v0.3.9 — Pre Work Burn: See Where Your Agent Budget Actually Goes
The Problem
Multi-agent coding systems spend 30–70% of their budget on manager, router, and planner calls before a single line of code changes. You see "$4.82 for a bug fix" and assume the agent was writing code the whole time. It wasn't — $2.31 of that was spent deciding what to do.
MartinLoop now tracks and reports that.
What's New
Pre Work Burn on Every Receipt
Every run receipt now shows how much was spent before the agent's first meaningful code change:
Pre Work Burn: $2.31 / $4.82 total (48%)
Time to first delta: 11m 32s
Route recommendation: direct_worker_next_time
Pre Work Burn measures cost accumulated before the first real file edit — not metadata, lockfiles, or cache writes.
Route Classification
classifyRoute() scores task complexity and recommends the right execution mode:
- Direct — short, scoped, single-file tasks skip coordination overhead
- Manager — security-sensitive, multi-file, or architectural tasks get orchestration
- Consensus — security + migration combined triggers multi-reviewer mode
Considers objective length, file scope, keyword signals, and historical success rates.
Routing Policy
Control coordination cost with configurable caps:
routing:
maxPreworkBudgetPct: 25
maxPreworkCostUsd: 2.00
maxManagerCalls: 2
skipOrchestrationIfConfidenceAbove: 0.85Cost-per-Outcome Metrics
New metrics on every receipt: cost per accepted change, cost per attempt, acceptance rate, and wasted coordination spend.
Install
npm install -g martin-loop@0.3.9