
dispatch-spawn
The one spawn path for /dispatch — scripts/spawn-confined.sh forks the worker's worktree, wraps it in a kernel-level jail, and runs the harness headless inside it. Every harness takes this path; there is no in-session arm and no unconfined fallback. The worker cannot commit — it hands back an uncommitted working tree and the orchestrator imports it. Reached from the /dispatch router; do not invoke directly.
- Installs
- 55
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/davidlee/doctrine --skill dispatch-spawn- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dispatch-spawn automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Dispatch — spawn a confined worker
One spawn shape, for every harness. The drive cadence lives in the
/dispatch router; this skill is the spawn call plus the
landing mechanics.
See lib:reference/dispatch-mechanics.md § The worker returns a working tree,
not a commit.
Spawn
scripts/spawn-confined.sh <harness> <B> <BRANCH> <DIR> <PROMPT_FILE> [BACKSTOP_SECS]
<harness> is pi or claude. The script does the whole pre-spawn sequence
itself — you do not fork separately:
- Capability probe. Linux asserts
bwrapis present and refusesbwrap-unavailablebefore minting a fork; macOS gets its named refusal fromdoctrine worktree jail-prefix, which fails closed and writes no prefix. There is no unconfined fallback — an unresolvable jail aborts the spawn rather than degrading (an empty prefix is caught by its own guard). - Fork.
doctrine worktree fork --base <B> --branch <BRANCH> --dir <DIR> --worker, orchestrator-classed, run from the project root before any confinement. The fork is deliberately unbound — no--slice/--phase(see The funnel, below). - Confine + exec.
timeout <BACKSTOP> <jail prefix> <harness exec>, delivering<PROMPT_FILE>to the worker (stdin forclaude; one compact RPC line forpi) and capturing the transcript. The jail rw-binds the fork dir and the harness config dir, ro-binds the rest, and setsDOCTRINE_WORKER=1inside the namespace. - Hand back.
claude -pexits when the turn ends — process exit is the completion signal.pi --mode rpcnever self-exits, so that profile alone holds stdin open with a fifo and polls for its typed settle event. That asymmetry is the only harness difference beyond the config dir and the exec line.
See lib:reference/dispatch-mechanics.md § Workers can silently discard their
own work for the prompt-fencing rules (clean checkout, forbidden verbs,
edit-not-discard for a red proof).
Never trust the worker's self-reported success. The tree is the ground truth.
Landing
The delta is an uncommitted working tree that persists after the process exits — nothing auto-reaps it.
- Import.
doctrine worktree import --base <B> --from-worktree <DIR> --slice <N>— gathers the tracked + untracked delta, runs theclassify_importscope belt and the reject-and-halt prove gate perlib:reference/dispatch-mechanics.md— a red delta halts staged, never auto-fixed (land-or-reject, never rewrite). Any refusal is report-and-halt — never import around it. - Commit ONE on the coordination branch — the orchestrator's own act, and the reason import is non-committing.
- Record the boundary.
doctrine slice record-delta <N> PHASE-NN --commit <S>, withSpinned at the code commit, never read fromHEADat record time. Knowledge commits trail the code commit, soHEADmay have moved;--commitrecords exactlyS's own patch, which excludes trailing knowledge and any refresh-base merge by construction. This write is not skippable —dispatch sync --prepare-review's completeness gate halts if a completed phase has no registry row. - Verify and conclude. Run the phase's verification on the coordination
tree (the worker's own report is advisory), then flip the sheet:
doctrine slice phase --status completed <N> PHASE-NN. - Reap the spent fork:
doctrine worktree gc --fork <BRANCH>— the unfunnelled-fork case its patch-id oracle is narrowed to, and idempotent. Nevergit worktree remove --forcean unimported tree: that deletes the sole copy of the delta.--dry-runprints the verdict and destroys nothing.
The funnel: a bound fork's machinery, not this path's
See lib:reference/dispatch-mechanics.md § The funnel record, and when it is
the driver — this path forks unbound, so no row lands and next sits at
spawn.
Red Flags
Never: instruct or expect a worker to commit (its .git is read-only —
there is no self-commit path); spawn outside the script (a hand-rolled exec is
an unconfined worker); omit the backstop timeout; eval the prompt; use a
heredoc for the pi profile's RPC stdin (EOF kills it); import around a scope or
prove-gate refusal (a refusal is a defect or a halt, never a detour); auto-fix a
red delta into the import; force-remove a fork before its delta has landed;
trust the worker's own green/failure labels; treat a spawn prescription from
dispatch next as a stuck funnel.
Always: halt on a non-zero spawn (fail-closed is the whole posture — a
confinement that cannot be established means no worker); pass a pre-distilled,
self-contained prompt; import with --slice so the scope belt has selectors to
check; pin S at the code commit before recording the boundary; return to the
router for the drive cadence.
FAQ
What does the dispatch-spawn skill do?
The one spawn path for /dispatch — scripts/spawn-confined.sh forks the worker's worktree, wraps it in a kernel-level jail, and runs the harness headless inside it. Every harness takes this path; there is no in-session arm and no unconfined fallback. The worker cannot commit — it hands back an uncommitted working tree and the orchestrator imports it. Reached from the /dispatch router; do not invoke directly.
How do I install dispatch-spawn?
Run npx skills add https://github.com/davidlee/doctrine --skill dispatch-spawn in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dispatch-spawn/ (personal) or .claude/skills/dispatch-spawn/ (project).
Which AI agents can use dispatch-spawn?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dispatch-spawn safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dispatch-spawn?
It is published by davidlee in davidlee/doctrine. It has 55 recorded installs.
More from davidlee/doctrine
code-review
davidlee/doctrine
Use whenever reviewing code for quality and correctness — a diff, PR, module, or subsystem — producing verified, severity-ranked findings on the RV ledger. Not for comprehension tours (walkthrough) or doctrine-conformance hunts (inquisition, user-invoked only).
pair
davidlee/doctrine
Agentic pair programming — drive a change together with a human partner in the loop, narrating intent and pausing at decision points. Use when the user wants to work side-by-side rather than hand off a whole task. Calibrated by three dials (role, detail, autonomy) and an always-on challenge mandate.
consult
davidlee/doctrine
Use the moment you hit an unanticipated obstacle, a decision with competing tradeoffs, or emergent complexity mid-task — before adapting planned scope, adding a dependency, taking a shortcut, or making any impactful concession on your own.
handover
davidlee/doctrine
Use when handing work to a fresh context — first bring the durable harvest current, then emit a continuation at one of two weights — a printed continuation prompt (light) or a handover.md context packet (full). Use whenever a fresh agent would more efficiently continue.
canon
davidlee/doctrine
Use before making architectural or workflow choices, when correctness depends on project governance, or when entering an unfamiliar subsystem — to load the project's authoritative rules before you act on assumptions.
retrieve-memory
davidlee/doctrine
Use before making non-trivial assumptions — before touching a subsystem you have not this session, before running or changing a command pipeline, when code and docs conflict, when asked "what is the right way here?", when debugging a recurring failure, or when about to answer with "probably/usually/likely".
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.