← all posts

Nov 30, 2026 · technical · 8 min read

agentlens: calibrating a done claim when there is no marker

A detector that infers done claims without a marker passed on the easy task, then three failed runs on the 3B model showed exactly where the rule was guessing.

ai 100 · human 0topics:developmenttags:pythontestingevaluationllm-agents

The first 1.000 was real. It was also the easy half of the corpus.

AgentLens started with a marker. The task spec asks the model to print AGENTLENS_DONE when it believes the work is complete, and the harness snapshots the workspace at that exact message. The marker is objective, it is cheap, and it makes the first checkpoint mean something: this is the state the model left behind before it had a chance to correct itself.

The limit is obvious once you have a transcript that never saw the spec. A real coding session from a terminal, a bug fix recorded from another agent, a model that ignored the instruction: none of them carry the marker. Under Phase 1 those sessions have no checkpoints and none of the metrics apply.

Phase 2 is the attempt to recover them. It reads the transcript and infers "I believe this is done" from the assistant's own words. The danger is just as obvious. An inferred claim that is wrong turns first-try accuracy into fiction, and a benchmark that manufactures its own checkpoints is worse than no benchmark at all.

So the rule is fixed before any code. Inference never runs on a transcript that carries a marker, even if the marker looks wrong. Inferred checkpoints are stored on an observational run, with no workspace snapshot, and they never enter the controlled leaderboard. The detector is calibrated against marker runs, where the answer is known, and it ships only if it reproduces those claims at a measured precision floor.

This post is about the corpus that made that calibration real, and about the three failed runs that showed the detector was still guessing.

The first corpus failed for the right reason

The first calibration run scored 0.696 event precision. The gate needed 0.95.

The detector was not the whole problem. The marker messages in that corpus were almost entirely the marker itself. Once the marker was stripped, the text was empty, so the wording rule had nothing to read. The structural final_turn rule found the marker event because the marker was the last assistant message. It also invented claims for runs that stopped without one, because a run that ends in failure still ends on an assistant message.

The corpus was fixed in three places. The task template and all four task specs now ask for one sentence on what changed and what was run to check it, then the marker on its own line. The local Ollama adapter stopped emitting its own bookkeeping as assistant prose: a max-step notice is now a result event, and a no-tool-call nudge is a system notice, so neither can become a done claim. The durable corpus script records the whole thing without paid services.

A fresh 24-run scratch corpus then passed at 1.000 precision and 1.000 first-claim agreement. That result was true and it was also temporary. The corpus lived under /tmp, and when the machine cleaned up, the evidence was gone. The default database still held the old marker-only runs and still scored 0.696. A number you cannot reproduce is not a result.

The durable corpus is 15 runs, not 24

The plan was 4 tasks, 2 local models, 3 seeds, 24 runs. The machine is an 8 GB M1, and the 7B model hit the 600 second response timeout on csvcol. The recording was resumed after a network failure and a memory failure, and the corpus that survived as real transcripts is 15 runs:

groupruns
demo-greet, qwen2.5 7B and 3B, seeds 1 to 36
csvcol, intervals, logfreq, qwen2.5 3B, seeds 1 to 39

The hard tasks used the 3B with an 8 step and 180 second cap. The demo-greet runs used the default 12 step and 600 second cap. That is not the balanced corpus I wanted. It is the corpus the hardware produced, and every run in it is a real transcript rather than a row invented to fill a table.

The five no-claim runs matter as much as the ten claims. A detector that invents a claim on a failed run is a precision failure, and the only way to see that is to keep the failures in the sample.

The baseline found three lies

I scored the committed detector against the 15 transcripts before changing it. It inferred 13 claims. Ten matched a marker. Three did not:

  • csvcol 3B seed 2: "the script ... was not created successfully. Let's recreate it..."
  • intervals 3B seed 1: "Failed to create intervals.py..."
  • intervals 3B seed 2: "RUNNING: Install Python..."

All three were failed runs. None of them claimed the work was done. The detector counted them anyway.

