What problem does it solve?
Codex sessions often run with a default ~258K context window, causing frequent auto-compaction and lost context on long tasks. Manually editing config.toml risks guessing wrong token limits, breaking TOML syntax, or overwriting unrelated settings.
Core Features & Use Cases
- Model-aware configuration: Reads the live Codex model catalog via
codex doctor and codex debug models, then caps the requested 1M window at the selected model's declared maximum instead of guessing.
- Safe config editing: Changes only
model_context_window and model_auto_compact_token_limit (set to 60% of the window), preserves all other TOML content, creates content-addressed backups, and rolls back on validation failure.
- Three-mode workflow:
doctor inspects and reports, apply writes the change atomically, and verify confirms the config still matches the recommendation after upgrades.
- Use Case: A team notices Codex compacting conversations too aggressively on long refactoring sessions. Run the doctor/apply/verify workflow to raise the context window to the model's maximum (up to 1M tokens) across macOS and Windows workstations.
Quick Start
Ask the assistant to run the codex context window doctor command to inspect the current limit, then apply the recommended model-aware configuration.