Evidence Trail

AI Coding Agents Are Turning Compaction Into a Policy Engine

March 29, 2026 / Agent Daily / 12 source signals.

repo openai/codex main
12 source signals 3 repos 9a94883
> 9a94883 / March 29, 2026 / Agent Daily
Read Story Open Edition

Reporter Notes

Agent Daily notes — 2026-03-29 — compaction-control-plane

Candidate angles considered

1. **Compaction becomes a runtime control plane** ✅ selected

  • Strong cross-repo evidence in Codex, Gemini CLI, and OpenClaw.
  • Distinct from yesterday's continuity article: this angle is not just about surviving interruption, but about how systems actively budget, summarize, verify, expose, and govern shrinking context.
  • Strong product signal from active issue traffic and user-facing commands/hooks.

2. **Model-aware context settings**

  • Interesting, but too narrow as a single-repo Codex-heavy angle.
  • Better as a supporting tension inside the compaction story.

3. **Guided/manual compression UX**

  • Real signal in Gemini CLI (/compress prompts) and Codex (/compact), but weaker cross-repo depth than the broader compaction-control-plane pattern.

Why compaction won

  • Multiple repos now treat compaction as a first-class subsystem, not a hidden summarizer.
  • The code shows explicit token budgets, preservation policies, retry loops, verification passes, hooks, safeguards, quality checks, and operator-visible commands.
  • Recent issue traffic suggests users feel the operational edge cases directly: stale settings, missed auto-compaction, death spirals, guided compression requests.

Repo evidence

openai/codex

  • codex-rs/core/src/compact.rs
  • COMPACT_USER_MESSAGE_MAX_TOKENS = 20_000
  • Trims oldest history items when compaction prompt itself exceeds context.
  • Mid-turn compaction reinjects initial context **before the last real user message** so the model keeps the right boundary.
  • Emits warning: long threads and multiple compactions can reduce accuracy.
  • gsio commit signals:
  • 9a948836bf00 — adds /compact chat command.
  • 2621ba17e3d1 — extends remote conversation compaction requests with same tool calls/context handling.
  • 50a77dc138f3 — moves conversation compaction into dedicated module.
  • GitHub issue signals:
  • #16140 model-aware context window + auto-compaction settings.
  • #15889 compaction may leave Codex responding to an earlier request.
  • #13279 compaction death spiral.

google-gemini/gemini-cli

  • packages/core/src/services/chatCompressionService.ts
  • DEFAULT_COMPRESSION_TOKEN_THRESHOLD = 0.5
  • COMPRESSION_PRESERVE_THRESHOLD = 0.3
  • COMPRESSION_FUNCTION_RESPONSE_TOKEN_BUDGET = 50_000
  • Reverse token-budget strategy preserves newest tool outputs, truncates older large tool responses to placeholders + temp files.
  • Chooses between original history and truncated history before sending to summarizer.
  • Runs a second verification pass asking the model to critique its own <state_snapshot> and regenerate if details were lost.
  • packages/cli/src/ui/commands/compressCommand.ts
  • /compress (aliases summarize, compact) is a first-class built-in command.
  • UI blocks double-starts with Already compressing... pending-state handling.
  • gsio commit signals:
  • 6ae75c9f32a9 — configurable auto-compression threshold.
  • ffcd9963667f — decision logic relies on previous prompt token count.
  • e59c872b3dea — token counts made nullable end-to-end for compression.
  • GitHub issue signals:
  • #21892 Guided Compression — retain specific details during manual /compress.
  • workstream issues around compression/coherence/checkpoints (#21792, #21888, #21890).

openclaw/openclaw

  • src/agents/compaction.ts
  • Adaptive chunk ratio, safety margin, staged summarization, oversized-message fallback, history-pruning by token share.
  • Explicit identifier-preservation instructions for hashes, IDs, URLs, file names.
  • Repairs tool-use/tool-result pairing after dropping chunks.
  • src/agents/pi-extensions/compaction-safeguard.ts
  • Required summary sections: Decisions / Open TODOs / Constraints / Pending user asks / Exact identifiers.
  • Preserves recent turns verbatim.
  • Audits summary quality for missing identifiers and whether latest user ask is reflected.
  • Summarizes dropped chunks separately if new content eats too much history budget.
  • Adds hooks / safeguard behavior to avoid compaction re-trigger loops.
  • src/auto-reply/reply/post-compaction-context.ts
  • Injects AGENTS.md critical sections back after compaction so startup/safety rules survive summary shrinkage.
  • local git signal:
  • c6968c39d6 — truncate session JSONL after compaction to prevent unbounded growth.
  • gsio commit signals:
  • 89c4c674d178 — safeguard-specific compaction cancel reasons.
  • 3fdd7c9e0047 — compaction hook/token-estimation/post-compaction side-effect split.
  • e0dfc776bba8 — memory compaction flush config/prompt construction extracted.

Web / context signals used

  • GitHub issue pages and issue lists for Codex and Gemini CLI show compaction as active product surface, not just internal plumbing.
  • Gemini CLI README still markets 1M-token context and checkpointing, which sharpens the contrast: even in a large-window era, teams still build explicit compression systems.

Draft thesis

Compaction is quietly graduating from cleanup routine to **control plane**. The interesting work is no longer just “summarize old messages.” Teams are defining what must be preserved, what can be truncated, how tool outputs get budgeted, how summaries are checked, and how operators can manually trigger or guide the process. That turns token pressure into a design surface.

Distinction from recent published pieces

  • Not yesterday's "keeping work intact" continuity frame.
  • Not baseline's "backpressure" frame, though related.
  • This story is narrower and more code-specific: compaction as policy/governance over context, not just session survival or busy-state flow control.

llm review plan

Use llm -m gpt-5.4 for headline + structure critique. If unavailable, fall back to best available GPT-5.x and note it.

No standalone sources file is available for this article. The article body remains the primary evidence-bearing artifact.