Essays/Systems

Hard limits are governance

A guideline needs someone awake to enforce it. A number in the rules file stops an agent at 3am, and it is changed there, in writing, when the evidence says so.

A guideline needs someone awake to enforce it. A number does not: the agent hits it, the check fails, the run stops. So the rules my agents work under are numbers in one file they all read, and when a number turns out to be wrong I change it there, in writing.

One rule is that no file goes over 700 lines. Said as “keep files clean”, every agent reads it differently by Friday. Said as a number, it is a fact an agent can check by counting lines, and a fact I can check the same way. Neither of us has to argue about whether a file feels too big.

It does not bend for code that handles money. A billing handler that had reached 1,214 lines was split into seven modules. A billing API file of 980 lines became seven files, the smallest 31 lines and the largest 284. An SDK entry file of 1,142 lines became a thin re-export over nine modules. A UI component of 823 lines came out as a 74-line shell, a 610-line controller hook and a 293-line presentational component. Each refactor kept the behavior of the file it replaced, and every output landed under the ceiling.

The number itself is nearly arbitrary. That it is a number is not. A file that mixes nine unrelated concerns is the file every agent in that repository has to load before touching anything nearby. It is also the file two agents working in parallel are certain to collide on. The ceiling looks like code style and works as a concurrency policy.

What happened when I overrode my own cap

Concurrency gets the same treatment, and I have changed that number more often than I would like. The rule once capped parallel subagents at two. I raised it to six. Then, in the middle of an incident, looking at a machine with obvious headroom, I told an agent to ignore the six-agent rule I had written days earlier. That is a real weakness of hard limits: the person who set the number gets annoyed at it under pressure.

I kept the rule and wrote the exception into it. The policy now says that if I say bypass the cap, the agent bypasses the cap. Six later became sixteen on a machine that could take it. When a read-only architecture review needed more hands than the standing cap allowed, the exception was stated, scoped to that task and recorded with its reason.

I learned where the ceiling really sits from a rename. An exhaustive rename across a codebase went out as 24 agents at once, 20 editing and 4 verifying. All 24 died on their first message, rate limited, with no tokens spent, and the failure log reported a downstream symptom instead of the cause. The same rename, resubmitted as six agents on non-overlapping files, finished cleanly in under two hours. The fix was not a better retry strategy. It was fewer agents.

Can a limit be too cautious?

Yes, and that failure is as real as the permissive one. A CI suite of 692 files ran with concurrency capped at one, because at some point that had felt like the safe setting. Every push waited more than 60 minutes. Raising the cap to the platform default of 20 cut the same run to between five and ten minutes, with no new failures. The isolation the low cap was meant to protect had never been at risk. A limit that exists out of caution instead of evidence is superstition with a config flag.

Limits that are not a single number

Some limits are ranges. The tool that pastes a prompt into an agent’s terminal waits before pressing Enter, for a time computed from the length of the prompt, but never under 150 milliseconds and never over 4,000. A testing tool that fans work out across sandboxes accepts between one and twelve workers and a request body of at most one mebibyte. Nobody derived these from a formula. They came from watching what broke below the floor and above the ceiling, then writing both numbers down so the lesson does not have to be learned twice.

A UI canvas of ours may render sixteen block types and no more, because an unbounded registry lets every feature request become a new block type that nobody consolidates. Auditing what sits inside the sixteen is a standing task. A cap that is never re-examined becomes sixteen slots of accumulated debt.

Other limits are lists, and the number that matters is zero exceptions. The path agents use to run shell commands refuses a fixed set of destructive patterns outright, such as formatting a filesystem or a fork bomb. No agent gets to argue past the list. A good-sounding reason is exactly how a destructive command gets run by something that does not understand the consequences.

In the tools my agents use, including the loops that maintain the machines in Write loops, not prompts, anything that changes state is off by default, and turning it on means typing an exact confirmation string. An agent can talk itself past a yes in the flow of a task. It cannot do that with a string it has to reproduce character for character.

Why the number has to be written down

None of these numbers is permanent, and none was right on the first guess. 700 lines might be 600 next year. Sixteen subagents might be thirty on a bigger machine. The concurrency default that fixed the 60-minute CI run may need retuning the day the suite doubles. What stays constant is the shape: a hard number, written down, checkable by a script, and changed in the same rules file everyone reads, not in a conversation nobody archives.

A limit that lives only in someone’s memory is not governance, it is a mood.

Agents will generate complexity, spawn subagents and keep running for as long as nothing stops them. That is not malice; nothing told them where the edge was. A number tells them, in a form that needs no explaining again each session. It still holds at 3am, three levels deep in a delegation tree, when the person who could have said no is asleep.

Back to the essays

Field Notes

A letter from Andrei Hasna on building with AI agents

Subscribe by email

By clicking “Subscribe”, I confirm that I want to get email delivered to my address and agree to Andrei Hasna’s Privacy Policy and Terms.

In each letter

  • New essays on AI agents and the systems behind them
  • What Hasna is building, and why
  • Costs, routing and results from real work
  • What did not work
  • News of the book and the podcast