Run a team of AI coding agents without chaos: our Claude Code playbook
One agent that does everything tends to do too much or too little. A small team with clear jobs, narrow tools and a shared to-do board is calmer, and we built one.
the quick answer
A multi-agent Claude Code workflow stays calm when each agent has one job, a short list of tools, and one shared to-do board. Use a planner that never writes code, a finisher, a deployer and a sweeper. Allow one build in flight at a time. As of November 2026, subagents are markdown files with a tools list you control13.
Safe to try? High risk Agents act with your accounts, so commit and push your work first, give each agent the fewest tools it needs, and approve the first live release yourself.
Why does a multi-agent Claude Code workflow turn into chaos?
You did nothing wrong. People keep asking about this, because the pile of half-finished projects is a common place to end up.
The pattern is familiar. Code gets written, but it never reaches a live address. Nothing checks it afterwards. Broken things sit unnoticed. You may have tried one big "do everything" agent, and it either did too much or too little.
Our fix was not a smarter agent. It was a smaller job for each one, plus a board they all read.
What a good solution does
It gives every agent one sentence of purpose. A subagent in Claude Code is a markdown file with YAML frontmatter, so a job description is easy to write down1. Each subagent runs in its own context window with its own system prompt, tool access and permissions1.
It also limits what each agent can touch. The docs list "enforce constraints by limiting which tools a subagent can use" as a reason to use subagents1.
And it keeps a single to-do board, so no agent has to remember what the others did. That board is where the calm comes from.
What you need before you start
- Claude Code, installed from the official page (see /start-here/ for how).
- A GitHub account and the gh command-line tool, which signs in with
gh auth login4. - A small database, such as a hosted free tier.
- A place to put finished work, such as a static host.
- A plain, empty folder to begin in, and a private repository for it.
Set aside an afternoon for the first pass. We will not promise more than that, because your projects differ from ours.
The playbook
Here is the order we would follow again. Your AI does these with you, one at a time, and asks before it runs anything.
Make a safe place first.
Commit what you have. Then create a private repository from your local folder with gh, which can do that when you give it a name and
--private, plus--sourcefor the local folder5.Build the board.
Make three things in your small database: a builds table (a key, a stage, an owner agent, a next action, a blocked reason, a repo address, a live address and a health result), an event log, and a queue view that sorts by priority and puts blocked rows last.
Write one agent file per role.
Put each in your agents folder, in
.claude/agents/for one project1. Give each a one-sentence job, an input rule (it receives exactly one build key), a numbered procedure and a short list of hard rules.Set tools per agent.
Give the planner read and write on the database only. Give the deployer a shell and git. Give nobody payment or customer-messaging tools. Check first what each agent quietly relied on, so you do not remove something it needs.
Limit work in progress to one.
The planner dispatches no new build while one is mid-flight.
Split "deployed" from "verified".
The deployer may set a build to live. Only a different agent, or you, may set it to shipped.
Write the sweeper's runbook.
Make it a separate markdown file the sweeper reads first, listing each check and the exact command for it. Make tickets repeatable: give each finding a fingerprint, so a rerun updates a ticket instead of making a copy.
Schedule the sweeper
twice a day, with a hard time cap on every run.
Write git rules before anything pushes.
See the next section for ours.
Did this fix work?
One tap tells the next reader what to expect. No sign-up.
What we got wrong the first time
We built this, we run it, and it taught us several things the slow way.
We scoped new work while something sat mid-deploy. That was the founding failure, and the one-build limit exists to stop it.
Most of our agent files had no tools line. An agent that omits the line inherits every connected tool server. That meant a routine agent could reach powerful keys. Adding the line is the cheapest safety win we found.
A port check lied to us. A local tunnel answered while the far end was dead. We switched to a real web request through the tunnel. An answer that says "sign in first" counts as healthy. A timeout is the finding.
Silence fooled us more than errors did. One connector reported "completed" for hours while a folder was empty. A queue consumer exited cleanly on an empty queue for weeks. Watching for errors cannot see that, so a liveness watcher compares what a pipeline produced with what we expect. It is still a draft, and we infer the expected rates rather than declare them.
Our scheduler skipped jobs. On a Mac, jobs set for a time the machine was off did not run later, and every job looked fine because none had started. A sweep designed to be short once ran for many hours, and the next scheduled sweep silently never started. So judge jobs by how fresh their output is, and give every run a time cap. Add a second health probe after a delay before you close a ticket. Why? Our sweeper once called a tunnel fixed after a single good probe. It was dead again within the hour.
Logins expired quietly. Several scheduled runs in a row died at a login wall. We now write a marker file and send a notification the moment a headless run hits one.
Parallel worktrees started from a stale main branch. Whoever pushed last undid the others. The cure is to fetch before building, and to use a hook that refuses to end a session while commits are unpushed. Hooks are user-defined commands that run at set points, such as when Claude finishes responding2.
Our git sweep found around a hundred commits that never left the laptop. So now the sweeper pushes only non-default or local-only branches, as plain fast-forwards. A default branch in a repo with automated checks counts as a deploy, so a person decides. Diverged repos and missing remotes are a person's call too. It never force-pushes, merges or deletes a branch.
What it costs to run
As of November 2026, agent runs use your normal Claude plan or API usage. The sweeper adds two short runs a day. The database and static hosting can sit on free tiers. We do not know the exact spend, so we will not guess one.
Keep it safe
- Agents act with your credentials. Give each the minimum tools, and keep deploys, money and customer messages behind a human gate.
- Never let an agent write a secret to a file or a log. Use names of environment variables only, and keep the values in the platform.
- A sweeper that can push or fix things needs written guardrails. Keep personal and financial repos local only, always.
- Hooks can block a tool call before it runs2. That makes them a good place for a rule such as "refuse a push to the default branch".
- Approve the first production release yourself.
Common questions
What is the agent orchestrator pattern?
It is one agent that picks the next job and hands it to a specialist. Ours reads the queue, chooses a build, dispatches a specialist and logs it. It never writes app code and never deploys, so a mistake in one role stays in that role1.
Can Claude Code subagents deploy for me?
Yes, if you give one a shell and git. Keep it to one job: take finished code to a live address, then check that a health address answers with a success code1.
How do I limit what an AI agent can reach?
Can an AI agent fix a broken scheduled job?
It can find one, if you tell it what "healthy" looks like. Ours sweeps twice a day, opens a ticket for each finding, and then fixes what is safe or asks a person. Judge the jobs by fresh output, not by exit codes.
You now have a team that can build, ship and check its own work, and you check it only where it matters. Spend the hours you got back on someone you love.
James
Made with care: researched from 5 official sources and checked step by step against them on November 12, 2026. Written with AI, security-scanned before publishing.
This is general help, not professional support. For account recovery, the company that runs the account is the only real authority.
Back up anything you can't replace before you start.
Sources
- Anthropic (Claude Code Docs). "Create custom subagents." Official docs, read November 12, 2026. code.claude.com
- Anthropic (Claude Code Docs). "Hooks reference." Official docs, read November 12, 2026. code.claude.com
- Anthropic (Claude Code Docs). "Settings files and precedence." Official docs, read November 12, 2026. code.claude.com
- GitHub CLI. "Manual." Official docs, read November 12, 2026. cli.github.com
- GitHub CLI. "gh repo create." Official docs, read November 12, 2026. cli.github.com
Spotted a mistake? Tell us. We fix it in place and note the change.
Notes from readers
Found a better way, or did a step change? Tell me. Every note is read by a person before it goes up, and the best ones make the guide better.