Skip to content

Context window size ignores CLAUDE_CODE_DISABLE_1M_CONTEXT env var #28

@duarbdhks

Description

@duarbdhks

Description

The webview displays context window size as 1000k for Opus 4.6 and Sonnet 4.6 models, but does not respect the CLAUDE_CODE_DISABLE_1M_CONTEXT=1 environment variable which limits the actual context window to 200k.

Current Behavior

In dist/webview/index.js, the context window size is hardcoded per model:

// Hardcoded model → context window mapping
{ "opus-4-6": 1e6, "sonnet-4-6": 1e6 }
S = 2e5   // 200k fallback
C = 1e6   // 1M default

The getContextWindowSize() function only checks the model name and always returns 1,000,000 for Opus/Sonnet 4.6.

Expected Behavior

When CLAUDE_CODE_DISABLE_1M_CONTEXT=1 is set in Claude Code's settings.json (under env), the context gauge should display 200k instead of 1000k.

How to Reproduce

  1. Set CLAUDE_CODE_DISABLE_1M_CONTEXT=1 in ~/.claude/settings.jsonenv
  2. Start agent-flow-app
  3. Open the webview — context gauge shows 1000k max instead of 200k

Suggested Fix

  • Read the CLAUDE_CODE_DISABLE_1M_CONTEXT env var (from hook stdin payload or Claude Code settings)
  • If set to "1", cap context window at 200,000 regardless of model

Environment

  • agent-flow-app: v0.6.2
  • Model: claude-opus-4-6
  • OS: macOS (Darwin 25.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions