[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75WGZ4FGKR9X2PXB1WSARDC":3,"skill-same:01M75WGZ4FGKR9X2PXB1WSARDC":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":44},"01M75WGZ4FGKR9X2PXB1WSARDC","swarm-create",null,"Create a new self-sufficient swarm team from a Beads epic with N worker agents + a watchdog daemon that auto-recovers stuck panes and notify-only finalizes when the epic is done. Cross-provider (Claude\u002FCodex\u002FCopilot).","stevengonsalvez\u002Fainb-toolkit","stevengonsalvez","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9320602?v=4","01M75W59QRYZYANWY3XG8CJB1P","Steven Gonsalvez","01M75W59RD5YW1RT67BDV0EAZF",1,"MIT","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-create\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: swarm-create\ndescription: Create a new self-sufficient swarm team from a Beads epic with N worker agents + a watchdog daemon that auto-recovers stuck panes and notify-only finalizes when the epic is done. Cross-provider (Claude\u002FCodex\u002FCopilot).\nuser-invocable: true\n---\n\n# \u002Fswarm-create\n\nCreate a tmux-persistent multi-agent swarm team for parallel task execution,\nbacked by a cross-provider bash watchdog that prevents agents from getting\nstuck indefinitely and writes a notify-only finalize report when the epic\ncompletes.\n\n> **v2 changes from v1**: ships a watchdog tmux session that detects stuck\n> panes, sends Enter \u002F \"continue\" \u002F leader-help nudges, and runs `finalize.sh`\n> when the epic is done. Never auto-kills tmux. Never auto-merges. Cross-\n> provider via explicit `--provider` flag.\n\n## Usage\n\n```bash\n\u002Fswarm-create --epic \u003Cepic-id> --agents \u003Ccount> --provider \u003Cclaude|codex|copilot> \\\n  [--isolation \u003Cshared|worktree>] [--tick-min \u003CN>] [--auto-pr] [--use-loop] \\\n  [--verify-cmd \u003Ccmd>] [--no-watchdog] [--dry-run]\n```\n\n## Arguments\n\n| Argument | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `--epic` | Yes | - | Beads epic ID to create swarm from |\n| `--agents` | No | 2 | Number of worker agents (max 4) |\n| `--provider` | **Yes** | - | Agent runtime: `claude`, `codex`, `copilot`, or `generic`. Determines spinner detection. Ask the user if not given. |\n| `--isolation` | No | (ask user) | `shared` or `worktree` |\n| `--tick-min` | No | 5 | Watchdog tick interval in minutes (1-60) |\n| `--auto-pr` | No | off | If set, on epic-done with green verify, watchdog opens a **draft** PR via `gh`. Default off. |\n| `--use-loop` | No | off | Claude-only: also arm a leader `\u002Floop` for redundant fast-tick. Bash watchdog still runs. |\n| `--verify-cmd` | No | auto-detect | Override the auto-detected verify command. Auto-detect: Cargo.toml→`cargo test --workspace --no-fail-fast`, package.json→`npm test`, pyproject.toml→`pytest`, go.mod→`go test .\u002F...`, Makefile→`make test`, etc. |\n| `--no-watchdog` | No | off | Escape hatch — skip watchdog entirely. Use v1 (no auto-recovery) behavior. |\n| `--dry-run` | No | off | Preview without executing |\n\n## Isolation Modes\n\nSame as v1: `shared` (faster, no merge step) vs `worktree` (full isolation,\nneeds explicit merge step at the end). The watchdog respects both — for\nworktree mode, finalize runs a **dry-run merge** per agent branch and reports\nconflicts without actually merging.\n\n**You MUST ask the user which isolation mode they want if not specified.**\n\n## Process\n\nWhen you receive this command:\n\n1. **Parse Arguments**\n   ```bash\n   EPIC_ID=\"\"           # --epic\n   AGENT_COUNT=2        # --agents\n   PROVIDER=\"\"          # --provider (will ask if missing)\n   ISOLATION_MODE=\"\"    # --isolation (will ask if missing)\n   TICK_MIN=5           # --tick-min\n   AUTO_PR=false        # --auto-pr\n   USE_LOOP=false       # --use-loop\n   VERIFY_CMD=\"\"        # --verify-cmd (will auto-detect if missing)\n   USE_WATCHDOG=true    # negated by --no-watchdog\n   DRY_RUN=false        # --dry-run\n   ```\n\n2. **Ask for provider if not specified**\n\n   Use `AskUserQuestion`:\n\n   ```\n   question: \"Which agent runtime will the swarm panes run?\"\n   header: \"Provider\"\n   options:\n     - label: \"claude\"\n       description: \"Claude Code TUI (default — spinner: ✻\u002F✳\u002F⏺\u002F✿ + verbs)\"\n     - label: \"codex\"\n       description: \"OpenAI Codex CLI (braille spinner — placeholder, may need calibration)\"\n     - label: \"copilot\"\n       description: \"GitHub Copilot CLI (placeholder)\"\n     - label: \"generic\"\n       description: \"Unknown \u002F mixed — pane-hash heuristic only\"\n   ```\n\n3. **Ask for isolation mode if not specified** (same as v1)\n\n4. **Auto-detect verify command**\n   ```bash\n   if [[ -z \"$VERIFY_CMD\" ]]; then\n     VERIFY_CMD=$(bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh detect-verify-cmd \"$PWD\")\n     echo \"Auto-detected verify cmd: $VERIFY_CMD\"\n   fi\n   ```\n\n   Show the user what was detected and let them confirm\u002Foverride.\n\n5. **Validate Epic** (if not dry-run)\n   ```bash\n   bd show \"$EPIC_ID\" --json || echo \"Epic not found\"\n   ```\n\n6. **Create Beads Swarm**\n   ```bash\n   bd swarm create \"$EPIC_ID\" --json\n   ```\n\n7. **Initialize Team Directory** (v1 helper)\n   ```bash\n   source {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh\n   TEAM_ID=$(swarm_create_team \"$EPIC_ID\" \"$AGENT_COUNT\" \"$ISOLATION_MODE\")\n   ```\n\n8. **Initialize v2 team.json schema fields**\n   ```bash\n   bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh init-v2-team-json \\\n     \"$TEAM_ID\" \"$PROVIDER\" \"$VERIFY_CMD\" \"$TICK_MIN\" \"$AUTO_PR\" \"$USE_LOOP\" \"$PWD\"\n   ```\n\n9. **Spawn Leader** (v1 helper, now has v2-aware prompt baked in)\n   ```bash\n   LEADER_SESSION=$(swarm_spawn_leader \"$TEAM_ID\")\n   ```\n\n10. **Spawn Worker Agents** (v1 helper, also v2-aware prompt)\n    ```bash\n    for i in $(seq 1 $AGENT_COUNT); do\n      AGENT_SESSION=$(swarm_spawn_agent \"$TEAM_ID\" \"agent-$i\")\n      sleep 2\n    done\n    ```\n\n11. **Spawn Watchdog Daemon** (unless `--no-watchdog`)\n    ```bash\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      WATCHDOG_SESSION=$(bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh spawn-watchdog \"$TEAM_ID\")\n      echo \"Watchdog spawned: $WATCHDOG_SESSION\"\n    fi\n    ```\n\n12. **Optional: arm leader \u002Floop** (Claude only, `--use-loop`)\n\n    If `$PROVIDER == \"claude\"` and `$USE_LOOP == \"true\"`, separately arm a\n    `\u002Floop` on the leader for redundant fast-tick. This requires the leader's\n    Claude TUI to be receptive — the bash watchdog is the primary tick path.\n\n13. **Verify & Report**\n\n    ```bash\n    swarm_get_status \"$TEAM_ID\" | jq .\n\n    echo \"\"\n    echo \"========================================\"\n    echo \"Swarm Created (v2): $TEAM_ID\"\n    echo \"========================================\"\n    echo \"Epic:         $EPIC_ID\"\n    echo \"Provider:     $PROVIDER\"\n    echo \"Isolation:    $ISOLATION_MODE\"\n    echo \"Leader:       ${TEAM_ID}-leader\"\n    echo \"Agents:       $AGENT_COUNT\"\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      echo \"Watchdog:     ${TEAM_ID}-watchdog (${TICK_MIN}-min ticks)\"\n    else\n      echo \"Watchdog:     DISABLED (--no-watchdog)\"\n    fi\n    echo \"Verify cmd:   $VERIFY_CMD\"\n    echo \"Auto-PR:      $AUTO_PR\"\n    echo \"\"\n    echo \"Commands:\"\n    echo \"  Attach to leader:    tmux attach -t ${TEAM_ID}-leader\"\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      echo \"  Attach to watchdog:  tmux attach -t ${TEAM_ID}-watchdog\"\n      echo \"  Watchdog log:        tail -f {{HOME_TOOL_DIR}}\u002Fswarm\u002F${TEAM_ID}\u002Fwatchdog.log\"\n      echo \"  Kill watchdog only:  bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh kill-watchdog ${TEAM_ID}\"\n    fi\n    echo \"  Status:              \u002Fswarm-status ${TEAM_ID}\"\n    echo \"  Shutdown:            \u002Fswarm-shutdown ${TEAM_ID}\"\n    echo \"\"\n    echo \"Watchdog behavior:\"\n    echo \"- Captures all panes every ${TICK_MIN}min\"\n    echo \"- Nudges stuck panes (Enter → 'continue' + Enter → leader-help-inbox)\"\n    echo \"- On epic-done: runs finalize.sh (notify-only, writes report)\"\n    echo \"- NEVER kills tmux. NEVER auto-merges. Human owns those steps.\"\n    echo \"========================================\"\n    ```\n\n## Dry Run Output\n\n```\nDRY RUN: Would create v2 swarm from epic: bd-epic-123\n\nProvider:        claude\nIsolation:       worktree\nAgents:          3\nWatchdog:        ON (5-min ticks)\nVerify cmd:      cargo test --workspace --no-fail-fast (auto-detected)\nAuto-PR:         off\nUse-loop:        off\n\nWould create:\n  - Team directory: {{HOME_TOOL_DIR}}\u002Fswarm\u002Fswarm-XXXXXXXXXX\u002F\n  - team.json with v2 schema (provider, commands, ci, watchdog, finalize)\n  - Inbox files: leader.jsonl, agent-1.jsonl, agent-2.jsonl, agent-3.jsonl\n  - Worktrees (worktree mode): agent-1, agent-2, agent-3\n\nWould spawn tmux sessions:\n  - swarm-XXXXXXXXXX-leader\n  - swarm-XXXXXXXXXX-agent-{1,2,3}\n  - swarm-XXXXXXXXXX-watchdog (bash daemon)\n\nWould run:\n  bd swarm create bd-epic-123\n\nNo changes made.\n```\n\n## Examples\n\n```bash\n# Basic v2 (cross-provider, claude)\n\u002Fswarm-create --epic bd-epic-skill-manager-v1 --agents 3 --provider claude\n\n# Codex agents\n\u002Fswarm-create --epic bd-epic-X --agents 2 --provider codex\n\n# Aggressive watchdog cadence\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --tick-min 3\n\n# Belt-and-suspenders Claude swarm with auto-PR\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --use-loop --auto-pr\n\n# Escape hatch: v1 behavior (no auto-recovery)\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --no-watchdog\n```\n\n## Worktree Mode — Post-Swarm Workflow\n\nWhen using worktree isolation, after the swarm completes (finalize runs):\n\n```bash\n# 1. Watchdog writes finalize-report.md to shared\u002F\ncat {{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002Fshared\u002Ffinalize-report.md\n\n# 2. Inspect conflict report. If clean, do the actual merge:\nbash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh merge-worktrees \u003Cteam-id>\n\n# 3. Review the merged changes\ngit log --oneline -10\n\n# 4. Push and open PR (if not done via --auto-pr)\ngit push -u origin HEAD\ngh pr create --title \"...\" --body-file {{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002Fshared\u002Ffinalize-report.md\n\n# 5. Shutdown the swarm (you own this — watchdog never does it)\n\u002Fswarm-shutdown \u003Cteam-id>\n```\n\n## Integration with Beads\n\nSame as v1:\n- **Epic** = parent issue\n- **bd ready --unassigned** = ready work pool\n- **bd swarm create** = bd-side bookkeeping\n\n## What This Does NOT Do (v2 hard constraints)\n\n- ❌ Never kills tmux sessions automatically — human owns `\u002Fswarm-shutdown`\n- ❌ Never auto-merges worktree branches — finalize does dry-run only\n- ❌ Never marks a PR as ready — auto-PR opens **draft** only\n- ❌ Never modifies code in worker panes directly — watchdog only sends Enter \u002F \"continue\" \u002F writes inbox\n\n## Hard Failure Modes & Mitigations\n\n| Failure | What watchdog does | What human still owns |\n|---|---|---|\n| Worker pane has stuck text in `❯` prompt | Send Enter → \"continue\" + Enter → log to leader.jsonl | Reviewing if leader correctly recovers |\n| Worker capped (5h limit hit) | Skip nudge, note in log, continue | Wait for cap reset OR run \u002Fswarm-attach-watchdog with different provider config |\n| Leader pane stuck | Same nudge sequence as workers | Same as above |\n| Watchdog tmux session dies | Nothing — daemon is dead | Run `\u002Fswarm-attach-watchdog \u003Cteam-id>` to respawn |\n| Epic-done but verify fails | Writes failed verify in report; does NOT touch worktrees or PR | Fix code + re-trigger by clearing `.finalized` marker |\n| All workers capped, leader idle | Watchdog logs 'all_capped' to leader.jsonl, keeps ticking | Wait for cap or reassign work |\n\n## Files Created at Swarm Creation\n\n```\n{{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002F\n├── team.json                       # v2 schema (provider, commands, ci, watchdog, finalize, ...)\n├── inbox\u002F\n│   ├── leader.jsonl\n│   └── agent-{1..N}.jsonl\n├── shared\u002F                         # populated by workers + finalize.sh\n├── watchdog.pid                    # written by watchdog at startup\n├── watchdog.log                    # tick-by-tick log\n├── watchdog.state                  # per-pane stuck counters + hashes\n└── .finalized                      # sentinel — set after finalize.sh runs once\n```\n\nTmux sessions:\n```\n\u003Cteam-id>-leader        # Claude\u002FCodex\u002FCopilot TUI (orchestrator)\n\u003Cteam-id>-agent-{1..N}  # Worker TUIs\n\u003Cteam-id>-watchdog      # Pure bash daemon — captures + nudges + finalizes\n```\n\n## Migration from v1\n\nExisting v1 swarms can be retrofitted in-place — no need to recreate them.\n\n```bash\n\u002Fswarm-attach-watchdog \u003Cteam-id> --provider claude\n```\n\nThis upgrades `team.json` to the v2 schema and spawns the watchdog tmux session\nwithout touching the leader or worker tmux sessions.\n\nSee `\u002Fswarm-attach-watchdog` skill for details.\n","# \u002Fswarm-create\n\nCreate a tmux-persistent multi-agent swarm team for parallel task execution,\nbacked by a cross-provider bash watchdog that prevents agents from getting\nstuck indefinitely and writes a notify-only finalize report when the epic\ncompletes.\n\n> **v2 changes from v1**: ships a watchdog tmux session that detects stuck\n> panes, sends Enter \u002F \"continue\" \u002F leader-help nudges, and runs `finalize.sh`\n> when the epic is done. Never auto-kills tmux. Never auto-merges. Cross-\n> provider via explicit `--provider` flag.\n\n## Usage\n\n```bash\n\u002Fswarm-create --epic \u003Cepic-id> --agents \u003Ccount> --provider \u003Cclaude|codex|copilot> \\\n  [--isolation \u003Cshared|worktree>] [--tick-min \u003CN>] [--auto-pr] [--use-loop] \\\n  [--verify-cmd \u003Ccmd>] [--no-watchdog] [--dry-run]\n```\n\n## Arguments\n\n| Argument | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `--epic` | Yes | - | Beads epic ID to create swarm from |\n| `--agents` | No | 2 | Number of worker agents (max 4) |\n| `--provider` | **Yes** | - | Agent runtime: `claude`, `codex`, `copilot`, or `generic`. Determines spinner detection. Ask the user if not given. |\n| `--isolation` | No | (ask user) | `shared` or `worktree` |\n| `--tick-min` | No | 5 | Watchdog tick interval in minutes (1-60) |\n| `--auto-pr` | No | off | If set, on epic-done with green verify, watchdog opens a **draft** PR via `gh`. Default off. |\n| `--use-loop` | No | off | Claude-only: also arm a leader `\u002Floop` for redundant fast-tick. Bash watchdog still runs. |\n| `--verify-cmd` | No | auto-detect | Override the auto-detected verify command. Auto-detect: Cargo.toml→`cargo test --workspace --no-fail-fast`, package.json→`npm test`, pyproject.toml→`pytest`, go.mod→`go test .\u002F...`, Makefile→`make test`, etc. |\n| `--no-watchdog` | No | off | Escape hatch — skip watchdog entirely. Use v1 (no auto-recovery) behavior. |\n| `--dry-run` | No | off | Preview without executing |\n\n## Isolation Modes\n\nSame as v1: `shared` (faster, no merge step) vs `worktree` (full isolation,\nneeds explicit merge step at the end). The watchdog respects both — for\nworktree mode, finalize runs a **dry-run merge** per agent branch and reports\nconflicts without actually merging.\n\n**You MUST ask the user which isolation mode they want if not specified.**\n\n## Process\n\nWhen you receive this command:\n\n1. **Parse Arguments**\n   ```bash\n   EPIC_ID=\"\"           # --epic\n   AGENT_COUNT=2        # --agents\n   PROVIDER=\"\"          # --provider (will ask if missing)\n   ISOLATION_MODE=\"\"    # --isolation (will ask if missing)\n   TICK_MIN=5           # --tick-min\n   AUTO_PR=false        # --auto-pr\n   USE_LOOP=false       # --use-loop\n   VERIFY_CMD=\"\"        # --verify-cmd (will auto-detect if missing)\n   USE_WATCHDOG=true    # negated by --no-watchdog\n   DRY_RUN=false        # --dry-run\n   ```\n\n2. **Ask for provider if not specified**\n\n   Use `AskUserQuestion`:\n\n   ```\n   question: \"Which agent runtime will the swarm panes run?\"\n   header: \"Provider\"\n   options:\n     - label: \"claude\"\n       description: \"Claude Code TUI (default — spinner: ✻\u002F✳\u002F⏺\u002F✿ + verbs)\"\n     - label: \"codex\"\n       description: \"OpenAI Codex CLI (braille spinner — placeholder, may need calibration)\"\n     - label: \"copilot\"\n       description: \"GitHub Copilot CLI (placeholder)\"\n     - label: \"generic\"\n       description: \"Unknown \u002F mixed — pane-hash heuristic only\"\n   ```\n\n3. **Ask for isolation mode if not specified** (same as v1)\n\n4. **Auto-detect verify command**\n   ```bash\n   if [[ -z \"$VERIFY_CMD\" ]]; then\n     VERIFY_CMD=$(bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh detect-verify-cmd \"$PWD\")\n     echo \"Auto-detected verify cmd: $VERIFY_CMD\"\n   fi\n   ```\n\n   Show the user what was detected and let them confirm\u002Foverride.\n\n5. **Validate Epic** (if not dry-run)\n   ```bash\n   bd show \"$EPIC_ID\" --json || echo \"Epic not found\"\n   ```\n\n6. **Create Beads Swarm**\n   ```bash\n   bd swarm create \"$EPIC_ID\" --json\n   ```\n\n7. **Initialize Team Directory** (v1 helper)\n   ```bash\n   source {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh\n   TEAM_ID=$(swarm_create_team \"$EPIC_ID\" \"$AGENT_COUNT\" \"$ISOLATION_MODE\")\n   ```\n\n8. **Initialize v2 team.json schema fields**\n   ```bash\n   bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh init-v2-team-json \\\n     \"$TEAM_ID\" \"$PROVIDER\" \"$VERIFY_CMD\" \"$TICK_MIN\" \"$AUTO_PR\" \"$USE_LOOP\" \"$PWD\"\n   ```\n\n9. **Spawn Leader** (v1 helper, now has v2-aware prompt baked in)\n   ```bash\n   LEADER_SESSION=$(swarm_spawn_leader \"$TEAM_ID\")\n   ```\n\n10. **Spawn Worker Agents** (v1 helper, also v2-aware prompt)\n    ```bash\n    for i in $(seq 1 $AGENT_COUNT); do\n      AGENT_SESSION=$(swarm_spawn_agent \"$TEAM_ID\" \"agent-$i\")\n      sleep 2\n    done\n    ```\n\n11. **Spawn Watchdog Daemon** (unless `--no-watchdog`)\n    ```bash\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      WATCHDOG_SESSION=$(bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh spawn-watchdog \"$TEAM_ID\")\n      echo \"Watchdog spawned: $WATCHDOG_SESSION\"\n    fi\n    ```\n\n12. **Optional: arm leader \u002Floop** (Claude only, `--use-loop`)\n\n    If `$PROVIDER == \"claude\"` and `$USE_LOOP == \"true\"`, separately arm a\n    `\u002Floop` on the leader for redundant fast-tick. This requires the leader's\n    Claude TUI to be receptive — the bash watchdog is the primary tick path.\n\n13. **Verify & Report**\n\n    ```bash\n    swarm_get_status \"$TEAM_ID\" | jq .\n\n    echo \"\"\n    echo \"========================================\"\n    echo \"Swarm Created (v2): $TEAM_ID\"\n    echo \"========================================\"\n    echo \"Epic:         $EPIC_ID\"\n    echo \"Provider:     $PROVIDER\"\n    echo \"Isolation:    $ISOLATION_MODE\"\n    echo \"Leader:       ${TEAM_ID}-leader\"\n    echo \"Agents:       $AGENT_COUNT\"\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      echo \"Watchdog:     ${TEAM_ID}-watchdog (${TICK_MIN}-min ticks)\"\n    else\n      echo \"Watchdog:     DISABLED (--no-watchdog)\"\n    fi\n    echo \"Verify cmd:   $VERIFY_CMD\"\n    echo \"Auto-PR:      $AUTO_PR\"\n    echo \"\"\n    echo \"Commands:\"\n    echo \"  Attach to leader:    tmux attach -t ${TEAM_ID}-leader\"\n    if [[ \"$USE_WATCHDOG\" == \"true\" ]]; then\n      echo \"  Attach to watchdog:  tmux attach -t ${TEAM_ID}-watchdog\"\n      echo \"  Watchdog log:        tail -f {{HOME_TOOL_DIR}}\u002Fswarm\u002F${TEAM_ID}\u002Fwatchdog.log\"\n      echo \"  Kill watchdog only:  bash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh kill-watchdog ${TEAM_ID}\"\n    fi\n    echo \"  Status:              \u002Fswarm-status ${TEAM_ID}\"\n    echo \"  Shutdown:            \u002Fswarm-shutdown ${TEAM_ID}\"\n    echo \"\"\n    echo \"Watchdog behavior:\"\n    echo \"- Captures all panes every ${TICK_MIN}min\"\n    echo \"- Nudges stuck panes (Enter → 'continue' + Enter → leader-help-inbox)\"\n    echo \"- On epic-done: runs finalize.sh (notify-only, writes report)\"\n    echo \"- NEVER kills tmux. NEVER auto-merges. Human owns those steps.\"\n    echo \"========================================\"\n    ```\n\n## Dry Run Output\n\n```\nDRY RUN: Would create v2 swarm from epic: bd-epic-123\n\nProvider:        claude\nIsolation:       worktree\nAgents:          3\nWatchdog:        ON (5-min ticks)\nVerify cmd:      cargo test --workspace --no-fail-fast (auto-detected)\nAuto-PR:         off\nUse-loop:        off\n\nWould create:\n  - Team directory: {{HOME_TOOL_DIR}}\u002Fswarm\u002Fswarm-XXXXXXXXXX\u002F\n  - team.json with v2 schema (provider, commands, ci, watchdog, finalize)\n  - Inbox files: leader.jsonl, agent-1.jsonl, agent-2.jsonl, agent-3.jsonl\n  - Worktrees (worktree mode): agent-1, agent-2, agent-3\n\nWould spawn tmux sessions:\n  - swarm-XXXXXXXXXX-leader\n  - swarm-XXXXXXXXXX-agent-{1,2,3}\n  - swarm-XXXXXXXXXX-watchdog (bash daemon)\n\nWould run:\n  bd swarm create bd-epic-123\n\nNo changes made.\n```\n\n## Examples\n\n```bash\n# Basic v2 (cross-provider, claude)\n\u002Fswarm-create --epic bd-epic-skill-manager-v1 --agents 3 --provider claude\n\n# Codex agents\n\u002Fswarm-create --epic bd-epic-X --agents 2 --provider codex\n\n# Aggressive watchdog cadence\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --tick-min 3\n\n# Belt-and-suspenders Claude swarm with auto-PR\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --use-loop --auto-pr\n\n# Escape hatch: v1 behavior (no auto-recovery)\n\u002Fswarm-create --epic bd-epic-X --agents 3 --provider claude --no-watchdog\n```\n\n## Worktree Mode — Post-Swarm Workflow\n\nWhen using worktree isolation, after the swarm completes (finalize runs):\n\n```bash\n# 1. Watchdog writes finalize-report.md to shared\u002F\ncat {{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002Fshared\u002Ffinalize-report.md\n\n# 2. Inspect conflict report. If clean, do the actual merge:\nbash {{HOME_TOOL_DIR}}\u002Futils\u002Fswarm-lib.sh merge-worktrees \u003Cteam-id>\n\n# 3. Review the merged changes\ngit log --oneline -10\n\n# 4. Push and open PR (if not done via --auto-pr)\ngit push -u origin HEAD\ngh pr create --title \"...\" --body-file {{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002Fshared\u002Ffinalize-report.md\n\n# 5. Shutdown the swarm (you own this — watchdog never does it)\n\u002Fswarm-shutdown \u003Cteam-id>\n```\n\n## Integration with Beads\n\nSame as v1:\n- **Epic** = parent issue\n- **bd ready --unassigned** = ready work pool\n- **bd swarm create** = bd-side bookkeeping\n\n## What This Does NOT Do (v2 hard constraints)\n\n- ❌ Never kills tmux sessions automatically — human owns `\u002Fswarm-shutdown`\n- ❌ Never auto-merges worktree branches — finalize does dry-run only\n- ❌ Never marks a PR as ready — auto-PR opens **draft** only\n- ❌ Never modifies code in worker panes directly — watchdog only sends Enter \u002F \"continue\" \u002F writes inbox\n\n## Hard Failure Modes & Mitigations\n\n| Failure | What watchdog does | What human still owns |\n|---|---|---|\n| Worker pane has stuck text in `❯` prompt | Send Enter → \"continue\" + Enter → log to leader.jsonl | Reviewing if leader correctly recovers |\n| Worker capped (5h limit hit) | Skip nudge, note in log, continue | Wait for cap reset OR run \u002Fswarm-attach-watchdog with different provider config |\n| Leader pane stuck | Same nudge sequence as workers | Same as above |\n| Watchdog tmux session dies | Nothing — daemon is dead | Run `\u002Fswarm-attach-watchdog \u003Cteam-id>` to respawn |\n| Epic-done but verify fails | Writes failed verify in report; does NOT touch worktrees or PR | Fix code + re-trigger by clearing `.finalized` marker |\n| All workers capped, leader idle | Watchdog logs 'all_capped' to leader.jsonl, keeps ticking | Wait for cap or reassign work |\n\n## Files Created at Swarm Creation\n\n```\n{{HOME_TOOL_DIR}}\u002Fswarm\u002F\u003Cteam-id>\u002F\n├── team.json                       # v2 schema (provider, commands, ci, watchdog, finalize, ...)\n├── inbox\u002F\n│   ├── leader.jsonl\n│   └── agent-{1..N}.jsonl\n├── shared\u002F                         # populated by workers + finalize.sh\n├── watchdog.pid                    # written by watchdog at startup\n├── watchdog.log                    # tick-by-tick log\n├── watchdog.state                  # per-pane stuck counters + hashes\n└── .finalized                      # sentinel — set after finalize.sh runs once\n```\n\nTmux sessions:\n```\n\u003Cteam-id>-leader        # Claude\u002FCodex\u002FCopilot TUI (orchestrator)\n\u003Cteam-id>-agent-{1..N}  # Worker TUIs\n\u003Cteam-id>-watchdog      # Pure bash daemon — captures + nudges + finalizes\n```\n\n## Migration from v1\n\nExisting v1 swarms can be retrofitted in-place — no need to recreate them.\n\n```bash\n\u002Fswarm-attach-watchdog \u003Cteam-id> --provider claude\n```\n\nThis upgrades `team.json` to the v2 schema and spawns the watchdog tmux session\nwithout touching the leader or worker tmux sessions.\n\nSee `\u002Fswarm-attach-watchdog` skill for details.\n",{"name":5,"description":7,"user-invocable":24},true,"main","9cf32d1e636db09530158af14ba301bfa5d401e9","skills\u002Fswarm-create","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez","stevengonsalvez.com","2026-11-12 00:50:59",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":24},[34,37,40],{"tool":35,"command":36},"npx","npx skills add stevengonsalvez\u002Fainb-toolkit --skill swarm-create",{"tool":38,"command":39},"bunx","bunx skills add stevengonsalvez\u002Fainb-toolkit --skill swarm-create",{"tool":41,"command":42},"pnpm","pnpm dlx skills add stevengonsalvez\u002Fainb-toolkit --skill swarm-create","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-create\u002FSKILL.md",[45,51,57],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"finalize.sh","SCRIPT","脚本",9207,"https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-create\u002Ffinalize.sh",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"v2-spec.md","REFERENCE","参考文档",19430,"https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-create\u002Fv2-spec.md",{"path":58,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":59,"sourceHtmlUrl":60},"watchdog.sh",11788,"https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-create\u002Fwatchdog.sh",[62,69,76,82,89,96],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M75WK9B8DKVJBJJ4CX2QMJMX","well-formed","Fixture skill that satisfies every mechanical rule, used to prove the conformance check passes a clean tree instead of failing everything.","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fclean\u002Fwell-formed\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M75WK6ZGDXJJN8879K49QEYG","underscore-tools","Fixture skill that spells the tool allowlist key with an underscore instead of the hyphen the spec requires.","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fbroken\u002Funderscore-tools\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M75WK524MVT2H9E27ZCEA3HR","no-frontmatter","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fbroken\u002Fno-frontmatter\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M75WJWZBMKR8R60PG3T3MCCC","long-description","Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling. Fixture skill with a deliberately oversized description used to prove the conformance check rejects anything past the 1024 character ceiling.","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fbroken\u002Flong-description\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M75WJVRH3J22WKED7E5D01S8","some-other-name","Fixture skill whose frontmatter name does not match its parent directory name.","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fbroken\u002Fdir-mismatch\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M75WJTC7H5FRP6S129VBSMZC","bad_Name","Fixture skill whose name uses an underscore and a capital letter, so it violates the agentskills.io name pattern.","https:\u002F\u002Fgithub.com\u002Fstevengonsalvez\u002Fainb-toolkit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fagentskills\u002Fbroken\u002Fbad_Name\u002FSKILL.md",[],[]]