Repository navigation
Attribute evidence freshness in compiled Context briefs - #1003
Conversation
read_context_documents already returns each source version's retrievedAt, but the brief compiler dropped it, so a creative-direction or playlist-pitch brief could not show how current its evidence was. Summarize retrieval dates per selected document into an additive input_manifest.freshness object and end each document section of the brief text with a Retrieved line; source locations stay out of both. Keep compilerVersion at context-brief-v1 and the manifest document entries unchanged because the deployed save_context_brief function pins that version and compares the manifest exactly. Add a two-song same-artist checkpoint fixture that drives the shared operation for brief, save_brief and read_brief. Refs recoupable/app#2130 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Architecture diagram
sequenceDiagram
participant Client as HTTP/MCP Client
participant PCO as processContextOperation
participant RPC as Context RPC Layer
participant DB as Postgres DB
participant Compiler as compileContextBrief
participant Selector as selectContextDocuments
participant Freshness as summarizeContextBriefFreshness
participant Saver as save_context_brief RPC
Note over Client,Saver: Context Brief Compilation Flow (context-brief-v1)
Client->>PCO: brief action (request_ids + purpose)
PCO->>RPC: read_context_request (per request_id)
RPC->>DB: Fetch request
DB-->>RPC: Request + subjectIds
RPC-->>PCO: Request data
PCO->>RPC: read_context_documents
RPC->>DB: Fetch documents (filtered by workspace & subject)
DB-->>RPC: Documents with sources[].retrievedAt
RPC-->>PCO: ContextBriefDocument[] (includes sources metadata)
PCO->>Compiler: compileContextBrief(input)
Compiler->>Selector: selectContextDocuments(documents)
Selector->>Selector: Filter by status/coverage/owner
Selector-->>Compiler: Selected documents
Compiler->>Freshness: summarizeContextBriefFreshness(documents)
Freshness->>Freshness: Parse retrievedAt per source
Freshness->>Freshness: Compute oldest/newest/documentsWithoutRetrievalDate
Freshness-->>Compiler: Freshness summary (locations excluded)
Compiler->>Compiler: Render Markdown text
Note over Compiler: Append "Retrieved: <ISO|unknown>" to each section
Compiler-->>PCO: Brief with input_manifest.freshness + retrievedAt lines
PCO->>Saver: save_context_brief (compilerVersion=context-brief-v1)
Saver->>DB: Persist brief snapshot
alt Snapshot key already used
Saver-->>PCO: Brief key already used for different output conflict
else New key
Saver-->>PCO: Saved snapshot
end
PCO-->>Client: Brief response
alt Read back brief
Client->>PCO: read_brief action
PCO->>RPC: read_context_brief
RPC->>DB: Fetch brief
DB-->>RPC: Stored snapshot
RPC-->>PCO: Snapshot data
PCO-->>Client: Identical brief as saved
end
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Compiled briefs now carry freshness lines and a manifest freshness object, so a Sites save_brief replay of a pre-deploy brief-v3 key would hit save_context_brief's "Brief key already used for different output" conflict on the concepts -> generate path and on every retry. Rotate the suffix to brief-v4 and lock the exact keys in the Sites key test. Freshness previously took each document's newest source, which masked an older source on multi-source evidence. Overall and per-document bounds now span every dated source, and the Retrieved line shows a range when a document's sources differ. The checkpoint test that only proves topic scoping is renamed so it no longer claims a private-input rule. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 7 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Adds evidence-freshness attribution to compiled Context briefs via an additive manifest object and per-document Retrieved: lines, preserving the RPC-pinned context-brief-v1 shape and bumping the Sites idempotency key, with tests locking freshness bounds and unknown dates.
View guided diff | Turn on auto-fix | Re-trigger cubic
Compiled Context briefs dropped source retrieval dates, and the old freshness candidate did not satisfy the current strict response schemas. Add retrieval ranges to the final selected evidence, rendered brief text and input manifest, and reconcile both direct and saved-brief contracts. Historical snapshots may omit freshness and remain readable without recompilation. Retrieval dates describe collection time; they do not enforce age or establish factual accuracy.
Preserve the SQL-pinned compiler version, exact six-field document manifest, current coverage summaries, Unicode filtering and authorization. Advance the Sites brief key from v3 to v4 so changed compiled output does not conflict with a previously saved snapshot for the same site revision and request.
Validation: 139 focused tests and both contract typechecks pass after current-main composition and the two-file published-fixture correction. Actual compile/save/read outputs, historical snapshots, HTTP/MCP examples, source attribution, text bounds and Sites request-isolated keys are covered. Independent source and composition reviews passed; exact-head required CI is checked separately. No provider calls, database migration, hosted writes or historical mutations.
Release order: current Docs #25 must qualify and merge first; then this API PR. Its inventory pins API candidate
1fa960510869bc0cad890764e5c04b5c29dd5e8f. The archived docs-legacy #360 remains open and is not a release target. Production freshness and a real two-song journey remain separately unverified.Related: recoupable/app#2130 under recoupable/app#2116. The broader epic remains open.