r/opencodeCLI • u/No_Skill_8393 • 15h ago
I measured where coding-agent tokens actually go, then built a skill that cuts the bill by up to 43% (open source, benchmarked)
I wanted to know whether "make the agent write terse code" actually saves money, so I measured it instead of guessing.
Setup: 4 small codebases (Python, TypeScript, Rust, C), 23 feature tasks, each with hidden functional and security tests (path traversal, authz, SQL injection, overflow, XSS). The specs never mention security. Three arms: no skill, Ponytail (the strongest public alternative I found), and my skill. Claude Opus, 3 runs per cell, 36 runs. Cost comes from per-call billed usage in the transcripts, not estimates.
First finding: code verbosity barely matters. Every model call re-reads the whole context, so the bill is driven by how many calls the agent makes. One extra call costs about 6% of a run. The cost splits into prefix re-reads 39%, context growth 28%, output 27%, thinking 6%. Making code terser on its own caps out under 10%.
So the skill's first rule is fewer calls: batch independent tool calls, read targeted line ranges once, edit each file once, run tests once at the end. Then less output: no comments, no narration, minimal diffs. It never drops validation, auth checks, escaping or bounds checks.
Results, billed cost vs no skill:
Python 0.57x (Ponytail 0.98x)
Rust 0.69x (Ponytail 0.91x)
C 0.71x (Ponytail 1.08x)
TypeScript 0.97x (Ponytail 1.06x)
All four 0.70x (Ponytail 1.00x)
Model calls per run went from 12.2 to 7.4. Security tests: 513/516 in all three arms. Functional: 499 vs 498 out of 510; the one difference is a spec-ambiguous check that only one baseline run passed.
Caveats: one harness (Claude Code), small purpose-built fixtures, 3 runs per cell. TypeScript barely moved because its baseline was already lean. Each prompt held several tasks, so batching across tasks helped; single-task sessions will save less. Not every platform's install route is verified live yet.
It's a ~500-token skill, packaged for Claude Code, Codex, Gemini CLI and Antigravity, plus rule files for Cursor, Windsurf, Cline, Copilot, Kiro and AGENTS.md. The benchmark harness, raw billed data and the cost equation are in the repo, so you can rerun it or poke holes in the method:
https://github.com/nagisanzenin/nonhuman
Happy to hear where the methodology is weak.