{
  "spec_id": "cain-38.0-capability-spec",
  "generated_at": "2026-09-18T00:42:00Z",
  "status": "DOCUMENTS EXISTING CODE, AS FIXED THIS SESSION -- cain_intent_action_fabric.CryptographicDelegationToken + DelegationSecurityValidator, pre-dating CAIN 34 but with a real bug fixed here (see CAIN_38_SECURITY_RED_TEAM.json).",
  "token_schema": {
    "token_id": "str",
    "tenant_id": "str -- WHO (tenant boundary)",
    "parent_actor": "str -- WHO delegated",
    "child_actor": "str -- WHO received authority",
    "granted_actions": "List[str] -- WHAT (action verbs, '*' = all)",
    "allowed_resources": "List[str] -- WHERE (resource/counterparty patterns, supports trailing '/*' prefix match)",
    "max_spend_cents": "int -- MAXIMUM SPEND (enforced as of this session's fix; previously hashed but not checked)",
    "max_depth": "int -- delegation chain depth bound",
    "current_depth": "int",
    "issued_at": "float (unix ts) -- WHEN starts",
    "expires_at": "float (unix ts) -- WHEN ends / EXPIRATION",
    "parent_signature": "str (not populated by any call site found this session -- see gap below)",
    "token_hash": "str -- sha256 over the canonical field set (computed by compute_hash())"
  },
  "mission_phase_5_field_coverage": {
    "WHO": "parent_actor / child_actor / tenant_id -- COVERED",
    "WHAT": "granted_actions -- COVERED",
    "WHERE": "allowed_resources -- COVERED",
    "WHEN": "issued_at/expires_at -- COVERED",
    "WHY": "NOT a field -- no purpose/justification string on the token itself",
    "MAXIMUM_IMPACT": "NOT a field distinct from spend (no non-monetary impact bound)",
    "MAXIMUM_SPEND": "max_spend_cents -- COVERED, NOW ENFORCED (this session's fix)",
    "MAXIMUM_EXECUTION_COUNT": "NOT a field -- a token can be validated an unbounded number of times before expiration; no per-token usage counter",
    "ALLOWED_TOOLS": "overlaps with granted_actions but not a distinct concept",
    "ALLOWED_DATA": "overlaps with allowed_resources",
    "ALLOWED_AGENTS": "NOT a field -- no explicit counterparty-agent allowlist on the token itself (CAIN 38's EconomicIntent.conditions.allowed_counterparties is a separate, caller-side check, not part of the token)",
    "DELEGATION_RIGHTS": "max_depth/current_depth -- COVERED (can this token itself be re-delegated further)",
    "EXPIRATION": "expires_at -- COVERED",
    "REVOCATION": "NOT a field -- no revocation registry/CRL for these tokens found this session (contrast: identity_engine.revoke_delegation() DOES support revocation, but for its own separate, generic-constraints delegation model -- not this token class)"
  },
  "real_gaps_found_not_fixed": [
    "No MAXIMUM_EXECUTION_COUNT: a single valid, unexpired token can authorize unlimited actions within its bounds. Not attacked or fixed this session -- flagged.",
    "parent_signature field exists on the dataclass but no call site in this repo populates or verifies it -- the token's 'cryptographic' binding is presently just a SHA-256 content hash (compute_hash()), not an actual Ed25519 signature from the parent. Calling this 'cryptographically scoped' per the mission's Phase 5 title is only partially accurate: hash-bound yes, signature-authenticated no.",
    "No revocation mechanism for this specific token class -- a leaked or over-issued token remains valid until expires_at with no way to revoke it early."
  ]
}
