codex-1m-context-window-setup
An agent skill by daymade, from daymade/claude-code-skills. Tags: cli, cloud, performance, setup, validation.
What it does
Configures and verifies an expanded, model-aware context window for OpenAI Codex CLI and Codex Desktop by safely updating the shared base config. Use whenever Codex shows about 258K context, the user asks for 500K or 1M context, auto-compaction happens too often, model_context_window or model_auto_compact_token_limit needs repair, or a workstation/classroom needs the same long-context setup across macOS and Windows. Detects the selected model's live maximum, requests up to 1M tokens, sets compaction to 60% of the attainable window, preserves unrelated TOML, backs up changes, and fails rather than guessing when the model contract cannot be verified.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add daymade/claude-code-skills --skill codex-1m-context-window-setup
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/daymade/claude-code-skills
cp -r claude-code-skills/daymade-codex/codex-1m-context-window-setup ~/.claude/skills/codex-1m-context-window-setup
Safety box score
Grade B, low risk: 23 of 100 risk points, rated 2026-10-16. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill uses the installed `codex` CLI to read the live model catalog and then edits the user's base Codex config at `CODEX_HOME/config.toml`, with backups written under `CODEX_HOME/backups/...`. The main risks are local command execution and modifying user-level configuration; it does not attempt sudo, system-wide installs, or secret harvesting.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | `scripts/codex_context_window.py` shells out to the local `codex` binary with `subprocess.run` for `doctor`, `debug models`, and `--strict-config doctor`, so installing the skill grants local command execution of whatever `codex` executable is present. |
| Network access | 1 (low) | The workflow depends on a live model catalog (`codex debug models`) and Codex diagnostics (`codex doctor --json`), so it can reach Codex services using the user's existing CLI identity, but it does not fetch arbitrary URLs or send data to third-party hosts. |
| Filesystem reach | 2 (moderate) | `apply` reads and writes the base `$CODEX_HOME/config.toml` and creates timestamped backups under `$CODEX_HOME/backups/codex-1m-context-window-setup/`, which changes user-level files outside the repository. |
| Secrets & credentials | 0 (none) | The shipped files do not read `.env`, keychains, browser sessions, or token stores; they only ask Codex for model metadata and config status. |
| Privilege & persistence | 0 (none) | There is no `sudo`, global package install, service registration, shell-startup editing, or OS-level setting change in the skill. |
| Instruction hijack surface | 1 (low) | `SKILL.md` directs the agent to "Do not ask the user for raw token numbers" and to stop if the installed path is not exposed; this is a strong behavior constraint, but it is not a hidden prompt or an external instruction fetch. |
| Irreversible actions | 0 (none) | The skill only configures local Codex settings and reports results; it does not send messages, deploy, pay, book, or delete external resources. |
| Transparency | 0 (none) | All shipped files are plain-text Markdown and Python; there are no binaries, minified blobs, or runtime-downloaded code. |
Before installing
- Read `scripts/codex_context_window.py` to confirm you are comfortable with it invoking `codex doctor`, `codex debug models`, and `codex --strict-config doctor`.
- Check whether you want it to modify `CODEX_HOME/config.toml` and create backups under `CODEX_HOME/backups/codex-1m-context-window-setup/`.
- If you want to avoid touching your real config first, run `doctor` with a scratch `CODEX_HOME` and a test `codex` binary.
- Verify that your environment can already run `codex debug models` with your normal login, since the skill relies on live model metadata.
Rated 2026-10-16 by an automated review of 4 files from the skill's repository.
Source
- Repository
- daymade/claude-code-skills (all skills from this repository)
- Path
- daymade-codex/codex-1m-context-window-setup/SKILL.md
- Branch
- main
- Updated
- 2026-09-20
Related skills
- signing-in-to-aws — Gets AWS credentials for CLI/SDK access via `aws login`.
- claude-switch-models-setup — Set up and maintain multiple isolated Claude Code CLI profiles so students and power users can run different LLM providers (Kimi K3, Kimi K2.7 highspeed.
- agents-get-started — Use when a developer wants to create a new agent project or get started with AgentCore.
- agents-harden — Use when preparing your agent for production — IAM scoping, inbound auth (JWT, SigV4), secrets management, cold start optimization, session lifecycle.
- agents-pay — Use when THIS agent needs to pay for x402-protected content at runtime: hitting a paywall mid-task, settling it via AgentCore Payments.
- aws-billing-and-cost-management — Analyze AWS costs, find savings, manage budgets, evaluate Savings Plans and Reserved Instances, right-size EC2/Lambda/RDS/EBS with Compute Optimizer.