Cut AI Coding Token Costs: Caveman & Ponytail Guide
Cut AI coding token costs in Claude Code and Codex using Caveman and Ponytail. Learn setup, 6 compression rocks, the 7-step ladder, and pstack eval.
Table of Contents
- 1. What Is a Token?
- 2. Two Skills at a Glance
- 3. Caveman — Say Less & Read Less
- 4. Installing Caveman
- 5. How to Actually Save Tokens with Caveman
- 6. Ponytail — Write Less Code
- 7. Installing Ponytail
- 8. How to Actually Save Tokens with Ponytail
- 9. Which One Should You Use—or Both?
- 10. Pairing with pstack Playbooks
- 11. Precautions & FAQ
1. What Is a Token?
A token is a piece of text that an AI model reads or writes. Whenever coding agents like Claude Code or Codex work on your codebase, token consumption falls into three buckets:
- Your prompt — input tokens from your instructions
- Code, logs, and files read by the AI — context input tokens (by far the largest bucket)
- The AI's written response — output tokens
Whether you are stretching a monthly subscription cap or paying per token via an API key, reducing tokens directly saves both money and waiting time. Caveman and Ponytail shrink different parts of that footprint.
2. Two Skills at a Glance
Caveman shrinks the volume of conversation (what the AI reads and says), while Ponytail shrinks the volume of work itself (how much new code the AI writes). Because their scopes do not overlap, you can run them side by side.
CavemanSay less + Read less without touching code
“why many token when few do trick”
- What It Shrinks
- AI verbosity + logs, JSON, CSV, and web pages fed into context
- Core Mechanism
- Terse replies + pre-read compression + Auto model routing + script reuse
- Measured Results
- 33.2% fewer session input tokens; 1.4–2.4x Adobe cost cut; no quality loss in JetBrains A/B
- Install Format
- One-line CLI installer or agent skill/plugin
Ponytail7-step reuse ladder for minimal working code
“Write one line in silence—and it works”
- What It Shrinks
- Generated diff size and unnecessary architectural bloat
- Core Mechanism
- Stops at the earliest rung of a 7-step ladder before writing new code
- Measured Results (v5)
- 53% less code, 26% lower cost, 45% fewer tokens, 98% risky-logic test coverage (vs. 68%)
- Install Format
- Agent plugin or AGENTS.md / SKILL.md rule file
Caveman + Ponytail + pstackFull-stack token & code discipline
“Prove (eval) → Optimize (hillclimb) → Lock in (authoring)”
- Division of Labor
- Caveman compresses I/O + Ponytail trims code + pstack validates on your repo
- Built-In Synergy
- If Ponytail's review/PR summaries feel wordy, Caveman's output mode trims them too
- Recommended Order
- Install Caveman + Auto login → add Ponytail → verify with pstack eval/hillclimb
- Caveat
- Rule prompts cost ~1,160 input tokens, so always A/B test on short-session workflows
3. Caveman — Say Less & Read Less
Named after the idea of speaking with caveman brevity, Caveman cuts what your AI reads and writes while leaving every character of your source code untouched.
How It Works: The 6 Rocks
Installing Caveman turns on all six rocks by default, and you can toggle any individual rock off with caveman off <rock>.
| Rock | CLI Name | What It Does | Measured Savings |
|---|---|---|---|
| Say less | output | Compresses AI replies while keeping code, commands, paths, and error messages intact. Never rewrites your prompt. | Extra 3% over "answer concisely" (ultracave 35%) |
| Read less | input | Compresses logs, JSON, CSV, and test output before the AI reads them. Originals stay untouched on disk. | Session input tokens 33.2% ↓ (CSV files 98.9% ↓) |
| Auto | routing | Routes easy prompts to lighter models/effort and hard prompts to stronger models automatically. | 0.46x cost vs. Opus xhigh (preliminary) |
| Blocks | scripts | Saves and reuses repetitive helper scripts agents keep rewriting (8 built-in: test-summary, json-peek, etc.). | Reading test results 397 → 76 tokens |
| Waste fixes | waste-fixes | Pinpoints token leaks and keeps the prompt cache warm while you step away. | Not yet measured |
| Browse | browse | Compresses web pages into clean text before feeding them to the agent. | 200-row table page 15,704 → 121 tokens |
"Say Less" in Action
- Standard AI (63 tokens equivalent): "Your React component is re-rendering likely because a new object reference is created on every render cycle. Passing an inline object as a prop causes React's shallow comparison to see a different object each time and trigger a re-render. We recommend memoizing the object with
useMemo." - Caveman (20 tokens):
"New object ref each render, so React re-renders. Wrap the prop in useMemo."
Same exact fix, roughly one-third the output tokens.
4. Installing Caveman
Requires Node.js 22.13+ and works across macOS, Linux, and Windows. Choose the installation method that fits your setup.
npx @caveman-ai/cli@latest5. How to Actually Save Tokens with Caveman
5.1 Check Status First
Run caveman status to see which rocks are active, which agents are patched, and the recommended next action. To disable a single rock, pass its name—for example, caveman off browse (output, input, waste-fixes, routing, scripts, browse).
5.2 Start Where Savings Are Largest: Read Less
- High-volume logs, tests, and data files: Teams handling large test suites or data files see the biggest wins—over 50% session input token reduction in measured runs.
- CLI helpers:
caveman shrink -- pnpm test: Compresses noisy test or build output before the agent reads it.caveman browse <url>: Fetches and compresses web documentation.caveman learn: Ranks where your tokens go, then lets you apply fixes step by step withcaveman learn implement.
- Compress bloated memory files: Run
/caveman-compress <file>on oversizedCLAUDE.mdor instruction files (a backup of the original is preserved).
5.3 Pick Your Brevity Intensity
| Command | Intensity | When to Use |
|---|---|---|
/caveman | Normal (63 → 20 tokens example) | Everyday default |
/ultracave | Stronger (extra 35% savings) | When answers still feel wordy |
/megacave | Maximum (ultra-dense shorthand) | Extreme compression mode—looks like a meme, actually works |
/caveman off | Off | When you want full, detailed prose |
5.4 Cut Model Bills with Auto & Stop Rewriting Scripts with Blocks
- Auto Routing (
caveman login): Creating a free account unlocksAutoin your model picker. It selects the model and reasoning effort per request, cutting costs to 0.46x and latency to under half compared to Opus xhigh (if you do not log in,Autostays hidden and nothing is transmitted). - Blocks (
caveman-blocks scan/caveman-blocks init): Telemetry from real machines showed agents rewriting the exact same helper script up to 394 times in a single week. Initializing Blocks cuts test-result reading from 397 to 76 tokens. - Measure your own sessions: Use
caveman statsfor history andcaveman trial -- claudeto run live A/B comparisons on your own tasks.
5.5 Output Savings vs. Your Actual Total Bill (Honest Numbers)
Understanding where savings happen prevents disappointment, especially if you work in multilingual teams or short Q&A sessions:
| Component | Expected Impact | Evidence & Benchmark Context |
|---|---|---|
Read less · Blocks · Browse · /caveman-compress | Language-agnostic: ~25–55% session input ↓ | Targets code, logs, JSON (26.4% ↓), logs (50.2% ↓), and CSV (55.1% ↓), yielding 33.2% average total session input reduction regardless of language. |
| Auto (model routing) | Language-agnostic: up to 0.46x cost | Routes based on task complexity rather than prose style. |
| Say less (reply brevity) | English: ~41% output ↓ (6,983 → 4,119 tokens); Non-English: ~8–30% output ↓ | Structural rules ("answer first, skip pleasantries, one idea per sentence") drive most gains. English adds extra +3–35% from dropping articles and STE word shortening. In a Portuguese 10-question benchmark on top of an already concise CLAUDE.md, output fell 8% (median -5%) (issue #733). |
Crucially, look at total session cost: in a 662-session Claude Code analysis, output tokens accounted for just 0.3% of total tokens, keeping Say Less's net bill impact within ±0.2% (issue #733). Another benchmark cut output by 44% while total cost shifted +0.06% (issue #727). Because rule instructions add roughly 1,160 input tokens, short Q&A sessions or per-request billing plans (such as GitHub Copilot) can actually see a net loss (issue #145).
Bottom line: Even in English sessions, Read less, Blocks, Browse, and Auto drive the lion's share of real-world savings. Always verify with caveman trial -- claude, /caveman-stats, and your provider's billing dashboard.
6. Ponytail — Write Less Code
Ponytail channels the veteran engineer who has been at the company longer than the version control system—the one who silently replaces your 50-line function with a clean 1-liner that just works.
The rule is not "fewest tokens at any cost," it is "write only what is necessary." Ponytail never cuts input validation, error handling, security checks, or accessibility. Code shrinks because unnecessary reinvention disappears, and lower token bills follow as a welcome side effect.
How It Works: The 7-Step Ladder
Before writing a single line, Ponytail reads the target files and traces real execution flow, then stops at the earliest rung that solves the problem:
- 1Is this even needed?
Check whether the problem can be solved without writing new code at all.
- 2Does this codebase already have it?
Search for existing utilities, UI components, hooks, or helpers before creating anything new.
- 3Can the standard library do it?
Use built-in language and runtime APIs rather than custom implementations.
- 4Can the platform do it natively?
Prefer native HTML elements, browser APIs, and framework primitives.
- 5Does an installed dependency already handle it?
Leverage packages already in your lockfile instead of adding new dependencies.
- 6Can it be a one-liner?
Avoid wrapper abstractions and boilerplate layers when a direct expression suffices.
- 7Write the minimal working code
Only if rungs 1–6 cannot solve it, write the smallest clean implementation (+ 1 focused test if it contains logic).
For example, when asked to "add a date picker," a standard AI often builds a custom calendar widget or installs a heavy package (335 lines). Ponytail combines your existing Input component with the browser's native date input (10 lines).
7. Installing Ponytail
/plugin marketplace add DietrichGebert/ponytail
/plugin install ponytail@ponytail8. How to Actually Save Tokens with Ponytail
8.1 Intensity Modes: /ponytail
/ponytail lite: Light touch for simple projects or unfamiliar codebases/ponytail full: Default everyday mode/ponytail ultra: Maximum cleanup mode—"when the codebase feels like it personally betrayed me"/ponytail off: Temporarily disable
8.2 Review, Repo Audit & Debt Tracking
/ponytail-review: Instead of inspecting only the diff, it reads surrounding code to catch bugs, security gaps, real-world load issues, untested risky logic, slow paths, and dead code to delete. In benchmarks, it caught 100% of planted bugs (87% without) and 100% of outside-diff issues (78% without). Targetuncommitted,staged,branch, or a PR URL./ponytail-audit: Scans the entire repository under the same rules and prioritizes what to fix first./ponytail-debt: Collectsshortcut:comments left in your code so intentional shortcuts don't turn into permanent tech debt.
8.3 Live Cost & Reuse Telemetry (Claude Code)
- Band (
/ponytail band): Displays live session cost, tokens, elapsed time, existing-code reuse rate, and test pass status right above your prompt input, with quick buttons for review and audit (requires Claude Code 2.1.290+; not shown in VS Code chat panel or cloud sessions). - Board: Local web dashboard showing cumulative cost, tokens, and time per project. All data stays locally in
~/.config/ponytail/band/, and past sessions can be imported via/ponytail band import. /ponytail-gain: Prints a benchmark-based savings scorecard.
9. Which One Should You Use—or Both?
| Comparison | Caveman | Ponytail |
|---|---|---|
| Primary Target | AI conversation — reply length & read logs/files | Code output — lines written & complexity |
| Approach | Terse output rules + input compression + Auto routing + Blocks | 7-step ladder forcing reuse before creation |
| Packaging | One-line terminal CLI (or skill/plugin) | Agent plugin / AGENTS.md rule file |
| Benchmarks | Input tokens 33.2% ↓, cost up to 0.46x (Auto) | Code 53% ↓, cost 26% ↓, tokens 45% ↓ (v5) |
| Go-To Commands | caveman status, /ultracave, caveman shrink | /ponytail full, /ponytail-review, /ponytail-audit |
| Best For | Developers working with heavy logs, tests, CSVs, and long sessions | Developers building new features who want cleaner, smaller diffs |
If budget is your top concern, start with Caveman full install + Auto login. When you also want leaner code and fewer over-engineered diffs, layer Ponytail on top. If Ponytail's review explanations feel verbose, Caveman's Say Less trims those too.
Command Cheat Sheet (Click to Copy)
Caveman CLI · Compression · Stats
Caveman Modes · Memory Compression
Ponytail Modes · Review · Debt
10. Pairing with pstack Playbooks
pstack is an engineering skill plugin for Cursor and Claude Code that routes tasks through 23 structured playbooks. Three playbooks—eval, hillclimb, and authoring a skill—form a repeatable optimization loop: Prove quality holds → Cut costs further → Slim down the rule files themselves.
30-Second Setup
- Cursor: Type
/add-plugin pstackin chat - Claude Code: Run
/plugin marketplace add cursor/pluginsthen/plugin install pstack@cursor-plugins
- 1eval — Prove quality doesn't drop in your repo
/poteto-mode (eval)Runs identical prompts with skills on vs. off, hides candidate labels from the grader, and inspects real transcripts instead of self-reports.
- 2hillclimb — Drive down cost per task systematically
/poteto-mode (hillclimb)Locks a measurement harness first, then toggles one Caveman rock or Ponytail intensity per iteration—keeping only verified wins.
- 3authoring a skill — Trim rule files for your project
/poteto-mode (authoring a skill)Cuts redundant examples from Caveman's ~1,160-token rules or Ponytail's SKILL.md, tailors project conventions, and validates frontmatter and links.
/poteto-mode Run a blind eval comparing caveman and ponytail ON vs OFF on the same bug-fix task. Compare quality differences and token usage, then summarize the results./poteto-mode Cut average cost per task by 40% from baseline. Run at least 10 iterations, changing one caveman setting or ponytail mode per step, and keep only verified improvements./poteto-mode Tailor the caveman skill for our repository. Remove redundant examples to minimize input tokens while keeping our project rules intact, then validate the edited skill.11. Precautions & FAQ
Q1. Are Caveman and Ponytail completely free?
Q2. Does my code or prompt leave my machine?
Q3. Will brevity hurt answer or code quality?
Q4. Why not just write 'answer concisely' in my prompt?
Q5. What if my installation breaks?
Validate Agent Configs & JSON Logs Locally with Hafuture
Inspect Claude Code, Cursor, or MCP JSON configurations and clean up test payloads 100% locally in your browser—zero uploads, zero cost.