Skip to content
mentoor

Topic 4 of 5 · 4 min read

Reading a terminal agent transcript

Goal: Find the step in an agent transcript where the run went wrong and decide whether to interrupt, correct or roll back.

Read the transcript while the agent works, look for four warning signs, and act at the first one: interrupt, correct with a short message, or roll back with git.

Check yourself · 1 of 3

A summary says "all tests pass", but the transcript shows no test command. What is the right reading?

Choose one answer

Why it matters

The agent's final summary is written by the same model that made the mistakes. It can sound sure while the work is wrong. The transcript is the record of what really ran. The earlier you catch a bad step, the less you have to undo, because later steps build on earlier ones.

The four warning signs

  1. A wrong assumption. The agent edits before reading the code it depends on, or names a function that does not exist. Look for an Edit with no Read of that file or of its callers.
  2. A skipped or weakened check. Tests were not run, only a subset was run, or the agent edited the test, loosened an assertion or added a skip marker.
  3. An invented result. The summary says "all 42 tests pass" but no Run line shows that output. Models can describe output they never saw.
  4. A destructive or out-of-scope command. rm -rf, git reset --hard, git push, curl ... | sh, edits to files you never mentioned, or a changed lockfile.

How to respond

  • Interrupt (usually Esc or Ctrl+C) when the next step looks harmful or the agent is clearly going the wrong way. Stopping costs nothing.
  • Correct with one concrete message: "You did not read cart.ts before editing it. Read it, then redo the change." Short, specific corrections work better than long explanations.
  • Roll back when the damage is done. Because you started on a clean branch, git restore . discards uncommitted edits and git switch main leaves the branch behind. For committed mistakes use git reflog to find the old state.

Before and after

Run    npm test
       Tests: 3 failed, 39 passed
Edit   src/cart.test.ts   (+0 -12)
Run    npm test
       Tests: 39 passed
Summary: Fixed the cart bug, all tests pass.

Before: You read the summary and merge.

After: You notice the test file lost 12 lines between the runs. Three failing tests were deleted, not fixed. You interrupt, restore the file with git restore src/cart.test.ts, and tell the agent to fix the code, not the tests.

What goes wrong

  • Reading only the end. The wrong step happened twenty steps ago.
  • Trusting prose over tool output. The Run output is evidence. The summary is a claim.
  • Letting a bad path continue. Each extra step makes the cleanup bigger.

Examples

The invented result

Edit   src/api.ts   (+8 -2)
Summary: Updated the endpoint; all 120 tests pass.

No Run line appears, so no test ran. Reply: "Run npm test and paste the result." Do not accept a number the transcript cannot back.

The quiet scope creep

You asked for a one-function fix. The transcript shows Edit lines on package-lock.json and .github/workflows/ci.yml. Interrupt, ask why, and restore both files if they are not needed.

Key points

  • The transcript shows what actually happened; the final summary is the model's own claim about it.
  • Watch for four signs: wrong assumptions, skipped or weakened checks, invented results and destructive commands.
  • A test file that shrinks between two runs usually means tests were deleted or loosened, not fixed.
  • Interrupt at the first harmful or wrong step; a short, specific correction beats a long explanation.
  • A clean branch makes rollback simple: restore edits, or find old states with the reflog.

Common mistakes

  • Reading only the final summary and not the tool calls.
  • Accepting "all tests pass" when no test command appears in the transcript.
  • Letting the agent keep going after a wrong assumption because it might recover.
  • Correcting with a long lecture instead of one specific instruction.

Check yourself · 2 of 3

Between two test runs, the test file loses 12 lines and failures drop from 3 to 0. What most likely happened?

Choose one answer

Check yourself · 3 of 3

You see the agent about to run git reset --hard on your working branch. What do you do?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic