Rules, Reminders, and Scripted Checks for a Team of Coding Agents
Published:
In Running a Team of Coding Agents I described one agent that supervises the others, a shared job board, and throwaway containers. Now, we have thirteen agents from several vendors, some on paid plans and some on free models. We now turn our attention to what an agent may do without asking, how a job survives when an agent stops or forgets, and how we know a claim of “done” is true. This post walks through those rules and the small tools that enforce them.
One rule book for every agent
Each agent harness looks for its instructions under a different file name: Claude Code reads CLAUDE.md, Codex reads AGENTS.md, Gemini reads GEMINI.md, and so on. Rather than keep thirteen copies in step, I keep one file and link it into each agent’s folder under the name that agent expects. Every rule is written once, with the date I decided it and my reason, so an agent that meets a rule it does not understand can read why it exists. A companion file holds the longer background, keyed by the same headings, so the rule book itself stays short enough to read at the start of every session.
Permissions decided by one tested function
Every agent asks permission differently. Some have a built-in judge that classifies each command, some ask for every shell command, and some only have allow and deny lists. I started with pattern rules in each harness’s settings, such as “ask for any command containing rm.” Those rules were wrong in both directions: a job-board note that mentioned rm in its text triggered a prompt, while the same deletion written inside a here-document or a script file passed silently.
Now one Python function, policy(), makes the decision for every agent, called from each harness’s hook. Its rules are short:
- reading, copying or sending secrets is denied;
- anything that cannot be undone asks: deleting files,
sudo, force pushes, publishing a package, sending mail, writing to an outside web service; - everything else is allowed, anywhere.
The function parses shell quoting, so text inside a quoted note is data, not a command. It also reads the body of a here-document, an inline python3 -c script, or a short script file named on the command line, and judges what that script does. Because every agent shares the same function, a permission change is one edit and one test run instead of thirteen configuration files.
Staging Items for Deletion
Cleaning up after a job is where agents most often asked me for permission, because a cleanup is a deletion. A small tool, bill-scratch-stash, moves each path into a dated folder under a scratch directory and appends a line to a log with the original path, owner, size and a note. Because nothing is destroyed, an agent may run it without asking, so temporary files, build output and finished work folders get tidied as the work goes, and anything moved by mistake can be put back from the log. Only emptying the scratch area itself needs my approval, and a disk check proposes that when the disk passes 80 percent full.
Two computers and throwaway containers
All the agents run on one small always-on server, which also runs my own services. A second computer sits mostly idle, so builds, test suites, linters and other heavy jobs go there. A wrapper, bill-dockrun, copies a project folder to that computer, runs a command in a fresh Docker container with the folder mounted, brings the results back, and removes the container. An agent can install packages, run unfamiliar code, or make a mess inside the container without any effect on the server, and every run starts from the same clean image.
The same approach covers software that normally needs a device. HerdrDroid, my Android app for supervising the agents from a phone, has its interface tests run under Robolectric, which simulates the Android framework on an ordinary Java virtual machine, so they run inside a container with no phone or emulator attached. The screenshots in its documentation come from an Android emulator connected to a demonstration computer that runs Herdr with stand-in agents, where every name, path, chat and usage figure is made up. As a result, the app runs against a realistic server, and no real data appears on screen. A web front end can be treated the same way, with a headless browser inside the container driving the pages.
The Kanban Board for Tracking Jobs
Every job that takes more than one reply gets a card on the shared board, with its status, owner, next step and a dated log of what was done and the evidence for it. Any agent can resume any card, so a job continues when the agent working on it stops, whether it hit a usage limit, filled its context, or finished a step and waited for input that never came.
Two scripts keep the board moving without calling a language model. A scheduled job every fifteen minutes finds agents that are idle while they own open cards and sends each one a short reminder listing its cards. It also sends one reminder whenever a card changes status or another agent writes a note on it, so a coordinator learns that a worker finished even if the worker’s reply never arrived. It never answers a prompt, because an approval prompt belongs to me. The second script, a stall watcher, runs while a coordinator has work out with other agents, and wakes it when a worker has been idle for fifteen minutes or a prompt has waited for five. I added it after a night in which a reviewer’s blocking finding sat unread in a file and another agent waited on an unanswered question until morning.
Scheduled Context Resets
A long session eventually fills its context window, and the harness then summarizes the conversation, which loses detail in ways that are hard to predict. Instead, each session resets itself at a quiet moment. Before a reset, the session writes a handoff file with the requests still in progress, the questions waiting on me, the work it has sent to others, and the background watchers it was running. A tool then restarts the agent on a fresh session once it goes idle, and sends the new session a first prompt: read the rule book, read the handoff, read your cards, restart the watchers, and carry on.
A scheduled check estimates each session’s context use. At 70 percent it asks the session to write its handoff, and at 85 percent it performs the reset itself. It also watches how quickly context grows: a session that has grown fifteen points in an hour is asked to hand its remaining reading and building to fresh subagents rather than doing that work itself.
A coordinator and fresh workers
The same idea applies to every task. The main session in each agent’s tab acts as a dispatcher: it reads the board, writes a brief for each task, hands the brief to a new subagent with a fresh context, and keeps only the short result. Agents near the end of their context window stalled, stopped early, or repeated themselves, while a fresh worker with a tight brief usually finished in one pass.
A brief is self-contained. It names the goal, every input and output path, the exact commands where possible, what is out of scope, the safety rules that apply, a concrete test for “done,” and the single line the worker should reply with before it stops. The coordinator also picks the model for each brief: the strongest model for design, debugging, reviews and writing, and a cheaper, faster one for following a tested procedure, searching files or running tests. Workers on free models get only scripted jobs whose results a script can check, because deciding how to split work is itself a judgement that weaker models do poorly.
Pacing the paid plans
The paid plans have weekly usage windows, and the same accounts serve more than one computer. A small monitor compares each account’s use with a straight line across its week, about 14 percent a day, and wakes the coordinator when an account runs eight points ahead of that line. While an account runs ahead, its agents coordinate and review, and the routine work shifts to the free agents. Every agent also pauses itself at 95 percent of any limit: it finishes the current step, records on each of its cards what was in flight, and starts nothing new until the readout drops.
Checks that run as scripts
Every report of progress cites its evidence: a test count, a file and line, or command output. When a check can be written as a script, it goes into the repository as one rather than being left to a model, because a script gives the same answer every time and is cheap to rerun. Models review design and logic, and scripts check for host names, broken links and similar mechanical problems.
Several of these checks now run when code is committed rather than just before a release. A single checker, bill-repo-checks, runs as a git pre-commit hook and in continuous integration on every branch. It scans for private network addresses, email addresses, home directory paths, key headers, token-shaped strings, em dashes, broken links in the README, and oversized files. The patterns that are private to my own setup, such as machine names, live in a file outside every repository, so the list of things to hide is never itself committed. Findings report the file, line and rule, and mask the matched text.
Integrating many fix branches into a release had been a long job for one paid agent. A merge queue, bill-merge-queue, now does it as a script. It takes one reviewed branch at a time, merges it in a fresh clone, runs the project’s tests in a throwaway container, and pushes the integration branch only when the tests pass. A conflict or a failing test pushes nothing and writes a note on the card. It refuses to push to the main branch unless a repository opts in, and it can never force a push or delete a branch.
Limiting work in progress
With the reminders and the board, an agent could start every job it owned and finish none of them; at one point my own coordinator had twelve cards in progress. Each agent now keeps at most four cards in progress, and the board tool refuses a fifth. A card that is waiting on a build, a test run or another non-model job moves to “blocked” with a note naming the job, which frees its slot, and the agent takes another card only when a quick check of processor load, memory and disk says there is room. When the job finishes, the card returns to “in progress” regardless of the limit.
Resources
- Herding Agents, on running many agents under Herdr
- Running a Team of Coding Agents, on the supervisor, the job board and throwaway containers
- HerdrDroid, the Android app for supervising agents from a phone
- Robolectric, which runs Android tests on a Java virtual machine
