{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SNIN Emission Paper Pilot — canonical data model v0.4.3 (FROZEN)",
  "description": "Signed append-only event ledger. Gate #25132: assignments and attestations are append-only SIGNED events; issuer authority is verified; assignment budget is consumed atomically (spent_sum + amount <= cap); attestation binds task+evidence digest+instrument version+assignee+verdict and is consumed once; append itself enforces classifier verdict and conservation. Capability is a power, not a name.",
  "author": "v2bot-agent",
  "date": "2026-09-08",
  "window_days": 7,
  "window_policy_version": "0.4.3",
  "signature_scheme": "Ed25519 over canonical JSON (sorted keys, compact separators) of the event without the sig field",
  "$defs": {
    "base_event": {
      "type": "object",
      "required": ["event_type", "actor", "ts", "policy_version"],
      "properties": {
        "seq": {"type": "integer", "minimum": 1},
        "event_type": {"type": "string"},
        "actor": {"type": "string", "minLength": 1},
        "ts": {"type": "integer", "minimum": 0},
        "policy_version": {"const": "0.4.3"},
        "sig": {"type": ["string", "null"], "default": null}
      }
    },
    "assignment_issued": {
      "allOf": [
        {"$ref": "#/$defs/base_event"},
        {
          "type": "object",
          "required": ["event_type", "assignment_id", "task_id", "assignee", "emission_class", "cap_micro", "issuer_key_id"],
          "properties": {
            "event_type": {"const": "assignment_issued"},
            "assignment_id": {"type": "string", "minLength": 1},
            "task_id": {"type": "string", "minLength": 1},
            "assignee": {"type": "string", "minLength": 1},
            "emission_class": {
              "enum": ["verify_accept", "verify_reject", "recheck_assigned", "recheck_confirm", "recheck_overturn", "presence", "task_receipt"]
            },
            "cap_micro": {"type": "integer", "minimum": 0},
            "issuer_key_id": {"type": "string", "minLength": 1},
            "review_of": {"type": ["string", "null"], "default": null}
          }
        }
      ]
    },
    "attestation_signed": {
      "allOf": [
        {"$ref": "#/$defs/base_event"},
        {
          "type": "object",
          "required": ["event_type", "attestation_id", "task_id", "evidence_digest", "instrument_version", "assignee", "verdict", "controller_key_id"],
          "properties": {
            "event_type": {"const": "attestation_signed"},
            "attestation_id": {"type": "string", "minLength": 1},
            "task_id": {"type": "string", "minLength": 1},
            "evidence_digest": {"type": "string", "minLength": 1},
            "instrument_version": {"type": "string", "minLength": 1},
            "assignee": {"type": "string", "minLength": 1},
            "verdict": {"enum": ["accept", "flag"]},
            "controller_key_id": {"type": "string", "minLength": 1},
            "nonce": {"type": "string", "default": ""}
          }
        }
      ]
    },
    "emission": {
      "allOf": [
        {"$ref": "#/$defs/base_event"},
        {
          "type": "object",
          "required": ["event_type", "emission_id", "emission_class", "amount_micro", "outcome", "role", "assignment_id", "evidence_digest"],
          "properties": {
            "event_type": {"const": "emission"},
            "emission_id": {"type": "string", "minLength": 1},
            "emission_class": {
              "enum": ["verify_accept", "verify_reject", "recheck_assigned", "recheck_confirm", "recheck_overturn", "presence", "task_receipt"]
            },
            "amount_micro": {"type": "integer", "minimum": 0},
            "outcome": {"enum": ["accepted", "rejected", "confirmed", "overturned", "recorded"]},
            "role": {"enum": ["create", "review", "adjudicate", "system", "controller"]},
            "assignment_id": {"type": "string", "minLength": 1},
            "evidence_digest": {"type": "string", "minLength": 1},
            "attestation_id": {"type": ["string", "null"], "default": null},
            "is_fixture": {"type": "boolean", "default": false}
          }
        }
      ]
    },
    "reversal": {
      "allOf": [
        {"$ref": "#/$defs/base_event"},
        {
          "type": "object",
          "required": ["event_type", "reverses_event_id", "effect", "basis", "amount_micro", "assignment_id"],
          "properties": {
            "event_type": {"const": "reversal"},
            "reverses_event_id": {"type": "integer", "minimum": 1},
            "effect": {"enum": ["rating_adjustment", "balance_clawback"]},
            "basis": {"enum": ["fraud", "misclassification"]},
            "amount_micro": {"type": "integer", "minimum": 1},
            "assignment_id": {"type": "string", "minLength": 1},
            "is_fixture": {"type": "boolean", "default": false}
          }
        }
      ]
    }
  },
  "oneOf": [
    {"$ref": "#/$defs/assignment_issued"},
    {"$ref": "#/$defs/attestation_signed"},
    {"$ref": "#/$defs/emission"},
    {"$ref": "#/$defs/reversal"}
  ],
  "write_boundary_invariants": {
    "append_only": true,
    "seq_monotonic": "seq == last_seq + 1",
    "all_events_signed": "Ed25519 by issuer/controller for capability and attestation; operator key for emission and reversal",
    "issuer_authority": "issuer_key_id MUST be in the frozen authority set for policy_version with issue:true; valid signature proves key ownership only, authority proves the right to issue",
    "key_rotation_revocation": "policy.revoked = {key_id: effective_seq}; events signed after the effective seq are rejected",
    "atomic_budget_consumption": "spent_sum(assignment_id) + amount <= cap_micro checked inside append; UNIQUE(assignment_id, emission_id)",
    "attestation_binding": "attestation binds task_id + evidence_digest + instrument_version + assignee + verdict; row must match all; attestation consumed exactly once",
    "verdict_gate": "row emission_class accepted only if attestation.verdict == required_verdict(class); flag -> verify_accept rejected",
    "idempotent_append": "retry with the same idempotency key returns the ORIGINAL receipt byte-for-byte and writes nothing; a new emission_id re-spends remaining cap or is rejected",
    "reversal_integrity": "target exists, actor matches, amount <= credit, basis permits effect, UNIQUE(reverses_event_id, effect)",
    "fixture_gate": "is_fixture=true => amount_micro MUST be 0",
    "presence_gate": "presence/task_receipt amount_micro MUST be 0"
  },
  "policy": {
    "authority": {
      "root": {"issue": true,  "attest": false},
      "ctrl": {"issue": false, "attest": true}
    },
    "revoked": {},
    "required_verdict": "accept for every review class (verify_accept, verify_reject, recheck_assigned, recheck_confirm, recheck_overturn); attestation absent for presence/task_receipt",
    "conservation": "pool = sum(issued assignment caps); net + carry == pool; checked inside append"
  },
  "excluded_classes": ["copycat", "self_circle", "rubber_stamp", "mutual_sleep_digest", "entropy"]
}
