{
  "handle": "AuditTrail",
  "mechanism": "Every consequential {{agent}} action (state mutation, external call, delegation, decision) appends a {{sign}}ed entry to an immutable {{ledger}} whose sequence number advances via {{monotonic_counter}}, so no entry can be wedged between two existing ones. Each entry contains: timestamp, {{agent}} {{identity}}, action type, input hash, output hash, and the sema pattern invoked. Extends {{trace}} from single-entity lineage to cross-agent compliance logging. The trail is append-only — entries cannot be modified or deleted. For cross-agent auditing, individual trails are aggregated via Merkle roots into a shared {{snapshot}}, enabling any party to verify the complete history without accessing raw entries.",
  "gloss": "Immutable append-only log of agent actions for compliance and debugging",
  "invariants": [
    "Append-Only: No entry in the {{ledger}} may be modified after creation",
    "Every entry must be {{sign}}ed by the acting {{agent}}",
    "{{trace}} provenance must link each entry to the sema pattern that triggered it"
  ],
  "preconditions": [
    "{{agent}} has established {{identity}}",
    "{{ledger}} is accessible and writable"
  ],
  "postconditions": [
    "Action recorded with full provenance in {{ledger}}",
    "{{snapshot}} of trail Merkle root available for external verification"
  ],
  "failure_modes": [
    "Storage exhaustion (unbounded trail growth in long-running systems).",
    "Clock skew (distributed agents disagree on timestamps — use logical clocks).",
    "Selective logging (agent omits inconvenient entries — requires external {{audit}})."
  ],
  "signature": [
    "Trace(Ledger)"
  ],
  "_meta": {
    "ring": 1,
    "tier": 1,
    "related": [
      "SpotAudit"
    ],
    "supersedes": [
      "sema:AuditTrail#mh:SHA-256:ff66d6d56fc4208d20e8bb1835ea9a04dc23269ced480e27c2cebb2f2fa6890c",
      "sema:AuditTrail#mh:SHA-256:b4419b5e90a6a7c5433fe5bcb459ca9fbff9cbd7d48ccf9b44b0b64166959551",
      "sema:AuditTrail#mh:SHA-256:bf18738b25414c907d542cc6971b13ecf1fb7b415d10529f1c398a1e08109f92",
      "sema:AuditTrail#mh:SHA-256:46f73da14d15073869646008bafb50651a875287b559885fda3ae578c8ebbaa9"
    ],
    "path": [
      "Infrastructure",
      "Verification"
    ]
  },
  "sema_ref": "AuditTrail#163b",
  "sema_id": "sema:AuditTrail#mh:SHA-256:163b784f86e448340b94d0459483f0f476e052b5b7c589113f5c7df5dd1115a8",
  "sema_stub": "163b",
  "dependencies": {
    "composes_with": {
      "snapshot": "sema:Snapshot#mh:SHA-256:390d2ec2934136d534f969b4039e6b899d2ed3956ddd8aa0ca4754068ed8d133"
    },
    "references": {
      "agent": "sema:Agent#mh:SHA-256:e127459069739fffc96a71d54ef6e8c97ca53471d5349c16aa72a092a33756cd",
      "audit": "sema:Audit#mh:SHA-256:be970add829f4f162533569b04c9ffd12ea4d070d53405a4993f0785d4074f77",
      "identity": "sema:Identity#mh:SHA-256:b24a57fdd59ebf2ef019be30af8fa10fc127f61d346a74ab0b49f729b4e32093",
      "ledger": "sema:Ledger#mh:SHA-256:4ddaf2792fd7283ceea0d6b9b01ddfff9b7274dfb1cea2bf23147c21520774e5",
      "monotonic_counter": "sema:MonotonicCounter#mh:SHA-256:d0d3ce256be4bc080a29eab7fda36381a4352a280d9a12d59179c60e71cf9bd0",
      "sign": "sema:Sign#mh:SHA-256:b2020447ec4c2725a139c6117c764cf464643e6e83379e86263267f95e4965ee",
      "trace": "sema:Trace#mh:SHA-256:b68d64423aa72b13a06714aa182baab79eb49a5a856dce56dd554fd63b41c2a9"
    }
  },
  "sema_layer": "Infrastructure",
  "sema_category": "Verification",
  "used_by": {}
}
