components:
  schemas:
    AcceptInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AcceptInBody.json
          format: uri
          readOnly: true
          type: string
        code:
          minLength: 1
          type: string
      required:
        - code
      type: object
    AddFactsInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AddFactsInBody.json
          format: uri
          readOnly: true
          type: string
        facts:
          items:
            $ref: "#/components/schemas/ObservedFact"
          minItems: 1
          type:
            - array
            - "null"
        share:
          pattern: ^[0-9a-fA-F]{8}$
          type: string
        source_episode:
          pattern: ^[0-9a-fA-F]{8}$
          type: string
      required:
        - facts
      type: object
    AddFactsOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AddFactsOutBody.json
          format: uri
          readOnly: true
          type: string
        results:
          items:
            $ref: "#/components/schemas/FactOutcome"
          type:
            - array
            - "null"
      required:
        - results
      type: object
    AddPinOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AddPinOutBody.json
          format: uri
          readOnly: true
          type: string
        id:
          type: string
      required:
        - id
      type: object
    AddTodosInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AddTodosInput.json
          format: uri
          readOnly: true
          type: string
        items:
          items:
            $ref: "#/components/schemas/TodoItem"
          minItems: 1
          type:
            - array
            - "null"
        scope:
          minLength: 1
          type: string
        share:
          type: string
        source_episode:
          type: string
      required:
        - scope
        - items
      type: object
    AddTodosOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/AddTodosOutBody.json
          format: uri
          readOnly: true
          type: string
        results:
          items:
            $ref: "#/components/schemas/TodoOutcome"
          type:
            - array
            - "null"
      required:
        - results
      type: object
    Attachment:
      additionalProperties: false
      properties:
        title:
          type: string
        url:
          type: string
      required:
        - url
      type: object
    Change:
      additionalProperties: false
      properties:
        layer:
          type: string
        scope:
          type: string
        shared:
          type: boolean
      required:
        - layer
      type: object
    CloseFactInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/CloseFactInput.json
          format: uri
          readOnly: true
          type: string
        ended_at:
          format: date-time
          type: string
        reason:
          minLength: 1
          type: string
      required:
        - ended_at
        - reason
      type: object
    CloseFactResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/CloseFactResult.json
          format: uri
          readOnly: true
          type: string
        ended_at:
          format: date-time
          type: string
        fact:
          type: string
        id:
          type: string
        reason:
          type: string
        valid_from:
          format: date-time
          type: string
      required:
        - id
        - fact
        - ended_at
        - reason
      type: object
    CreateEpisodeOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/CreateEpisodeOutBody.json
          format: uri
          readOnly: true
          type: string
        id:
          type: string
        kind:
          type: string
        scope:
          type: string
      required:
        - id
        - scope
        - kind
      type: object
    DeleteEpisodeOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/DeleteEpisodeOutBody.json
          format: uri
          readOnly: true
          type: string
        entities_deleted:
          format: int64
          type: integer
        facts_deleted:
          format: int64
          type: integer
      required:
        - facts_deleted
        - entities_deleted
      type: object
    DeleteFactsResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/DeleteFactsResult.json
          format: uri
          readOnly: true
          type: string
        deleted:
          items:
            type: string
          type:
            - array
            - "null"
        nodes_removed:
          items:
            $ref: "#/components/schemas/SweptNode"
          type:
            - array
            - "null"
        not_found:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - deleted
      type: object
    DeleteTodosResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/DeleteTodosResult.json
          format: uri
          readOnly: true
          type: string
        deleted:
          items:
            type: string
          type:
            - array
            - "null"
        not_found:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - deleted
        - not_found
      type: object
    DescribeScopeInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/DescribeScopeInput.json
          format: uri
          readOnly: true
          type: string
        description:
          description: What kind of work is filed here. Only what does not change; empty clears
          type: string
        scope:
          minLength: 1
          type: string
      required:
        - scope
        - description
      type: object
    DescribeScopeResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/DescribeScopeResult.json
          format: uri
          readOnly: true
          type: string
        cleared:
          type: boolean
        scope:
          type: string
        stale_vector:
          type: string
        written:
          type: string
      required:
        - scope
      type: object
    EntityOutcome:
      additionalProperties: false
      properties:
        aliases:
          items:
            type: string
          type:
            - array
            - "null"
        changed:
          items:
            type: string
          type:
            - array
            - "null"
        created:
          type: boolean
        error:
          type: string
        id:
          type: string
        name:
          type: string
        same_legal_code:
          type: string
        unlinked:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - name
      type: object
    EpisodeOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/EpisodeOutBody.json
          format: uri
          readOnly: true
          type: string
        episode:
          $ref: "#/components/schemas/Event"
        facts:
          items:
            $ref: "#/components/schemas/ScoredFact"
          type:
            - array
            - "null"
        total:
          format: int64
          type: integer
      required:
        - episode
        - facts
        - total
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: "#/components/schemas/ErrorDetail"
          type:
            - array
            - "null"
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    Event:
      additionalProperties: false
      properties:
        attachments:
          items:
            $ref: "#/components/schemas/Attachment"
          type:
            - array
            - "null"
        author:
          type: string
        content:
          type: string
        id:
          type: string
        importance:
          format: float
          type: number
        kind:
          type: string
        no_facts_reason:
          type: string
        parent_id:
          type: string
        scope:
          type: string
        shared:
          type: boolean
        summary:
          type: string
        title:
          type: string
        ts:
          format: date-time
          type: string
      required:
        - id
        - kind
        - scope
        - ts
      type: object
    Extent:
      additionalProperties: false
      properties:
        from:
          format: date-time
          type: string
        to:
          format: date-time
          type: string
      type: object
    Fact:
      additionalProperties: false
      properties:
        attachments:
          items:
            $ref: "#/components/schemas/Attachment"
          type:
            - array
            - "null"
        author:
          type: string
        close_reason:
          type: string
        confidence:
          format: float
          type: number
        dst:
          type: string
        fact:
          type: string
        id:
          type: string
        importance:
          format: float
          type: number
        merged_into:
          type: string
        moment:
          type: boolean
        predicate:
          type: string
        recorded_at:
          format: date-time
          type: string
        revisions:
          items:
            $ref: "#/components/schemas/Revision"
          type:
            - array
            - "null"
        scope:
          type: string
        shared:
          type: boolean
        source:
          additionalProperties: {}
          type: object
        src:
          type: string
        supersedes:
          type: string
        valid_from:
          format: date-time
          type: string
        valid_to:
          format: date-time
          type: string
      required:
        - id
        - src
        - predicate
        - fact
        - scope
        - recorded_at
      type: object
    FactKey:
      additionalProperties: false
      properties:
        object:
          type: string
        object_id:
          type: string
        predicate:
          type: string
        scope:
          type: string
        subject:
          type: string
        subject_id:
          type: string
      required:
        - subject_id
        - subject
        - predicate
        - scope
      type: object
    FactOutcome:
      additionalProperties: false
      properties:
        cited_episodes:
          items:
            $ref: "#/components/schemas/UnlinkedEpisode"
          type:
            - array
            - "null"
        dated_ahead:
          format: date-time
          type: string
        error:
          type: string
        flipped:
          type: boolean
        id:
          type: string
        objectless_relation:
          type: boolean
        outside_life:
          items:
            $ref: "#/components/schemas/LifeClash"
          type:
            - array
            - "null"
        predicate:
          type: string
        start_is_write_time:
          type: boolean
      type: object
    IdsInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/IdsInBody.json
          format: uri
          readOnly: true
          type: string
        ids:
          items:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
          minItems: 1
          type:
            - array
            - "null"
      required:
        - ids
      type: object
    InviteInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/InviteInBody.json
          format: uri
          readOnly: true
          type: string
        access:
          default: read
          enum:
            - read
            - write
          type: string
        expires_at:
          description: Defaults to a week out; must be in the future
          format: date-time
          type: string
        scope:
          description: Covers this path and everything under it
          minLength: 1
          type: string
      required:
        - scope
        - access
      type: object
    LifeClash:
      additionalProperties: false
      properties:
        bound:
          format: date-time
          type: string
        case:
          type: string
        entity:
          type: string
        kind:
          type: string
        side:
          type: string
      required:
        - entity
        - side
        - case
        - bound
      type: object
    ListEntitiesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListEntitiesOutBody.json
          format: uri
          readOnly: true
          type: string
        entities:
          items:
            $ref: "#/components/schemas/Node"
          type:
            - array
            - "null"
        matched:
          type: string
        not_searched:
          items:
            type: string
          type:
            - array
            - "null"
        total:
          format: int64
          type: integer
      required:
        - entities
      type: object
    ListEpisodesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListEpisodesOutBody.json
          format: uri
          readOnly: true
          type: string
        episodes:
          items:
            $ref: "#/components/schemas/Event"
          type:
            - array
            - "null"
        matched:
          format: int64
          type: integer
        not_searched:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - episodes
      type: object
    ListFactsOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListFactsOutBody.json
          format: uri
          readOnly: true
          type: string
        facts:
          items:
            $ref: "#/components/schemas/ScoredFact"
          type:
            - array
            - "null"
        observed:
          $ref: "#/components/schemas/Extent"
        total:
          format: int64
          type: integer
      required:
        - facts
        - total
      type: object
    ListPinsOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListPinsOutBody.json
          format: uri
          readOnly: true
          type: string
        pins:
          items:
            $ref: "#/components/schemas/Pin"
          type:
            - array
            - "null"
      required:
        - pins
      type: object
    ListSkillsOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListSkillsOutBody.json
          format: uri
          readOnly: true
          type: string
        browse:
          items:
            $ref: "#/components/schemas/SkillBrief"
          type:
            - array
            - "null"
        skills:
          items:
            $ref: "#/components/schemas/Skill"
          type:
            - array
            - "null"
        total:
          format: int64
          type: integer
      type: object
    ListTodosOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ListTodosOutBody.json
          format: uri
          readOnly: true
          type: string
        todos:
          items:
            $ref: "#/components/schemas/Todo"
          type:
            - array
            - "null"
        total:
          format: int64
          type: integer
      required:
        - todos
      type: object
    MarkNoFactsInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MarkNoFactsInput.json
          format: uri
          readOnly: true
          type: string
        reason:
          minLength: 1
          type: string
      required:
        - reason
      type: object
    MarkNoFactsResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MarkNoFactsResult.json
          format: uri
          readOnly: true
          type: string
        journal:
          type: string
        lost:
          type: string
        was:
          type: string
      type: object
    MergeFactsInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MergeFactsInput.json
          format: uri
          readOnly: true
          type: string
        at:
          format: date-time
          type: string
        fact:
          minLength: 1
          type: string
        parents:
          items:
            type: string
          minItems: 2
          type:
            - array
            - "null"
        reason:
          minLength: 1
          type: string
      required:
        - parents
        - fact
        - reason
      type: object
    MergeFactsOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MergeFactsOutBody.json
          format: uri
          readOnly: true
          type: string
        id:
          type: string
      required:
        - id
      type: object
    MergeNodesInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MergeNodesInput.json
          format: uri
          readOnly: true
          type: string
        from:
          minLength: 1
          type: string
        into:
          minLength: 1
          type: string
      required:
        - from
        - into
      type: object
    MergeNodesResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MergeNodesResult.json
          format: uri
          readOnly: true
          type: string
        from:
          type: string
        into:
          type: string
        stats:
          $ref: "#/components/schemas/MergeStats"
      required:
        - from
        - into
        - stats
      type: object
    MergeStats:
      additionalProperties: false
      properties:
        dropped_description:
          type: string
        edges_dropped:
          format: int64
          type: integer
        edges_moved:
          format: int64
          type: integer
        self_loops:
          format: int64
          type: integer
        skills_linked:
          format: int64
          type: integer
      required:
        - edges_moved
        - edges_dropped
        - self_loops
        - skills_linked
      type: object
    MoveEpisodeInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MoveEpisodeInput.json
          format: uri
          readOnly: true
          type: string
        share:
          type: string
        to:
          minLength: 1
          type: string
      required:
        - to
      type: object
    MoveEpisodeResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MoveEpisodeResult.json
          format: uri
          readOnly: true
          type: string
        facts:
          format: int64
          type: integer
        now:
          type: string
        was:
          type: string
      required:
        - was
        - now
        - facts
      type: object
    MoveScopeInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MoveScopeInput.json
          format: uri
          readOnly: true
          type: string
        from:
          minLength: 1
          type: string
        to:
          minLength: 1
          type: string
      required:
        - from
        - to
      type: object
    MoveScopeResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/MoveScopeResult.json
          format: uri
          readOnly: true
          type: string
        from:
          type: string
        moved:
          additionalProperties:
            format: int64
            type: integer
          type: object
        to:
          type: string
        total:
          format: int64
          type: integer
      required:
        - from
        - to
        - moved
        - total
      type: object
    Node:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/Node.json
          format: uri
          readOnly: true
          type: string
        aliases:
          items:
            type: string
          type:
            - array
            - "null"
        as_object_of:
          items:
            type: string
          type:
            - array
            - "null"
        created_at:
          format: date-time
          type: string
        degree:
          format: int64
          type: integer
        description:
          type: string
        id:
          type: string
        kind:
          type: string
        life_from:
          format: date-time
          type: string
        life_to:
          format: date-time
          type: string
        name:
          type: string
        object_degree:
          format: int64
          type: integer
        props:
          additionalProperties: {}
          type: object
        similarity:
          format: float
          type: number
        skill_degree:
          format: int64
          type: integer
        subject_degree:
          format: int64
          type: integer
      required:
        - id
        - kind
        - name
        - created_at
      type: object
    ObserveInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ObserveInput.json
          format: uri
          readOnly: true
          type: string
        attachments:
          items:
            $ref: "#/components/schemas/Attachment"
          type:
            - array
            - "null"
        content:
          minLength: 1
          type: string
        kind:
          type: string
        no_facts_reason:
          type: string
        parent_id:
          type: string
        scope:
          minLength: 1
          type: string
        share:
          type: string
        summary:
          minLength: 1
          type: string
        title:
          minLength: 1
          type: string
        ts:
          format: date-time
          type: string
      required:
        - content
        - title
        - summary
        - scope
      type: object
    ObservedFact:
      additionalProperties: false
      properties:
        attachments:
          items:
            $ref: "#/components/schemas/Attachment"
          type:
            - array
            - "null"
        confidence:
          format: float
          maximum: 1
          minimum: 0
          type: number
        fact:
          minLength: 1
          type: string
        moment:
          type: boolean
        object_id:
          type: string
        predicate:
          minLength: 1
          type: string
        scope:
          minLength: 1
          type: string
        source_episode:
          type: string
        start_unknown:
          type: boolean
        subject_id:
          type: string
        supersedes:
          type: string
        valid_from:
          format: date-time
          type: string
        valid_to:
          format: date-time
          type: string
        why_ended:
          type: string
      required:
        - scope
        - subject_id
        - predicate
        - fact
      type: object
    PathNode:
      additionalProperties: false
      properties:
        id:
          type: string
        kind:
          type: string
        name:
          type: string
      required:
        - id
        - name
      type: object
    Pin:
      additionalProperties: false
      properties:
        author:
          type: string
        id:
          type: string
        scope:
          type: string
        text:
          type: string
        ttl:
          format: date-time
          type:
            - string
            - "null"
      required:
        - id
        - scope
        - author
        - text
        - ttl
      type: object
    PinInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/PinInput.json
          format: uri
          readOnly: true
          type: string
        scope:
          type: string
        share:
          type: string
        text:
          minLength: 1
          type: string
        ttl:
          format: date-time
          type: string
      required:
        - text
        - scope
      type: object
    PinUpdateInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/PinUpdateInput.json
          format: uri
          readOnly: true
          type: string
        text:
          minLength: 1
          type: string
        ttl:
          format: date-time
          type: string
      required:
        - text
      type: object
    Predicate:
      additionalProperties: false
      properties:
        family:
          type: string
        gloss:
          type: string
        key:
          type: string
        long_lived:
          type: boolean
        subject_kinds:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - key
        - gloss
        - family
      type: object
    PredicatesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/PredicatesOutBody.json
          format: uri
          readOnly: true
          type: string
        families:
          items:
            type: string
          type:
            - array
            - "null"
        predicates:
          items:
            $ref: "#/components/schemas/Predicate"
          type:
            - array
            - "null"
      required:
        - predicates
        - families
      type: object
    ReachResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ReachResult.json
          format: uri
          readOnly: true
          type: string
        broken:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
        from:
          $ref: "#/components/schemas/Node"
        leads:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
        max_hops:
          format: int64
          type: integer
        routes:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
      required:
        - from
        - max_hops
      type: object
    RedateFactInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RedateFactInput.json
          format: uri
          readOnly: true
          type: string
        reason:
          type: string
        reopen:
          type: boolean
        start_unknown:
          type: boolean
        valid_from:
          format: date-time
          type: string
        valid_to:
          format: date-time
          type: string
      type: object
    RedateFactResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RedateFactResult.json
          format: uri
          readOnly: true
          type: string
        fact:
          type: string
        id:
          type: string
        now:
          format: date-time
          type: string
        revisions:
          format: int64
          type: integer
        until:
          format: date-time
          type: string
        was:
          format: date-time
          type: string
        was_until:
          format: date-time
          type: string
      required:
        - id
        - fact
        - was
        - now
      type: object
    RepointFactInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RepointFactInput.json
          format: uri
          readOnly: true
          type: string
        chain:
          items:
            type: string
          type:
            - array
            - "null"
        drop_object:
          type: boolean
        object_id:
          type: string
        predicate:
          type: string
        scope:
          type: string
        subject_id:
          type: string
      type: object
    RepointFactResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RepointFactResult.json
          format: uri
          readOnly: true
          type: string
        fact:
          type: string
        id:
          type: string
        moved:
          format: int64
          type: integer
        nodes_removed:
          items:
            $ref: "#/components/schemas/SweptNode"
          type:
            - array
            - "null"
        now:
          $ref: "#/components/schemas/FactKey"
        was:
          $ref: "#/components/schemas/FactKey"
      required:
        - id
        - fact
        - was
        - now
        - moved
      type: object
    Revision:
      additionalProperties: false
      properties:
        at:
          format: date-time
          type: string
        field:
          type: string
        reason:
          type: string
        was:
          type: string
      required:
        - at
        - field
        - was
      type: object
    RevokeInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RevokeInBody.json
          format: uri
          readOnly: true
          type: string
        grantee:
          type: string
        scope:
          minLength: 1
          type: string
      required:
        - scope
      type: object
    RevokeOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RevokeOutBody.json
          format: uri
          readOnly: true
          type: string
        revoked:
          format: int64
          type: integer
      required:
        - revoked
      type: object
    RewordFactInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RewordFactInput.json
          format: uri
          readOnly: true
          type: string
        fact:
          minLength: 1
          type: string
        reason:
          type: string
      required:
        - fact
      type: object
    RewordFactResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RewordFactResult.json
          format: uri
          readOnly: true
          type: string
        revisions:
          format: int64
          type: integer
        was:
          type: string
      type: object
    Route:
      additionalProperties: false
      properties:
        derived:
          format: int64
          type: integer
        disjoint:
          format: int64
          type: integer
        door:
          type: string
        door_id:
          type: string
        ended:
          format: int64
          type: integer
        hops:
          format: int64
          type: integer
        kind:
          type: string
        path:
          items:
            $ref: "#/components/schemas/PathNode"
          type:
            - array
            - "null"
        person:
          type: string
        person_id:
          type: string
        severed:
          format: int64
          type: integer
        steps:
          items:
            $ref: "#/components/schemas/Step"
          type:
            - array
            - "null"
        via:
          type: string
        via_id:
          type: string
      required:
        - person_id
        - person
        - kind
        - hops
        - steps
      type: object
    RoutesResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/RoutesResult.json
          format: uri
          readOnly: true
          type: string
        broken:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
        from:
          $ref: "#/components/schemas/Node"
        gone_reason:
          type: string
        gone_since:
          format: date-time
          type: string
        leads:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
        max_hops:
          format: int64
          type: integer
        mine:
          type: boolean
        no_self:
          type: boolean
        routes:
          items:
            $ref: "#/components/schemas/Route"
          type:
            - array
            - "null"
        target:
          $ref: "#/components/schemas/Node"
      required:
        - target
        - max_hops
      type: object
    SaveEntitiesInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SaveEntitiesInBody.json
          format: uri
          readOnly: true
          type: string
        entities:
          items:
            $ref: "#/components/schemas/SaveEntityInput"
          minItems: 1
          type:
            - array
            - "null"
      required:
        - entities
      type: object
    SaveEntitiesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SaveEntitiesOutBody.json
          format: uri
          readOnly: true
          type: string
        created:
          format: int64
          type: integer
        results:
          items:
            $ref: "#/components/schemas/EntityOutcome"
          type:
            - array
            - "null"
        undescribed:
          format: int64
          type: integer
      required:
        - results
      type: object
    SaveEntityInput:
      additionalProperties: false
      properties:
        aliases:
          items:
            type: string
          type:
            - array
            - "null"
        description:
          type: string
        kind:
          enum:
            - person
            - project
            - host
            - company
            - device
            - product
            - concept
            - event
            - location
            - document
          type: string
        life_from:
          format: date-time
          type: string
        life_to:
          format: date-time
          type: string
        name:
          minLength: 1
          type: string
      required:
        - name
        - kind
      type: object
    SaveSkillInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SaveSkillInput.json
          format: uri
          readOnly: true
          type: string
        body:
          minLength: 1
          type: string
        related_node_names:
          items:
            type: string
          type:
            - array
            - "null"
        scope:
          minLength: 1
          type: string
        share:
          type: string
        success_rate:
          format: float
          maximum: 1
          minimum: 0
          type: number
        trigger:
          minLength: 1
          type: string
      required:
        - trigger
        - body
        - scope
      type: object
    SaveSkillResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SaveSkillResult.json
          format: uri
          readOnly: true
          type: string
        bulky:
          type: string
        id:
          type: string
        linked:
          items:
            type: string
          type:
            - array
            - "null"
        stale_vector:
          type: string
        unresolved:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - id
        - linked
        - unresolved
        - bulky
        - stale_vector
      type: object
    ScopeShare:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ScopeShare.json
          format: uri
          readOnly: true
          type: string
        access:
          type: string
        created_at:
          format: date-time
          type: string
        grantee_tenant:
          type: string
        id:
          type: string
        owner_tenant:
          type: string
        scope:
          type: string
      required:
        - id
        - owner_tenant
        - scope
        - grantee_tenant
        - access
        - created_at
      type: object
    ScopeStat:
      additionalProperties: false
      properties:
        description:
          type: string
        episodes:
          format: int64
          type: integer
        facts:
          format: int64
          type: integer
        last_activity:
          format: date-time
          type: string
        owner:
          type: string
        pins:
          format: int64
          type: integer
        scope:
          type: string
        skills:
          format: int64
          type: integer
        todos:
          format: int64
          type: integer
      required:
        - scope
        - facts
        - episodes
        - todos
        - skills
        - pins
        - last_activity
      type: object
    ScopesResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ScopesResult.json
          format: uri
          readOnly: true
          type: string
        scopes:
          items:
            $ref: "#/components/schemas/ScopeStat"
          type:
            - array
            - "null"
        total:
          format: int64
          type: integer
        undescribed:
          format: int64
          type: integer
      required:
        - scopes
        - total
        - undescribed
      type: object
    ScoredFact:
      additionalProperties: false
      properties:
        chain_total:
          format: int64
          type: integer
        fact:
          $ref: "#/components/schemas/Fact"
        object:
          $ref: "#/components/schemas/Node"
        predecessors:
          format: int64
          type: integer
        relevance:
          format: float
          type: number
        score:
          format: float
          type: number
        subject:
          $ref: "#/components/schemas/Node"
        via:
          type: string
      required:
        - fact
        - subject
      type: object
    SelfResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SelfResult.json
          format: uri
          readOnly: true
          type: string
        node:
          $ref: "#/components/schemas/Node"
      type: object
    SetSkillStateInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SetSkillStateInBody.json
          format: uri
          readOnly: true
          type: string
        target:
          type: string
        value:
          maxLength: 4000
          type: string
      required:
        - target
        - value
      type: object
    ShareAccessInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ShareAccessInBody.json
          format: uri
          readOnly: true
          type: string
        access:
          enum:
            - read
            - write
          type: string
      required:
        - access
      type: object
    ShareInvite:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/ShareInvite.json
          format: uri
          readOnly: true
          type: string
        access:
          type: string
        claimed_at:
          format: date-time
          type: string
        claimed_by:
          type: string
        code:
          type: string
        created_at:
          format: date-time
          type: string
        expires_at:
          format: date-time
          type: string
        owner_tenant:
          type: string
        scope:
          type: string
      required:
        - code
        - owner_tenant
        - scope
        - access
        - created_at
        - expires_at
      type: object
    SharesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SharesOutBody.json
          format: uri
          readOnly: true
          type: string
        by_me:
          items:
            $ref: "#/components/schemas/ScopeShare"
          type:
            - array
            - "null"
        invites:
          items:
            $ref: "#/components/schemas/ShareInvite"
          type:
            - array
            - "null"
        to_me:
          items:
            $ref: "#/components/schemas/ScopeShare"
          type:
            - array
            - "null"
      required:
        - to_me
        - by_me
        - invites
      type: object
    Skill:
      additionalProperties: false
      properties:
        author:
          type: string
        body:
          type: string
        id:
          type: string
        last_used:
          format: date-time
          type:
            - string
            - "null"
        related_node_names:
          items:
            type: string
          type:
            - array
            - "null"
        related_nodes:
          items:
            type: string
          type:
            - array
            - "null"
        scope:
          type: string
        success_rate:
          format: float
          type: number
        trigger:
          type: string
        uses:
          format: int64
          type: integer
      required:
        - id
        - trigger
        - scope
        - author
        - success_rate
        - uses
        - last_used
        - body
        - related_nodes
        - related_node_names
      type: object
    SkillBrief:
      additionalProperties: false
      properties:
        body_chars:
          format: int64
          type: integer
        id:
          type: string
        scope:
          type: string
        searchable:
          type: boolean
        success_rate:
          format: float
          type: number
        trigger:
          type: string
        uses:
          format: int64
          type: integer
      required:
        - id
        - trigger
        - scope
        - success_rate
        - uses
        - body_chars
        - searchable
      type: object
    SkillFeedbackInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SkillFeedbackInBody.json
          format: uri
          readOnly: true
          type: string
        worked:
          type:
            - boolean
            - "null"
      required:
        - worked
      type: object
    SkillFeedbackOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SkillFeedbackOutBody.json
          format: uri
          readOnly: true
          type: string
        recorded:
          type: boolean
      required:
        - recorded
      type: object
    SkillOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/SkillOutBody.json
          format: uri
          readOnly: true
          type: string
        skill:
          $ref: "#/components/schemas/Skill"
      required:
        - skill
      type: object
    StatesOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/StatesOutBody.json
          format: uri
          readOnly: true
          type: string
        other_targets:
          items:
            type: string
          type:
            - array
            - "null"
        states:
          items:
            $ref: "#/components/schemas/TaskState"
          type:
            - array
            - "null"
      required:
        - states
      type: object
    Step:
      additionalProperties: false
      properties:
        dir:
          type: string
        disjoint:
          type: boolean
        ended:
          type: boolean
        fact:
          type: string
        gone:
          type: string
        inferred:
          type: boolean
        predicate:
          type: string
        scope:
          type: string
        shared:
          type: boolean
        valid_from:
          format: date-time
          type: string
        valid_to:
          format: date-time
          type: string
      required:
        - predicate
        - fact
        - scope
        - dir
      type: object
    SweptNode:
      additionalProperties: false
      properties:
        id:
          type: string
        name:
          type: string
      required:
        - id
        - name
      type: object
    TaskState:
      additionalProperties: false
      properties:
        skill_id:
          type: string
        target:
          type: string
        updated_at:
          format: date-time
          type: string
        value:
          type: string
      required:
        - skill_id
        - target
        - value
        - updated_at
      type: object
    Todo:
      additionalProperties: false
      properties:
        author:
          type: string
        closed_at:
          format: date-time
          type:
            - string
            - "null"
        created_at:
          format: date-time
          type: string
        detail:
          type: string
        due:
          format: date-time
          type:
            - string
            - "null"
        id:
          type: string
        scope:
          type: string
        source_episode:
          type: string
        status:
          type: string
        title:
          type: string
        updated_at:
          format: date-time
          type: string
      required:
        - id
        - author
        - scope
        - title
        - detail
        - status
        - due
        - created_at
        - updated_at
        - closed_at
      type: object
    TodoItem:
      additionalProperties: false
      properties:
        detail:
          type: string
        due:
          format: date-time
          type: string
        title:
          minLength: 1
          type: string
      required:
        - title
      type: object
    TodoOutcome:
      additionalProperties: false
      properties:
        duplicate:
          type: boolean
        error:
          type: string
        id:
          type: string
      type: object
    TodoPatchInput:
      additionalProperties: false
      properties:
        clear_due:
          type: boolean
        detail:
          type: string
        due:
          format: date-time
          type: string
        id:
          type: string
        scope:
          type: string
        status:
          type: string
        title:
          type: string
      required:
        - id
      type: object
    TodoUpdateOutcome:
      additionalProperties: false
      properties:
        error:
          type: string
        found:
          type: boolean
        id:
          type: string
      required:
        - id
        - found
        - error
      type: object
    UnlinkedEpisode:
      additionalProperties: false
      properties:
        id:
          type: string
        scope:
          type: string
        title:
          type: string
        ts:
          format: date-time
          type: string
      required:
        - id
        - ts
      type: object
    UpdateEntityInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateEntityInput.json
          format: uri
          readOnly: true
          type: string
        aliases:
          items:
            type: string
          type:
            - array
            - "null"
        clear_life_from:
          type: boolean
        clear_life_to:
          type: boolean
        description:
          type: string
        kind:
          enum:
            - person
            - project
            - host
            - company
            - device
            - product
            - concept
            - event
            - location
            - document
          type: string
        life_from:
          format: date-time
          type: string
        life_to:
          format: date-time
          type: string
        name:
          type: string
      type: object
    UpdateEntityResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateEntityResult.json
          format: uri
          readOnly: true
          type: string
        aliases:
          items:
            type: string
          type:
            - array
            - "null"
        aliases_set:
          type: boolean
        described:
          type: boolean
        description:
          type: string
        id:
          type: string
        kind:
          type: string
        life_from:
          format: date-time
          type: string
        life_set:
          type: boolean
        life_to:
          format: date-time
          type: string
        name:
          type: string
        unchanged:
          type: boolean
        was_kind:
          type: string
        was_name:
          type: string
      required:
        - id
        - name
        - kind
      type: object
    UpdatePinOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdatePinOutBody.json
          format: uri
          readOnly: true
          type: string
        updated:
          type: boolean
      required:
        - updated
      type: object
    UpdateSkillInput:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateSkillInput.json
          format: uri
          readOnly: true
          type: string
        related_node_names:
          items:
            type: string
          type:
            - array
            - "null"
        replace_new:
          type: string
        replace_old:
          type: string
        success_rate:
          format: float
          type: number
        trigger:
          type: string
      type: object
    UpdateSkillResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateSkillResult.json
          format: uri
          readOnly: true
          type: string
        body_chars:
          format: int64
          type: integer
        bulky:
          type: string
        changed:
          items:
            type: string
          type:
            - array
            - "null"
        id:
          type: string
        linked:
          items:
            type: string
          type:
            - array
            - "null"
        stale_vector:
          type: string
        unresolved:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - id
        - changed
        - bulky
        - stale_vector
        - body_chars
        - linked
        - unresolved
      type: object
    UpdateTodosInBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateTodosInBody.json
          format: uri
          readOnly: true
          type: string
        patches:
          items:
            $ref: "#/components/schemas/TodoPatchInput"
          minItems: 1
          type:
            - array
            - "null"
      required:
        - patches
      type: object
    UpdateTodosOutBody:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UpdateTodosOutBody.json
          format: uri
          readOnly: true
          type: string
        results:
          items:
            $ref: "#/components/schemas/TodoUpdateOutcome"
          type:
            - array
            - "null"
      required:
        - results
      type: object
    UseFactsResult:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/api/schemas/UseFactsResult.json
          format: uri
          readOnly: true
          type: string
        not_found:
          items:
            type: string
          type:
            - array
            - "null"
        recorded:
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - recorded
      type: object
