@sharedcontext/sdk 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/NOTICE +8 -0
  4. package/README.md +94 -2
  5. package/dist/canonical.d.ts +47 -0
  6. package/dist/canonical.js +257 -0
  7. package/dist/client.d.ts +96 -0
  8. package/dist/client.js +205 -0
  9. package/dist/constants.d.ts +19 -0
  10. package/dist/constants.js +21 -0
  11. package/dist/event.d.ts +104 -0
  12. package/dist/event.js +173 -0
  13. package/dist/generated/content.d.ts +588 -0
  14. package/dist/generated/content.js +3 -0
  15. package/dist/generated/schemas.d.ts +10 -0
  16. package/dist/generated/schemas.js +22 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +8 -0
  19. package/dist/reasons.d.ts +14 -0
  20. package/dist/reasons.js +142 -0
  21. package/dist/schema.d.ts +45 -0
  22. package/dist/schema.js +285 -0
  23. package/dist/types.d.ts +230 -0
  24. package/dist/types.js +3 -0
  25. package/package.json +46 -4
  26. package/schemas/sharedcontext-1/changes.schema.json +128 -0
  27. package/schemas/sharedcontext-1/content.schema.json +2076 -0
  28. package/schemas/sharedcontext-1/context.schema.json +218 -0
  29. package/schemas/sharedcontext-1/event.schema.json +55 -0
  30. package/schemas/sharedcontext-1/execution.schema.json +342 -0
  31. package/schemas/sharedcontext-1/history/content-1.0.schema.json +1915 -0
  32. package/schemas/sharedcontext-1/lineage.schema.json +753 -0
  33. package/schemas/sharedcontext-1/mcp-tools.schema.json +1357 -0
  34. package/schemas/sharedcontext-1/stored-event.schema.json +14 -0
  35. package/schemas/sharedcontext-directory-1/members.schema.json +52 -0
  36. package/schemas/sharedcontext-directory-1/memberships.schema.json +32 -0
