К основному содержанию
скилл CX Codex

codex-1m-context-window-setup — скилл для Codex: контекст

Скилл codex-1m-context-window-setup для Codex настраивает и проверяет окно контекста, включая автоуплотнение и расширение до 500K или 1M. Помогает диагностировать лимиты модели.

MIT 211 установок ★ 1 540 обновлён 2026-10-31

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add daymade/claude-code-skills --skill codex-1m-context-window-setup -a claude-code
Открыть на GitHub

Что делает codex-1m-context-window-setup

Скилл читает локальные настройки Codex, показывает размер окна и порог автоматического уплотнения. Он умеет менять только model_auto_compact_token_limit, а также проверять и применять модельный пресет для расширенного окна примерно с 258K до 500K или 1M.

Внутри есть скрипт scripts/codex_context_window.py с режимами show, set-compact, doctor, apply и verify. Для локального чтения нужен uv, а скрипт использует tomllib из Python 3.11+. Полное расширение требует доступных команд doctor --json, debug models и строгой проверки конфигурации Codex.

Без Python 3.11+ и uv запуск документированного сценария не состоится. Скилл не меняет выбранную модель и другие настройки Codex; существующая сессия после успешного расширения не увеличится сама.

Какие задачи решает

  • проверить текущий размер окна контекста Codex
  • снизить или задать порог автоуплотнения
  • диагностировать лимит выбранной модели
  • расширить окно до доступного модельного предела
  • проверить настройки после обновления Codex

Примеры запросов агенту

  • Покажи текущие настройки контекста Codex через show.
  • Проверь лимит модели и подготовь расширение окна через doctor.
  • Примени модельный пресет расширенного контекста через apply, затем проверь результат через verify.

Как установить codex-1m-context-window-setup

1Через Skills CLI (Vercel)

npx skills add daymade/claude-code-skills --skill codex-1m-context-window-setup -a claude-code

2Вручную: положить файлы

~/.claude/skills/codex-1m-context-window-setup/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/codex-1m-context-window-setup/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о codex-1m-context-window-setup

Как установить codex-1m-context-window-setup в Codex?

Выполните npx skills add daymade/claude-code-skills --skill codex-1m-context-window-setup -a codex, затем используйте файл .agents/skills/codex-1m-context-window-setup/SKILL.md.

Что делает codex-1m-context-window-setup?

Скилл читает настройки окна контекста Codex, меняет порог автоуплотнения и применяет модельный пресет расширения. Режимы doctor и verify помогают проверить лимиты и состояние конфигурации.

Что нужно для полного расширения окна Codex?

Нужны Python 3.11+, uv и команды Codex для doctor --json, debug models и строгой проверки конфигурации. Расширение строится по данным текущего каталога моделей.

Исходный текст

SKILL.md · MIT
---
name: codex-1m-context-window-setup
description: >-
  Configures and verifies an expanded, model-aware context window for OpenAI Codex CLI and Desktop.
  Use to inspect local context settings, lower or set the auto-compaction threshold, expand
  ~258K context to 500K or 1M, or repair model_context_window/model_auto_compact_token_limit.
  Not for changing the selected model or other Codex settings.
argument-hint: "[show|set-compact --tokens N|doctor|apply|verify]"
---

# Codex 1m Context Window Setup

Inspect local settings or change only automatic compaction. For full context
expansion, read Codex's current model catalog, cap the request at the model's
declared maximum, and apply the bundled expansion preset.

## Route the request

