[Feature] Agent evaluation harness, measure steps, tokens and cost per task
Description
Add an agent evaluation harness under benchmarks/agent/ that measures steps, tokens, cost and pass/fail per task, so changes to the agent loop can be judged instead of argued about.
Split out of #1186 at @will-lamerton's request, and filed under #772. #1186 stays as the design record for the wider work; this issue is Phase 0 only and stands on its own regardless of what happens to Phases 1–4.
Changes since filing
- Pass/fail is the primary score; tokens, steps and cost are measured alongside it. Fixtures must be rich enough that degraded or missing context changes the outcome, not just the cost. (From @nikolai-vysotskyi's feedback below.)
- A seventh fixture is generated from a pinned seed and generator instead of vendored, so the suite includes a large-repository case. (Same.)
- Gate 0 thresholds are committed to the repo with a
verdict: PENDINGline before any baseline run, so any later edit to the bar shows in the diff. (Same.)- Every result records the fixture-set version, so a fixture change can't be mistaken for an agent change.
- Gate 0 is judged against current main only. The v1.29.0 run is directional, because its step counts are derived rather than measured the same way (agreed with @will-lamerton on #1186).
Use Case
#772 is open because of a measured gap: 37.4 average steps and 55,844 output tokens against OpenCode's 16.6 and 17,463, at statistically flat quality, with the model held constant.
Twelve wastage sub-issues have since closed, two of them (#760, #761) specifically step-count fixes. Nobody has measured since. We cannot currently answer "did that help?" for work already merged, let alone for work not yet started.
The existing benchmarks/ suite measures interactive_boot_ms_approx, dist_size_bytes and tool_count: startup and packaging. Nothing in the repo can measure a step count.
This blocks three things:
- Closing #772, which needs a re-measurement to know where it stands
- Evaluating #793's context work, whose whole premise is context efficiency
- Deciding whether #1186's Phases 1–4 are worth building at all
Proposed Solution
A separate suite under benchmarks/agent/, run manually or nightly. The existing boot suite is untouched and must keep passing.
- Drive the agent by shelling out to the CLI, not by importing in-process:
nanocoder --plain --json run "<prompt>". Both flags already exist. This keeps the harness version-agnostic, which is what makes step 8 possible. - Vendored task fixtures: small project trees under
benchmarks/agent/fixtures/, each with a prompt and a machine-checkable assertion (a file contains X, a test passes, an exit code). Vendored rather than cloned, so runs are reproducible, offline, and immune to upstream drift. Six to start, spanning navigation, single-file edit, multi-file change, and a read-only structural question. Each fixture must be rich enough that a run working from stripped or degraded context fails the assertion rather than just finishing more cheaply. - One generated large fixture: a seventh fixture produced by a generator from a pinned seed, sized to exercise a large repository without carrying that tree in the repo. Its assertion includes the run completing without a crash.
- Pass/fail is the primary score. No LLM-graded scoring: it reintroduces the nondeterminism the harness exists to control. Steps, tokens and cost are reported alongside pass/fail, never instead of it.
- Score from
source/usage/, which already records provider-reported tokens and prices them via models.dev.priceTokens()bills cache reads and writes at their own rates, which matters for any later context work. - One additive source change.
PlainConversationOutcomereturnstoolCallsand token counts but no step count, andtoolCalls.lengthis not a substitute: a step may issue zero or several calls. Addsteps: numberto all three variants and surface it in the--jsonoutput. - Handle nondeterminism: five runs per task per configuration, report median and IQR, pin model and temperature. A single run proves nothing. Every result records the model, the temperature and the fixture-set version.
- Two model tiers: a mandatory local Ollama tier any contributor can reproduce, plus an optional cloud tier behind an env var.
- Baseline twice: current main, which Gate 0 is judged on, and the v1.29.0 tag the original benchmark used, as a directional check on whether the gap has already narrowed.
- Wire
pnpm run test:agent-eval. Deliberately not part oftest:all: too slow and too costly for the commit gate.scripts/test.shstays as it is.
Exit criterion (Gate 0)
- Before any baseline run, commit the Gate 0 thresholds under
benchmarks/agent/together with a literalverdict: PENDINGline. The thresholds are not edited after the numbers come in; any change must show in the diff and be explained. - Run the baseline on current main and record the verdict against those thresholds.
- Run v1.29.0 and publish it next to main as directional context only. It does not decide the gate.
- Post the results back to #1186.
If the harness does not reproduce a meaningful gap against a comparison harness on the same tasks, that is a real result, and #1186's Phases 1–4 should be reconsidered on the strength of it.
Alternatives Considered
Keep reasoning from the original third-party benchmark. It was run on 1.29.0 and we cannot re-run it or vary it. Two relevant fixes have landed since.
Import runPlainConversation in-process instead of shelling out. Simpler, but it can only ever measure the working tree, which makes the v1.29.0 comparison impossible.
Vendor every fixture, including a large one. A vendored tree at that size is unmaintainable; a generated one stays reproducible as long as the seed and the generator are pinned.
Add it to test:all. Rejected: it needs real model calls, takes minutes per run, and would make every PR in the repo slower and flakier.
LLM-as-judge scoring. Rejected: nondeterministic scoring on top of nondeterministic runs.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] This feature aligns with the project's goals (local-first AI assistance)
Implementation note. AVA's files glob covers only source/** and plugins/**, so it needs extending to benchmarks/**/*.spec.ts or the harness's own specs will silently never run.
Known measurement caveat. The v1.29.0 run will not have the steps field from step 6. Steps will be derived from its tool-call log for that run, and the two are not measured identically. This will be stated wherever the numbers are published rather than quietly averaged together, and it is why v1.29.0 does not decide Gate 0.
Parent: #772 · Design record: #1186
Hey @akramcodez, could you assign this to me ?
Disclosure: I maintain trace-mcp, a code-graph MCP server, so I've built the thing #1186 Phases 1–4 describe and ran the measurement around it twice. Nothing to install here. Two notes on the harness, both from getting it wrong.
Six vendored fixtures will freeze the corpus at a size where the regime you're measuring doesn't exist. Vendoring for reproducibility is right, and it has a cost: fixture size stops being a variable and nobody notices it's now the binding one. The audience #1186 names is large codebases, where exploring from scratch degrades fastest — but a hand-vendored tree is small by construction, and a step count on a small tree measures the loop, not the thing the index is supposed to fix.
Ours was measurable. Our largest CI corpus was 50,000 symbols and everything else sat under 1,000, while search returned the bare string Maximum call stack size exceeded for every query against a user's 152,734-symbol index — deterministically, reported from the field with a 3/3 repro. The cause was Math.min(...xs)-shaped spreads hitting V8's argument limit, which is not a fixed number: roughly 65k to 125k depending on remaining stack depth, so a fixture at 70k proves nothing either way. We now generate that fixture from a seeder at 150,000 symbols instead of vendoring it, because a vendored tree at that size is unmaintainable and a generated one is still reproducible if the seed and the generator are pinned. Same trick would give you a seventh fixture at whatever file count you consider "large", without carrying it in the repo.
Preregister the exit criterion before the baselines run. Gate 0 is already written as a real decision — Phases 1–4 get reconsidered if the gap doesn't reproduce — which is more than most harnesses commit to, and it's exactly the kind of bar that moves by 5% after the numbers come in and nobody remembers it moved. We commit the thresholds and a verdict: PENDING line in the repo before the run, so the diff shows whether the bar was edited afterwards. It costs one file and it's the only reason our own bad result survived contact with the people who wanted it to be good.
For what it's worth on the no-LLM-judge decision: we do use a judge, and the thing it caught wasn't a scoring difference. Our context bundle was shipping signatures with zero lines of source on every task — a bare require('node:fs') throwing under ESM, swallowed by an adjacent catch {}, cached as "file unreadable", degraded to names, reported as assembled fine. 10k+ unit tests stayed green because vitest defines require, and the token half of the benchmark rewarded it, since a context with the bodies removed is much cheaper. Write-up. Your pass/fail assertions would catch that where a token count can't, which is a point in favour of your design — as long as a fixture is big enough that the missing content changes the outcome.
Hi @nikolai-vysotskyi,
Thanks for this, that's a rare kind of comment, actual numbers from having hit the failure mode rather than a hunch about it.
Fair catch, and I don't want to argue with a repro. Vendoring six hand-picked trees does cap the corpus at a size where the regime #1186 is about never shows up. I'll add a 7th fixture generated from a seeded generator rather than vendored, sized to actually exercise "large" pinned seed + generator so it stays reproducible. Will look at whether your Math.min(...xs) failure mode is worth a dedicated assertion too, since "the tool doesn't crash" is a pass/fail check the harness can already make.
Agreed, and I'll adopt it outright: thresholds + a literal verdict: PENDING line committed before the baseline runs, so the diff shows if the bar moved after the numbers came in. Cheap enough that there's no reason not to.
This one actually argues for the design as proposed rather than against it,
I think, the bug you hit is exactly what a pass/fail task assertion catches and a token count can't.
The condition you named is the part I need to hold myself to:
fixtures have to be rich enough that stripped/degraded context actually flips the outcome,
not just cheaper.
That's another point in favor of #1,
a fixture too small to matter can't fail this way either.
Folding all three into the spec before I start on fixtures.
Agree that steps/tokens/cost per task is the right Phase 0 gate — without it, loop changes stay vibes.
Two harness notes from building MCP/tool-use evals (adjacent to coding-agent loops):
- Pin a dated pack ID so a cost regression is comparable week-to-week; otherwise fixture churn looks like model churn.
- Split deterministic asserts (expected tool name/args, exit codes) from LLM-judge; most CI failures we've seen are contract/format, not subtle quality.
We're packaging that shape as versioned task packs + scorecard if anyone here wants early access while #1186 lands: https://evalcase-waitlist.vercel.app — permission-only.