Bot template · Vibe coding

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.

Preview card for Token saver
Works withClaude CodeCodexCursorGeminiGooseLocal scripts, no network
Price
$19
Difficulty
Beginner
Setup
10 min
Format
.md file
$19 one time

token-saver-keep-command-output-out-of-agent-context.md · 11 KB · instant download after checkout

Buy now · $19

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

Claude CodeCodexCursorGeminiGooseLocal scripts, no network

Solid chips: the agent is named in this listing's own tools list. Dashed chip: Local scripts, no network.

Tools needed

bash, grep, awk, perlrun the two scripts
Claude Code, Codex, Cursor, Gemini CLI, Goose or similarthe agent that follows the rule
ripgrep (optional)faster search when Spotlight is not available
You needmacOS or Linux
You needAn AI coding agent that can run shell commands

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

  1. 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.

  2. 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.

  3. 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

The rule paragraph
## 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-command-output-out-of-agent-context.md (excerpt)11 KB total
# 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

vibe-codingclaude-codecodexcursorcostsshell