Token efficiency
Three-tier token and quota architecture: Zero-Dependency Core, CodeGraph acceleration, and the Gemini Decisions API
Prosecution and multi-lens adversarial review are where autonomous fleets spend most of their tokens and quota. Starting in v2.0.0, antigravity-booster layers three orthogonal efficiency tiers so you get large token reductions out of the box with zero extra dependencies, and even deeper savings when you opt into CodeGraph or Google's Gemini Decisions API.
Three-tier architecture
Every optimization is fail-closed: if an accelerator is unavailable, times out, hits a truncation cap, or returns low confidence (< 0.85), agb automatically falls back to full System-2 cross-model prosecution and review.
Tier 0 — Zero-dependency core (default ON)
Enabled automatically on every repository with zero external tools or API keys:
- Single-pass static-diff review (
dryRounds=1,maxRounds=1):agb reviewno longer re-sends identical static diffs twice by default. Pass--thoroughor--dry-rounds <n>when stochastic multi-dry convergence is explicitly wanted. - Delta fix-round verification (
--delta+.review/last-findings.json): After applying fixes, re-verify only the fix delta and prior open findings rather than re-billing the entire branch diff across all 5 lenses. - 1-turn readonly tool lockdown: Static-diff prosecutors and review lenses deny
read_file(*)vialib/role-settings.mjsunlesscontextPack.truncatedContext === true, eliminating redundant multi-turn file reads that re-bill the diff prompt. hollow-testpre-prosecution short-circuit: Whenadlc hollow-testfinds surviving mutants,prepareProsecutionPrecheck()returnsblockimmediately without acquiring a System-2 quota lease or spawningagy.- Blast-radius risk-tiered routing:
computeDiffBlastRadius()scores every diff (low,medium,high, with security-sensitive paths forced tohigh) and scales non-frontier prosecutors and review lenses viaselectRiskTieredProsecutor()andselectRiskTieredLensModel()while preserving cross-family isolation. - Deterministic Arbiter fast-path: When
<= 4disjoint, non-blast_radiusfindings survive across lenses,triageFindings()resolves triage deterministically in 0 tokens instead of spawning an LLM Arbiter. - Provenance-cached preflight coldstart &
--seams-onlypost-run review:agb planstampsplan.gateProvenance.coldstartHashessoagb preflightskips redundant coldstart checks on unchanged tickets (--force-coldstartto bypass), and--seams-onlyaudits only cross-ticket integration seams when every merged commit passed per-ticket System-2 prosecution.
Tier 1 — CodeGraph accelerator (auto-detected)
When <rootRepo>/.codegraph/ exists (created via codegraph init or agb init --with-codegraph), agb activates CodeGraph automatically across isolated ticket worktrees:
- Shared root index & dirty-guard hygiene: Ticket worktrees query
<rootRepo>/.codegraph/directly (never requiring per-worktree re-indexing),.codegraph/is excluded fromisDirty(), andintegrate()conditionally runscodegraph syncwhen the root working tree advances cleanly. - Graph-backed context packs & blast-radius scoring: Uses
codegraph callers,callees, andimpactto build bounded hunk-to-symbol context packs and fan-in scores, falling back to static-AST and elevatingtruncatedContexton any per-symbol failure or cap overflow. - Impacted test slicing:
deriveImpactedTests()queriescodegraph affected --jsonto narrow Strike-0 andhollow-testruns to impacted test files (while always running the fullplan.gate.testbefore final merge).
Disable at any time with AGB_CODEGRAPH=0, --no-codegraph, or "accelerators": { "codegraph": false } in .adlc/config.json.
Tier 2 — System-1 Decision Engine (Gemini Decisions API)
lib/decision-engine.mjs is a zero-dependency Node >= 22 fetch client for ultra-fast, 0-output-token probabilistic decision models (noul, choice, score primitives) used for:
- Calibrated lens gating (
gateReviewLenses): Skips a review lens only when defect probability< 0.15and confidence>= 0.85. - Typed Arbiter triage (
triageFindingsSystemOne): Classifies findings across verdict/severity/route/blast-radius while enforcingSHAPE-*andblast_radiussafety floors and escalating low-confidence items to System-2. - Batched coldstart screening (
scoreColdstartTickets): Screens tickets in parallel and escalates uncertain or gap-risk tickets to System-2. - Fail-closed low-risk fast-ship (
screenTicketFastShip): Ships a non-frontier, low-blast-radius ticket with 0hollow-testsurvivors only when every acceptance criterion scores>= 0.92and every prosecution charge scores< 0.10at>= 0.85confidence.
Automatic detection & priority
Because antigravity-booster is built for the Antigravity / Gemini ecosystem, Google's Gemini Decisions API (gemini-decision-1 at POST https://generativelanguage.googleapis.com/v1beta/decisions) is prioritized first and auto-detected whenever GEMINI_API_KEY is set:
# Zero config needed — automatically activates gemini-decision-1
export GEMINI_API_KEY="AIza..."
agb doctor .The Gemini Decisions driver transmits the diff once in the shared input field and evaluates all lens/AC/charge questions in a single forward pass with 0 output tokens.
Alternative providers (jev via TYPESAFE_API_KEY, or self-hosted kev via AGB_KEV_BASE_URL) remain supported via explicit AGB_DECISION_PROVIDER or agb init --decision-provider <gemini-decisions|jev|kev>. Disable System-1 gating completely with AGB_DECISION_ENGINE=0 or "accelerators": { "decision": { "enabled": false } } in .adlc/config.json.
Verified A/B benchmark results
Reproducible offline via node --test test/token-efficiency-v2.test.mjs (evals/subsystem-bench.mjs):
| Configuration | Review Reqs | System-2 Reqs | Billable Tokens | Token Reduction | Defect & Mutation Recall |
|---|---|---|---|---|---|
Pre-optimization agb (tiers disabled) | 29 | 35 | 134,322 | — | 100% |
| Tier 0 (Zero-Dep Core) | 10 (-65.5%) | 12 | 16,171 | -88.0% | 100% |
| Tier 1 (+ CodeGraph) | 10 (-65.5%) | 12 | 14,177 | -89.4% | 100% |
| Tier 2 (+ Decision Engine) | 6 (-79.3%) | 7 | 9,677 | -92.8% | 100% |
Split token telemetry
All runs and standalone reviews record split economics (Build, Prosecute, Review, System-1 calls, Hollow short-circuits, Skipped lenses, and Arbiter mode) to FactoryLedger and surface them in agb status, agb watch, the MCP Flight Deck / Mission Control views, and the Sidecar dashboard.