Refactor spawn-issues as orchestrator

spawn-issues now orchestrates the full workflow:
- Phase 1: Spawn issue-workers in parallel, wait for completion
- Phase 2: Review loop - spawn code-reviewer, if needs work spawn pr-fixer
- Phase 3: Report final status

issue-worker simplified:
- Removed Task tool and review loop
- Just implements, creates PR, cleans up
- Returns structured result for orchestrator to parse

Benefits:
- Better visibility into progress
- Reuses pr-fixer agent
- Clean separation of concerns
- Orchestrator controls review cycle

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-09 17:33:22 +01:00
parent 7dffdc4e77
commit 3afe930a27
2 changed files with 200 additions and 104 deletions

View File

@@ -1,13 +1,13 @@
---
name: issue-worker
description: Autonomous agent that works on a single issue in an isolated git worktree
tools: Bash, Read, Write, Edit, Glob, Grep, TodoWrite, Task
description: Autonomous agent that implements a single issue in an isolated git worktree
tools: Bash, Read, Write, Edit, Glob, Grep, TodoWrite
skills: gitea, issue-writing
---
# Issue Worker Agent
Autonomously implements a single issue in an isolated git worktree.
Autonomously implements a single issue in an isolated git worktree. Creates a PR and returns - the orchestrator handles review.
## Input
@@ -86,26 +86,7 @@ Closes #<ISSUE_NUMBER>"
Capture the PR number from the output (e.g., "Pull Request #42 created").
### 6. Review Loop
Spawn the `code-reviewer` agent **synchronously** to review the PR in the current worktree:
```
Task tool with:
- subagent_type: "code-reviewer"
- run_in_background: false
- prompt: "Review PR #<PR_NUMBER>. Working directory: <WORKTREE_PATH>"
```
Based on review feedback:
- **If approved**: Proceed to cleanup
- **If needs work**:
1. Address the review feedback
2. Commit and push the fixes
3. Trigger another review
4. Repeat until approved (max 3 iterations to avoid infinite loops)
### 7. Cleanup Worktree
### 6. Cleanup Worktree
Always clean up, even if earlier steps failed:
@@ -114,20 +95,21 @@ cd <REPO_PATH>
git worktree remove ../<REPO_NAME>-issue-<ISSUE_NUMBER> --force
```
### 8. Final Summary
### 7. Final Summary
**IMPORTANT**: Your final output must be a concise summary (5-10 lines max) for the spawning process:
**IMPORTANT**: Your final output must be a concise summary for the orchestrator:
```
Issue #<NUMBER>: <title>
Status: <completed|partial|blocked>
PR: #<PR_NUMBER> (<url>)
Changes: <1-2 sentence summary>
Review: <approved|needs-work|skipped>
Notes: <any blockers or important details>
ISSUE_WORKER_RESULT
issue: <ISSUE_NUMBER>
pr: <PR_NUMBER>
branch: <branch-name>
status: <success|partial|failed>
title: <issue title>
summary: <1-2 sentence description of changes>
```
Do NOT include verbose logs or intermediate output - only this final summary.
This format is parsed by the orchestrator. Do NOT include verbose logs - only this summary.
## Important Guidelines
@@ -144,3 +126,4 @@ If you encounter an error:
1. Try to recover if possible
2. If unrecoverable, create a PR with partial work and explain the blocker
3. Always run the cleanup step
4. Report status as "partial" or "failed" in summary