@@ -0,0 +1,22 @@
1
+ // Generated by scripts/generate.mjs from schemas/. Do not edit.
2
+ /** The schema files of sharedcontext/1, by their path in the contract's folder. */
3
+ export const SCHEMA_FILES = ["changes.schema.json", "content.schema.json", "context.schema.json", "event.schema.json", "execution.schema.json", "history/content-1.0.schema.json", "lineage.schema.json", "mcp-tools.schema.json", "stored-event.schema.json"];
4
+ /** Each schema file's exact text. */
5
+ export const SCHEMA_TEXT = {
6
+ "changes.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1 change feed page, changes@1\",\n \"$comment\": \"The change feed's page. One way to follow a store's changes after a cursor: the page a follower reads, whichever store answers it. The work log (sharedcontext/1) serves it as the read-only MCP tool `changes` (mcp-tools.schema.json `tool.changes`, its arguments `ChangesArgs`); other stores, such as a directory or a job API, can answer the same page for their own feeds, through the same tool or `GET <base>/changes?after=&limit=&kind=`. A change names what changed and points at it; it never carries the body: a follower reads the body through the store's own read (for the log: `subscribe` or `state`). Additive to sharedcontext/1: no event type, content or existing tool changes, and the v tag stays \\\"1\\\". Source: crates/sharedcontext/src/mcp/mod.rs (fn changes_page, fn parse_cursor, the changes tool) and crates/sharedcontext/tests/mcp/changes.rs; served only with `feed.changes` on, off by default. Cases: cases/changes.cases.jsonl.\",\n \"$defs\": {\n \"Cursor\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 128,\n \"pattern\": \"^[A-Za-z0-9._:-]+$\",\n \"$comment\": \"Opaque to a follower, defined by the store that issues it; a follower stores it and sends it back, never parses it, never compares cursors of two stores. Exclusive: `after` = c answers the changes after c. The work log's cursor is the decimal seq (`\\\"0\\\"` = before the first event). In the code: mcp/mod.rs fn parse_cursor (the seq as a decimal string, no sign, no leading zero; anything else is cursor_invalid).\"\n },\n \"Store\": {\n \"type\": \"string\",\n \"enum\": [\n \"work\",\n \"directory\",\n \"jobs\"\n ],\n \"$comment\": \"which store's feed answered: work = the work log (sharedcontext/1), directory = an identity service's directory, jobs = a job API. A follower that reads several feeds keeps one cursor per store.\"\n },\n \"Change\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"cursor\",\n \"at\",\n \"kind\",\n \"subject\",\n \"ref\"\n ],\n \"properties\": {\n \"cursor\": {\n \"$ref\": \"#/$defs/Cursor\",\n \"$comment\": \"this change's own position; a follower that stops after it resumes with after = this\"\n },\n \"at\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"$comment\": \"unix seconds the store took the change (the log: received_at)\"\n },\n \"kind\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 64,\n \"$comment\": \"the store's own vocabulary. work: the event type (e.g. claim.taken); directory: e.g. member.updated; jobs: the job state it entered\"\n },\n \"subject\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 256,\n \"$comment\": \"what changed: work: the node id (the project id for project.* events); directory: the member, team or org id; jobs: the job id\"\n },\n \"ref\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 256,\n \"$comment\": \"where the body is: work: the event id (64 hex); directory: the record's version; jobs: the job id again or its status digest\"\n }\n },\n \"$comment\": \"lib.rs fn changes_page: cursor = seq, at = received_at_ms / 1000, kind = the event type (tag w), subject = the node id (tag n) or, for an event without one, the project id (tag j), ref = the event id\"\n },\n \"ChangesPage\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"store\",\n \"changes\",\n \"next_cursor\",\n \"head_cursor\"\n ],\n \"properties\": {\n \"store\": {\n \"$ref\": \"#/$defs/Store\"\n },\n \"changes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Change\"\n },\n \"maxItems\": 1000\n },\n \"next_cursor\": {\n \"$ref\": \"#/$defs/Cursor\",\n \"$comment\": \"send it as the next `after`; the last position the store scanned: the last change's cursor, or past it when `kinds` left later changes out, or the request's `after` (or the store's start) when nothing is after it\"\n },\n \"head_cursor\": {\n \"$ref\": \"#/$defs/Cursor\",\n \"$comment\": \"the store's newest position now; next_cursor = head_cursor means caught up\"\n }\n },\n \"$comment\": \"lib.rs fn changes_page: store is always work there; next_cursor = the store's next_after_seq (never before after); head_cursor = the head seq (never before next_cursor). Sent as the tool's structured result\"\n },\n \"ChangesRefusal\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\n \"refused\",\n \"reason\"\n ],\n \"properties\": {\n \"refused\": {\n \"type\": \"string\",\n \"enum\": [\n \"feed_off\",\n \"cursor_invalid\",\n \"cursor_ahead\",\n \"cursor_gone\"\n ],\n \"$comment\": \"feed_off: the store does not serve the feed (its switch is off; on an MCP binding the tool is simply not listed, so this is the GET binding's answer). cursor_invalid: not a cursor this store issued. cursor_ahead: after is past the head (another store, or a store restored from an older copy: the follower stops). cursor_gone: history before oldest_cursor is no longer kept; the follower rebuilds from the store's own snapshot read, then follows from oldest_cursor (the work log never answers it in 1.x: it is append-only).\"\n },\n \"reason\": {\n \"type\": \"string\",\n \"maxLength\": 512\n },\n \"oldest_cursor\": {\n \"$ref\": \"#/$defs/Cursor\",\n \"$comment\": \"with cursor_gone only\"\n },\n \"head_cursor\": {\n \"$ref\": \"#/$defs/Cursor\",\n \"$comment\": \"with cursor_ahead only\"\n }\n },\n \"$comment\": \"lib.rs fn changes_page: cursor_invalid and cursor_ahead (with head_cursor), sent as a structured error result. The work log never answers cursor_gone (append-only) and never feed_off on MCP (off, the tool is not listed: an unknown tool). A kinds list over the limits is refused with mcp-tools.schema.json's Refusal shape ({reason: invalid_args, detail}), not this one\"\n }\n }\n}\n",
7
+ "content.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1 event content (1.1)\",\n \"description\": \"The content of each work event type, keyed by the event's w tag: use \\\"#/$defs/<type>\\\" (for example \\\"#/$defs/claim.taken\\\"). Fields are optional at this level because every payload field has a serde default; which fields a type needs, and the cross-field and state rules, are the log's (crates/sharedcontext/src/work/log.rs), so content that passes this schema can still be refused. Enumerations are given only where the log checks a fixed list in code; the rest (states, severities, gate kinds, roles in rules) come from the policy and grow without a schema change. An unknown type is refused by the log (unknown_type) and skipped by the fold.\",\n \"$comment\": \"sharedcontext/1.1: 1.0 plus the multi-repo minor. Source: crates/sharedcontext/src/work/types.rs (payload structs, KNOWN_TYPES, content_fields) and crates/sharedcontext/src/work/log.rs (the fixed-list checks); crates/sharedcontext/src/signed/registry.rs (Actor, Limits). Option fields accept null, as serde does. Types (35, KNOWN_TYPES order; project.repo_set is 1.1's, after 1.0's 34): project.created, project.policy_set, node.created, node.updated, node.moved, node.linked, node.unlinked, node.split, node.merged, node.closed, node.reopened, note.added, context.pinned, claim.taken, claim.renewed, claim.released, claim.expired, state.transitioned, gate.cleared, evidence.attached, findings.seen, ref.set, adapter.synced, change.external_event, external.state_changed, goal.measures_set, measure.observed, actor.enrolled, project.profile_set, project.budget_set, project.rule_set, project.budget_incident, cost.recorded, gate.approved, project.repo_set. 1.1 also adds RepoRef, RepoEntry and RepoKey, repos and the never-both rule on project.created, repo on node.created, change.external_event, ref.set and the registry Actor, and two shapes that are not event content (PolicyFieldOwnershipByRepo, RejectRepoOutOfScope).\",\n \"type\": \"object\",\n \"$defs\": {\n \"SessionRef\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs SessionRef\",\n \"properties\": {\n \"agent_cli\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"at most 64 bytes (MAX_AGENT_CLI_BYTES)\"\n },\n \"session_id\": {\n \"type\": \"string\",\n \"$comment\": \"at most 128 bytes (MAX_SESSION_ID_BYTES)\"\n }\n }\n },\n \"Repo\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Repo\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\"\n },\n \"owner\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n }\n },\n \"RepoRef\": {\n \"type\": \"object\",\n \"$comment\": \"sharedcontext/1.1: a repository is {host, owner, name}, each non-empty; its repo key is the lower-case string host/owner/name, and two repositories are the same when their keys are equal. crates/sharedcontext/src/work/types.rs Repo (key, is_complete). Lenient at its own level as 1.0's nested objects are; the log refuses unknown nested fields (named by path), which this schema does not yet express for any nested object.\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"owner\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"required\": [\n \"host\",\n \"owner\",\n \"name\"\n ]\n },\n \"RepoEntry\": {\n \"type\": \"object\",\n \"$comment\": \"sharedcontext/1.1: one entry of project.created.repos; default_branch per repository. crates/sharedcontext/src/work/types.rs RepoEntry.\",\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/RepoRef\"\n }\n ],\n \"properties\": {\n \"default_branch\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"RepoKey\": {\n \"type\": \"string\",\n \"$comment\": \"sharedcontext/1.1: a registry actor's scope: a repo key (lower-case host/owner/name) or \\\"*\\\" for a project-wide adapter (an issue tracker). crates/sharedcontext/src/signed/registry.rs Actor.repo; crates/sharedcontext/src/work/multirepo.rs.\",\n \"pattern\": \"^(\\\\*|[^/A-Z\\\\s]+/[^/A-Z\\\\s]+/[^/A-Z\\\\s]+)$\"\n },\n \"PrRef\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs PrRef\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\"\n },\n \"owner\": {\n \"type\": \"string\"\n },\n \"repo\": {\n \"type\": \"string\"\n },\n \"number\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Origin\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Origin\",\n \"properties\": {\n \"source\": {\n \"type\": \"string\"\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"Marker\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Marker: a sha plus a time, never a key\",\n \"properties\": {\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"run_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n }\n },\n \"Horizon\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Horizon (unix seconds)\",\n \"properties\": {\n \"from\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"to\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Measure\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Measure\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"target\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"$comment\": \"integer; the unit carries the scale\"\n },\n \"unit\": {\n \"type\": \"string\"\n },\n \"source\": {\n \"type\": \"string\"\n },\n \"direction\": {\n \"enum\": [\n \"at_least\",\n \"at_most\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: MEASURE_DIRECTIONS; at_least when absent\"\n }\n }\n },\n \"SplitPart\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs SplitPart\",\n \"properties\": {\n \"node_id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"body\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"severity\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"CloseEvidence\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs CloseEvidence\",\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"record_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"facts_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"rules_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covered\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"Override\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Override\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\"\n },\n \"policy_clause\": {\n \"type\": \"string\"\n }\n }\n },\n \"Cancel\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Cancel\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\"\n }\n }\n },\n \"Unverified\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Unverified\",\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_state\": {\n \"type\": \"string\"\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"ClosedAt\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClosedAt\",\n \"properties\": {\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n }\n },\n \"RegressionEvidence\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RegressionEvidence\",\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"seen\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"Blob\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Blob\",\n \"properties\": {\n \"digest\": {\n \"type\": \"string\"\n },\n \"media_type\": {\n \"type\": \"string\"\n },\n \"bytes\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Gate\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Gate\",\n \"properties\": {\n \"kind\": {\n \"type\": \"string\",\n \"$comment\": \"gate kinds come from the policy (GATE_KINDS is the default list, crates/sharedcontext/src/work/policy.rs)\"\n },\n \"ref\": {\n \"type\": \"string\"\n }\n }\n },\n \"Verdict\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Verdict\",\n \"properties\": {\n \"finding_fp\": {\n \"type\": \"string\"\n },\n \"verdict\": {\n \"type\": \"string\"\n },\n \"record_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"Provenance\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Provenance: the log refuses keys outside this list inside source (invalid_value, unknown_provenance_fields)\",\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"via\": {\n \"enum\": [\n \"webhook\",\n \"poll\",\n \"reconcile\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: PROVENANCE_VIA\"\n },\n \"id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"url\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"delivered_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n },\n \"additionalProperties\": false\n },\n \"Scope\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Scope\",\n \"properties\": {\n \"kind\": {\n \"type\": \"string\"\n },\n \"id\": {\n \"type\": \"string\"\n }\n }\n },\n \"Flags\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Flags\",\n \"properties\": {\n \"enrol_agents\": {\n \"type\": \"boolean\"\n },\n \"create_skills\": {\n \"type\": \"boolean\"\n },\n \"assign_work\": {\n \"type\": \"boolean\"\n }\n }\n },\n \"Limits\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs Limits: both fields required (no serde default)\",\n \"properties\": {\n \"events_per_min\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 4294967295\n },\n \"open_claims\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 4294967295\n }\n },\n \"required\": [\n \"events_per_min\",\n \"open_claims\"\n ]\n },\n \"Actor\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs Actor: role required; sharedcontext/1.1: repo, skip_serializing_if None, so a registry without it keeps its policy digest\",\n \"properties\": {\n \"role\": {\n \"enum\": [\n \"agent\",\n \"person\",\n \"steward\",\n \"system\",\n \"adapter\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: signed::ROLES, checked on project.policy_set\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"stage\": {\n \"enum\": [\n \"shadow\",\n \"nonprod\",\n \"prod\"\n ],\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs STAGES; default nonprod\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/Limits\"\n },\n \"owner\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"expires_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"repo\": {\n \"$ref\": \"#/$defs/RepoKey\",\n \"$comment\": \"The scope of an adapter-role key. Absent serializes as today, so existing policy digests are unchanged; read as \\\"*\\\" while the project has one active repository.\"\n }\n },\n \"required\": [\n \"role\"\n ]\n },\n \"ProfileFields\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProfileFields\",\n \"properties\": {\n \"org\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"teams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"member_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"flags\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Flags\"\n }\n ]\n },\n \"trust\": {\n \"enum\": [\n \"standard\",\n \"review\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: TRUST_LEVELS\"\n },\n \"lifecycle\": {\n \"enum\": [\n \"active\",\n \"paused\",\n \"retired\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: LIFECYCLES\"\n }\n }\n },\n \"PolicyFieldOwnershipByRepo\": {\n \"type\": \"object\",\n \"$comment\": \"Not event content. sharedcontext/1.1: the service's policy file, not the log. {\\\"<repo key>\\\": {field: owner}} overrides single fields for one repository; the native-only list (state, claims, covers, evidence, keys) cannot be overridden (a policy load error). An older service silently ignores it, so the service upgrades first. crates/sharedcontext/src/work/policy.rs Policy.field_ownership_by_repo, multirepo.rs.\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n },\n \"RejectRepoOutOfScope\": {\n \"type\": \"object\",\n \"$comment\": \"Not event content. sharedcontext/1.1: the reject repo_out_of_scope, a new reject name with no v bump. Refused: a write by a repo-scoped key on a node whose resolved repo is another one; the build checks every node write of a scoped key, not only the types first listed (ref.set, adapter.synced, change.external_event, external.state_changed, gate.cleared{approval}, node.updated of an owned field, node.created{origin: adapter}). Checked before field_not_owned. crates/sharedcontext/src/work/multirepo.rs; crates/sharedcontext/src/signed/verifier.rs RejectReason::RepoOutOfScope. Open point: a node of a project with no repository has no node_repo, and the build sends null there, which this shape refuses; reachable only with a scoped key in a repository-less project.\",\n \"properties\": {\n \"reason\": {\n \"const\": \"repo_out_of_scope\"\n },\n \"detail\": {\n \"type\": \"object\",\n \"properties\": {\n \"key_repo\": {\n \"$ref\": \"#/$defs/RepoKey\"\n },\n \"node_repo\": {\n \"$ref\": \"#/$defs/RepoKey\"\n }\n },\n \"required\": [\n \"key_repo\",\n \"node_repo\"\n ]\n }\n },\n \"required\": [\n \"reason\",\n \"detail\"\n ]\n },\n \"project.created\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"repo\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Repo\"\n }\n ]\n },\n \"default_branch\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"policy_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"repos\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": {\n \"$ref\": \"#/$defs/RepoEntry\"\n },\n \"$comment\": \"At least one; the first is the primary repo. Duplicate repo keys are refused by the log (invalid_value); JSON Schema here cannot compare keys.\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProjectCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source. sharedcontext/1.1: repos, at least one, the first primary; repo (the 1.0 form) or repos, never both (invalid_value). A repo-only project stays valid and folds as repos: [{...repo, default_branch}] (ProjectCreated.repos).\",\n \"not\": {\n \"required\": [\n \"repo\",\n \"repos\"\n ],\n \"$comment\": \"Repo (today's form) or repos, never both (invalid_value)\"\n }\n },\n \"project.policy_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"policy_ref\": {\n \"type\": \"string\"\n },\n \"effective_from_seq\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"actors\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/Actor\"\n },\n \"$comment\": \"hex pubkey → actor\"\n },\n \"params\": {\n \"$comment\": \"any JSON value\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProjectPolicySet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.created\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"epic\",\n \"issue\",\n \"task\",\n \"subtask\",\n \"change\",\n \"goal\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: NODE_KINDS\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"body\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"parent\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"origin\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Origin\"\n }\n ]\n },\n \"labels\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"priority\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"cluster_key\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fp_scheme\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"declaration_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"opened_at\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Marker\"\n }\n ]\n },\n \"pr\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/PrRef\"\n }\n ]\n },\n \"for\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"base_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"owner\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"horizon\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Horizon\"\n }\n ]\n },\n \"weight\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"measures\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Measure\"\n }\n },\n \"repo\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/RepoRef\"\n }\n ],\n \"$comment\": \"Optional for any kind. A change resolves to exactly one repo: repo, else pr's, else the only active repo; in a project with two or more active repos a change with neither is refused (invalid_value, detail `repo required`), and repo and pr must agree. Fixed at creation.\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source. sharedcontext/1.1: repo, NodeCreated.repo.\"\n },\n \"node.updated\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"patch\": {\n \"type\": \"object\",\n \"$comment\": \"field → new value\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeUpdated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.moved\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"parent\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeMoved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.linked\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"edge\": {\n \"enum\": [\n \"blocks\",\n \"relates\",\n \"duplicates\",\n \"split_from\",\n \"merged_into\",\n \"derived_from\",\n \"serves\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)\"\n },\n \"to\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.unlinked\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"edge\": {\n \"enum\": [\n \"blocks\",\n \"relates\",\n \"duplicates\",\n \"split_from\",\n \"merged_into\",\n \"derived_from\",\n \"serves\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)\"\n },\n \"to\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.split\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"into\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/SplitPart\"\n }\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeSplit. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.merged\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"into\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeMerged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.closed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"outcome\": {\n \"enum\": [\n \"done\",\n \"cancelled\",\n \"duplicate\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: OUTCOMES; a goal's close takes GOAL_OUTCOMES (done, cancelled)\"\n },\n \"evidence\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/CloseEvidence\"\n }\n ]\n },\n \"override\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Override\"\n }\n ]\n },\n \"cancel\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Cancel\"\n }\n ]\n },\n \"unverified\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Unverified\"\n }\n ]\n },\n \"closed_at\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/ClosedAt\"\n }\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeClosed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.reopened\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"cause\": {\n \"enum\": [\n \"regression\",\n \"override_reversed\",\n \"cancel_reversed\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: REOPEN_CAUSES\"\n },\n \"evidence\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/RegressionEvidence\"\n }\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeReopened. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"note.added\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"layer\": {\n \"enum\": [\n \"pinned\",\n \"working\",\n \"summary\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/types.rs: NOTE_LAYERS\"\n },\n \"text\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"blob\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Blob\"\n }\n ]\n },\n \"supersedes\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NoteAdded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"context.pinned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"text\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"blob\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Blob\"\n }\n ]\n },\n \"supersedes\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ContextPinned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.taken\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"lease_s\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"intent\": {\n \"enum\": [\n \"fix\",\n \"triage\",\n \"review\",\n \"verify\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: CLAIM_INTENTS\"\n },\n \"on_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimTaken. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.renewed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"lease_s\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"progress\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimRenewed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.released\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"reason\": {\n \"enum\": [\n \"done\",\n \"blocked\",\n \"handoff\",\n \"abandoned\",\n \"needs_input\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RELEASE_REASONS; handoff also needs a p tag\"\n },\n \"to\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimReleased. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.expired\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"claim\": {\n \"type\": \"string\"\n },\n \"lease_until\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"swept_at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimExpired. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"state.transitioned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"from\": {\n \"type\": \"string\"\n },\n \"to\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"by_rule\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"gate\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Gate\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs StateTransitioned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"gate.cleared\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ref\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GateCleared. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"evidence.attached\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"record_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"stage\": {\n \"type\": \"string\"\n },\n \"verdicts\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Verdict\"\n }\n },\n \"coverage\": {\n \"type\": \"string\"\n },\n \"confidence\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs EvidenceAttached. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"findings.seen\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"seen\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"gone\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"fp_scheme\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs FindingsSeen. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"ref.set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_id\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fields_owned\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"blocked_by\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"string\"\n },\n \"$comment\": \"the whole current list for this system; absent leaves it as it was\"\n },\n \"repo\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/RepoRef\"\n }\n ],\n \"$comment\": \"Required when the signing key is scoped to one repository, and equal to the node's resolved repo; a \\\"*\\\"-scoped key or a steward sends none (checked when present). A log rule, so the shape keeps it optional.\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RefSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source. sharedcontext/1.1: repo, RefSet.repo.\"\n },\n \"adapter.synced\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_id\": {\n \"type\": \"string\"\n },\n \"direction\": {\n \"type\": \"string\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"external_version\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs AdapterSynced. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"change.external_event\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"event\": {\n \"enum\": [\n \"opened\",\n \"synchronized\",\n \"review_requested\",\n \"approved\",\n \"merged\",\n \"closed\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EXTERNAL_EVENTS\"\n },\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"merge_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"pr\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/PrRef\"\n }\n ]\n },\n \"external_status\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n },\n \"repo\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/RepoRef\"\n }\n ],\n \"$comment\": \"Required in a project with two or more active repositories and equal to the node's resolved repo; optional (checked when present) in a single-repo project. The requirement is a log rule, so the shape keeps it optional.\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ChangeExternalEvent. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source. sharedcontext/1.1: repo, ChangeExternalEvent.repo.\"\n },\n \"external.state_changed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"from\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"to\": {\n \"type\": \"string\"\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"external_status\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ExternalStateChanged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"goal.measures_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"measures\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Measure\"\n }\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GoalMeasuresSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"measure.observed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"measure\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"source_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs MeasureObserved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"actor.enrolled\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"sponsor\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"stage\": {\n \"enum\": [\n \"shadow\",\n \"nonprod\",\n \"prod\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: signed::STAGES\"\n },\n \"limits\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Limits\"\n }\n ]\n },\n \"expires_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"profile\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/ProfileFields\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ActorEnrolled. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.profile_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"kind\": {\n \"enum\": [\n \"person\",\n \"agent\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/types.rs MEMBER_KINDS\"\n },\n \"sponsor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"org\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"teams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"member_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"flags\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Flags\"\n }\n ]\n },\n \"trust\": {\n \"enum\": [\n \"standard\",\n \"review\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: TRUST_LEVELS\"\n },\n \"lifecycle\": {\n \"enum\": [\n \"active\",\n \"paused\",\n \"retired\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: LIFECYCLES\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProfileSet (flattens ProfileFields). Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.budget_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/Scope\"\n }\n ],\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"org\",\n \"team\",\n \"project\",\n \"goal\",\n \"agent\",\n \"session\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_SCOPES\"\n }\n }\n },\n \"metric\": {\n \"enum\": [\n \"billed_cents\",\n \"tokens\",\n \"compute_minutes\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_METRICS\"\n },\n \"window\": {\n \"enum\": [\n \"calendar_month_utc\",\n \"lifetime\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_WINDOWS\"\n },\n \"amount\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"warn_percent\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"hard_stop\": {\n \"type\": \"boolean\"\n },\n \"unpriced\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"block (default) · allow\"\n },\n \"active\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"$comment\": \"false withdraws the budget; default true\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs BudgetSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.rule_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/Scope\"\n }\n ],\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"org\",\n \"team\",\n \"agent\",\n \"member\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RULE_SCOPES\"\n }\n }\n },\n \"effect\": {\n \"enum\": [\n \"permit\",\n \"forbid\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RULE_EFFECTS\"\n },\n \"actions\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"active\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RuleSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.budget_incident\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"budget\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"$ref\": \"#/$defs/Scope\"\n },\n \"metric\": {\n \"type\": \"string\"\n },\n \"window\": {\n \"type\": \"string\"\n },\n \"spent\": {\n \"type\": \"integer\"\n },\n \"amount\": {\n \"type\": \"integer\"\n },\n \"cost\": {\n \"type\": \"string\",\n \"$comment\": \"the cost.recorded event that crossed the limit\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"unpriced\": {\n \"type\": \"boolean\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs BudgetIncident. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"cost.recorded\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"agent\": {\n \"type\": \"string\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"goal\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"job\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"biller\": {\n \"type\": \"string\"\n },\n \"billing_type\": {\n \"enum\": [\n \"metered\",\n \"subscription_included\",\n \"subscription_overage\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BILLING_TYPES\"\n },\n \"amount\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"unit\": {\n \"enum\": [\n \"billed_cents\",\n \"tokens\",\n \"compute_minutes\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_METRICS as the unit\"\n },\n \"unpriced\": {\n \"type\": \"boolean\"\n },\n \"idempotency_key\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs CostRecorded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"gate.approved\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ref\": {\n \"type\": \"string\",\n \"$comment\": \"the open approval gate\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GateApproved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.repo_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"sharedcontext/1.1: crates/sharedcontext/src/work/types.rs ProjectRepoSet; steward-signed, tag j and no n. Adds a repository or changes the default_branch or state of a listed one, keyed by repo key. Never removes. Log rules (not shape): archiving the only active repository is refused; activating a second repository is refused while any adapter key in the registry has no repo. Top-level fields are strict: the log refuses any other (unknown_field).\",\n \"properties\": {\n \"repo\": {\n \"$ref\": \"#/$defs/RepoRef\"\n },\n \"default_branch\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"state\": {\n \"enum\": [\n \"active\",\n \"archived\"\n ]\n }\n },\n \"required\": [\n \"repo\",\n \"state\"\n ]\n }\n }\n}\n",
8
+ "context.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1.6, context provenance and lessons\",\n \"$comment\": \"sharedcontext/1.6, an additive minor of sharedcontext/1, built on the execution vocabulary (execution.schema.json, sharedcontext/1.5): the lesson shape and the attempts are that minor's. Holds what this minor adds: context.pinned with lesson and unpin (who: person and steward only), the context bundle pinned field by field with each item's provenance (signer, role, verified, untrusted), the pinned lessons, the lesson candidates, the node's attempts and a size budget, and the policy param for the budget. context.pinned copies 1.0's definition and adds to it. The bundle is the answer of context(node), and what an execution gateway may hand a job; 1.0 leaves it unpinned (mcp-tools.schema.json FoldedView). Every addition to it is a new key, so a body that reads today's bundle reads this one. Served only with the policy switch context.provenance on (crates/sharedcontext/src/work/context.rs). Checked by contract-check.mjs against cases/context.cases.jsonl and against the bundles the code serves (crates/sharedcontext/tests/work/context/bundles.jsonl). Not yet merged into content.schema.json and mcp-tools.schema.json.\",\n \"$defs\": {\n \"EventId\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{64}$\" },\n \"Pubkey\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{64}$\" },\n \"Role\": { \"enum\": [\"agent\", \"person\", \"steward\", \"system\", \"adapter\"], \"$comment\": \"the registry version in force at the item's seq\" },\n \"Provenance\": {\n \"type\": \"object\",\n \"$comment\": \"Who wrote an item of the bundle and how far to trust it. signer, role and sponsor come from the event that wrote the item and the registry version in force at its seq. verified: the log checked the content, or the system signed it from a qualifying source (evidence.attached, findings.seen, measure.observed); authored text is never verified, whoever signed it. untrusted: the text is data, never instructions: written by an agent or an adapter key, a node's title or body whose origin is outside (origin.source adapter or run: a customer's ticket, an evaluator's finding), or a note the system signed (the system only relays or rolls up text others wrote). The shape holds two of these rules: an agent's or an adapter's item is untrusted, and only the system's is verified.\",\n \"properties\": {\n \"signer\": { \"$ref\": \"#/$defs/Pubkey\" },\n \"role\": { \"$ref\": \"#/$defs/Role\" },\n \"sponsor\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Pubkey\" }], \"$comment\": \"for an agent, the registry owner (its human sponsor); null for anyone else\" },\n \"event\": { \"$ref\": \"#/$defs/EventId\" },\n \"seq\": { \"type\": \"integer\", \"minimum\": 1 },\n \"verified\": { \"type\": \"boolean\" },\n \"untrusted\": { \"type\": \"boolean\" }\n },\n \"required\": [\"signer\", \"role\", \"event\", \"seq\", \"verified\", \"untrusted\"],\n \"allOf\": [\n {\n \"if\": { \"properties\": { \"role\": { \"enum\": [\"agent\", \"adapter\"] } }, \"required\": [\"role\"] },\n \"then\": { \"properties\": { \"untrusted\": { \"const\": true } } },\n \"$comment\": \"an agent's or an adapter's item is untrusted, always\"\n },\n {\n \"if\": { \"properties\": { \"verified\": { \"const\": true } }, \"required\": [\"verified\"] },\n \"then\": { \"properties\": { \"role\": { \"const\": \"system\" } } },\n \"$comment\": \"only the system's content is verified (evidence, findings, measures)\"\n }\n ]\n },\n \"context.pinned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"sharedcontext/1.6: 1.0's context.pinned plus lesson (the event id of a note.added{layer: lesson} anywhere in this log) and unpin. A pin with lesson pins that lesson on n: it flows down to n's descendants whose kind and labels match its scope, as pinned context does. With unpin: true it ends that lesson's pin on n. Who: person and steward only (policy who[\\\"context.pinned:lesson\\\"]); an agent's pin with lesson is refused role_not_allowed, and no sponsor or permit lifts it: Policy::grantable answers false for context.pinned:lesson whatever the who row of context.pinned says. A policy document that lists any role but person and steward under context.pinned:lesson is a policy load error, and a project.policy_set carrying it is refused (invalid_value), so no policy widens it. A sandboxed body's pin is signed by the gateway as the hosted agent, so it is refused like any agent's (crates/sharedcontext/tests/work/context/pin-rules.jsonl). Log rules (not shape): lesson names a lesson note of this log (invalid_value); unpin only of a lesson pinned on n (invalid_value). text is the pinner's own note on why, and is the pinner's (trusted when a person or steward signs it). An older log refuses lesson and unpin (unknown_field).\",\n \"properties\": {\n \"text\": { \"type\": [\"string\", \"null\"] },\n \"blob\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }] },\n \"supersedes\": { \"type\": [\"string\", \"null\"] },\n \"session\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/SessionRef\" }] },\n \"lesson\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] },\n \"unpin\": { \"type\": [\"boolean\", \"null\"] }\n },\n \"allOf\": [\n {\n \"if\": { \"required\": [\"unpin\"], \"properties\": { \"unpin\": { \"const\": true } } },\n \"then\": { \"required\": [\"lesson\"], \"properties\": { \"lesson\": { \"$ref\": \"#/$defs/EventId\" } } },\n \"$comment\": \"unpin names the lesson it ends\"\n }\n ]\n },\n \"policy.context\": {\n \"type\": \"object\",\n \"$comment\": \"Policy param: the size budget of the bundle served for a claim (context(node) for a claimant, or the bundle an execution gateway hands a job), as the bytes of its canonical JSON. In project.policy_set{params: {context}}, steward-signed, read by the service's context read and ignored by the fold. Default max_bytes 65536; max_bytes_by_intent overrides it per claim intent. A node's own facts, pins by people and stewards, pinned lessons and the evidence slice are never cut.\",\n \"properties\": {\n \"max_bytes\": { \"type\": \"integer\", \"minimum\": 4096, \"maximum\": 1048576 },\n \"max_bytes_by_intent\": {\n \"type\": \"object\",\n \"properties\": {\n \"fix\": { \"type\": \"integer\", \"minimum\": 4096, \"maximum\": 1048576 },\n \"triage\": { \"type\": \"integer\", \"minimum\": 4096, \"maximum\": 1048576 },\n \"review\": { \"type\": \"integer\", \"minimum\": 4096, \"maximum\": 1048576 },\n \"verify\": { \"type\": \"integer\", \"minimum\": 4096, \"maximum\": 1048576 }\n },\n \"additionalProperties\": false\n }\n },\n \"required\": [\"max_bytes\"],\n \"additionalProperties\": false\n },\n \"PinnedItem\": {\n \"type\": \"object\",\n \"$comment\": \"1.0's pinned entry (crates/sharedcontext/src/work/reads.rs pinned_context: node, text, blob, by, event, pin) plus provenance\",\n \"properties\": {\n \"node\": { \"type\": \"string\" },\n \"text\": { \"type\": [\"string\", \"null\"] },\n \"blob\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }] },\n \"by\": { \"$ref\": \"#/$defs/Pubkey\" },\n \"event\": { \"$ref\": \"#/$defs/EventId\" },\n \"pin\": { \"type\": \"boolean\" },\n \"provenance\": { \"$ref\": \"#/$defs/Provenance\" }\n },\n \"required\": [\"node\", \"by\", \"event\", \"provenance\"]\n },\n \"NoteItem\": {\n \"type\": \"object\",\n \"$comment\": \"1.0's working note entry (text, by, seq) plus event and provenance\",\n \"properties\": {\n \"text\": { \"type\": [\"string\", \"null\"] },\n \"by\": { \"$ref\": \"#/$defs/Pubkey\" },\n \"seq\": { \"type\": \"integer\", \"minimum\": 1 },\n \"event\": { \"$ref\": \"#/$defs/EventId\" },\n \"provenance\": { \"$ref\": \"#/$defs/Provenance\" }\n },\n \"required\": [\"by\", \"seq\", \"provenance\"]\n },\n \"SummaryItem\": {\n \"type\": \"object\",\n \"$comment\": \"1.0's child summary entry (node, kind, title, state, summary) plus the provenance of the summary and of the title\",\n \"properties\": {\n \"node\": { \"type\": \"string\" },\n \"kind\": { \"type\": \"string\" },\n \"title\": { \"type\": [\"string\", \"null\"] },\n \"state\": { \"type\": \"string\" },\n \"summary\": {},\n \"provenance\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Provenance\" }], \"$comment\": \"of the summary; null when the child has none\" },\n \"title_provenance\": { \"$ref\": \"#/$defs/Provenance\" }\n },\n \"required\": [\"node\", \"kind\", \"state\", \"provenance\", \"title_provenance\"]\n },\n \"LessonItem\": {\n \"type\": \"object\",\n \"$comment\": \"a lesson in the bundle: the lesson note (its provenance: an agent's text is untrusted even when pinned) and, for a pinned lesson, the pin (pinned_by: a person or steward)\",\n \"properties\": {\n \"note\": { \"$ref\": \"#/$defs/EventId\" },\n \"node\": { \"type\": \"string\", \"$comment\": \"where the lesson note was written\" },\n \"lesson\": { \"$ref\": \"execution.schema.json#/$defs/Lesson\" },\n \"provenance\": { \"$ref\": \"#/$defs/Provenance\" },\n \"pinned_on\": { \"type\": [\"string\", \"null\"], \"$comment\": \"the node the pin is on (this node or an ancestor); null for a candidate\" },\n \"pinned_by\": { \"anyOf\": [{ \"type\": \"null\" }, { \"allOf\": [{ \"$ref\": \"#/$defs/Provenance\" }, { \"properties\": { \"role\": { \"enum\": [\"person\", \"steward\"] } } }] }], \"$comment\": \"the pin's provenance: a person or a steward only\" }\n },\n \"required\": [\"note\", \"node\", \"lesson\", \"provenance\", \"pinned_on\", \"pinned_by\"]\n },\n \"AttemptItem\": {\n \"type\": \"object\",\n \"$comment\": \"one attempt on this node or in a run whose claim is on this node, newest first: what an agent learns from before it tries again\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"step\": { \"type\": \"string\" },\n \"round\": { \"type\": \"integer\", \"minimum\": 1 },\n \"node\": { \"type\": \"string\" },\n \"outcome\": { \"anyOf\": [{ \"type\": \"null\" }, { \"enum\": [\"completed\", \"failed\", \"budget_exceeded\", \"cancelled\", \"abandoned\"] }], \"$comment\": \"null while running\" },\n \"record\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }] },\n \"reasons\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"provenance\": { \"$ref\": \"#/$defs/Provenance\", \"$comment\": \"of attempt.ended (or attempt.started while running)\" }\n },\n \"required\": [\"run\", \"step\", \"round\", \"node\", \"outcome\", \"provenance\"]\n },\n \"EvidenceItem\": {\n \"type\": \"object\",\n \"$comment\": \"1.0's evidence slice entry (run_id, sha, stage, coverage, confidence, record_digest, deviations) plus provenance (system, verified)\",\n \"properties\": {\n \"run_id\": { \"type\": \"string\" },\n \"sha\": { \"type\": [\"string\", \"null\"] },\n \"stage\": { \"type\": [\"string\", \"null\"] },\n \"coverage\": { \"type\": [\"string\", \"null\"] },\n \"confidence\": { \"type\": [\"string\", \"null\"] },\n \"record_digest\": { \"type\": [\"string\", \"null\"] },\n \"deviations\": { \"type\": [\"integer\", \"null\"], \"minimum\": 0, \"$comment\": \"the fold's count of deviation verdicts (EvidenceObs.deviations, u32)\" },\n \"provenance\": { \"$ref\": \"#/$defs/Provenance\" }\n },\n \"required\": [\"run_id\", \"provenance\"]\n },\n \"GoalItem\": {\n \"type\": \"object\",\n \"$comment\": \"one goal the node serves, directly or through an ancestor (crates/sharedcontext/src/work/reads.rs context_at: the goal's summary, via, pinned, measures). The goal's own fields stay lenient; its pins are the pins on the goal node, each a PinnedItem with provenance. Agents may pin on goals (who[\\\"context.pinned\\\"] is agent, person, steward, and the goal guards do not cover pins), so an agent's goal pin reaches every node that serves the goal: it arrives marked untrusted, and it is cut with agents' pins\",\n \"properties\": {\n \"pinned\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/PinnedItem\" } }\n },\n \"required\": [\"pinned\"]\n },\n \"Budget\": {\n \"type\": \"object\",\n \"$comment\": \"The size budget this bundle was cut to (policy.context), its size as canonical JSON, and what was cut by section; over is true when the parts never cut exceed the budget on their own (served whole, never truncated further)\",\n \"properties\": {\n \"max_bytes\": { \"type\": \"integer\", \"minimum\": 0 },\n \"bytes\": { \"type\": \"integer\", \"minimum\": 0 },\n \"over\": { \"type\": \"boolean\" },\n \"cut\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"section\": { \"enum\": [\"lesson_candidates\", \"working_notes\", \"attempts\", \"children_summaries\", \"pinned\", \"goal_pins\"] },\n \"dropped\": { \"type\": \"integer\", \"minimum\": 1 },\n \"kept\": { \"type\": \"integer\", \"minimum\": 0 }\n },\n \"required\": [\"section\", \"dropped\", \"kept\"]\n }\n }\n },\n \"required\": [\"max_bytes\", \"bytes\", \"over\", \"cut\"]\n },\n \"ContextBundle\": {\n \"type\": \"object\",\n \"$comment\": \"context(node) with provenance. The 1.0 keys keep their names and meaning (crates/sharedcontext/src/work/reads.rs context_at: node, goals, ancestors, pinned, working_notes, children_summaries, done_blockers, open_blockers, gate, evidence_slice, declaration_ref, linked_changes); new keys: node_provenance, lessons, lesson_candidates, attempts, at_seq, budget. node stays lenient (the folded view, unpinned in 1.0); a goal keeps its own fields lenient and its pins carry provenance (GoalItem). The fold's derived facts (state, gate, claim, blockers, linked changes) are the log's own and carry no provenance.\",\n \"properties\": {\n \"node\": { \"type\": \"object\" },\n \"node_provenance\": {\n \"type\": \"object\",\n \"properties\": { \"title\": { \"$ref\": \"#/$defs/Provenance\" }, \"body\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Provenance\" }] } },\n \"required\": [\"title\", \"body\"],\n \"$comment\": \"of the last event that wrote the node's title and body (node.created, or node.updated for that field)\"\n },\n \"goals\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/GoalItem\" } },\n \"ancestors\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"pinned\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/PinnedItem\" } },\n \"lessons\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/LessonItem\" }, \"$comment\": \"pinned lessons in force here: pinned on this node or an ancestor, scope matching this node; each with pinned_by\" },\n \"lesson_candidates\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/LessonItem\" }, \"$comment\": \"unpinned lesson notes written on this node only; pinned_on and pinned_by null\" },\n \"working_notes\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/NoteItem\" } },\n \"children_summaries\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/SummaryItem\" } },\n \"attempts\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/AttemptItem\" } },\n \"done_blockers\": { \"type\": \"array\" },\n \"open_blockers\": { \"type\": \"array\" },\n \"gate\": {},\n \"evidence_slice\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/EvidenceItem\" } },\n \"declaration_ref\": { \"type\": [\"string\", \"null\"] },\n \"linked_changes\": {},\n \"at_seq\": { \"type\": \"integer\", \"minimum\": 0, \"$comment\": \"the head seq the bundle was read at\" },\n \"budget\": { \"$ref\": \"#/$defs/Budget\" }\n },\n \"required\": [\"node\", \"node_provenance\", \"ancestors\", \"pinned\", \"lessons\", \"lesson_candidates\", \"working_notes\", \"children_summaries\", \"attempts\", \"evidence_slice\", \"at_seq\", \"budget\"]\n }\n }\n}\n",
9
+ "event.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1 event envelope\",\n \"description\": \"One work event: a plain NIP-01 event of kind 7411, signed (BIP-340) by its own actor's key. Tags: w = the event type (with a dot), j = the project, c = the client id (idempotency, at most 64 bytes), v = the schema major, n = the node (every type except project.* and cost.recorded); e (causal reference) and p (counterparty) where a type uses them. Unknown single-letter tags are ignored. content is the event's payload as canonical JSON (content.schema.json, keyed by the w tag).\",\n \"$comment\": \"Source: crates/sharedcontext/src/signed/event.rs: struct Event (deny_unknown_fields: id, pubkey, created_at, kind, tags, content, sig), TICKET_KIND = 7411, TYPE_TAG = w, SCHEMA_MAJOR = 1, CLIENT_ID_MAX = 64, Event::verify_shape (tag rules, required tags, node_tag_optional) and check_canonical_content. Beyond this schema, the log checks: id = sha256 of the NIP-01 serialization, the BIP-340 signature, created_at <= received_at + 900 (FUTURE_SKEW_S), c at most 64 bytes (this schema counts characters), canonical content (keys sorted bytewise at every level, no whitespace, integers never spelled as floats), then the log's rules (crates/sharedcontext/src/work/log.rs). contract-check.mjs adds the id and canonical-content checks; it does not verify signatures.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"id\", \"pubkey\", \"created_at\", \"kind\", \"tags\", \"content\", \"sig\"],\n \"properties\": {\n \"id\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{64}$\", \"$comment\": \"sha256 of [0, pubkey, created_at, kind, tags, content] (event.rs serialize_nip01, event_id)\" },\n \"pubkey\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{64}$\", \"$comment\": \"x-only public key of the signer\" },\n \"created_at\": { \"type\": \"integer\", \"minimum\": 0, \"$comment\": \"unix seconds; informational, the log orders by seq\" },\n \"kind\": { \"const\": 7411, \"$comment\": \"TICKET_KIND; any other kind is wrong_kind\" },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"array\",\n \"minItems\": 2,\n \"prefixItems\": [\n { \"type\": \"string\", \"pattern\": \"^[A-Za-z]$\" },\n { \"type\": \"string\", \"minLength\": 1 }\n ],\n \"items\": { \"type\": \"string\" },\n \"$comment\": \"every tag name is one ASCII letter with a non-empty value, else bad_tag (verify_shape)\"\n },\n \"allOf\": [\n { \"contains\": { \"$ref\": \"#/$defs/tagW\" }, \"$comment\": \"w required, with a dot (missing_tag, bad_tag)\" },\n { \"contains\": { \"$ref\": \"#/$defs/tagJ\" }, \"$comment\": \"j required\" },\n { \"contains\": { \"$ref\": \"#/$defs/tagC\" }, \"$comment\": \"c required, at most 64 bytes\" },\n { \"contains\": { \"$ref\": \"#/$defs/tagV\" }, \"$comment\": \"v required; this reader understands major 1 only (unsupported_schema_major)\" },\n {\n \"if\": { \"contains\": { \"$ref\": \"#/$defs/tagWNodeOptional\" } },\n \"then\": true,\n \"else\": { \"contains\": { \"$ref\": \"#/$defs/tagN\" } },\n \"$comment\": \"n required unless w starts with project. or is cost.recorded (node_tag_optional)\"\n }\n ]\n },\n \"content\": {\n \"type\": \"string\",\n \"contentMediaType\": \"application/json\",\n \"contentSchema\": { \"$ref\": \"content.schema.json\" },\n \"$comment\": \"canonical JSON object; validated per type by content.schema.json (contract-check.mjs applies it by the w tag)\"\n },\n \"sig\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{128}$\", \"$comment\": \"BIP-340 Schnorr signature over id\" }\n },\n \"$defs\": {\n \"tagW\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"w\" }, { \"type\": \"string\", \"pattern\": \"^[^.]+\\\\..+$\" }], \"minItems\": 2 },\n \"tagWNodeOptional\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"w\" }, { \"type\": \"string\", \"pattern\": \"^(project\\\\..*|cost\\\\.recorded)$\" }], \"minItems\": 2 },\n \"tagJ\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"j\" }, { \"type\": \"string\", \"minLength\": 1 }], \"minItems\": 2 },\n \"tagC\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"c\" }, { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 64 }], \"minItems\": 2 },\n \"tagV\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"v\" }, { \"const\": \"1\" }], \"minItems\": 2 },\n \"tagN\": { \"type\": \"array\", \"prefixItems\": [{ \"const\": \"n\" }, { \"type\": \"string\", \"minLength\": 1 }], \"minItems\": 2 }\n }\n}\n",
10
+ "execution.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1.5, the execution vocabulary\",\n \"$comment\": \"sharedcontext/1.5, an additive minor of sharedcontext/1: the v tag stays \\\"1\\\". Holds only what the minor adds or changes: four new types (run.planned, run.decided, attempt.started, attempt.ended), the lesson layer on note.added, the visibility mark, two read tools (run_events, claim_state) and two reject names. Every other type is as in content.schema.json; note.added copies 1.0's definition and adds to it; shared nested shapes are $refs into content.schema.json. Nested objects stay lenient, top levels strict. Served only when the policy turns execution.vocabulary on (crates/sharedcontext/src/work/execution.rs). The minor's cases and two worked runs are in crates/sharedcontext/tests/work/execution/, run against the code by its tests. Not yet merged into content.schema.json and mcp-tools.schema.json.\",\n \"$defs\": {\n \"EventId\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{64}$\",\n \"$comment\": \"a work event's id (64 lower-case hex)\"\n },\n \"Pubkey\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{64}$\",\n \"$comment\": \"an x-only public key of the actor registry\"\n },\n \"Digest\": {\n \"type\": \"string\",\n \"pattern\": \"^sha256:[0-9a-f]{64}$\",\n \"$comment\": \"bytes in object storage, by digest; the form of the job envelope's refs\"\n },\n \"StepId\": {\n \"type\": \"string\",\n \"pattern\": \"^[A-Za-z0-9._:-]{1,64}$\",\n \"$comment\": \"a step of the run's plan; main is the one step of a run with no run.planned\"\n },\n \"Visibility\": {\n \"enum\": [\"agent\", \"human\"],\n \"$comment\": \"The visibility mark. agent: tracker, code-host and chat projections leave the event out. human: projections treat it as today. Absent: the type's default, agent for the four execution types and for note.added{layer: lesson}; as today for every other type and layer.\"\n },\n \"Strategy\": {\n \"type\": \"object\",\n \"$comment\": \"A strategy is versioned policy data pinned in the log. name is the strategy's name, digest the bytes of its definition. The log records it; whether it is the definition in force is the controller's check at run start and an auditor's afterwards (the log does not read the policy's exec section).\",\n \"properties\": {\n \"name\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 64 },\n \"digest\": { \"$ref\": \"#/$defs/Digest\" }\n },\n \"required\": [\"name\", \"digest\"]\n },\n \"PlanStep\": {\n \"type\": \"object\",\n \"$comment\": \"one step (a batch) of a plan, by the digest of its own description; after lists the steps it waits for (an order edge, not a claim)\",\n \"properties\": {\n \"step\": { \"$ref\": \"#/$defs/StepId\" },\n \"digest\": { \"$ref\": \"#/$defs/Digest\" },\n \"after\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/StepId\" } }\n },\n \"required\": [\"step\", \"digest\"]\n },\n \"Why\": {\n \"type\": \"object\",\n \"$comment\": \"why a decision was taken: the strategy's rule that fired, the digest of what it read (scores, candidates), and a short text for people\",\n \"properties\": {\n \"rule\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 128 },\n \"inputs\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Digest\" }] },\n \"text\": { \"type\": [\"string\", \"null\"], \"maxLength\": 1024 }\n },\n \"required\": [\"rule\"]\n },\n \"LessonEvidence\": {\n \"type\": \"object\",\n \"$comment\": \"what a lesson rests on: an event of this log (an attempt.ended, a findings.seen), a record by digest, or both\",\n \"properties\": {\n \"event\": { \"$ref\": \"#/$defs/EventId\" },\n \"record\": { \"$ref\": \"#/$defs/Digest\" }\n },\n \"anyOf\": [{ \"required\": [\"event\"] }, { \"required\": [\"record\"] }]\n },\n \"Lesson\": {\n \"type\": \"object\",\n \"$comment\": \"A structured note layer. guidance is what to do next time; observation what happened; scope narrows where it applies below the node it is written on (node kinds, labels); evidence what it rests on; run the run it came from. Who may pin one, and how it enters a context bundle, is context.schema.json's (sharedcontext/1.6). Text sizes as note text (MAX_BODY_BYTES, 16 KiB, for the whole content).\",\n \"properties\": {\n \"guidance\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 2048 },\n \"observation\": { \"type\": [\"string\", \"null\"], \"maxLength\": 2048 },\n \"scope\": {\n \"type\": [\"object\", \"null\"],\n \"properties\": {\n \"kinds\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"labels\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n }\n },\n \"evidence\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/LessonEvidence\" } },\n \"run\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] }\n },\n \"required\": [\"guidance\"]\n },\n \"run.planned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"New type. The plan of a run: the strategy, the plan's bytes by digest and its steps by digest. Signed by the holder of the run's claim while it is live; tag n = the claim's node. A re-plan names the plan it replaces in supersedes. Log rules (not shape): run is the live claim of n held by the signer (not_claimant, no_live_claim, claim_mismatch); step ids unique and after names only steps of this plan (invalid_value); supersedes names a run.planned of the same run (invalid_value).\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\", \"$comment\": \"the run's claim: the event id of its claim.taken (the job's dedupe_key)\" },\n \"strategy\": { \"$ref\": \"#/$defs/Strategy\" },\n \"plan\": { \"$ref\": \"content.schema.json#/$defs/Blob\" },\n \"steps\": { \"type\": \"array\", \"minItems\": 1, \"items\": { \"$ref\": \"#/$defs/PlanStep\" } },\n \"supersedes\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] },\n \"visibility\": { \"$ref\": \"#/$defs/Visibility\" }\n },\n \"required\": [\"run\", \"strategy\", \"plan\", \"steps\"]\n },\n \"run.decided\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"New type. A decision that changes what happens, written before it is acted on: assign a step to an assignee on a node for a round, skip a step, or stop the run. Signed by the holder of the run's claim while it is live; tag n = the claim's node; for assign, tag p = to. Log rules (not shape): the run's claim is live and held by the signer (not_claimant, no_live_claim, claim_mismatch); step is a step of the plan in force, or main when the run has no plan (unknown_step); for assign, to is a registry key whose role may sign claim.taken and node an open node of the project (invalid_value, unknown_node), and round is greater than every earlier round of the step in this run (invalid_value); nothing after stop (invalid_value).\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"action\": { \"enum\": [\"assign\", \"skip\", \"stop\"] },\n \"step\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/StepId\" }] },\n \"round\": { \"type\": [\"integer\", \"null\"], \"minimum\": 1 },\n \"to\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Pubkey\" }] },\n \"node\": { \"type\": [\"string\", \"null\"], \"minLength\": 1, \"$comment\": \"the node the assignee claims and works the step on: the run's own node, or another (a change node for a batch)\" },\n \"why\": { \"$ref\": \"#/$defs/Why\" },\n \"visibility\": { \"$ref\": \"#/$defs/Visibility\" }\n },\n \"required\": [\"run\", \"action\", \"why\"],\n \"allOf\": [\n {\n \"if\": { \"properties\": { \"action\": { \"const\": \"assign\" } }, \"required\": [\"action\"] },\n \"then\": {\n \"required\": [\"step\", \"round\", \"to\", \"node\"],\n \"properties\": { \"step\": { \"$ref\": \"#/$defs/StepId\" }, \"round\": { \"type\": \"integer\" }, \"to\": { \"$ref\": \"#/$defs/Pubkey\" }, \"node\": { \"type\": \"string\" } }\n },\n \"$comment\": \"assign names the step, the round, the assignee and the node\"\n },\n {\n \"if\": { \"properties\": { \"action\": { \"const\": \"skip\" } }, \"required\": [\"action\"] },\n \"then\": { \"required\": [\"step\"], \"properties\": { \"step\": { \"$ref\": \"#/$defs/StepId\" } } },\n \"$comment\": \"skip names the step\"\n },\n {\n \"if\": { \"properties\": { \"action\": { \"enum\": [\"skip\", \"stop\"] } }, \"required\": [\"action\"] },\n \"then\": { \"not\": { \"anyOf\": [{ \"required\": [\"to\"], \"properties\": { \"to\": { \"type\": \"string\" } } }, { \"required\": [\"round\"], \"properties\": { \"round\": { \"type\": \"integer\" } } }] } },\n \"$comment\": \"only assign has an assignee and a round\"\n }\n ]\n },\n \"attempt.started\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"New type. Written by the assignee before the work starts, under its own live claim on n; tag e = decision. For a job-backed claim, an execution gateway writes it as the claimant before it submits the job. Log rules (not shape): claim is the live claim of n held by the signer (not_claimant, no_live_claim, claim_mismatch); the run's claim is live (no_live_claim); decision is a run.decided{assign} of this run naming this step, round, the signer as to and n as node (no_decision); one start per (run, step, round) (invalid_value).\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"claim\": { \"$ref\": \"#/$defs/EventId\", \"$comment\": \"the claim the attempt runs under; equals run when the run's claimant works the step itself\" },\n \"step\": { \"$ref\": \"#/$defs/StepId\" },\n \"round\": { \"type\": \"integer\", \"minimum\": 1 },\n \"decision\": { \"$ref\": \"#/$defs/EventId\" },\n \"session\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/SessionRef\" }], \"$comment\": \"the session reference, when the assignee knows it before the work starts (a self-running agent's session); a gateway writes the start before submit, so it leaves this out and the job id follows on the job-id note and on attempt.ended\" },\n \"visibility\": { \"$ref\": \"#/$defs/Visibility\" }\n },\n \"required\": [\"run\", \"claim\", \"step\", \"round\", \"decision\"]\n },\n \"attempt.ended\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"New type. The outcome of an attempt, signed by the key that signed its start; tag e = started; no live claim needed (an outcome after a lapse is still recorded, as a note is); allowed on a closed node. outcome follows the job's end: completed, failed, budget_exceeded, cancelled; abandoned when the claim ended first (lapse, self-fencing, max_hold). Log rules (not shape): started is an attempt.started of this run, step and round signed by the same key (not_claimant, invalid_value); one end per start (invalid_value). A job's artifacts are never evidence: record is a reference, and only the evaluator's system-signed pair closes work.\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"step\": { \"$ref\": \"#/$defs/StepId\" },\n \"round\": { \"type\": \"integer\", \"minimum\": 1 },\n \"started\": { \"$ref\": \"#/$defs/EventId\" },\n \"outcome\": { \"enum\": [\"completed\", \"failed\", \"budget_exceeded\", \"cancelled\", \"abandoned\"] },\n \"record\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }], \"$comment\": \"the attempt's record by digest: the job's index manifest, or a runner's record\" },\n \"changes\": { \"type\": \"array\", \"items\": { \"type\": \"string\" }, \"$comment\": \"change nodes the attempt produced\" },\n \"reasons\": { \"type\": \"array\", \"items\": { \"type\": \"string\", \"maxLength\": 256 }, \"$comment\": \"the job's status reasons, short\" },\n \"session\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/SessionRef\" }], \"$comment\": \"the job that ran the attempt; a gateway learns the job id only from submit, after attempt.started, so the id is on this event and on the job-id note\" },\n \"visibility\": { \"$ref\": \"#/$defs/Visibility\" }\n },\n \"required\": [\"run\", \"step\", \"round\", \"started\", \"outcome\"]\n },\n \"note.added\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"sharedcontext/1.5: 1.0's note.added plus the layer lesson, the field lesson (required with that layer, refused with any other) and visibility. Who may write a lesson: as note.added (agent, person, steward); pinning one is context.schema.json's (sharedcontext/1.6). Policy rows: note.added:lesson joins allowed_on_closed (a lesson learnt after the close). An older log refuses all three (invalid_value for the layer, unknown_field for the fields).\",\n \"properties\": {\n \"layer\": { \"enum\": [\"pinned\", \"working\", \"summary\", \"lesson\"], \"$comment\": \"1.0: crates/sharedcontext/src/work/types.rs NOTE_LAYERS; lesson added\" },\n \"text\": { \"type\": [\"string\", \"null\"] },\n \"blob\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }] },\n \"supersedes\": { \"type\": [\"string\", \"null\"] },\n \"session\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/SessionRef\" }] },\n \"lesson\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Lesson\" }] },\n \"visibility\": { \"$ref\": \"#/$defs/Visibility\" }\n },\n \"allOf\": [\n {\n \"if\": { \"properties\": { \"layer\": { \"const\": \"lesson\" } }, \"required\": [\"layer\"] },\n \"then\": { \"required\": [\"lesson\"], \"properties\": { \"lesson\": { \"$ref\": \"#/$defs/Lesson\" } } },\n \"$comment\": \"a lesson note carries its lesson\"\n },\n {\n \"if\": { \"required\": [\"lesson\"], \"properties\": { \"lesson\": { \"type\": \"object\" } } },\n \"then\": { \"required\": [\"layer\"], \"properties\": { \"layer\": { \"const\": \"lesson\" } } },\n \"$comment\": \"lesson only on the lesson layer\"\n }\n ]\n },\n \"reject.no_decision\": {\n \"type\": \"object\",\n \"$comment\": \"New reject name: an attempt.started with no run.decided{assign} of its run naming its step, round, signer and node. The log's RejectReason::NoDecision (crates/sharedcontext/src/signed/verifier.rs).\",\n \"properties\": {\n \"reason\": { \"const\": \"no_decision\" },\n \"detail\": {\n \"type\": \"object\",\n \"properties\": { \"run\": { \"$ref\": \"#/$defs/EventId\" }, \"step\": { \"$ref\": \"#/$defs/StepId\" }, \"round\": { \"type\": \"integer\" } },\n \"required\": [\"run\", \"step\", \"round\"]\n }\n },\n \"required\": [\"reason\", \"detail\"]\n },\n \"reject.unknown_step\": {\n \"type\": \"object\",\n \"$comment\": \"New reject name: a run.decided naming a step that is not in the plan in force (or not main, for a run with no plan).\",\n \"properties\": {\n \"reason\": { \"const\": \"unknown_step\" },\n \"detail\": {\n \"type\": \"object\",\n \"properties\": { \"run\": { \"$ref\": \"#/$defs/EventId\" }, \"step\": { \"type\": \"string\" }, \"plan\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] } },\n \"required\": [\"run\", \"step\"]\n }\n },\n \"required\": [\"reason\", \"detail\"]\n },\n \"RunEventsArgs\": {\n \"type\": \"object\",\n \"$comment\": \"read tool run_events: one run's events after a seq, a page\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"after_seq\": { \"type\": \"integer\", \"minimum\": 0 },\n \"limit\": { \"type\": [\"integer\", \"null\"], \"minimum\": 0, \"$comment\": \"default 100, as subscribe\" }\n },\n \"required\": [\"run\", \"after_seq\"]\n },\n \"RunEventsResult\": {\n \"type\": \"object\",\n \"$comment\": \"the run's events after after_seq in seq order, each as a subscribe row: every event whose content names the run (run.planned, run.decided, attempt.started, attempt.ended, a lesson note whose lesson.run is the run), and the claim events of the run's claim and of every claim an attempt of the run names (claim.taken, claim.renewed, claim.released, claim.expired). Served from events_by_node over the run's nodes (its claim's node and every node a decision names), merged by seq: no new keyspace.\",\n \"properties\": {\n \"run\": { \"$ref\": \"#/$defs/EventId\" },\n \"node\": { \"type\": \"string\", \"$comment\": \"the run's claim's node\" },\n \"after_seq\": { \"type\": \"integer\", \"minimum\": 0 },\n \"head_seq\": { \"type\": \"integer\", \"minimum\": 0 },\n \"next_after_seq\": { \"type\": \"integer\", \"minimum\": 0 },\n \"events\": { \"$ref\": \"mcp-tools.schema.json#/$defs/SubscribeResult/properties/events\" }\n },\n \"required\": [\"run\", \"node\", \"after_seq\", \"head_seq\", \"next_after_seq\", \"events\"]\n },\n \"ClaimStateArgs\": {\n \"type\": \"object\",\n \"$comment\": \"read tool claim_state: one claim's state\",\n \"properties\": { \"claim\": { \"$ref\": \"#/$defs/EventId\" } },\n \"required\": [\"claim\"]\n },\n \"ClaimState\": {\n \"type\": \"object\",\n \"$comment\": \"one claim folded: its lease, how it ended, and the run it roots (if any). Derived, never stored as truth, not part of the canonical snapshot, so expected-state.json does not change.\",\n \"properties\": {\n \"claim\": { \"$ref\": \"#/$defs/EventId\" },\n \"node\": { \"type\": \"string\" },\n \"holder\": { \"$ref\": \"#/$defs/Pubkey\" },\n \"intent\": { \"enum\": [\"fix\", \"triage\", \"review\", \"verify\"] },\n \"taken\": {\n \"type\": \"object\",\n \"properties\": { \"seq\": { \"type\": \"integer\", \"minimum\": 1 }, \"received_at\": { \"type\": \"integer\", \"minimum\": 0 } },\n \"required\": [\"seq\", \"received_at\"]\n },\n \"live\": { \"type\": \"boolean\" },\n \"lease_until\": { \"type\": [\"integer\", \"null\"], \"minimum\": 0 },\n \"renewals\": { \"type\": \"integer\", \"minimum\": 0 },\n \"ended\": {\n \"anyOf\": [\n { \"type\": \"null\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"how\": { \"enum\": [\"released\", \"expired\"] },\n \"reason\": { \"type\": [\"string\", \"null\"] },\n \"seq\": { \"type\": \"integer\", \"minimum\": 1 }\n },\n \"required\": [\"how\", \"seq\"]\n }\n ]\n },\n \"session\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/SessionRef\" }] },\n \"run\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/RunView\" }] }\n },\n \"required\": [\"claim\", \"node\", \"holder\", \"intent\", \"taken\", \"live\", \"lease_until\", \"renewals\", \"ended\", \"run\"]\n },\n \"RunView\": {\n \"type\": \"object\",\n \"$comment\": \"the run this claim roots, folded from its events: the strategy and plan in force, each step's latest round with its decision and attempt, and the stop if any\",\n \"properties\": {\n \"strategy\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Strategy\" }] },\n \"plan\": {\n \"anyOf\": [\n { \"type\": \"null\" },\n { \"type\": \"object\", \"properties\": { \"event\": { \"$ref\": \"#/$defs/EventId\" }, \"digest\": { \"$ref\": \"#/$defs/Digest\" } }, \"required\": [\"event\", \"digest\"] }\n ]\n },\n \"steps\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"step\": { \"$ref\": \"#/$defs/StepId\" },\n \"state\": { \"enum\": [\"planned\", \"assigned\", \"running\", \"ended\", \"skipped\"] },\n \"round\": { \"type\": [\"integer\", \"null\"], \"minimum\": 1 },\n \"to\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/Pubkey\" }] },\n \"node\": { \"type\": [\"string\", \"null\"] },\n \"decision\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] },\n \"attempt\": {\n \"anyOf\": [\n { \"type\": \"null\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"started\": { \"$ref\": \"#/$defs/EventId\" },\n \"claim\": { \"$ref\": \"#/$defs/EventId\" },\n \"ended\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] },\n \"outcome\": { \"anyOf\": [{ \"type\": \"null\" }, { \"enum\": [\"completed\", \"failed\", \"budget_exceeded\", \"cancelled\", \"abandoned\"] }] },\n \"record\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"content.schema.json#/$defs/Blob\" }] }\n },\n \"required\": [\"started\", \"claim\", \"ended\", \"outcome\"]\n }\n ]\n }\n },\n \"required\": [\"step\", \"state\"]\n }\n },\n \"stopped\": { \"anyOf\": [{ \"type\": \"null\" }, { \"$ref\": \"#/$defs/EventId\" }] }\n },\n \"required\": [\"strategy\", \"plan\", \"steps\", \"stopped\"]\n },\n \"tool.run_events\": {\n \"type\": \"object\",\n \"$comment\": \"read tool; emits nothing\",\n \"properties\": { \"name\": { \"const\": \"run_events\" }, \"arguments\": { \"$ref\": \"#/$defs/RunEventsArgs\" }, \"result\": { \"$ref\": \"#/$defs/RunEventsResult\" } }\n },\n \"tool.claim_state\": {\n \"type\": \"object\",\n \"$comment\": \"read tool; emits nothing\",\n \"properties\": { \"name\": { \"const\": \"claim_state\" }, \"arguments\": { \"$ref\": \"#/$defs/ClaimStateArgs\" }, \"result\": { \"$ref\": \"#/$defs/ClaimState\" } }\n }\n }\n}\n",
11
+ "history/content-1.0.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1.0 event content (frozen)\",\n \"description\": \"The content of each work event type, keyed by the event's w tag: use \\\"#/$defs/<type>\\\" (for example \\\"#/$defs/claim.taken\\\"). Fields are optional at this level because every payload field has a serde default; which fields a type needs, and the cross-field and state rules, are the log's (crates/sharedcontext/src/work/log.rs), so content that passes this schema can still be refused. Enumerations are given only where the log checks a fixed list in code; the rest (states, severities, gate kinds, roles in rules) come from the policy and grow without a schema change. An unknown type is refused by the log (unknown_type) and skipped by the fold.\",\n \"$comment\": \"Frozen: the sharedcontext/1.0 content shape exactly as it was before 1.1 (multi-repo) moved into ../content.schema.json. Kept only so contract-check.mjs can answer what a 1.0 log answers for a case marked older (an older log refuses a newer field). Not the contract in force. Source: crates/sharedcontext/src/work/types.rs (payload structs, KNOWN_TYPES, content_fields) and crates/sharedcontext/src/work/log.rs (the fixed-list checks); crates/sharedcontext/src/signed/registry.rs (Actor, Limits). Option fields accept null, as serde does. Types (34, KNOWN_TYPES order): project.created, project.policy_set, node.created, node.updated, node.moved, node.linked, node.unlinked, node.split, node.merged, node.closed, node.reopened, note.added, context.pinned, claim.taken, claim.renewed, claim.released, claim.expired, state.transitioned, gate.cleared, evidence.attached, findings.seen, ref.set, adapter.synced, change.external_event, external.state_changed, goal.measures_set, measure.observed, actor.enrolled, project.profile_set, project.budget_set, project.rule_set, project.budget_incident, cost.recorded, gate.approved.\",\n \"type\": \"object\",\n \"$defs\": {\n \"SessionRef\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs SessionRef\",\n \"properties\": {\n \"agent_cli\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"at most 64 bytes (MAX_AGENT_CLI_BYTES)\"\n },\n \"session_id\": {\n \"type\": \"string\",\n \"$comment\": \"at most 128 bytes (MAX_SESSION_ID_BYTES)\"\n }\n }\n },\n \"Repo\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Repo\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\"\n },\n \"owner\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n }\n },\n \"PrRef\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs PrRef\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\"\n },\n \"owner\": {\n \"type\": \"string\"\n },\n \"repo\": {\n \"type\": \"string\"\n },\n \"number\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Origin\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Origin\",\n \"properties\": {\n \"source\": {\n \"type\": \"string\"\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"Marker\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Marker: a sha plus a time, never a key\",\n \"properties\": {\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"run_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n }\n },\n \"Horizon\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Horizon (unix seconds)\",\n \"properties\": {\n \"from\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"to\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Measure\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Measure\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"target\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"$comment\": \"integer; the unit carries the scale\"\n },\n \"unit\": {\n \"type\": \"string\"\n },\n \"source\": {\n \"type\": \"string\"\n },\n \"direction\": {\n \"enum\": [\n \"at_least\",\n \"at_most\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: MEASURE_DIRECTIONS; at_least when absent\"\n }\n }\n },\n \"SplitPart\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs SplitPart\",\n \"properties\": {\n \"node_id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"body\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"severity\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"CloseEvidence\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs CloseEvidence\",\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"record_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"facts_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"rules_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covered\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"Override\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Override\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\"\n },\n \"policy_clause\": {\n \"type\": \"string\"\n }\n }\n },\n \"Cancel\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Cancel\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\"\n }\n }\n },\n \"Unverified\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Unverified\",\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_state\": {\n \"type\": \"string\"\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"ClosedAt\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClosedAt\",\n \"properties\": {\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n }\n },\n \"RegressionEvidence\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RegressionEvidence\",\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"seen\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"Blob\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Blob\",\n \"properties\": {\n \"digest\": {\n \"type\": \"string\"\n },\n \"media_type\": {\n \"type\": \"string\"\n },\n \"bytes\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n }\n },\n \"Gate\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Gate\",\n \"properties\": {\n \"kind\": {\n \"type\": \"string\",\n \"$comment\": \"gate kinds come from the policy (GATE_KINDS is the default list, crates/sharedcontext/src/work/policy.rs)\"\n },\n \"ref\": {\n \"type\": \"string\"\n }\n }\n },\n \"Verdict\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Verdict\",\n \"properties\": {\n \"finding_fp\": {\n \"type\": \"string\"\n },\n \"verdict\": {\n \"type\": \"string\"\n },\n \"record_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"Provenance\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Provenance: the log refuses keys outside this list inside source (invalid_value, unknown_provenance_fields)\",\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"via\": {\n \"enum\": [\n \"webhook\",\n \"poll\",\n \"reconcile\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: PROVENANCE_VIA\"\n },\n \"id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"url\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"delivered_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n },\n \"additionalProperties\": false\n },\n \"Scope\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Scope\",\n \"properties\": {\n \"kind\": {\n \"type\": \"string\"\n },\n \"id\": {\n \"type\": \"string\"\n }\n }\n },\n \"Flags\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs Flags\",\n \"properties\": {\n \"enrol_agents\": {\n \"type\": \"boolean\"\n },\n \"create_skills\": {\n \"type\": \"boolean\"\n },\n \"assign_work\": {\n \"type\": \"boolean\"\n }\n }\n },\n \"Limits\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs Limits: both fields required (no serde default)\",\n \"properties\": {\n \"events_per_min\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 4294967295\n },\n \"open_claims\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 4294967295\n }\n },\n \"required\": [\n \"events_per_min\",\n \"open_claims\"\n ]\n },\n \"Actor\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs Actor: role required\",\n \"properties\": {\n \"role\": {\n \"enum\": [\n \"agent\",\n \"person\",\n \"steward\",\n \"system\",\n \"adapter\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: signed::ROLES, checked on project.policy_set\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"stage\": {\n \"enum\": [\n \"shadow\",\n \"nonprod\",\n \"prod\"\n ],\n \"$comment\": \"crates/sharedcontext/src/signed/registry.rs STAGES; default nonprod\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/Limits\"\n },\n \"owner\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"expires_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n }\n },\n \"required\": [\n \"role\"\n ]\n },\n \"ProfileFields\": {\n \"type\": \"object\",\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProfileFields\",\n \"properties\": {\n \"org\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"teams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"member_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"flags\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Flags\"\n }\n ]\n },\n \"trust\": {\n \"enum\": [\n \"standard\",\n \"review\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: TRUST_LEVELS\"\n },\n \"lifecycle\": {\n \"enum\": [\n \"active\",\n \"paused\",\n \"retired\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: LIFECYCLES\"\n }\n }\n },\n \"project.created\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"repo\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Repo\"\n }\n ]\n },\n \"default_branch\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"policy_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProjectCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.policy_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"policy_ref\": {\n \"type\": \"string\"\n },\n \"effective_from_seq\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"actors\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/Actor\"\n },\n \"$comment\": \"hex pubkey → actor\"\n },\n \"params\": {\n \"$comment\": \"any JSON value\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProjectPolicySet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.created\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"epic\",\n \"issue\",\n \"task\",\n \"subtask\",\n \"change\",\n \"goal\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: NODE_KINDS\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"body\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"parent\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"origin\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Origin\"\n }\n ]\n },\n \"labels\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"priority\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"cluster_key\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fp_scheme\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"declaration_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"opened_at\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Marker\"\n }\n ]\n },\n \"pr\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/PrRef\"\n }\n ]\n },\n \"for\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"base_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"owner\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"horizon\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Horizon\"\n }\n ]\n },\n \"weight\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"measures\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Measure\"\n }\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.updated\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"patch\": {\n \"type\": \"object\",\n \"$comment\": \"field → new value\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeUpdated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.moved\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"parent\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeMoved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.linked\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"edge\": {\n \"enum\": [\n \"blocks\",\n \"relates\",\n \"duplicates\",\n \"split_from\",\n \"merged_into\",\n \"derived_from\",\n \"serves\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)\"\n },\n \"to\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.unlinked\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"edge\": {\n \"enum\": [\n \"blocks\",\n \"relates\",\n \"duplicates\",\n \"split_from\",\n \"merged_into\",\n \"derived_from\",\n \"serves\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)\"\n },\n \"to\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.split\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"into\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/SplitPart\"\n }\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeSplit. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.merged\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"into\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeMerged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.closed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"outcome\": {\n \"enum\": [\n \"done\",\n \"cancelled\",\n \"duplicate\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: OUTCOMES; a goal's close takes GOAL_OUTCOMES (done, cancelled)\"\n },\n \"evidence\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/CloseEvidence\"\n }\n ]\n },\n \"override\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Override\"\n }\n ]\n },\n \"cancel\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Cancel\"\n }\n ]\n },\n \"unverified\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Unverified\"\n }\n ]\n },\n \"closed_at\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/ClosedAt\"\n }\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeClosed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"node.reopened\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"cause\": {\n \"enum\": [\n \"regression\",\n \"override_reversed\",\n \"cancel_reversed\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: REOPEN_CAUSES\"\n },\n \"evidence\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/RegressionEvidence\"\n }\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NodeReopened. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"note.added\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"layer\": {\n \"enum\": [\n \"pinned\",\n \"working\",\n \"summary\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/types.rs: NOTE_LAYERS\"\n },\n \"text\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"blob\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Blob\"\n }\n ]\n },\n \"supersedes\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs NoteAdded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"context.pinned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"text\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"blob\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Blob\"\n }\n ]\n },\n \"supersedes\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ContextPinned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.taken\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"lease_s\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"intent\": {\n \"enum\": [\n \"fix\",\n \"triage\",\n \"review\",\n \"verify\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: CLAIM_INTENTS\"\n },\n \"on_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimTaken. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.renewed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"lease_s\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"progress\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimRenewed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.released\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"reason\": {\n \"enum\": [\n \"done\",\n \"blocked\",\n \"handoff\",\n \"abandoned\",\n \"needs_input\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RELEASE_REASONS; handoff also needs a p tag\"\n },\n \"to\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/SessionRef\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimReleased. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"claim.expired\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"claim\": {\n \"type\": \"string\"\n },\n \"lease_until\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"swept_at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ClaimExpired. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"state.transitioned\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"from\": {\n \"type\": \"string\"\n },\n \"to\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"by_rule\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"gate\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Gate\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs StateTransitioned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"gate.cleared\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ref\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GateCleared. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"evidence.attached\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"record_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"stage\": {\n \"type\": \"string\"\n },\n \"verdicts\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Verdict\"\n }\n },\n \"coverage\": {\n \"type\": \"string\"\n },\n \"confidence\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs EvidenceAttached. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"findings.seen\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"seen\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"gone\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"fp_scheme\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs FindingsSeen. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"ref.set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_id\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fields_owned\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"blocked_by\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"string\"\n },\n \"$comment\": \"the whole current list for this system; absent leaves it as it was\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RefSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"adapter.synced\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"external_id\": {\n \"type\": \"string\"\n },\n \"direction\": {\n \"type\": \"string\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"external_version\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs AdapterSynced. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"change.external_event\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"event\": {\n \"enum\": [\n \"opened\",\n \"synchronized\",\n \"review_requested\",\n \"approved\",\n \"merged\",\n \"closed\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: EXTERNAL_EVENTS\"\n },\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"merge_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"pr\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/PrRef\"\n }\n ]\n },\n \"external_status\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ChangeExternalEvent. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"external.state_changed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"system\": {\n \"type\": \"string\"\n },\n \"from\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"to\": {\n \"type\": \"string\"\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"external_status\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"source\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Provenance\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ExternalStateChanged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"goal.measures_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"measures\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Measure\"\n }\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GoalMeasuresSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"measure.observed\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"measure\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"source_ref\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs MeasureObserved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"actor.enrolled\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"sponsor\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"stage\": {\n \"enum\": [\n \"shadow\",\n \"nonprod\",\n \"prod\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: signed::STAGES\"\n },\n \"limits\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Limits\"\n }\n ]\n },\n \"expires_at\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"profile\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/ProfileFields\"\n }\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ActorEnrolled. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.profile_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"kind\": {\n \"enum\": [\n \"person\",\n \"agent\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/types.rs MEMBER_KINDS\"\n },\n \"sponsor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"org\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"teams\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"member_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"flags\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Flags\"\n }\n ]\n },\n \"trust\": {\n \"enum\": [\n \"standard\",\n \"review\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: TRUST_LEVELS\"\n },\n \"lifecycle\": {\n \"enum\": [\n \"active\",\n \"paused\",\n \"retired\",\n null\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: LIFECYCLES\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs ProfileSet (flattens ProfileFields). Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.budget_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/Scope\"\n }\n ],\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"org\",\n \"team\",\n \"project\",\n \"goal\",\n \"agent\",\n \"session\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_SCOPES\"\n }\n }\n },\n \"metric\": {\n \"enum\": [\n \"billed_cents\",\n \"tokens\",\n \"compute_minutes\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_METRICS\"\n },\n \"window\": {\n \"enum\": [\n \"calendar_month_utc\",\n \"lifetime\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_WINDOWS\"\n },\n \"amount\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"warn_percent\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"hard_stop\": {\n \"type\": \"boolean\"\n },\n \"unpriced\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"block (default) · allow\"\n },\n \"active\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"$comment\": \"false withdraws the budget; default true\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs BudgetSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.rule_set\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/Scope\"\n }\n ],\n \"properties\": {\n \"kind\": {\n \"enum\": [\n \"org\",\n \"team\",\n \"agent\",\n \"member\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RULE_SCOPES\"\n }\n }\n },\n \"effect\": {\n \"enum\": [\n \"permit\",\n \"forbid\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: RULE_EFFECTS\"\n },\n \"actions\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"active\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs RuleSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"project.budget_incident\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"budget\": {\n \"type\": \"string\"\n },\n \"scope\": {\n \"$ref\": \"#/$defs/Scope\"\n },\n \"metric\": {\n \"type\": \"string\"\n },\n \"window\": {\n \"type\": \"string\"\n },\n \"spent\": {\n \"type\": \"integer\"\n },\n \"amount\": {\n \"type\": \"integer\"\n },\n \"cost\": {\n \"type\": \"string\",\n \"$comment\": \"the cost.recorded event that crossed the limit\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"unpriced\": {\n \"type\": \"boolean\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs BudgetIncident. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"cost.recorded\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"agent\": {\n \"type\": \"string\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"goal\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"job\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"session\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"provider\": {\n \"type\": \"string\"\n },\n \"biller\": {\n \"type\": \"string\"\n },\n \"billing_type\": {\n \"enum\": [\n \"metered\",\n \"subscription_included\",\n \"subscription_overage\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BILLING_TYPES\"\n },\n \"amount\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"unit\": {\n \"enum\": [\n \"billed_cents\",\n \"tokens\",\n \"compute_minutes\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/log.rs: BUDGET_METRICS as the unit\"\n },\n \"unpriced\": {\n \"type\": \"boolean\"\n },\n \"idempotency_key\": {\n \"type\": \"string\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs CostRecorded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n },\n \"gate.approved\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ref\": {\n \"type\": \"string\",\n \"$comment\": \"the open approval gate\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/types.rs GateApproved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source.\"\n }\n }\n}\n",
12
+ "lineage.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1.x, the lineage read\",\n \"$comment\": \"The lineage read: one new read-only MCP tool, `lineage`, as an additive minor of sharedcontext/1 whose number is not yet assigned: no event type, no event field, no fold or store-format change in the log's contract (any index it reads is the store's own). Nested shapes are $refs into content.schema.json and mcp-tools.schema.json. Served only with the service's reads.lineage on (crates/sharedcontext/src/work/lineage.rs). Checked by contract-check.mjs against cases/lineage.cases.jsonl and against the answers the code serves (crates/sharedcontext/tests/work/lineage/answers.jsonl).\",\n \"$defs\": {\n \"LineageArgs\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"$comment\": \"The lineage read's arguments. One key per call: `by` names which provenance key `value` is. The record handle is asked for as by: record; its value is what the log carries as record_digest. `repo` narrows a sha (or any key) to one repository of a multi-repo project: the repo key host/owner/name, or the immutable repository id when the log carries one.\",\n \"properties\": {\n \"by\": {\n \"enum\": [\n \"node\",\n \"run\",\n \"record\",\n \"finding\",\n \"sha\"\n ],\n \"$comment\": \"node: a node id; run: a run_id; record: the record handle; finding: a finding fingerprint; sha: a commit sha\"\n },\n \"value\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 512\n },\n \"fp_scheme\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"$comment\": \"by: finding only; fingerprints are opaque and only comparable within one scheme. Absent: every scheme, each match tagged with its own\"\n },\n \"repo\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"history\": {\n \"type\": \"boolean\",\n \"default\": true,\n \"$comment\": \"every close and reopen of each node, not only the current one\"\n },\n \"changes\": {\n \"type\": \"boolean\",\n \"default\": true,\n \"$comment\": \"for an issue, the lineage of each linked change (for[]), one level deep\"\n },\n \"limit\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 100,\n \"default\": 25\n },\n \"after\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"the opaque `next` of a previous page\"\n }\n },\n \"required\": [\n \"by\",\n \"value\"\n ],\n \"allOf\": [\n {\n \"if\": {\n \"required\": [\n \"fp_scheme\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"by\": {\n \"const\": \"finding\"\n }\n }\n }\n }\n ]\n },\n \"EventRef\": {\n \"type\": \"object\",\n \"$comment\": \"One log event by position and id, so a caller can fetch and verify it (subscribe, or the shipped segments). policy_version is the stored line's: the policy the event was judged under.\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 1\n },\n \"id\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{64}$\"\n },\n \"w\": {\n \"type\": \"string\"\n },\n \"received_at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"policy_version\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"seq\",\n \"id\",\n \"w\",\n \"received_at\"\n ]\n },\n \"Signer\": {\n \"type\": \"object\",\n \"$comment\": \"Who signed, as the registry said at that event's seq (the log keeps every registry version). member_id is null when the registry entry has none. evaluator is the registry's evaluator entry (its shape is left open here): null for any key that is not an evaluator, which today is every key, since only the system key may sign the pair.\",\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{64}$\"\n },\n \"role\": {\n \"type\": \"string\",\n \"$comment\": \"agent · person · steward · system · adapter, and the evaluator role or scope of the evaluator route\"\n },\n \"label\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"owner\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-f]{64}$\"\n }\n ]\n },\n \"stage\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"member_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"evaluator\": {\n \"type\": [\n \"object\",\n \"null\"\n ]\n },\n \"active_now\": {\n \"type\": \"boolean\",\n \"$comment\": \"false when the key has since been retired or rotated out; the event stays valid (verified against the registry at its seq)\"\n }\n },\n \"required\": [\n \"pubkey\",\n \"role\",\n \"active_now\"\n ]\n },\n \"FindingsSeenRef\": {\n \"type\": \"object\",\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/EventRef\"\n }\n ],\n \"properties\": {\n \"signer\": {\n \"$ref\": \"#/$defs/Signer\"\n },\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"seen\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"gone\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"fp_scheme\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"signer\",\n \"run_id\",\n \"seen\",\n \"gone\",\n \"fp_scheme\"\n ]\n },\n \"EvidenceRef\": {\n \"type\": \"object\",\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/EventRef\"\n }\n ],\n \"properties\": {\n \"signer\": {\n \"$ref\": \"#/$defs/Signer\"\n },\n \"run_id\": {\n \"type\": \"string\"\n },\n \"record_digest\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"the record handle as the event carries it; null is legal in sharedcontext/1.0 and is flagged record_handle_missing\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"stage\": {\n \"type\": \"string\"\n },\n \"coverage\": {\n \"type\": \"string\"\n },\n \"confidence\": {\n \"type\": \"string\"\n },\n \"verdicts\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"content.schema.json#/$defs/Verdict\"\n }\n }\n },\n \"required\": [\n \"signer\",\n \"run_id\",\n \"record_digest\",\n \"stage\",\n \"coverage\",\n \"confidence\",\n \"verdicts\"\n ]\n },\n \"Run\": {\n \"type\": \"object\",\n \"$comment\": \"One run as one node saw it: the findings.seen and evidence.attached events on that node sharing run_id. For an issue both halves make a qualifying run; a change closes on evidence.attached alone, so findings_seen is null there and that is not a flag.\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"run_id\": {\n \"type\": \"string\"\n },\n \"sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fp_scheme\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"record_digests\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"$comment\": \"the distinct record handles the run's evidence events on this node carry\"\n },\n \"findings_seen\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/FindingsSeenRef\"\n }\n ]\n },\n \"evidence_attached\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/EvidenceRef\"\n }\n },\n \"qualifying\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"$comment\": \"whether the run met the close rule for this node under the policy in force at its seq; null for a kind with no evidence close\"\n },\n \"unmet\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"when not qualifying: the close tool's unmet reason\"\n }\n },\n \"required\": [\n \"node\",\n \"run_id\",\n \"findings_seen\",\n \"evidence_attached\",\n \"qualifying\"\n ]\n },\n \"Close\": {\n \"type\": \"object\",\n \"$comment\": \"One node.closed and what it rested on. how: evidence (system, with the run that closed it), override (steward, policy_clause), cancel, or other (a close with none of the three, such as a goal's).\",\n \"properties\": {\n \"event\": {\n \"$ref\": \"#/$defs/EventRef\"\n },\n \"signer\": {\n \"$ref\": \"#/$defs/Signer\"\n },\n \"outcome\": {\n \"enum\": [\n \"done\",\n \"cancelled\",\n \"duplicate\"\n ]\n },\n \"how\": {\n \"enum\": [\n \"evidence\",\n \"override\",\n \"cancel\",\n \"other\"\n ]\n },\n \"current\": {\n \"type\": \"boolean\",\n \"$comment\": \"true for the close the node is in now (no reopen after it)\"\n },\n \"evidence\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"content.schema.json#/$defs/CloseEvidence\"\n }\n ]\n },\n \"run\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Run\"\n }\n ],\n \"$comment\": \"the run named by evidence.run_id, joined on this node\"\n },\n \"override\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"content.schema.json#/$defs/Override\"\n }\n ]\n },\n \"cancel\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"content.schema.json#/$defs/Cancel\"\n }\n ]\n },\n \"closed_at\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"content.schema.json#/$defs/ClosedAt\"\n }\n ]\n },\n \"merged_into\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"event\",\n \"signer\",\n \"outcome\",\n \"how\",\n \"current\"\n ]\n },\n \"Reopen\": {\n \"type\": \"object\",\n \"properties\": {\n \"event\": {\n \"$ref\": \"#/$defs/EventRef\"\n },\n \"signer\": {\n \"$ref\": \"#/$defs/Signer\"\n },\n \"cause\": {\n \"enum\": [\n \"regression\",\n \"override_reversed\",\n \"cancel_reversed\"\n ]\n },\n \"run\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"#/$defs/Run\"\n }\n ],\n \"$comment\": \"for a regression: the run that saw a covered finding again\"\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"event\",\n \"signer\",\n \"cause\"\n ]\n },\n \"ChangeLineage\": {\n \"type\": \"object\",\n \"$comment\": \"A change linked to an issue by its for[]: the merge the change close needs, and its closes.\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"pr\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"$ref\": \"content.schema.json#/$defs/PrRef\"\n }\n ]\n },\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"merge\": {\n \"anyOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/EventRef\"\n }\n ],\n \"properties\": {\n \"head_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"merge_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n }\n ]\n },\n \"closes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Close\"\n }\n }\n },\n \"required\": [\n \"node\",\n \"state\",\n \"closes\"\n ]\n },\n \"Flag\": {\n \"type\": \"object\",\n \"$comment\": \"Something the read found but does not decide. A flag never changes the log; rekey_suspect in particular is a suspicion, not a finding.\",\n \"properties\": {\n \"code\": {\n \"enum\": [\n \"not_found\",\n \"not_closed\",\n \"closed_without_evidence\",\n \"record_handle_missing\",\n \"record_handle_mismatch\",\n \"pair_incomplete\",\n \"pair_sha_mismatch\",\n \"mixed_signers\",\n \"signer_not_evaluator\",\n \"signer_inactive_now\",\n \"fp_scheme_mismatch\",\n \"rekey_suspect\",\n \"covers_moved\",\n \"repo_unresolved\",\n \"repo_key_mutable\",\n \"history_incomplete\",\n \"truncated\"\n ]\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"run_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fp\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"detail\": {\n \"type\": [\n \"object\",\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"code\"\n ]\n },\n \"NodeLineage\": {\n \"type\": \"object\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"kind\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"repo\": {\n \"type\": [\n \"object\",\n \"string\",\n \"null\"\n ],\n \"$comment\": \"the node's resolved repository: the repo key, with the immutable repository id beside it when the log carries one\"\n },\n \"cluster_key\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"fp_scheme\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"covers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"opened_at\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"$comment\": \"an issue's {sha, run_id, at}\"\n },\n \"closes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Close\"\n }\n },\n \"reopens\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Reopen\"\n }\n },\n \"changes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/ChangeLineage\"\n }\n },\n \"flags\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Flag\"\n }\n }\n },\n \"required\": [\n \"node\",\n \"kind\",\n \"state\",\n \"closes\",\n \"reopens\",\n \"changes\",\n \"flags\"\n ]\n },\n \"LineageResult\": {\n \"type\": \"object\",\n \"$comment\": \"The answer, as of one seq of one org's log. nodes: every node the key leads to, with its closes and reopens. runs: for by run, record, finding and sha, every (run, node) the key matched, closing or not. flags: what the read noticed at query level (not_found, truncated, history_incomplete). org_id is null when project.created carries none.\",\n \"properties\": {\n \"as_of_seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"project\": {\n \"type\": \"string\"\n },\n \"org_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"query\": {\n \"$ref\": \"#/$defs/LineageArgs\"\n },\n \"nodes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/NodeLineage\"\n }\n },\n \"runs\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Run\"\n }\n },\n \"flags\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Flag\"\n }\n },\n \"next\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"as_of_seq\",\n \"project\",\n \"org_id\",\n \"query\",\n \"nodes\",\n \"runs\",\n \"flags\",\n \"next\"\n ]\n },\n \"tool.lineage\": {\n \"type\": \"object\",\n \"$comment\": \"read only; scope tickets:read. Refusals as every tool's (mcp-tools.schema.json Refusal): node_not_found for by node, bad_arguments, project_not_created. Any other key that leads nowhere is an answer with the flag not_found, not a refusal\",\n \"properties\": {\n \"name\": {\n \"const\": \"lineage\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/LineageArgs\"\n },\n \"result\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/$defs/LineageResult\"\n },\n {\n \"$ref\": \"mcp-tools.schema.json#/$defs/Refusal\"\n }\n ]\n }\n }\n }\n }\n}\n",
13
+ "mcp-tools.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1 MCP tools\",\n \"description\": \"The work items contract's MCP tools, with their argument and result shapes: \\\"#/$defs/tool.<name>\\\" names the tool's arguments and result; \\\"#/$defs/<Shape>\\\" are the shapes themselves. Write tools take a pre-signed event and return Appended; a refused call returns a structured error result shaped as Refusal (close: {unmet}). The tools are served by ticket-mcp over stdio and by the store-backed service at /mcp. changes (the change feed, changes@1) is served only where the deployment turns it on (feed.changes, off by default). emit and advance_time are test and demo tools, outside the contract.\",\n \"$comment\": \"Source: crates/sharedcontext/src/mcp/mod.rs (#[tool] functions, the argument structs, fn shape, Service::describe and the result json! literals). Tools (25): next, ready, claim_next, draft, claim, release, renew, context, split, merge, note, pin, link, move, gate_clear, close, goal_create, goal_measures, goal_close, subscribe, submit, state, stats, emit, advance_time; and changes (26), the change feed (struct ChangesArgs, fn changes, fn changes_page), its page in changes.schema.json. Arguments are not strict: the structs do not deny unknown fields; the one exception is ChangesArgs, which the contract closes (changes@1; its own $comment). No recorded MCP transcript yet: contract-check.mjs runs cases/changes-args.cases.jsonl against this file and compares it with the tools and argument structs it reads statically from the source; the tools' results are not checked against a transcript (open point).\",\n \"$defs\": {\n \"WriteArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"event\": {\n \"$comment\": \"a complete, signed NIP-01 event (object or JSON string) of this tool's type, as drafted by draft: sharedcontext/1 event.schema.json\",\n \"anyOf\": [\n {\n \"type\": \"object\"\n },\n {\n \"type\": \"string\"\n }\n ]\n },\n \"actor\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"INSECURE-SPIKE ONLY: the pubkey the server stamps as signer; never the contract\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"intent\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"claim: fix · triage · review · verify (claim_next: default fix)\"\n },\n \"pubkey\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"claim_next / claim without a node: the claimant's x-only pubkey\"\n },\n \"kinds\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"string\"\n },\n \"$comment\": \"claim_next filter: node kinds\"\n },\n \"labels\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"string\"\n },\n \"$comment\": \"claim_next filter: labels the node must all carry\"\n },\n \"goal\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"claim_next filter: a goal the node must serve\"\n },\n \"session\": {\n \"$comment\": \"optional agent session reference {agent_cli?, session_id}\"\n },\n \"lease_s\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0\n },\n \"on_sha\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"reason\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"release: done · blocked · handoff · abandoned · needs_input; also move, gate_clear, goal_measures, goal_close\"\n },\n \"to\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"release{handoff}: target pubkey; link: target node; gate_clear: the gate ref\"\n },\n \"progress\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"layer\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"note: pinned · working · summary\"\n },\n \"text\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"supersedes\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"edge\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"from\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"move: the current state\"\n },\n \"to_state\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"move: the target state\"\n },\n \"gate\": {\n \"$comment\": \"move{to_state: blocked}: {kind, ref}\"\n },\n \"parts\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"$comment\": \"split: [{title, covers[], severity?}]\"\n },\n \"into\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"body\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"owner\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"horizon\": {\n \"$comment\": \"goal_create: {from, to} unix seconds\"\n },\n \"weight\": {\n \"type\": [\n \"integer\",\n \"null\"\n ]\n },\n \"measures\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"$comment\": \"[{name, target, unit, source, direction?}]\"\n },\n \"outcome\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"goal_close: done · cancelled\"\n },\n \"client_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"idempotency id (c tag); generated when absent\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct WriteArgs: every write tool takes a pre-signed event (the contract); the other fields are the insecure-spike form and draft's args\"\n },\n \"NextArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"kind\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"limit\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0,\n \"$comment\": \"default 10\"\n },\n \"viewer\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"$comment\": \"the caller's pubkey\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct NextArgs\"\n },\n \"DraftArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"tool\": {\n \"type\": \"string\",\n \"$comment\": \"claim · release · renew · split · merge · note · pin · link · move · gate_clear · goal_create · goal_measures · goal_close\"\n },\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"args\": {\n \"type\": \"object\",\n \"$comment\": \"the write tool's arguments (WriteArgs names)\"\n }\n },\n \"required\": [\n \"tool\",\n \"pubkey\",\n \"args\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct DraftArgs\"\n },\n \"NodeArg\": {\n \"type\": \"object\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"node\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct NodeArg\"\n },\n \"CloseArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"run_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"node\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct CloseArgs\"\n },\n \"SubscribeArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"after_seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"limit\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 0,\n \"$comment\": \"default 100\"\n }\n },\n \"required\": [\n \"after_seq\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct SubscribeArgs\"\n },\n \"ChangesArgs\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"after\": {\n \"anyOf\": [\n {\n \"$ref\": \"changes.schema.json#/$defs/Cursor\"\n },\n {\n \"type\": \"null\"\n }\n ],\n \"$comment\": \"absent or null: from the start of the store's retained history\"\n },\n \"limit\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"minimum\": 1,\n \"maximum\": 1000,\n \"$comment\": \"Default 100, at most 1000 (as subscribe)\"\n },\n \"kinds\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 64\n },\n \"maxItems\": 32,\n \"$comment\": \"only these kinds; the cursor still moves past the others, so a filtered follower never re-reads them\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct ChangesArgs. Closed by the contract (changes@1): a caller sends only these. As built the struct, like the others here, does not deny unknown fields, and limit outside 1–1000 is clamped rather than refused\"\n },\n \"SubmitArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"event\": {\n \"anyOf\": [\n {\n \"type\": \"object\"\n },\n {\n \"type\": \"string\"\n }\n ],\n \"$comment\": \"a complete, signed NIP-01 event\"\n }\n },\n \"required\": [\n \"event\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct SubmitArgs\"\n },\n \"EmitArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"actor\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"content\": {\n \"$comment\": \"any JSON value\"\n },\n \"tags\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"client_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"actor\",\n \"type\",\n \"content\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct EmitArgs (INSECURE-SPIKE ONLY)\"\n },\n \"AdvanceArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"seconds\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n },\n \"required\": [\n \"seconds\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs struct AdvanceArgs\"\n },\n \"NoArgs\": {\n \"type\": \"object\",\n \"properties\": {},\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs stats takes no arguments\"\n },\n \"Appended\": {\n \"type\": \"object\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"duplicate\": {\n \"type\": \"boolean\"\n },\n \"reactions\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"w\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n }\n }\n },\n \"$comment\": \"service reactions appended with it (new events only)\"\n },\n \"node\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"claim\": {\n \"$comment\": \"the live claim or null\"\n },\n \"closed\": {\n \"$comment\": \"the close record or null\"\n },\n \"covers\": {\n \"type\": \"array\"\n },\n \"gate\": {\n \"$comment\": \"{kind, ref} or null\"\n }\n }\n }\n },\n \"required\": [\n \"seq\",\n \"id\",\n \"duplicate\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs Service::describe\"\n },\n \"Refusal\": {\n \"type\": \"object\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\",\n \"$comment\": \"snake_case RejectReason of the log, or a tool-level reason: wrong_tool_for_type, unsigned_write, missing_argument, unknown_tool, bad_arguments, project_not_created, node_not_found\"\n },\n \"detail\": {\n \"$comment\": \"any JSON value\"\n },\n \"hint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"reason\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs Service::append (log refusals {reason, detail}) and the tool-level errors; sent as a structured error result\"\n },\n \"Unsigned\": {\n \"type\": \"object\",\n \"properties\": {\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"created_at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"kind\": {\n \"const\": 7411\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"content\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"pubkey\",\n \"created_at\",\n \"kind\",\n \"tags\",\n \"content\"\n ],\n \"$comment\": \"crates/sharedcontext/src/signed/event.rs UnsignedEvent, as Service::draft returns it\"\n },\n \"Reservation\": {\n \"type\": \"object\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"until_ms\": {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n },\n \"required\": [\n \"node\",\n \"pubkey\",\n \"until_ms\"\n ],\n \"$comment\": \"crates/sharedcontext/src/work/claim_next.rs Reservation\"\n },\n \"NextResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"now\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"swept\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"w\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n }\n },\n \"next\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"node\": {\n \"type\": \"string\"\n },\n \"kind\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"severity\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"covers\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"handoff\": {},\n \"blocks\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"goal_weight\": {},\n \"unblock_count\": {},\n \"goals\": {\n \"type\": \"array\"\n }\n },\n \"$comment\": \"crates/sharedcontext/src/work/log.rs Log::next entries\"\n }\n },\n \"alias_of\": {\n \"const\": \"next\"\n }\n },\n \"required\": [\n \"now\",\n \"swept\",\n \"next\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs next_view\"\n },\n \"ClaimNextResult\": {\n \"anyOf\": [\n {\n \"allOf\": [\n {\n \"$ref\": \"#/$defs/Appended\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"claimed\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"claimed\"\n ]\n }\n ],\n \"$comment\": \"one call: this server holds the caller's key\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"claimed\": {\n \"type\": \"null\"\n },\n \"hint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"claimed\"\n ],\n \"$comment\": \"nothing claimable\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"reserved\": {\n \"$ref\": \"#/$defs/Reservation\"\n },\n \"unsigned\": {\n \"$ref\": \"#/$defs/Unsigned\"\n },\n \"hint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"reserved\",\n \"unsigned\"\n ],\n \"$comment\": \"two-phase: sign unsigned and send it to claim before until_ms\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"reserved\": {\n \"type\": \"null\"\n },\n \"hint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"reserved\"\n ],\n \"$comment\": \"nothing claimable\"\n }\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs fn claim_next; claim without event and node adds alias_of: claim_next\"\n },\n \"DraftResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"tool\": {\n \"type\": \"string\"\n },\n \"unsigned\": {\n \"$ref\": \"#/$defs/Unsigned\"\n },\n \"hint\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"tool\",\n \"unsigned\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs tool draft\"\n },\n \"CloseResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"evidence\": {\n \"$comment\": \"any JSON value\"\n },\n \"appended\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n },\n \"required\": [\n \"evidence\",\n \"appended\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs tool close: when the rule does not hold the result is a structured error {unmet}\"\n },\n \"SubscribeResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"after_seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"head_seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"events\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"received_at\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"w\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"pubkey\": {\n \"type\": \"string\"\n },\n \"content\": {\n \"$comment\": \"the content parsed as JSON (sharedcontext/1 content.schema.json by w), or null\"\n }\n },\n \"required\": [\n \"seq\",\n \"received_at\",\n \"w\",\n \"node\",\n \"id\",\n \"pubkey\",\n \"content\"\n ]\n }\n }\n },\n \"required\": [\n \"after_seq\",\n \"head_seq\",\n \"events\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs tool subscribe\"\n },\n \"FoldedView\": {\n \"type\": \"object\",\n \"$comment\": \"the folded node view with derived fields, or the context bundle (crates/sharedcontext/src/work/log.rs context_at, node_view_at); its node fields follow the canonical snapshot form in crates/sharedcontext/fixtures/README.md. Not pinned field by field in sharedcontext/1 (open point)\"\n },\n \"StatsResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"events\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"nodes\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"rejects\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"skipped\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"registry_versions\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"now\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"project\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"insecure_spike\": {\n \"type\": \"boolean\"\n },\n \"reject_tail\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"reason\": {\n \"type\": \"string\"\n },\n \"detail\": {\n \"$comment\": \"any JSON value\"\n },\n \"w\": {\n \"$comment\": \"any JSON value\"\n }\n }\n }\n }\n },\n \"required\": [\n \"events\",\n \"nodes\",\n \"rejects\",\n \"skipped\",\n \"registry_versions\",\n \"now\",\n \"project\",\n \"insecure_spike\",\n \"reject_tail\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs tool stats\"\n },\n \"AdvanceResult\": {\n \"type\": \"object\",\n \"properties\": {\n \"now\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"virtual\": {\n \"type\": \"boolean\"\n },\n \"swept\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"seq\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"w\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"node\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n }\n }\n },\n \"required\": [\n \"now\",\n \"virtual\",\n \"swept\"\n ],\n \"$comment\": \"crates/sharedcontext/src/mcp/mod.rs tool advance_time\"\n },\n \"tool.next\": {\n \"type\": \"object\",\n \"$comment\": \"claimable nodes for viewer in next() order; read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"next\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/NextArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/NextResult\"\n }\n }\n },\n \"tool.ready\": {\n \"type\": \"object\",\n \"$comment\": \"alias of next\",\n \"properties\": {\n \"name\": {\n \"const\": \"ready\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/NextArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/NextResult\"\n }\n }\n },\n \"tool.claim_next\": {\n \"type\": \"object\",\n \"$comment\": \"atomic best ready node: one call with the caller's key, else a 5 s reservation and the draft\",\n \"properties\": {\n \"name\": {\n \"const\": \"claim_next\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/ClaimNextResult\"\n }\n }\n },\n \"tool.draft\": {\n \"type\": \"object\",\n \"$comment\": \"the unsigned body for a write tool; read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"draft\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/DraftArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/DraftResult\"\n }\n }\n },\n \"tool.claim\": {\n \"type\": \"object\",\n \"$comment\": \"claim.taken; without event and node it is claim_next\",\n \"properties\": {\n \"name\": {\n \"const\": \"claim\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.release\": {\n \"type\": \"object\",\n \"$comment\": \"claim.released\",\n \"properties\": {\n \"name\": {\n \"const\": \"release\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.renew\": {\n \"type\": \"object\",\n \"$comment\": \"claim.renewed (e tag → the claim)\",\n \"properties\": {\n \"name\": {\n \"const\": \"renew\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.context\": {\n \"type\": \"object\",\n \"$comment\": \"the context bundle; read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"context\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/NodeArg\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/FoldedView\"\n }\n }\n },\n \"tool.split\": {\n \"type\": \"object\",\n \"$comment\": \"node.split\",\n \"properties\": {\n \"name\": {\n \"const\": \"split\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.merge\": {\n \"type\": \"object\",\n \"$comment\": \"node.merged\",\n \"properties\": {\n \"name\": {\n \"const\": \"merge\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.note\": {\n \"type\": \"object\",\n \"$comment\": \"note.added\",\n \"properties\": {\n \"name\": {\n \"const\": \"note\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.pin\": {\n \"type\": \"object\",\n \"$comment\": \"context.pinned\",\n \"properties\": {\n \"name\": {\n \"const\": \"pin\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.link\": {\n \"type\": \"object\",\n \"$comment\": \"node.linked\",\n \"properties\": {\n \"name\": {\n \"const\": \"link\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.move\": {\n \"type\": \"object\",\n \"$comment\": \"state.transitioned\",\n \"properties\": {\n \"name\": {\n \"const\": \"move\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.gate_clear\": {\n \"type\": \"object\",\n \"$comment\": \"gate.cleared\",\n \"properties\": {\n \"name\": {\n \"const\": \"gate_clear\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.close\": {\n \"type\": \"object\",\n \"$comment\": \"evaluate the close policy now\",\n \"properties\": {\n \"name\": {\n \"const\": \"close\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/CloseArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/CloseResult\"\n }\n }\n },\n \"tool.goal_create\": {\n \"type\": \"object\",\n \"$comment\": \"node.created{kind: goal}\",\n \"properties\": {\n \"name\": {\n \"const\": \"goal_create\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.goal_measures\": {\n \"type\": \"object\",\n \"$comment\": \"goal.measures_set\",\n \"properties\": {\n \"name\": {\n \"const\": \"goal_measures\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.goal_close\": {\n \"type\": \"object\",\n \"$comment\": \"node.closed on a goal\",\n \"properties\": {\n \"name\": {\n \"const\": \"goal_close\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/WriteArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.subscribe\": {\n \"type\": \"object\",\n \"$comment\": \"events after a seq (a page; poll to follow); read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"subscribe\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/SubscribeArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/SubscribeResult\"\n }\n }\n },\n \"tool.changes\": {\n \"type\": \"object\",\n \"$comment\": \"the change feed, changes@1: what changed after a cursor, without the body; read only, the same read scope as subscribe. Served only with feed.changes on (off by default): off, the tool is not listed and a call is an unknown tool. A refused call returns a ChangesRefusal (cursor_invalid, cursor_ahead) as a structured error result\",\n \"properties\": {\n \"name\": {\n \"const\": \"changes\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/ChangesArgs\"\n },\n \"result\": {\n \"$ref\": \"changes.schema.json#/$defs/ChangesPage\"\n }\n }\n },\n \"tool.submit\": {\n \"type\": \"object\",\n \"$comment\": \"append any pre-signed event (the generic write path)\",\n \"properties\": {\n \"name\": {\n \"const\": \"submit\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/SubmitArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.state\": {\n \"type\": \"object\",\n \"$comment\": \"folded view of one node; read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"state\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/NodeArg\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/FoldedView\"\n }\n }\n },\n \"tool.stats\": {\n \"type\": \"object\",\n \"$comment\": \"log statistics and the reject journal tail; read only\",\n \"properties\": {\n \"name\": {\n \"const\": \"stats\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/NoArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/StatsResult\"\n }\n }\n },\n \"tool.emit\": {\n \"type\": \"object\",\n \"$comment\": \"INSECURE-SPIKE ONLY, not part of the contract\",\n \"properties\": {\n \"name\": {\n \"const\": \"emit\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/EmitArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/Appended\"\n }\n }\n },\n \"tool.advance_time\": {\n \"type\": \"object\",\n \"$comment\": \"virtual clock only; test and demo\",\n \"properties\": {\n \"name\": {\n \"const\": \"advance_time\"\n },\n \"arguments\": {\n \"$ref\": \"#/$defs/AdvanceArgs\"\n },\n \"result\": {\n \"$ref\": \"#/$defs/AdvanceResult\"\n }\n }\n }\n }\n}\n",
14
+ "stored-event.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"sharedcontext/1 stored event\",\n \"description\": \"An event as the log stores and serves it: the signed event plus the server-side fields, which are never hashed or signed. seq is the one fold order; received_at (unix seconds) is the lease clock; policy_version is the hash of the policy version the log checked the event against. One line of the fixture log after its header.\",\n \"$comment\": \"Source: crates/sharedcontext/src/signed/event.rs struct StoredEvent {seq, received_at, policy_version (optional: absent only for events stored before the log recorded policy versions), event}; fixture line format {seq, received_at, policy_version, event} (crates/sharedcontext/fixtures/README.md).\",\n \"type\": \"object\",\n \"required\": [\"seq\", \"received_at\", \"event\"],\n \"properties\": {\n \"seq\": { \"type\": \"integer\", \"minimum\": 1 },\n \"received_at\": { \"type\": \"integer\", \"minimum\": 0 },\n \"policy_version\": { \"type\": \"string\", \"pattern\": \"^sha256:[0-9a-f]{64}$\", \"$comment\": \"crates/sharedcontext/src/work/org.rs policy_version\" },\n \"event\": { \"$ref\": \"event.schema.json\" }\n }\n}\n",
15
+ };
16
+ /** The schema files of the directory contract sharedcontext-directory/1 (a directory's HTTP pages). */
17
+ export const DIRECTORY_SCHEMA_FILES = ["sharedcontext-directory-1/members.schema.json", "sharedcontext-directory-1/memberships.schema.json"];
18
+ /** Each directory schema file's exact text. */
19
+ export const DIRECTORY_SCHEMA_TEXT = {
20
+ "sharedcontext-directory-1/members.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"urn:sharedcontext-directory:1:members\",\n \"title\": \"sharedcontext-directory/1 member page\",\n \"$comment\": \"The 200 body of GET {base}/orgs/{org_id}/members?limit={n}[&cursor={c}] (required route). A client follows next_cursor until it is null, empty or absent; a repeated cursor is an error. The pages together are the org's complete listing, or the server answers an error: never a silently partial listing (a member missing from it reads as gone from the org). Fields not named here are ignored by a client (additive changes stay v1; a breaking change is v2). Contract: docs/directory-http.md. Client: src/directory/http.rs.\",\n \"type\": \"object\",\n \"required\": [\"members\"],\n \"properties\": {\n \"members\": {\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/$defs/Member\" }\n },\n \"next_cursor\": { \"$ref\": \"#/$defs/NextCursor\" }\n },\n \"$defs\": {\n \"NextCursor\": {\n \"type\": [\"string\", \"null\"],\n \"maxLength\": 1024,\n \"$comment\": \"Opaque to the client, which sends it back as ?cursor= (percent-encoded) with the same org and limit, and never parses it. null, empty or absent: this is the last page. A server may answer a cursor issued for another org 400.\"\n },\n \"Id\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 256 },\n \"Member\": {\n \"type\": \"object\",\n \"required\": [\"member_id\", \"org_id\", \"user_id\", \"kind\", \"role\", \"lifecycle\", \"teams\", \"keys\"],\n \"properties\": {\n \"member_id\": { \"$ref\": \"#/$defs/Id\", \"description\": \"The member's id in the directory; stable for the member's life.\" },\n \"org_id\": { \"$ref\": \"#/$defs/Id\", \"description\": \"Always the org of the request: a member of another org fails the whole read.\" },\n \"user_id\": { \"type\": \"string\", \"maxLength\": 256, \"description\": \"The user behind a person member; may be empty for an agent.\" },\n \"kind\": { \"enum\": [\"person\", \"agent\"] },\n \"role\": { \"type\": \"string\", \"maxLength\": 128, \"description\": \"The org role (owner, admin, member or a custom role), or several comma-separated; may be empty (read as member).\" },\n \"title\": { \"type\": [\"string\", \"null\"], \"maxLength\": 256 },\n \"lifecycle\": { \"enum\": [\"active\", \"paused\", \"retired\"] },\n \"sponsor_member_id\": { \"type\": [\"string\", \"null\"], \"maxLength\": 256, \"description\": \"Agents: the sponsoring member (a person of the same org).\" },\n \"teams\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/Id\" }, \"description\": \"Team ids.\" },\n \"keys\": { \"type\": \"array\", \"items\": { \"$ref\": \"#/$defs/Key\" }, \"description\": \"The member's Nostr keys, revoked ones included (with revoked_at); at most one unrevoked.\" },\n \"sponsor_active\": { \"type\": [\"boolean\", \"null\"], \"description\": \"Agents: the directory's own view of whether the sponsor is active (read for drift only).\" }\n },\n \"if\": { \"required\": [\"kind\"], \"properties\": { \"kind\": { \"const\": \"agent\" } } },\n \"then\": { \"required\": [\"sponsor_member_id\"], \"properties\": { \"sponsor_member_id\": { \"type\": \"string\", \"minLength\": 1 } } },\n \"$comment\": \"Optional fields (title, sponsor_member_id, sponsor_active, a key's revoked_at) are best omitted; a client accepts null too. An agent always carries its sponsor_member_id.\"\n },\n \"Key\": {\n \"type\": \"object\",\n \"required\": [\"pubkey\", \"custody\"],\n \"properties\": {\n \"pubkey\": { \"type\": \"string\", \"pattern\": \"^[0-9a-f]{64}$\", \"description\": \"x-only public key, 64 lowercase hex.\" },\n \"custody\": { \"enum\": [\"self\", \"directory\"], \"description\": \"self: the member holds it (a person); directory: the directory holds it and signs with it (an agent's minted key).\" },\n \"revoked_at\": { \"type\": [\"string\", \"null\"], \"maxLength\": 64, \"description\": \"Set when the key was revoked (RFC 3339); a revoked key maps to nothing.\" }\n }\n }\n }\n}\n",
21
+ "sharedcontext-directory-1/memberships.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"urn:sharedcontext-directory:1:memberships\",\n \"title\": \"sharedcontext-directory/1 membership page\",\n \"$comment\": \"The 200 body of GET {base}/users/{user_id}/memberships?limit={n}[&cursor={c}] (optional route: 404 or 501 means the directory does not offer it). Paged like the member listing (members.schema.json), with the same complete-or-error rule. Fields not named here are ignored by a client. Contract: docs/directory-http.md. Client: src/directory/http.rs.\",\n \"type\": \"object\",\n \"required\": [\"memberships\"],\n \"properties\": {\n \"memberships\": {\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/$defs/Membership\" }\n },\n \"next_cursor\": {\n \"type\": [\"string\", \"null\"],\n \"maxLength\": 1024,\n \"$comment\": \"As in members.schema.json: opaque; null, empty or absent on the last page.\"\n }\n },\n \"$defs\": {\n \"Membership\": {\n \"type\": \"object\",\n \"required\": [\"org_id\", \"member_id\", \"kind\", \"role\", \"lifecycle\"],\n \"properties\": {\n \"org_id\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 256 },\n \"member_id\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 256 },\n \"kind\": { \"enum\": [\"person\", \"agent\"] },\n \"role\": { \"type\": \"string\", \"maxLength\": 128 },\n \"lifecycle\": { \"enum\": [\"active\", \"paused\", \"retired\"] }\n }\n }\n }\n}\n",
22
+ };