System prompt does NOT survive compaction

Open 💬 2 comments Opened Apr 23, 2026 by Morriz

What version of Codex CLI is running?

0.122.0

What subscription do you have?

pro max

Which model were you using?

gpt-5.4

What platform is your computer?

Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

iTerm2

What issue are you seeing?

System prompt does NOT survive compaction, so whatever we put in ~/.codex/CODEX.md is only known to it before compaction, and lost afterwards.

What steps can reproduce the bug?

  1. Give it a list of commands you want it to know about.
  2. Ask it if it knows one or all
  3. Work and await compaction
  4. Ask it again

What is the expected behavior?

System prompt to be preserved verbatim and not even be part of compaction.

Additional information

To no avail, we also tried markers around our system prompt (using experimental_compact_prompt_file ="$HOME/.codex/CODEX.compaction.md") with these instructions:

You are performing a CONTEXT CHECKPOINT COMPACTION. Create a handoff summary for another LLM that will resume the task.

Include:

  • Current progress and key decisions made
  • Important context, constraints, or user preferences
  • What remains to be done (clear next steps)
  • Any critical data, examples, or references needed to continue

Be concise, structured, and focused on helping the next LLM seamlessly continue the work.

When compacting context, preserve verbatim every byte between
<!-- CONTEXT_PRESERVATION_START --> and
<!-- CONTEXT_PRESERVATION_END -->.

Keep the markers themselves. Do not summarize, normalize, reformat, reorder, or
delete any enclosed content. Copy it forward exactly as-is across every
compaction cycle before the compaction output. This ensures that all critical information is retained

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