Nothing said no
In two days, my hosting provider ran 754 builds on 30-core machines. On a separate occasion, GitHub Actions burned 4,000 hours in 45 minutes across two accounts.
No one hacked anything. No rule was broken. I had coding agents working in parallel, and every one of them did what it was allowed to do. They pushed branches. They rebased and force-pushed. They merged. Each of those is an ordinary action, and each one could start a build on a machine billed by the minute.
I had written instructions. Batch your pushes. Don't rebuild what hasn't changed. Use the local check. The agents read them, and mostly followed them. But "mostly" multiplied by several agents and hundreds of builds is a bill, and nothing in the system was positioned to say no.
That's the part I keep coming back to. The agents didn't exceed their authority. Their authority was simply larger than anything I had meant to give them.
The authority in the room
When I start an agent in a terminal, it runs as me. It has my shell, my Git remotes, my signed-in command-line tools, my cloud sessions, and whatever tokens happen to be in the environment. Before it reads a single instruction, the set of things it can do is already fixed. It's everything I can do from that prompt.
Security people call this ambient authority: power that comes from where a process runs, not from what it was asked to do. It's convenient, and it is why agents feel capable so quickly. There is no setup step where you hand over permissions. They are just there.
The trouble is that ambient authority has no shape. My deploy token doesn't know the difference between a staging preview and a production release. My Git credentials don't know whether a push is the fifth of the hour or the five hundredth. They answer one question, is this me?, and the answer is always yes.
So the agent's real authority isn't the task I described. It's the union of every credential in reach, at full strength, for as long as the session lasts.
Instructions are not boundaries
My first response was to write better rules. Longer instruction files, sharper wording, the incident spelled out in numbers so the agent would understand the stakes. It helped. It didn't solve anything.
An instruction is advice to the thing being constrained. The agent reads it, weighs it against the task, and decides. Most of the time it decides well. But it can misread the rule, forget it as the context grows, decide this case is an exception, or follow a different instruction that arrived later in a file or a web page. Each of those failures is rare. Run enough agents for long enough and rare becomes Tuesday.
A boundary is different. It's enforced somewhere the agent can't edit, by something that doesn't need to be persuaded. A push that is refused is refused whether the agent understood why or not.
The distinction sounds obvious written down. In practice, it is easy to blur, because instructions and boundaries can look alike. Both are text. Both mention the same actions. The test is simple: if the agent decided to ignore it, would anything stop it? If not, it was advice.
Who decides?
If instructions can't hold the line, the decision has to move out of the agent entirely. That's the idea behind ACP Gateway, a small service I built to sit between agents and the actions that matter. It's my own tool, built for my own work, so take it as one way to move the decision, not the only one.
The design rests on one choice: the gateway decides; it doesn't publish rules. Before a protected action, the agent asks a narrow question: may this caller perform this named action against this named repository? It gets back one of five decisions, ALLOW, DENY, AUTH_REQUIRED, REVERIFY_REQUIRED or QUARANTINE, each with a stable reason code. The policy that produced the answer stays on the server. In the words of its README, an agent never receives rules it could reinterpret, misapply, or be talked out of.
That last phrase matters more than it looks. If the agent holds the policy, the policy becomes one more piece of context to reason about. It can be summarized wrong, weighed against a deadline, or argued with by a cleverly worded file. If the agent only holds the answer, there is nothing to argue with. The question was asked; the answer was no.
It also changes what an instruction file is for. Mine still exists, but it no longer carries the weight. It tells the agent how to ask, what each answer means, and to stop when the answer isn't yes. The boundary lives somewhere else.
Fail closed, and stay closed
A boundary is only as good as its behavior when something goes wrong. If the gateway is unreachable, the safe answer is no. If the answer is ambiguous, the safe answer is no. ALLOW permits exactly the action that was asked about, not the next one, and not a similar one on another branch.
Latchkey, the credential tool I described in The Credentials We Learned to Copy, follows the same rule from the other side. When it refuses to release a secret, it exits with code 77, and the guidance to agents is plain: stop and ask; don't retry. A retry loop is how a refusal turns into a negotiation.
The subtler failure is delegation. Agents can start other agents. If a denial applies to one agent's name, the obvious workaround is to ask a second agent to do the same thing. So the gateway records which agent asked, and gives that field no weight at all. A different model, a shell script, a CI runner and a second agent get the same answer to the same request. Delegating a denied action doesn't convert the denial into permission.
The same principle runs through how I work with agents generally. An approval relayed by another agent is not my approval. If a sub-agent says the owner agreed, that is a claim, and the approval still has to come from me.
Meter what costs, before it starts
The build incident wasn't a security breach. It was a budget breach, and that turned out to need the same treatment. An invoice is an audit log that arrives too late to help.
So the gateway treats five actions as metered: a push that starts a hosted build, a merge that deploys production, a manual CI run, a heavy build outside the local build register, and a heavy sub-agent. Each is decided before it happens, not reviewed afterwards: builds, merges and CI runs against daily budgets, heavy sub-agents against a limit on how many run at once, and a heavy local build only with a stated reason.
The check reads what the exact commit would actually build. A commit no provider builds is allowed and not counted. Asking twice about the same commit is answered from the record, not counted twice. A CI workflow with no timeout or no concurrency group is refused outright, with the lines to add. Within budget, the answer is ALLOW and nobody is interrupted. Past it, or for production, the answer is AUTH_REQUIRED, along with the exact grant command for me to run.
The defaults are deliberately small: twenty hosted builds per repository per day, sixty in all. Measured against 754 builds in two days, that is the whole point.
What the agent can't grant
The last piece is the shortest list: the things an agent can never do for itself. It can't approve its own exceptions. It can't widen its own grant. It can't approve anything that reaches production. Those approvals come from me, from my own terminal, for a named action and a limited window. There is also a stop switch any session can pull, and only I can reset.
None of this makes the agents less useful. Most of what they do is routine and passes without a prompt. What changed is where the edge sits. It used to be wherever my credentials happened to reach. Now it is a decision someone made on purpose, kept somewhere the agent can't edit.
I still write instructions. The agents still mostly follow them. But I've stopped asking how much I can trust an agent, because the honest answer is "usually", and usually is not a control. The better question is where the decision sits when that trust turns out to be wrong.
The agents didn't take that authority. We gave it to them by default, every time we started one in a terminal that could already do everything we could. Taking it back is less about the agent than about us: deciding, ahead of time, what we are actually willing to let it do.