From oh-my-harness
Spawns multiple parallel Claude Code agents in tmux panes with optional isolated git worktrees for concurrent task execution like fixing errors across files.
npx claudepluginhub hoya324/oh-my-harness --plugin oh-my-harnessThis skill uses the workspace's default tool permissions.
Spawn multiple Claude Code agents in parallel tmux panes, each with optional isolated git worktrees.
Spawns AI coding agents in isolated git worktrees using agent-cli dev for parallel development, task delegation, and feature isolation. Activates on requests to launch agents or parallelize work.
Orchestrates multiple git worktree agents using workmux CLI: spawn with prompt files, monitor statuses, send instructions, wait for completion, and merge.
Launches git worktrees with tmux background sessions running Claude Code agents for non-blocking execution of large multi-step coding tasks like major refactors or new services.
Share bugs, ideas, or general feedback.
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