Cmd. /compact
Summarize a long conversation to free context.
Key takeaways
/compactsummarizes the visible conversation so Codex keeps the critical points without overloading the context window.- Unlike
/clearor/new, it preserves the running task instead of resetting it. - Use it after a long investigation before implementation, or before handing a session to a teammate.
- Do not compact away unresolved blockers, IDs, test results, or acceptance criteria.
Original Command Declaration
/compactOfficial Summary
/compact summarizes the visible conversation so Codex can keep the critical points without
overloading the context window.
Usage
/compactGood Examples
- Compact after a long investigation before moving into implementation.
- Compact before handing a session to another teammate, then run
/status.
Similar Commands
| Command | Difference | Choose It When |
|---|---|---|
/compact | Summarizes long transcript context | The session is long but still useful |
/clear | Clears and starts a fresh chat | You want a true reset |
/new | Starts a new conversation | You want a new task in the same CLI |
Use Cases
- Keeping important assumptions, decisions, and next steps across a long run.
- Reducing context pressure before review or test work.
- Stabilizing handoff between planning and implementation.
Cautions
- Review the summary if the task contains subtle requirements.
- Do not compact away unresolved blockers, IDs, test results, or acceptance criteria.
Release Basis
- Judgment: confirmed addition
- First evidence version:
rust-v0.11.0 - Date (UTC): 2025-08-02
- Release link: https://github.com/openai/codex/releases/tag/rust-v0.11.0
Sources
- Codex slash commands: https://developers.openai.com/codex/cli/slash-commands
- Codex CLI features: https://developers.openai.com/codex/cli/features