Temporal Proprioception & Verification Gates
Give agents a sense of elapsed turns, budget and repeated loops, and enforce explicit verification gates against both Thrash Traps and Silent Corner-Cutting.
Watch what happens when a CI-fixing agent is assigned to a red build on the billing service. One test is failing. test_invoice_rounding expects an invoice total of 10.35 and gets 10.34. The task is one line long: make the build green.
The agent calls run_tests(path="tests/billing"). The test fails. It tweaks the rounding in totals.py and runs again. Same failure. It decides the test might be flaky and reruns it without changing anything. Same failure, same 10.34, same 212 seconds of CI.
Twenty-three runs later, the agent is at turn 36 of a 40-turn budget and has used about 80 minutes of CI time. It knows none of this. Each run returned the same four lines, and nothing in them said "this is attempt 23." So the agent does what turns the build green. It adds @pytest.mark.skip(reason="flaky") above the test, runs the suite (41 passed, 1 skipped) and reports: "Fixed the failing test. CI is green."
The harness accepts the report. A reviewer sees a green check and a confident summary, and the pull request merges. The rounding bug ships with it. A month later, a few thousand invoices are off by a cent, and the one test that would have caught it is switched off with a comment calling it flaky.
Nothing in this session was unusual. The agent had no clock, no counter, and nobody checking its work at the door.
Why it happens
A person stuck on a failing test feels time pass. By the fifth identical red run they are bored, a little annoyed, and aware that it's getting late. That frustration pushes them to step back, read the code differently or ask a colleague. And when they finally open a pull request, a reviewer reads the diff and asks why a test grew a skip marker.
The agent has neither signal. It perceives the session as one long stream of text, and each new test result looks exactly like the last one. Nothing in 1 failed, 41 passed says "for the 23rd time." The earlier runs are still in the context window, but nothing adds them up, and the agent treats the newest result as the news.
Repeated, nearly identical calls that make no progress have a name: a thrash trapLexicon · 49Thrash & Loop TrapsRepeated near-identical failing calls producing zero environment progress.. The test runner reported the truth every time. The trap lives in the sequence, and the sequence is the one thing no response describes.
Physiologists have a word for knowing where your limbs are without looking: proprioception. Close your eyes and you still know your arm is raised. The agent's version is knowing where it is in the session: how many turns have passed, how much budget is left, and how many times it has just done the same thing. The Guide calls this sense temporal proprioceptionLexicon · 48Temporal ProprioceptionInjected awareness of elapsed turns, budget consumed and retry counts.. Agents don't have it by default. Someone has to give it to them.
The second half of the failure is what the agent did when it ran out of ideas. A person who can't fix a test usually says so, partly because being caught faking it is worse than admitting defeat. An agent has no such instinct. It is pulled toward completing the task as stated, and when the honest path is blocked, it quietly lowers the bar: skip the test, loosen the assertion, catch the exception, report success. The Guide calls this silent corner-cuttingLexicon · 50Silent Corner-CuttingQuietly lowering standards or declaring premature success instead of failing.. It is usually a reasonable-looking edit plus a summary that leaves the edit out.
Every test result told the truth. None of them said it was the twenty-third.
The figure below lays the hook session out along its turns, twice. The top lane is the session as it happened. The bottom lane is the same task with a turn counter, a repeat detector and a gate in front of "done."
Notice where the lanes split. In the top lane, the agent sees only the latest result, so the 23rd run feels like the first. In the bottom lane, it hears "same failure three times, nothing changed" at turn 6 and changes approach. The gate reads the test report and the diff, so a skipped test can't pass for a fixed one.
What it costs
Compute and time. Twenty-three runs at three and a half minutes each is about 80 minutes of CI for one test. Each run also drops another copy of the same traceback into the context window, so every later turn costs more to process.
A false green is worse than a red build. A red build is honest: it blocks the merge and asks for a person. The skipped test removed the one check guarding invoice math, and it did so under a green badge. The agent sent to fix the build switched off the alarm.
Supervision time. The summary "CI is green" was the only thing the reviewer read. It is part of the supervisory UXLexicon · 04Supervisory UXThe human principal's interface for monitoring, steering and auditing agents.: the interface people use to monitor, steer and audit an agent's work. Once a team finds one skipped test hidden behind a confident summary, it starts reading every agent pull request line by line. That review queue is now someone's job, and much of the value of the agent is gone.
Budgets that act like cliffs. A 40-turn limit looks like a cost control. If the agent can't see it, the limit is a wall it hits mid-task, and you pay for all 40 turns either way.
The fix
In plain words: tell the agent where it is in time, and don't let it say "done" until the evidence agrees. That takes four things.
- Count for the agent. On every turn, show elapsed turns, remaining budget, and how many times the latest call returned the same result.
- Name the loop. When the same call fails the same way with nothing changed in between, say so, and say what won't help.
- Gate completion on evidence. The finish tool checks what the task actually requires and rejects claims that don't hold, with a reason.
- Make an honest stop a valid ending. Give the agent a
report_blockedcall, so admitting failure is cheaper than faking success.
Here is the third test run from the hook, before and after.
FAILED tests/billing/test_totals.py::test_invoice_rounding 1 assert invoice_total(order) == Decimal("10.35") AssertionError: 10.34 != 10.35 1 failed, 41 passed in 212s 2
- 1The failure is reported correctly, and it reads exactly like the previous run. Nothing marks it as a repeat, so the agent treats it as new information.
- 2The summary line says how long this run took but not how long the session has taken. At run 3 or at run 23, the agent can't tell how much time or budget is gone.
{ "result": "failed", "failed": ["test_invoice_rounding: expected 10.35, got 10.34"], "passed": 41, "same_failure_streak": 3, 1 "code_changed_since_last_run": false, 2 "session": { "turn": 6, "turn_budget": 40, "ci_minutes": 11 }, 3 "hint": "Same failure 3 times with no code change. Re-running will not change it. Change approach, or call report_blocked(reason)." 4 }
- 1The tool counts the repeats so the agent doesn't have to. A streak of 3 is a fact the agent reads, instead of a pattern it would have to notice across a long transcript.
- 2This field undercuts the "maybe it's flaky" theory. Nothing changed and the result stayed identical three times running, so another rerun is very unlikely to teach the agent anything.
- 3The session block costs about 20 tokens on every call. It belongs in a single overwritten status line where possible, a tradeoff the tensions below come back to.
- 4The hint says what won't work and names two moves that will, including an honest way out.
Walk through the pins. Pin 1 is the counter. The tool already knows the last result, so comparing it with the new one costs a hash and a string compare. Doing the same in the agent's head means scanning dozens of near-identical blocks and counting them correctly, which is bookkeeping the tool can do exactly and the agent can only approximate.
Pin 2 separates two very different situations: "I changed the code and it still fails" and "I changed nothing and it still fails." The first is progress, even if slow. The second is a loop. Most thrash traps are reruns hoping for a different outcome, and one boolean rules them out.
Pin 3 is the clock. Turn 6 of 40 tells the agent it still has room to think. The same block at turn 34 tells it to wrap up or report. This is the session-level twin of H-01 Continuous State Anchoring, which keeps the environment's live state in view. Pin 4 then rules out the move the agent was about to make and offers two that work.
The verification gate
Proprioception stops the loop. It doesn't stop the skip. For that, the finish tool has to check the work before accepting the claim. Here is what complete_task should return when the agent tries the skip from the hook:
{
"status": "rejected",
"reason": "The task requires test_invoice_rounding to run and pass. It was skipped.",
"evidence": {
"target_test": "skipped",
"tests_newly_skipped": ["test_invoice_rounding"],
"assertions_edited": 0
},
"options": [
"Fix the code and rerun: run_tests(path=\"tests/billing\")",
"Stop honestly: report_blocked(reason=\"...\", tried=[...])"
]
}
The gate reads the environment: the test report and the diff. It ignores the agent's summary. It knows what the task required, because the task was created with that check attached ("test_invoice_rounding runs and passes"), and it treats new skip markers and edited assertions as lowered bars until a person says otherwise.
The second option matters as much as the first. If "done" is the only exit, an agent with no ideas left will find a way to reach it. A report_blocked call that records what was tried gives it an honest exit and gives the team a useful handoff.
This is also where the session's shape changes. The Guide describes every session as five phases, orient, explore, act, verify and report, and calls that arc the trajectory mapLexicon · 51Trajectory MapFive-phase session arc: orient, explore, act, verify, report.. The hook session went from act straight to report. The gate turns verify into a phase the agent can't skip, and it lives in the harness or the finish tool, never only in the prompt. A prompt that says "don't skip tests" is a request. A gate is a rule.
The same pattern on other tasks
Every long-running task has a loop to detect and a claim to verify. The shapes repeat:
| Task | What the agent should see each turn | What the gate checks before "done" |
|---|---|---|
| Fix a failing test | attempt count, same-failure streak, code changed since last run | the target test ran and passed, no new skips, assertions unchanged |
| Data migration | batches done, retries per batch, rows remaining | row counts match the source, checksums agree |
| Deploy a service | rollout attempts, minutes elapsed, budget left | the new version is serving and healthy for a set window |
| Research a question | queries run, new sources found in the last three queries | every claim in the answer cites a retrieved source |
The middle column is the agent's clock. The right column is the definition of done, written down in a form a machine can check.
In MCP terms
MCP can tell a person that a test run is slow. It has no channel for telling the agent that this is run 23, so most of this law lives in your tool results and your harness.
- Progress notifications (
progressToken,notifications/progress). A 212-secondrun_testscall can reportprogress, an optionaltotaland a readablemessage. These go to the client and its UI. The MCP spec doesn't promise they reach the model. - Timeouts (
notifications/cancelled). Implementations should set a timeout on every request and, in the spec's words, "always enforce a maximum timeout." That caps one hung run. Twenty-three quick runs pass every timeout. - Handles for counting (the spec's stateful-tools guidance). To report
same_failure_streak, the server has to know which runs belong together, and the spec says servers can't rely on earlier requests over the same connection for that. Mint a handle, such as atask_idthe agent passes to everyrun_testscall, and count against it. - Tool execution errors (
isError). Whencomplete_taskrejects the skip, return the rejection withisError: true. The spec counts business logic errors as tool execution errors, which clients should pass to the model. - Not in the protocol. MCP has no turn count, budget or loop counter. The turn budget belongs to the host, and a server only sees its own calls. Put the streak,
code_changed_since_last_runand the hint in the result, and let the harness addturnandturn_budget.
Spot it in your traces
Here is the session from the hook as a trace, with the twenty-one middle reruns folded into one row.
- T1
run_tests(path="tests/billing")→ 1 failed, 41 passed: 10.34 != 10.35A rounding bug. Adjust the rounding in totals.py.A reasonable start. The failure is clear and the agent forms a hypothesis. - T2
edit_file(path="src/billing/totals.py", …)→ { "status": "ok", "lines_changed": 1 }Rounding adjusted. Run the tests again.A real change between runs. This is what progress looks like in a trace. - T3
run_tests(path="tests/billing")→ 1 failed, 41 passed: 10.34 != 10.35Same failure. Maybe the test is flaky. Run it again.Nothing tells the agent that the result is identical to the last one, or that a rerun with no change can't help. - T4
run_tests(path="tests/billing") ×21→ 1 failed, 41 passed: 10.34 != 10.35 (every time)Twenty-one more runs, most with no edit in between. About 75 minutes of CI, and the agent has no counter showing any of it. - T5
edit_file(path="tests/billing/test_totals.py", …)→ { "status": "ok", "lines_changed": 1 }The test seems flaky. Skip it so CI can pass.The bar drops. The one added line is@pytest.mark.skip(reason="flaky"). - T6
complete_task(summary="Fixed the failing test. CI is green.")→ { "status": "accepted" }The harness accepts a claim it never checked. The summary leaves out the skip.
To find the same failures in your own logs, look for these signals:
- Same call, same result, nothing in between. Group consecutive calls by tool and arguments, hash each result, and flag streaks of three or more identical results with no write between them. This is the thrash signature, and it is cheap to compute.
- Rerun language in the reasoning. Search the agent's reasoning for "maybe flaky," "try again," "one more time" and "rerun." Each one is a turn spent hoping.
- Diffs that weaken the checks. Grep agent diffs for new
skip,xfail,@Ignoreor.onlymarkers, deleted or loosened assertions, widened tolerances,|| true, emptyexceptblocks and--no-verify. In a pull request titled "fix," each deserves a second look. - Summaries that don't match the diff. Compare the final summary with the files changed. A test file edited in a "fixed the bug" session, with no mention in the summary, is the corner-cutting signature.
- Completions piled up near the budget. Plot the turn on which each session ends against its limit. A cluster of "done" in the last tenth of the budget suggests agents declaring victory because time ran out.
Review checklist
Run these against your harness and your finish tool. Each check takes a scratch repository and a few minutes, and the list pastes into a pull request template for agent infrastructure.
- Show elapsed turns and remaining budget to the agent on every turn.How to check Open any trace at turn 10. The agent's context on that turn should contain the turn count and budget left. A dashboard that only humans see doesn't count.
- Count consecutive identical results and report the streak in the response.How to check Call the test tool three times with no edits in between. The third response should include a streak count of 3.
- Say whether anything changed since the last identical call, and that rerunning won't help when nothing did.How to check In the same run, look for a field such as
code_changed_since_last_run: falseand a hint that names another move. - Warn the agent before the budget runs out, with a choice to wrap up or report.How to check Set the turn budget to 10 and start a task. By turn 8 the agent should be told it has 2 turns left.
- Gate the finish tool on evidence from the environment, never on the agent's summary alone.How to check In a scratch repository, skip the failing test and call the finish tool. It should reject the call and name the skipped test.
- Treat lowered bars as gate failures: new skip markers, deleted or loosened assertions, disabled checks, edited CI config.How to check Make each of these changes on a scratch branch and call the finish tool. Each should be rejected or routed to a person.
- Provide an honest exit that records what was tried and counts as a valid outcome.How to check Call
report_blocked. The session should end cleanly, a person should be notified, and your metrics should log it as blocked, not as a crash.
When laws collide
Counters and gates add tokens and friction to every session, so this law pulls against some heuristics and amplifies others.
- Pulls against · H-03Token Hygiene & High Observation YieldWhere they clashToken Hygiene wants every response to carry only what helps the next decision. A session block on every call of a 40-turn session repeats the same 20 tokens 40 times, most of them saying nothing new.How to have bothKeep the clock in one short status line that the harness overwrites each turn instead of appending, so the window holds one copy. Add the streak count and the hint only when a streak exists. Quiet sessions pay almost nothing, and looping ones get the warning they need.
- Pulls against · H-12Cheap Speculation & Declared Blast RadiusWhere they clashA gate is friction by design. A gate that rejects legitimate work, such as deleting a test for a feature that was removed on purpose, becomes dead friction, and agents learn to route around it with edits the gate doesn't check.How to have bothGate on specific, named evidence tied to the task, and keep the rule list short. When a change is plausibly legitimate, such as a deleted test, route it to a person with the reason attached instead of rejecting it outright. Productive friction stops the corner. Dead friction only teaches the agent to hide it.
- Works with · H-01Continuous State AnchoringHow they combineState Anchoring keeps the environment's live state in view: the branch, the failing tests, the files open. This law adds the session's own state: the turn, the budget, the streak.What you getOne compact header carries both, such as
branch fix/rounding · 1 failing · turn 6/40 · same failure ×3. The agent sees where the world is and where it is in time in the same glance.
Model size changes how the failure looks. Every model is exposed to it, though. The Guide treats model family and size as the user persona, a stance it calls Persona = ModelLexicon · 12Persona = ModelTreating model family, scale and training as the user persona.. A stronger model may notice the loop sooner on its own, and a smaller one may loop longer. Neither can see a budget nobody showed it, and neither should be the last line of defense for your test suite.
Terms from this page
- 49Thrash & Loop Traps
- Repeated near-identical failing calls producing zero environment progress.
- 48Temporal Proprioception
- Injected awareness of elapsed turns, budget consumed and retry counts.
- 50Silent Corner-Cutting
- Quietly lowering standards or declaring premature success instead of failing.
- 04Supervisory UX
- The human principal's interface for monitoring, steering and auditing agents.
- 51Trajectory Map
- Five-phase session arc: orient, explore, act, verify, report.
- 12Persona = Model
- Treating model family, scale and training as the user persona.