
Claude Code’s Cache Fixes, Prompt Sanitization, and Cost Savings
We break down the latest Claude Code point releases, including the new dynamic boundary for prompt caching that can cut input token costs dramatically, plus practical tips for avoiding cache misses caused by whitespace and line-ending changes.
Also covered: automatic prompt sanitization to strip invisible Unicode injection tricks, smoother plugin marketplace registration, and a handy Auto mode status update in slash status.
Chapter 1
Optimizing Prompt Caching with Dynamic System Prompt Boundaries
Lachlan Reed
You know, if there is one thing that gets my motor running in the shed, it is making developer workflows fly without burning a hole in your pocket. Before we dive in, quick shoutout to our sponsor Jellypod AI for making this episode possible.
James Turner
Yeah, absolutely! And today we have to talk about a massive fix that landed in Claude Code version 2.1.275. If you have been using custom system prompts with the system prompt flag, you might have been unknowingly burning money.
Lachlan Reed
Wait, how so? Was it, uh, missing the cache entirely?
James Turner
Exactly. Developers were putting things like git commit SHAs, build timestamps, or environment variables right at the top of their prompt files. And because Anthropic's prompt cache relies on exact prefix matching from the top down, changing a single date string busted the entire prompt cache on every single turn.
Lachlan Reed
Oh, oof! That is like, er, busting the entire cache because a timestamp changed on a static image. It is basically like web caching, right? You want your big static library files sitting on a global CDN with a super long time to live, while your dynamic user session stuff gets calculated on the fly.
James Turner
That is the perfect analogy. And to solve this, Anthropic added a special sentinel line: double underscore SYSTEM PROMPT DYNAMIC BOUNDARY double underscore.
Lachlan Reed
Right, right. So everything above that magic boundary line gets treated as a static array prefix and cached globally across requests.
James Turner
Yes! And anything below that line is treated as dynamic context per request. In long running sessions, this cuts input token costs by up to 90 percent.
Lachlan Reed
Ninety percent! Crikey, that is serious savings.
James Turner
It really is. Picture a CI CD code review workflow where you run claude with a custom system prompt file like dot claude slash review prompt dot txt. Above the boundary line, you put your org wide linting rules, security guidelines, and architectural standards. Then below the boundary line, you put the PR author's name and the commit time.
Lachlan Reed
Ah, gotcha. So all those heavy company rules stay cached for every build, and only the PR metadata shifts.
James Turner
Exactly. But there is a huge caveat developers need to watch out for: byte matching above that boundary line is strictly enforced. If your text editor changes line endings from LF to CR LF, or adds a sneaky space at the end of a line above the boundary, boom, full cache miss.
Lachlan Reed
Classic invisible whitespace trap! That will get you every time if you are not careful.
James Turner
Oh yeah. But speaking of sneaky invisible stuff, version 2.1.277 brought another great quality of life fix: automatic prompt sanitization.
Lachlan Reed
What kind of sanitization?
James Turner
It automatically strips invisible Unicode formatting tags and zero width spaces from prompts before sending them. Turns out attackers were hiding prompt injection payload instructions inside zero width Unicode characters!
Lachlan Reed
No way! Invisible prompt injection? That is sneaky as a snake in the grass.
James Turner
Right? Now Claude Code cleans them out and shows you the clean text before executing.
Lachlan Reed
Love that. What else shipped recently in the terminal tool?
James Turner
Well, in 2.1.275, if you run claude plugin install with a marketplace flag pointing to an unregistered source, it detects it and asks if you want to auto register that marketplace in one command.
Lachlan Reed
Nice, no separate configuration step needed.
James Turner
And in 2.1.278, they added an Auto mode server status row when you run slash status, so you can immediately see if your session's auto mode classifier is running server side where it does not charge you extra classifier token overhead.
Lachlan Reed
Clean cost savings, better security, and smoother plugin installs. Gotta love when point releases pack this much punch. Good chatting as always!