MCPInstall
davidlee avatar

dispatch-subprocess

The codex/pi arm of /dispatch — doctrine worktree fork --worker then spawn the worker as a subprocess with its cwd bound to the fork. Reached only from the /dispatch router on a codex/pi↔env-marker agreement; do not invoke directly.

Installs
82
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-subprocess
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads dispatch-subprocess automatically when relevant.

  3. 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 — codex/pi arm

Spawn a worker via doctrine worktree fork --worker + subprocess spawn. Drive loop lives in the /dispatch router.

Spawn — codex arm

doctrine worktree fork --base "$B" --branch "$BR" --dir "$D" --worker \
  || { echo "fork failed: $?" >&2; exit 1; }
env -C "$D" DOCTRINE_WORKER=1 codex exec "<pre-distilled prompt>"

Confined (bwrap); run the fork, check $?, then spawn. The worker inherits the ambient env and compiles into its own in-tree $D/target (no env contract).

Spawn — pi arm (RPC mode)

doctrine worktree fork --base "$B" --branch "$BR" --dir "$D" --worker \
  || { echo "fork failed: $?" >&2; exit 1; }
cp AGENTS.md "$D/" \
  || { echo "AGENTS.md copy failed: $?" >&2; exit 1; }
PI_FIFO=$(mktemp -u) && mkfifo "$PI_FIFO"
{ printf '%s\n' \
    '{"type":"set_auto_retry","enabled":false}' \
    '{"type":"prompt","message":"<pre-distilled prompt>"}'
  sleep 300
} > "$PI_FIFO" &
timeout 300 env -C "$D" DOCTRINE_WORKER=1 \
  pi --mode rpc --thinking off --session-dir "$D/.pi-session" \
     --no-extensions --no-skills --no-themes \
     --offline --approve --tools read,bash,edit,write,grep,find,ls \
  < "$PI_FIFO"
rm -f "$PI_FIFO"

Same confinement as codex arm; fifo keeps stdin open (pi RPC exits on EOF). sleep 300 keepalive, agent_end gives typed completion. Ignore extension_ui_request widget events from installed packages.

Boundary recording

At the conclude prescription (doctrine dispatch next --slice <N>), after the code commit: doctrine slice record-delta <SL> PHASE-NN --commit <S> — the safe-default single-commit mode. It derives [S^, S] and writes the per-phase boundary into the primary-tree conformance registry (F-5 resolves it from the coord tree; F-6 guard; upsert).

Pin S at the code commit; never read HEAD at record time. Knowledge commits trail the code commit, so by the time you record, HEAD may no longer be the code commit. Capture S=$(git rev-parse HEAD) immediately after the code commit lands and record --commit "$S" before trailing knowledge (or with the pinned oid regardless of order). git diff S^..S is exactly S's own patch — trailed knowledge and any refresh-base merge (which sits in S^) are excluded by construction; this is what the old --start/--end range failed to do.

This arm has no record-boundary and the codex/pi symmetric ledger derive is deferred (D6/IMP-171), so this record-delta is the arm's registry write — RETAINED, every landed phase, orchestrator-issued. It is no longer skippable: dispatch sync --prepare-review's completeness gate bail!s if a completed phase lacks a registry row, so a forgotten write halts the pre-audit conclude beat instead of silently passing (the ISS-052 failure mode). The same verb still doubles as the manual escape hatch — --start/--end remains for a range / bootstrap. Its incoming Manual is provenance-preserving — it never clears an existing funnel/legacy halt (D12).

Red Flags

Never: eval; spawn outside env -C "$D"; omit timeout; use a heredoc for RPC mode (stdin EOF kills pi); hand-sequence the funnel from memory (ask doctrine dispatch next --slice <N>). Always: halt on fork failure; carry DOCTRINE_WORKER=1; use a fifo for RPC stdin; rm -f the fifo after exit; return to the router for the funnel cadence.

FAQ

What does the dispatch-subprocess skill do?

The codex/pi arm of /dispatch — doctrine worktree fork --worker then spawn the worker as a subprocess with its cwd bound to the fork. Reached only from the /dispatch router on a codex/pi↔env-marker agreement; do not invoke directly.

How do I install dispatch-subprocess?

Run npx skills add https://github.com/davidlee/doctrine --skill dispatch-subprocess 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-subprocess/ (personal) or .claude/skills/dispatch-subprocess/ (project).

Which AI agents can use dispatch-subprocess?

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-subprocess 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-subprocess?

It is published by davidlee in davidlee/doctrine. It has 82 recorded installs.

More from davidlee/doctrine

View all →
davidlee avatar

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).

davidlee avatar

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.

AI & Agents148 installs
davidlee avatar

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.

davidlee avatar

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.

AI & Agents146 installs
davidlee avatar

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.

davidlee avatar

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 other skills

View category →
heygen-com avatar

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.7M installs
mattpocock avatar

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1.1M installs
mattpocock avatar

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

871.6K installs
mattpocock avatar

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

599.8K installs
mattpocock avatar

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

551.2K installs
mattpocock avatar

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

514.8K installs