dispatch_story
Spawn a headless agent to implement a story in an isolated git worktree, reusing interrupted work and transitioning the issue to In Progress.
Instructions
Spawn a headless Claude Code agent to work on a single story.
For a fresh story, creates a git worktree on a new branch. For a story left "interrupted" (or whose worktree already exists from a prior run), reuses the existing worktree/branch instead and seeds the agent's prompt with the checkpoint journal so it continues rather than starting over. Transitions the Plane issue to In Progress. Returns the subprocess PID; completion is async.
Acquires _plan_lock so direct MCP tool calls serialize across MCP
server processes - without this guard, two Claude sessions (each with
their own MCP server PID) can both call dispatch_story on the same story
in the same window, and the second one treats the first one's
half-built worktree as resumable and spawns a second agent into the
same directory. That race is what produced the repeated zero-output
agent deaths logged in 2026-06-27's e2e-decentralized-messaging run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_name | Yes | ||
| story_key | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||