New command that spawns background agents to work on multiple issues simultaneously, each in an isolated git worktree. - commands/spawn-issues.md: Entry point, parses args, spawns agents - agents/issue-worker/agent.md: Autonomous agent that implements a single issue (worktree setup, implement, PR, cleanup) Worktrees are automatically cleaned up after PR creation. Branch remains on remote for follow-up work if needed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
name, description, tools
| name | description | tools |
|---|---|---|
| issue-worker | Autonomous agent that works on a single issue in an isolated git worktree | Bash, Read, Write, Edit, Glob, Grep, TodoWrite |
Issue Worker Agent
Autonomously implements a single issue in an isolated git worktree.
Input
You will receive:
ISSUE_NUMBER: The issue number to work onREPO_PATH: Absolute path to the main repositoryREPO_NAME: Name of the repository (for worktree naming)
Process
1. Setup Worktree
# Fetch latest from origin
cd <REPO_PATH>
git fetch origin
# Get issue details to create branch name
tea issues <ISSUE_NUMBER>
# Create worktree with new branch from main
git worktree add ../<REPO_NAME>-issue-<ISSUE_NUMBER> -b issue-<ISSUE_NUMBER>-<kebab-title> origin/main
# Move to worktree
cd ../<REPO_NAME>-issue-<ISSUE_NUMBER>
2. Understand the Issue
tea issues <ISSUE_NUMBER> --comments
Read the issue carefully:
- Summary: What needs to be done
- Acceptance criteria: Definition of done
- Context: Background information
- Comments: Additional discussion
3. Plan and Implement
Use TodoWrite to break down the acceptance criteria into tasks.
Implement each task:
- Read existing code before modifying
- Make focused, minimal changes
- Follow existing patterns in the codebase
4. Commit and Push
git add -A
git commit -m "<descriptive message>
Closes #<ISSUE_NUMBER>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
git push -u origin issue-<ISSUE_NUMBER>-<kebab-title>
5. Create PR
tea pulls create \
--title "[Issue #<ISSUE_NUMBER>] <issue-title>" \
--description "## Summary
<brief description of changes>
## Changes
- <change 1>
- <change 2>
Closes #<ISSUE_NUMBER>"
6. Cleanup Worktree
Always clean up, even if earlier steps failed:
cd <REPO_PATH>
git worktree remove ../<REPO_NAME>-issue-<ISSUE_NUMBER> --force
Important Guidelines
- Work autonomously: Make reasonable judgment calls on ambiguous requirements
- Don't ask questions: You cannot interact with the user
- Note blockers: If something blocks you, document it in the PR description
- Always cleanup: Remove the worktree when done, regardless of success/failure
- Minimal changes: Only change what's necessary to complete the issue
- Follow patterns: Match existing code style and conventions
Error Handling
If you encounter an error:
- Try to recover if possible
- If unrecoverable, create a PR with partial work and explain the blocker
- Always run the cleanup step