info:
  description: "Episodes, facts, entities and scopes of one mnemos tenant. Writes are verbs rather than PUT: a fact that stopped being true is closed, never updated in place."
  title: mnemos
  version: 6340dce
openapi: 3.1.0
paths:
  /api/changes:
    get:
      description: "Server-sent events, one per write that this caller may see. An event names the LAYER that moved and, for the caller's own memory, the SCOPE — never an id and never a row: what may be read is decided by the read endpoints, with their visibility predicates, and a stream handing rows out would be a second read path to keep in step with the first forever. `shared` marks a write into a scope somebody else owns and granted; its scope is withheld, because a path is a disclosure of its own. An event with no `layer` means the stream fell behind and something was dropped: re-read whatever is on screen."
      operationId: watch-changes
      responses:
        "200":
          content:
            text/event-stream:
              schema:
                description: Each oneOf object in the array represents one possible Server Sent Events (SSE) message, serialized as UTF-8 text according to the SSE specification.
                items:
                  oneOf:
                    - properties:
                        data:
                          $ref: "#/components/schemas/Change"
                        event:
                          const: change
                          description: The event name.
                          type: string
                        id:
                          description: The event ID.
                          type: integer
                        retry:
                          description: The retry time in milliseconds.
                          type: integer
                      required:
                        - data
                        - event
                      title: Event change
                      type: object
                title: Server Sent Events
                type: array
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Stream of what moved in this tenant's memory
      tags:
        - changes
  /api/entities:
    get:
      operationId: list-entities
      parameters:
        - description: One entity name per value, each searched separately
          explode: false
          in: query
          name: query
          schema:
            description: One entity name per value, each searched separately
            items:
              type: string
            type:
              - array
              - "null"
        - description: Read these entities by id; composes with the other filters
          explode: false
          in: query
          name: node_ids
          schema:
            description: Read these entities by id; composes with the other filters
            items:
              type: string
            type:
              - array
              - "null"
        - explode: false
          in: query
          name: kind
          schema:
            enum:
              - person
              - project
              - host
              - company
              - device
              - product
              - concept
              - event
              - location
              - document
            type: string
        - description: PER NAME, not a total
          explode: false
          in: query
          name: limit
          schema:
            default: 5
            description: PER NAME, not a total
            format: int64
            maximum: 50
            minimum: 1
            type: integer
        - description: Skip this many rows of a browse; refused with query
          explode: false
          in: query
          name: offset
          schema:
            description: Skip this many rows of a browse; refused with query
            format: int64
            minimum: 0
            type: integer
        - description: Only entities some fact of this area is about; browse only
          explode: false
          in: query
          name: scope
          schema:
            description: Only entities some fact of this area is about; browse only
            type: string
        - description: How the scope is traversed
          explode: false
          in: query
          name: direction
          schema:
            description: How the scope is traversed
            enum:
              - descendants
              - ancestors
              - exact
            type: string
        - description: Rank by meaning over name+description instead of trigram over the name
          explode: false
          in: query
          name: use_embed
          schema:
            description: Rank by meaning over name+description instead of trigram over the name
            type: boolean
        - description: Admission floor; -1 uses the server default
          explode: false
          in: query
          name: similarity
          schema:
            default: -1
            description: Admission floor; -1 uses the server default
            format: float
            maximum: 1
            minimum: -1
            type: number
        - description: At most this many facts; 0 finds true orphans, -1 disables the filter
          explode: false
          in: query
          name: max_degree
          schema:
            default: -1
            description: At most this many facts; 0 finds true orphans, -1 disables the filter
            format: int64
            minimum: -1
            type: integer
        - description: "object_only: never stands as a subject, i.e. probably a label rather than an entity"
          explode: false
          in: query
          name: role
          schema:
            description: "object_only: never stands as a subject, i.e. probably a label rather than an entity"
            enum:
              - object_only
            type: string
        - description: Omit for either
          explode: false
          in: query
          name: has_description
          schema:
            description: Omit for either
            enum:
              - "true"
              - "false"
            type: string
        - description: Description at most this many CHARACTERS; -1 disables the filter
          explode: false
          in: query
          name: description_max_chars
          schema:
            default: -1
            description: Description at most this many CHARACTERS; -1 disables the filter
            format: int64
            minimum: -1
            type: integer
        - explode: false
          in: query
          name: created_after
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: created_before
          schema:
            format: date-time
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListEntitiesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Resolve entity names, or browse and audit them with no query at all
      tags:
        - entities
    post:
      operationId: create-entities
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SaveEntitiesInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SaveEntitiesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Create entities. An existing name returns its id rather than a second row
      tags:
        - entities
  /api/entities/merge:
    post:
      operationId: merge-entities
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MergeNodesInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MergeNodesResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Fold a duplicate into the canonical entity, keeping its facts, name and spellings
      tags:
        - entities
  /api/entities/{id}:
    delete:
      operationId: delete-entity
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Remove an entity nothing states anything about. REFUSED while any fact references it
      tags:
        - entities
    patch:
      operationId: update-entity
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateEntityInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateEntityResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Edit name, kind, description or aliases. A field nobody named does not move
      tags:
        - entities
  /api/entities/{id}/reach:
    get:
      description: |-
        The mirror of `routes`: the same walk with the far end unbound, so instead of the people who reach one target it returns everywhere one entity gets to. Same cost policy, same marks for ended links, guesses and severed steps.

        Read from the other end: a route is walked BACK to you and printed person → … → target, while this starts where you already are, so the anchor comes first.

        `leads` is a SEPARATE list here too — chains resting on an overlap in time nobody stated.
      operationId: entity-reach
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - explode: false
          in: query
          name: max_hops
          schema:
            format: int64
            maximum: 4
            minimum: 1
            type: integer
        - explode: false
          in: query
          name: limit
          schema:
            format: int64
            maximum: 25
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReachResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: What this entity OPENS — everyone it gets to
      tags:
        - entities
  /api/entities/{id}/routes:
    get:
      description: |-
        Walks the graph BACKWARD from the entity and returns the people who reach it, shortest route first. It is not a mode of recall and answers a different question: recall ranks by closeness to words, so a question naming no person never starts at one, and a densely connected neighbour buries the single link that reaches the target. Nothing here is ranked — a route exists or it does not.

        Ended relationships are walked and marked: somebody who USED to work there is one of the three ordinary ways in.

        `leads` is a SEPARATE list and is not routes: chains resting on an overlap in time that nobody stated. An overlap says neither that the two ever met nor that either can be asked for anything — it is where the connection nobody writes down lives, and it is a thing to check rather than to act on.
      operationId: routes-to-entity
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - explode: false
          in: query
          name: from_id
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - explode: false
          in: query
          name: max_hops
          schema:
            format: int64
            maximum: 4
            minimum: 1
            type: integer
        - explode: false
          in: query
          name: limit
          schema:
            format: int64
            maximum: 25
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoutesResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Who do I go through to reach this entity, and by what chain
      tags:
        - entities
  /api/entities/{id}/self:
    post:
      description: "Without a centre, \"the people I know\" and \"the people that exist\" are the same set: a route has nowhere to start and no way to tell a contact from a stranger three steps into somebody else's network. It must be a person."
      operationId: set-self
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Node"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Mark this entity as the account's own — the centre of its graph
      tags:
        - entities
  /api/episodes:
    get:
      operationId: list-episodes
      parameters:
        - description: Namespace to read; empty = the whole tenant
          explode: false
          in: query
          name: scope
          schema:
            description: Namespace to read; empty = the whole tenant
            type: string
        - description: How Scope is walked. Default descendants (self + subtree)
          explode: false
          in: query
          name: direction
          schema:
            description: How Scope is walked. Default descendants (self + subtree)
            enum:
              - descendants
              - ancestors
              - exact
            type: string
        - description: Concepts to search for, one per value. Omit to browse by time
          explode: false
          in: query
          name: query
          schema:
            description: Concepts to search for, one per value. Omit to browse by time
            items:
              type: string
            type:
              - array
              - "null"
        - explode: false
          in: query
          name: kind
          schema:
            items:
              enum:
                - message
                - tool_call
                - observation
                - decision
                - correction
                - reflection
              type: string
            type:
              - array
              - "null"
        - explode: false
          in: query
          name: since
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: until
          schema:
            format: date-time
            type: string
        - description: Only episodes no fact cites — the structuring worklist
          explode: false
          in: query
          name: unstructured
          schema:
            description: Only episodes no fact cites — the structuring worklist
            type: boolean
        - explode: false
          in: query
          name: oldest_first
          schema:
            type: boolean
        - explode: false
          in: query
          name: limit
          schema:
            default: 25
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: Skip this many rows of the same ordering (browse only — refused with query)
          explode: false
          in: query
          name: offset
          schema:
            default: 0
            description: Skip this many rows of the same ordering (browse only — refused with query)
            format: int64
            minimum: 0
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListEpisodesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: List or search episodes. The body is omitted — fetch one by id for it
      tags:
        - episodes
    post:
      operationId: create-episode
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ObserveInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateEpisodeOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Append an episode to the log
      tags:
        - episodes
  /api/episodes/{id}:
    delete:
      operationId: delete-episode
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteEpisodeOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Remove an episode AND the facts drawn from it — only for what should never have been written
      tags:
        - episodes
    get:
      operationId: get-episode
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - description: How many of the facts drawn from this episode to return
          explode: false
          in: query
          name: limit
          schema:
            default: 20
            description: How many of the facts drawn from this episode to return
            format: int64
            maximum: 100
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EpisodeOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: One episode with its body and the facts drawn from it
      tags:
        - episodes
  /api/episodes/{id}/move:
    post:
      operationId: move-episode
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MoveEpisodeInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MoveEpisodeResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Re-file a misfiled episode, with the facts that share its scope
      tags:
        - episodes
  /api/episodes/{id}/no-facts:
    post:
      operationId: declare-episode-factless
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MarkNoFactsInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarkNoFactsResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Record WHY an episode establishes no fact — a reason, not a flag
      tags:
        - episodes
  /api/facts:
    delete:
      operationId: delete-facts
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdsInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteFactsResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Remove facts that were NEVER true. One that stopped being true is closed instead
      tags:
        - facts
    get:
      operationId: list-facts
      parameters:
        - description: Every fact touching this entity, in either position
          explode: false
          in: query
          name: node_id
          schema:
            description: Every fact touching this entity, in either position
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - explode: false
          in: query
          name: scope
          schema:
            type: string
        - explode: false
          in: query
          name: direction
          schema:
            enum:
              - descendants
              - ancestors
              - exact
            type: string
        - description: "Bi-temporal pivot: answer as of this instant. Default now, so a superseded statement is ABSENT rather than ranked low"
          explode: false
          in: query
          name: at
          schema:
            description: "Bi-temporal pivot: answer as of this instant. Default now, so a superseded statement is ABSENT rather than ranked low"
            format: date-time
            type: string
        - description: Include superseded facts, grouped by chain, newest first within each
          explode: false
          in: query
          name: history
          schema:
            description: Include superseded facts, grouped by chain, newest first within each
            type: boolean
        - description: "With history: the cap PER CHAIN rather than over the whole reply, which would cut inside whichever chain sorts there. 0 lifts it"
          explode: false
          in: query
          name: per_key
          schema:
            default: 5
            description: "With history: the cap PER CHAIN rather than over the whole reply, which would cut inside whichever chain sorts there. 0 lifts it"
            format: int64
            maximum: 50
            minimum: 0
            type: integer
        - explode: false
          in: query
          name: recorded_after
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: recorded_before
          schema:
            format: date-time
            type: string
        - description: Read these facts by id (not node ids)
          explode: false
          in: query
          name: fact_ids
          schema:
            description: Read these facts by id (not node ids)
            items:
              type: string
            type:
              - array
              - "null"
        - description: Only facts with no source episode
          explode: false
          in: query
          name: no_source
          schema:
            description: Only facts with no source episode
            type: boolean
        - description: Words to look for in the SENTENCE. Needs missing_predicate
          explode: false
          in: query
          name: prose_words
          schema:
            description: Words to look for in the SENTENCE. Needs missing_predicate
            items:
              type: string
            type:
              - array
              - "null"
        - description: Only subjects of this kind. Empty = any
          explode: false
          in: query
          name: subject_kind
          schema:
            description: Only subjects of this kind. Empty = any
            enum:
              - person
              - organization
              - project
              - product
              - place
              - event
              - concept
              - document
              - tool
              - source
            type: string
        - description: The edge that should exist and does not. Needs prose_words
          explode: false
          in: query
          name: missing_predicate
          schema:
            description: The edge that should exist and does not. Needs prose_words
            type: string
        - description: Only objectless facts naming a person or company the subject has no fact with
          explode: false
          in: query
          name: prose_relation
          schema:
            description: Only objectless facts naming a person or company the subject has no fact with
            type: boolean
        - explode: false
          in: query
          name: limit
          schema:
            default: 25
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: Skip this many rows of the same ordering (browse paths only)
          explode: false
          in: query
          name: offset
          schema:
            default: 0
            description: Skip this many rows of the same ordering (browse paths only)
            format: int64
            minimum: 0
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListFactsOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Facts of an entity, of a scope, or of a window of write time
      tags:
        - facts
    post:
      operationId: add-facts
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddFactsInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddFactsOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Write facts. A statement superseding an open one CLOSES it and keeps it
      tags:
        - facts
  /api/facts/merge:
    post:
      operationId: merge-facts
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MergeFactsInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MergeFactsOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Consolidate several open readings of one key into a summary that closes them
      tags:
        - facts
  /api/facts/used:
    post:
      operationId: mark-facts-used
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdsInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UseFactsResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: "Report the facts that answered something. Positive-only: importance is LEARNED, not written"
      tags:
        - facts
  /api/facts/{id}/close:
    post:
      operationId: close-fact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CloseFactInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CloseFactResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: End a fact that stopped being true with nothing replacing it
      tags:
        - facts
  /api/facts/{id}/redate:
    post:
      operationId: redate-fact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RedateFactInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RedateFactResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Correct when a fact STARTED — the one axis with no other repair
      tags:
        - facts
  /api/facts/{id}/repoint:
    post:
      operationId: repoint-fact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RepointFactInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepointFactResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: "Move a fact to the right KEY: wrong entity, endpoints the wrong way round, or an object that was only a label"
      tags:
        - facts
  /api/facts/{id}/reword:
    post:
      operationId: reword-fact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RewordFactInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RewordFactResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Fix the WORDING, keeping the id and everything hanging off it — dates, scope, source episode, earned importance, both pointers
      tags:
        - facts
  /api/pins:
    get:
      operationId: list-pins
      parameters:
        - explode: false
          in: query
          name: scope
          schema:
            type: string
        - explode: false
          in: query
          name: direction
          schema:
            enum:
              - descendants
              - ancestors
              - exact
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListPinsOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: What is switched on. Descendants, because this is the inventory view
      tags:
        - pins
    post:
      operationId: add-pin
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PinInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddPinOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Pin text into every recall beneath a scope. Costs context on every call
      tags:
        - pins
  /api/pins/{id}:
    delete:
      operationId: delete-pin
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Switch a pin off
      tags:
        - pins
    patch:
      operationId: update-pin
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PinUpdateInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdatePinOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Re-word a pin or change when it expires
      tags:
        - pins
  /api/predicates:
    get:
      description: |-
        The closed vocabulary a fact's `predicate` must come from. Direction is part of the key — the gloss reads `subject → object` — and writing one where the graph holds the other splits the relation in two.

        `family` groups by what is at the ENDS: person↔person is personal, anything reaching an organisation is work, the rest is about things.
      operationId: list-predicates
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PredicatesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: The fact keys, with their direction and their family
      tags:
        - facts
  /api/scopes:
    get:
      operationId: list-scopes
      parameters:
        - description: Rank the map by description and by path. Omit to list it
          explode: false
          in: query
          name: query
          schema:
            description: Rank the map by description and by path. Omit to list it
            type: string
        - description: "How many scopes a query answers with. Ignored without one: an unfiltered map is always complete"
          explode: false
          in: query
          name: limit
          schema:
            default: 50
            description: "How many scopes a query answers with. Ignored without one: an unfiltered map is always complete"
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScopesResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: The derived map of namespaces, with what each holds
      tags:
        - scopes
  /api/scopes/description:
    put:
      operationId: describe-scope
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DescribeScopeInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DescribeScopeResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Label a scope with the kind of work filed under it
      tags:
        - scopes
  /api/scopes/move:
    post:
      operationId: move-scope
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MoveScopeInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MoveScopeResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Rename a scope, or merge it into another. IRREVERSIBLE by data
      tags:
        - scopes
  /api/self:
    get:
      description: "Empty when no centre has been set, which is an answer and not an error: a fresh account has none. A client needs it to show the state of the control that sets one — a switch with no visible state reads as a question rather than a setting."
      operationId: get-self
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SelfResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: The entity this account has named as its own
      tags:
        - entities
  /api/shares:
    get:
      operationId: list-shares
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SharesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: What is open to me, what I have opened, and what is unclaimed
      tags:
        - shares
    post:
      operationId: invite-to-scope
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InviteInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ShareInvite"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Open a scope and its subtree to whoever redeems the code
      tags:
        - shares
  /api/shares/accept:
    post:
      operationId: accept-share
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AcceptInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScopeShare"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Redeem a code. Whoever redeems it becomes the grantee
      tags:
        - shares
  /api/shares/invites/{code}:
    delete:
      operationId: cancel-invite
      parameters:
        - in: path
          name: code
          required: true
          schema:
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Kill an unclaimed code. A claimed one is refused by name
      tags:
        - shares
  /api/shares/revoke:
    post:
      operationId: revoke-share
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevokeInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokeOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Withdraw one grant, or every grant on a scope
      tags:
        - shares
  /api/shares/{id}/access:
    post:
      operationId: set-share-access
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ShareAccessInBody"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Move a grant between read and write. Only the owner may
      tags:
        - shares
  /api/skills:
    get:
      operationId: list-skills
      parameters:
        - description: The question to find a recipe for. Omit to browse
          explode: false
          in: query
          name: task
          schema:
            description: The question to find a recipe for. Omit to browse
            type: string
        - explode: false
          in: query
          name: scope
          schema:
            type: string
        - explode: false
          in: query
          name: direction
          schema:
            enum:
              - descendants
              - ancestors
              - exact
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 5
            format: int64
            maximum: 50
            minimum: 1
            type: integer
        - description: Skip this many rows of the same ordering (browse only)
          explode: false
          in: query
          name: offset
          schema:
            default: 0
            description: Skip this many rows of the same ordering (browse only)
            format: int64
            minimum: 0
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListSkillsOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Find a recipe by the question it answers, or browse what exists
      tags:
        - skills
    post:
      operationId: save-skill
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SaveSkillInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SaveSkillResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Write a recipe. A mistyped trigger writes a SECOND one — edit by id instead
      tags:
        - skills
  /api/skills/{id}:
    delete:
      operationId: delete-skill
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Remove a recipe
      tags:
        - skills
    get:
      operationId: get-skill
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SkillOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: One recipe whole
      tags:
        - skills
    patch:
      operationId: update-skill
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSkillInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateSkillResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Re-title, or replace a passage that must match exactly once
      tags:
        - skills
  /api/skills/{id}/outcome:
    post:
      operationId: record-skill-outcome
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SkillFeedbackInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SkillFeedbackOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Fold one run into the recipe's running mean. This is what last_used means
      tags:
        - skills
  /api/skills/{id}/state:
    get:
      operationId: get-skill-state
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
        - explode: false
          in: query
          name: target
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StatesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Where this recipe's runs stopped, per target
      tags:
        - state
    put:
      operationId: set-skill-state
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{8}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SetSkillStateInBody"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Record where this run stopped. Overwritten, never appended; empty clears
      tags:
        - state
  /api/state:
    get:
      operationId: list-states
      parameters:
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StatesOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Every bookmark — the inventory view, for one whose job stopped existing
      tags:
        - state
  /api/todos:
    delete:
      operationId: delete-todos
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdsInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeleteTodosResult"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Only for a todo that should never have existed. One considered and rejected is DROPPED
      tags:
        - todos
    get:
      operationId: list-todos
      parameters:
        - description: Search by wording; omit to browse
          explode: false
          in: query
          name: query
          schema:
            description: Search by wording; omit to browse
            type: string
        - explode: false
          in: query
          name: scope
          schema:
            type: string
        - explode: false
          in: query
          name: direction
          schema:
            enum:
              - descendants
              - ancestors
              - exact
            type: string
        - description: "Default: open only"
          explode: false
          in: query
          name: status
          schema:
            description: "Default: open only"
            items:
              enum:
                - open
                - done
                - dropped
              type: string
            type:
              - array
              - "null"
        - explode: false
          in: query
          name: due_before
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: created_before
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: created_after
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: oldest_first
          schema:
            type: boolean
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: Skip this many rows of the same ordering
          explode: false
          in: query
          name: offset
          schema:
            default: 0
            description: Skip this many rows of the same ordering
            format: int64
            minimum: 0
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTodosOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Open obligations. Never decay, never appear in a recall — read them deliberately
      tags:
        - todos
    patch:
      operationId: update-todos
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTodosInBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateTodosOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Close done or dropped, re-word, re-date. A field nobody named does not move
      tags:
        - todos
    post:
      operationId: add-todos
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddTodosInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddTodosOutBody"
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Error
      summary: Write obligations. A repeated open intention returns the existing one
      tags:
        - todos
