Preserve evidence across primary agent compaction - #842
Open
TheGreatAxios wants to merge 9 commits into
Open
Conversation
Capture the post-policy representation that enters primary history — messages, tool args lifecycle, assistant text, structured/error results, MCP blocks, and attachment/overflow blob provenance — into a session-owned evidence archive with completeness certificates. Workers omit the hook.
Workers omit the holder, so assemble keeps plain storage and skips admission and authorize recording wraps.
Context store blob keys cannot contain slashes, so archive occurrences failed to persist. Hash overflow blobs after scrub and admit string send the same way as inbound messages.
Persist blobs and stage writeTurns first. Replace reactor memory only after commit so an interrupt resumes the old generation.
A failed compact commit must not later replaceTurns stale output, and an unpublished rewrite stays off the live generation until git commit succeeds.
Dedicated archive tools made the on-disk dump the implied retrieval API. Primary sessions now search and read archive:/// through search_files, grep, and read_file. Blob keys reject slash so they cannot nest under tool-output.
Failed summaries used to write a stats stub into history, and later folds stacked frozen prefixes. The primary session now keeps the prior context on summary failure and replaces the dropped prefix with a single archive-backed handoff.
TheGreatAxios
marked this pull request as ready for review
September 9, 2026 20:40
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.
Summary
Verification
bun test ./evals/compaction/metrics.test.ts ./tests/integration/compaction-baseline.test.tspasses (exit 0; 9 tests, 47 assertions).bun run typecheckandbun run checkpass (exit 0) on baseline commit189df620; independent Critic re-review is clean.Fixes CL-7521