feat: add structured extraction with provenance receipts (#156) - #180
Merged
Conversation
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #156.
Automatic capture currently splits text without preserving speaker roles or evidence spans. This change adds
POST /v1/extractand stored provenance receipts. It supports preview and idempotent proposed writes. The SDK and OpenAPI expose the versioned contract.The Hermes feature flag sends structured messages through the new API. Provider failures preserve the request and retry key in volatile storage. Disabling the flag restores the existing classifier pipeline. The flag defaults to false.
Extraction preserves assertion mode, caller-supplied roles, evidence spans, shared roots, and literal source cues. The #162D-shaped regression retains this provenance when the suggested kind is
fact. Extraction does not assign risk, consequence, sensitivity, or admission authority. Production admission behavior remains unchanged.Migration 036 explicitly revokes UPDATE and DELETE inherited from migration 003's default grants. Both extraction tables are append-only to
engram_app, which has SELECT/INSERT only. The existing UPDATE triggers and link constraints provide additional protection. Owner/migration-role maintenance remains available.Verification
5d8af6a64f0d425613881f863e4b43f11b687d91.42501. The run and link remain unchanged after each attempt, including the attempted cascading run deletion.make checkpassed inside Docker Compose.make compose-cirun passed: 3,543 service tests, 56 SDK tests, 190 hooks tests, and 36 MCP tests.Live evaluation
The configured classification provider used
deepseek-ai/DeepSeek-V4-Flashwith promptengram.extract.3and schemaengram.extraction.v1. The frozen set contains 19 synthetic cases. All expected HTTP outcomes passed. Candidate precision and recall were 100%; kind accuracy was 78.9%; retention accuracy was 89.5%. Attribution and evidence checks scored 100%. The provider reported $0.002690244 and a median latency of 4.410 seconds.The recorded outputs, earlier development runs, and reproducibility checks are included. This small synthetic set does not certify production admission. Caller-supplied roles do not authenticate speakers, and batch roots do not prove independent evidence.
See the completion report and the ADR.