Repository navigation
Feat/heuristic strip fold fixes - #13
Merged
Merged
Conversation
…ic strip - pipeUpstream forwarded a stale content-encoding header on responses that undici's fetch had already decompressed, causing Claude Code's own fetch client to throw BrotliDecompressionError on every proxied request. Strip content-encoding/content-length from the forwarded response headers. - transformRequest netted ScaleDown's summarize-call cost against Anthropic's savings as raw token counts (1:1), but the two are priced very differently (~$0.05/M vs Anthropic's cache read/write rates) — a cheap ScaleDown call could wipe out a real, substantial Anthropic-side saving. Net in dollars instead and expose both netSavingsUsd and a token-equivalent savedTokens. - client.summarize() now optionally sends structured message blocks alongside the flattened text, so ScaleDown can run a heuristic tool-result-stripping pass server-side (x-source: kode) instead of a model call for DietCode's traffic specifically. - foldEveryTurns default lowered 10 -> 5, closer to the point where the token safety net alone would otherwise trigger, based on real-session analysis. Verified end-to-end against a real multi-prompt conversation: fold fires correctly, heuristic strip runs server-side, and net savings are now reported correctly instead of clamping to 0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This repo is open source; comments describing exactly how the backend decides to run its cheaper tool-result-stripping path (naming a private file, and spelling out the client-identification header that gates it) shouldn't be public here. Describe only what this client sends and why, not how the backend routes on it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
varchanaiyer
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.