Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
plan_nameYes
story_keyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It covers the core action (spawn agent), the worktree lifecycle (create vs. reuse), the transition to In Progress, the async completion and PID return, and a detailed explanation of the _plan_lock race condition including a concrete failure example. This is exceptionally transparent and goes beyond typical descriptions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, then explains the fresh/interrupted branching, and finally a lengthy race-condition explanation. The race-condition paragraph is detailed but arguably excessive for an agent deciding whether to call the tool; it could be condensed to a caution about locking. Overall it is well-structured but slightly verbose, so a middle score is appropriate.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema shown, the description covers the essential behavioral aspects: what it does, how it handles different states, the async nature, the returned PID, and the concurrency risk. The only major omission is the meaning of the two parameters, which is a notable gap. Still, for a tool of moderate complexity, it is largely complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate by explaining the parameters. It never explicitly defines plan_name or story_key. While the names are somewhat self-explanatory (plan identifier and story key), the description does not add any detail about their format, allowed values, or relationship. For a tool with two required parameters and zero schema coverage, this is a significant gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb-resource statement: 'Spawn a headless Claude Code agent to work on a single story.' It then distinguishes fresh versus interrupted stories and explains worktree reuse, which differentiates it from sibling tools like mark_story_in_progress or interrupt_story. The purpose is unambiguous and specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly explains when to use the tool (for a fresh or interrupted story) and what happens in each case. It does not explicitly name alternatives or say 'use this instead of X,' but the behavioral context (spawning an agent, worktree management) makes the use case evident. It also cautions about the lock race condition, which is relevant to safe usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.