thoufeeque22/zeroburn
Sobre
Zero-waste AI coding-agent orchestrator for Claude, Gemini, OpenAI & Cursor. Cut multi-file ticket tokens 31–46% via code-graph digests, 0-token AST checks, local Ollama diff audits & 1-line test logs.
Ferramentas de desenvolvimentoCrescimento medido de estrelas
- em 24 h
- +1
- em 7 dias
- +4
- em 15 dias
- Coletando histórico
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalZeroBurn (zeroburn)
Cut AI coding-agent orchestration & tooling token overhead by 70–98% — and end-to-end multi-file ticket tokens by ~31–46% in controlled A/B tests (with 0% tax on small fixes) — by eliminating test/discovery output bloat, querying live-verified local code graphs, running deterministic AST/auth/scope checks, and offloading mechanical failure analysis and diff reviews to local Ollama models without sacrificing Contract-First TDD or strict quality gates.
Works across any coding agent harness and frontier model family (Google Gemini, Anthropic Claude, OpenAI, Cursor, Antigravity).
Engineered by the team building directly.social (
@directlysocial).
⚡ Quick Start (10 Seconds)
Prerequisites: Any Git repository (GitHub, GitLab, Bitbucket, or local Git), Node.js 18+, and (optional) local Ollama. No GitHub account or
ghlogin required.
1. Live 0-Install Benchmark & AST Diff Auditor (Try it in any repo):
curl -fsSL https://github.com/thoufeeque22/zeroburn/raw/main/benchmarks/try-now.mjs | node
2. Install ZeroBurn into your repo:
git clone --depth 1 https://github.com/thoufeeque22/zeroburn /tmp/zb && cp -R /tmp/zb/.agents . && rm -rf /tmp/zb && node .agents/scripts/init.mjs --pull
3. In-Place Upgrade to Latest Release:
node .agents/scripts/init.mjs --upgrade
4. Trigger in Chat (GitHub Issue or Plain Local Task):
# With a GitHub issue:
start orchestration workflow on #1043
# Or without GitHub / plain local task:
implement tier-based upload quota limits in src/lib/billing
Note: Upgrades preserve your existing project settings (
projectName,stackSummary,graphProjectId, and local models) inside.agents/project.config.jsonwhile updating the engine, rules, and subagents. When a new release is available, your agent's session banner will automatically alert you.
Tooling & context overhead preview from
benchmarks/try-now.mjs(for full end-to-end ticket A/B results including IDE system prompt and code-editing tokens, see the End-to-End A/B Benchmark table below):
🔥 ZeroBurn v2.11.1 — Live Tooling-Overhead Benchmark & 0-Token Diff Auditor
📂 Repository: /Users/dev/my-app (branch: feat/billing-quota)
📊 1. Context & Cloud Token Footprint (Standard Subagent vs ZeroBurn)
┌────────────────────────────┬────────────────────────────┬─────────────────────────────┬────────────────┐
│ Pipeline Stage │ Vanilla Agent │ ZeroBurn v2.11.1 │ Cloud Saved │
├────────────────────────────┼────────────────────────────┼─────────────────────────────┼────────────────┤
│ 1. Repo & Route Discovery │ 15,429 tok (1465 files) │ 512 tok (5-line digest) │ -96.7% │
│ 2. Rule & Docs Ingestion │ 59,202 tok (4348 lines) │ 195 tok (7-line digest) │ -99.7% │
│ 3. Test Verification Logs │ 6,816 tok (verbose log) │ 17 tok (1-line quiet-cli) │ -99.8% │
│ 4. Diff Security Audit │ 3,500 tok (Cloud Pro) │ 0 tok (Local Ollama + AST) │ -100.0% │
├────────────────────────────┼────────────────────────────┼─────────────────────────────┼────────────────┤
│ TOTAL (Single Agent Loop) │ 84,947 cloud tokens │ 724 cloud tokens │ -99.1% │
│ TOKENS TO 1ST GREEN EDIT │ 312,078 tok (4 turns) │ 2,731 tok (2 turns) │ -99.1% │
│ 5-TURN CUMULATIVE BILLING │ ~339,788 billed tokens │ ~2,896 billed tokens │ 336,892 saved │
└────────────────────────────┴────────────────────────────┴─────────────────────────────┴────────────────┘
🛡️ 2. Live 0-Cloud-Token Diff Audit (HEAD~1..HEAD — 3 changed file(s))
┌────────────────────────────┬──────────┬──────────────┬─────────────────────────────────────────────────┐
│ Audit Engine │ Time │ Cloud Cost │ Verdict │
├────────────────────────────┼──────────┼──────────────┼─────────────────────────────────────────────────┤
│ Static AST & Route Auth │ 0.01s │ 0 cloud tok │ ✅ PASS (<=200L, 0 `any`, route auth guards) │
│ Ollama (qwen2.5-coder:14b) │ 8.92s │ 0 cloud tok │ ✅ PASS — Clean diff verified │
└────────────────────────────┴──────────┴──────────────┴─────────────────────────────────────────────────┘
Why zeroburn Exists
Most multi-agent setups ("PM / Architect / Dev / QA prompt packs") drain your 5-hour and weekly Claude / Gemini usage limits in two tickets because:
- Blank-Slate Subagent Tax: Every subagent starts fresh and wastes 3–5 turns re-reading markdown rule files, directory trees, and full source files.
- Test Log Bloat: Verbose test/lint runs (
vitest,eslint,tsc) dump 500+ lines (~15,000 tokens) into context on every turn, which then gets re-billed on every subsequent turn ($O(N^2)$ context growth). - Frontier Models on Mechanical Checks: Cloud
pro/Opusmodels are spawned to check line counts,anytypes, and file blast radius that Python + local Ollama can verify in 0 cloud tokens.
Verified End-to-End Controlled A/B Benchmark (transcript.jsonl Ground Truth)
Measured across 3 real production tickets on directly.social (1,470 source files) in isolated git worktree checkouts from the same main commit (Arm A: ZeroBurn v2.11.0 vs. Arm B: .agents/ completely stripped), identical prompts, same primary model + Medium thinking, using exact Antigravity transcript.jsonl logs via benchmarks/token-benchmark.mjs. Full methodology & per-model tables in benchmarks/END_TO_END_AB_BENCHMARK.md:
| Ticket Scope | Files | Total Tokens Delta | Model Steps | Wall-Clock Time | Est. Cloud Cost* | Tests |
|---|---|---|---|---|---|---|
| Small (Backend Concurrency & Validation) | 4 | +0.6% (-1.4% uncached, 0% tax) |
9 vs 9 | -1.8% (1m 47s vs 1m 49s) |
$0.22 vs $0.22 |
22/22 |
| Medium, Pre-Mapped (UI, WCAG 2.1 AA, Tokens) | 16 | -30.7% (-547k tokens) |
16 vs 19 (-15.8%) |
-13.8% (5m 01s vs 5m 49s) |
-16.1% ($0.59 vs $0.70) |
21/21 |
| Exploratory, 5 Domains (CI, FFmpeg, Auth, Worker, Docs) | 16 | -46.4% (-1.63M tokens) |
19 vs 29 (-34.5%) |
-36.7% (5m 34s vs 8m 48s) |
-26.5% ($0.79 vs $1.07) |
42/42 |
Tooling & Context Overhead Microbenchmark (directly.social — 10,893 AST Nodes, 1,470 Source Files)
Stage-by-stage orchestration & CLI overhead ("Locate and audit checkUploadQuota tier logic, run all 6 billing unit test suites (70 tests), and execute a diff security audit"). Full raw traces and reproducible runner in benchmarks/REAL_WORLD_BENCHMARK.md:
| Stage | Standard Coding Agent (Vanilla) | zeroburn v2.11.1 Engine |
Measured Savings |
|---|---|---|---|
| 1. Repo & Route Discovery | find src -type f (1,470 lines / 15,454 tokens) |
build_repo_map_digest() (6 lines / 636 tokens: 28 Prisma models, 32 domains, 60 API routes) |
-95.9% tokens |
| 2. Governance & Rule Loading | cat .agents/AGENTS.md .agents/base/*.md (276 lines / 10,274 tokens) |
Pre-computed inlined rule digests (7 lines / 195 tokens) |
-98.1% tokens |
| 3. Symbol Localization | grep -rn "quota" src/lib/ (64 matches / 1,921 tokens) + exploratory reads |
codebase-memory-mcp search_graph -> FreemiumGuard.checkUploadQuota (src/lib/billing/freemium-guard.ts:43-83) in 0 LLM tokens |
-100% exploratory LLM tokens |
| 4. Unit Test Run (6 suites, 70 tests) | npx vitest run (243 lines / 6,816 tokens per run) |
node .agents/scripts/quiet-cli.mjs unit (1 line / 17 tokens) |
-99.75% test log tokens |
| 5. Diff Security & Quality Audit | Cloud Pro / Opus subagent review (~12,000+ cloud tokens) |
0-token Python AST/Blast-Radius + Local Ollama qwen2.5-coder:14b-custom (13.43s, 0 cloud tokens) |
100% cloud audit quota saved |
| Single-Pass Overhead Total | 46,465+ Cloud Tokens | 848 Cloud Tokens | 98.2% Reduction |
⚡ 30-Second Before vs After (Actual Terminal Trace)
❌ WITHOUT ZEROBURN (Standard Subagent — 46,465 tokens burned before writing code):
$ find src -type f # 1,470 lines (15,454 tokens)
$ cat .agents/AGENTS.md .agents/base/*.md # 276 lines (10,274 tokens)
$ grep -rn "quota" src/lib/ # 64 lines ( 1,921 tokens)
$ npx vitest run src/__tests__/unit/*billing* # 243 lines ( 6,816 tokens)
$ [Spawns Cloud Pro Subagent for Diff Review] # (12,000 tokens)
----------------------------------------------------------------------------------
💥 Result: 46,465+ tokens & ~185,000 cumulative billed tokens across a 5-turn loop.
✅ WITH ZEROBURN v2.11.1 (848 tokens — 98.2% reduction):
$ [codebase-memory-mcp] search_graph("billing tier quota check") # 0 tokens
-> FreemiumGuard.checkUploadQuota (src/lib/billing/freemium-guard.ts:43-83)
$ [Inlined REPO_MAP_DIGEST + Rule Digests] # 831 tokens
-> 28 Prisma Models | 32 src/lib domains | 60 API Routes
$ node .agents/scripts/quiet-cli.mjs unit src/__tests__/unit/*billing*
-> [quiet-cli] unit: PASS (Test Files 6 passed (6), Tests 70 passed (70)) # 17 tokens
$ [parallel-audit.py] Python AST + Local Ollama qwen2.5-coder # 0 cloud tokens
----------------------------------------------------------------------------------
⚡ Result: 848 tokens total. Surgical edit on Turn 1. Zero cloud Pro audit burn.
How It Works (Under the Hood)
Instead of relying on proprietary agent runtimes or buzzwords, ZeroBurn is a set of transparent scripts, hooks, and local model helpers that eliminate cloud context waste:
Test Stdout Truncation, FTS5 Spillover Search & Live Savings Telemetry (
quiet-cli.mjs+quiet-store.mjs):- Passing runs: Vitest, ESLint, and TypeScript emit a 1-line receipt (
PASS) instead of dumping 500 lines of ASCII progress bars into chat history. - Failing runs: On >12-line failures, local Ollama (
gemma4/qwen2.5-coder) outputs a concise 3-line diagnosis (exactfile:line, root cause, suggested fix) directly above the last 35 lines of the raw stack trace, while outputs>=4 KBare automatically indexed into a localnode:sqliteFTS5 spillover store (with JSONL fallback on Node 18–22.4) for targeted follow-up viaquiet-cli.mjs search "<terms>"— with 0 MCP tool-schema token tax. - Ad-hoc command filtering & live stats: Run
quiet-cli.mjs exec --query "<terms>" <cmd...>to keep 100 KB+ logs/JSON out of context and inspect cumulative real-world savings anytime viaquiet-cli.mjs stats.
- Passing runs: Vitest, ESLint, and TypeScript emit a 1-line receipt (
Deterministic
PreToolUseAuto-Rewrite & Large-Read Context-Guard (pre-tool-guard.mjs+command-rewrite.mjs):- Transparently rewrites single and chained
&&noisy verification commands (npx/pnpm vitest run,pnpm test,tsc --noEmit,pnpm typecheck,eslint,pnpm lint,pnpm pr-check) intoquiet-cli.mjsviaPreToolUseoverwriteso token savings hold even when an agent chains commands or forgets the wrapper. - Blocks unbounded full-file reads of large source files (
>24 KB, configurable viamaxUnboundedReadBytes) withoutStartLine/EndLine, steering agents tocodebase-memory-mcpor bounded line ranges, whileSessionStartsteers final diff audits to 0-cloud-tokenlive-audit.mjs.
- Transparently rewrites single and chained
Pre-Execution AST Code Graph with Live Tree Verification (
codebase-memory-mcp):- Queries a local SQLite/AST symbol index before constructing subagent prompts—avoiding both exploratory
find/greploops and the ~9k-token per-turn MCP tool-schema tax (schemas stay lazy-loaded). - Every graph-indexed path and line range is verified against the live filesystem on read (
_verify_live_file_entry), converting moved or deleted files into explicit[STALE_INDEX_MISS]signals so agents never trust stale coordinates.
- Queries a local SQLite/AST symbol index before constructing subagent prompts—avoiding both exploratory
Two-Tier Hybrid Security, Docs Parity & Quality Audit (
parallel-audit.py+quiet-cli.mjs docs-parity):- Tier 1 (0-Token Deterministic Rules + Local Ollama Pre-Filter): Deterministic properties run in pure Python first (missing server-side auth guards on non-public
/api/**/route.tshandlers, docs & knowledge parity checks for user-facing/schema diffs across Track S/M/L, line-count modularity,'use server'line-1 placement, explicitany, and blueprint scope drift). Local Ollama then scans the diff for fuzzy logic/error-handling issues. - Tier 2 (Cloud Auditor Final Decision): Local findings are passed into a single cloud frontier auditor (
proorflash), which filters out local false positives and serves as the authoritative gate for blockingCriticalandHighissues.
- Tier 1 (0-Token Deterministic Rules + Local Ollama Pre-Filter): Deterministic properties run in pure Python first (missing server-side auth guards on non-public
Dynamic Live
REPO_MAP_DIGEST& Inlined Rule Digests (workflow_common.py):- Walks
src/app/api/**,src/lib/*, andprisma/schema.prismalive on disk in<5msright before spawning a subagent, inlining a 6-line structural map + compressed rule digests so subagents never waste turns listing directories or reading markdown docs.
- Walks
Advisory File Locks for Parallel Workers (
swarm_leases.json):- Simple JSON lockfile enforced by
pre-tool-guard.mjsbefore file edits, preventing concurrent subagents in parallel swarms from editing the same file simultaneously.
- Simple JSON lockfile enforced by
Stage 0/1 Smart Bypass & Work-Resume Gate (
parallel-discovery.py+ORCHESTRATION.md):- Automatically detects branches that already have commits/WIP (
already_worked_on), Track L child sub-issues, and pre-specced observation-triage tickets, bypassing redundantproduct-agentanddiscovery-agentspawns in 0 cloud tokens and resuming directly atDev,QA, orAudit.
- Automatically detects branches that already have commits/WIP (
Multi-Slice Epic Feature Branches & Docs-Only Zero-Test Fast-Path:
- Multi-slice epics branch into and PR against dedicated
epic/<epic-id>-<slug>master feature branches to eliminate cascading rebase conflicts. Commits touching only documentation or markdown rules bypass full test suites to save compute.
- Multi-slice epics branch into and PR against dedicated
Tips, Tricks & Token Optimization Guide
For everyday efficiency tips, prompt shortcuts, and session hygiene best practices, read the ZeroBurn Tips & Tricks Guide:
- 1-Line Minimalist Startups: Why typing
start orchestration workflow on #1043is faster and cheaper than pasting 2,000-token manual handover notes. - Master Epic Branches: Eliminating cascading rebase conflicts on multi-slice features.
- Session Lifecycles: 1 chat per ticket, 0-token AST checks, and optimal timing for
/compact. - Knowledge Graph vs Grep: Using MCP graph queries instead of reading full 500-line source files.
Repository Layout
CHANGELOG.md # Version history & upgrade notes
docs/
└── TIPS_AND_TRICKS.md # Operational token-saving & prompt shortcut guide
benchmarks/
├── END_TO_END_AB_BENCHMARK.md # Controlled Small (4-file) & Medium (16-file) A/B transcript benchmark
├── REAL_WORLD_BENCHMARK.md # Verified A/B benchmark on 10,893-node production repo
├── token-benchmark.mjs # Exact Antigravity transcript.jsonl token & cost comparator CLI
├── try-now.mjs # Zero-install live token benchmark & local Ollama diff auditor
└── run_benchmark.py # Reproducible Python A/B benchmark runner
.agents/
├── AGENTS.md # Global management policies & Subagent Registry
├── project.config.json # Single declarative config (stamps zeroburnVersion)
├── project.config.example.json # Starter template
├── hooks.json # SessionStart & PreToolUse safety hooks
├── base/
│ ├── ORCHESTRATION.md # Hybrid Quota Policy (Options A+B+C), Tracks S/M/L
│ ├── CORE.md # TypeScript, 100-line modularity, data contracts
│ ├── PRODUCTION.md # Reliability, 7-Point AI Security Checklist
│ ├── UI_UX.md # Design system, ergonomics, a11y, microcopy
│ └── VARIABLES.md # Canonical paths, commands, verdicts
├── hooks/
│ ├── session-start.mjs # Git + Version + Auto-Start Local Ollama + Graph banner
│ ├── pre-tool-guard.mjs # Secret guard, Swarm file-lease guard, auto-rewrite & large-read guard
│ └── command-rewrite.mjs # Pure PreToolUse command-rewriting & large-read Context-Guard helpers
├── scripts/
│ ├── init.mjs # 1-command auto-detector & version upgrader (--pull, --pin, --version)
│ ├── live-audit.mjs # Real-time 0-cloud-token diff auditor & context calculator
│ ├── graph_prefetch.py # Live-verified codebase-memory-mcp graph pre-fetcher
│ ├── ollama_gate.py # Local Ollama auto-start, model resolution & fail-closed gate
│ ├── repo_digest.py # Dynamic REPO_MAP_DIGEST & swarm advisory file leases
│ ├── workflow_common.py # Shared FALLBACK_CHAINS, digests & modular re-exports
│ ├── parallel-discovery.py # Stage 1: Product || Discovery workflow
│ ├── parallel-audit.py # Stage 4: 0-token Python/Auth/Docs + Local Ollama + 1 Cloud Auditor
│ ├── quiet-cli.mjs # 1-line tsc/lint/vitest wrapper + Judgment Kernel + exec --query/search/stats
│ ├── quiet-store.mjs # Zero-dep node:sqlite FTS5 spillover index (JSONL fallback on Node <22.5)
│ └── quiet-stats.mjs # Live per-repo byte & token savings telemetry ledger
└── plugins/
└── zeroburn/
├── plugin.json # Single source of truth for ZeroBurn version (v2.11.1)
└── agents/ # 8 specialized subagent definitions
Attribution
Open-sourced by the engineering team building directly.social (@directlysocial).
Explore projetos relacionados
Carregando…