一键导入
agent-spawn
Spawn multiple Claude Code agents in parallel tmux panes with optional git worktrees
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Spawn multiple Claude Code agents in parallel tmux panes with optional git worktrees
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run an autonomous, spec-driven, tiered self/cross-verifying loop — the harness forces continuation until the goal is objectively met or a guardrail fires
Author a durable, machine-checkable SPEC.md (the anchor for an autonomous loop) with EARS-style acceptance criteria mapped to verify commands
Tier 3 작업 완료 전 N-라운드 독립검증·수정 루프. git diff를 모델 로테이션(Claude/GPT/Gemini)으로 라운드마다 독립 검증하고 수정한다.
Initialize oh-my-harness in the current project (plugin mode)
Configure oh-my-harness settings (features, thresholds, model routing, multi-agent)
Create a native Claude Code team with configured teammates and task assignments
| name | agent-spawn |
| description | Spawn multiple Claude Code agents in parallel tmux panes with optional git worktrees |
| level | 2 |
Spawn multiple Claude Code agents in parallel tmux panes, each with optional isolated git worktrees.
Usage: /agent-spawn [count] [task description] Example: /agent-spawn 3 fix all TypeScript errors in src/
Parse arguments: Extract agent count (default: 2) and task description from $ARGUMENTS.
Read config: Load .claude/.omh/harness.config.json and extract:
multiAgent.maxAgents — cap agent count if exceeded (warn user)multiAgent.useWorktree — whether to create isolated git worktrees (default: true)multiAgent.tmuxSession — tmux session name (default: omh-agents)Validate inputs before proceeding:
tmuxSession must match ^[a-zA-Z0-9_-]+$ — if not, reject with error: "Invalid tmux session name. Only alphanumeric, dash, underscore allowed."N must be a positive integer ≤ maxAgentsConfirm with user using AskUserQuestion before doing anything: Show a clear summary of exactly what will happen:
About to spawn {N} Claude agents:
Task : {task description}
Tmux session: {tmuxSession}
Worktrees : YES — each agent gets branch omh/agent-{i}
(or: NO — agents share the main working directory)
Permissions : --dangerously-skip-permissions (agents run without tool confirmations)
Auto-view : A new terminal window will open showing all agent panes
Proceed? [yes / cancel]
If the user says no or cancel, stop immediately. Do not proceed.
Check prerequisites (fail fast, report clearly):
which tmux — tmux must be installedwhich claude — claude CLI must be in PATHuseWorktree is true: git rev-parse --git-dir — must be a git repo.claude/.omh/agents.json — if it exists with running agents, warn and ask to abort or replaceCreate worktrees (only when useWorktree is true):
For each agent i from 1 to N:
git worktree add .claude/.omh/worktrees/agent-{i} -b omh/agent-{i}
Working directory per agent: .claude/.omh/worktrees/agent-{i}.
When useWorktree is false, all agents run from the project root.
Create tmux session:
# First pane — agent-1 workdir
tmux new-session -d -s "{tmuxSession}" -c {workdir-for-agent-1}
# Remaining panes
tmux split-window -t "{tmuxSession}" -c {workdir-for-agent-i} # repeat for i=2..N
tmux select-layout -t "{tmuxSession}" tiled
Prepare task descriptions: Task descriptions may contain newlines, quotes, or special characters that break shell quoting. Always write each agent's task to a file and reference it in the command:
# Write task file per agent (inside the agent's working directory)
# File: {workdir}/TASK.md
Use the Write tool to create TASK.md in each agent's worktree/working directory.
This avoids all shell escaping issues with multiline or complex task descriptions.
Launch Claude in each pane:
Use --permission-mode bypassPermissions instead of --dangerously-skip-permissions to avoid the interactive consent prompt:
tmux send-keys -t "{tmuxSession}:0.{i-1}" "claude --permission-mode bypassPermissions -p 'TASK.md 파일을 읽고 그 안의 지시사항대로 작업해줘.'" Enter
Important:
-p (print) flag skips the workspace trust dialog and runs non-interactively.TASK.md, NOT inline — this prevents shell injection and quoting issues.TASK.md contains its own task.Auto-open terminal with tmux session (macOS): Immediately after launching agents, open a new terminal window attached to the tmux session so the user can watch live:
# Detect terminal emulator and open accordingly
if [[ "$TERM_PROGRAM" == "iTerm.app" ]] || pgrep -q iTerm2; then
osascript -e 'tell application "iTerm2" to create window with default profile command "tmux attach -t \"{tmuxSession}\""'
elif [[ "$TERM_PROGRAM" == "WarpTerminal" ]] || pgrep -q Warp; then
open -a "Warp" --args -e "tmux attach -t \"{tmuxSession}\""
else
osascript -e 'tell application "Terminal" to do script "tmux attach -t \"{tmuxSession}\""'
fi
On Linux (non-macOS):
# Fallback: suggest manual attach
echo "Run: tmux attach -t \"{tmuxSession}\""
Save agent state to .claude/.omh/agents.json:
{
"session": "{tmuxSession}",
"spawned_at": "ISO timestamp",
"task": "task description",
"useWorktree": true,
"agents": [
{ "id": 1, "status": "running", "branch": "omh/agent-1", "worktree": ".claude/.omh/worktrees/agent-1" }
]
}
When useWorktree is false, omit branch and worktree fields per agent.
Spawned {N} agents in tmux session '{tmuxSession}'.
A terminal window has been opened — you can watch agents live.
Next steps:
/agent-status — check progress (commits, files changed)
/agent-apply [id|all] — preview and merge changes (worktree mode only)
/agent-stop [id|all] — stop agents and clean up
/agent-apply