Files
architecture/commands/spawn-issues.md
Hugo Nijhuis 7dffdc4e77 Add review loop to spawn-issues agent prompt
The inline prompt in spawn-issues.md was missing the review loop
that was added to issue-worker/agent.md. Now includes:
- Step 7: Spawn code-reviewer synchronously, fix and re-review if needed
- Step 9: Concise final summary output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 17:26:21 +01:00

3.6 KiB

allowed-tools, description
allowed-tools description
Bash, Task, Read Spawn parallel background agents to work on multiple issues simultaneously

Spawn Issues

Spawn background agents to work on multiple issues in parallel. Each agent works in an isolated git worktree.

Arguments

One or more issue numbers separated by spaces: $ARGUMENTS

Example: /spawn-issues 42 43 44

Process

  1. Validate arguments: Ensure at least one issue number is provided
  2. Get repo info: Determine repository path and name
  3. Fetch issue titles: Get title for each issue (for display)
  4. Spawn agents: For each issue, spawn a background issue-worker agent
  5. Report: Display summary table with agent IDs

Implementation

Step 1: Parse and Validate

Parse $ARGUMENTS into a list of issue numbers. If empty, inform the user:

Usage: /spawn-issues <issue-number> [<issue-number>...]
Example: /spawn-issues 42 43 44

Step 2: Get Repository Info

REPO_PATH=$(pwd)
REPO_NAME=$(basename $REPO_PATH)

Step 3: For Each Issue

For each issue number in the arguments:

  1. Fetch issue title using tea issues <number> (just to verify it exists and get the title)

  2. Spawn background agent using Task tool:

    Task tool with:
      - subagent_type: "general-purpose"
      - run_in_background: true
      - prompt: See agent prompt below
    

Agent Prompt

For each issue, use this prompt:

You are an issue-worker agent. Work on issue #<NUMBER> autonomously.

Context:
- Repository path: <REPO_PATH>
- Repository name: <REPO_NAME>
- Issue number: <NUMBER>

Instructions from @agents/issue-worker/agent.md:

1. Setup worktree:
   cd <REPO_PATH>
   git fetch origin
   git worktree add ../<REPO_NAME>-issue-<NUMBER> -b issue-<NUMBER>-<short-title> origin/main
   cd ../<REPO_NAME>-issue-<NUMBER>

2. Get issue details:
   tea issues <NUMBER> --comments

3. Plan with TodoWrite, then implement the changes

4. Commit:
   git add -A && git commit with message "...\n\nCloses #<NUMBER>\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"

5. Push:
   git push -u origin <branch-name>

6. Create PR:
   tea pulls create --title "[Issue #<NUMBER>] <title>" --description "Closes #<NUMBER>\n\n<summary of changes>"
   Capture the PR number from the output.

7. Review loop:
   Spawn code-reviewer agent SYNCHRONOUSLY (run_in_background: false) to review the PR:
   Task tool with subagent_type: "code-reviewer", prompt: "Review PR #<PR_NUMBER>. Working directory: <WORKTREE_PATH>"

   If review says "needs work":
   - Address the feedback
   - Commit and push fixes
   - Re-run the review
   - Repeat until approved (max 3 iterations)

8. Cleanup (ALWAYS do this, even if earlier steps failed):
   cd <REPO_PATH> && git worktree remove ../<REPO_NAME>-issue-<NUMBER> --force

9. Final output - ONLY output this concise summary (5-10 lines max):
   Issue #<NUMBER>: <title>
   Status: <completed|partial|blocked>
   PR: #<PR_NUMBER>
   Changes: <1-2 sentence summary>
   Review: <approved|needs-work|skipped>
   Notes: <any blockers or important details>

Work autonomously. Make judgment calls on ambiguous requirements. If blocked, note it in the PR description.

Step 4: Report

After spawning all agents, display:

Spawned <N> issue-worker agents:

| Issue | Title                    | Status     |
|-------|--------------------------|------------|
| #42   | Add /commit command      | spawned    |
| #43   | Add /pr command          | spawned    |
| #44   | Add CI status            | spawned    |

Agents working in background. Monitor with:
- Check PR list: tea pulls
- Check worktrees: git worktree list