跳到主要内容
知仓学习社ZHICANG

codex-1m-context-window-setup

>-

读凭据执行命令严重 0 · 高危 13daymade/claude-code-skills

它会碰到什么

扫了多少4 个文本文件,37 KB
它会碰到什么读凭据执行命令
命中总数13 处
命中统计严重 0 · 高 13 · 中 0 · 低 0
逐条看命中(13 条严重或高危)
  • scripts/codex_context_window.py:69cred-envread
    configured = os.environ.get("CODEX_HOME")
  • scripts/codex_context_window.py:79exec-spawn
    result = subprocess.run(
  • tests/test_codex_context_window.py:25cred-envread
    model = os.environ.get("FAKE_CATALOG_MODEL", "gpt-5.6-sol")
  • tests/test_codex_context_window.py:28cred-envread
    "context_window": int(os.environ.get("FAKE_CONTEXT", "272000")),
  • tests/test_codex_context_window.py:29cred-envread
    "max_context_window": int(os.environ.get("FAKE_MAX", "872000")),
  • tests/test_codex_context_window.py:30cred-envread
    "effective_context_window_percent": int(os.environ.get("FAKE_PERCENT", "95")),
  • tests/test_codex_context_window.py:35cred-envread
    if "--strict-config" in args and os.environ.get("FAKE_STRICT_FAIL") == "1":
  • tests/test_codex_context_window.py:40cred-envread
    "details": {"model": os.environ.get("FAKE_SELECTED_MODEL", "gpt-5.6-sol")},
  • tests/test_codex_context_window.py:67cred-envread
    env["CODEX_HOME"] = str(self.home)
  • tests/test_codex_context_window.py:68cred-envread
    env["HOME"] = str(self.os_home)
  • tests/test_codex_context_window.py:69cred-envread
    env["USERPROFILE"] = str(self.os_home)
  • tests/test_codex_context_window.py:70exec-spawn
    return subprocess.run(
  • tests/test_codex_context_window.py:148exec-spawn
    result = subprocess.run(

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Codex 1m Context Window Setup

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.

Route the request

| 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.

Run the workflow

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 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" verify

On 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" verify

doctor

Run first. It is read-only and reports:

  • selected model resolved by Codex;
  • catalog default, model maximum, and usable percentage;
  • requested raw window (up to 1,000,000), usable window, and 60% 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. Do not substitute remembered

model limits, API marketing numbers, or a bundled default.

apply

Run only after doctor succeeds. 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.

  1. Creates a content-addressed backup only when bytes will change.
  2. Uses an atomic same-directory replace and refuses to overwrite a concurrently

changed config.

  1. Runs Codex strict-config diagnostics; a failure restores the exact prior bytes.
  2. 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

recommendation. Report the mismatch; do not call it configured.

Report the outcome

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, the 95% usable-window display, or compaction semantics.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。