All courses

The agent knows only what its tools returned

Explain that if the agent did not run the test, it has not seen it pass. Show how truncated output, the wrong working directory or a stale build can mislead it. Read a transcript to tell claims backed by tool output apart from unbacked assertions.

Builds on: A coding agent is a model in a loop, What the agent sees: its context

Read it card by card Start the whole course

'All tests pass' — but which run?

You asked the agent to fix rounding in a Go billing package. Its final message: *'Fixed the rounding in `tax.go`; all tests pass.'* It reads like a report of something it watched happen. Before you merge, ask: is there a command in the transcript whose output shows exactly that, for this change, after this edit? Or is the sentence a prediction?

No tool output, no observation

Recall the loop: the agent learns the current state of your repo through tool outputs added to its context. If it never ran the tests, there is no 'pass' output it could have seen. The sentence is a prediction from reading code. Real output can mislead too: cut off by `head`, run in the wrong working directory, or run against a build older than the edit. **Later cost:** you merge a change nobody actually checked.

Is this claim backed? Four checks

For each claim in the summary, find the tool call behind it: 1. **Exists:** is there a command whose output would show this? No call means unbacked. 2. **Covers:** right directory, package, build target? Did tests actually run (not `no test files`, not `no tests ran`)? 3. **Complete:** did you see the end, the summary line, or was it cut by `head` or the tool's own truncation? 4. **Fresh:** did it run after the last edit, on a rebuilt artifact?

Stale build, cut-off output (TypeScript)

The agent fixed a date bug in `src/format.ts`, ran `node dist/cli.js 2024-02-29` and reported *'output is correct now'*. `dist/` is produced by `tsc`, which it never ran after the edit. So it executed the old code: a stale build. That output says nothing about the fix. Likewise `npm test 2>&1 | head -n 40`: 'no failures seen' covers only 40 lines. Better: `npx tsc && node dist/cli.js ...`, and test output read to its summary line.

Green, real, and beside the point

The output is genuine and green. But `./...` means 'this directory and below', and the agent ran it from `internal/api`. The tell: no output line names `billing`. That package was never compiled or tested. Backed: *api and auth tests pass*. Unbacked: *rounding fixed*, *all tests pass*. Ask for `go test ./...` from the module root, with output. **Later cost:** a broken or still-wrong `tax.go` merged under a green-looking report.
// Go
[edit] internal/billing/tax.go
$ cd internal/api && go test ./...
ok   svc/internal/api       0.31s
ok   svc/internal/api/auth  0.12s
Agent: Rounding fixed in tax.go;
all tests pass.

Point to the run, or it's a prediction

The agent has seen only what its tools returned. A claim counts when you can point to the command behind it: one that ran, covered the changed code, came after the last edit, and showed its end. Everything else is a prediction. Ask for the run.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.