Resolves the open question in #2
CLAUDE_CODE_MAX_CONTEXT_TOKENS is real — but it is conditionally honored, which is why it never appeared in the official env-vars reference.
Verified against the shipping binary, ~/.local/share/claude/versions/2.1.216 — not against docs, and not against the leaked v2.1.88 source (see #17 for why that distinction matters).
The two read sites
function a9c(){ // path A
if(Z.DISABLE_COMPACT){ // ← only when DISABLE_COMPACT is set
let e=Z.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
if(e!==void 0&&e>0)return e
}
return
}
function l9c(e,t){ // path B — default resolver
if(Tb(e))return 1e6; // model id matches /\[1m\]/i
if(t?.includes(Ege.header)&&RG(e))return 1e6; // context-1m-2025-08-07 beta
if(eM(e))return 1e6; // native_1m, first-party gated
let r=b7n(e); if(r!==null)return r;
let n=Z.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
if(n!==void 0&&n>0&&!po(mi(e)).startsWith("claude-"))return n; // ← non-"claude-*" ONLY
return EYt // EYt = 200000
}
Constants: EYt = 200000, qtg = 1e6 (cap).
What this means for us
| Model ID |
DISABLE_COMPACT |
Effect |
glm-5.2, qwen-…, openrouter/… |
unset |
Honored — doesn't start with claude- |
claude-opus-4.8 |
unset |
Silent no-op — exactly the failure mode #2 warned about |
| anything |
set |
Honored via path A |
Since cuckoocode's third-party presets use non-claude-* model IDs, this variable does work for our primary use case. It is not a no-op for us.
Note Tb(e) — a [1m] suffix returns 1e6 directly, confirming the mechanism in #14 independently of this variable.
Acceptance criteria
Conflict note
#2 currently instructs implementers to omit this variable unless confirmed. That guidance was correct when written and is now superseded. Anything already built under the old guidance is conservative rather than wrong — it just leaves the fix incomplete.
Resolves the open question in #2
CLAUDE_CODE_MAX_CONTEXT_TOKENSis real — but it is conditionally honored, which is why it never appeared in the official env-vars reference.Verified against the shipping binary,
~/.local/share/claude/versions/2.1.216— not against docs, and not against the leaked v2.1.88 source (see #17 for why that distinction matters).The two read sites
Constants:
EYt = 200000,qtg = 1e6(cap).What this means for us
DISABLE_COMPACTglm-5.2,qwen-…,openrouter/…claude-claude-opus-4.8Since cuckoocode's third-party presets use non-
claude-*model IDs, this variable does work for our primary use case. It is not a no-op for us.Note
Tb(e)— a[1m]suffix returns 1e6 directly, confirming the mechanism in #14 independently of this variable.Acceptance criteria
CLAUDE_CODE_MAX_CONTEXT_TOKENSonly when the configured model ID does not start withclaude-context_length, capped at 1e6[1m]suffix (BUG: z.ai preset silently runs at 200K context instead of 1M #14), never insteadclaude-*id (must not be set) and aglm-*id (must be set)Conflict note
#2 currently instructs implementers to omit this variable unless confirmed. That guidance was correct when written and is now superseded. Anything already built under the old guidance is conservative rather than wrong — it just leaves the fix incomplete.