Skip to content

ADR 0001: Proof search on agda-mcp

File: agda-native-air/docs/adr/0001-proof-search-on-agda-mcp.md

  • Status: Accepted through P2. P0, P1, and P2 are landed on main and measured; P3 is direction. The agent-in-the-loop comparison (#154) is measured and recorded in § 9, and so is Agda's own proof search as a closer in the loop (#206). Rewritten 2026-09-09 as a decision record; the explanatory companion is [proof-search/overview.md], which defines the vocabulary both documents use.
  • Date: 2026-08-22 (P0 and P1); 2026-08-27 (P2, first measurement); 2026-09-08 (P2 re-measured after review, and measured on the agda-algebras tier); 2026-09-10 (the haystack tier measured); 2026-09-15 (the agent in the loop measured); 2026-09-21 (its control); 2026-09-29 (both re-measured without the fixture headers' hints, #219); 2026-10-03 (Agda's own proof search in the loop, and the exclusion's name rule corrected, #206).
  • Tracking: #113 ([M2-9]); phases #119 (P0, PR #121), #122 (P1, PR #126), #123 (P2, [M2-10], PR #130 and the stage-two measurement in its comments), #124 (P3, direction); the benchmark instruments #127 (the agda-algebras tier, PR #132), #129, and #142; the hand-off #19 ([M2-5]); the agent-in-the-loop comparison #154 ([M1-10]); Agda's own proof search, the tool #205 (PR #230) and its use in the loop #206.
  • Ancestry: #112, the post-mortem of the retired search.py, whose four lessons this design encodes as types and tests, and whose one defect it makes unrepresentable.

Executive summary

We are building a machine that proves Agda theorems by search, with Agda itself as the only judge of every step. This document records what was decided, the evidence that earned each decision, and the measured state of the work; [proof-search/overview.md] explains how the search works, with a worked example.

The idea in six sentences.

  • A theorem with a hole in its proof is an obligation.
  • The searcher keeps a set of unfinished obligations for the file it is working on, and repeatedly plays a simple move: pick the first open obligation, propose a handful of candidate terms that might fill it, and ask Agda, through the agda-mcp server's fill_hole tool, whether each candidate typechecks there.
  • A candidate that typechecks is committed: it is spliced into the working copy of the file, and any fresh holes it contains (a candidate may be a partial application like (_,_ {!!} {!!}), whose two holes become two new obligations) replace the obligation it discharged.
  • The search fans out over these states in a beam: at each depth it keeps only the few most promising states and expands those.
  • A proof is claimed only when a state has no obligations left AND a final, strict, whole-file check by Agda comes back green.
  • Nothing the searcher believes is ever trusted: Agda's exit code is the sole source of truth, at every step and again at the end.

Why this shape. One measured fact: the oracle is the entire cost. Each fill_hole judgment spawns a batch Agda process that spends about 2.6 s loading the standard library's interfaces before it checks anything (about 3.5 s averaged over the suite once the agda-algebras tier is included), while everything else the searcher does costs microseconds, and the server's interaction lane answers questions about a loaded file in 1–3 ms. So the design optimizes one quantity, the number of batch judgments, and treats everything that can reduce it as nearly free: judgments are memoized, budgets are counted in judgments, and a millisecond type_of peek filters candidates before they cost one. The same fact chose the host language: transport is 0.21 % of oracle time, so no rewrite of the client can matter, and the client lives in Scala beside the benchmark and corpus machinery.

The defect designed out. The retired search.py carried a single goal per state and declared victory when any subgoal closed, so a lemma with two obligations counted as proved when one was discharged. Here the state is the obligation set, "done" is emptiness of the whole set, and the only way to construct the SolvedClaim type is through a factory that demands both the empty set and the final green check. A regression test pins exactly the two-obligation trap, both in isolation and against the live server.

Where it stands

  • P0 landed the state model, the oracle client, and the single-step harness, and measured the economics above.
  • P1 landed the beam loop with a fixed, non-learned action space (the closers refl and tt, the goal context's assumptions, and applications of the lemmas the fixture imports) and measured the baseline on the standard-library tier: 6 of 22 obligations (routine 6/7, compositional 0/10, non-obvious 0/5). That is exactly the set whose gold proofs are single terms expressible from the fixture's imports, so the number is the term-mode ceiling of that tier, not a shortfall of the loop. The type_of peek cut probes by 88 % and wall time by 4.5× with the same six solves.
  • P2 landed retrieval over real corpora (the standard library, 55,576 rows; agda-algebras, 13,123 rows) behind the same proposer interface, and measured the honest result twice. On the standard-library tier retrieval adds zero solves under target exclusion, because the ceiling binds any term-mode proposer, while the labeled control with exclusion off retrieves and commits all five admissible standard-library lemmas. On the agda-algebras tier, built so that every gold is a single term, the fixed space solves 2 of 21, retrieval again adds zero under exclusion, and the control commits one wholesale-stratum lemma end to end; the ledgers locate the binding constraint in ranking at scale, not in the move vocabulary. The baseline over the 43 obligations of those two tiers is 8 of 43, byte-stable across four reproductions; with the haystack tier's twelve rows added, the fixed space stands at 8 of 55 and retrieval under exclusion at 14 of 55, by composition of the separately measured tiers (each fixture's search is independent of every other).
  • The haystack tier (#129) is the instrument those two nulls called for: twelve standard-library obligations whose needles are import-reachable but never using-listed and never the answer key. On it retrieval has its first solves under exclusion, 6 of 12 against the fixed space's 0 of 12, each attributable to retrieval by construction, and each of the six nulls pins one limitation of the placeholder ranker or the peek (§ 9).

  • The agent in the loop (#154) is a second instrument beside the loop: a frontier model as proposer and search, driving the same server over the same 55 obligations under the same verifier, one fresh session per obligation with nothing but the server's tools and the one file. Measured without the fixture headers' hints (#219), Sonnet 5 solves 44 of 55 and Opus 5 *55 of 55, against the loop's 8 of 55 (fixed space) and 14 of 55 (retrieval under exclusion), which is a different instrument and no baseline for them; the rows an agent does not solve honestly are the ones where it cites the library's own lemma, reported in a restated* column (9 for Sonnet, 0 for Opus). The first arms, with the hints in view, solved 46 and 54; the difference is § 9's header-free subsection.

  • The composition tier (#160) asks for several lemmas where every earlier tier asks for one: twelve agda-algebras rows whose golds string two to four library lemmas through a root lemma with an implicit middle point. The loop solves 0 of 12 by construction, since fill_hole refuses such a root lemma with holes for its arguments. Both frontier models write a checking proof for every row in every configuration (72 of 72 final files), finding the lemmas through the tools and the sources, so this tier too sits at the models' ceiling.
  • Agda's own proof search (#205, #206), the one an editor's C-c C-a runs (Mimer, under the pinned Agda), solves 17 of the original 55 rows by itself, with no corpus and no model: a floor beneath every count here. Composed into the loop as a closer, proposed first at every state, it lifts the fixed space on the 43 from 8 to 18, one more than it solves alone (§ 9). Handing it retrieval's lemmas as hints exposed a gap in the target exclusion, now closed: the name rule never fired on the agda-algebras tier's renamed obligations (§ 7).

Where it goes

P3 replaces the deterministic ranker with a learned policy behind the existing policy-backend contract. The stage-two ledgers and the haystack tier's nulls are the quantitative demand for premise selection (#19, [M2-5]), which slots into the scorer seam the retrieval proposer already exposes. One benchmark instrument is measured (#129); the style-paired one (#142) remains. Raising the ceiling itself needs case-split moves, which is deliberately outside P1–P3.

1. Context: why proof search, and why now

(See also #112 and #113.)

The project's north star is AI agents that work effectively with Agda. Retrieval and representation (docs/PLAN.md Phase 2) tell an agent what might help; proof search is the part that does mathematics: propose a step, submit it to the checker, iterate. Its one prior implementation, agda-dojang/python/tools/search.py, had been dead since 2026-03-10; #112 is its post-mortem, and the file's move to experiments/archive/ is still open there.

Three things had changed by mid-2026 (#113). The oracle became native: agda-mcp exposes fill_hole, get_goal, and check_file directly and, since the #68 hardening wave, answers scope, type, and definition questions from a persistent interaction lane (#75, #107, #108), which is precisely the information a proposer needs. The corpus exists: agda-strux extraction plus search_by_name and search_by_type can supply candidate lemmas at scale. And the measurement exists: data/benchmarks/ is the suite, 43 obligations across two libraries with difficulty tiers at that point (55 since the haystack tier of #129 landed), and the proof-completion evaluator already emits versioned JSONL (eval-proof-completion.v0), so search results sit beside the policy-backend baseline with no new apparatus.

Four lessons from #112 are load-bearing and reappear as decisions below: report actions are peeks, not moves; partial application consumes visible binders only; there are two caches because the oracle is the cost center; and children are ordered by remaining obligations. The fifth inheritance is the defect: the old search was disjunctive where obligations are conjunctive.

2. The oracle and its economics

(See also #119, PR #121, and [agda-mcp/agda-mcp-interaction-lane.md].)

Decision. The searcher drives agda-mcp as a client over its public tool contract, from Scala in strux-driver; verdicts come only from the batch lane, knowledge only from the interaction lane, and the boundary is absolute.

  • Batch lane, verdicts. check_file and fill_hole derive success from a one-shot agda process's exit code. This lane is the only judge: probe outcomes, commits, and the final claim all come from it.
  • Interaction lane, knowledge. A persistent agda --interaction-json child answers get_goal and type_of about a loaded file in milliseconds. Knowledge informs proposals and pre-filters; it never decides anything.
  • Consequences, all of them code. The budget is denominated in batch judgments; judgments are memoized; knowledge calls are unbudgeted but ledgered; and any pre-filter cheaper than a judgment that rejects even a small fraction of candidates pays for itself.

Evidence. P0's measurement (#113, run split-m15, 180 oracle calls per pass over the 22 standard-library obligations): oracle calls are effectively 100 % of wall time and proposal is 2.3 ms in total; the agda subprocess is 99.79 % of oracle time and transport plus server handling 0.21 % (about 6 ms per call), which is all an in-process Haskell rewrite could ever recover; each batch call costs 2.6–2.9 s on standard-library fixtures, and the cost is per-spawn import loading rather than checking, since a builtins-only fixture answers in about 0.2 s. P1 added the lane's side: switching the lane to a new file costs about 220 ms and a question about a loaded file 1–3 ms, two to three orders of magnitude below a judgment. At the agda-algebras tier's prices a batch call averages 3.52 s against the flake-pinned library with prebuilt interfaces.

Status. Adopted (P0). The host-language fork the tracking issue posed is closed on evidence rather than taste.

3. The state model

(See also PR #121 and Model.scala.)

Decision. A state is an obligation set, a working-copy content, and a script; solved means the whole set is empty and a final batch check passed; and the model makes the wrong reading unrepresentable rather than merely avoided.

  • Conjunctive by construction. SearchState(content, obligations, script); there is no per-goal success anywhere in the model.
  • Probes are not moves. fill_hole restores the file server-side, so every probe is a peek; ProbeOutcome (what the oracle said) and Move (an action committed to the working copy) are distinct types, and the script has type Vector[Move].
  • States are unforgeable. SearchState and SolvedClaim are sealed abstract case classes with private constructors (the Scala 2 idiom that suppresses the synthetic apply and copy), so a state is born only through initial or commit, and a claim only through fromFinalCheck, which refuses an inhabited obligation set, a failed check, and internally inconsistent evidence (success reported beside a non-zero exit).
  • The obligation set is the oracle's, not ours. Every fill_hole response carries the re-anchored hole list describing the file as that candidate would leave it (issue #79); commit adopts that list wholesale, so client-side hole arithmetic can never drift from Agda's.
  • Two caches, two key types. OracleKey(contentFingerprint, line, col, candidate) memoizes judgments; StateKey(contentFingerprint, script) identifies states for frontier dedup. Conflating them either re-runs Agda or wrongly prunes the frontier (#112's lesson), so they are distinct case classes; the memo is scoped to one fixture's search, the timing ledger to the run.
  • Strict wire decoders. The response fields the search acts on (holes, counts, elapsedMs, context) are required, and counts are cross-checked against lists, so a drifted server shape fails the decode visibly instead of bending ranking or measurement. Every decoder is pinned against responses captured verbatim from the live server.
  • Splice columns are codepoints. Agda counts columns in codepoints and Scala strings index UTF-16 units; on lines carrying astral-plane glyphs (𝑨, 𝒾𝒹, everywhere in agda-algebras and nowhere in the standard-library tier) a naive index refused commits or spliced at a shifted offset. Found and fixed by the agda-algebras tier (#127).

Evidence. ModelSpec pins the two-obligation regression, the probe/move separation, the splice, the key types, and the ranking; SingleStepIntegrationSpec and LoopIntegrationSpec pin the trap against the live server, where every intermediate fill_hole answers ok and the state still refuses the claim; WireSpec pins the decoders on the live captures under src/test/resources/search/.

Status. Adopted (P0); the codepoint fix landed with PR #132.

4. The loop

(See also #122, PR #126, and BeamLoop.scala.)

Decision. Level-synchronous beam search over states, with a budget counted in probes, three distinct termination statuses, and anomalies that redden a run without stopping it.

  • Expansion. Each frontier state is expanded at its first open obligation, a fixed selection policy stated and pinned as a deliberate simplification: because the set is conjunctive and every commit re-anchors from the oracle, selection order affects which proofs are found under budget, never whether a found proof is real. Expansion writes the state's content to the working file, reads the goal, asks the proposer for candidates, peeks each unless it is a closer, and probes the survivors.
  • Children and the beam. Ok probes commit to children; children are deduped against every state ever enqueued, ranked with fewer remaining obligations first, and the best beamWidth become the next level. A probe that closes every obligation is claimed immediately through the final batch gate, since search work after a proof would be budget spent for nothing.
  • Termination is a distinct per-fixture status: solved (the claim was granted), exhausted (the frontier emptied, or the depth bound cut a live frontier, and the outcome says which), or budget_exceeded (the probe budget ran out with work remaining). The distinction is what lets a measurement say "this proposer's space, searched to depth 6 under this beam, holds no proof" rather than "we stopped"; exhaustion is relative to the configured search, since the proposer is incomplete and the beam discards children, and it never establishes that no term-mode proof exists.
  • The budget counts fill_hole probes that miss the memo. Memo hits are free and stay free at the cap, because the loop consults the memo before the budget gate. The baseline check_file, the final strict checks, and the knowledge calls are ledgered but not gated; they are bounded structurally (one get_goal per expansion, expansions at most beam × depth, final checks at most closing probes).
  • Dedup keys on content plus script. Content-only dedup would merge two histories that reach one content, which is safe in principle; the conservative key can never wrongly prune two live states, and measurement found the two identical (§ 9).
  • Defaults: beam 4, depth 6, budget 60, dedup by script, peek on; all tunable on the Make target.
  • Anomalies are loud and non-fatal. A commit the state refuses, a wire drift, or a closing probe whose final check disagrees raises out of that fixture; the sweep continues, every artifact is written (an anomalous fixture keeps its attempt rows, wall clock, and probe counts), and the run exits non-zero. This is inherited from #112's own failure mode: a harness that exits 0 while writing broken rows lets breakage sit silent for months.

Evidence. BeamLoopSpec pins the multi-obligation solve, first-open-obligation order, the budget semantics including a memo hit served at the cap, frontier exhaustion, the depth cap, both dedup policies and the adopted default, and that a beam-cut child does not poison a later path to the same state; LoopHarnessSpec pins what an anomalous fixture keeps. The dedup A/B was measured on the standard-library tier at P1 and re-measured at P2 with hole-free compound candidates present, the stated trigger: identical sweeps both times, zero skips under either key.

Status. Adopted (P1); the dedup decision re-confirmed (P2).

5. The action space and the proposer seam

(See also #122, PR #126, and Propose.scala.)

Decision. Proposals go through one interface, Proposer.propose(state, target, goal), which every phase plugs into; P1's implementation is fixed and non-learned, and the ceiling it implies is stated beside every number it produces.

  • The fixed space, in proposal order: the closers refl and tt; the goal context's assumptions by name; and applications of every name the fixture imports through using lists, one {!!} per remaining visible binder, ordered cheap-before-expensive because the budget can run out mid-expansion. Binder counts come from lane type_of answers through a deliberately small pi-type splitter (arrows at bracket depth 0).
  • Applications are parenthesized, (s≤s {!!}), because a hole is an argument position as often as a right-hand side, and a verbatim splice of s≤s {!!} into a sub-hole reads as s≤s sym {!!}, a different term. The first P1 sweep measured every depth-1 application dying exactly this way.
  • The splitter is a proposal device, not an authority. It reads printed types well enough to count visible binders; the oracle polices what it gets wrong, since an overcount is refused as a type error and an undercount leaves a partial application the goal must then accept.
  • The term-mode ceiling. No case splits and no with means clause-restructuring golds are unreachable by any proposer. On the standard-library tier that is 16 of 22 (13 two-clause inductions, 2 case splits, and one ≡-Reasoning chain whose imports the obligation lacks); the six with expressible single-term golds are exactly the six solves. The agda-algebras tier (#127) was mined for single-term golds so that this ceiling cannot bind it (21 of 21 are term-expressible by construction), which moves the whole gap onto the action space: its using stratum is reachable by the fixed space in principle, and its wholesale stratum is starved of using lists by design, so that uplift there is attributable to retrieval and nothing else.

Evidence. ProposeSpec pins the imports parser, the splitter on live-captured renderings, the proposal order, and the lane-rejection rule; the P1 baseline in § 9 saturates the ceiling exactly.

Agda's own proof search composes around any space (#206). --auto closer wraps the configured proposer: at every expanded state it asks the server's auto tool at the selected obligation before any other proposal, and proposes the term first; --auto hints gives the search, as hint names, the retrieval proposer's accepted lemmas for the goal, after the exclusion. The term is a candidate judged by fill_hole like any other. It skips the type_of peek through one seam method, Proposer.unpeeked(state, target, candidate), whose default is exactly the earlier rule (the two closers): Agda has just typed the term at this goal, and the peek's textual match misjudges terms equal to the goal only up to unfolding, the same reason the closers are exempt (§ 6). The exemption holds at the state and obligation the term was found for and nowhere else; the same text proposed at another goal is peeked like any other candidate (a Copilot catch on #233, where an exemption that outlived its proposal let it through). Off, nothing is wrapped and the report gains no key.

Status. Adopted (P1); the seam survived P2 unchanged, and gained unpeeked with Agda's own search (#206), its default the closers' exemption.

6. The type_of peek

(See also #122, #127, and Propose.scala.)

Decision. Before spending a judgment on a candidate, ask the interaction lane to infer its type at the goal with _ in place of each hole, and skip the judgment when the answer cannot fit. A peek only ever skips a probe, never substitutes for one; any failure to peek keeps the candidate; and the two closers are exempt.

  • What the wire established. Under-determined metas are answered, not errored (sym _ infers _y_8 ≡ _x_7), and bad expressions come back as in-body errors (NotInScope, CannotApply, UnequalTerms) in 1–3 ms. The filter rejects on a lane error, or when the inferred type cannot textually match the goal display with every meta read as a wildcard and the same meta as the same wildcard, so refl's _x_9 ≡ _x_9 is rejected at m + n ≡ n + m and kept at n ≡ n.
  • One canonicalization. Agda folds closed naturals to numerals in goal displays (1 ≤ suc n) but a meta blocks the folding in inferred types (suc _m_5 ≤ suc _n_6), so small numerals are expanded to suc towers before comparison; without it the peek falsely rejects (s≤s {!!}) and costs a solve.
  • Default and exemption. Opt-in through P1; default ON since P2 re-validated it on retrieval candidates. The closers are exempt since #127: on agda-algebras goals whose two sides are definitionally equal but textually distinct (lift ∘ lower ≡ 𝑖𝑑 (Lift b A) closes by refl) the textual test rejects a correct closer, and a closer's probe costs no more than its peek. Only the closers: exempting every hole-free candidate re-probed the context assumptions at every expansion and gave the peek's entire savings back.

Evidence. P1, the same six solves with byte-identical scripts: probes 435 → 50 (−88.5 %), batch oracle time 1227 s → 209 s, wall 21.5 min → 4.7 min (4.5×), probe precision 6.7 % → 70 %, and the budget-burners converted to honest depth-capped exhaustion (plus-comm from 60 probes to 6). P2, post-review: two budget-ordering losses recovered (4/22 → 6/22), 3,734 of 4,262 judgments skipped, zero solves lost. The agda-algebras tier: the P1 policy lost lift∼lower (1/21 against the peek-off control's 2/21); with the closers exempt the peek keeps 2/21 at a 5.5× probe and 3.9× wall advantage over the control (119 probes and 745 s against 651 and 2,911 s), while exempting all hole-free candidates measured 833 probes and 3,086 s, within noise of no peek at all.

Status. Adopted (P1); default flipped (P2); closers exempt (PR #132).

7. Retrieval proposals

(See also #123, PR #130, Retrieve.scala, and § 6.2 of [proof-search/overview.md].)

Decision. Retrieval widens what is proposed, not how anything is judged: a RetrievalProposer behind the same seam, composed around the fixed space, whose candidate pool is scoped to what the fixture can name, purged of the answer key, ranked by a replaceable scorer, and rendered into three candidate shapes.

  • Composition. The fixed space stays (it carries the constructors the corpus does not row), so the P2 space is a superset of P1's by construction and any measured delta is attributable to retrieval.
  • Scope. A candidate must resolve in the fixture's module, and open import M using (xs) still grants qualified access to all of M (verified against the pinned toolchain), so the legal pool is every corpus row whose module the fixture imports or whose module extends an imported one at a dot boundary. A whole-module open import M enters the scope with no lemma names, which is what the wholesale stratum depends on. Renderings walk a ladder (bare when using-listed, the row's qualified name, the importing module qualifying the bare name) and the lane arbitrates: the first rendering type_of can type wins, a name the lane cannot type stays out, and the cut to the top eight lemmas is taken after resolution, so a rejected rendering does not consume a slot. Widening a fixture's import surface (committing import lines as moves) is out of scope: a new move vocabulary, and a change to what the benchmark states.
  • Target exclusion. Every standard-library obligation is a standard-library lemma, and a wholesale-stratum obligation opens the module holding its original, so the corpus contains the answers. A row whose bare name equals the hole's name is excluded (record-field projections of the target included), and so is a row whose statement normalizes to the target's, compared on the lane's own printing of both; a differently stated but convertible lemma stays in, because using it is a real proof step. Exclusions are named per fixture in report.json, and the policy has one labeled off switch, --exclude-target off, for the mechanism-control sweep only, so a null headline is distinguishable from broken machinery.
  • Ranking is deterministic and selected by name (--scorer, PROOF_SEARCH_SCORER); ties break cheap-before-expensive on approximate arity and then on the name. The default, token-overlap, is the placeholder every published sweep ranked with: token overlap between the goal display and the corpus type (corpus tokens reduced to bare segments), a name bonus capped at one, a penalty for operators the goal never mentions (without it the + goal ranks the *-and-+ semiring bundles above the + lemmas). It stays the default so those numbers reproduce. The stronger idf-unfold (#19, § 9) reduces both sides to bare tokens and fragments, weights shared units by inverse document frequency over the pool being ranked, counts the conclusion twice, scores the units of the row's own name under the same weights, unfolds the definitions a row's type names through their corpus bodies for three steps, normalizes by the row's own weight, and adds the overlap between the row's premises and the hypotheses' types. The scorer is its own interface, CandidateScorer, handed the whole pool and a query of goal and hypothesis tokens (RankQuery); premise-selection scores replace it and nothing else moves. The pool pipeline before ranking (RetrievalPool) is one function shared with the offline recall instrument (RetrievalRecall.scala), so ranking is measured in seconds on recorded goals, never only through a loop-hour.
  • Three candidate shapes per lemma: the hole-free _-form ((+-comm _ _), one probe when unification solves the arguments), argument-saturated forms over the goal context's assumptions (every tuple, arity at most 3 and at most 27 tuples), and the {!!}-refinement form. The saturated forms are forced by a wire fact this phase probed and pinned (captures wire-fill-hole-blocked-{subholes,metas}.json): fill_hole refuses a candidate whose sub-holes or metas carry blocked constraints, so (+-comm {!!} {!!}) at m + n ≡ n + m is a type_error, and the alias-stated equational class can only ever be committed fully applied. Binder counts still come from the lane, which expands alias types on qualified names (Data.Nat.Properties.+-comm infers (x y : ℕ) → x + y ≡ y + x); the corpus type string ranks, never counts.
  • The honesty ledger. Every cut is counted and every exclusion named, per fixture, in report.json, so the report alone distinguishes a gamed run from a fair one.

Evidence. RetrieveSpec, on a canned corpus of real extraction rows, pins scope, both exclusion rules and the off switch, ranking determinism and each shakedown lesson, the rendering ladder, the shapes and their bounds, the post-resolution cut, and the ledger; RetrievalIntegrationSpec drives the real server with --corpus. The two review rounds on PR #130 found three defects that had shaped the first published sweeps (the top-eight cut fell before lane resolution, whole-module imports never entered the scope, and the statement exclusion compared notations that never agree on real data); all three are fixed and pinned, and § 9 quotes the re-measured record.

The name rule sees through a renaming prime (#206). An obligation whose fixture opens its original is renamed to live beside it, by appending a prime: 18 of the 21 agda-algebras obligations are X′ for an original X. Compared exactly, the name rule fired on none of them, and the lane-form statement rule caught one original, since an obligation that makes its original's implicit binders explicit prints a different statement. Retrieval's shapes never committed an original, so the gap stayed latent until --auto hints handed the accepted pool to Agda's own search, which closed algebras-inverses-image-f-f by citing Imagef∋f. The rule now also compares the hole's stem, its name less trailing primes. It errs toward excluding, the safe side for an anti-gaming rule, and every exclusion is still named; its one known false shape, a library lemma whose own name ends in a prime (stdlib-dec-map's map′), is reached by no measured run. The recall instrument shares the rule, and none of its published figures moves (§ 9).

Status. Adopted (P2); #123 closed with the stage-two measurement. The name rule compares the hole's stem since #206.

8. Reporting: one schema for every phase

(See also LoopHarness.scala and § 8 of [proof-search/overview.md].)

Decision. Every run writes the shared evaluation schema, so search results sit beside the policy-backend evaluator's with no private format. A run directory holds the following.

file one row or entry per contents
results.jsonl judged candidate an eval-proof-completion.v0 attempt row: fixtureId, benchmarkId, the hole's position, candidateRank, candidate, status in fill_hole's own vocabulary, rc, the client-observed elapsedMs, logPath
fixtures.jsonl fixture the eval-proof-completion.v0 summary row (holesTotal, holesSolved, fullySolved, solvedPath) plus the additive searchStatus
timing.jsonl oracle call, and one per proposal the proof-search-timing.v0 ledger: phase, clientMs, serverElapsedMs, overheadMs, checkedFromSource, cached
report.json run the config, the corpus provenance for retrieval runs, per-tier and per-stratum solve counts (perTier, perStratum), the batch/knowledge/retrieval/proposal split, and per-fixture outcomes with scripts, counters, and the retrieval honesty ledger
solved/ solved fixture the typecheckable module with the proof spliced in

Two ledger conventions keep the split honest: a memo hit is a row with cached: true and no server time, so saved calls never count as oracle time; and a proposal row carries the proposer's own time with any oracle calls it made through the seam subtracted, since the ledger already holds those.

Evidence. #113's acceptance ("no private formats"); the rows are consumed by the existing ETL unchanged.

Status. Adopted (P0/P1); the retrieval phase and the provenance block added at P2.

9. Where it stands: the numbers

A reader's guide to the tables in this section, naming which instrument produced each number, defining the words the tables use, and stating for each number what it is a win or a loss for, is [docs/reading-the-results.md]; the loop's columns in the agent table below are a different instrument from the agents', not their baseline, and that guide is where the distinction is drawn.

Every sweep below used the same knobs (beam 4, depth 6, probe budget 60, dedup by script), ran serially against one server on an otherwise quiet machine, and reported zero anomalies; run identifiers and the full tables are in #113's comments.

P0 (#113, the measurement that settled the fork). 180 oracle calls per pass at 2.6–2.9 s each; 99.79 % of oracle time in the agda subprocess, 0.21 % transport; proposal 2.3 ms in total; 4 of 22 solved by the six-candidate stub.

P1 (#122, PR #126; the standard-library tier).

configuration solved probes wall
baseline (dedup by script, no peek) 6/22: routine 6/7, compositional 0/10, non-obvious 0/5 435 21.5 min
dedup content-only, no peek identical to the baseline, per fixture 435 21.6 min
dedup by script, peek on 6/22, byte-identical scripts 50 4.7 min

The six proofs: refl three times, tt once, (_,_ {!!} {!!}) ; a ; b at depth 2, and (s≤s {!!}) ; z≤n at depth 1; the last two are what the loop adds over P0's single step. Four fixtures exhausted the budget without the peek, all of them chains that refine forever without progress (sym-flipping on plus-comm, mul-comm, and mul-distrib-r; id-wrapping on list-map-id); with the peek they become honest depth-capped exhaustion. Decisions taken from these numbers: dedup stays script-inclusive; the peek is a validated cost lever; and the baseline every later phase must beat is 6/22.

The 43-obligation suite (#127, PR #132; the fixed space with the peek on and the closers exempt; run run-127-repin-full-peek-on-1, byte-stable across four reproductions).

library and tier solved probes wall
stdlib routine 6/7 22 116 s
stdlib compositional 0/10 65 239 s
stdlib non-obvious 0/5 50 173 s
agda-algebras routine 2/6 11 73 s
agda-algebras compositional 0/10 43 293 s
agda-algebras non-obvious 0/5 65 402 s

8/43 in 21 m 39 s: the stdlib rows reproduce the P1 baseline exactly, and the two agda-algebras solves (lift∼lower, lower∼lift) are refl in one probe each. By stratum, using 2/11 and wholesale 0/10, the wholesale zero being the intended control surface for retrieval. Economics at this pin: 307 batch calls in 1,080.7 s (3.52 s average), 1,411 knowledge calls in 214.1 s, and 1,039 peeks skipping 946 probes.

P2, stage one (#123, PR #130; the standard-library tier, retrieval composed around the fixed space, top eight lemmas per goal, exclusion on unless stated). Measured twice: at the initial code, and re-measured after the review fixes changed the real pool composition. The table is the post-fix record (runs p2fix-{a,b,c,d}); those wall clocks ran on a loaded machine, so probe counts are the comparable column.

configuration solved probes
A: retrieval, no peek 4/22, the P1 set minus prod-mk-pair and zero-lt-suc (17 of 22 fixtures exhaust the budget against full eight-lemma pools) 1,064
B: retrieval, peek on 6/22, the P1 set with identical scripts 526
C: A with content-only dedup identical to A, probe for probe; zero skips either way 1,064
D: A with exclusion off (the labeled control) 9/22, A's four plus all five admissible targets, each a one-shot saturated application 943

The reading: the suite's term-mode ceiling binds any term-mode proposer. Retrieval widened the legal pool from using-list handfuls to thousands of in-scope rows (plus-comm alone draws 22,610 raw hits and 4,012 in-scope rows) and still adds zero solves under exclusion, while the control commits every needle the exclusion had removed, in both measurement rounds. The oracle-dominance split holds at this scale: on sweep A, batch oracle 3,019 s against retrieval 7.9 s plus knowledge 66.5 s.

P2, stage two (#123; the whole suite with the agda-algebras v0.1 corpus, digest-verified; runs p2s2-{a,b,c}, 2026-09-08).

sweep stdlib agda-algebras using agda-algebras wholesale total
A: retrieval, peek on, exclusion on 6/22 (137 probes) 2/11 0/10 8/43
B: fixed space (the attribution control) 6/22 (137 probes) 2/11 0/10 8/43
C: retrieval, exclusion off (the labeled control) 6/22 (137 probes) 2/11 1/10 9/43

Three findings. The mechanism is proven on this corpus: the control's one new solve is a wholesale needle committed end to end, algebras-inverses-range-to-image closed by (Setoid.Functions.IsInRange→IsInImage w), retrieved from a 79-row in-scope pool, ranked in the top three, rendered through the qualified rung of the ladder, saturated with the context assumption, and committed in five probes. Zero uplift under exclusion, and this time the binding constraint is measured to be ranking at scale rather than the move vocabulary: wholesale opens flood the legal pools (up to 24,566 raw hits and 3,025 in-scope rows on one fixture, against using-stratum pools of 16–79), the token-overlap ranker drowns the targets under the library's generic projections (Overture.ℓ₁, ∣_∣, ∥_∥, 𝑖𝑑), and eight fixtures burn the full budget on ranked-but-wrong candidates. And the measurement existed at all because of the review round: every wholesale pool flows through the whole-module scope fix, without which this sweep would have reported a false zero.

The haystack tier (#129, [M2-11]; twelve standard-library obligations whose golds apply one lemma that the fixture imports but does not using-list, so the needle is never the answer key; runs hay-fixed-final and hay-retrieval-final, retrieve-k 8, exclusion on, 2026-09-10; other work ran on the machine, so probe counts are the comparable column, and every number reproduced across two sweeps).

tier fixed space retrieval, exclusion on probes (retrieval)
routine 0/3 2/3 13
compositional 0/5 4/5 64
non-obvious 0/4 0/4 240
total 0/12 (30 probes, every row exhausted at depth 0) 6/12 317

The first solves under target exclusion: six needles committed as one saturated application each ((Data.Nat.Properties.+-mono-≤ le le), (Data.Bool.Properties.∧-distribˡ-∨ a a b), …) in 3 to 9 probes, with the exclusion ledger empty on every row, so each is attributable to retrieval by construction. The six nulls each pin one limitation of the placeholder pipeline, with a fixture built so that nothing else can explain it: a renamed re-export splits the vocabulary (∸ in the display, Agda.Builtin.Nat.- in the corpus); display normalization hides the needle's notation (m < n displays as suc m ≤ n, so +-mono-< carries a misfit token); the ranker reads the goal display and never the hypothesis (three rows); the peek rejects a candidate whose inferred type keeps a trailing implicit binder (length-++, ranked first, a one-probe proof by fill_hole, never probed); and the cheap-arity tie-break reads arity off the corpus string, where alias-stated rows look nullary. Widening the cut to 32 (hay-retrieval-k32) reproduces the solve set and the 317 probes exactly for 2.3 times the peeks, and no missing needle enters the top 32, so on this tier the cut is not the bottleneck. One rule the measurement forced onto the tier: a fixture binds every hypothesis in its clause, since the proposer saturates every visible binder and a Π-typed goal could only be closed by a partial application, outside the three shapes.

Ranking at scale (#19, [M2-5]; the offline recall instrument over the agda-algebras tier, 2026-09-10, re-measured on 2026-09-15 after PR #152's review). The ground truth is in the index: every agda-algebras row carries a restates: tag (the library original it was mined from) and target: tags (the lemmas its gold applies), 21 and 33 names. The instrument replays the retrieval pool pipeline over the goal displays and contexts recorded by run ctx-probe-1 (a budget-1 retrieval loop, whose ledger it reproduces on every fixture: pool counts exactly, and the accepted-lemma order once lane rejections are removed) and ranks each pool with a named scorer. Fair targets are measured in the pool with exclusion on; originals in the unexcluded pool, the regime the exclusion-off control depends on. Two findings precede the table. The published stage-two ledgers sum inScope over every goal a search visited, so the "3,025-row pool" is a cumulative count; a root goal's legal pool on this tier is 15 to 1,118 function rows. And the placeholder's failure had a cause that no IDF weighting touches: goal displays carry qualified tokens (Setoid.Homomorphisms.Basic.IsHom) while the scorer bare-reduced only the corpus side, so nothing matched, the whole pool tied at zero, and the arity tie-break handed the top eight to nullary generics (ℓ₁, ∣_∣, ∥_∥).

scorer (run recall-ctx1-r2) targets in top 8 targets in top 32 originals in top 8 originals in top 32
token-overlap (the placeholder) 1/33 3/33 5/21 7/21
bare-overlap (both sides bare) 3/33 5/33 8/21 8/21
idf (IDF over the pool, bare tokens) 1/33 2/33 8/21 8/21
idf-norm (fragments, conclusion, name, cosine) 1/33 5/33 8/21 10/21
idf-unfold3-norm (plus three unfolding steps) 4/33 11/33 11/21 19/21
idf-unfold (plus the hypotheses) 9/33 12/33 12/21 20/21

Each rule of idf-unfold is kept because removing it alone costs top-eight recall: no fragments 8/33, no conclusion weight 5/33, no name 7/33, no hypotheses 4/33, no norm 4/33, no unfolding 4/33; unfolding depth two 8/33. The name rule has a history worth recording. The first measurement dropped it as neutral on fair targets, but that measurement was confounded: at weight zero the name's units still entered the frequencies and the norm, a defect PR #152's review found; on the clean semantics the rule earns two fair targets at eight and costs two originals, and the fair regime decides, so it stays. The two rules that carry the tier were not among the listed hypotheses: unfolding, because the interaction lane prints goals normalized while lemma types are stated in the library's aliases, and the hypotheses, because the lemmas that conclude hom 𝑨 𝑩 (𝒾𝒹, mon→hom, epi→hom, _≅_.to, HomReduct) differ only in what they assume. What no deterministic rule reaches, by name: the targets outside the corpus (Setoid.refl three times, Setoid.sym, Function.Base._∘_ twice, id; seven rows), the constructors the defKind filter never proposes (eq twice, mkIsHom, mkcon; four rows), the pair and nested-application golds no candidate shape can commit whatever their rank (⊙-hom … , ⊙-injective …, epi→hom 𝑨 (𝑨 ╱ θ) (πepi h θ), IsMon.HomReduct (proj₂ m)), and, within ranking itself, the generic projections that are themselves needles (𝑖𝑑 on homs-id-hom falls from 2 to 161 under idf-unfold, _⊙_ on comp-hom from 35 to 204, kerRel on ker-con from 13 to 942: short, symbol-free types that the placeholder's misfit penalty favored and that IDF has no reason to) and the hom-concluding neighborhood the scorer cannot order further (⊙-injective at 84 and 91, ≅-sym at 37, ≅toInjective at 50). That last residue is the demand curve for a learned ranker.

The two recorded knob experiments (#19; wholesale stratum, the placeholder scorer, exclusion on, runs k19-wholesale-{k8,k16,k32,b120}, 2026-09-10; development work ran alongside, so probe counts are the comparable column). The control reproduces p2s2-a on all ten fixtures (status, probes, peeks, and accepted lemmas identical), and neither knob moves a solve, as the instrument predicted: no fair target of the stratum sits within the placeholder's top 32.

run retrieve-k budget solved probes peeks
k19-wholesale-k8 (control) 8 60 0/10 364 3,097
k19-wholesale-k16 16 60 0/10 369 4,330
k19-wholesale-k32 32 60 0/10 401 4,939
k19-wholesale-b120 8 120 0/10 664 5,207

The wider cuts admit the same generic projections deeper down the ranking at 40 % and 60 % more peeks; the doubled budget lets the six budget-bound fixtures run to 120 probes and depth 5 without one new commit. The wholesale zero is a ranking zero, not an economics zero; the knobs stay at 8 and 60.

The idf-unfold sweeps (#19; all 43 obligations, the standing knobs, exclusion on and then off, runs k19r2-idf-unfold-{a,b}, quiet machine, zero anomalies, 2026-09-15; they re-run the 2026-09-10 sweeps with the scorer as corrected by PR #152's review, and reproduce their solve set). The stdlib rows, which retrieve from no corpus in these runs, reproduce the frozen baseline field for field (every status, probe count, and script as in p2s2-a; 6/22, 137 probes).

sweep stdlib agda-algebras using agda-algebras wholesale total probes peeks wall
p2s2-a: token-overlap, exclusion on 6/22 2/11 0/10 8/43 723 5,695 3,917 s
A: idf-unfold, exclusion on 6/22 3/11 0/10 9/43 492 3,675 2,573 s
B: idf-unfold, exclusion off (control) 6/22 3/11 1/10 10/43 496 3,659 2,576 s

The first fair retrieval solve on the agda-algebras tier under exclusion: surjinv-inverse-r by (InvIsInverseʳ fE) in five probes, the lemma the placeholder ranked 60th and idf-unfold ranks first, in retrieval's saturated shape (the fixed space's (InvIsInverseʳ {!!}) is refused on a blocked sub-hole). The lane-form exclusion fired for the first time on this tier's originals (three, two on wholesale rows and one on a using row, none a fair target) because the new ranking put them in the resolved prefix; 492 probes against 723 because better-ranked pools exhaust sooner. The control adds only the needle the placeholder's control added; the originals now ranked first or second and accepted (lift∼lower, 𝒾𝒹, mon→hom) are stopped, verified on the wire, by the peek's textual match (an η-expanded record, retained implicit binders) or by the shapes (an implicit argument, the saturation cap), and sup-trans with ≤-trans accepted sixth is stopped the same way. The mechanism's ceiling has moved off the ranker; those are the levers handed on.

The agent in the loop

(See also #154, #83, [docs/mcp-field-reports.md], and [reports/agent-bench/README.md].)

The terms. A subject is one fresh, non-interactive Claude Code session (claude -p) given a staged copy of one obligation, the thirteen agda-mcp tools with the row's library corpus loaded, and Read and Edit on that one file, under a turn cap, a cost cap, and a wall cap. An arm is one model over the whole suite, one subject per obligation. The judge decides what the file the subject leaves behind earned, and every fact it uses about Agda code is Agda's own answer, asked through the server and the extractor: preservation is the module line and every original import line still present (a line diff, comments aside; added import lines allowed and logged) and the definition still of the statement it was given: its elaborated type as Agda holds it internally, extracted by agda-strux as a structural AST (typeAst), equal to the committed gold's, which is the obligation with the hole filled and so the statement by construction (binder names aside; nothing is printed or parsed); escape is check_file under --safe reporting none of Agda's refusals (SafeFlagPostulate, SafeFlagTerminating, SafeFlagPragma, SafeFlagNoPositivityCheck, CoInfectiveImport for an unsafe module such as TrustMe); holes is check_file's hole list empty; typecheck is the gold verifier's own agda invocation with --safe added, exit-code verdict, with check_file's exit code recorded beside it (a failure is named in the order frozen text, escape, holes, statement, verdict, the statement being asked only of a file Agda could type). A file that passes every gate but whose definition refers to the library's own lemma for the statement it was asked to prove is restated: its own column, never counted as solved, the agent-side twin of the loop's target exclusion. The reference is read off Agda's internal terms by agda-strux (the bodyRefs field: every Def and Con head in the clause bodies, closed over the file's own helpers) and compared with the original, which is the index row's restates: tag (PR #152's qualified corpus name) where the row has one and the index's module and the fixture's prime-stripped name otherwise; the haystack tier has no original by construction. Beyond that line diff the judge reads no Agda code: the arms were first judged by a textual reading (a signature block matched byte for byte, postulate and hole tokens found by a lexer, the original's name found among the body's tokens), and re-judged under the Agda-backed gates to the same verdict on every row.

Decision. The agent is measured as a second instrument beside the loop, under the loop's verifier and in the loop's report shape, with isolation verified from each transcript rather than assumed, and with a restated column that keeps a looked-up lemma out of the solve count.

  • Same verifier, same suite, same shape, Agda's own classification. The judge's agda command is GoldVerifier's, so an agent's solve and a loop's solve mean one thing, and the gate a failed file is named by is Agda's (its safe-flag code, its hole list, its elaborated type of the definition, its internal references), never a reading of the text; the report is the loop's (perTier, perStratum, one outcome per obligation) plus per-tool call counts, turns, wall, cost, and tokens; results.jsonl holds one eval-proof-completion.v0 row per fill_hole the subject probed.
  • Isolation is measured. The client presents no settings and no CLAUDE.md (--setting-sources "", verified with a canary), the tools eagerly with their descriptions (verified on the on-disk session transcript, the #83 run-1 lesson), exactly Read, Edit, and the thirteen tools, confined to the work directory; every transcript is audited for the tools used and the paths read or edited, and a subject whose server never connected, whose tools arrived deferred, or which was presented a tool beyond those fifteen is an anomaly, not a row.
  • Turns and tool calls are the comparable columns. Subjects ran three at a time, so wall clocks are indicative only; the client's list-price cost is recorded per subject.
  • The standard-library rows measure memory. Their statements are standard-library lemmas in every model's training data, and their using lists hand the subject the key lemmas; the wholesale and haystack rows are where the subject has to find something with the tools.

Evidence. Runs agent-sonnet5-1 (claude-sonnet-5) and agent-opus5-1 (claude-opus-5), 2026-09-15, Claude Code 2.1.261, 30 turns, 900 s, and USD 3.00 per subject, parallelism 3, the stdlib v0 corpus (14e0d47e) for standard-library rows and the agda-algebras v0.1 corpus (af864432) for the others; zero anomalies in either arm; every subject ended on its own (no cap reached). Loop columns are the fixed space and retrieval under exclusion on main (the composed 8 of 55 and 14 of 55 above). The subjects' servers of these runs ran without --safe, which the judge applied; no final file carries a safe-flag refusal and every subject's last check_file verdict agrees with the judge's, so no verdict depends on it, and the harness now gives the subjects' servers the judge's flags and records each run's protocol before the first subject spawns. Every subject had its fixture's header in view, and until #219 the headers carried hints (a Strategy: line on every row, the haystack tier's Needle: line); the header-free re-run is below.

The agent table, 2026-09-15, fixture headers' hints in view.

stratum n loop fixed loop retrieval Sonnet 5 solved Sonnet 5 restated Opus 5 solved Opus 5 restated
agda-stdlib 22 6 6 21 0 22 0
agda-stdlib/haystack 12 0 6 12 0 12 0
agda-algebras/using 11 2 2 9 2 11 0
agda-algebras/wholesale 10 0 0 4 6 9 1
total 55 8 14 46 8 54 1

By tier (Sonnet, Opus): routine 15 and 16 of 16, compositional 20 and 24 of 25, non-obvious 11 and 14 of 14. Sonnet's one row that is neither solved nor restated (stdlib-nat-mul-comm) failed the preservation gate by appending ; trans to an original using list instead of adding an import line; the file type-checks under --safe, and the gate is the protocol's, so the row stays unsolved and the fact is recorded. Per arm: Sonnet 327 turns, 272 tool calls, USD 4.62; Opus 325 turns, 270 tool calls, USD 9.14. A second Opus seed (agent-opus5-2) solves the same 54 rows and restates the same one, with 44 of 55 final files byte-identical to the first seed's, at 338 turns, 283 tool calls, and USD 9.46: on this suite the model's variance is in the path, not the solve set. Per tool, Sonnet then Opus: check_file 56 and 55, type_of 24 and 21, fill_hole 12 and 41, get_goal 10 and 17, search_by_name 15 and 8, definition_of 13 and 4, exports_of 12 and 4, get_dependencies 4 and 2, search_by_type 2 and 1, normalize 0 and 3, resolve_name 0 and 1, get_diagnostics and check_project never. Three readings.

  • The restated column is where the arms differ. Sonnet's eight restatements are all agda-algebras rows, six of them wholesale: it queries exports_of or search_by_name, finds the library's mon→hom, kercon, ⊙-injective, and writes mon→hom′ m = mon→hom _ _ m. Opus finds the same names and mostly does not use them: on kercon′ it builds the congruence from kerRel, mkcon, and HomKerComp under a where block after four type_of queries and one fill_hole probe; on ≤-trans-≅′ it composes ⊙-hom and ⊙-injective with ≅toInjective in 17 turns after an exports_of on a module that was not in scope and a type_of whose NotInScope answer carried the right name as a suggestion. Its one restatement (mon→hom′) is a row it had proved honestly in the cost pair an hour earlier (IsMon.HomReduct (proj₂ m)), so the column also measures run-to-run variance.
  • The haystack tier is not a haystack for a model. Both arms solve all twelve, Sonnet eleven of them in four turns (Read, Edit, check_file) and Opus five, naming the needle qualified from memory; over the 34 standard-library rows of both tiers Sonnet made three queries besides the final check (type_of) and Opus thirteen (fill_hole probes before the edit); the row the loop's ranker could not reach because the corpus prints ∸ as - is solved by Sonnet with one type_of on the needle's qualified name. The tier measures a ranker; it does not measure a model.
  • What the tools are missing, from the transcripts. Thirteen definition_of calls in the Sonnet arm were followed by eleven attempts to Read the library source they named, all refused by the confinement (two in the Opus arm); the tool answers where a definition is, not what it says. get_dependencies refused bare names (kercon); get_goal and fill_hole were called at guessed columns six times in the Sonnet arm and nine in the Opus arm, and answered with the nearest holes; exports_of on a module the file had not opened answered NotInScope. None of these cost a solve, and each is a Milestone 5 item.

Status. Adopted and measured (#154); the harness is struxdriver.agentbench (make agent-bench), its judge's rules pinned by JudgeSpec on Agda's answer shapes and on extractor rows captured from archived files, its live gates by AgentBenchIntegrationSpec against the server, agda, and agda-json (a gold solved; a hole, a weakened statement, an edited import, a postulate, a wrong proof, and a restatement each named), its transcript reader by TranscriptSpec on a captured stream; the transcripts, verdicts, and final files of every quoted run are under [reports/agent-bench/README.md]. The arms were judged before #152 merged, by the textual judge; every archived row re-judged under the Agda-backed gates and the restates: tags reaches the same verdict, and the archive holds the re-judged verdicts.

The attribution arms: what the server is worth

(See also #162, #83, #17, and [reports/agent-bench/README.md].)

Every subject of § 9's arms had the server and nothing else, so those numbers say what a frontier model does with the instrument and nothing about what it does without it, and the obvious objection, that an agent can run the pinned agda itself, was unanswered; #83 was designed around the question and its control arm was never run. An arm is now one instrument: shell gives the subject Bash with the pinned agda on PATH, mcp gives it the server, both gives it both.

Decision. The server is measured against its own control, on the same suite, prompts, caps, and judge, with one symmetric change and one new confinement.

  • One symmetric change: the libraries' own sources are readable on every arm (the registry's library roots and source roots and the Agda registry directory, reached by --add-dir), because the archived arm refused eleven such reads for Sonnet as a confinement side effect and a shell arm that can cat a module while the server arm cannot would confound the comparison.
  • The shell arms are confined by audit, because the client cannot confine Bash. --restricted keeps Bash whenever --tools names it, so it stays on every arm for what it does give (the file tools confined, the settings files ignored), and the paths each Bash command names are read afterwards: a command the reader cannot account for is a violation, never a pass. The confinement is therefore post-hoc: a row whose commands left the roots is not a result and its outcome.json names the command.
  • The both arm is not a tie-breaker but the measurement, through two columns the report gains: via per row (which instruments the subject used) and verdictVia (which gave it its last verdict), with the run's Bash calls counted by class.
  • The judge does not change, and neither does the report shape; a run id is one arm, recorded in protocol.json and in each subject's own subject.json with the roots it was given, so a re-judge audits a run under the arm it ran with.

Evidence. Runs arm162-shell-1, arm162-mcp-1, arm162-both-1 (claude-sonnet-5, 2026-09-21, Claude Code 2.1.261, one arm at a time at one protocol version, 30 turns, 900 s and USD 3.00 per subject, parallelism 3, the same two corpora); zero anomalies in all three; USD 12.41 together. The fixture headers' hints were in view on every arm; the header-free re-run is below.

The attribution table, 2026-09-21, fixture headers' hints in view.

stratum n archive mcp shell mcp both
agda-stdlib 22 21 solved 20 solved 21 solved 20 solved
agda-stdlib/haystack 12 12 solved 12 solved 12 solved 12 solved
agda-algebras/using 11 9 solved, 2 restated 9 solved 9 solved, 1 restated 11 solved
agda-algebras/wholesale 10 4 solved, 6 restated 9 solved 5 solved, 5 restated 8 solved, 2 restated
total 55 46 solved, 8 restated 50 solved, 0 restated 47 solved, 6 restated 51 solved, 2 restated

Turns and tool calls are the comparable columns (308, 342, 327 and 253, 287, 272; subjects ran three at a time). Four readings.

  • The control does not merely match the server arm; it beats it, and restates nothing. The difference sits where § 9 predicted a difference would sit, the agda-algebras/wholesale stratum and the restated column, with the sign reversed: 9 of 10 and none restated, against 5 and 5. The judge's original column (#188), added after the fact, qualifies both halves: the shell arm had the restated lemma's own proof in view before its last edit for 15 of its 18 agda-algebras solves and the mcp arm for 4 of its 14, so on these rows the win and the zero measure access to the library's text as much as the instrument ([docs/reading-the-results.md] § 4.3).
  • The both arm says what the server is for. Offered both, the subject took all 55 verdicts from check_file and ran agda on the shell not once, while using Bash 65 times, every call a library-source read. The knowledge tools collapse beside a shell and the verdict tool does not move: definition_of 19 calls in the mcp arm and 0 in the both arm, search_by_name 18 and 1, exports_of 11 and 2, type_of 34 and 11, check_file 56 and 57.
  • The mechanism is searching, not reading. Every arm could read the library's sources; the shell arm consulted them 82 times and the mcp arm 13, because grep over a tree needs no prior knowledge of where a thing is, while definition_of answers where a definition is and not what it says (§ 9's own finding), leaving Read to be pointed at a file the subject must already have named. On algebras-homs-mon-to-hom the server arms cite the original (mon→hom′ m = mon→hom _ _ m) and the shell arm, with the library's proof in view, writes mon→hom′ m = IsMon.HomReduct (proj₂ m), which is the library's own mon→hom h = IsMon.HomReduct (proj₂ h) and also the term Opus wrote on that row in § 9's cost pair with no read of the library, so an identical body alone shows no copying; the judge's original column (#188) records the proof in view, not what was written from it.
  • Nobody used the protocol, and nobody read the corpus. Both shell-bearing arms were told in one sentence that agda --interaction-json exists and were given their row's corpus path; across 200 Bash calls the classes are agda-batch 56, library-read 141, other 3, agda-interaction 0, and corpus-grep 0. The strongest possible test of the claim is that a frontier model does not reach for the protocol the server encodes, which argues for the batch lane rather than against it; and the extracted corpus is a retrieval substrate, not something an agent reads.

Two qualifications the numbers carry. Five rows across the two shell-bearing arms failed the isolation gate, and every one of those files type-checks with its statement preserved and no restatement evidence, so 50 and 51 are lower bounds and the files earned 54 and 52; three of the five are subjects hunting for Agda's own primitive modules (Agda.Builtin.*, which ship in Agda's data directory and belong to no registered library, so no read root contains them) by searching the filesystem, and two are the audit refusing xargs, which takes its paths from standard input and so names none the reader can account for. Neither was changed while the comparison ran, because one audit across three arms is what makes them comparable. And the mcp arm re-run reproduces the archive: 7 of 55 rows differ and they cancel, to 47 and 6 against 46 and 8, inside the variance the two Opus seeds already document, so the three protocol differences from the archive moved nothing measurable (the fourteenth tool search_in_scope from PR #161, presented on every server-arm subject and called zero times; the readable library sources; the subjects' servers carrying the judge's --safe).

Status. Adopted and measured (#162). ADR 0002 § 12's honest pattern stands and is sharpened: the server's value on this suite is the verdict, which is latency and a structured answer, and which the both arm shows an agent will not give up; its retrieval and knowledge surface is not merely reproducible by a shell but worse than one here, and that gap is worth six restatements. The work it points at is #17, retrieval as server tools, whose first rung is the thing a shell does best and the server cannot do at all, searching the library's own sources. Open: the read roots omit Agda's primitive sources, and the audit does not model xargs; both are recorded on #162 and cost no sweep to fix, since a re-judge re-audits every arm. Opus arms are not run, since Opus is at 54 of 55 with the server and its control could only move the restated column and the cost.

The header-free arms (2026-09-29)

(See also #219, #220, #221, [reports/agent-bench/README.md], and [docs/reading-the-results.md] § 4.6.)

The two tables above were measured with the fixture headers' hints in view. A subject works on a byte-for-byte copy of its obligation, and until #219 each obligation's header carried a Strategy: line sketching the proof, the haystack tier's a Needle: line naming the lemma the tier asks a searcher to find, and the mined tiers' a Source: line naming the module that holds the original. Neither the loop nor the judge reads comments, so no loop number and no archived verdict moves; what the headers changed is what a subject was told. They are now stripped from every tier (#220, #221), each tier's README keeps what they said, and the four arms behind the two tables were run again without them.

Decision. Every agent number is measured on fixtures whose headers carry no hints, and the dated tables above stay as the evidence they were.

  • A fixture's header names the file and the obligation, and nothing else: no Source:, Strategy:, Haystack:, Needle:, or Note: line, which FixtureHeadersSpec asserts over every index row.
  • The re-run replaces; the archive keeps. The run table marks every run before 2026-09-29 "hints in view", and a number quoted anywhere is the header-free run's where one exists.
  • The protocol is otherwise the current one, not the first arms': fourteen tools, lean answers (#184) and the trimmed surface (#191), readable library sources, --safe on the subjects' servers, client 2.1.282, and, on the two arms with a shell, a prompt that names each library's source directory (PR #200). So the Sonnet mcp arm is the one clean comparison, against the two #191 seeds with the hints (arm-surface-mcp-1 and -2: 48 and 45 solved, 7 and 8 restated), and every other arm has one seed a side and more than one variable.

Evidence. Runs suite219-sonnet5-mcp-1, suite219-sonnet5-shell-1, and suite219-sonnet5-both-1 (claude-sonnet-5) and suite219-opus5-mcp-1 (claude-opus-5), 2026-09-29, Claude Code 2.1.282, the 55 rows named by --ids (the index now holds 81), 30 turns, 900 s, and USD 3.00 per subject, parallelism 3, one arm at a time from one frozen server, extractor, and class snapshot, the same two corpora; each arm after a two-row cost pair (cost-suite219-*); zero anomalies; USD 18.61 for the four.

The agent table, 2026-09-29, fixture headers stripped of hints.

stratum n loop fixed loop retrieval Sonnet 5 solved Sonnet 5 restated Opus 5 solved Opus 5 restated
agda-stdlib 22 6 6 21 0 22 0
agda-stdlib/haystack 12 0 6 12 0 12 0
agda-algebras/using 11 2 2 9 1 11 0
agda-algebras/wholesale 10 0 0 2 8 10 0
total 55 8 14 44 9 55 0

The attribution table, 2026-09-29, fixture headers stripped of hints.

stratum n shell mcp both
agda-stdlib 22 22 solved 21 solved 21 solved
agda-stdlib/haystack 12 11 solved 12 solved 11 solved
agda-algebras/using 11 10 solved 9 solved, 1 restated 11 solved
agda-algebras/wholesale 10 4 solved, 4 restated 2 solved, 8 restated 5 solved, 5 restated
total 55 47 solved, 4 restated 44 solved, 9 restated 48 solved, 5 restated

The mcp column is the agent table's Sonnet arm. Turns (shell, mcp, both, Opus mcp): 345, 347, 353, 323; tool calls 290, 292, 298, 268; USD 3.42, 3.99, 4.13, 7.07. Every gated row's file type-checks with its statement kept: the shell arm's four are two find / searches (although the prompt names the directories), one xargs the audit does not model, and one edited using list; the mcp and both arms' two each are edited using lists, one of them appending the original it then cites. Four readings.

  • The haystack tier's route was the header's. Every arm still solves all twelve rows or all but one (an edited using list), but with the Needle: line in view the Sonnet mcp arms solved 8 to 11 of them with no query before the final check (11 in agent-sonnet5-1), and header-free 3, with search_by_name called on eight rows; the needle was named before any search on 12 of 12 rows in every Sonnet arm with the hints and on 7, 6, and 6 without them. § 9's reading of the first arms, the needle "named qualified from memory", was on most rows the header; without it the model searched, and the server's search found the needle.
  • About three agda-algebras rows per Sonnet arm move from solved to restated, in the same direction in every arm: shell 18 and 0 to 14 and 4, mcp 14 and 7 (or 13 and 8) to 11 and 9, both 19 and 2 to 16 and 5. On those rows the Strategy: line named the proof's shape in a word (pairing, application, constructor); in both shell-bearing arms the subject had the original's proof in view on every row that moved, with the headers and without them, and wrote it out only when the shape was named. The restated rule cannot see a transcription (§ 9's attribution readings), so on these rows the header decided which column a found answer landed in.
  • The rest did not move: the 34 rows with no original solve 33, 33, and 32 (32 to 34 with the hints); the both arm again took all 55 verdicts from check_file, ran agda on the shell never, and left the knowledge tools beside the shell (definition_of 0 calls against 11 in the mcp arm, search_by_name 4 against 21); and the shell arm still solves at least as many rows as the server arm (47 against 44) and restates fewer (4 against 9).
  • Opus. Opus 5 moved the other way: 54 solved and 1 restated with the hints (both seeds), 55 and 0 header-free, its one restatement (algebras-homs-mon-to-hom) now written out without the original in view; one row on one seed a side is not a finding, and the arm sits at the suite's ceiling. Its haystack route is its own: header-free it asked before its final check on 11 of the 12 rows (7 with the hints), but with 15 fill_hole probes and 3 type_of calls on lemmas it named itself and no search call, naming the needle before any search on 10 of 12 (11 with the hints). For Opus the needle came from memory; for Sonnet, on most rows, from the header. Its protocol differs from agent-opus5-1's in everything #162, #184, and #191 changed, and it cost USD 7.07 against 9.14.

Status. Adopted (#219). The demo and the project site read these two tables (the demo finds each by its caption, since the dated tables above share their headers) and the guide's § 4.6 carries the comparison with the hinted runs. The hard tier's three Opus arms, first measured with proof sketches in their headers, were re-run without them (#219's runs 2 and 3, PR #225): every final file checks again, and the mcp pair, whose protocol differs only in the index and one read root, solves 14 of 14 on both sides (the guide's § 4.5). Open: each haystack obligation keeps one inline comment under its module line ("The haystack: reachable qualified; the using list holds decoys only"), which names no lemma and was in view in these runs.

The composition tier (2026-09-29)

(See also #160, #218, #225, [data/benchmarks/agda-algebras-composition-v0/README.md], and [docs/reading-the-results.md] § 4.7.)

Every tier above asks for one lemma. The composition tier asks for several: twelve agda-algebras obligations whose golds string two to four library lemmas together (the row's needles, one needle: tag each), through a root lemma with an implicit middle point, a variable its premises share and its conclusion does not mention (y in x ≤ y → y ≤ z → x ≤ z). The loop's refinement form proves a nested application of determined steps, so "no single needle closes the goal" is not enough to keep a row out of its reach; what keeps it out is that fill_hole refuses the root lemma with holes for its arguments ([UnsolvedMetaVariables]), since nothing fixes the middle point. The rows were mined by a program (scripts/python/corpus/mine_compositions.py) that chains the corpus by types and checks each candidate against every corpus row, then read against the source and posed with header-free fixtures.

Decision. The composition instrument is a mined tier whose every gold has an implicit middle point at its root, gated by the loop at zero, by per-needle recall, and by needle provenance per transcript.

  • Three gates for the loop, one for the agents: the fixed space and retrieval with both scorers must solve 0 of 12 by construction; RetrievalRecall ranks each needle as it ranks a target, reported only where a row carries one; and needle-source.py (the sweeps skill) says, per transcript, whether each needle came from a tool answer, a source read, or the subject's own call before any answer showed it.
  • The judge is unchanged: a composition row has no restates: tag, so it can be solved and never restated, and the final file's count beside the solved count is the figure that measures proving, since the preservation and isolation gates lower the solved count without reading the proof.

Evidence. The loop: runs comp160-fixed-1, comp160-retrieval-1, and comp160-retrieval-idf-1, 0 of 12 each, zero anomalies, nothing excluded; where idf-unfold offered the root lemma (rows 5, 8, 12), fill_hole refused every form with unsolved metas. Recall, run comp160-recall-1: token overlap ranks 0 of 33 needles in the top 32, idf-unfold 14 of 33 in the top 8 and 21 of 33 in the top 32. The agents: runs comp-{opus5,sonnet5}-{shell,mcp,both}-1, 2026-09-29, Claude Code 2.1.282, 60 turns, 1,800 s, and USD 6.00 per subject, parallelism 2, one frozen server, extractor, and class snapshot, each arm after a two-row cost pair; zero anomalies; USD 22.60 for the six.

The composition table, 2026-09-29.

Opus shell Opus mcp Opus both Sonnet shell Sonnet mcp Sonnet both
run comp-opus5-shell-1 comp-opus5-mcp-1 comp-opus5-both-1 comp-sonnet5-shell-1 comp-sonnet5-mcp-1 comp-sonnet5-both-1
final file checks, statement kept 12 12 12 12 12 12
solved 10 12 10 6 3 5
lost to the preservation gate 0 0 0 5 9 5
lost to the isolation gate 2 0 2 1 0 2
needles in the final files (of 33) 20 20 22 25 32 26
rows on the gold's whole route 5 5 6 7 11 8
turns 130 128 148 157 206 179
USD (list) 4.14 4.05 4.87 2.60 3.55 3.39

A final file checks when the judge's own run of agda on it exits 0 and its statement is the obligation's. A needle is in a final file when its name, as its last dotted component, occurs there bounded by Agda's delimiters, and a row is on the gold's whole route when its final file names every needle of the row. USD is each report's list-price total rounded half up to the cent.

  • At both models' ceiling: all 72 final files type-check with their statements kept. Every row missing from a solved count lost a gate: 19 Sonnet rows to preservation, each an edited using list (the fixture imports each needle's module through a using list of decoys), and seven rows to isolation, four the subject leaving its roots and three the audit's limits.
  • The needles came from the tools and the sources: all but three of the needles the transcripts name first appear in a tool answer (exports_of and Read with the server; with a shell, cat and grep for Opus and Read for Sonnet); the three were names the subject handed to search_by_name first. On the haystack tier, by contrast, Opus names the needle before any search on 10 of 12 rows.
  • The miner's necessity check does not bind the models: the needles' relations are defined as functions and pairs, and Opus proved rows 3, 7, 8, 9, and 10 by unfolding them, with the needles in view; row 2 has a second three-lemma route through the fixture's own decoy ⊧-I-invar, which all six arms took. The check compares a needle with the corpus's other lemmas, not with terms built from the definitions.

Status. Adopted (#160); the tier is landed and measured, and the loop's zero stands as the tier's construction. The agents' ceiling is the finding: the tier cannot tell the tools apart for either frontier model, and the instruments differ in route, not in what was proved. The demo reads this table by its caption and replays three of its sessions for where the needles came from and which route each model took (#224). Open, for William on #160: a revision would pose relations a proof cannot unfold (a record or an abstract definition), add the definitional check to the miner, lengthen the chains, or run weaker subjects.

Agda's own proof search in the loop (2026-10-03)

(See also #205, #206, [reports/auto-floor/README.md], and [docs/reading-the-results.md] § 1.6.)

Agda ships a proof search, the one an editor's C-c C-a runs; under the pinned Agda 2.8.0 it is Mimer, which replaced Agsy in Agda 2.7. agda-mcp's auto tool runs it at one hole and answers the term it found as a candidate (#205). By itself, one call per obligation and no loop, it solves 17 of the original 55 rows and 18 of all 81, every term it finds passing fill_hole (the floor, [reports/auto-floor/README.md]). Here it runs inside the loop, behind one knob: closer asks it at every expanded state before any other proposal, with its default space; hints gives it, as hint names, the retrieval proposer's accepted lemmas for the goal, after both exclusion rules.

The loop with Agda's own search, 2026-10-03. Every run beside its knob-off twin, made the same day against one frozen server binary from snapshots of the driver's classes; each twin, run from this branch's classes before the exclusion's correction, reproduces its published run field for field, and a budget-1 loop reproduces ctx-probe-1 (the regression check of the sweeps skill's § 5).

stratum n knob off closer hints published twin
the 43 (stdlib and agda-algebras), fixed space 43 8 (256 probes) 18 (221 probes) run-127-repin-full-peek-on-1
the 43, retrieval, token-overlap 43 8 (723 probes; 721 with the corrected rule) 18 (528 probes) p2s2-a-retrieval-peek
haystack, fixed space 12 0 0 hay-fixed-final
haystack, retrieval, token-overlap 12 6 (317 probes) 6 (335) 6 (333) hay-retrieval-final
composition, fixed space 12 0 1 comp160-fixed-1
composition, retrieval, token-overlap 12 0 1 comp160-retrieval-1
composition, retrieval, idf-unfold 12 0 2 comp160-retrieval-idf-1

Run ids are auto206-<stratum>-<space>-<knob>, and the agda-algebras rows of the 43's retrieval runs are auto206fix-alg-retrieval-{off,hints}, re-run with the corrected name rule (below); the composition twins are the published runs, made header-free. Zero anomalies in every run. Over the original 55, hints on retrieval solves 24: one more than the union of what Agda's search solves alone (17) and what retrieval adds on the haystack (6), the bound #206 set.

  • The closer adds what Agda solves alone, and one row neither solves alone. On the 43 the closer solves the floor's 17 rows, each in one probe, plus algebras-homs-id-hom: Agda's search finds nothing at its root, the fixed space commits (_,_ {!!} {!!}), and the search closes both sub-holes (a record { to = λ z → z ; … } and an mkIsHom (…)). So 18 of 43 against the fixed space's 8, for fewer probes (221 against 256) and less wall clock.
  • On a data-typed argument hole a closer is noise. Where retrieval has committed a lemma applied to holes, the search fills a hole of type ℕ with any ℕ (m, 0); fill_hole rightly accepts it and the child leads nowhere. On the haystack that cost 18 probes and turned one row from exhausted at 42 probes into budget-exceeded at 60, with the solve set unchanged.
  • Hints reach the search only through ranking, and the search uses few of them. On the haystack the needle was in the root hint set on 7 rows, and the search solved one of them itself ((Data.Nat.Properties.+-suc m m), one probe where retrieval took three); on the other six it answers no solution in 2 to 9 ms with the needle alone as its hint, so neither the bound nor the other hints are the cause. The corpus records those six as stated through an alias (∧-assoc : Associative …, ∧-distribˡ-∨ : … DistributesOverˡ …, +-mono-≤ and *-mono-≤ : Monotonic₂ …) or as level-polymorphic (map-++, length-++), while +-suc is a plain function type over ℕ; that is the measured difference, not a verified cause. On the five rows retrieval misses, the needle never reached the hints: a ranking miss, the limit § 9's recall instrument already names. On the composition tier token-overlap sent no needle at all; idf-unfold sent both of comp-homomorphism-isomorph-is-image's, and the search returned the gold, HomImage-≅' IdHomImage A≅B, in one probe: the floor's upper bound (every needle as a hint, 2 of 12) reached by the loop with retrieval's own hints.
  • The exclusion had a hole, and the hints found it. The first hints run solved algebras-inverses-image-f-f by citing Imagef∋f, the lemma the row restates: the name rule compared names exactly and the obligation is named Imagef∋f′, so the original had sat in retrieval's accepted pool all along (§ 7). With the rule corrected the original is excluded by name on all 18 renamed rows, no restated lemma reaches any hint set, and the search solves the row with its own (eq a (… refl …)). Knob off, the correction changes no solve and no status (2 of 21 on the agda-algebras rows, as before), only the ledger's exclusions and the probes of the two rows whose originals had been ranked into the pool; the recall instrument's published figures do not move.
  • The composition tier's gate is the loop as built. With the knob off the loop solves 0 of 12, as the tier requires. With it, two rows fall: one from the context alone (λ z → φ≤N (θ⊆φ z), the definitional unfolding Opus also used), and one the gold, whose middle point the search fills by unification where the loop's refinement leaves a meta fill_hole refuses.
  • What it costs: one search per expanded state, milliseconds each with the default space (80 searches, 10 s in all, on the 43) and about half a second with hints, which spend the search's CPU bound (25 s over 50 searches on the haystack); a found term adds a lane re-load. Against batch judgments of seconds, the knob is cheap.

10. Where it is going

  • Premise selection (#19, [M2-5]). The instrument and the bar now exist: a learned ranker is measured on the same target: and restates: ground truth, in the same excluded and unexcluded pools, and has to beat idf-unfold's 9 of 33 fair targets and 12 of 21 originals in the top eight (§ 9). What it has to learn is stated: the library's definitional unfoldings (which the deterministic scorer reads off the corpus bodies) and the discrimination among lemmas that conclude the same thing, where the hypotheses carry the signal. Two changes outside ranking would move more than any scorer: candidate shapes that project hypotheses (proj₂ m) and nest applications, and a ranking query taken from the un-normalized goal display, which would state goals in the aliases the lemmas use.
  • P3, policy proposals (#124). A learned policy behind the existing contract (policy_contract.py, mirrored by AgdaMCP.Types; policy_fixture.py as the deterministic stand-in), compared against policy-alone top-k and both earlier baselines: the closed propose, check, and learn loop the project has been building toward.
  • Benchmark instruments (#129, #142, #160). The haystack tier (#129) is landed and measured (§ 9): obligations whose single-term golds require a non-using-listed, non-target lemma from an imported haystack, on which retrieval now has its first solves under exclusion and its nulls each name a ranking or peek limitation. The composition tier (#160) is landed and measured too (§ 9): the loop solves none of it by construction, and its needles are the quantitative case for composition moves (a trans whose middle point is supplied from a retrieved lemma's conclusion). Style-paired obligations (#142) remain, so retrieval's ranking value becomes measurable without gaming from a second direction.
  • Raising the ceiling (unscheduled, the largest known win). Term mode caps the standard-library tier at 6/22, and 13 of the 16 unreachable golds are structural inductions of a single shape (f zero … = refl; f (suc n) … = cong g (f n …)). Reaching them needs case-split moves, plausibly via the interaction protocol's Cmd_make_case, which changes the state model's move vocabulary and is deliberately outside P1–P3.
  • Recorded options, taken only if measurement demands: parallel oracle workers (N servers over disjoint work copies) if wall time becomes the bottleneck; richer selection policies than first-open-obligation if multi-hole fixtures ever make selection order matter under budget.

11. Decision log

# Decision Status Evidence
1 Obligation sets are conjunctive; SolvedClaim requires the empty set AND a final green batch check Adopted (P0) #112 post-mortem; ModelSpec, live in SingleStepIntegrationSpec and LoopIntegrationSpec
2 The client lives in Scala (strux-driver), driving agda-mcp over its public contract; no in-process Haskell rewrite Adopted (P0) Transport is 0.21 % of oracle time (#113)
3 Budgets are denominated in batch judgments, not seconds Adopted (P1) A batch call's import loading dominates all else (#113)
4 Judgments memoized on OracleKey, scoped per fixture; hits free, including at the budget cap Adopted (P1) OracleMemoSpec; BeamLoopSpec cap test
5 Frontier dedup keys on content plus script Adopted (P1); re-measured with hole-free compounds present (P2): stands Both A/Bs identical, zero skips either way; BeamLoopSpec
6 First-open-obligation selection Adopted (P1), a stated simplification Sound under conjunctive re-anchoring; BeamLoopSpec
7 Application candidates parenthesized Adopted (P1) First sweep: every depth-1 application died unparenthesized
8 The type_of peek informs only, never decides; default ON since P2; the two closers exempt since the agda-algebras tier Adopted (P1); default flipped (P2); exemption (#127) P1: −88.5 % probes at zero solve cost; P2: two losses recovered; #127: lift∼lower
9 Anomalies never abort a sweep, always redden the run, and keep their diagnostics Adopted (P0/P1) #112's silent-breakage failure mode; LoopHarnessSpec
10 All reporting on eval-proof-completion.v0 beside the policy baseline Adopted (P0/P1) #113 acceptance: no private formats
11 Retrieval is composed around the fixed space, so the P2 space is a superset of P1's Adopted (P2) Stage-one sweep B reproduces P1's solve set and scripts
12 Retrieval scope is the fixture's imported modules with qualified access, lane-arbitrated; import-widening is out of scope Adopted (P2) Qualified access toolchain-verified; whole-module imports enter the scope (PR #130 review); RetrieveSpec
13 Target exclusion by name and lane-form statement, named per fixture, with a labeled off switch for the control only; the name rule compares the hole's name less trailing primes too Adopted (P2); the stem since #206 The control commits all five stdlib targets in both rounds and the wholesale needle on agda-algebras; RetrieveSpec; exact names missed 18 of 21 renamed agda-algebras obligations, and Agda's search cited one original through the gap (§ 7)
14 Three candidate shapes: _-form, bounded saturation over the context, {!!}-refinement Adopted (P2) fill_hole refuses blocked-constraint sub-holes (captures wire-fill-hole-blocked-*); the control solves are saturated one-shots
15 The scorer is a seam; token overlap is the placeholder, premise selection the replacement Adopted (P2); the demand now measured Stage two: needles in scope, drowned at 3,000-row pools (#19)
16 Splice columns are codepoints, never UTF-16 units Adopted (#127) ModelSpec regression; astral glyphs throughout agda-algebras
17 The retrieval instrument is a tier whose needles are import-reachable, not using-listed, never the answer key, with golds inside the three candidate shapes and the exclusion ledger required empty Adopted (#129) Fixed space 0/12 against retrieval 6/12 under exclusion, zero exclusions; each null pinned to one pipeline limitation (§ 9)
18 Ranking is measured offline against index ground truth (target:, restates:), by replaying the shared pool pipeline on recorded goals Adopted (#19) The instrument reproduces run ctx-probe-1's pool counts and accepted order; RetrievalRecallSpec
19 idf-unfold is the deterministic scorer; the default stays token-overlap so published numbers reproduce Adopted (#19); the name rule re-instated after PR #152's review un-confounded its knob 9/33 fair targets and 12/21 originals in the top eight against 1/33 and 5/21; every rule pinned on corpus rows in RetrieveSpec
20 The agent in the loop is a second instrument under the loop's verifier and report shape: one fresh session per obligation with the thirteen tools and one file, isolation verified per transcript, a restated column for a looked-up lemma, turns and tool calls as the comparable columns, and every fact about the final file Agda's own answer (check_file under --safe, agda-strux's elaborated types and body references) Adopted (#154) Sonnet 5 46/55 and Opus 5 54/55 against the loop's 14/55, 8 and 1 restated, zero anomalies; JudgeSpec over all 55 pairs, TranscriptSpec on a captured stream, AgentBenchIntegrationSpec (§ 9)
21 The server is measured against its own control: an arm is one instrument (shell, mcp, both), the libraries' sources are readable on every arm, a shell arm is confined by a conservative audit over the paths its commands name rather than by the client, which cannot confine Bash, and the report gains via, verdictVia, and Bash calls by class Adopted (#162) Sonnet 5: shell 50/55 and 0 restated, mcp 47/55 and 6, both 51/55 and 2, zero anomalies; the both arm takes all 55 verdicts from check_file and runs agda on the shell never, definition_of 19 calls against 0; ShellAuditSpec written before the parser (§ 9)
22 Every agent number is measured on fixtures whose headers carry no hints (no Source:, Strategy:, Haystack:, Needle:, or Note: line); the arms measured with them stay archived, dated, and marked Adopted (#219) Header-free, Sonnet 5 mcp 44/55 and 9 restated against 48 and 45 with the hints; the haystack tier solved with no query on 3 of 12 rows against 8 to 11; about three agda-algebras rows per Sonnet arm from solved to restated; FixtureHeadersSpec over every index row (§ 9)
23 The composition instrument is a mined tier whose every gold has an implicit middle point at its root, gated by the loop at zero, by per-needle recall, and by needle provenance per transcript Adopted (#160) The loop 0/12 in three sweeps; idf-unfold 14/33 needles in the top 8; every one of the 72 agent final files checks, Opus 5 solved 10, 12, 10 and Sonnet 5 6, 3, 5 in shell, mcp, both, the rest lost to gates; needles from tool answers, not memory (§ 9)
24 A tier at the models' ceiling is read by its final files and its route, not by its solved count: where every final file checks, a solved count measures the gates, and what separates the arms is where each needle came from and whether the proof took the gold's route Adopted (#224) The composition tier: 72 of 72 final files check; 19 preservation and 7 isolation losses, each after a file that checks; Sonnet 5 on the gold's whole route on 11 of 12 rows with the server, Opus 5 on 5 or 6 in every arm; all but three needles first shown by a tool answer (§ 9)
25 Agda's own proof search composes around any space as a closer behind one knob (--auto off\|closer\|hints), proposed first at every state and judged like any candidate; its term skips the textual peek through Proposer.unpeeked; hints are retrieval's accepted lemmas after the exclusion Adopted (#206) The 43: fixed space 8 to 18 with closer (one row neither solves alone), retrieval 8 to 18 with hints; the haystack unchanged at 6; composition 0 to 2 with idf-unfold hints, the floor's upper bound; every knob-off twin reproduces its published run; the first hints run exposed the exclusion's blind spot (decision 13) (§ 9)

References

  • Issues: #112 (the post-mortem), #113 (tracking; every measurement in its comments), #119, #122, #123, and #124 (the phases), #127, #129, and #142 (the benchmark instruments), #19 (premise selection), #68, #75, #107, and #108 (the server substrate), #79 (re-anchored hole lists), #154 (the agent in the loop; its comments hold the tables and the transcript moments) and #83 (the field measurement it complements); #205 and #206 (Agda's own proof search, as a tool and in the loop).
  • PRs: #121 (P0), #126 (P1), #130 (P2), #132 (the agda-algebras tier, with the codepoint and peek fixes), #152 (the recall instrument and the idf-unfold scorer), #230 (the auto tool and the floor).
  • Docs: [proof-search/overview.md] (how the search works, with a worked example, and the vocabulary), [agda-mcp/agda-mcp-interaction-lane.md] (the two-lane policy and the lane protocol), [agda-mcp/README.md] (tool contracts), [data/benchmarks/README.md] and [benchmarks/taxonomy.md] (the suite and its tiers), [agda-dojang/README.md] (the result schema), [corpora/agda-stdlib-v0.md] and [corpora/agda-algebras-v0.1.md] (the corpora), [docs/mcp-field-reports.md] (what agents did with the tools in the field), [reports/agent-bench/README.md] (the archived agent runs).
  • Code map (strux-driver/src/main/scala/struxdriver/search/): Model.scala (state, claims, keys, splice), Wire.scala (strict decoders), McpClient.scala (transport), Oracle.scala (timed, memoized calls, the ledger), Actions.scala (application arithmetic, pi splitter), Propose.scala (proposer seam, fixed space, peek), Retrieve.scala (the retrieval proposer, the shared pool pipeline, the scorer seam and the IDF family, exclusion), AutoClose.scala (Agda's own proof search as a closer, the --auto knob and its ledger), RetrievalRecall.scala (the offline recall instrument), BeamLoop.scala (the loop), Scaffold.scala (shared fixture scaffolding), SingleStepHarness.scala (P0 entry), LoopHarness.scala (P1 and P2 entry); tests beside them in src/test/scala/struxdriver/search/, wire captures in src/test/resources/search/. The agent bench lives beside it in struxdriver/agentbench/, one module per question: Statement.scala (the frozen text: module and import lines, for the diff), Ask.scala (what the judge asks Agda: check_file, the extractor's elaborated types and body references), Judge.scala (the gates as functions of those answers), Cli.scala (the arguments), Layout.scala (where a run keeps things), Subject.scala (the client process and its flag set), Transcript.scala (the stream-json reader), Audit.scala (isolation, terminal state, probe rows), Outcomes.scala (what one obligation earned, from its archive), Report.scala (the outputs), Run.scala (stage, spawn, archive, resume), AgentBench.scala (the wiring); the text-file effects they share are struxdriver/io/TextIO.scala; the fixed prompts are under src/main/resources/agentbench/; tests beside them in src/test/scala/struxdriver/agentbench/.