Codex auto-compaction body_after_prefix scope
Parent: Mac local LLMs: Agent clients, context and compaction · Published reference · snapshot 2026-10-05
↓ Facts as markdownall context files
The Codex config reference lists `model_auto_compact_token_limit_scope` directly after `model_auto_compact_token_limit` with the values `total` and `body_after_prefix`.
These notes link each claim to its source. A source may be a research report hosted on this site rather than the primary document. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Facts
- The Codex config reference lists `model_auto_compact_token_limit_scope` directly after `model_auto_compact_token_limit` with the values `total` and `body_after_prefix`. [source]
- Codex exposes `compact_prompt` (an inline override of the history compaction prompt) and `experimental_compact_prompt_file` (the same override loaded from a file, marked experimental). [source]
- Codex's hook events include `PreCompact` and `PostCompact`, configured as matcher groups under `hooks.<Event>`. [source]
- Codex's `tool_output_token_limit` is the token budget for storing an individual tool or function output in history. [source]
- `model_catalog_json` is an optional path to a JSON model catalog loaded at startup, and a profile file can override it per profile. [source]
- Codex ships a built-in table of context windows, tool support and input modalities for OpenAI's own models; for any other slug it warns `Model metadata for <slug> not found. Defaulting to fallback metadata`, once per session. [source]
- Unsloth's fix for that warning is `model_context_window = 131072` in `~/.codex/config.toml` for a 128K model, and a custom `ModelInfo` entry in the file named by `model_catalog_json` to control tool support and input modalities. [source]
- A Codex remote-compaction call to an OpenAI model failed with `context_length_exceeded` ("Your input exceeds the context window of this model") in a long-running session, and the same session first showed a misleading "high demand" message on the older model. [source]
- Inferred: `body_after_prefix` helps a local server only if the prefix it excludes is stable across compactions, so the local KV cache for that prefix stays warm; the docs do not say whether that is the intent. [source]
- Inferred: for a local server with window W, setting `model_context_window` to W and `model_auto_compact_token_limit` below W minus the largest tool result is the same rule as for Claude Code, and the scope key changes only the quantity compared. [source]
Children
- No children recorded.