Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
davidlee avatar

Dispatch Subprocess

  • 75 installs
  • 1 repo stars
  • Updated August 3, 2026
  • davidlee/doctrine

The codex/pi arm of dispatch: forks a worker worktree with doctrine worktree fork, then spawns the worker as a confined subprocess bound to that fork.

About

Spawns a Doctrine dispatch worker as a codex or pi subprocess after forking a worker worktree, with cwd bound to the fork and boundary recording via record-delta. A developer reaches it from the dispatch router on a codex/pi arm agreement, never directly.

  • codex exec and pi RPC-mode spawn templates over a forked worktree
  • record-delta writes each phase boundary into the conformance registry

Dispatch Subprocess by the numbers

  • 75 all-time installs (skills.sh)
  • Ranked #5,460 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davidlee/doctrine --skill dispatch-subprocess

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs75
repo stars1
Last updatedAugust 3, 2026
Repositorydavidlee/doctrine

What it does

The codex/pi arm of dispatch: forks a worker worktree with doctrine worktree fork, then spawns the worker as a confined subprocess bound to that fork.

Files

SKILL.mdMarkdownGitHub ↗

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 funnel Record beat (router step 8), after the code commit: doctrine slice record-delta <SL> PHASE-NN --start <B> --end <B+1> — writes the per-phase boundary into the primary-tree conformance registry (F-5 resolves it from the coord tree; F-6 guard; upsert). 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 doubles as the manual escape hatch (correct 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). 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.

Related skills

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.