Build the harness before you hand the agent real work
Key takeaway: Wire lint, types, build, and tests into a hook the agent cannot skip before you give it real work.
An agent never doubts its guesses, so build the checks that catch them before you hand it real work. A person who writes a plausible line has a nagging doubt and goes back to check. An agent has whatever signal you give it, and if the only signal is “the file was written,” it thinks it’s done.
So what tells the agent a line is wrong? If the answer is “the reviewer, tomorrow,” it will stack ten more guesses on top first.
What each one catches:
- Linters catch the sloppy leftovers of guessing: unused variables, shadowed names, empty branches.
- Type checkers catch calls to methods that don’t exist, with a line number and often a “did you mean.” In an untyped codebase, get that back with gradual types or tests that hit every call site the agent touched.
- The build proves every piece the agent referenced exists and fits.
- Formatters strip diff noise, so the diff you review is only the change.
- A deterministic, local test suite. One that hits the network and fails one run in twelve teaches the agent to reason around red instead of fixing it.
Run them cheapest first, on the changed files, in under a minute. Each layer filters what reaches the next, so a lint failure never waits on a build.
Don’t leave running them up to the agent. Asked to “run the checks when you’re done,” it will sometimes decide it’s done early. Wire the checks into a hook that fires after every edit. In Claude Code, a PostToolUse hook on Edit|Write can run script/check and exit 2 on failure, so the next thing the agent reads is what it broke.
How much autonomy you can give depends on the harness. With no types, no lint, and a twenty-minute suite, you hand the agent small supervised tasks and read every line. With all of it answering in under a minute, you can hand it a feature branch and review the outcome instead of the output.
Any check you leave out is a mistake you’ll be catching by hand.