Flywheel agent team
A harness and a small team of AI agents in which the rules that can be checked are code, every change gets an independent review, by default from a different model, and a task can go from the board to a merged merge request with no hand-sent prompt.
A rule written in an AI agent’s instructions does not always hold. That is not enough when agents write code and open merge requests without me watching. So I moved the rules that can be checked out of prose and into code: hooks that block a tool call before it runs, and a map in each repo that says what an agent may do there. Around them sit review by a different model and a board that hands out the work.
On October 24, 2026, the loop from board to merge ran on its own for the first time. A task went from the board to a merged merge request (MR) in eight minutes, through one review block, a fix with new tests, and a pass, with no hand-sent prompt recorded. Since October 19 the team board has closed more than 200 issues, and on November 28 the team was still taking its next task from it.
Why rules in a prompt are not enough
A language model follows its instructions with high probability, not with certainty. An idea I captured on November 21, 2026, puts it plainly: “An LLM is probabilistic and sometimes stalls even with a good harness, so harness rules written as prompt language that could be code should move into” code.
A rule also drifts when it lives in two places. Our policy says when an agent should hand its work to a fresh session, measured by how full its context window is: at 70 percent. A stale memory note still said 25 to 30 percent, and on November 1, 2026, the note won over the policy. The rules file now says it in one line: “A memory note that restates policy drifts from it.” The fix was not a better note. A gate in the scripts now enforces the policy, and since early November Claude Code’s built-in memory is off across the harness, a hook blocks writes to it, and the only memory is Mnemodrome. Rules are never kept as memory notes.
And an agent that writes code and then judges it is not a check. The harness map says it: “one independent review per MR, and the author never reviews its own MR.”
Who does what
Flywheel has two halves. The harness is what every Claude Code session loads: the rules file, the hooks, the skills, and the project maps. The team is a small set of agents that work inside it:
- The orchestrator, a Claude session that keeps the work moving, merges where it is allowed to, and reports to me.
- The builder, a Claude agent that takes a task, writes the code, and opens the MR.
- The reviewer, Codex, a model from another company, which reviews the builder’s work.
- The dispatcher, a service that puts tasks on the board and offers them to an agent.
The rules and the decisions are mine, and so is the final say on anything live. “We” on this page is the team: the agents wrote the hooks, the dispatcher, and most of the MRs, and Codex reviewed their MRs. The idea for the harness comes from Daniel Miessler’s Personal AI Infrastructure.
Decisions
Rules that can be checked become code
Claude Code runs hooks before and after each tool call, and a hook that runs before a call can stop it. The harness wires seven of these pre-call hooks and about thirty hook commands in all. Some examples of a rule that became one:
- Memory goes to Mnemodrome only. A hook blocks any write to the built-in memory folder.
- Web search goes through our own search service. A hook blocks the built-in web search tool.
- Credentials never appear in a terminal. A hook blocks the shell commands that would print them, and each block carries a rule ID for the audit trail.
- Before an agent’s first read or edit in a mapped repo, a hook stops it once and points it to that repo’s map. Then it lets it through.
- An agent that reports “saved” is not evidence. A ledger hook records every real write from the tool’s own result. Its header gives the reason: “A model that invents a write can also invent its read-back check; it cannot invent a ledger line.”
- The model-router hook used to advise which model a subagent should use. As advice it changed nothing: every subagent without an explicit model still inherited the session’s model. Version 2 sets the model itself. An explicit choice is always respected.
Code has its own cost. Each hook change needs a test, and a hook is loaded by every session on every machine. So the hard rule is: “A broken hook breaks every session on every host. Hooks fail open. Hook tests pass before review.” Today 13 test files with 148 tests cover many of the hooks, and all pass. Where a rule cannot be checked by code, the rules file says so instead of pretending: for one web tool it says “this is the honor system.”
A map for each repo
An agent that enters a repo needs to know three things: what it is there to do, what to read first, and what must be true before it is done. A mapped repo has an AGENTS.md for that. It opens: “Read this page first. It is the map. Find the row for your intent, read its “Read first” page and its procedure before your first change, and state the row and its gate in your first reply (or in the issue). If no row fits, stop and ask.”
Each row ends in a gate of one of three kinds: “check (a command that must exit 0), approval (a named person says yes), precondition (a fact that must be true).” The harness map has fifteen rows, from “idea” and “bug” to “deploy” and “secret.” The map also saves work: “Do not read all of the docs “to be safe”: the map exists so you read less.” A repo without a map is not off limits, but an agent there must “stop and ask before push, release or deploy.” The entry hook above makes sure the map is read.
Review by a different model, at the exact commit
On October 19, 2026, I set the flow: every change is a draft MR, and an independent reviewer checks it. The writer never reviews its own work; Claude’s work goes to Codex. The verdict is a note on the MR that names the exact commit it reviewed. A fix is a new commit, and it gets a new review.
It earned its place in the first days. On October 19 Codex stopped a change that would have reset a network adapter on every cluster node at once, where the role itself forbids changing two nodes together. Two days later it stopped a release step that could accept a half-extracted archive as a complete release; the fix added a staged build and a completion marker. Both were fixed before merge.
Review is also the expensive part. In October, a finding graded P2 could still block an MR. In November, one hook took six review rounds. On November 24, 2026, I set the review rules that apply now. Their purpose: “only real problems send work back.” Findings carry grades: P0 is “Security flaw. Data loss. Function broken against the goal. Failing tests or CI. Broken decision or gate.”; P1 is “Real bug on a side path. Test missing for a stated behavior. Docs claim that misleads.”; P2 is “Style, wording, taste, hypotheticals.” Only P0 and P1 send work back. A P0 has no round cap and is always fixed; a P1 gets at most two rounds and then becomes a follow-up issue. When the writer disputes a finding, a third view decides: another model family or a fresh agent, because “the same model with the same context is not a new view.” And “the reviewer only reports. The reviewer never edits.”
A board, offers, and who may merge
GitLab issues are the single work list. The dispatcher picks up issues labelled agent-ready, puts each on the team board, and posts an offer for one agent. A small “doorbell” delivers offers and review requests to the right agent, so no one has to relay them.
One option was to have the dispatcher type the prompt into the agent’s terminal. That would have needed root, or the Docker group, on the machine that runs the agents: “too much power for the dispatcher.” So it posts offers instead, and it runs with a GitLab role that cannot merge.
Merging is a separate right, given on purpose. Builder agents never merge. The orchestrator merges an MR when the review passes. In the harness itself the line is tighter: I merge code, the rules file, and the settings, and the orchestrator may merge only map or docs changes after a passing review. Every decision falls in one of three classes: decide and do; decide, do, and tell; or ask first. “While a question to Carlos is open, you do not act on the decision it is about.” And “a merged MR is not an apply”: nothing goes live without my yes.
The cheapest model that does the job
The team runs on a Claude Code subscription, so usage is the budget. A hook puts a budget status into every session, green, yellow, or red, and the work follows it. In yellow, mechanical work goes to local models or the smallest Claude model, and no speculative fan-outs start. In red, only work that needs a stronger model gets one, and the agent says so instead of quietly doing worse work. Local models come first on the ladder, through one job manager: “Local work costs watts, not subscription dollars.” The floor holds in every state: “complexity that genuinely needs a frontier model gets one — economy comes from the routine majority, never from the critical work.”
Eight minutes on October 24
Times are Hawaii time.
At 12:11 the dispatcher put a task on the board and offered it to the builder: a fix for the doorbell itself. At 12:15 the builder claimed it: “Claimed. I own this task now.” At 12:16 it pushed a commit, opened a draft MR and asked Codex for a review. Codex blocked the first version within a minute. At 12:18 the builder pushed a fix with new tests, and Codex passed it. At 12:19 the MR was merged. No hand-sent prompt is recorded between the offer and the merge. As I noted that day, since October 21 every task, review request, rotation, and merge in the team had needed the orchestrator to send a prompt by hand. I called it a watershed.
The cycle also showed what was still missing. The builder had merged its own MR the moment the review passed. Seven minutes later, at 12:26, I set the rule: builder agents never merge, even at a pass; the orchestrator merges. The next cycle, a day later, ran that way.
How it’s built
- Harness: a GitLab repo that every Claude Code session loads: the rules file, hooks in TypeScript with tests, skills, and an
AGENTS.mdmap per repo; the harness map is checked in CI. - Work: GitLab issues and a team board; a dispatcher and a doorbell that deliver offers and review requests.
- Agents: Claude Code sessions as orchestrator and builder, Codex as reviewer; herdr, an open-source agent multiplexer, runs them in Docker.
- Models and budget: a budget signal from TokenPilot; local models through one job manager, then Haiku, Sonnet, and Opus.
- Memory: Mnemodrome, the only memory store.
Where it stands
The team board has closed 208 issues since October 19, 2026, with 107 open; the count includes the mirrored tasks and review requests. The harness has 54 merged MRs and the orchestration layer 69. The hooks pass 148 tests. On November 4 the orchestrator took an eight-hour mandate for network work with “zero asks, one morning report.” On November 28 the doorbell was still handing out the next task.
What I cannot show yet is cost: there is no measured cost per MR, review quality, or revert rate.
What’s next
Measuring the factory is an open issue: review quality, cost per MR, and reverts. Also open, risk tiers: which changes the orchestrator may merge and switch on alone after a pass. Anything live, and anything that touches infrastructure, secrets, models, or money, stays with me. A local model as a reviewer is being tested: on November 28 a blind test on three past MRs, where Codex had found five real bugs, ranked one local model above another. And an audit of the rules file is an open idea: move each rule that can be checked from prose into code.