I Logged 163 Agent Mistakes. A Guardrail Could Have Stopped 23.
The Exit Code That Lied
My agent reported a long re-embedding job as finished, with exit code 0.
That exit code belonged to the date command that ran after the job. The job had died at 53%. Every tool call in that sequence was allowed.
AWS spent re:Invent 2026 building gates in front of what agents do. AWS Greenlight, in preview since December 1, drafts an agent's rules from your procedures and from its own traces, then enforces the approved ones outside the agent "with deterministic checks on every action before it runs."
IAM's new agent identities give each agent its own identity, so every request traces back to the agent that made it.
The re:Invent news brief adds Amazon Bedrock Gateway, a gated preview that sets a dollar spending limit per user, group or IAM role and stops requests before they reach a model.
Every piece of that stack is about what the agent does: the call it's about to make, the money it's about to spend, the permissions it acts with. AWS pitches Greenlight to builders who want agents to do more "without a person approving every step," and it ships as a plugin for Claude Code.
My mistake log points somewhere else. Most of what went wrong was a false claim, like that "finished," made while every tool call was allowed. 76% of the logged mistakes were things the agent said.
163 Mistakes, Sorted by Where They Could Have Been Stopped
My agents run in Claude Code, and they log every mistake that reaches me in one log: what happened, why, and the rule it produced. Between August 16 and December 4, 2026, that log collected 163 entries.
I had my agent sort all 163 by one question: where could this have been stopped?
- 124 of them (76%) were false claims. The agent told me something untrue, or wrote it into a record as fact, and every tool call it made along the way was allowed.
- 23 (14%) were actions that a rule written in advance could have blocked at the tool boundary.
- 13 (8%) were permitted changes that were simply wrong, the kind tests and code review catch.
- The last 3 were judgment slips.
| Where it could have been stopped | Count | Share |
|---|---|---|
| False claim, every tool call allowed | 124 | 76% |
| Action a rule written in advance could block | 23 | 14% |
| Permitted change that was wrong | 13 | 8% |
| Judgment slip | 3 | 2% |
| Total | 163 | 100% |
Twelve of the labels were judgment calls. Flip every one toward actions and actions top out at 27 (17%). Claims never drop below 121 (74%).
The limits are real. This is one operator and one agent stack, and the labels came from my own agent. The log only holds mistakes that reached me. An action a hook blocked or a bug a test caught never got logged, and neither did a false "done" that nobody re-checked, so I can't tell which way that tilts the split.
The 23 Action Mistakes Are the Ones Gates Exist For
Eight of the 23 were secrets or tokens printed into a transcript or committed to git. One of those came from a filter: the agent filtered a config file with grep -v key to keep credentials out of the transcript. The setting's name ended in _api, and the API key printed.
Among the other 15, the agent ran a pull request's checks and its merge in one command, and the merge went through while the secret scan was still pending. It also stopped a test server with pkill. BSD pkill read the options after the pattern as more patterns, and it signaled most of my processes.
Each one maps to a rule you can write before the session starts.
- Read config files through an allowlist, never a denylist.
- No merge while a required check is pending.
- No
pkillby pattern; stop a process by its PID.
Greenlight is a preview, so whether it catches these exact cases is open. They're the kind of rule it says it enforces, and they're the mistakes that leave visible damage: a key in a transcript, a dead process tree, an unscanned merge. Gating them is worth paying for.
Every Tool Call Behind the 124 Claims Was Allowed
The claims split three ways. Of the 124 claims, 65 were never checked at all: an inference, a guess or a memory stated as fact. 46 were checked with a probe that could not have seen the problem. 13 rested on stale evidence.
Never checked looks like this. It wrote 19:20 into my daily log when the clock said 19:16. The rule against typing times instead of reading the clock was already loaded in its instructions. It relayed another agent's guess about what a reboot would do as if it were fact.
The blind probe is the most dangerous shape, because the agent did the right ritual. The re-embedding job is the purest case. The log entry records the command's shape; the script name here is a placeholder:
node reembed.js ; date ; echo REEMBED_EXIT = $?
# $? is date's status, so this prints REEMBED_EXIT=0
On December 4, my agent told me the links in an email draft were clean. Its check searched the message text. The links lived in the HTML, rewritten into redirects, and the email went out that way. It reported that hosts on my network had no open ports. macOS had denied the probe local network access, and the socket call reports that the same way as a closed port.
Stale evidence is the quietest. It gave me a machine's IP address from the previous day's probe. That morning another session had moved the address, and I screen-shared to the wrong one.
An Approval Prompt Carries the Agent's Claim With It
The obvious fix is to put a human in front of risky steps. But the human reads the agent's description of the step. One false claim sat inside an approval prompt. A cleanup question told me a change was 'this host only'. The file it changed sits on a network share that every machine reads.
Descriptions of risky steps fail the same way outside prompts, too. It once promised about a minute of downtime for a container restart, and 32 of 33 containers stayed down until it started them by hand.
This is the strongest case for Greenlight, and it holds. A deterministic rule that checks the actual file path against a list of shared mounts doesn't care what the prompt says. If your approval flow shows the agent's summary instead of the raw action, a rule engine is the better reviewer. That's the one approval-prompt case in this post, and it's one of the judgment calls: the sort called it a claim because the harm came from the description, though a path rule could have caught the change itself.
Most claims offer no risky call to gate at all. A search, a probe, a log line, a status message: the call was fine and the sentence was wrong. That part is my argument, not something the sort proves.
AWS Already Checks Claims Against Policy, but Not Against the World
AWS does sell claim checking. Automated Reasoning checks in Amazon Bedrock Guardrails, generally available since August 6, 2025, validate model output against a policy you define. InfoQ's Greenlight coverage draws the line plainly: those checks evaluate what a model says, while Greenlight decides whether a tool call may proceed.
As I read them, neither checks a statement against the world. Automated Reasoning compares an answer with a policy. Greenlight inspects a call before it runs, arguments included, so a rule could match a path against a list of shared mounts someone maintains. Neither asks whether "no open ports" is true right now.
A policy can say "never report a job finished without a zero exit from the job itself." It can't know which process the zero came from. That answer lives on the machine, and only a probe can fetch it.
A Claim Should Be an Action the Agent Harness Can Re-run
Every one of those 163 mistakes produced a rule. The rules for claims are prose: check the field where the defect lives, prove a probe can come back positive before trusting a negative, re-observe before reporting. Prose doesn't enforce. The wrong timestamp happened with its rule loaded.
My proposal: make a claim an action. Every status claim ships with the command and output that support it. The agent harness re-runs that evidence at the boundary before the claim reaches a human. And a negative claim ("nothing open," "not mounted") gets refused until the same probe has returned a positive on a known-good target.
Here's a sketch, with illustrative addresses and table names:
reembed_claim = {
"text": "Re-embed finished",
"polarity": "positive",
# Full-table re-embed: rows this run wrote must equal rows in the source table.
"evidence": {
"cmd": "sqlite3 index.db \"SELECT (SELECT count(*) FROM embeddings WHERE run_id = 'r42') = (SELECT count(*) FROM chunks)\"",
"expect_stdout": "1"
},
}
port_claim = {
"text": "No open TCP ports in 1-1024 on 192.168.1.40",
"polarity": "negative",
"evidence": {
"cmd": "nc -z -w 2 192.168.1.40 1-1024",
"expect_exit": 1
},
"control": {
"cmd": "nc -z -w 2 192.168.1.10 22",
"expect_exit": 0
},
}
def gate(claim, run):
if claim["polarity"] == "negative":
if run(claim["control"]["cmd"]).returncode != claim["control"]["expect_exit"]:
return "REFUSE: probe can't see a known positive"
result = run(claim["evidence"]["cmd"])
ev = claim["evidence"]
if "expect_exit" in ev and result.returncode != ev["expect_exit"]:
return "REFUSE: evidence changed since the claim was made"
if "expect_stdout" in ev and result.stdout.strip() != ev["expect_stdout"]:
return "REFUSE: current value doesn't match the claim"
return "PASS"
The control runs through the same probe as the evidence. If the probe can't reach the network, the control fails too, and the gate refuses "no open ports" before anyone reads it. In Claude Code, the gate could sit behind a dedicated reporting tool, with a PreToolUse hook that runs it and blocks the call on REFUSE. The agent gets the refusal back instead of a delivered status line.
That only holds if the agent has to use the tool; a claim typed straight into the chat skips it. The cost is real too: every status line now carries a re-run, which adds latency, and someone has to maintain a list of known-good targets. The gate also runs commands the agent supplied, so those need the same policy as any other call, a read-only allowlist at minimum.
The sketch has holes. The control runs against a different host, so it proves the probe works, not that the target is reachable. A target that's powered off, moved or filtered also makes nc exit 1, and this gate would PASS "no open ports" for a machine that isn't there. A reachability check against the target itself narrows that, though a host that drops everything still looks like a quiet one. The agent also writes the evidence queries here; a real gate would pick them by claim type, so no agent can hand it a query that always passes.
Some claims have no command to re-run: an inference, a memory, a promise of about a minute of downtime. The honest move for those is to refuse them or mark them unverified.
I haven't wired any of this into Greenlight, and Greenlight is a preview whose rules govern tool calls. A claim submitted through a tool call is at least something a tool-call gate can see. A claim written as prose isn't.
For "finished," the evidence that counts is rows written against rows given, not an exit code. That is how the re-embedding job finally got caught. The orchestrating session counted the rows the job had written, and the job had stopped at 53%.
Comments
No comments yet. Start the discussion.