João RamiresInstruction manual

Notebook

My orchestrator: the main agent that plans, approves and asks me last

On 29 November my orchestrator ended a status report with “The queue is empty.” I stopped reading. I knew I had left hundreds of items in my planning app, and I had just put the orchestrator in delegation mode to work through them. I asked what it meant by an empty queue, and whether it had finished everything open there.

The orchestrator was telling the truth about the queue it had read, a list of work waiting on the development machine. It had never looked at the queue that counts. When it did, the planning app held about 400 ready items across five projects. That one wrong word shows what I want from the orchestrator and what I had to build around it: a main agent that always knows what comes next, finds it in the right place, and bothers me only when it must.

The orchestrator is my main Claude Code session. I described it as one part of a larger setup in a jail, a factory and an orchestrator. This article is its own story: how I configured it, what I let it decide for me, and the days it got that wrong. The jail that holds the other agents and the factory that moves their work stay in the background here.

What it does, and what it keeps for me

It plans the work, writes a brief for each builder, reads what comes back, reviews it, approves the plan and the result for me, and merges. Every builder and reviewer it starts runs in the jail, and the orchestrator checks their reports as untrusted text, because a report is only a claim. It writes documents and never code. I told it so on 10 October, and a hook now refuses any edit it makes outside its own notes folder.

It also decides when I am not around. In early October I wrote that if I delegate the execution, it can approve plans on my behalf, so that it and the other agents don’t sit waiting for me. A few days later I said I did not want to approve things actively, that this was why I had an orchestrator. On 8 November I went further: choose for me, and call me only when you really can’t decide. Its approvals carry that trail. Each record names the orchestrator, quotes my words with their date and never says that I approved.

What it may not decide is short. I come in for real money, secrets, sudo and logins. I also confirm, at a terminal, any branch that touches a path the jail protects. No agent can type that for me, and the orchestrator can’t either. A subagent can’t approve or merge at all, and a hook refuses it. Everything else the orchestrator should finish alone, or leave to software that stops it.

Keeping it working

My first complaint about the orchestrator was that it stopped. On 5 October I said I wanted the system to keep running without my manual work or approval, not waiting for me after a compaction (the agent’s memory squeezed into a summary). A count of the stops showed it also waited between tasks and at a usage limit. In the transcripts I had on disk, 8 subagents had stopped at a usage limit, and the orchestrator resumed 7 of them by hand, six of them 2.4 to 7.8 hours later.

Three pieces of setup came out of that.

  • Rules and state at every start. A hook runs when a session starts, resumes or compacts. It hands the orchestrator its own rules file and the state of the work. The rules of the main agent live in that file and not in the file every agent reads, so builders don’t pay for them.
  • A gate on stopping. When the orchestrator tries to end its turn while a ready item exists, a hook blocks the stop and names the item. The gate has a cap of 20 blocks per hour, a snooze and an off switch for me, because a session that never stops has a cost too.
  • A wake-up prompt. A recurring /loop runs a short prompt, which I show below.
The wake-up prompt, trimmedTEXT
Read the work queue. Do the first ready item: the line names the action,
and the rules file has the rest. If the queue is empty, answer "idle" in
one line and stop. An item that must wait, or needs me (real money,
secrets, sudo or a login), gets snoozed with a reason, and a branch
gets the state "blocked" with the reason.

The prompt holds no clever idea. It points the agent at one queue, gives it one verb, and says what to do when nothing is left. The rest sits in the rules file.

flowchart TD
  S[Session starts or compacts] -->|hook| R[Rules and state loaded]
  R --> Q[First ready item]
  Q --> W[Plan, brief, review, approve]
  W --> G{Ready work left?}
  G -->|yes| Q
  G -->|no| I[Idle]
What surrounds one turn

Remembering what I said

A rule I state once in chat has to apply in every later session. Consilium, the planning app my agents and I share, records my words as decisions, each with a matter that names its scope. The orchestrator’s own rules sit under matters that start with orchestrator..

Two hooks join the session to Consilium. At the start, one prints the queue and what waits. At the end of each turn, a second flags any message of mine that reads like a decision but has no record, and the orchestrator records it or says why it holds none. The Consilium article tells the day this would have saved me, and the day it came too late.

The part I add here is a cost. The orchestrator re-reads its standing rules in every loop, about every half hour. The command it used took one whole matter, so each read printed every decision and the agent filtered by hand. There were 104 decisions under the prefix and 54 rules actually in force. I added a prefix match and a “newest of each matter” flag to Consilium, so one command now prints what is in force. A rule set that grows by adding decisions needs a “what holds now” read, or every reader repeats the same filter and can get it wrong.

Finding the next job

The empty queue from the opening came from two lists. The development machine had a queue of its own, and Consilium had the queue I care about. My rule, from the same week, is that everything ready belongs in the queue, and that planning an item counts as work. I put it harder than that: records that never reach the queue make Consilium pointless.

So the orchestrator takes the first ready item of the Consilium queue, and a plan counts as an item. I also told it not to build everything blindly. Items age. A decision made after a record can turn it into nonsense, so before it builds an item, the orchestrator checks that the item still makes sense. When I asked about the empty queue, the orchestrator read the right one, found the 400 and chose a triage pass of 20 items at a time. A jail agent reads each one and marks it done, out of date, mine or to build, with a size. Builders take the “to build” ones in groups, and the orchestrator closes the others with a reason.

I set a second rule in November. If I am slow to answer for more than 20 minutes, the orchestrator starts something else, and if the project in front of it is blocked, it moves to another project. My waiting time is not the system’s waiting time.

Where it got things wrong

The orchestrator makes mistakes of its own, and I keep each one as a lesson in Consilium. Five of them changed the setup, and the overview tells three more: a fetch chained to a fast-forward, a rule it said it had recorded and had not, and a block it should have fixed instead of asking me.

It trusted a stale row. On 24 November the work board still showed five branches as waiting for review or for me. I had answered the steps, and all five had been reviewed and archived the day before. The orchestrator believed the board, started two builders, made two new batches and asked me to confirm a fetch the merge did not need. It found the repeat when it listed the archived changes of the waiting batches, and stopped the builders after 9 and 2 minutes. Five days later the board was wrong the other way: a finished branch sat as “working” for 42 hours after its fix merged. A board row is a note. The branches and the archive are the facts, so now it checks, with git, that no open batch already holds a branch tip before it batches it, and a run that ends moves its branch on the board by itself.

It named a cause it had not read. On 27 November it told me four replays waited behind the nightly test run. The builder it briefed was asked to confirm the premise first, and read the code and the data. Each run decides alone, the replays had started before the nightly, and the real fault was the reverse: the nightly waited 59 minutes while small jobs took the room. Building from the orchestrator’s guess would have fixed something that was not broken. I had written the rule in October: verify, don’t guess. Now a plan brief asks the builder to check the premise, and the orchestrator reads the admit lines before it names a cause.

It reported a partial run as a pass. After a Claude Code update, it ran the escape suite of the jail, saw 22 passes and 0 failures, and asked me for the new baseline. The jail’s health check then said the run covered 22 rows of 32. The full run needs a flag, and the orchestrator had not used it. With the flag: 32 passes, 0 failures, and 5 skips, the same as before. Now it compares the row count with the suite before it asks me for anything.

It wrote “met” on reads that were not. Its notes called four reads of a host “met”, and a docs run ticked the boxes from those notes. The batch review blocked it with 3 high findings: a journal not read, a health line not quoted, a part of the data that existed and was called unreadable. Two more docs runs fixed it. Before it writes “met”, it checks each part of the done-when and quotes each value or says “not read”.

It sent my email address to a public service. To read the publish dates of three crate versions, it called a public API and put my email in the request header, as the service asks. My rule is that the address identifies me and never goes to an outside service. Nothing broke. The orchestrator told me at once. The habit it came from, filling in whatever a service asks for, is where privacy rules break, so each outbound request now gets read for what it carries.

What I’d tell someone building the same

  • Give the main agent one queue and one verb. A second list will give it a second answer.
  • Put its rules in a file that a hook loads at every start, and write each rule once, in your own words, in a place the agent reads.
  • Gate the stop, with a cap. An agent that waits for you is a cost, and one that never stops is another.
  • Delegate in writing. Every approval it gives for you should name the agent and quote your words.
  • Keep a short list of what it never decides, and enforce it with software, not with a promise.
  • Treat every board row as a note and check it against the branches before the agent acts on it.
  • Make a block in a tool the tool’s bug when you have delegated the work.
  • Keep a record of its mistakes next to the rules. Mine did more to improve the setup than any design did.

The next article takes the jail apart and shows what it holds the agents in.