When an AI agent maintains durable knowledge (comparing session recaps against a knowledge graph, planning updates, checking claims, and walking edits past a human), the quality bar is strict: cheaper runs still have to find what a careful expensive run finds and never write unproven facts.
Here is how we cut the cost of that pipeline from $20.50 to $32.20 per run (and $16.17 in its earlier single-session form) down to $6.84, a 58% reduction, without lowering the review bar.
Why single-session and swarm shapes stalled
- Shape 1: single frontier session ($16.17, ~24 min): Simple and high quality, but a black box. One run gives only a total bill: you cannot tell what planning cost versus retrieval versus review, so there is nothing isolated to optimize.
- Shape 2: parallel cheap workers + frontier manager (~$20/run): Failed twice over. The coordinating manager alone accounted for 77% of the bill, every run confounded model, prompt, and role, and letting a cheap model judge its own work was unsafe (one run marked 16 real defects as "fixed" in two seconds).
Shape 3: unit-testable capability jobs
The fix was splitting the pipeline into five single-purpose, independently testable jobs:
- Session runner: Reads the recap, gathers context, drafts edits, and walks changes with the human.
- Backlog shortlist: Filters ~900 open backlog items down to relevant candidates.
- Claim lookup: Checks which session claims already exist in the knowledge graph.
- Planner: Decides every candidate: keep, skip, defer, and target home.
- Checker: Adversarially reviews the plan and draft before human review.
Benchmarking eight models across these separated jobs (~$150 total benchmark spend) yielded one clear rule: match the model to the kind of judgment, then put a strong verifier behind anything cheap.
- Lookups: Cheap models matched or beat frontier models. DeepSeek handled lookups at ~7% of the frontier cost.
- Judgment & planning: Mid-tier and strong open models covered roughly the same plan surface as frontier models, leaving 1 to 2 unsourced facts per plan that a verifier can catch.
- Adversarial review: The gap that never closed. Even the best cheap checker re-found only 8 of 12 real frontier findings and missed the ones requiring multi-step live verification.
One-change-per-run optimization
With isolated parts, each change was measured one at a time against an answer key written before reading outputs:
- Baseline (all jobs on frontier Opus): $20.50 to $32.20 per run.
- Legacy (single monolithic session): $16.17 per run.
- Step 1 (session runner -> DeepSeek): $10.34 per run (eliminated the ~$24 context-reread tax on Opus).
- Step 2 (backlog shortlist -> keyword + vector retrieval): Matched the $1.37 model judge's recall for ~$0.
- Step 3 (planner -> Qwen): $6.84 per run ($2.28 vs $4.16; the Opus checker caught loose claims live before any human saw them).
Just as important were the ideas we measured and rejected:
- Trimming checker inputs: Saved almost nothing (~$0.15) because the checker's cost comes from running live probes, not reading the brief.
- Risk-tiered review: Audited offline against 31 real findings across three production runs; two real defects landed on items the skip tier would have bypassed, including a false claim headed for permanent storage.
The reusable optimization method
- Make one isolated change per experiment.
- Write predictions and pass/fail gates before running.
- Run at least three trials per cell and compare against pre-written answer keys.
- Price whole runs from the harness's own accounting rather than summing raw transcript turns (which easily double-counts cached context).
- Audit ideas for free against logs already on disk before building anything new.