Contents7 of 15Download the PDF (892 KB)

Before You Blame the ModelPart II · The Voice: how you talk to it

Chapter 06Tools and guards

Guards beat signage

I built an agent full of helpers, switched them all off, and nothing changed. 8 out of 8 tasks passed either way.

2 min read

The obvious conclusion was that the helpers were useless. I almost wrote it down. Then I audited what "switched off" actually meant.

When I counted, 28 of the helpers were advice: text slipped into the model's context saying things like "you've read this file already" or "you haven't run the tests since your last edit." 6 were real mechanisms that actually blocked or changed an action. My off switch only removed the text. All 6 mechanisms ran in both versions.

So the experiment had measured exactly one thing: whether signs work. They didn't. A sign asks the model to close the door. A mechanism closes it.

It got better. Two of the helpers were half switched off. The code that made the advice also quietly changed the agent's state, and Python runs the inner call before the outer one, so the state change happened even when the advice was suppressed. My "off" arm was running half the treatment.

Prose can be ignored. A guard can't.

#Turning signs into guards

  • Cut the menu, at dispatch. If an action isn't allowed right now, refuse it when the call comes in, and say why. Do this in code, not by removing the tool from the list, because a list that changes every turn breaks your cache (Chapter 3).
  • Fail closed, with a name. When your code can't do something safely, stop and give a specific reason the model, and you, can act on. "Not available until the tests have run once" beats a generic error and beats silently doing the wrong thing.
  • Make the right move the easy move. If you want the model to run tests after editing, have the edit result include the test run.

#Tools are the doors the model walks through

How a tool is shaped can matter as much as whether it exists. In the SWE-agent study, a file viewer that showed 100 lines at a time beat one that showed 30 lines (18.0% against 14.3% solved), and both beat showing the whole file (12.7%) (Yang et al., 2024; GPT-4 Turbo on SWE-bench Lite). Too little context and too much both hurt.

Edit tools matter even more. Can Bölük changed nothing but the edit format in one afternoon and reported one model jumping from 6.7% to 68.3% on his benchmark, with the new format winning for 14 of 16 models (Can Bölük, "We improved 15 LLMs at coding in one afternoon", Feb 2026). Gains like that depend heavily on the model, so don't expect a 10x on a frontier model. Do expect that a weak model plus a fussy edit format looks exactly like a dumb model. In my runs, small models edited most reliably with many small exact search-and-replace edits rather than big rewrites. I don't have a clean controlled number for that one, just a lot of runs pointing the same way.

CodePythonSteal this · a guard at dispatch
def dispatch(call, state):
    tool = TOOLS.get(call.name)              # the tool list itself never changes
    if tool is None:
        return tool_error(f"unknown tool {call.name}")
    reason = blocked_reason(call.name, state)  # e.g. "tests haven't run yet"
    if reason:
        emit("guard_blocked", tool=call.name, reason=reason)
        return tool_error(f"{call.name} isn't available yet: {reason}")
    try:
        return tool(**call.args)
    except Exception as e:                   # a failed tool is a result, not a crash
        return tool_error(f"{call.name} failed: {e}")
Before You Blame the Model7 / 15