# TokenTrim

- **Event:** [Meta Global AI Developer Hackathon](https://cerebralvalley.ai/e/meta-ai-developer-hackathon)
- **When:** Oct 26, 12:00 PM – Nov 4, 9:00 PM (EST)
- **Where:** Online
- **Team:** [Hari Krishna Nandigam](https://cerebralvalley.ai/u/nankris)
- **GitHub:** https://github.com/nankris/tokentrim-meta/tree/feat/cache-key-code-outline
- **Demo video:** https://www.youtube.com/watch?v=vgowxqCbd_s
- **Gallery:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2793

Coding agents spend most of their budget on filler, over-long reasoning, re-sent tool output and prompt cache misses. Most token savers report tokens saved, but tokens are not dollars. TokenTrim targets the lowest cost per solved task, proven with measured spend only.

What it does:
- A skill (any agent, no key): say less, think in proportion, make the smallest complete change, ask tools for less, stop once verified. It never trades away correctness, tests, security or exact values.
- A tiny local gateway (OpenAI and Anthropic compatible, loopback only): sets reasoning_effort=low and raises it only when the agent keeps failing, adds a shared prompt_cache_key, compresses tool output reversibly, and a reserving spend ledger enforces a hard cap.
- /tokentrim-gain scoreboard and /tokentrim-audit to show where tokens went.

Measured results (real bug fixes mined from 15 open-source Python libraries, mini-swe-agent, paired against no skill, 95% confidence intervals):
- Gateway on muse-spark-1.3-contributor: -76% cost [-80, -72], 230/234 solved vs 213.
- Gateway on muse-spark-1.3: -87% [-90, -84], 53/53 vs 51.
- Gateway on muse-wonder-1.0: -84% [-88, -79], 12/12 vs 12.
- Skill only: -57% [-63, -49], 102/110 vs 101.
- Libraries the skill was never tuned on (79 tasks): -76%, 124/128 vs 109/128.
- Other languages (JS, TS, React, Go, Rust, Java; 17 tasks): -74% [-80, -65], 17/17 vs 13/17, 8.1 -> 2.7 min/task.

Repo: https://github.com/nankris/tokentrim-meta/tree/feat/cache-key-code-outline

## More from Meta Global AI Developer Hackathon

- [Cog & Code](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2790)
- [Ctrl-Alt-Win](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2791)
- [urelimitless](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2792)
- [Indus](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2794)
- [Team Pico](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2795)
- [crumpledpaper](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2796)

---

Markdown version of https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/2793. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
