Skip to content
AI Primer
workflow

Claude Code users report tmux claude-p wrappers and cache fixes after June 15

Developers published two Claude Code workarounds after users flagged metered -p mode: a tmux-backed claude-p wrapper and a setting to stop attribution headers from breaking prompt caching. Both reduce repeated-token spend in agent-heavy runs.

4 min read
Claude Code users report tmux claude-p wrappers and cache fixes after June 15
Claude Code users report tmux claude-p wrappers and cache fixes after June 15

TL;DR

You can read Zed's breakdown of the June 15 billing change, inspect Patrick Debois' gist for an earlier headless wrapper idea, and compare the caching advice against Anthropic's own prompt caching docs, which were talking about cache pre-warming, not the attribution-header bug users are now discussing.

June 15 billing split

The official change surfacing through Zed's post and aibuilderclub_'s thread is simple: interactive Claude usage stays on the subscription plan, while Agent SDK style usage moves to a separate monthly credit bucket on June 15.

The numbers in

are small enough to explain the reaction. The screenshot lists $20 for Pro, $100 for Max 5x, and $200 for Max 20x. Zed's TL;DR post summarized the practical effect as API-rate billing for agent and SDK usage.

tmux wrapper

The workaround making the rounds is a local wrapper that treats an already-open Claude Code terminal as the backend. aibuilderclub_ described the flow as:

  • local script
  • tmux session
  • already-open Claude Code
  • clean stdout

That keeps the script out of the API path. aibuilderclub_'s claim is that the prompt gets pasted into the live session with tmux send-keys, which makes it look like claude -p without actually calling the metered path Anthropic is moving into the SDK bucket.

clean stdout

What turned this from a toy into a usable shim is the output cleanup. aibuilderclub_ said sending the prompt was the easy part, and listed three problems the wrapper had to solve: knowing when Claude Code is done, ignoring TUI noise, and keeping only the final answer.

The fixes in that same post were mechanical:

  • write the answer to a tmp file first
  • use pane markers as fallback
  • strip ANSI codes

That is the interesting bit. The hack is not just terminal automation, it is terminal automation plus enough output discipline to pipe the result into another command, including cat prompt.md | ./claude-p > demo.html from the usage example.

cache invalidation

r/ClaudeCode

Fix your CC right now and save tokens

1 comments

A second workaround targets token burn rather than CLI routing. In the Reddit post, a user said Claude Code prepends a changing attribution header, such as a session ID, turn counter, or timestamp, to each message, which breaks prefix caching on every turn for local inference.

The post attributes that finding to Unsloth's Claude Code writeup and says the fix is setting CLAUDE_CODE_ATTRIBUTION_HEADER to "0" inside ~/.claude/settings.json. The same post links to claude-code-cache-fix, which inserts a filter into API traffic to preserve more cache hits.

The useful distinction is that Anthropic's own prompt caching docs and ClaudeDevs' pre-warming tip are about warming a large system prompt in advance. The Reddit thread is about a different failure mode: a changing header that prevents the cached prefix from matching in the first place.

rate-limit context

r/ClaudeCode

Fix your CC right now and save tokens

1 comments

The cache-fix thread adds one last wrinkle: the original poster said the workflow improvement may also be partially explained by recent rate-cap increases, and a follow-up comment in the same Reddit thread said Claude Code 2.1.143 still did not flip the attribution-header default.

That leaves two separate cost-control ideas circulating at once. One is a tmux shim that keeps automation inside an interactive Claude Code session. The other is a local cache fix that tries to stop repeated prompt prefixes from missing cache due to changing headers. They solve different problems, which is why both showed up within days of the June 15 billing change.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 2 threads
June 15 billing split2 posts
tmux wrapper1 post
Share on X