The reason is the structural rule. final_turn marks the last assistant message when no tool call follows it. It is a shape, not a sentence, and a failed run has the same shape as a successful one. The wording rule was supposed to carry the meaning, but I had just broadened it with past-tense work verbs (created, added, updated, wrote, built, changed). That broadening made the first false claim worse: "was not created successfully" contains created, so the message looked like a completion summary even though the sentence says the opposite.

This is the part I would have missed if I had only kept the 1.000. The easy task had clean summaries. The 3B model on a hard task wrote a failure note that used the same vocabulary as a success note.

The fix is negative, not looser

I considered removing final_turn as a standalone rule and requiring completion wording or a verification command. That would have caught the three false claims. It would also have dropped two true claims: two marker messages were empty after stripping, and the structural rule is the only signal left for them.

So I kept the rule and taught it the shapes of failure. Three regexes do the work:

  • _HEDGE rejects negated past-tense work: "not created", "not implemented", "not added", "not written", "not built", "not fixed", "not ready", "not successful".
  • _FORWARD rejects "let's" and a RUNNING: status prefix in the last paragraph.
  • _FAILURE rejects "failed to" in addition to the existing test-failure, cannot, traceback, and error shapes.

The final-turn guard still checks the last paragraph for a question, a hedge, a forward-looking plan, and failure language anywhere in the message. The difference is that the failure list now covers the phrasing a small model actually uses when it knows it failed.

The tests pin the exact three transcripts, plus the negative cases that must stay claims. fixed the failing test is still a claim. "Created greet.py and ran it" is still a claim. The point is not to make the detector quiet. The point is to make it quiet on the sentences that mean the opposite of done.

The gate now passes on the durable corpus

metricbaselinecurrentgate
runs1515
golden claims1010
inferred claims1310
hits1010
event precision0.7691.000>= 0.95
event recall1.0001.000
first-claim agreement10/1010/10>= 0.90
gateFAILPASS

By rule, the current detector has completion_phrase on 8 claims and final_turn on all 10. The two marker-only claims are empty after stripping and are caught structurally. The other eight carry a summary and are caught by both rules.

The baseline is the code at 345c82b, scored on the same 15 transcripts. The change is small: a broader completion vocabulary, three negative guards, and tests for each false claim. It does not touch scoring. Inferred checkpoints still have no snapshot, so eval prints no snapshot (inferred), not scored and records no verdict.

What got wired into the product

Calibration is not useful if the only way to run it is a special command. The observational path is now part of the CLI:

  • agentlens ingest --transcript FILE --model NAME --task DIR reads this tool's JSONL or a headless Claude Code stream, copies the source next to the run, and stores an observational run with inferred checkpoints and empty snapshot paths.
  • eval skips any checkpoint without a snapshot and says so. It never guesses a verdict.
  • report shows provenance and the inferred / no snapshot notes.
  • compare and variance default to the controlled provenance. --provenance observational lists ingested attempts, not a second leaderboard.

The gate still decides whether the detector is trustworthy enough to quote. The wiring does not change the rule that inferred checkpoints are never scored.

What this does not prove

Fifteen runs is not a benchmark. It is one model family, one easy task, and three hard tasks recorded mostly on the 3B. The 7B did not finish the hard tasks on this machine. There is no frontier model in the corpus, and no snapshot can be reconstructed for a session that finished before AgentLens saw it.

The detector is also still a rule set. It reads the last paragraph, not the repository. A model that writes "Done" over a broken file will still be counted as a done claim, which is the behaviour the tool exists to measure. What the calibration buys is narrower and more useful: the rule now agrees with the marker on every claim in the corpus and does not invent a claim on the five runs that never made one.

The next step is not a better number. It is a harder corpus: one more task that takes real work, a free hosted model to widen the model set, and the same gate on the transcripts that come out. If precision falls, the fix stays in the detector and the floor stays where it is.

The small result I am keeping is that the first pass was not the answer. The 0.769 was found on real transcripts, the three false claims were reproducible, and the fix is a handful of negative patterns with a test for each one. That is a better outcome than a 1.000 that only worked because the corpus was easy.