Skip to content

Preserve evidence across primary agent compaction - #842

Open
TheGreatAxios wants to merge 9 commits into
mainfrom
cl-7521-preserve-compaction-evidence-with-fresh-working-context-and
Open

Preserve evidence across primary agent compaction#842
TheGreatAxios wants to merge 9 commits into
mainfrom
cl-7521-preserve-compaction-evidence-with-fresh-working-context-and

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Establish a repeated-compaction mechanics baseline for the primary agent.
  • Record three persisted folds with continuation and the evidence lost by the current implementation.
  • Target v0.3.19; production evidence archival, consolidated compaction, selector removal, and remaining continuity/evaluation work are still pending. This PR remains draft.

Verification

  • bun test ./evals/compaction/metrics.test.ts ./tests/integration/compaction-baseline.test.ts passes (exit 0; 9 tests, 47 assertions).
  • bun run typecheck and bun run check pass (exit 0) on baseline commit 189df620; independent Critic re-review is clean.
  • Verification applies to the baseline commit, not the unimplemented production changes.

Fixes CL-7521

@linear-code

linear-code Bot commented Sep 9, 2026

Copy link
Copy Markdown

CL-7521

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
TheGreatAxios marked this pull request as ready for review September 9, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant