一键导入
parallel-worktree-agents
Pattern for running multiple sub-agents in parallel using git worktrees. Use this when working on multiple issues/PRs simultaneously.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Pattern for running multiple sub-agents in parallel using git worktrees. Use this when working on multiple issues/PRs simultaneously.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
{what this skill teaches agents}
Guide for using the Rally CLI tool to dispatch AI agents to GitHub issues and PR reviews via git worktrees. Use this when working with Rally dispatches, the dashboard, or managing worktrees.
Workaround for installing Squad SDK from GitHub branches that don't have dist/ committed
Hard-won patterns for building fullscreen terminal UIs with Ink 5 + React. Covers useInput race conditions, fullscreen rendering, sub-view switching, and testing with ink-testing-library.
Dual-review PR workflow: Copilot automated code review + Mal manual team review. All comments must be addressed (fix or explain). Out-of-scope work opens GitHub issues with @copilot assignment.
Proven process for technical design phases: resolve blockers upfront, engage stakeholders early, validate against reality before team review, spec test frameworks before implementation, scope features explicitly.
| name | parallel-worktree-agents |
| description | Pattern for running multiple sub-agents in parallel using git worktrees. Use this when working on multiple issues/PRs simultaneously. |
Run multiple sub-agents in isolated git worktrees to parallelize work across issues and PRs. Each agent gets its own working copy so there are no file conflicts.
Create a worktree per issue/PR from origin/main. Use /tmp/ if the repo's parent directory has restricted permissions:
cd <repo-root>
git fetch origin main
git worktree add /tmp/<repo>-<number> -b <branch-prefix>/<number>-<slug> origin/main
Branch naming conventions:
fix/<number>-<slug>, refactor/<number>-<slug>, feat/<number>-<slug>review/<number>-<slug>docs/<number>-<slug>chore/<number>-<slug>Important: Always create branches from origin/main, not from HEAD, to prevent cross-PR contamination when multiple agents work in parallel.
Use the task tool with mode: "background" and agent_type: "general-purpose" for each worktree:
task(
agent_type: "general-purpose",
mode: "background",
description: "Fix #<number> <short-desc>",
prompt: "Work in worktree `/tmp/<repo>-<number>` on branch `<branch>`..."
)
Each agent prompt should include:
cd and what branch they're ongh pr create with title, body, --base mainread_agent(agent_id: "agent-N", wait: true, timeout: 300)
Poll multiple agents in parallel:
read_agent(agent_id: "agent-1", wait: true, timeout: 300)
read_agent(agent_id: "agent-2", wait: true, timeout: 300)
# ... up to 5
After PR creation, Copilot reviews arrive within ~60-90 seconds. Check with:
gh pr view <number> --json reviews --jq '.reviews[] | "\(.author.login): \(.state)"'
Read review threads:
github-mcp-server-pull_request_read(method: "get_review_comments", pullNumber: <N>)
Dispatch a fix agent to the same worktree/branch to address comments, then resolve threads via GraphQL:
# Get thread IDs
gh api graphql -f query='{ repository(owner: "OWNER", name: "REPO") { pullRequest(number: N) { reviewThreads(first: 20) { nodes { id isResolved } } } } }'
# Resolve each thread
gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
PRs that touch overlapping files must be merged sequentially — each merge changes main, so subsequent PRs need rebase:
# Merge first PR
gh pr merge <N> --squash --delete-branch --admin
# Rebase next PR in its worktree
cd /tmp/<repo>-<next>
git fetch origin main
git rebase origin/main
# Resolve conflicts if needed
GIT_EDITOR=true git rebase --continue # headless rebase
git push --force-with-lease origin <branch>
# Then merge
gh pr merge <next> --squash --delete-branch --admin
Merge order: Security fixes → bug fixes → features → refactors → docs
After all PRs are merged:
cd <repo-root>
git worktree remove /tmp/<repo>-<number> --force
# Repeat for each worktree
The --force flag handles the case where the branch was already deleted by the merge.
Use the session SQL database to track agent work:
INSERT INTO todos (id, title, status) VALUES ('i42', '#42 Fix auth bug', 'pending');
-- Before dispatching:
UPDATE todos SET status = 'in_progress' WHERE id = 'i42';
-- After PR merged:
UPDATE todos SET status = 'done' WHERE id = 'i42';
/tmp/ prefix if git worktree add fails with permission errorsgit worktree add /tmp/X -B branch origin/main (capital -B) to force-resetgit fetch origin main && git rebase origin/main in the worktree before merging--delete-branch--test-force-exit flag due to ~35s delay from es-toolkit/compat