You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #78 created the tool_result_events table in archive.sqlite but left it empty:
tool_result_events — table reserved (created, not populated) for the future content-sidecar bridge (#33) and execution-graph work.
The table is defined at packages/ledger/src/archive.ts (schema block, with the comment Reserved for the content-sidecar bridge (#33) and the execution-graph work). Columns: source, session_id, message_id, tool_use_id, call_index, event_index, status, content_length, content_hash, subagent_session_id, agent_id, event_source, ts.
This issue is the thin connector: read the canonical ToolResultEventRecord lines (and optionally enrich content_length / content_hash from the content sidecar where the execution-graph record doesn't already carry them) and materialize them into the archive's tool_result_events rows during incremental build.
Proposal
In archive.ts, add a third pass to buildArchive() that handles LedgerLine kind tool_result_event (added by PR Execution graph substrate: SessionRelationshipRecord + ToolResultEventRecord (#42) #77). Parse via the new isToolResultEventLine guard and INSERT OR REPLACE INTO tool_result_events keyed on (source, session_id, message_id, tool_use_id, event_index).
Track build progress through the same archive_state.ledger_offset_bytes cursor — no separate cursor needed since both turn and tool-result-event lines live in the same ledger.jsonl.
Context
PR #78 created the
tool_result_eventstable inarchive.sqlitebut left it empty:The table is defined at
packages/ledger/src/archive.ts(schema block, with the commentReserved for the content-sidecar bridge (#33) and the execution-graph work). Columns:source,session_id,message_id,tool_use_id,call_index,event_index,status,content_length,content_hash,subagent_session_id,agent_id,event_source,ts.The upstream data already exists or will exist:
ContentRecordrows fortool_resultare written to~/.relayburn/content/<sessionId>.jsonlfor Claude, Codex, and OpenCode.ToolResultEventRecordto the canonical ledger viaappendToolResultEvents/queryToolResultEvents. Schema columns line up with the archive table almost 1:1.This issue is the thin connector: read the canonical
ToolResultEventRecordlines (and optionally enrichcontent_length/content_hashfrom the content sidecar where the execution-graph record doesn't already carry them) and materialize them into the archive'stool_result_eventsrows during incremental build.Proposal
archive.ts, add a third pass tobuildArchive()that handlesLedgerLinekindtool_result_event(added by PR Execution graph substrate: SessionRelationshipRecord + ToolResultEventRecord (#42) #77). Parse via the newisToolResultEventLineguard andINSERT OR REPLACE INTO tool_result_eventskeyed on(source, session_id, message_id, tool_use_id, event_index).contentLengthandcontentHash(per PR Execution graph substrate: SessionRelationshipRecord + ToolResultEventRecord (#42) #77's record shape). If a future record lacks them, fall back to reading the matchingContentRecordfrom the content sidecar.archive_state.ledger_offset_bytescursor — no separate cursor needed since both turn and tool-result-event lines live in the sameledger.jsonl.Tests:
ToolResultEventRecordrows, runbuildArchive(), assert they show up with correct keys, statuses, and content metadata.ARCHIVE_VERSIONclears and re-populatestool_result_eventsfrom the ledger.Acceptance criteria
tool_result_eventsis populated incrementally duringburn archive build.burn archive status --jsonrow counts includetool_result_events.Out of scope
ToolResultEventRecordshape (covered by PR Execution graph substrate: SessionRelationshipRecord + ToolResultEventRecord (#42) #77 / Execution graph for passive readers: session relationships and tool-result event chronology #42).tool_result_events(waste detectors, subagent tree, etc.).Refs
burn archive(#40) #78 (Derived analytics archive: materialize the ledger into a local queryable store #40 follow-up)ToolResultEventRecordwriter path