Shadow Runs: Try an Agent Fleet Before It Can Ask Anyone
The first time you start twenty coding agents on a job, you do not know what they will ask for. One wants to run the test suite. Another wants npm install. A third reaches for a deploy script nobody mentioned. If each of those becomes a question to a person, the first real run is spent answering prompts. If they are answered by an allow-everything setting, the first real run is a risk.
A shadow run sits between the two. The agents do their real work, in their own copies of the repository, while anything that would have reached a person is refused at once and recorded. Afterwards you read one grouped list of what the fleet would have asked, write rules for the routine items, and only then run for real.
This guide explains how Forkit's shadow runs work and how to use one. In this article "factory" means a Forkit factory, a saved fan-out that can be run on request; it does not mean the company Factory.
Why test a fleet before it can ask
Anthropic's account of Claude Code's auto mode (25 Mar 2026) gives the reason most prompts are a poor control: "in practice users accept 93% of them anyway." Auto mode hands the decision to a classifier instead. Anthropic publishes its error rates, and calls a 17% miss rate on real overeager actions "the honest number."
A fleet changes the numbers. Twenty agents doing the same job ask the same things at about the same moment, and many of them run where nobody sits beside a terminal. You want to know their asks before the run, and you want to decide them as rules once, instead of answering them twenty times.
Warp's essay "Don't vibe code your software factory" (4 Nov 2026) argues that factories need measurement and improvement infrastructure: replaying tasks "from their original state with different factory configurations", A/B tests and judged runs. As read on 25 Nov 2026, it does not describe dry runs or a shadow mode. It does say that permissions should differ between people and agents, for example that agents should not reach the environment's secrets.
What a shadow run does
From Forkit's engineering notes ("Factories", 21 Nov 2026):
- A fan-out or a factory can be started with
shadow: true(--shadowon the command line). - The agents work in their forks as usual. They edit, commit and push.
- Allow rules still answer. A request a rule allows goes through, as it would in a real run.
- Anything that would have reached a person is refused at once with the reason "Shadow run", and kept, recorded as decided by
shadow. GET /api/v1/fanouts/:id/asks, orforkit factory asks FANOUT_ID, lists what was kept, grouped: each line gives the tool and subject, how many agents asked, and the rule that would allow it.
So a shadow run is a full run with one change: no question reaches a person, and every question is written down.
Step 1: Start a shadow fan-out
For a one-off fan-out:
forkit fanout create --name deps-trial --agents 6 \
--shadow --max-cost 5 --max-tool-calls 2000 \
--repo-from ./my-repo
This prints each agent's key once, as JSON. --repo-from DIR gives each agent its own fork of a private repository you push from your checkout; use --repo URL for a public one. Start your agents with those keys, in sandboxes or on CI, with the agent tool you already use. Forkit does not start them.
For a factory, add --shadow when you create it:
forkit factory create --name deps-shadow --prompt-file ./deps-prompt.md \
--agents 6 --max-cost 5 --push --shadow
Then ask for a run (forkit factory run deps-shadow --items-file ./items.json) and let your runner pick it up (forkit factory work deps-shadow --exec "$PWD/agent.sh" --repo-from ./my-repo --once). The reference runner prints what would have reached a person when a shadow run finishes.
Step 2: Let the agents work
Inside a Claude Code sandbox, forkit init --sandbox installs the hooks with no sign-in and sets an unanswered request to be denied. The hook allows Forkit's own coordination calls inside sandboxes, because Claude Code ignores a project's permissions.allow in a workspace it has not been told to trust.
The agents meet refusals during the run. An agent refused node run.js is told so, and may try something else or report that it is blocked. That changes how far a shadow run gets, which is the point: you learn where a real run would stop and wait for someone.
Step 3: Read the grouped list
forkit factory asks FANOUT_ID
The output has this shape (the commands here are illustrative):
A real run would have asked a person:
6 agents Bash: npm test rule: ...
2 agents Bash: npm install --save-dev vitest rule: ...
1 agent Bash: ./scripts/deploy.sh staging rule: ...
Each line is one question that a real run would have put to a person, with how many agents asked it and the rule Forkit would suggest to allow it.
Read it in three groups:
- Routine, asked by most agents. The test command, the build. Write an allow rule.
- Reasonable, asked by a few. Installing a dev dependency. Decide whether the task should need it. If not, change the prompt.
- Wrong for this job. A deploy, a secret, a production database. Leave these for a person, or deny them with a rule.
Step 4: Write rules
Forkit's command rules match a glob on the command or on a repository-relative path. A matching deny always wins. Rules are the first of four layers that answer a request: rules, then an orchestrator agent an owner picks for the tools they tick, then a person, then a timeout (CLAUDE.md, "Permission requests").
Some requests never take a rule. Production, secrets and money always reach a person: allow rules and the orchestrator never answer them, and a person can only allow them once. A shadow run will list them like everything else, and in a real run they will still come to someone.
Rules are added from the team page or from a person's answer: "always" on a request adds a rule. A member's rules cover only their own agents.
Step 5: Run it again, for real
Start the same job without --shadow. The routine asks are answered by your rules. What is left reaches a person, and because the agents are a fan-out, identical pending requests (same fan-out, tool, subject and repository) are shown as one question, settled by one answer. Production, secrets and money are never grouped.
If you used a factory, keep the shadow copy. Run it again after changing the prompt or the model, and compare its list with the last one.
What one shadow run looked like
Forkit's notes record one shadow run on staging (21 Nov 2026, one run). A factory with a pushed repository and shadow set was asked for a run through its webhook address with two items. The runner started two real Claude Code agents. Each wrote its hypothesis and pushed. node run.js was refused for both, and listed as one line with 2 agents. The run finished in 47 s at about $0.21 (an estimate at list price), was marked good, and its threads were titled by the factory ("hypotheses: h03").
Two agents is a small fleet. It shows the mechanics: the work was done and pushed, and the one thing a person would have been asked appeared once, with its count.
What a shadow run does not cover
- Requests a rule allows are carried out. A shadow run tests the questions that would reach a person. A command your rules allow still runs. Check your rules before a shadow run if any of them are broad.
- Agents still push to their forks and spend real tokens. Set
--max-costand--max-tool-calls. - It is not a sandbox. It decides who answers; the agent's machine and network are still yours to isolate (see sandboxes vs approvals).
- Refusals change the run. A shadow run that stops at its first refused test command tells you less about later steps than a real run would.
- No hold on data. A mode that keeps held-out data from agents is not built.
Shadow runs compared with other ways to try a fleet
| Approach | What runs | What you learn | What it costs |
|---|---|---|---|
| Try one agent by hand | One agent, a person answers | Whether the prompt works | One agent's tokens and your attention |
| Allow everything in a sandbox | Every agent, nothing asked | Whether the job finishes | Risk of anything the sandbox allows |
| Classifier approval (auto mode) | Every agent, a model decides | Little about what was asked, unless you read transcripts | Misses at Anthropic's published rate |
| Shadow run | Every agent; rules answer, nothing reaches a person | A grouped list of every question, with counts and suggested rules | The run's tokens; refusals may cut it short |
They combine. Try one agent by hand, then a shadow run, then the real run with rules written from the list.
Related: agent permission rules, agent sandbox vs approvals, Claude Code permission modes compared, how to build a software factory and grouping identical permission requests.
Where Forkit fits
Forkit is the coordination system for agent teams: plans, handoffs, file claims and decisions, shared by every agent and the people behind them. A shadow run is a way to find a fleet's decisions before anyone has to make them. Forkit runs no agents; you start them with your own tools. It is free to try at forkit-mcp.com.
Sources
- Anthropic, "How we built Claude Code auto mode", 25 Mar 2026, https://www.anthropic.com/research/claude-code-auto-mode (read 25 Nov 2026).
- Warp, "Don't vibe code your software factory", 4 Nov 2026, https://www.warp.dev/blog/build-production-software-factory (read 25 Nov 2026).
- Forkit engineering notes (CLAUDE.md): "Factories" (shadow runs), 21 Nov 2026; "Permission requests"; "Fan-outs" (grouped approvals).
forkit fanout create --shadowandforkit factory asks, forkit-cli command reference.