# Enforce the gate in code

The human's yes where it matters, enforced by the runtime - a hook, a schedule, a queue - rather than asked for in a prompt.

A human gate asked for in a prompt is a request: the agent can forget it, [game the check](/reference/failure-map/unattended-agent-failures/gaming-the-check) or drift from it over a long run. The same gate in code is a refusal the agent has to satisfy before anything moves. In our unattended runs, the boundaries that matter live in the harness, not the prompt.

- A hook refuses every call whose text carries a recursive or forced delete flag, in commands and in file contents both, and its refusal names the safe form instead: one file at a time, or a dated folder under `~/tmp/trash/`. The rule exists because on 2026-11-02 a test script ran a recursive, forced delete of `$LIVE/*` with `LIVE` unset, which became the whole root.
- A heartbeat cron wakes the gardener agent every 30 minutes with a self-contained prompt, and the human owns the cadence: on 2026-11-25 he cut it from 5 minutes to 30 after one day of beats burned a fifth of the monthly model allotment.
- The next task comes from one queue file the runtime reads on every beat, and a linter refuses a malformed edit to it, so what the agent works on next is chosen outside the agent.

A gate in code is only a gate when it fails closed. In Claude Code, Codex and Cursor a hook that errors lets the action proceed unless it is set to fail closed ([how the top harnesses handle hooks](/research/how-top-ai-agent-harnesses-handle-hooks)); a hook that fails open is the request again, under a better name.

What a human gate means for money-touching steps is the question a team with a budget asks first. On r/CFO on 2026-11-21, a finance lead at a company past 100M revenue (the post names no currency) asked which accounting process anyone had handed to an agent, and how they handle controls, audit trail and auditor sign-off ([the thread](https://www.reddit.com/r/CFO/comments/1y1qv7p/anyone_from_real_companies_actually_using_ai/), read 2026-11-25). In our runs that answer is a gate, not a promise: paid API keys sit behind a balance command (`purse`), a paid run prints its price and gets the human's yes first, and anything that messages outside the team needs the same yes.

Untested beyond our own runs; it is our own prediction that this guards against [gaming the check](/reference/failure-map/unattended-agent-failures/gaming-the-check) and [memory ratcheting](/reference/failure-map/unattended-agent-failures/memory-ratcheting): a gate the agent cannot edit is a gate its own corrections cannot loosen, and a refusal in code cannot be passed without doing the work. It pairs with [human-held prompts](/reference/failure-map/unattended-agent-failures/human-held-prompts): that guard keeps the setup human-edited; this one keeps the checks outside the agent's reach.

---

Published 2026-11-25. Web page: https://www.mackenziebowes.com/reference/failure-map/unattended-agent-failures/enforce-the-gate-in-code