| User intent | Action |
|---|---|
| Read the current base-config window or compaction threshold | Run `show`; no Codex process or model catalog needed |
| Lower/set only automatic compaction | Run `show`, then `set-compact --tokens N` |
| Explain 258K, diagnose model limits, or preview full expansion | 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` |

Honor a user-specified threshold exactly. If the user only asks for a small
reduction, choose and state a modest reversible reduction from the observed value.
For expansion, derive attainable values from the live catalog instead of asking
the user for model limits. Running `apply` selects the full expansion preset and
replaces a custom threshold; do it only when full setup is requested.

For local reads/edits, start with the bundled commands. Do not dump config.toml,
load unrelated machine manuals, or run network/model diagnostics. Consult official
OpenAI documentation when parameter semantics or compatibility are unresolved;
it cannot establish this machine's current value. Respect host output restrictions;
if numeric output is denied, use its supported field-condition probe and keep an
unread value unknown. Do not reconstruct denied values through repeated comparisons.

## Prerequisites

Use Python 3.11+ for the script's `tomllib` dependency and uv for the documented
launcher. `show` needs no Codex executable. `set-compact` requires a Codex CLI
supporting `features list`; full expansion additionally requires `doctor --json`,
`debug models` and strict-config diagnostics. Missing expansion support does not
prevent a local read. Do not substitute another config root or guessed model data
when a required command is unavailable.

## Run the workflow

Run the bundled [configuration script](scripts/codex_context_window.py).

When this Skill loads, the host exposes its installed path. Resolve it explicitly:

- In Codex, take the directory containing `SKILL.md` from this Skill's `file:`
  entry in the current **Available skills** catalog.
- In Claude Code, use the **Base directory for this skill** shown by the Skill
  load result.

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:

```bash
SKILL_DIR="/absolute/path/from-the-loaded-skill-metadata"
```

On Windows PowerShell, use the same exposed directory with forward slashes:

```powershell
$SkillDir = "C:/absolute/path/from-the-loaded-skill-metadata"
```

Execute only the branch selected under **Route the request**. In the commands
below, PowerShell users substitute `$SkillDir` for `$SKILL_DIR`.

### `show` and `set-compact`

Use the same resolved script path on either platform:

```bash
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" show --json
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" set-compact --tokens 400000 --json
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" show --json
```

Choose `--tokens` from the current request, not this example. `show` emits only
the numeric settings, the config path and evidence status; a missing value is null,
not a guessed default.
It does not inspect profile or command-line overrides.

`set-compact` preserves the context-window setting, profiles, comments and existing
formatting; inserting a missing key may add a separating newline. It rejects
nonpositive/out-of-range tokens and thresholds
above an explicitly configured window. When the window is absent, leave it absent;
model-derived runtime caps remain unverified. Before a changed write, back up the
original and check for concurrent edits. Write atomically, run the local
`codex features list` configuration-load check with captured output, and read back
the target. Restore the original on validation failure unless a concurrent edit
makes that unsafe. A no-op creates no backup. Do not echo diagnostic bodies that
may contain unrelated configuration. Use `show` afterward as independent readback.

### `doctor`

Run first for full expansion or model-cap diagnosis:

```bash
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" doctor --json
```

It is read-only and reports:

- selected model resolved by Codex;
- catalog default, model maximum, and usable percentage;
- recommended raw window, usable window, and preset compaction point;
- current base-config values and whether `apply` is needed;
- exact `$CODEX_HOME/config.toml` target.

If Codex cannot return a live model catalog, stop the expansion path. Do not
substitute remembered model limits, API marketing numbers, or a bundled default.
Local `show`/`set-compact` remain independent of catalog availability.

### `apply`

Run only after `doctor` succeeds:

```bash
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" apply --json
```

The script:

1. Re-reads the live model contract.
2. Changes only the top-level `model_context_window` and
   `model_auto_compact_token_limit` keys.
3. Creates a content-addressed backup only when bytes will change.
4. Uses an atomic same-directory replace and refuses to overwrite a concurrently
   changed config.
5. Runs Codex strict-config diagnostics; a failure restores the exact prior bytes.
6. Reads the written file back and reports the values that future sessions will use.

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.

### `verify`

Run 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
expansion preset. A deliberate custom threshold can differ from that preset; this
is not proof that the saved threshold is invalid. Use `show` for its current base value.

```bash
uv run --no-project python "$SKILL_DIR/scripts/codex_context_window.py" verify --json
```

## Report the outcome

For a threshold-only change, report previous → saved tokens, backup path when
changed, local configuration-load result and independent readback. Keep
`session_adoption: unverified` until the actual consumer supplies evidence. Ask
the user to start a new CLI thread or restart/open a new Desktop thread that reads
this base config; do not claim the running thread changed. Profile and `-c`
overrides can still supersede it.

For expansion, copy exact values from script output. Include:

- model slug;
- configured raw window;
- usable window shown to the session;
- automatic compaction threshold;
- whether the model capped the 1M request;
- config and backup paths;
- `restart_required: true` after a changed apply.

## Refuse scope expansion

This Skill does not:

- change the selected model, reasoning effort, service tier, sandbox, approvals,
  plugins, MCP servers, browser/computer-use settings, or shell aliases;
- edit profile-specific config files or override per-command `-c` flags;
- claim the current running thread was expanded;
- force 1M when the selected model declares a smaller maximum;
- fall back to stale or guessed model metadata.

Read [references/context_window_contract.md](references/context_window_contract.md)
when diagnosing model caps, usable-window display, or compaction semantics.

© daymade · MIT · daymade/claude-code-skills

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
context-window-management sickn33 Скилл context-window-management для Claude Code считает, сокращает и распределяет контекст LLM. Управляет историей многошаговых диалогов, когда она мешает запросу. CX Codex +1 1 600установок context-budget affaan-m Скилл context-budget для Claude Code, Codex, Cursor и других платформ, который показывает текущее использование контекста и оставшуюся ёмкость через встроенные команды поставщика. CX Codex +1 7 000установок conductor-setup biw Скилл conductor-setup приводит репозиторий в порядок для Conductor: правит .conductor/settings.toml, переносит старый conductor.json, раскладывает скрипты и переменные окружения. CX Codex +1 1 200установок context-compression muratcankoylan Скилл context-compression учит агента сворачивать историю долгой сессии в структурную сводку: что делали, какие файлы правили, какие решения приняли и что дальше. CX Codex +1 669установок context-surfing pskoett Скилл context-surfing следит за деградацией контекста в длинных сессиях, фиксирует внешние якоря и корректно передаёт состояние новому запуску. CX Codex +1 272установок context-engineering Rohit Ghumare Скилл context-engineering задаёт правила управления контекстом в Claude Code через четыре операции: запись, выборку, сжатие и изоляцию рабочих сессий. CX Codex +1 ★ 2 966звёзд репо

Из того же набора102

Весь набор →
read-codex-history Скилл read-codex-history для Codex, Claude Code, Cursor, GitHub Copilot и Gemini CLI, который читает, ищет и экспортирует локальную историю сессий OpenAI Codex без возобновления работы. CX Codex +1 221установок prior-work-retrieval Скилл prior-work-retrieval для Claude Code находит и проверяет уже существующие наработки в проекте до написания нового кода. Запускается по прямому запросу о повторном использовании. CX Codex +1 218установок continue-claude-code-work Скилл continue-claude-code-work возвращает прерванную работу Claude Code по истории сессии: восстанавливает цель, незавершённые запросы и следующий шаг. CX Codex +1 216установок interaction-design-board Скилл interaction-design-board собирает несколько кликабельных HTML-прототипов одного интерфейса в Design Board, где можно выбрать вариант или попросить ремикс до того, как агент изменит продакшен-код. CX Codex +1 213установок lark-cli-router Скилл lark-cli-router маршрутизирует задачи для Feishu, Lark и Doubao через встроенные руководства утилиты lark-cli. Помогает безопасно вызывать API документов, встреч, задач и чатов. CX Codex +1 210установок excalidraw-use Скилл excalidraw-use раскладывает готовые картинки по сцене Excalidraw ровной сеткой, снимает слайды Vite-деки в отдельные изображения и читает .excalidraw на битые картинки. CX Codex +1 187установок meme-creator Скилл meme-creator для Claude Code накладывает логотипы, аватары и стикеры на движущиеся объекты в видео и сохраняет результат в MP4 и GIF. Создаёт мемы и реакции из видеоклипов. CX Codex +1 174установок agent-web-search-setup Скилл agent-web-search-setup для Claude Code и других платформ диагностирует и чинит веб-поиск на моделях через прокси и реселлеров. CX Codex +1 162установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой