Files
magpie/docs
yetone 1555cddfa0 agent: with Claude Desktop on magpie, Claude Code runs each model at its own window, not the least of them all (#2025, 6.1sol)
Claude Desktop's Code tab runs Claude Code on ~/.claude/settings.json
with every model Desktop lists. Claude Code takes one window
(CLAUDE_CODE_MAX_CONTEXT_TOKENS) for every model it doesn't know, and
magpie told it the least of Desktop's (#1458), so one small model held
a 500K or 1M one to its 131K.

Now, while Desktop is on magpie, magpie tells Claude Code the largest
window of Desktop's models and of Claude Code's own main and tier
models, and holds each model below it to its own with
modelSettings.<id>.autoCompactWindow (claudePlan, claude_budget.go).
CLAUDE_CODE_AUTO_COMPACT_WINDOW would take precedence over those, so in
this mode magpie's working window goes in the top-level
autoCompactWindow instead, and an entry is written only where a
model's window or threshold differs from what it would run at
without one. Claude models (and groups of them) are left out as
before. magpie's entries and top-level value are stashed and go when
Desktop leaves magpie. The user's own entries, top-level value and
variables are never written over: an entry of theirs past its model's
window (or "auto") holds the largest to that window, and with a
CLAUDE_CODE_AUTO_COMPACT_WINDOW of theirs the least window is told as
before. Desktop off is unchanged.

Verified with real Claude Code 2.1.296 in a sandbox
CLAUDE_CONFIG_DIR, on a settings.json written through magpie's editor:
/context shows 256k for mythos-magpie-2's entry, 131k for
magpie/v/gpt-6.1-sol (dotted key, with and without [1m]), and the
top-level 272k for a model without an entry, under a 1M
MAX_CONTEXT_TOKENS.

Tests: TestClaudePlan and TestBudgetPath (new), and
TestClaudeDesktopContextWindow / TestClaudeDesktopAloneContextWindow
rewritten (largest window, per-model entries, Full window, the user's
entry and top-level kept, Desktop off removing only magpie's). They fail
on the old claude.go (256000 told), and with the skip of the user's
entries removed from claudePlan. Run: go test ./internal/agent (full),
gofmt -l, go vet for darwin, GOOS=linux -tags nogui and GOOS=windows.
2026-10-14 08:17:33 +08:00
..