{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mnemoverse-com/json-schema/mnemoverse-com-atom-chain-schema-schema.json",
  "title": "AtomChainSchema",
  "description": "Every revision reachable from one atom by supersession links.\n\n`include_history` grants ELIGIBILITY under ranking — it never promised a\ncomplete chain, and the read schemas say so. This is the handle that does\npromise one. It hydrates through the point read, which resolves any\nrevision regardless of the read-side filter, so a chain is available whether\nor not that filter is enabled: it is a fact about the data.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mnemoverse-com-memory-v1-api-openapi.yml#/components/schemas/AtomChainSchema",
  "properties": {
    "atom_id": {
      "type": "string",
      "format": "uuid",
      "title": "Atom Id",
      "description": "The revision the walk started from."
    },
    "revisions": {
      "items": {
        "$ref": "#/$defs/ChainRevisionSchema"
      },
      "type": "array",
      "title": "Revisions",
      "description": "Every revision found, roots to head. Ordered topologically along the supersedes links — a predecessor never follows something that replaced it; creation time decides only between branches the links leave genuinely unordered (e.g. two predecessors consolidated by one successor)."
    },
    "dangling": {
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "type": "array",
      "title": "Dangling",
      "description": "Chain pointers that resolved to nothing — the referenced revision was destroyed by the loud delete handle, or belongs to another tenant. Reported as breaks in the chain rather than raised: the caller already holds these ids, they came off rows the caller can read."
    },
    "truncated": {
      "type": "boolean",
      "title": "Truncated",
      "description": "True when the walk exhausted its lookup budget and stopped early, so `revisions` is a prefix of the chain rather than all of it. The budget counts EVERY lookup — resolved revisions and dangling-pointer misses alike — so a heavily-damaged chain can set this with far fewer than 64 revisions returned; do not infer chain length from it. A cap that truncated silently would let a caller believe they hold the whole history.",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "atom_id",
    "revisions"
  ],
  "$defs": {
    "ChainRevisionSchema": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id",
          "description": "Atom UUID of this revision."
        },
        "content": {
          "type": "string",
          "title": "Content",
          "description": "Stored text content of this revision."
        },
        "domain": {
          "type": "string",
          "title": "Domain",
          "description": "Domain the revision is stored in (may differ per revision)."
        },
        "concepts": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Concepts",
          "description": "Associated concepts."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At",
          "description": "UTC creation instant, ISO-8601."
        },
        "supersedes": {
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "type": "array",
          "title": "Supersedes",
          "description": "Ids this revision replaced. OMITTED when it replaced nothing."
        },
        "superseded_by": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Superseded By",
          "description": "Id of the revision that replaced this one. OMITTED for the head."
        },
        "is_head": {
          "type": "boolean",
          "title": "Is Head",
          "description": "True for the live tip — the revision no other revision has replaced. False for every historical revision, and false for a revision whose successor was destroyed (its id then appears in `dangling`): a broken chain has no head, and claiming one would rewrite history."
        }
      },
      "type": "object",
      "required": [
        "id",
        "content",
        "domain",
        "created_at",
        "is_head"
      ],
      "title": "ChainRevisionSchema",
      "description": "One revision inside a supersession chain."
    }
  }
}