---
title: "Let the agent check its own work · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/agent-verifies-own-work
updated: 2026-10-20
licence: "All rights reserved"
---

# Let the agent check its own work

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Working in small steps](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps)
- Rule: Give the agent the means to see the result of its change. It runs the checks after its last edit, before it reports done.
- How: Name the check command and the test data in the instructions file. For screens, give the agent a browser driver or screenshot tool, such as Playwright, so it can look at the page. For servers, let it read the local logs. Where the agent supports it, add a hook that runs the check command when the agent tries to finish and sends it back on failure. The example below uses the Claude Code settings format. Cap the turns per session, so a check the agent cannot fix does not loop forever.
- Check: In every session log, the check command runs after the last file edit and passes. A deliberately broken test makes the agent keep working instead of reporting done.

Example:

```json
{
  "hooks": {
    "Stop": [{ "hooks": [{ "type": "command", "command": "./check.sh >&2 || exit 2" }] }]
  }
}
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers ai development playbook: https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/agent-verifies-own-work`.

- Previous: [Keep one task per session](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/one-task-per-session)
- Next: [Keep each change small](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/small-diffs)
- [Working in small steps](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps)
