--- title: "Be the operator: run a team of Claude Code agents" description: "How one person runs several Claude Code agents at once: the rules file, the brief, parallel sessions, review steps and guardrails, and steering it all from your phone." level: Advanced minutes: 15 updated: 2026-12-03 order: 7 sources: - https://code.claude.com/docs/en/worktrees - https://code.claude.com/docs/en/sub-agents - https://code.claude.com/docs/en/hooks-guide - https://code.claude.com/docs/en/remote-control - https://code.claude.com/docs/en/computer-use - https://code.claude.com/docs/en/chrome - https://code.claude.com/docs/en/agent-teams - https://code.claude.com/docs/en/permission-modes - https://code.claude.com/docs/en/claude-projects - https://code.claude.com/docs/en/agent-view - https://code.claude.com/docs/en/commands - https://code.claude.com/docs/en/permissions --- AI is a force multiplier. With the right setup, one person can get through work that used to need a small team. We call that person the **operator**. The operator doesn't type most of the code. The operator splits the work into tasks, gives each task to its own Claude Code agent, and reviews what comes back. It uses a lot of tokens. In the hands of a skilled operator, it's worth it. This guide is the setup we use: a rules file every agent reads, a brief for each task, several sessions running side by side, and review steps before anything is merged. ## What you need - Claude Code, signed in with a Pro, Max, Ultra, Team or Enterprise plan - A project in git with at least one commit, because parallel sessions use git worktrees - A test, build or lint command Claude can run to check its own work - About 30 minutes to set it up the first time Each agent uses its own tokens, so five agents use up your plan's limits roughly five times as fast as one. Start with two or three. ## How the pieces fit Rules (CLAUDE.md) and guardrails (hooks) Agent 1 own worktree Agent 2 own worktree Agent 3 own worktree You: brief, review, merge terminal, desktop app or phone A **subagent** is a helper a session calls for a side job, like review, defined in `.claude/agents/`. **Hooks** are rules Claude Code enforces in `.claude/settings.json`, not just reads. ## Step 1: Write the rules once Every agent reads `CLAUDE.md` at the start of every session, so it's where you write down what you'd otherwise repeat to each one. For a team of agents, the most useful rules say how to check the work, how to stay in its lane, and how to report back: ```markdown # How to check your work - Run `npm test` and `npm run lint` before you say a task is done - In your summary, paste the command you ran and the last lines of its output # How we work - One task per session. If you find a second problem, tell me instead of fixing it - Stay in your own worktree. Never push to main - Ask before you add a dependency or change the database schema # When you finish - Summarize what changed in 3 to 5 bullets - List anything you skipped or couldn't check ``` Swap in your own commands. Our [CLAUDE.md guide](/knowledge-work/using-ai/claude-md-guide) covers where the file goes and how to check that Claude loaded it. ## Step 2: Write the brief like a ticket A vague task gets a vague result. Give each agent a brief with a clear finish line: ```prompt Task: [one sentence] Why: [the problem this solves] Done means: [the test or check that proves it works] Stay inside: [the files or folders it may change] Don't: [what to leave alone] Before you change anything, show me a short plan and wait for my OK. ``` Here's one filled in: ```prompt Task: Fix the order dates that show one day early for customers in Asia. Why: Dates are converted to UTC twice before they're displayed. Done means: A new test for a Tokyo customer passes, and npm test passes. Stay inside: src/lib/dates.ts and its tests. Don't: Change the database or any API responses. Before you change anything, show me a short plan and wait for my OK. ``` | Vague | Clear | | --- | --- | | Fix the dates | Fix the order dates that show one day early in Asia | | Make sure it works | A new test for a Tokyo customer passes | | Clean up the code | Stay inside `src/lib/dates.ts` and its tests | The last line of the brief puts a review step before any edit. You can also start the session in plan mode, covered in Step 5. ## Step 3: Run agents side by side Two agents editing the same folder will overwrite each other's work. Claude Code solves this with git worktrees: each session gets its own separate copy of the project. Open a terminal for each task: ```bash claude --worktree fix-date-bug claude --worktree add-checkout-tests claude --worktree update-docs ``` `-w` is the short form. Each worktree lives in `.claude/worktrees//`. Add `.claude/worktrees/` to your `.gitignore`. When you exit a session and the worktree has changes or new commits, Claude Code asks whether to keep or remove it. A clean worktree can be removed for you. Gitignored files such as `.env` don't count as changes, so copy out anything you need first. Paste a brief into each session and let them work. If you'd rather not keep a terminal open for every agent, start them in the background and check on them from one place: ```bash claude --bg "Fix the order dates that show one day early in Asia. Done means npm test passes." claude agents ``` `claude agents` opens agent view, where you can see every background session grouped by state, peek at its latest output, reply, or attach to the full conversation. Agent view is a research preview, so details may change. Claude Code also has agent teams, where one session leads and other sessions work as teammates that message each other. It's experimental, off by default, and uses many more tokens. Start with worktrees, and see Anthropic's agent teams page when you outgrow them. ## Step 4: Give side jobs to subagents A subagent is a helper that a session calls for one focused job, with its own context window and its own tools. A reviewer is the most useful one to start with, because it checks work with fresh eyes. Save this as `.claude/agents/reviewer.md` in your project: ```markdown --- name: reviewer description: Reviews a finished change for bugs, missing tests and edits outside the task. Use after a task is done and before it is merged. tools: Read, Glob, Grep, Bash model: sonnet --- You review changes. Read the diff against main and run the tests, then report: 1. Bugs or risky edits, with the file and line 2. Missing tests 3. Anything that doesn't match the task Don't edit any files. Report only. ``` Then, in any session: ```prompt Use the reviewer subagent to check this work before I merge it. ``` The `model` line lets a helper run on a smaller, cheaper model than the main session. Anthropic's subagents page lists every field. ## Step 5: Add guardrails Claude Code enforces A line in `CLAUDE.md` works most of the time. For anything that must never happen, use settings that Claude Code enforces whatever the model decides. ### Pick a permission mode New terminal sessions start in Auto. Press `Shift+Tab` in a session to switch modes, or start with a flag such as `claude --permission-mode plan`. | Mode | What it does | Use it for | | --- | --- | --- | | Auto | A separate model checks each action and blocks risky ones | Long tasks where prompts would stall the work | | Manual | Asks before most edits and commands | Getting started, or any risky task | | Accept edits | Edits files without asking, still asks for most commands | Agents you trust on a small task | | Plan | Reads and plans, but edits stay blocked until you approve the plan | Checking an agent's plan before it starts | Auto mode needs a supported model, and Team and Enterprise admins can turn it off. If it isn't available, a session starts in Manual. Anthropic's permission modes page has the details. ### Block what must never happen Hooks are commands Claude Code runs at fixed points. A `PreToolUse` hook runs before every tool call, and if it exits with code 2, the call is blocked. This one stops force pushes and pushes to main. Add it to `.claude/settings.json`: ```json { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-risky-git.sh" } ] } ] } } ``` Then save this script as `.claude/hooks/block-risky-git.sh` and run `chmod +x` on it. It needs `jq`: ```bash #!/usr/bin/env bash # Stops force pushes and pushes to main. Exit code 2 blocks the command, # and Claude sees the message on stderr. cmd=$(jq -r '.tool_input.command // ""') if echo "$cmd" | grep -Eq 'git push.*(--force|-f( |$))|git push.* main( |$)'; then echo "Blocked: no force pushes and no pushes to main. Open a pull request instead." >&2 exit 2 fi exit 0 ``` We tested it with sample commands. It blocks `git push origin main`, `git push -f` and `git push --force-with-lease`, and allows `git push -u origin worktree-add-tests` and `git push origin main-menu-fix`. PreToolUse hooks run before the permission mode is checked, so this block holds in every mode. ### Get a ping when an agent needs you With several agents running, you won't be watching each one. On a Mac, this `Notification` hook shows a system notification whenever Claude Code is waiting for you. Add it inside the same `"hooks"` object: ```json "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'" } ] } ] ``` ## Step 6: Review before you merge Reviewing is the operator's real job. Before you merge anything, ask for evidence, not a promise: ```prompt Show me what you changed: a short summary of the diff, the test command you ran with its output, and anything you couldn't check. Don't merge anything yet. ``` If it looks right, ask the agent to commit and open a pull request. If it doesn't, say what's wrong in one or two sentences. After two failed corrections, it's usually faster to run `/clear` and write a better brief than to try a third time. ## Run it from your phone Your agents don't need you at the desk. Remote Control connects the Claude app on your phone to a Claude Code session running on your own computer, so you can send prompts, read results and steer from anywhere. Start a session with Remote Control on: ```bash claude --remote-control ``` Or turn it on in a session that's already open with `/remote-control` (or `/rc`). Then open the Claude app on your phone and go to the **Code** tab. Run `/mobile` in Claude Code for a QR code that gets you the app. - **Plans:** Remote Control works on Pro, Max, Ultra, Team and Enterprise. On Team and Enterprise, an owner has to turn it on first. It doesn't work with an API key. - **Your computer stays on.** The session runs on your machine, so the computer has to stay on with Claude Code running. If it sleeps or the network drops, the session reconnects when the machine is back online. - **Talk instead of typing.** Your phone's dictation works in the prompt box, so you can speak each brief. Claude Code's Projects take this further: one project conversation splits work into threads that run in parallel, mostly as cloud sessions, and you can check and steer every thread from your phone. Projects are a public beta on Pro, Max, Ultra, Team and Enterprise. They are rolling out gradually on individual plans, and on Team and Enterprise an owner has to turn them on. See Anthropic's Projects page. ## Watch your token use Running agents in parallel spends your plan's limits faster. Check where it's going: - `/usage` shows your plan's usage limits and an estimate for the current session. `/cost` and `/stats` open the same screen. - `/context` shows what's filling the current session's context window. To spend less: keep one task per session, run `/clear` before starting a new task in the same session, put helpers on a smaller model, and stop background agents you no longer need. ## When it goes wrong | If you see | Do this | | --- | --- | | An agent drifts into other work | Press `Esc`, restate the task, and keep one task per session | | It says "done" but never ran the tests | Make "Done means" a command, and ask for its output | | Two agents change the same files | Give each one a worktree and a "Stay inside" line | | Your limits run out fast | Run fewer agents at once, and put helpers on a smaller model | | You type the same correction every day | Add it to `CLAUDE.md` | | Something must never happen | Use a hook, not a line in `CLAUDE.md` | ## Your first week as an operator 1. **Write the brief like a ticket.** A task, a reason, and a finish line Claude can check. 2. **Give each agent one job.** One task, one session, one worktree. 3. **Make every result easy to review.** Ask for the diff, the test output and what was skipped, every time. Start with two agents on small, separate tasks. Add a third once reviewing the first two feels easy. ## How we checked this We checked every command, flag and setting on this page against Anthropic's Claude Code documentation on December 3, 2026, and ran the hook script on sample commands. Agent view, agent teams and Projects are previews, experiments or betas, so check Anthropic's pages if something looks different. ## Keep going New to the rules file? Start with [How to write a CLAUDE.md that Claude Code follows](/knowledge-work/using-ai/claude-md-guide). For more on agents that drive a screen, read [What computer-use agents can do, and how to run them safely](/knowledge-work/using-ai/what-is-computer-use), then [Let Claude Code drive a browser with Playwright MCP](/knowledge-work/using-ai/playwright-mcp-claude-code).