127.0.0.1 (ephemeral port, torn down when you quit), points Claude Code at it via ANTHROPIC_BASE_URL, and launches claude normally.
What the proxy sends
Why it works
Progressive
Most turns make zero ScaleDown calls. One call folds the oldest turns into the summary only when summary plus recent turns passes
SCALEDOWN_PROXY_COMPACT_THRESHOLD.Replaces native compaction
The forwarded payload stays small, so Claude’s own auto-compaction effectively never fires. ScaleDown owns compaction instead.
Reversible
Compacted turns are stored locally. The summary tells Claude to call
sd_retrieve("<id>") when it needs an exact detail.Cache-safe
System prompt and tools are untouched, so Anthropic’s prompt cache stays warm.
Run the proxy yourself
Why not a
PreCompact hook? It can only append to the window, so injecting a summary there costs tokens instead of saving them. The real work happens in the proxy, where DietCode controls the request payload.