Token saver: keep long command output out of your coding agent's context
by PaperChaseWebb
Two shell scripts and one rule line that make Claude Code, Codex, Cursor and other agents read a one-page summary of builds, tests and searches instead of thousands of lines.
- Price
- $19
- Difficulty
- Beginner
- Setup
- 10 min
- Format
- .md file
token-saver-keep-command-output-out-of-agent-context.md · 11 KB · instant download after checkout
Want this built for you instead? We can build it for you.
What you end up with
Noisy commands stop flooding the conversation, failures stay visible, and long sessions cost less.
What you get
- One .md file with the full source of ts-run and ts-find
- A rule paragraph and where to put it for each major agent tool
- Install, verify and uninstall steps with backups
- Six habits from our own usage audit that cut more than the tool does
Who it is for
Anyone whose coding agent runs builds, tests and searches that print hundreds of lines into the chat, and who wants shorter, cheaper sessions without losing the error that matters.
Works with
Solid chips: the agent is named in this listing's own tools list. Dashed chip: Local scripts, no network.
Tools needed
Cost to run: Free. Runs locally with tools already on macOS and most Linux systems.
Time to result: Working in 10 minutes
How it works
Install the scripts
Save ts-run and ts-find to ~/.token-saver/bin and add it to your PATH.
Expected: command -v ts-run ts-find prints both paths.
Add the rule
Back up your agent's rules file and add the Token saver paragraph.
Expected: The rule appears once in each rules file.
Verify
Run the five checks, then ask your agent to run your test suite.
Expected: The agent calls ts-run and quotes a short summary. Exit codes pass through.
Preview
## Token saver For commands likely to print more than 40 lines (builds, tests, logs, long scripts, find or ls -R), run them through `ts-run '<command>'` and read only the summary. If you need detail, grep the full.log path it prints instead of printing the log.
Free preview of the file
# Token saver: keep long command output out of your coding agent's context PaperChase bot template, version 1.0. Two small shell scripts plus one rule line for Claude Code, Codex, Cursor, Gemini CLI, Goose or any agent that runs shell commands. Runs on your own Mac or Linux machine. No accounts, no network calls, nothing installed outside one folder in your home directory. ## The problem Coding agents read everything a command prints. A test run, a build log or a wide `grep` can dump thousands of lines into the conversation, and in a long session that text is re-read on every turn. You pay for it, the agent gets slower, and the one line that mattered (the error) is buried. When we audited our own recent sessions across several agent CLIs, shell output and wide file searches were the two largest sources of tool output by count. Long sessions re-reading cached context were the largest cost overall. ## What it does - **`ts-run '<command>'`** runs any command, saves the full output to a log file and prints a one-page summary: exit code, line and byte count, error and warning lines, the most repeated lines, the first 20 and last 20 lines. The exit code passes through unchanged, so scripts and agents still see failures. - **`ts-find <query> [folder]`** searches a large folder and prints a grouped summary: match count, top folders, file types, the 20 most recently changed matches and the first hit lines from 10 files. Uses Spotlight on macOS and ripgrep or grep elsewhere. - **One rule line** tells your agent to use them for noisy commands and wide searches, and to search the saved log instead of printing it again. Example from our own test: `seq 1 3000` prints about 13,900 bytes. Through `ts-run` the agent reads a 496-byte summary. ## Contents 1. What it changes and what it never does 2. Install (5 minutes) 3. Source: ts-run 4. Source: ts-find 5. Add the rule to your agents 6. Verify 7. Other habits that cut more than this tool does 8. Uninstall
Worth knowing
- The rule is a request. Agents follow it most of the time, not every time.
- Saved logs may contain anything your commands printed. Clear the output folder and keep it out of synced folders.
- Tested on macOS and Linux. Not tested on Windows or WSL.
Questions
Does it change what my agent can do?
No. It only changes how much of a command's output the agent reads. The full log is still on disk for the agent to search.
Does it send anything anywhere?
No. Both scripts run locally and make no network calls.
Details
Version 1.0 · Updated Oct 15, 2026 · Markdown version of this page
License: Use on your own machines and your team's. Do not resell or republish the scripts or the guide. Download terms
Related

AGENTS.md, CLAUDE.md and Cursor rules starter files
Six fill-in instruction files for coding agents (base, Next.js plus Supabase, FastAPI, browser game, CLAUDE.md pointer, scoped Cursor rules) and 8 prompts to write, trim and test your own.

Solo-founder agent ops playbook: run your business with agents without losing control
Decide which jobs go to agents, how much power each gets, one house rules file they all follow, a daily brief, a weekly review, cost caps and a runbook for when an agent gets it wrong.

Debug a vibe-coded app without breaking it further
12 prompts that make your AI coding tool find the real cause of a bug, change one thing at a time and prove the fix before it moves on.