Configures and verifies an expanded, model-aware context window for OpenAI Codex CLI and Desktop. Use when Codex shows ~258K context, you want 500K or 1M tokens, auto-compaction fires too often, or model_context_window/model_auto_compact_token_limit needs repair. Not for changing the selected model or other Codex settings.
73
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Expand future Codex sessions without pretending every model supports one million tokens. The bundled script reads Codex's current model catalog, caps the request at the selected model's declared maximum, and applies the user's established 60% auto-compaction policy.
| User intent | Action |
|---|---|
| Inspect the current limit, explain 258K, or preview the recommendation | Run doctor |
| Configure/fix/raise the context window | Run apply |
| Confirm a prior setup is still correct after an update or model switch | Run verify |
Do not ask the user for raw token numbers. The model catalog is the authority and the script derives the attainable values.
When this Skill loads, the host exposes its installed path. Resolve it explicitly:
SKILL.md from this Skill's file:
entry in the current Available skills catalog.Do not search a home directory for another copy. If the host did not expose an
installed path, stop with installed Skill path not exposed rather than guessing.
On macOS/Linux, set that exact directory and run:
SKILL_DIR="/absolute/path/from-the-loaded-skill-metadata"
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" doctor
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" apply
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" verifyOn Windows PowerShell, use the same exposed directory with forward slashes:
$SkillDir = "C:/absolute/path/from-the-loaded-skill-metadata"
uv run --no-project python "$SkillDir/scripts/codex_context_window.py" doctor
uv run --no-project python "$SkillDir/scripts/codex_context_window.py" apply
uv run --no-project python "$SkillDir/scripts/codex_context_window.py" verifydoctorRun first. It is read-only and reports:
apply is needed;$CODEX_HOME/config.toml target.If Codex cannot return a live model catalog, stop. Do not substitute remembered model limits, API marketing numbers, or a bundled default.
applyRun only after doctor succeeds. The script:
model_context_window and
model_auto_compact_token_limit keys.Existing sessions do not grow in place. After success, tell the user to start a new CLI thread or restart/open a new Codex Desktop thread.
verifyRun after Codex upgrades, default-model changes, or on a newly configured machine. It exits non-zero when the current base config no longer equals the model-aware recommendation. Report the mismatch; do not call it configured.
Copy exact values from script output. Include:
restart_required: true after a changed apply.This Skill does not:
-c flags;Read references/context_window_contract.md when diagnosing model caps, the 95% usable-window display, or compaction semantics.
daymade/claude-code-skills
f2637d9
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.