{"$id":"https://cumulativewebinc.github.io/cwi-context-grants/schema/grants.schema.json","$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"description":"An approval bound to both a content hash AND the context in which the approval was given. cwi.context-grant/1.0.","properties":{"action":{"additionalProperties":false,"properties":{"content_hash":{"pattern":"^sha256:[0-9a-f]{64}$","type":"string"},"content_ref":{"description":"Human pointer to the content (URL, repo path, manifest location).","type":"string"},"description":{"minLength":1,"type":"string"},"type":{"enum":["deploy","publish","payment","config-change","submission","access-grant","other"],"type":"string"}},"required":["description","type","content_hash"],"type":"object"},"context":{"additionalProperties":false,"properties":{"approver":{"description":"Identity + authority basis of the approver.","type":"string"},"assembled_at":{"format":"date-time","type":"string"},"conversation_ref":{"description":"Pointer to the conversation/turn that produced the approval (session id, message ids).","type":"string"},"expires_at":{"description":"The approval lease expires here. Any context divergence before this SHOULD trigger re-approval.","format":"date-time","type":"string"},"model":{"description":"Model id + agent identity that requested/assembled the grant.","type":"string"},"notes":{"type":"string"},"tools_available":{"description":"Tool namespaces available to the agent at decision time.","items":{"type":"string"},"type":"array"},"venue":{"description":"Where the approved action executes (repo, chain, platform).","type":"string"}},"required":["model","tools_available","venue","assembled_at","expires_at","approver"],"type":"object"},"context_hash":{"description":"SHA-256 over canonical JSON of {action, context} — binds content AND context.","pattern":"^sha256:[0-9a-f]{64}$","type":"string"},"grant_id":{"pattern":"^grt_[0-9A-HJKMNP-TV-Z]{26}$","type":"string"},"issuer":{"const":"Cumulative Web Inc"},"prev_hash":{"description":"sha256:<hex> of the previous grant's payload, or GENESIS.","type":"string"},"protocol":{"const":"cwi.context-grant/1.0"},"signature":{"description":"Ed25519 (base64) over canonical bytes of the grant payload (everything except signature), signed by the CWI offline key.","type":"string"}},"required":["protocol","grant_id","action","context","context_hash","issuer","prev_hash"],"title":"CWI Context Grant","type":"object"}