DEV Community

hao li
hao li

Posted on

session-handover v0.5: a cross-harness compaction semantics matrix (Claude Code, Codex, Gemini, Aider, OpenCode, Copilot CLI, Cursor, Cline)

v0.5 of session-handover (PyPI) widens the compaction audit from Claude Code to every harness I hand sessions to.

pip install session-handover, then:

session-handover compact-matrix
Enter fullscreen mode Exit fullscreen mode

It prints a cross-harness comparison: what triggers compaction, what mechanism it uses, what survives, what gets dropped, and — the part I actually use — the durable anchor where state should be pinned before compaction happens.

Why

v0.2 audited what Claude Code's /compact dropped by diffing durable items against the replacement summary. But I bounce between tools, and every harness compacts differently. The same session handed to a different tool loses different things:

  • Claude Code — project-root CLAUDE.md is re-injected from disk (8 of 8 measured compactions in rulestack's study); path-scoped rules and nested CLAUDE.md are lost until a matching file is read again; invoked skill bodies came back 6 of 8 times, with the stale text after an edit.
  • Codex CLI — remote v2 compaction returns an encrypted blob plus retained user messages; the local fallback drops all assistant messages and the summary becomes a "CONTEXT CHECKPOINT" user message. Reasoning items are filtered before summarization; the compaction prompt is configurable since v0.50.
  • Gemini CLI (/compress), Aider, OpenCode, Copilot CLI (/compact, auto at ~95%), Cursor, Cline — documented with their anchors (GEMINI.md, committed files, AGENTS.md, copilot-instructions.md, .cursor/rules, .clinerules).

Full report: session-handover compact-matrix --out MATRIX.md. Pairwise diff: --compare claude-code codex-cli. Single harness: --harness codex-cli.

Also in v0.5: Codex /compact audit is real now

audit-compact used to detect Codex compactions with bare marker strings. It now recognizes the actual checkpoint shapes: the remote v1 **CONTEXT CHECKPOINT** assistant message, the local fallback "another language model started to solve this problem…" prefix, and type=compaction response items. A lone /compact command line is the trigger, not the replacement — it no longer fabricates a boundary by itself.

Same boundaries as always

Still stdlib-only, no dependencies. The audit never blocks (exit 0; --fail-on-drop for CI). Extraction is a heuristic recall floor and matching is token overlap, not semantic — entries marked "community" in the matrix are widely reported but not formally verified. Verify before trusting.

18 new tests, all green. Differentiation, as before: I'm a cross-tool handover author, not a spec-first workflow — SpecWeave does the heavy process side; this stays a lightweight CLI on the compaction-diff boundary.

Top comments (0)