From fd8e09e2d22cdaf414862b0b5342a98ac94d9b58 Mon Sep 17 00:00:00 2001 From: Sidney Swift <158200036+sidneyswift@users.noreply.github.com> Date: Sat, 10 Oct 2026 16:08:38 -0400 Subject: [PATCH 1/2] Document the read_document_history context action The shared context operation gains a scoped read of a document's immutable revision history so a superseded brief can be resolved to the result it cited. Add the request variant, an example and the response contract to the OpenAPI spec; the operate page stays frontmatter-only. Refs recoupable/app#2121 Co-Authored-By: Claude Fable 5.1 --- api-reference/openapi/context.json | 48 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/api-reference/openapi/context.json b/api-reference/openapi/context.json index f65ae185..2aab3d6c 100644 --- a/api-reference/openapi/context.json +++ b/api-reference/openapi/context.json @@ -32,7 +32,7 @@ "post": { "operationId": "contextOperation", "summary": "Ingest, read, or compile context briefs", - "description": "Save reusable music context, read progress, or compile a task-specific evidence brief. This reference documents the ingestion, read, brief, save_brief and read_brief actions of the shared HTTP/MCP operation. Brief compilation combines up to ten completed or partial requests in one authorized workspace, reuses saved evidence without provider or model calls, and returns bounded Markdown plus the selected input versions. Creative direction prioritizes lyrics and artwork; playlist pitching prioritizes catalog/audio metadata. Shared artist evidence appears once, with coverage reported separately for each request. Briefs are evidence packets, not generated creative concepts or finished outreach. Inspect readiness, request_coverage and gaps. The brief action is read-only; use save_brief with the same inputs and an idempotency_key to freeze the server-compiled output, then read_brief with its brief_id to retrieve it without recompilation. A newer document revision marks the snapshot superseded without rewriting it. Withdrawn/unavailable evidence, cancelled requests, or removed subject scope withhold the payload. Saving rechecks current evidence before committing. Apply the companion snapshot migration before using save_brief/read_brief. Ingestion dispatches a durable workflow; retry the same input and idempotency key after dispatch failure.", + "description": "Save reusable music context, read progress, or compile a task-specific evidence brief. This reference documents the ingestion, read, brief, save_brief and read_brief actions of the shared HTTP/MCP operation. Brief compilation combines up to ten completed or partial requests in one authorized workspace, reuses saved evidence without provider or model calls, and returns bounded Markdown plus the selected input versions. Creative direction prioritizes lyrics and artwork; playlist pitching prioritizes catalog/audio metadata. Shared artist evidence appears once, with coverage reported separately for each request. Briefs are evidence packets, not generated creative concepts or finished outreach. Inspect readiness, request_coverage and gaps. The brief action is read-only; use save_brief with the same inputs and an idempotency_key to freeze the server-compiled output, then read_brief with its brief_id to retrieve it without recompilation. A newer document revision marks the snapshot superseded without rewriting it. Withdrawn/unavailable evidence, cancelled requests, or removed subject scope withhold the payload. Saving rechecks current evidence before committing. Apply the companion snapshot migration before using save_brief/read_brief. Ingestion dispatches a durable workflow; retry the same input and idempotency key after dispatch failure. read_document_history reads the immutable revision history of one saved context document in the authorized workspace, without provider or model calls.", "security": [ { "ApiKey": [] @@ -253,6 +253,42 @@ "description": "Optional organization that owns the private context. Current membership is checked." } } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "action", + "document_id" + ], + "properties": { + "action": { + "type": "string", + "const": "read_document_history" + }, + "document_id": { + "type": "string", + "format": "uuid", + "description": "A context document ID from a brief manifest (documentId) or read result (id)." + }, + "organization_id": { + "type": "string", + "format": "uuid", + "description": "Optional organization that owns the private context. Current membership is checked." + }, + "before_revision": { + "type": "integer", + "minimum": 0, + "description": "Exclusive cursor: return revisions below this number. Use next_before from the previous page." + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 50, + "description": "Page size, newest revision first." + } + } } ] }, @@ -284,6 +320,14 @@ "action": "read_brief", "brief_id": "33333333-3333-4333-8333-333333333333" } + }, + "readDocumentHistory": { + "summary": "Read the revision history of one saved document", + "value": { + "action": "read_document_history", + "document_id": "44444444-4444-4444-8444-444444444444", + "limit": 20 + } } } } @@ -294,7 +338,7 @@ "description": "Saved ingestion request; inspect request.status and use read to poll. Existing completed/partial requests return without provider work." }, "200": { - "description": "Read returns request. Brief returns request_id, request_ids, purpose, readiness, bounded Markdown text and text_characters, documents and their serialized characters count, missingTopics, guidance, gaps, request_coverage, and input_manifest. Each coverage entry includes requestId, readiness and missingTopics; overall readiness remains partial if any request has a gap or partial evidence. The manifest includes compilerVersion, method, requestIds, excludedTopics, and selected documents with documentId, resultId (null only if unavailable), subjectId, topic, version and sourceVersionIds. The result is returned without creating a saved brief record. Save/read brief return {snapshot: {id, created_at, purpose, state, superseded, brief}}. state is saved or unavailable; unavailable snapshots return brief: null. saved snapshots return the exact compiled response including its input manifest. Another workspace cannot read the record." + "description": "Read returns request. Brief returns request_id, request_ids, purpose, readiness, bounded Markdown text and text_characters, documents and their serialized characters count, missingTopics, guidance, gaps, request_coverage, and input_manifest. Each coverage entry includes requestId, readiness and missingTopics; overall readiness remains partial if any request has a gap or partial evidence. The manifest includes compilerVersion, method, requestIds, excludedTopics, and selected documents with documentId, resultId (null only if unavailable), subjectId, topic, version and sourceVersionIds. The result is returned without creating a saved brief record. Save/read brief return {snapshot: {id, created_at, purpose, state, superseded, brief}}. state is saved or unavailable; unavailable snapshots return brief: null. saved snapshots return the exact compiled response including its input manifest. Another workspace cannot read the record. read_document_history returns {state, document, versions, has_more, next_before}. state is found or not_found; another workspace's or an unknown document is not_found with document: null and no versions, never confirming existence. document carries id, subject_id, topic, current_revision, current_result_id and updated_at. versions are newest first; each has revision, result_id (null for a cleared revision), change (accepted or cleared), backfilled, recorded_at, the result's current result_status and evidence_kind, source_version_ids and source_state (live, withdrawn, removed, or null when cleared). A superseded brief's manifest version resolves to the result that was current at that revision. History rows are immutable; the current pointer stays on the document. Apply the companion document-version migration before using read_document_history." }, "400": { "description": "Invalid input" From 180de652fc7928013d61fff75c58a7f189a5972a Mon Sep 17 00:00:00 2001 From: Sidney Swift <158200036+sidneyswift@users.noreply.github.com> Date: Sat, 10 Oct 2026 17:27:58 -0400 Subject: [PATCH 2/2] Point read_document_history at real document ID sources The read action returns the request, not documents, so document_id now names where IDs actually come from: a brief or saved brief response's documents[].id or input_manifest.documents[].documentId. before_revision starts at 1 to match the API, because revision 0 is never recorded and is never returned as next_before. Refs recoupable/app#2121 Co-Authored-By: Claude Opus 5.5 --- api-reference/openapi/context.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api-reference/openapi/context.json b/api-reference/openapi/context.json index 2aab3d6c..749d06ff 100644 --- a/api-reference/openapi/context.json +++ b/api-reference/openapi/context.json @@ -269,7 +269,7 @@ "document_id": { "type": "string", "format": "uuid", - "description": "A context document ID from a brief manifest (documentId) or read result (id)." + "description": "A context document ID from a brief or saved brief response: documents[].id or input_manifest.documents[].documentId." }, "organization_id": { "type": "string", @@ -278,8 +278,8 @@ }, "before_revision": { "type": "integer", - "minimum": 0, - "description": "Exclusive cursor: return revisions below this number. Use next_before from the previous page." + "minimum": 1, + "description": "Exclusive cursor: return revisions below this number. Use next_before from the previous page; revision 0 is never recorded." }, "limit": { "type": "integer",