Provenance lines in recall/reflect output (document_id / context / observation_scopes)

#56 · open · 0 comments

View on GitHub ↗

gtnotacoder

Tracking issue for the fork's slice-7 work (epic gtnotacoder/pi-dynamic-workflows#393). The server returns provenance on every recalled fact (RecallResult: id, document_id, context, metadata with observation_scopes; ReflectResponse: based_on.memories when includeFacts is requested) but the plugin dropped it — hindsight_recall rendered only 'N. <text>' and hindsight_reflect only the synthesized answer, so agents could not judge a memory's trustworthiness. Implemented on the fork (gtnotacoder/epimetheus, branch feat/hindsight-recall-provenance @ 900a89a, merged to fork main): - hindsight_recall renders a compact provenance line per result: [id: <id> | doc: <document_id or -> | ctx: <context snippet ≤80 chars or -> | scopes: <observation scopes ≤3, +N more note, or ->]. - hindsight_reflect appends a Sources: list (id prefix + first ~60 chars of text per source fact, ≤10 with a (N more sources) note) after the synthesized answer; requests includeFacts only when provenance is on. - provenance param (boolean, default true) on both tools — false strips the lines (token-budget escape hatch; raw facts stay in details). - New src/provenance.ts pure renderers (ReflectFact derived locally — the SDK does not export it); observation_scopes parser handles nested string[][] JSON, JSON arrays, comma-separated, mode strings, and absent/null metadata. - 20 new tests (renderer unit tests + tool/client behavioral tests). Upstream PR is permission-blocked for the fork author; this issue tracks the feature for upstream consideration.

Comments