Hi everyone, I wanted to share a quick workaround I built to keep my personal automation working without breaking the bank, especially with the upcoming policy changes. The Motivation As you all know, starting June 15th, using claude -p (piping text directly into Claude Code) will switch to pay-per-use API billing, completely separated from the flat-rate Pro subscription. As a hobby project, I’ve been using claude -p to build a personal assistant agent for my family, and it has been incredibly useful. Since I am on the Pro subscription, I always enjoyed a fixed, predictable monthly budget. Moving a personal hobby project over to API billing felt a bit risky because costs can fluctuate wildly depending on usage. I wanted to find a way to keep my family agent running safely within my fixed subscription budget. The Solution: Simulating claude -p via tmux Instead of using -p, I decided to wrap the standard interactive claude TUI inside a headless tmux session and script the input/output orchestration. Here is the high-level pipeline of the Bash script I wrote: Spawn: Spin up claude in a detached tmux session. Inject: Use tmux send-keys to inject the user prompt and trigger Enter. Poll: Periodically run tmux capture-pane and parse the buffer. Detect: Wait until the termination token appears — specifically matching the regex for that funny summary line: ✻ .* for [0-9]+s Scrape & Crop: Once detected, crop the text from the prompt line down to the termination token, clean up the formatting, and forward it back to my agent. It’s a bit hacky and not 100% perfect, but it mimics claude -p close enough within the standard subscription mode. 🙏 A Quick Note to Anthropic: I know Anthropic might not love this kind of workaround, but please forgive me - I’m just a hobbyist building fun tools for my wife and kids! Rest assured, for my actual day job at the company, we build our corporate agents using the official pay-per-use API billing. This tmux hack is working great for my family agent so far, but I’d love to hear from you guys. How are other hobby devs preparing for the June 15th change? Are you looking into similar terminal workarounds, or just biting the bullet and moving to the API? submitted by /u/rossjang
Originally posted by u/rossjang on r/ClaudeCode
