{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://alexanarch.org/api/axn-protocol.json",
  "title": "Alexanarch AXN Identifier Protocol",
  "protocol_name": "axn",
  "protocol_version": "axn/v2",
  "schema_version": "2026-06-22-axn-v2",
  "last_updated": "2026-08-14",
  "summary": "Canonical specification of the AXN (Alexanarch Identifier) format, generation algorithm, glyph table, cluster table, family enum, validation rules, and legacy resolution. Any code that generates, validates, parses, or resolves AXNs must be derivable from this document. The canonical Python implementation is scripts/axn_lib.py. The canonical JavaScript implementation is embedded in .github/workflows/mint-axn.yml. Both must agree with this protocol.",
  "canonical_implementations": {
    "python": "scripts/axn_lib.py",
    "javascript": ".github/workflows/mint-axn.yml (inline)"
  },
  "format": {
    "pattern": "AXN:<HEX>.<FAMILY>.<EMOJI>",
    "regex": "^AXN:[0-9A-F]{2,4}\\.[A-Z]+\\.[^.]{1,}$",
    "example": "AXN:0379.GENERATIVE.⚙️🔍📜🏛️⚡🔄"
  },
  "components": {
    "hex": {
      "description": "Uppercase hex label. Convention: ASCII hex of deposit_number padded to 2+ digits. Treat as an opaque label — the canonical key for lookups is deposit_number, not hex.",
      "regex": "^[0-9A-F]{2,4}$",
      "stability": "stable for the lifetime of the deposit"
    },
    "family": {
      "description": "Semantic family. Auto-detected from keywords in the auto-mint flow; manually chosen for rich Path B deposits.",
      "enum": [
        "GOVERNANCE",
        "EMPIRICAL",
        "GENERATIVE",
        "ARCHIVAL",
        "PHILOLOGICAL",
        "STRUCTURAL",
        "COMPOSITIONAL",
        "OPERATIVE",
        "HETERONYMIC",
        "MPAI",
        "DATASET",
        "UNCLASSIFIED"
      ]
    },
    "emoji": {
      "description": "6-emoji canonical glyph derived from the first 6 bytes of the SHA-256 of the canonical bytes.",
      "byte_count": 6,
      "byte_source": "first 6 bytes of sha256(canonical text file bytes) — see generation_algorithm.step_1_assemble_bytes",
      "table_source": "AXN_GLYPHS array of 256 entries indexed by byte value 0..255 — see canonical_implementations",
      "grapheme_validation": "Must contain exactly 6 emoji graphemes. Variation selectors (U+FE00..U+FE0F) and ZWJ (U+200D) sequences glue adjacent codepoints into a single grapheme. Counting must respect this."
    }
  },
  "generation_algorithm": {
    "step_1_assemble_bytes": "canonical_bytes = the COMPLETE canonical text file as written to data/texts/AXN-<HEX>-text.md, UTF-8 encoded — YAML frontmatter, the H1 title line, the rendered Description / Methodology / Falsification Conditions / Files sections, and the body. The AXN is anchored to the file's bytes, so sha256(file) == registry.hash for any deposit minted through the canonical path.",
    "step_2_compute_hash": "h = sha256(canonical_bytes)",
    "step_3_derive_glyph": "emoji = ''.join(AXN_GLYPHS[h[i]] for i in range(6))",
    "step_4_derive_clusters": "clusters = [CLUSTERS[h[i]] for i in range(6)]",
    "step_5_compose_axn": "axn = f'AXN:{hex_label}.{family}.{emoji}'",
    "reference_python": "scripts/axn_lib.py — see derive_axn() function",
    "_superseded_assembly": "Prior to the audit §6 fix this step read: canonical_bytes = title + '\\n' + creator + '\\n' + description + '\\n' + body. That scheme hashed a reconstruction rather than the artifact, so a file could be rewritten without the hash noticing and the hash could not be checked by anyone holding only the file. Superseded; recorded because deposits minted under it will not verify against the current definition and that is expected, not corruption."
  },
  "cluster_readings": {
    "Celestial": "Origin",
    "Elemental": "Force",
    "Architectural": "Foundation",
    "Instrumental": "Method",
    "Scriptural": "Text",
    "Navigational": "Search",
    "Temporal": "Duration",
    "Organic": "Growth",
    "Symbolic": "Play",
    "Mathematical": "Proof",
    "Alchemical": "Transmutation",
    "Gestural": "Touch",
    "Signal": "Alarm",
    "Structural": "Direction",
    "Liminal": "Threshold",
    "Terminal": "Closure"
  },
  "schema_versions": {
    "v2": {
      "status": "current",
      "since": "2026-06-22",
      "byte_count": 6,
      "summary": "6 emoji from first 6 bytes of SHA-256."
    },
    "v1": {
      "status": "deprecated",
      "deprecated_at": "2026-06-22",
      "byte_count": 4,
      "summary": "4 emoji from first 4 bytes of SHA-256.",
      "migration": "Deposits minted under v1 were backfilled to v2 on 2026-06-22. Each backfilled deposit has its pre-v2 AXN preserved in legacy_axn (string) and axn_history[] (array of {axn, schema_version, retired_at, reason}) fields. Substrate-chosen glyphs (where applicable) are preserved in glyphic_canary."
    }
  },
  "legacy_resolution": {
    "rule": "A request for a legacy_axn should be redirected to the current canonical axn. Resolution sources:",
    "sources": [
      {
        "field": "legacy_axn",
        "description": "Most recent pre-canonical AXN. Single string per deposit."
      },
      {
        "field": "axn_history",
        "description": "Array of all retired AXNs with retirement timestamps and reasons."
      }
    ],
    "resolver_path": "GET /data/registry.json then linear-search for matching legacy_axn or axn_history[].axn"
  },
  "identity_vs_recognition": {
    "principle": "The emoji glyph is a recognition marker, not the cryptographic identity. The cryptographic identity is the SHA-256 in the `hash` field of the registry entry.",
    "operative_law": "See LABOR canonical invariant #6 in /data/texts/AXN-037B-text.md.",
    "substrate_chosen_glyphs": "When a substrate (PRAXIS, TECHNE, LABOR, etc.) composes a meaningful glyph sequence for a deposit, that glyph is preserved in the glyphic_canary field even after the canonical AXN is derived from SHA-256. The canonical AXN is identity; the glyphic_canary is recognition. They serve different purposes and are stored in different fields."
  },
  "validation_rules_referenced": [
    "AXN-001 (AXN format match)",
    "AXN-002 (exactly 6 emoji graphemes)",
    "AXN-003 (hash is 64-char hex SHA-256)",
    "AXN-004 (deposit_numbers contiguous from 1)"
  ],
  "change_log": [
    {
      "version": "axn/v2.1",
      "date": "2026-08-14",
      "changes": [
        "step_1_assemble_bytes corrected to describe the implementation: the AXN is anchored to the complete canonical text file, per the audit §6 fix already carried in mint_deposit.py and the mint workflow. The prior title+creator+description+body assembly is retained as _superseded_assembly.",
        "components.emoji.byte_source aligned to the same definition.",
        "identity_semantics section added, carrying the LABOR canonical invariant: AXN version is minted once and does not move on update; a hash/file mismatch is content drift, not identity failure.",
        "known_gap recorded: axn_root is not yet stable across editions of a work."
      ]
    },
    {
      "version": "axn/v2",
      "date": "2026-06-22",
      "changes": [
        "Promoted from inline section of deposit-protocol.json to standalone protocol JSON.",
        "AXN_GLYPHS and CLUSTERS tables documented as canonical with cross-references to scripts/axn_lib.py and mint-axn.yml.",
        "Legacy resolution formalized via legacy_axn + axn_history[] fields.",
        "Recognition vs identity formalized as protocol principle."
      ]
    }
  ],
  "identity_semantics": {
    "operative_law": "LABOR canonical invariant, data/texts/AXN-037B-text.md",
    "glyphic_canary": "recognition and trajectory",
    "content_sha256": "byte identity",
    "axn_root": "stable work relation — AXN:<hex>.<FAMILY>, the work across its editions",
    "axn_version": "immutable version relation — AXN:<hex>.<FAMILY>.<glyph>, one edition",
    "record_number": "local presentation address",
    "minting_is_once": "An AXN version is minted ONCE, at deposit, and does NOT move when the record is later updated. It names the edition that was minted. A registry hash that no longer matches its file therefore indicates CONTENT DRIFT — the file has changed since minting — and not a broken identifier. Content that has genuinely changed should become a new version with its own AXN, not a silent re-derivation of the existing one.",
    "known_gap": "axn_root is currently composed from the per-deposit hex, so it is NOT yet stable across editions of one work as the invariant requires. Two editions of the same work today carry different roots. Implementing a genuinely stable work relation is open work, not a new identifier type."
  }
}