r/crewai • u/thoufeeque22 • 8d ago
Skilled Agent How we cut coding-agent cloud token burn by 98% (84,947 -> 724 tokens/loop) using 0-token AST graph pre-fetching + local Ollama diff audits (Open Source)
While building our production Next.js + Prisma app (1,465 source files, 10,893 AST nodes, 60 API routes), our multi-agent coding loops kept hitting the 5-hour Claude/Gemini usage cliff after just two tickets.
When we instrumented the exact token payloads per subagent loop, three culprits accounted for 98% of the token burn:
Blank-Slate File & Rule Crawling (\~74,600 tokens/loop): Every spawned subagent ran \`find src\`, \`grep\`, and read thousands of lines of markdown rules before touching a single line of code.
Verbose Test Log Bloat (\~6,816 tokens/run): Running \`vitest\` / \`tsc\` / \`eslint\` dumped 250+ lines of passing logs into context—which gets re-billed on every turn.
Frontier Models on Mechanical Diff Checks: Spawning cloud Pro/Opus subagents just to check modularity, \`any\` types, or missing server-side auth guards.
So we built and open-sourced ZeroBurn (v2.5.0):
- 0-Token Knowledge Graph Pre-Fetch (codebase-memory-mcp) + 5-line REPO_MAP_DIGEST (\~512 tokens)
- 1-Line Quiet CLI + Local Ollama Judgment Kernel (17 tokens on green runs; 3-line local Gemma/Qwen root-cause digest on failures)
- 0-Cloud-Token Diff Audit via Python AST + local Ollama (\`qwen2.5-coder\`, auto-starts \`ollama serve\` if stopped)
Try it live on your own repo in 10 seconds (zero install):
\`curl -fsSL https://raw.githubusercontent.com/thoufeeque22/zeroburn/main/benchmarks/try-now.mjs | node\`
GitHub (MIT): https://github.com/thoufeeque22/zeroburn