Skip to main content

Module codex_compact

Module codex_compact 

Source
Expand description

/compact for a Codex pane.

A Codex pane runs one codex exec per turn, and exec can’t compact a thread. codex app-server can (thread/compact/start), and it reads the same threads from $CODEX_HOME. So a /compact sent to a Codex pane (the composer’s Compact button sends exactly that) starts no exec turn: srv runs a short-lived app-server with the turn’s own command, environment and working directory, resumes the thread, compacts it, and stops it.

The pane sees what it sees for Claude Code: compaction_started when it begins, then a compact_boundary frame in the stream (the context-compacted card, which also ends “Compacting…”), or Claude’s compaction-failed notice.

Verified against codex-cli 0.154.0 on 2026-10-22: a 12,595-token thread that codex exec made came back at 4,706 in about 2 s, and codex exec resume carried on from it, remembering the earlier turn.