Repository navigation
Compact external agents' transcripts with their own compactor - #2804
Conversation
The checkpoint writer built transcript.jsonl with the built-in compactor, which only understands built-in agents' native formats. For an external agent such as Grok Build it wrote lines with no content, so readers of transcript.jsonl showed an empty session. When the session's agent declares compact_transcript, run its compact-transcript on the already-redacted transcript (through a private temp file), redact the output again, and scope the checkpoint by compacting the lines before checkpoint_transcript_start. Fall back to the built-in compactor when the agent errors, returns nothing, or returns assets, so the compact transcript never costs a checkpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M52YQ8EMXKYHAT0Z6WPJ3AM7
There was a problem hiding this comment.
🟡 Changes recommended
Boundary calculation can omit checkpoint content, and plugin error logging can expose sensitive data.
2 open findings
What changed in this PR
Enables checkpoint storage to use external agents’ own compactors so their conversations appear in transcript.jsonl.
Changes:
- Adds agent compaction with output redaction and built-in fallback.
- Adds tests for scoping, failures, assets, and credential redaction.
- Documents the compaction protocol and persistence behavior.
| File | Description |
|---|---|
| docs/development/checkpoint-implementation.md | Documents agent compaction and fallbacks. |
| docs/architecture/external-agent-protocol.md | Defines the compaction capability and command. |
| cmd/entire/cli/checkpoint/persistent.go | Tries agent compaction before built-in conversion. |
| cmd/entire/cli/checkpoint/persistent_external_compact_test.go | Tests external compaction and safeguards. |
| cmd/entire/cli/checkpoint/compact_agent.go | Implements compaction, redaction, and boundary calculation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1bc3daa. Configure here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M535P318G8BJPP2CP9ZDHCMT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M536YSTYV0VPBW1J0QH5A2AT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M538G4ZSJ7F9E6FHCA179RRQ
… cap, keep stderr out of logs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5AN3JQTX78K094KHFRZWKEZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-compact-transcript # Conflicts: # docs/development/checkpoint-implementation.md



https://entire.io/gh/entireio/cli/trails/1600
Problem
For external agents, a checkpoint's
transcript.jsonl(Entire's shared transcript format) is built by the CLI's built-in compactor, which only understands built-in agents' native formats. For agents like Grok Build (entire-agent-grok) it writes empty lines (four blank user entries for a full session), so nothing downstream can show the conversation. The agent's owncompact-transcriptcommand, which does understand its format, was only used byentire explain.Fix
When the session's agent declares
compact_transcript,writeCompactTranscript(cmd/entire/cli/checkpoint/persistent.go, newcompact_agent.go) buildstranscript.jsonlwith the agent's compactor:compact_transcript_startis the number of leading lines that compacting the lines beforecheckpoint_transcript_startshares byte-for-byte with the full output, so a line the plugin merges across the boundary (e.g. Grok folding a tool_result into its call) stays in this checkpointcompact-transcriptstdout up to the base64 size of the 50 MB compact blob cap (other subcommands keep 10 MB), so large sessions don't fall back to a blank transcriptDocs:
compact_transcript/compact-transcriptadded toexternal-agent-protocol.md(it was undocumented);checkpoint-implementation.mddescribes the agent path and fallbacks.+524/-8 across 8 files (the protocol doc now also says
compact-transcriptmay receive a CLI temp file outside the agent's session store).Verification
persistent_external_compact_test.gowith a mock external agent: agent compactor used with correct scoping; a plugin that merges lines across the boundary keeps the merged line in scope; a hung plugin times out and falls back; each run gets its own timeout; plugin stderr stays out of errors; fallback on compactor failure, empty output and returned assets; prefix-compaction failure keeps the agent's transcript and scopes from line 0; credential in agent output redacted before storing; unit tests forleadingLines/countLines. The scoping and redaction tests failed before the change.store.Writewith the realentire-agent-grok:transcript.jsonlwent from 4 blank lines to 53 lines including the prompt.transcript.jsonl, the session page shows the prompt, responses and tool calls.compact_transcript, using each agent's sample transcripts and the real binaries throughcompactWithAgent: the agent compactor was never worse. Built-in output was empty or blank for Goose, Kilo, Kiro, Amp (legacy export) and Grok Build; Oh My Pi and Qwen gain tool calls; Amp (current format) is unchanged; Hermes's compactor rejects the temp path and falls back to the built-in result (same as today). 4–76 ms per checkpoint.mise run lint: 0 issues.mise run test:cipasses (run with~/.local/binoffPATH, since a realentire-agent-*there leaks into setup tests).Fixes the bug in trail https://entire.io/gh/entireio/cli/trails/1608. Pairs with entire-api trail https://entire.io/et/entirehq/entire-api/trails/400, which reads
transcript.jsonlfor agents it has no parser for. Checkpoints written before this fix keep their emptytranscript.jsonl.🤖 Generated with Claude Code