The Coding Agent Harness: Hooks, Verification Gates and Allowlists You Set Up Once
One verification command, hooks that enforce it, typecheck and lint failures routed back to the agent, and permission allowlists so it stops asking you.
Contents
What is an agent harness, and what does it actually stop?
What is the one command the agent must run and pass?
How do hooks turn a rule the agent can ignore into one it cannot?
How do you make a failure go back to the agent instead of back to you?
| Hook event | Exit 2 blocks? | What happens |
|---|---|---|
| `PreToolUse` | Yes | Blocks the tool call before it runs |
| `PostToolUse` | No | Tool already ran; stderr is shown to Claude |
| `Stop` | Yes | Prevents Claude stopping, continues the conversation |
| `SubagentStop` | Yes | Prevents the subagent stopping |
| `PostToolBatch` | Yes | Stops the agentic loop before the next model call |
| `Notification` | No | Exit code and stderr are ignored |
How do you stop the agent prompting you on commands you already trust?
How do you set up environment and secrets once so it stops asking?
What is the equivalent setup in Codex, Cursor and Aider?
| Tool | Enforcement layer | Permission control | Verification loop |
|---|---|---|---|
| Claude Code | Hooks in `settings.json`, 31 events, exit 2 blocks | `permissions.allow` / `deny` / `ask`, `defaultMode`, OS sandbox | `Stop` hook running one command |
| Cursor | `hooks.json` at `.cursor/hooks.json`, events including `beforeShellExecution`, `afterFileEdit`, `stop` | Hook response `permission` field of `allow`, `deny` or `ask` | `afterFileEdit` plus `stop` hooks |
| Codex CLI | `[hooks]` in `config.toml`, behind a feature flag | `approval_policy` of `untrusted`, `on-request` or `never`; `sandbox_mode` of `read-only`, `workspace-write` or `danger-full-access` | AGENTS.md instructions plus sandboxed shell |
| Aider | `--auto-lint` (on by default) and `--auto-test` | Repository map and confirmation prompts | `--lint-cmd` and `--test-cmd`, errors fed back on non-zero exit |
Where should the harness still stop and fetch you?
Frequently asked questions
Build the harness once, then stop watching every run
buildAcademy teaches builders the verification and enforcement setup that makes a coding agent trustworthy without supervision, the same habits we run in every buildDay session.
See buildAcademyRelated Guides
How to Run Multiple AI Coding Agents in Parallel Without Git Chaos
Claude Code's --worktree flag, tmux panes, and five overnight guardrails that stop parallel agents overwriting each other's work while you sleep.
AI Said It Works. How Do You Know?
Bryan Ho asked it in a build-day sign-up: how do you trust AI-generated code? Here's the in-the-moment habit for deciding what to check and what to believe.
How to Work With an AI Coding Agent in a Codebase Too Big to Explain
Repo maps, layered CLAUDE.md and AGENTS.md files, scoped file sets and handover notes that keep a coding agent oriented in a large repo and across sessions.