[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MK5QRJB27QVJZCPQX41TQT":3,"skill-same:01M6MK5QRJB27QVJZCPQX41TQT":69},{"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":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":62},"01M6MK5QRJB27QVJZCPQX41TQT","flow-parallel",null,"Decompose and execute large changes, migrations, or multi-issue fixes in parallel with quality gates","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1575,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fnyldn\u002Fclaude-octopus\u002Fskills\u002Fflow-parallel\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"flow","parallel","flow parallel","issue","decompose","fixes","true","gates","with","multi","quality gates","changes","migrations","quality","execute","2026-11-10 10:12:30",false,"---\nname: flow-parallel\ndescription: \"Decompose and execute large changes, migrations, or multi-issue fixes in parallel with quality gates\"\ndisable-model-invocation: true\n---\n\n> **Host: Codex CLI** — This skill was designed for Claude Code and adapted for Codex.\n> Cross-reference commands use installed skill names in Codex rather than `\u002Focto:*` slash commands.\n> Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it.\n> For host tool equivalents, see `skills\u002Fblocks\u002Fcodex-host-adapter.md`.\n\n\n# STOP - SKILL ALREADY LOADED\n\n**DO NOT call Skill() again. DO NOT load any more skills. Execute directly.**\n\n\n## EXECUTION CONTRACT (MANDATORY - CANNOT SKIP)\n\nThis skill uses **ENFORCED execution mode**. You MUST follow this exact 7-step sequence.\n\n**Architectural Principle:** host subagent tool subagents do NOT load plugins. Independent `claude -p` processes DO. This skill spawns independent `claude -p` processes so each work package gets the full Octopus plugin, its own Double Diamond, agents, and quality gates.\n\n\n### STEP 1: Clarifying Questions (MANDATORY)\n\n**Ask via AskUserQuestion BEFORE any other action.**\n\nYou MUST gather these inputs from the user — without scope, count, and dependency answers, the decomposition will be generic and produce overlapping work packages that cause merge conflicts:\n\n```\nAskUserQuestion with these questions:\n\n1. **Compound task**: What compound task should be decomposed?\n   - Use inline args if provided (e.g., \u002Focto:parallel \"build auth system\")\n   - If no args: ask \"What compound task should I decompose into parallel work packages?\"\n\n2. **Work package count**: How many work packages?\n   - Options: \"3 (Recommended)\", \"4\", \"5\", \"Custom (up to 10)\"\n   - Default: 3-5 is optimal\n\n3. **Dependencies**: Are the work packages independent?\n   - \"Fully independent - no dependencies between packages (Recommended)\"\n   - \"Some dependencies - packages may need to share interfaces\"\n   - \"Sequential dependencies - packages must complete in order\"\n```\n\nIf user provided a description inline with the command (e.g., `\u002Focto:parallel build a full auth system with OAuth, RBAC, and audit logging`), use that as the task description but STILL ask remaining questions (count, dependencies).\n\nIf user says \"skip\" for any question, use defaults: 3 work packages, fully independent.\n\n**DO NOT PROCEED TO STEP 2 until questions answered.**\n\n\n### STEP 2: Display Visual Indicators (MANDATORY - BLOCKING)\n\n**MANDATORY: You MUST use the native shell command tool to run this provider check BEFORE displaying the banner. Do NOT skip it. Do NOT assume availability.**\n\n```bash\nbash \"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fhelpers\u002Fcheck-providers.sh\"\n```\n\n**Use the ACTUAL results below. PROHIBITED: Showing only \"🔵 Claude: Available ✓\" without listing all providers.**\n\n**Display this banner with real provider status BEFORE any decomposition:**\n\n```\n🐙 CLAUDE OCTOPUS ACTIVATED - Team of Teams Mode\nParallel Phase: Decomposing compound task into N independent work packages\n\nArchitecture:\n  Main (this session) - Orchestrator: decompose, launch, monitor, aggregate\n  WP-1..WP-N (claude -p) - Independent workers with full plugin capabilities\n\nEach worker:\n  - Runs as independent claude -p process in its own git worktree\n  - Loads full Octopus plugin\n  - Has own context, tools, and quality gates\n  - Produces output.md + exit-code\n  - Tracked in agent registry (~\u002F.claude-octopus\u002Fagents\u002Fregistry.json)\n\nEstimated Time: 5-15 minutes (depending on task complexity)\n```\n\n**DO NOT PROCEED TO STEP 3 until banner displayed.**\n\n\n### STEP 3: Read Prior State (MANDATORY - State Management)\n\n**Before decomposing, read any prior context:**\n\n```bash\n# Initialize state if needed\nif [[ -d \".octo\" ]]; then\n  echo \"Found existing .octo\u002F state directory\"\nelse\n  echo \"No prior .octo\u002F state found - starting fresh\"\nfi\n\n# Check for prior discover\u002Fspec context\nif [[ -f \".octo\u002FSTATE.md\" ]]; then\n  echo \"Prior state found:\"\n  cat .octo\u002FSTATE.md\nfi\n\nif [[ -f \".octo\u002FPROJECT.md\" ]]; then\n  echo \"Prior project context found:\"\n  cat .octo\u002FPROJECT.md\nfi\n```\n\nUse any prior context (discover findings, spec definitions, project state) to inform the WBS decomposition.\n\n**DO NOT PROCEED TO STEP 4 until state read.**\n\n\n### STEP 4: Decompose into WBS (MANDATORY)\n\nClaude analyzes the compound task and produces a Work Breakdown Structure.\n\n**Decomposition rules:**\n- Break into 3-5 independent work packages (WP-1 through WP-N, max 10)\n- Each WP gets: name, scope description, expected output files, dependencies\n- Validate: non-overlapping scopes, collectively exhaustive\n- Each WP must be self-contained enough for an independent claude -p process\n\n**Create the coordination directory and WBS:**\n\n```bash\n# Create parallel coordination directory\nmkdir -p .octo\u002Fparallel\n\n# Write wbs.json\ncat > .octo\u002Fparallel\u002Fwbs.json \u003C\u003C 'WBSEOF'\n{\n  \"task\": \"\u003Ccompound task description>\",\n  \"created\": \"\u003CISO timestamp>\",\n  \"work_packages\": [\n    {\n      \"id\": \"WP-1\",\n      \"name\": \"\u003Cwork package name>\",\n      \"scope\": \"\u003Cwhat this WP covers>\",\n      \"expected_outputs\": [\"\u003Clist of files this WP should produce>\"],\n      \"dependencies\": [],\n      \"wave\": 1,\n      \"branch\": \"\u003Ca branch name unique to this work package>\",\n      \"status\": \"pending\"\n    }\n  ]\n}\nWBSEOF\n```\n\n**You MUST write actual WBS content** based on your analysis of the compound task. The JSON above is a template — populate it with real decomposition. Template or placeholder WBS produces vague instructions that agents interpret differently, causing duplicate work or missed scope.\n\n**Validation gate: `wbs_generated`** — Verify `.octo\u002Fparallel\u002Fwbs.json` exists and contains valid JSON:\n\n```bash\n# Validate WBS was created\nif [[ -f \".octo\u002Fparallel\u002Fwbs.json\" ]]; then\n  python3 -c \"import json; json.load(open('.octo\u002Fparallel\u002Fwbs.json')); print('WBS validation: PASSED')\" 2>\u002Fdev\u002Fnull || echo \"WBS validation: FAILED - invalid JSON\"\nelse\n  echo \"WBS validation: FAILED - file not found\"\nfi\n```\n\n**DO NOT PROCEED TO STEP 5 until WBS validated.**\n\n\n### STEP 4.5: Adversarial WBS Cross-Check (RECOMMENDED)\n\n**After generating the WBS but BEFORE dependency validation, cross-check the decomposition with a second model.** Single-model decomposition often produces work packages with hidden dependencies, ambiguous interface contracts, or scope gaps that cause merge conflicts and duplicated work.\n\n**If an external provider is available, dispatch the WBS for adversarial review through Octopus routing:**\n\n```bash\nWBS_CONTENT=$(\u003C\".octo\u002Fparallel\u002Fwbs.json\")\nreview_provider=\"\"\ncommand -v codex >\u002Fdev\u002Fnull 2>&1 && review_provider=\"codex\"\n[[ -z \"$review_provider\" ]] && command -v agy >\u002Fdev\u002Fnull 2>&1 && review_provider=\"agy\"\n\nif [[ -n \"$review_provider\" ]]; then\n  \"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Forchestrate.sh\" spawn \"$review_provider\" \\\n    \"Review this Work Breakdown Structure for a parallel execution pipeline. Your job is to find problems BEFORE agents start working.\n\n1. What DEPENDENCIES between work packages were missed? (e.g., WP-2 needs a type definition from WP-1 but doesn't declare it)\n2. What INTERFACE CONTRACTS are ambiguous? (e.g., two WPs will create conflicting exports, or expect different API signatures)\n3. Do any work packages OVERLAP in scope? (e.g., both WP-1 and WP-3 might modify the same file)\n4. Are there GAPS — things no work package covers?\n\nWBS:\n${WBS_CONTENT}\" 2>\u002Fdev\u002Fnull || true\nfi\n```\n\n**After receiving the challenge:**\n- If overlapping scopes found: adjust WP boundaries and file paths in the WBS\n- If missing dependencies found: add them to the `dependencies` array\n- If interface ambiguities found: add explicit Integration Contract sections to the affected WP instructions\n- If gaps found: either add a new WP or expand an existing one's scope\n\n**Skip with `--fast` or when user explicitly requests speed over thoroughness.**\n\n\n### STEP 4.6: Dependency Validation & Wave Assignment (MANDATORY)\n\nIf any work package has non-empty `dependencies`, validate the dependency graph and assign wave numbers.\n\n**Skip this step** if all work packages have `\"dependencies\": []` — they all get wave 1 (backward compatible).\n\n**Run dependency validation and wave assignment:**\n\n```bash\npython3 \u003C\u003C 'DEPEOF'\nimport json, sys\n\nwith open('.octo\u002Fparallel\u002Fwbs.json') as f:\n    wbs = json.load(f)\n\npackages = wbs['work_packages']\nids = {wp['id'] for wp in packages}\ndeps = {wp['id']: wp.get('dependencies', []) for wp in packages}\n\n# Check for missing references\nerrors = []\nfor wp_id, wp_deps in deps.items():\n    for dep in wp_deps:\n        if dep not in ids:\n            errors.append(f\"WP {wp_id} depends on unknown {dep}\")\n\nif errors:\n    print(\"DEPENDENCY VALIDATION: FAILED\")\n    for e in errors:\n        print(f\"  ERROR: {e}\")\n    sys.exit(1)\n\n# Cycle detection (DFS)\nWHITE, GRAY, BLACK = 0, 1, 2\ncolor = {wp_id: WHITE for wp_id in ids}\n\ndef has_cycle(node, path):\n    color[node] = GRAY\n    for dep in deps[node]:\n        if color[dep] == GRAY:\n            cycle = path[path.index(dep):] + [dep]\n            return cycle\n        if color[dep] == WHITE:\n            result = has_cycle(dep, path + [dep])\n            if result:\n                return result\n    color[node] = BLACK\n    return None\n\nfor wp_id in ids:\n    if color[wp_id] == WHITE:\n        cycle = has_cycle(wp_id, [wp_id])\n        if cycle:\n            print(f\"DEPENDENCY VALIDATION: FAILED - Cycle detected: {' -> '.join(cycle)}\")\n            sys.exit(1)\n\n# Topological sort and wave assignment\nwaves = {}\nassigned = set()\n\ndef get_wave(wp_id):\n    if wp_id in waves:\n        return waves[wp_id]\n    if not deps[wp_id]:\n        waves[wp_id] = 1\n        return 1\n    max_dep_wave = max(get_wave(d) for d in deps[wp_id])\n    waves[wp_id] = max_dep_wave + 1\n    return waves[wp_id]\n\nfor wp_id in ids:\n    get_wave(wp_id)\n\n# Update WBS with wave assignments\nfor wp in packages:\n    wp['wave'] = waves[wp['id']]\n\nwith open('.octo\u002Fparallel\u002Fwbs.json', 'w') as f:\n    json.dump(wbs, f, indent=2)\n\nmax_wave = max(waves.values())\nprint(f\"DEPENDENCY VALIDATION: PASSED\")\nprint(f\"Waves assigned: {max_wave}\")\nfor w in range(1, max_wave + 1):\n    wave_wps = [wp_id for wp_id, wave in waves.items() if wave == w]\n    print(f\"  Wave {w}: {', '.join(wave_wps)}\")\nDEPEOF\n```\n\n**If validation fails:** Report the error to the user and STOP. Do not proceed with invalid dependencies.\n\n**DO NOT PROCEED TO STEP 5 until dependencies validated (or step skipped for independent WPs).**\n\n\n### STEP 5: Generate Instruction Files (MANDATORY)\n\nFor each work package in the WBS, create an instructions file and a launch script.\n\n**For each WP-N, create:**\n\n#### `instructions.md`\n\n```bash\nmkdir -p \".octo\u002Fparallel\u002FWP-N\"\n\ncat > \".octo\u002Fparallel\u002FWP-N\u002Finstructions.md\" \u003C\u003C 'INSTREOF'\n# Work Package WP-N: \u003Cname>\n\n## Task\n\u003CClear description of what this work package must accomplish>\n\n## Scope Boundaries\n- IN SCOPE: \u003Cwhat this WP covers>\n- OUT OF SCOPE: \u003Cwhat other WPs handle — explicit boundaries>\n\n## Expected Output\n- Files to create\u002Fmodify: \u003Cexplicit file paths — MANDATORY>\n- Location: \u003Cwhere outputs go in the project>\n\n## Integration Contract\n- This WP produces: \u003Cwhat downstream consumers can expect>\n- This WP consumes: \u003Cwhat it needs from the project, NOT from other WPs>\n\n## Quality Requirements (MANDATORY)\n- Code must compile\u002Fparse without errors\n- Follow existing project conventions (naming, structure, patterns)\n- Run any existing tests related to your changes — do NOT skip tests\n- Run the project linter if one exists (eslint, ruff, golangci-lint, etc.)\n- No `type: ignore`, `@ts-ignore`, `any` casts, or suppression comments unless the existing code already uses them\n- No placeholder code — no `TODO`, `FIXME`, or stub implementations\n- Verify your changes work by running or testing them before completing\n- If you break existing tests, fix them — do not delete or skip them\n\n## Committing (MANDATORY if you changed any file)\n- Commit your work to this package's own branch before you finish. The worktree is removed once\n  your commit exists and the tree is clean. Uncommitted work is retained for recovery.\n- Stage explicit paths. Never `git add -A` or `git add .` — the coordination directory and other\n  packages' stray files must not enter your commit.\n\n## Dependency Context\n- This WP depends on: \u003Clist of dependency WP IDs, or \"none\">\n- Outputs from completed dependencies will be provided below when available\nINSTREOF\n```\n\n**CRITICAL:** Every instructions.md MUST contain explicit file paths — parallel agents interpret vague scope independently, so without explicit paths two WPs may modify the same file or leave gaps between them. Vague descriptions like \"create the auth module\" are PROHIBITED — specify exact paths like `src\u002Fauth\u002Foauth.ts`.\n\n#### `launch.sh`\n\n**v8.44.0: Each work package runs in its own git worktree** for full file isolation. This prevents write contention when multiple agents modify files simultaneously.\n\n```bash\ncat > \".octo\u002Fparallel\u002FWP-N\u002Flaunch.sh\" \u003C\u003C 'LAUNCHEOF'\n#!\u002Fbin\u002Fbash\nSCRIPT_DIR=\"$(cd \"$(dirname \"${0}\")\" && pwd)\"\nPROJECT_ROOT=\"\u003Cabsolute-project-root-path>\"\nWP_ID=\"WP-N\"\nWP_BRANCH=\"\u003Cwp-branch-name>\"\nBASE_REF=\"\u003Cbase-ref>\"\nREGISTRY=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fagent-registry.sh\"\n\n# Every exit path must leave exit-code and .done behind, or the orchestrator's\n# monitor loop waits for a marker that never arrives and only the wave timeout\n# ends the run.\nfail() {\n    echo \"${1}\" >&2\n    if [[ -x \"$REGISTRY\" ]]; then\n        \"$REGISTRY\" update \"$WP_ID\" --status failed --error \"${1}\" 2>\u002Fdev\u002Fnull || true\n    fi\n    echo \"${2:-1}\" > \"$SCRIPT_DIR\u002Fexit-code\"\n    touch \"$SCRIPT_DIR\u002F.done\"\n    exit \"${2:-1}\"\n}\n\n# A retry must not inherit the previous run's completion status.\nrm -f \"$SCRIPT_DIR\u002F.done\" \"$SCRIPT_DIR\u002Fexit-code\" || fail \"ERROR: cannot clear completion markers\"\n# Hook environments can otherwise redirect Git away from PROJECT_ROOT.\nwhile IFS= read -r git_var; do unset \"$git_var\"; done \u003C \u003C(git rev-parse --local-env-vars)\n\n# v8.44.0: Create isolated worktree for this work package.\n# Each package checks out its OWN branch. git refuses to check one branch out\n# in two worktrees, so reusing the session branch fails every package after the\n# first, and a shared branch would also pile unrelated packages onto one ref.\ncd \"$PROJECT_ROOT\" || fail \"ERROR: cannot enter $PROJECT_ROOT\"\nPROJECT_ROOT=\"$(pwd -P)\"\nWORKTREE_DIR=\"${PROJECT_ROOT}\u002F..\u002F.octo-worktree-${PROJECT_ROOT##*\u002F}-${WP_ID}\"\nCOMMON_DIR=\"$(git rev-parse --git-common-dir)\" || fail \"ERROR: not a Git repository\"\nCOMMON_DIR=\"$(cd \"$COMMON_DIR\" && pwd -P)\" || fail \"ERROR: cannot resolve repository identity\"\ngit worktree prune 2>\u002Fdev\u002Fnull || true\nif [[ -d \"$WORKTREE_DIR\" ]]; then\n    # Retry: reuse the existing worktree instead of discarding the work in it.\n    cd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nelse\n    git worktree add -b \"$WP_BRANCH\" \"$WORKTREE_DIR\" \"$BASE_REF\" \\\n        > \"$SCRIPT_DIR\u002Fworktree.log\" 2>&1 ||\n        git worktree add \"$WORKTREE_DIR\" \"$WP_BRANCH\" \\\n            >> \"$SCRIPT_DIR\u002Fworktree.log\" 2>&1 ||\n        fail \"ERROR: failed to create worktree at $WORKTREE_DIR (see worktree.log)\"\nfi\n\n# Reject stale directories from another project, branch, or non-worktree path.\ncd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nWORKTREE_DIR=\"$(pwd -P)\"\nWORKTREE_TOP=\"$(git rev-parse --show-toplevel)\" || fail \"ERROR: not a Git worktree\"\nWORKTREE_TOP=\"$(cd \"$WORKTREE_TOP\" && pwd -P)\" || fail \"ERROR: cannot resolve worktree root\"\nWORKTREE_COMMON_DIR=\"$(git rev-parse --git-common-dir)\" || fail \"ERROR: cannot identify worktree repository\"\nWORKTREE_COMMON_DIR=\"$(cd \"$WORKTREE_COMMON_DIR\" && pwd -P)\" || fail \"ERROR: cannot resolve worktree repository\"\nWORKTREE_BRANCH=\"$(git symbolic-ref --quiet --short HEAD)\" || fail \"ERROR: worktree has detached HEAD\"\n[[ \"$WORKTREE_TOP\" == \"$WORKTREE_DIR\" && \"$WORKTREE_COMMON_DIR\" == \"$COMMON_DIR\" && \\\n   \"$WORKTREE_BRANCH\" == \"$WP_BRANCH\" ]] || fail \"ERROR: worktree repository or branch does not match this package\"\n\n# Register agent in registry\nif [[ -x \"$REGISTRY\" ]]; then\n    \"$REGISTRY\" register \"$WP_ID\" \"$WP_BRANCH\" \"$WORKTREE_DIR\" 2>\u002Fdev\u002Fnull || true\nfi\n\ncd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nunset CLAUDECODE\n# v8.32.0: Credential isolation — work packages don't need provider keys\nunset OPENAI_API_KEY AGY_AUTH_TOKEN ANTIGRAVITY_API_KEY OPENROUTER_API_KEY PERPLEXITY_API_KEY\n# No `set -e` around this call: a non-zero claude -p must still record its exit\n# code and .done rather than abort the script before either is written.\nclaude -p \u003C \"$SCRIPT_DIR\u002Finstructions.md\" > \"$SCRIPT_DIR\u002Foutput.md\" 2>\"$SCRIPT_DIR\u002Fagent.log\"\nEXIT_CODE=$?\necho $EXIT_CODE > \"$SCRIPT_DIR\u002Fexit-code\"\n\n# Update agent registry with completion status\nif [[ -x \"$REGISTRY\" ]]; then\n    if [[ \"$EXIT_CODE\" -eq 0 ]]; then\n        \"$REGISTRY\" update \"$WP_ID\" --status done 2>\u002Fdev\u002Fnull || true\n    else\n        \"$REGISTRY\" update \"$WP_ID\" --status failed --error \"Exit code $EXIT_CODE\" 2>\u002Fdev\u002Fnull || true\n    fi\nfi\n\n# Discard the worktree only once its work is committed to the package's branch.\n# A force-remove over uncommitted edits destroys everything the package built;\n# the commits themselves survive removal, because they are already in the\n# shared object store on WP_BRANCH.\nUNCOMMITTED=\"$(git -C \"$WORKTREE_DIR\" status --porcelain 2>\u002Fdev\u002Fnull)\" ||\n    fail \"ERROR: cannot inspect worktree status; retained $WORKTREE_DIR\"\nCOMMITS=\"$(git -C \"$WORKTREE_DIR\" rev-list --count \"$BASE_REF..HEAD\" 2>\u002Fdev\u002Fnull)\" ||\n    fail \"ERROR: cannot inspect worktree commits; retained $WORKTREE_DIR\"\necho \"$COMMITS\" > \"$SCRIPT_DIR\u002Fcommit-count\"\ncd \"$PROJECT_ROOT\"\nif [[ -z \"$UNCOMMITTED\" && \"$COMMITS\" -gt 0 ]]; then\n    git worktree remove \"$WORKTREE_DIR\" 2>\u002Fdev\u002Fnull ||\n        fail \"ERROR: cannot remove worktree; retained $WORKTREE_DIR\"\nelif [[ -n \"$UNCOMMITTED\" ]]; then\n    echo \"KEPT $WORKTREE_DIR: uncommitted work present on $WP_BRANCH\" \\\n        >> \"$SCRIPT_DIR\u002Fagent.log\"\nelse\n    echo \"KEPT $WORKTREE_DIR: no commits beyond $BASE_REF on $WP_BRANCH\" \\\n        >> \"$SCRIPT_DIR\u002Fagent.log\"\nfi\ntouch \"$SCRIPT_DIR\u002F.done\"\nLAUNCHEOF\n\nchmod +x \".octo\u002Fparallel\u002FWP-N\u002Flaunch.sh\"\n```\n\n**You MUST replace all three placeholders:** `\u003Cabsolute-project-root-path>` with the actual project\nroot (use `pwd`), `\u003Cwp-branch-name>` with this package's own branch from the WBS, and `\u003Cbase-ref>`\nwith the ref every package branches from (normally `origin\u002F\u003Ctrunk>`, so the packages land as\nindependent branches rather than stacked on the session branch).\n\n**Worktree fallback:** if git worktree is unavailable (shallow clone, detached HEAD), the launch\nscript fails closed and records a non-zero exit code plus `.done`, so the wave reports the failure\ninstead of hanging. A worktree that still holds uncommitted work is kept, not removed, and the\nreason is appended to `agent.log`.\n\n**Validation gate: `instructions_written`** — Verify all instruction files exist:\n\n```bash\n# Count WPs from wbs.json\nwp_count=$(python3 -c \"import json; print(len(json.load(open('.octo\u002Fparallel\u002Fwbs.json'))['work_packages']))\")\n\n# Verify each WP has instructions.md and launch.sh\nmissing=0\nfor i in $(seq 1 \"$wp_count\"); do\n  if [[ ! -f \".octo\u002Fparallel\u002FWP-$i\u002Finstructions.md\" ]]; then\n    echo \"MISSING: .octo\u002Fparallel\u002FWP-$i\u002Finstructions.md\"\n    missing=$((missing + 1))\n  fi\n  if [[ ! -f \".octo\u002Fparallel\u002FWP-$i\u002Flaunch.sh\" ]]; then\n    echo \"MISSING: .octo\u002Fparallel\u002FWP-$i\u002Flaunch.sh\"\n    missing=$((missing + 1))\n  fi\ndone\n\nif [[ \"$missing\" -eq 0 ]]; then\n  echo \"Instruction files validation: PASSED ($wp_count work packages)\"\nelse\n  echo \"Instruction files validation: FAILED ($missing files missing)\"\nfi\n```\n\n**DO NOT PROCEED TO STEP 6 until all instruction files validated.**\n\n\n### STEP 6: Launch & Monitor — Wave-Based Execution (MANDATORY)\n\nLaunch work packages in dependency waves. Wave 1 runs first; Wave 2 starts only after Wave 1 completes (with outputs injected); and so on.\n\n**If all WPs are in Wave 1** (no dependencies), this behaves identically to the original launch — backward compatible.\n\n**Wave-based launch sequence:**\n\n```bash\nPROJECT_ROOT=\"$(pwd)\"\nWBS_FILE=\".octo\u002Fparallel\u002Fwbs.json\"\nMAX_WAVE=$(python3 -c \"import json; wbs=json.load(open('$WBS_FILE')); print(max(wp.get('wave',1) for wp in wbs['work_packages']))\")\nTIMEOUT=600  # 10 minutes per wave\n\necho \"Executing $MAX_WAVE wave(s)...\"\n\nfor WAVE in $(seq 1 \"$MAX_WAVE\"); do\n  echo \"\"\n  echo \"=== WAVE $WAVE ===\"\n  echo \"\"\n\n  # Get WPs for this wave\n  WAVE_WPS=$(python3 -c \"\nimport json\nwbs=json.load(open('$WBS_FILE'))\nwps=[wp['id'] for wp in wbs['work_packages'] if wp.get('wave',1)==$WAVE]\nprint(' '.join(wps))\n  \")\n\n  # Inject outputs from completed dependency WPs into instructions\n  for WP_ID in $WAVE_WPS; do\n    WP_NUM=\"${WP_ID#WP-}\"\n    WP_DIR=\".octo\u002Fparallel\u002F$WP_ID\"\n\n    # Get dependencies for this WP\n    DEPS=$(python3 -c \"\nimport json\nwbs=json.load(open('$WBS_FILE'))\nwp=[w for w in wbs['work_packages'] if w['id']=='$WP_ID'][0]\nprint(' '.join(wp.get('dependencies',[])))\n    \")\n\n    if [[ -n \"$DEPS\" ]]; then\n      echo \"Injecting dependency outputs into $WP_ID...\"\n      echo \"\" >> \"$WP_DIR\u002Finstructions.md\"\n      echo \"## Outputs from Dependencies\" >> \"$WP_DIR\u002Finstructions.md\"\n      for DEP in $DEPS; do\n        DEP_DIR=\".octo\u002Fparallel\u002F$DEP\"\n        if [[ -f \"$DEP_DIR\u002Foutput.md\" ]]; then\n          echo \"\" >> \"$WP_DIR\u002Finstructions.md\"\n          echo \"### From $DEP:\" >> \"$WP_DIR\u002Finstructions.md\"\n          head -c 4000 \"$DEP_DIR\u002Foutput.md\" >> \"$WP_DIR\u002Finstructions.md\"\n        fi\n      done\n    fi\n  done\n\n  # Launch WPs in this wave with 12s stagger\n  WAVE_COUNT=0\n  for WP_ID in $WAVE_WPS; do\n    WP_NUM=\"${WP_ID#WP-}\"\n    echo \"Launching $WP_ID at $(date '+%H:%M:%S')...\"\n    # Clear before background launch, so the monitor cannot see a stale result.\n    rm -f \".octo\u002Fparallel\u002F$WP_ID\u002F.done\" \".octo\u002Fparallel\u002F$WP_ID\u002Fexit-code\" || exit 1\n    bash \".octo\u002Fparallel\u002F$WP_ID\u002Flaunch.sh\" &\n    WP_PID=$!\n    echo \"$WP_PID\" > \".octo\u002Fparallel\u002F$WP_ID\u002Fpid\"\n    echo \"  $WP_ID launched (PID: $WP_PID)\"\n    WAVE_COUNT=$((WAVE_COUNT + 1))\n\n    # 12-second stagger within wave (skip after last)\n    REMAINING=$(echo \"$WAVE_WPS\" | wc -w | tr -d ' ')\n    if [[ \"$WAVE_COUNT\" -lt \"$REMAINING\" ]]; then\n      echo \"  Waiting 12 seconds before next launch...\"\n      sleep 12\n    fi\n  done\n\n  # Monitor this wave\n  START_TIME=$(date +%s)\n  COMPLETED=0\n  WAVE_TOTAL=$(echo \"$WAVE_WPS\" | wc -w | tr -d ' ')\n\n  echo \"Monitoring Wave $WAVE ($WAVE_TOTAL WPs, timeout: ${TIMEOUT}s)...\"\n\n  while [[ \"$COMPLETED\" -lt \"$WAVE_TOTAL\" ]]; do\n    COMPLETED=0\n    for WP_ID in $WAVE_WPS; do\n      if [[ -f \".octo\u002Fparallel\u002F$WP_ID\u002F.done\" ]]; then\n        COMPLETED=$((COMPLETED + 1))\n      fi\n    done\n\n    ELAPSED=$(( $(date +%s) - START_TIME ))\n    echo \"Wave $WAVE progress: $COMPLETED\u002F$WAVE_TOTAL complete (${ELAPSED}s elapsed)\"\n\n    if [[ \"$ELAPSED\" -gt \"$TIMEOUT\" ]]; then\n      echo \"TIMEOUT: Wave $WAVE did not complete within ${TIMEOUT}s\"\n      break\n    fi\n\n    if [[ \"$COMPLETED\" -lt \"$WAVE_TOTAL\" ]]; then\n      # v8.45.0: Fire reaction engine between poll cycles\n      REACTIONS=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Freactions.sh\"\n      if [[ -x \"$REACTIONS\" ]]; then\n        \"$REACTIONS\" check-all 2>\u002Fdev\u002Fnull || true\n      fi\n      sleep 15\n    fi\n  done\n\n  echo \"Wave $WAVE complete: $COMPLETED\u002F$WAVE_TOTAL finished.\"\ndone\n\necho \"\"\necho \"All waves executed.\"\n```\n\n**Validation gate: `processes_launched`** — Verify PID files exist for all WPs.\n\n**IMPORTANT:** The launch and monitor commands above should be run via the native shell command tool. You may need to combine them or run the monitor as a separate polling step. The monitor loop will block until each wave completes or times out.\n\n**DO NOT PROCEED TO STEP 7 until all waves complete.**\n\n\n### STEP 7: Aggregate & Present (MANDATORY)\n\nAfter all work packages complete (or timeout), aggregate results.\n\n**Read all outputs and exit codes:**\n\n```bash\n# Restore the count in this shell, rather than relying on launch-time locals.\nWP_COUNT=$(python3 -I -c '\nimport json\nwith open(\".octo\u002Fparallel\u002Fwbs.json\", encoding=\"utf-8\") as stream:\n    packages = json.load(stream)[\"work_packages\"]\nif not isinstance(packages, list) or not packages:\n    raise SystemExit(\"Cannot summarize results: work_packages must be a nonempty list\")\nprint(len(packages))\n') || exit 1\necho \"=== WORK PACKAGE RESULTS ===\"\necho \"\"\n\nFAILED=0\nSUCCEEDED=0\n\nfor i in $(seq 1 \"$WP_COUNT\"); do\n  WP_DIR=\".octo\u002Fparallel\u002FWP-$i\"\n\n  if [[ -f \"$WP_DIR\u002Fexit-code\" ]]; then\n    EXIT_CODE=$(cat \"$WP_DIR\u002Fexit-code\")\n  else\n    EXIT_CODE=\"N\u002FA (not completed)\"\n  fi\n\n  if [[ \"$EXIT_CODE\" == \"0\" ]]; then\n    STATUS=\"SUCCESS\"\n    SUCCEEDED=$((SUCCEEDED + 1))\n  else\n    STATUS=\"FAILED (exit code: $EXIT_CODE)\"\n    FAILED=$((FAILED + 1))\n  fi\n\n  echo \"WP-$i: $STATUS\"\n\n  if [[ -f \"$WP_DIR\u002Foutput.md\" ]]; then\n    OUTPUT_SIZE=$(wc -c \u003C \"$WP_DIR\u002Foutput.md\" | tr -d ' ')\n    echo \"  Output: $OUTPUT_SIZE bytes\"\n  else\n    echo \"  Output: MISSING\"\n  fi\n\n  echo \"\"\ndone\n\necho \"=== SUMMARY ===\"\necho \"Total: $WP_COUNT | Succeeded: $SUCCEEDED | Failed: $FAILED\"\n```\n\n**Then read each output.md** using the Read tool and **review quality before declaring success:**\n\n1. Read all `output.md` files from completed WPs\n2. Flag any failed WPs (non-zero exit code) with their `agent.log` content\n3. **Quality spot-check each succeeded WP** — scan output for:\n   - Suppression markers (`@ts-ignore`, `type: ignore`, `noqa`, `eslint-disable`)\n   - Placeholder code (`TODO`, `FIXME`, `not implemented`, stub functions)\n   - Test skip markers (`skip`, `xit`, `xdescribe`, `pytest.mark.skip`)\n   - If any found: flag as **QUALITY WARNING** (do not auto-fail, but surface to user)\n4. List any files created or modified across all WPs\n5. Note any integration points that need manual attention (shared interfaces, overlapping files)\n\n**Present results in this format:**\n\n```\n=== TEAM OF TEAMS - RESULTS ===\n\nCompound Task: \u003Coriginal task>\nWork Packages: N total | N succeeded | N failed\n\nWP-1: \u003Cname> - [SUCCESS\u002FFAILED]\n  \u003Csummary of what was accomplished>\n\nWP-2: \u003Cname> - [SUCCESS\u002FFAILED]\n  \u003Csummary of what was accomplished>\n\n...\n\nIntegration Notes:\n- \u003Cany cross-WP concerns>\n- \u003Cfiles that may need reconciliation>\n\nFailed Work Packages (if any):\n- WP-X: \u003Cerror summary from agent.log>\n\nCoordination Files: .octo\u002Fparallel\u002F\n```\n\n**Validation gate: `all_work_packages_complete`** — All WPs have `.done` files and exit codes checked.\n\n**Agent registry summary** (v8.44.0):\n\n```bash\n# Show agent registry status for this parallel run\nREGISTRY=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fagent-registry.sh\"\nif [[ -x \"$REGISTRY\" ]]; then\n  echo \"\"\n  echo \"=== AGENT REGISTRY ===\"\n  \"$REGISTRY\" list\nfi\n```\n\n\n## Coordination Protocol Directory Structure\n\nCreated and managed by this skill:\n\n```\n.octo\u002Fparallel\u002F\n  wbs.json              # Work Breakdown Structure\n  WP-1\u002F\n    instructions.md     # Task instructions for this WP\n    launch.sh           # Launch script (runs claude -p)\n    output.md           # Agent output (created by claude -p)\n    agent.log           # Agent stderr log (created by launch.sh)\n    exit-code           # Process exit code (created by launch.sh)\n    pid                 # Process ID (created by orchestrator)\n    .done               # Completion marker (created by launch.sh)\n  WP-2\u002F\n    ...\n  WP-N\u002F\n    ...\n```\n\n\n## Prohibitions (MANDATORY - CANNOT VIOLATE)\n\n- CANNOT use host subagent tool subagents as substitute — Task subagents run in isolated sandboxes without plugin access, so they get no Octopus quality gates, personas, or provider orchestration\n- CANNOT skip WBS decomposition (Step 4) — without decomposition, agents receive the full compound task and produce overlapping, uncoordinated output\n- CANNOT launch without instruction files (Step 5 must precede Step 6)\n- CANNOT skip 12-second stagger between launches — simultaneous process spawning causes CPU\u002Fmemory contention that degrades all agents' performance\n- CANNOT declare success without checking exit codes\n- CANNOT proceed to next step without completing current step\n- CANNOT write vague instructions — explicit file paths are MANDATORY\n- CANNOT launch more than 10 work packages — beyond 10, resource contention and merge complexity outweigh parallelism gains\n- CANNOT skip the monitoring loop — without monitoring, failed or hung agents go undetected and the orchestrator reports false success\n- CANNOT launch a wave before its dependency wave completes — later waves consume outputs from earlier waves, so premature launch produces agents working with missing context\n- CANNOT skip dependency validation when dependencies exist\n\n\n## Error Handling\n\n**If a work package fails (non-zero exit code):**\n1. Read its `agent.log` for error details\n2. Present the error to the user\n3. Offer to retry the failed WP individually\n4. Do NOT re-run succeeded WPs\n\n**If monitoring times out:**\n1. Report which WPs completed and which did not\n2. Check if timed-out WPs are still running (check PID)\n3. Offer to wait longer or kill remaining processes\n\n**If `claude` command is not available:**\n1. Check with `command -v claude`\n2. Report to user and STOP — cannot proceed without claude CLI\n\n\n## Example Usage\n\n### Example: Authentication System\n\n```\nUser: \u002Focto:parallel build a full authentication system with OAuth, RBAC, and audit logging\n\nDecomposition:\n  WP-1: OAuth Integration\n    - OAuth provider setup (Google, GitHub)\n    - Token management and refresh\n    - Callback handlers\n    Files: src\u002Fauth\u002Foauth.ts, src\u002Fauth\u002Fproviders\u002F\n\n  WP-2: RBAC Implementation\n    - Role and permission models\n    - Authorization middleware\n    - Role assignment API\n    Files: src\u002Fauth\u002Frbac.ts, src\u002Fmiddleware\u002Fauthorize.ts\n\n  WP-3: Audit Logging\n    - Audit event model\n    - Logging middleware\n    - Audit query API\n    Files: src\u002Faudit\u002Flogger.ts, src\u002Faudit\u002Fevents.ts\n\nEach WP runs as independent claude -p with full Octopus plugin.\nResults aggregated after all complete.\n```\n\n### Example: Migration (batch-style)\n\n```\nUser: \u002Focto:batch migrate all components in src\u002Fcomponents\u002F from class components to functional React with hooks\n\nDecomposition:\n  WP-1: Form components (src\u002Fcomponents\u002Fforms\u002F)\n  WP-2: Layout components (src\u002Fcomponents\u002Flayout\u002F)\n  WP-3: Data display components (src\u002Fcomponents\u002Ftables\u002F, src\u002Fcomponents\u002Fcharts\u002F)\n  WP-4: Navigation components (src\u002Fcomponents\u002Fnav\u002F)\n\nEach WP migrates its directory, runs existing tests, fixes any failures.\nNo overlapping files — safe to merge all results.\n```\n\n### Example: Fix multiple issues in parallel\n\n```\nUser: \u002Focto:parallel fix issue #12, issue #15, and issue #22\n\nDecomposition (after reading each issue):\n  WP-1: Fix #12 — login redirect loop (src\u002Fauth\u002Flogin.ts)\n  WP-2: Fix #15 — pagination off-by-one (src\u002Fapi\u002Fpagination.ts)\n  WP-3: Fix #22 — dark mode toggle not persisting (src\u002Fhooks\u002FuseTheme.ts)\n\nNo file overlaps detected — all three run in Wave 1.\nEach WP runs related tests before marking complete.\n```\n\n### Example: Build independent tools in parallel\n\n```\nUser: \u002Focto:parallel build a confluence scraper in go, a markdown-to-obsidian converter, a qdrant vectorizer, and a CLI search tool\n\nDecomposition:\n  WP-1: Confluence scraper (cmd\u002Fscraper\u002F) — Wave 1\n  WP-2: Markdown-to-Obsidian converter (cmd\u002Fconverter\u002F) — Wave 2 (depends on WP-1 output format)\n  WP-3: Qdrant vectorizer (cmd\u002Fvectorizer\u002F) — Wave 2 (depends on WP-2 output format)\n  WP-4: CLI search tool (cmd\u002Fsearch\u002F) — Wave 2 (depends on WP-3 schema)\n\nWave 1 completes first, output format injected into Wave 2 instructions.\nEach WP builds, runs go test, and verifies the binary works.\n```\n","> **Host: Codex CLI** — This skill was designed for Claude Code and adapted for Codex.\n> Cross-reference commands use installed skill names in Codex rather than `\u002Focto:*` slash commands.\n> Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it.\n> For host tool equivalents, see `skills\u002Fblocks\u002Fcodex-host-adapter.md`.\n\n\n# STOP - SKILL ALREADY LOADED\n\n**DO NOT call Skill() again. DO NOT load any more skills. Execute directly.**\n\n\n## EXECUTION CONTRACT (MANDATORY - CANNOT SKIP)\n\nThis skill uses **ENFORCED execution mode**. You MUST follow this exact 7-step sequence.\n\n**Architectural Principle:** host subagent tool subagents do NOT load plugins. Independent `claude -p` processes DO. This skill spawns independent `claude -p` processes so each work package gets the full Octopus plugin, its own Double Diamond, agents, and quality gates.\n\n\n### STEP 1: Clarifying Questions (MANDATORY)\n\n**Ask via AskUserQuestion BEFORE any other action.**\n\nYou MUST gather these inputs from the user — without scope, count, and dependency answers, the decomposition will be generic and produce overlapping work packages that cause merge conflicts:\n\n```\nAskUserQuestion with these questions:\n\n1. **Compound task**: What compound task should be decomposed?\n   - Use inline args if provided (e.g., \u002Focto:parallel \"build auth system\")\n   - If no args: ask \"What compound task should I decompose into parallel work packages?\"\n\n2. **Work package count**: How many work packages?\n   - Options: \"3 (Recommended)\", \"4\", \"5\", \"Custom (up to 10)\"\n   - Default: 3-5 is optimal\n\n3. **Dependencies**: Are the work packages independent?\n   - \"Fully independent - no dependencies between packages (Recommended)\"\n   - \"Some dependencies - packages may need to share interfaces\"\n   - \"Sequential dependencies - packages must complete in order\"\n```\n\nIf user provided a description inline with the command (e.g., `\u002Focto:parallel build a full auth system with OAuth, RBAC, and audit logging`), use that as the task description but STILL ask remaining questions (count, dependencies).\n\nIf user says \"skip\" for any question, use defaults: 3 work packages, fully independent.\n\n**DO NOT PROCEED TO STEP 2 until questions answered.**\n\n\n### STEP 2: Display Visual Indicators (MANDATORY - BLOCKING)\n\n**MANDATORY: You MUST use the native shell command tool to run this provider check BEFORE displaying the banner. Do NOT skip it. Do NOT assume availability.**\n\n```bash\nbash \"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fhelpers\u002Fcheck-providers.sh\"\n```\n\n**Use the ACTUAL results below. PROHIBITED: Showing only \"🔵 Claude: Available ✓\" without listing all providers.**\n\n**Display this banner with real provider status BEFORE any decomposition:**\n\n```\n🐙 CLAUDE OCTOPUS ACTIVATED - Team of Teams Mode\nParallel Phase: Decomposing compound task into N independent work packages\n\nArchitecture:\n  Main (this session) - Orchestrator: decompose, launch, monitor, aggregate\n  WP-1..WP-N (claude -p) - Independent workers with full plugin capabilities\n\nEach worker:\n  - Runs as independent claude -p process in its own git worktree\n  - Loads full Octopus plugin\n  - Has own context, tools, and quality gates\n  - Produces output.md + exit-code\n  - Tracked in agent registry (~\u002F.claude-octopus\u002Fagents\u002Fregistry.json)\n\nEstimated Time: 5-15 minutes (depending on task complexity)\n```\n\n**DO NOT PROCEED TO STEP 3 until banner displayed.**\n\n\n### STEP 3: Read Prior State (MANDATORY - State Management)\n\n**Before decomposing, read any prior context:**\n\n```bash\n# Initialize state if needed\nif [[ -d \".octo\" ]]; then\n  echo \"Found existing .octo\u002F state directory\"\nelse\n  echo \"No prior .octo\u002F state found - starting fresh\"\nfi\n\n# Check for prior discover\u002Fspec context\nif [[ -f \".octo\u002FSTATE.md\" ]]; then\n  echo \"Prior state found:\"\n  cat .octo\u002FSTATE.md\nfi\n\nif [[ -f \".octo\u002FPROJECT.md\" ]]; then\n  echo \"Prior project context found:\"\n  cat .octo\u002FPROJECT.md\nfi\n```\n\nUse any prior context (discover findings, spec definitions, project state) to inform the WBS decomposition.\n\n**DO NOT PROCEED TO STEP 4 until state read.**\n\n\n### STEP 4: Decompose into WBS (MANDATORY)\n\nClaude analyzes the compound task and produces a Work Breakdown Structure.\n\n**Decomposition rules:**\n- Break into 3-5 independent work packages (WP-1 through WP-N, max 10)\n- Each WP gets: name, scope description, expected output files, dependencies\n- Validate: non-overlapping scopes, collectively exhaustive\n- Each WP must be self-contained enough for an independent claude -p process\n\n**Create the coordination directory and WBS:**\n\n```bash\n# Create parallel coordination directory\nmkdir -p .octo\u002Fparallel\n\n# Write wbs.json\ncat > .octo\u002Fparallel\u002Fwbs.json \u003C\u003C 'WBSEOF'\n{\n  \"task\": \"\u003Ccompound task description>\",\n  \"created\": \"\u003CISO timestamp>\",\n  \"work_packages\": [\n    {\n      \"id\": \"WP-1\",\n      \"name\": \"\u003Cwork package name>\",\n      \"scope\": \"\u003Cwhat this WP covers>\",\n      \"expected_outputs\": [\"\u003Clist of files this WP should produce>\"],\n      \"dependencies\": [],\n      \"wave\": 1,\n      \"branch\": \"\u003Ca branch name unique to this work package>\",\n      \"status\": \"pending\"\n    }\n  ]\n}\nWBSEOF\n```\n\n**You MUST write actual WBS content** based on your analysis of the compound task. The JSON above is a template — populate it with real decomposition. Template or placeholder WBS produces vague instructions that agents interpret differently, causing duplicate work or missed scope.\n\n**Validation gate: `wbs_generated`** — Verify `.octo\u002Fparallel\u002Fwbs.json` exists and contains valid JSON:\n\n```bash\n# Validate WBS was created\nif [[ -f \".octo\u002Fparallel\u002Fwbs.json\" ]]; then\n  python3 -c \"import json; json.load(open('.octo\u002Fparallel\u002Fwbs.json')); print('WBS validation: PASSED')\" 2>\u002Fdev\u002Fnull || echo \"WBS validation: FAILED - invalid JSON\"\nelse\n  echo \"WBS validation: FAILED - file not found\"\nfi\n```\n\n**DO NOT PROCEED TO STEP 5 until WBS validated.**\n\n\n### STEP 4.5: Adversarial WBS Cross-Check (RECOMMENDED)\n\n**After generating the WBS but BEFORE dependency validation, cross-check the decomposition with a second model.** Single-model decomposition often produces work packages with hidden dependencies, ambiguous interface contracts, or scope gaps that cause merge conflicts and duplicated work.\n\n**If an external provider is available, dispatch the WBS for adversarial review through Octopus routing:**\n\n```bash\nWBS_CONTENT=$(\u003C\".octo\u002Fparallel\u002Fwbs.json\")\nreview_provider=\"\"\ncommand -v codex >\u002Fdev\u002Fnull 2>&1 && review_provider=\"codex\"\n[[ -z \"$review_provider\" ]] && command -v agy >\u002Fdev\u002Fnull 2>&1 && review_provider=\"agy\"\n\nif [[ -n \"$review_provider\" ]]; then\n  \"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Forchestrate.sh\" spawn \"$review_provider\" \\\n    \"Review this Work Breakdown Structure for a parallel execution pipeline. Your job is to find problems BEFORE agents start working.\n\n1. What DEPENDENCIES between work packages were missed? (e.g., WP-2 needs a type definition from WP-1 but doesn't declare it)\n2. What INTERFACE CONTRACTS are ambiguous? (e.g., two WPs will create conflicting exports, or expect different API signatures)\n3. Do any work packages OVERLAP in scope? (e.g., both WP-1 and WP-3 might modify the same file)\n4. Are there GAPS — things no work package covers?\n\nWBS:\n${WBS_CONTENT}\" 2>\u002Fdev\u002Fnull || true\nfi\n```\n\n**After receiving the challenge:**\n- If overlapping scopes found: adjust WP boundaries and file paths in the WBS\n- If missing dependencies found: add them to the `dependencies` array\n- If interface ambiguities found: add explicit Integration Contract sections to the affected WP instructions\n- If gaps found: either add a new WP or expand an existing one's scope\n\n**Skip with `--fast` or when user explicitly requests speed over thoroughness.**\n\n\n### STEP 4.6: Dependency Validation & Wave Assignment (MANDATORY)\n\nIf any work package has non-empty `dependencies`, validate the dependency graph and assign wave numbers.\n\n**Skip this step** if all work packages have `\"dependencies\": []` — they all get wave 1 (backward compatible).\n\n**Run dependency validation and wave assignment:**\n\n```bash\npython3 \u003C\u003C 'DEPEOF'\nimport json, sys\n\nwith open('.octo\u002Fparallel\u002Fwbs.json') as f:\n    wbs = json.load(f)\n\npackages = wbs['work_packages']\nids = {wp['id'] for wp in packages}\ndeps = {wp['id']: wp.get('dependencies', []) for wp in packages}\n\n# Check for missing references\nerrors = []\nfor wp_id, wp_deps in deps.items():\n    for dep in wp_deps:\n        if dep not in ids:\n            errors.append(f\"WP {wp_id} depends on unknown {dep}\")\n\nif errors:\n    print(\"DEPENDENCY VALIDATION: FAILED\")\n    for e in errors:\n        print(f\"  ERROR: {e}\")\n    sys.exit(1)\n\n# Cycle detection (DFS)\nWHITE, GRAY, BLACK = 0, 1, 2\ncolor = {wp_id: WHITE for wp_id in ids}\n\ndef has_cycle(node, path):\n    color[node] = GRAY\n    for dep in deps[node]:\n        if color[dep] == GRAY:\n            cycle = path[path.index(dep):] + [dep]\n            return cycle\n        if color[dep] == WHITE:\n            result = has_cycle(dep, path + [dep])\n            if result:\n                return result\n    color[node] = BLACK\n    return None\n\nfor wp_id in ids:\n    if color[wp_id] == WHITE:\n        cycle = has_cycle(wp_id, [wp_id])\n        if cycle:\n            print(f\"DEPENDENCY VALIDATION: FAILED - Cycle detected: {' -> '.join(cycle)}\")\n            sys.exit(1)\n\n# Topological sort and wave assignment\nwaves = {}\nassigned = set()\n\ndef get_wave(wp_id):\n    if wp_id in waves:\n        return waves[wp_id]\n    if not deps[wp_id]:\n        waves[wp_id] = 1\n        return 1\n    max_dep_wave = max(get_wave(d) for d in deps[wp_id])\n    waves[wp_id] = max_dep_wave + 1\n    return waves[wp_id]\n\nfor wp_id in ids:\n    get_wave(wp_id)\n\n# Update WBS with wave assignments\nfor wp in packages:\n    wp['wave'] = waves[wp['id']]\n\nwith open('.octo\u002Fparallel\u002Fwbs.json', 'w') as f:\n    json.dump(wbs, f, indent=2)\n\nmax_wave = max(waves.values())\nprint(f\"DEPENDENCY VALIDATION: PASSED\")\nprint(f\"Waves assigned: {max_wave}\")\nfor w in range(1, max_wave + 1):\n    wave_wps = [wp_id for wp_id, wave in waves.items() if wave == w]\n    print(f\"  Wave {w}: {', '.join(wave_wps)}\")\nDEPEOF\n```\n\n**If validation fails:** Report the error to the user and STOP. Do not proceed with invalid dependencies.\n\n**DO NOT PROCEED TO STEP 5 until dependencies validated (or step skipped for independent WPs).**\n\n\n### STEP 5: Generate Instruction Files (MANDATORY)\n\nFor each work package in the WBS, create an instructions file and a launch script.\n\n**For each WP-N, create:**\n\n#### `instructions.md`\n\n```bash\nmkdir -p \".octo\u002Fparallel\u002FWP-N\"\n\ncat > \".octo\u002Fparallel\u002FWP-N\u002Finstructions.md\" \u003C\u003C 'INSTREOF'\n# Work Package WP-N: \u003Cname>\n\n## Task\n\u003CClear description of what this work package must accomplish>\n\n## Scope Boundaries\n- IN SCOPE: \u003Cwhat this WP covers>\n- OUT OF SCOPE: \u003Cwhat other WPs handle — explicit boundaries>\n\n## Expected Output\n- Files to create\u002Fmodify: \u003Cexplicit file paths — MANDATORY>\n- Location: \u003Cwhere outputs go in the project>\n\n## Integration Contract\n- This WP produces: \u003Cwhat downstream consumers can expect>\n- This WP consumes: \u003Cwhat it needs from the project, NOT from other WPs>\n\n## Quality Requirements (MANDATORY)\n- Code must compile\u002Fparse without errors\n- Follow existing project conventions (naming, structure, patterns)\n- Run any existing tests related to your changes — do NOT skip tests\n- Run the project linter if one exists (eslint, ruff, golangci-lint, etc.)\n- No `type: ignore`, `@ts-ignore`, `any` casts, or suppression comments unless the existing code already uses them\n- No placeholder code — no `TODO`, `FIXME`, or stub implementations\n- Verify your changes work by running or testing them before completing\n- If you break existing tests, fix them — do not delete or skip them\n\n## Committing (MANDATORY if you changed any file)\n- Commit your work to this package's own branch before you finish. The worktree is removed once\n  your commit exists and the tree is clean. Uncommitted work is retained for recovery.\n- Stage explicit paths. Never `git add -A` or `git add .` — the coordination directory and other\n  packages' stray files must not enter your commit.\n\n## Dependency Context\n- This WP depends on: \u003Clist of dependency WP IDs, or \"none\">\n- Outputs from completed dependencies will be provided below when available\nINSTREOF\n```\n\n**CRITICAL:** Every instructions.md MUST contain explicit file paths — parallel agents interpret vague scope independently, so without explicit paths two WPs may modify the same file or leave gaps between them. Vague descriptions like \"create the auth module\" are PROHIBITED — specify exact paths like `src\u002Fauth\u002Foauth.ts`.\n\n#### `launch.sh`\n\n**v8.44.0: Each work package runs in its own git worktree** for full file isolation. This prevents write contention when multiple agents modify files simultaneously.\n\n```bash\ncat > \".octo\u002Fparallel\u002FWP-N\u002Flaunch.sh\" \u003C\u003C 'LAUNCHEOF'\n#!\u002Fbin\u002Fbash\nSCRIPT_DIR=\"$(cd \"$(dirname \"${0}\")\" && pwd)\"\nPROJECT_ROOT=\"\u003Cabsolute-project-root-path>\"\nWP_ID=\"WP-N\"\nWP_BRANCH=\"\u003Cwp-branch-name>\"\nBASE_REF=\"\u003Cbase-ref>\"\nREGISTRY=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fagent-registry.sh\"\n\n# Every exit path must leave exit-code and .done behind, or the orchestrator's\n# monitor loop waits for a marker that never arrives and only the wave timeout\n# ends the run.\nfail() {\n    echo \"${1}\" >&2\n    if [[ -x \"$REGISTRY\" ]]; then\n        \"$REGISTRY\" update \"$WP_ID\" --status failed --error \"${1}\" 2>\u002Fdev\u002Fnull || true\n    fi\n    echo \"${2:-1}\" > \"$SCRIPT_DIR\u002Fexit-code\"\n    touch \"$SCRIPT_DIR\u002F.done\"\n    exit \"${2:-1}\"\n}\n\n# A retry must not inherit the previous run's completion status.\nrm -f \"$SCRIPT_DIR\u002F.done\" \"$SCRIPT_DIR\u002Fexit-code\" || fail \"ERROR: cannot clear completion markers\"\n# Hook environments can otherwise redirect Git away from PROJECT_ROOT.\nwhile IFS= read -r git_var; do unset \"$git_var\"; done \u003C \u003C(git rev-parse --local-env-vars)\n\n# v8.44.0: Create isolated worktree for this work package.\n# Each package checks out its OWN branch. git refuses to check one branch out\n# in two worktrees, so reusing the session branch fails every package after the\n# first, and a shared branch would also pile unrelated packages onto one ref.\ncd \"$PROJECT_ROOT\" || fail \"ERROR: cannot enter $PROJECT_ROOT\"\nPROJECT_ROOT=\"$(pwd -P)\"\nWORKTREE_DIR=\"${PROJECT_ROOT}\u002F..\u002F.octo-worktree-${PROJECT_ROOT##*\u002F}-${WP_ID}\"\nCOMMON_DIR=\"$(git rev-parse --git-common-dir)\" || fail \"ERROR: not a Git repository\"\nCOMMON_DIR=\"$(cd \"$COMMON_DIR\" && pwd -P)\" || fail \"ERROR: cannot resolve repository identity\"\ngit worktree prune 2>\u002Fdev\u002Fnull || true\nif [[ -d \"$WORKTREE_DIR\" ]]; then\n    # Retry: reuse the existing worktree instead of discarding the work in it.\n    cd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nelse\n    git worktree add -b \"$WP_BRANCH\" \"$WORKTREE_DIR\" \"$BASE_REF\" \\\n        > \"$SCRIPT_DIR\u002Fworktree.log\" 2>&1 ||\n        git worktree add \"$WORKTREE_DIR\" \"$WP_BRANCH\" \\\n            >> \"$SCRIPT_DIR\u002Fworktree.log\" 2>&1 ||\n        fail \"ERROR: failed to create worktree at $WORKTREE_DIR (see worktree.log)\"\nfi\n\n# Reject stale directories from another project, branch, or non-worktree path.\ncd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nWORKTREE_DIR=\"$(pwd -P)\"\nWORKTREE_TOP=\"$(git rev-parse --show-toplevel)\" || fail \"ERROR: not a Git worktree\"\nWORKTREE_TOP=\"$(cd \"$WORKTREE_TOP\" && pwd -P)\" || fail \"ERROR: cannot resolve worktree root\"\nWORKTREE_COMMON_DIR=\"$(git rev-parse --git-common-dir)\" || fail \"ERROR: cannot identify worktree repository\"\nWORKTREE_COMMON_DIR=\"$(cd \"$WORKTREE_COMMON_DIR\" && pwd -P)\" || fail \"ERROR: cannot resolve worktree repository\"\nWORKTREE_BRANCH=\"$(git symbolic-ref --quiet --short HEAD)\" || fail \"ERROR: worktree has detached HEAD\"\n[[ \"$WORKTREE_TOP\" == \"$WORKTREE_DIR\" && \"$WORKTREE_COMMON_DIR\" == \"$COMMON_DIR\" && \\\n   \"$WORKTREE_BRANCH\" == \"$WP_BRANCH\" ]] || fail \"ERROR: worktree repository or branch does not match this package\"\n\n# Register agent in registry\nif [[ -x \"$REGISTRY\" ]]; then\n    \"$REGISTRY\" register \"$WP_ID\" \"$WP_BRANCH\" \"$WORKTREE_DIR\" 2>\u002Fdev\u002Fnull || true\nfi\n\ncd \"$WORKTREE_DIR\" || fail \"ERROR: cannot enter $WORKTREE_DIR\"\nunset CLAUDECODE\n# v8.32.0: Credential isolation — work packages don't need provider keys\nunset OPENAI_API_KEY AGY_AUTH_TOKEN ANTIGRAVITY_API_KEY OPENROUTER_API_KEY PERPLEXITY_API_KEY\n# No `set -e` around this call: a non-zero claude -p must still record its exit\n# code and .done rather than abort the script before either is written.\nclaude -p \u003C \"$SCRIPT_DIR\u002Finstructions.md\" > \"$SCRIPT_DIR\u002Foutput.md\" 2>\"$SCRIPT_DIR\u002Fagent.log\"\nEXIT_CODE=$?\necho $EXIT_CODE > \"$SCRIPT_DIR\u002Fexit-code\"\n\n# Update agent registry with completion status\nif [[ -x \"$REGISTRY\" ]]; then\n    if [[ \"$EXIT_CODE\" -eq 0 ]]; then\n        \"$REGISTRY\" update \"$WP_ID\" --status done 2>\u002Fdev\u002Fnull || true\n    else\n        \"$REGISTRY\" update \"$WP_ID\" --status failed --error \"Exit code $EXIT_CODE\" 2>\u002Fdev\u002Fnull || true\n    fi\nfi\n\n# Discard the worktree only once its work is committed to the package's branch.\n# A force-remove over uncommitted edits destroys everything the package built;\n# the commits themselves survive removal, because they are already in the\n# shared object store on WP_BRANCH.\nUNCOMMITTED=\"$(git -C \"$WORKTREE_DIR\" status --porcelain 2>\u002Fdev\u002Fnull)\" ||\n    fail \"ERROR: cannot inspect worktree status; retained $WORKTREE_DIR\"\nCOMMITS=\"$(git -C \"$WORKTREE_DIR\" rev-list --count \"$BASE_REF..HEAD\" 2>\u002Fdev\u002Fnull)\" ||\n    fail \"ERROR: cannot inspect worktree commits; retained $WORKTREE_DIR\"\necho \"$COMMITS\" > \"$SCRIPT_DIR\u002Fcommit-count\"\ncd \"$PROJECT_ROOT\"\nif [[ -z \"$UNCOMMITTED\" && \"$COMMITS\" -gt 0 ]]; then\n    git worktree remove \"$WORKTREE_DIR\" 2>\u002Fdev\u002Fnull ||\n        fail \"ERROR: cannot remove worktree; retained $WORKTREE_DIR\"\nelif [[ -n \"$UNCOMMITTED\" ]]; then\n    echo \"KEPT $WORKTREE_DIR: uncommitted work present on $WP_BRANCH\" \\\n        >> \"$SCRIPT_DIR\u002Fagent.log\"\nelse\n    echo \"KEPT $WORKTREE_DIR: no commits beyond $BASE_REF on $WP_BRANCH\" \\\n        >> \"$SCRIPT_DIR\u002Fagent.log\"\nfi\ntouch \"$SCRIPT_DIR\u002F.done\"\nLAUNCHEOF\n\nchmod +x \".octo\u002Fparallel\u002FWP-N\u002Flaunch.sh\"\n```\n\n**You MUST replace all three placeholders:** `\u003Cabsolute-project-root-path>` with the actual project\nroot (use `pwd`), `\u003Cwp-branch-name>` with this package's own branch from the WBS, and `\u003Cbase-ref>`\nwith the ref every package branches from (normally `origin\u002F\u003Ctrunk>`, so the packages land as\nindependent branches rather than stacked on the session branch).\n\n**Worktree fallback:** if git worktree is unavailable (shallow clone, detached HEAD), the launch\nscript fails closed and records a non-zero exit code plus `.done`, so the wave reports the failure\ninstead of hanging. A worktree that still holds uncommitted work is kept, not removed, and the\nreason is appended to `agent.log`.\n\n**Validation gate: `instructions_written`** — Verify all instruction files exist:\n\n```bash\n# Count WPs from wbs.json\nwp_count=$(python3 -c \"import json; print(len(json.load(open('.octo\u002Fparallel\u002Fwbs.json'))['work_packages']))\")\n\n# Verify each WP has instructions.md and launch.sh\nmissing=0\nfor i in $(seq 1 \"$wp_count\"); do\n  if [[ ! -f \".octo\u002Fparallel\u002FWP-$i\u002Finstructions.md\" ]]; then\n    echo \"MISSING: .octo\u002Fparallel\u002FWP-$i\u002Finstructions.md\"\n    missing=$((missing + 1))\n  fi\n  if [[ ! -f \".octo\u002Fparallel\u002FWP-$i\u002Flaunch.sh\" ]]; then\n    echo \"MISSING: .octo\u002Fparallel\u002FWP-$i\u002Flaunch.sh\"\n    missing=$((missing + 1))\n  fi\ndone\n\nif [[ \"$missing\" -eq 0 ]]; then\n  echo \"Instruction files validation: PASSED ($wp_count work packages)\"\nelse\n  echo \"Instruction files validation: FAILED ($missing files missing)\"\nfi\n```\n\n**DO NOT PROCEED TO STEP 6 until all instruction files validated.**\n\n\n### STEP 6: Launch & Monitor — Wave-Based Execution (MANDATORY)\n\nLaunch work packages in dependency waves. Wave 1 runs first; Wave 2 starts only after Wave 1 completes (with outputs injected); and so on.\n\n**If all WPs are in Wave 1** (no dependencies), this behaves identically to the original launch — backward compatible.\n\n**Wave-based launch sequence:**\n\n```bash\nPROJECT_ROOT=\"$(pwd)\"\nWBS_FILE=\".octo\u002Fparallel\u002Fwbs.json\"\nMAX_WAVE=$(python3 -c \"import json; wbs=json.load(open('$WBS_FILE')); print(max(wp.get('wave',1) for wp in wbs['work_packages']))\")\nTIMEOUT=600  # 10 minutes per wave\n\necho \"Executing $MAX_WAVE wave(s)...\"\n\nfor WAVE in $(seq 1 \"$MAX_WAVE\"); do\n  echo \"\"\n  echo \"=== WAVE $WAVE ===\"\n  echo \"\"\n\n  # Get WPs for this wave\n  WAVE_WPS=$(python3 -c \"\nimport json\nwbs=json.load(open('$WBS_FILE'))\nwps=[wp['id'] for wp in wbs['work_packages'] if wp.get('wave',1)==$WAVE]\nprint(' '.join(wps))\n  \")\n\n  # Inject outputs from completed dependency WPs into instructions\n  for WP_ID in $WAVE_WPS; do\n    WP_NUM=\"${WP_ID#WP-}\"\n    WP_DIR=\".octo\u002Fparallel\u002F$WP_ID\"\n\n    # Get dependencies for this WP\n    DEPS=$(python3 -c \"\nimport json\nwbs=json.load(open('$WBS_FILE'))\nwp=[w for w in wbs['work_packages'] if w['id']=='$WP_ID'][0]\nprint(' '.join(wp.get('dependencies',[])))\n    \")\n\n    if [[ -n \"$DEPS\" ]]; then\n      echo \"Injecting dependency outputs into $WP_ID...\"\n      echo \"\" >> \"$WP_DIR\u002Finstructions.md\"\n      echo \"## Outputs from Dependencies\" >> \"$WP_DIR\u002Finstructions.md\"\n      for DEP in $DEPS; do\n        DEP_DIR=\".octo\u002Fparallel\u002F$DEP\"\n        if [[ -f \"$DEP_DIR\u002Foutput.md\" ]]; then\n          echo \"\" >> \"$WP_DIR\u002Finstructions.md\"\n          echo \"### From $DEP:\" >> \"$WP_DIR\u002Finstructions.md\"\n          head -c 4000 \"$DEP_DIR\u002Foutput.md\" >> \"$WP_DIR\u002Finstructions.md\"\n        fi\n      done\n    fi\n  done\n\n  # Launch WPs in this wave with 12s stagger\n  WAVE_COUNT=0\n  for WP_ID in $WAVE_WPS; do\n    WP_NUM=\"${WP_ID#WP-}\"\n    echo \"Launching $WP_ID at $(date '+%H:%M:%S')...\"\n    # Clear before background launch, so the monitor cannot see a stale result.\n    rm -f \".octo\u002Fparallel\u002F$WP_ID\u002F.done\" \".octo\u002Fparallel\u002F$WP_ID\u002Fexit-code\" || exit 1\n    bash \".octo\u002Fparallel\u002F$WP_ID\u002Flaunch.sh\" &\n    WP_PID=$!\n    echo \"$WP_PID\" > \".octo\u002Fparallel\u002F$WP_ID\u002Fpid\"\n    echo \"  $WP_ID launched (PID: $WP_PID)\"\n    WAVE_COUNT=$((WAVE_COUNT + 1))\n\n    # 12-second stagger within wave (skip after last)\n    REMAINING=$(echo \"$WAVE_WPS\" | wc -w | tr -d ' ')\n    if [[ \"$WAVE_COUNT\" -lt \"$REMAINING\" ]]; then\n      echo \"  Waiting 12 seconds before next launch...\"\n      sleep 12\n    fi\n  done\n\n  # Monitor this wave\n  START_TIME=$(date +%s)\n  COMPLETED=0\n  WAVE_TOTAL=$(echo \"$WAVE_WPS\" | wc -w | tr -d ' ')\n\n  echo \"Monitoring Wave $WAVE ($WAVE_TOTAL WPs, timeout: ${TIMEOUT}s)...\"\n\n  while [[ \"$COMPLETED\" -lt \"$WAVE_TOTAL\" ]]; do\n    COMPLETED=0\n    for WP_ID in $WAVE_WPS; do\n      if [[ -f \".octo\u002Fparallel\u002F$WP_ID\u002F.done\" ]]; then\n        COMPLETED=$((COMPLETED + 1))\n      fi\n    done\n\n    ELAPSED=$(( $(date +%s) - START_TIME ))\n    echo \"Wave $WAVE progress: $COMPLETED\u002F$WAVE_TOTAL complete (${ELAPSED}s elapsed)\"\n\n    if [[ \"$ELAPSED\" -gt \"$TIMEOUT\" ]]; then\n      echo \"TIMEOUT: Wave $WAVE did not complete within ${TIMEOUT}s\"\n      break\n    fi\n\n    if [[ \"$COMPLETED\" -lt \"$WAVE_TOTAL\" ]]; then\n      # v8.45.0: Fire reaction engine between poll cycles\n      REACTIONS=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Freactions.sh\"\n      if [[ -x \"$REACTIONS\" ]]; then\n        \"$REACTIONS\" check-all 2>\u002Fdev\u002Fnull || true\n      fi\n      sleep 15\n    fi\n  done\n\n  echo \"Wave $WAVE complete: $COMPLETED\u002F$WAVE_TOTAL finished.\"\ndone\n\necho \"\"\necho \"All waves executed.\"\n```\n\n**Validation gate: `processes_launched`** — Verify PID files exist for all WPs.\n\n**IMPORTANT:** The launch and monitor commands above should be run via the native shell command tool. You may need to combine them or run the monitor as a separate polling step. The monitor loop will block until each wave completes or times out.\n\n**DO NOT PROCEED TO STEP 7 until all waves complete.**\n\n\n### STEP 7: Aggregate & Present (MANDATORY)\n\nAfter all work packages complete (or timeout), aggregate results.\n\n**Read all outputs and exit codes:**\n\n```bash\n# Restore the count in this shell, rather than relying on launch-time locals.\nWP_COUNT=$(python3 -I -c '\nimport json\nwith open(\".octo\u002Fparallel\u002Fwbs.json\", encoding=\"utf-8\") as stream:\n    packages = json.load(stream)[\"work_packages\"]\nif not isinstance(packages, list) or not packages:\n    raise SystemExit(\"Cannot summarize results: work_packages must be a nonempty list\")\nprint(len(packages))\n') || exit 1\necho \"=== WORK PACKAGE RESULTS ===\"\necho \"\"\n\nFAILED=0\nSUCCEEDED=0\n\nfor i in $(seq 1 \"$WP_COUNT\"); do\n  WP_DIR=\".octo\u002Fparallel\u002FWP-$i\"\n\n  if [[ -f \"$WP_DIR\u002Fexit-code\" ]]; then\n    EXIT_CODE=$(cat \"$WP_DIR\u002Fexit-code\")\n  else\n    EXIT_CODE=\"N\u002FA (not completed)\"\n  fi\n\n  if [[ \"$EXIT_CODE\" == \"0\" ]]; then\n    STATUS=\"SUCCESS\"\n    SUCCEEDED=$((SUCCEEDED + 1))\n  else\n    STATUS=\"FAILED (exit code: $EXIT_CODE)\"\n    FAILED=$((FAILED + 1))\n  fi\n\n  echo \"WP-$i: $STATUS\"\n\n  if [[ -f \"$WP_DIR\u002Foutput.md\" ]]; then\n    OUTPUT_SIZE=$(wc -c \u003C \"$WP_DIR\u002Foutput.md\" | tr -d ' ')\n    echo \"  Output: $OUTPUT_SIZE bytes\"\n  else\n    echo \"  Output: MISSING\"\n  fi\n\n  echo \"\"\ndone\n\necho \"=== SUMMARY ===\"\necho \"Total: $WP_COUNT | Succeeded: $SUCCEEDED | Failed: $FAILED\"\n```\n\n**Then read each output.md** using the Read tool and **review quality before declaring success:**\n\n1. Read all `output.md` files from completed WPs\n2. Flag any failed WPs (non-zero exit code) with their `agent.log` content\n3. **Quality spot-check each succeeded WP** — scan output for:\n   - Suppression markers (`@ts-ignore`, `type: ignore`, `noqa`, `eslint-disable`)\n   - Placeholder code (`TODO`, `FIXME`, `not implemented`, stub functions)\n   - Test skip markers (`skip`, `xit`, `xdescribe`, `pytest.mark.skip`)\n   - If any found: flag as **QUALITY WARNING** (do not auto-fail, but surface to user)\n4. List any files created or modified across all WPs\n5. Note any integration points that need manual attention (shared interfaces, overlapping files)\n\n**Present results in this format:**\n\n```\n=== TEAM OF TEAMS - RESULTS ===\n\nCompound Task: \u003Coriginal task>\nWork Packages: N total | N succeeded | N failed\n\nWP-1: \u003Cname> - [SUCCESS\u002FFAILED]\n  \u003Csummary of what was accomplished>\n\nWP-2: \u003Cname> - [SUCCESS\u002FFAILED]\n  \u003Csummary of what was accomplished>\n\n...\n\nIntegration Notes:\n- \u003Cany cross-WP concerns>\n- \u003Cfiles that may need reconciliation>\n\nFailed Work Packages (if any):\n- WP-X: \u003Cerror summary from agent.log>\n\nCoordination Files: .octo\u002Fparallel\u002F\n```\n\n**Validation gate: `all_work_packages_complete`** — All WPs have `.done` files and exit codes checked.\n\n**Agent registry summary** (v8.44.0):\n\n```bash\n# Show agent registry status for this parallel run\nREGISTRY=\"${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${HOME}\u002F.claude-octopus\u002Fplugin}}\u002Fscripts\u002Fagent-registry.sh\"\nif [[ -x \"$REGISTRY\" ]]; then\n  echo \"\"\n  echo \"=== AGENT REGISTRY ===\"\n  \"$REGISTRY\" list\nfi\n```\n\n\n## Coordination Protocol Directory Structure\n\nCreated and managed by this skill:\n\n```\n.octo\u002Fparallel\u002F\n  wbs.json              # Work Breakdown Structure\n  WP-1\u002F\n    instructions.md     # Task instructions for this WP\n    launch.sh           # Launch script (runs claude -p)\n    output.md           # Agent output (created by claude -p)\n    agent.log           # Agent stderr log (created by launch.sh)\n    exit-code           # Process exit code (created by launch.sh)\n    pid                 # Process ID (created by orchestrator)\n    .done               # Completion marker (created by launch.sh)\n  WP-2\u002F\n    ...\n  WP-N\u002F\n    ...\n```\n\n\n## Prohibitions (MANDATORY - CANNOT VIOLATE)\n\n- CANNOT use host subagent tool subagents as substitute — Task subagents run in isolated sandboxes without plugin access, so they get no Octopus quality gates, personas, or provider orchestration\n- CANNOT skip WBS decomposition (Step 4) — without decomposition, agents receive the full compound task and produce overlapping, uncoordinated output\n- CANNOT launch without instruction files (Step 5 must precede Step 6)\n- CANNOT skip 12-second stagger between launches — simultaneous process spawning causes CPU\u002Fmemory contention that degrades all agents' performance\n- CANNOT declare success without checking exit codes\n- CANNOT proceed to next step without completing current step\n- CANNOT write vague instructions — explicit file paths are MANDATORY\n- CANNOT launch more than 10 work packages — beyond 10, resource contention and merge complexity outweigh parallelism gains\n- CANNOT skip the monitoring loop — without monitoring, failed or hung agents go undetected and the orchestrator reports false success\n- CANNOT launch a wave before its dependency wave completes — later waves consume outputs from earlier waves, so premature launch produces agents working with missing context\n- CANNOT skip dependency validation when dependencies exist\n\n\n## Error Handling\n\n**If a work package fails (non-zero exit code):**\n1. Read its `agent.log` for error details\n2. Present the error to the user\n3. Offer to retry the failed WP individually\n4. Do NOT re-run succeeded WPs\n\n**If monitoring times out:**\n1. Report which WPs completed and which did not\n2. Check if timed-out WPs are still running (check PID)\n3. Offer to wait longer or kill remaining processes\n\n**If `claude` command is not available:**\n1. Check with `command -v claude`\n2. Report to user and STOP — cannot proceed without claude CLI\n\n\n## Example Usage\n\n### Example: Authentication System\n\n```\nUser: \u002Focto:parallel build a full authentication system with OAuth, RBAC, and audit logging\n\nDecomposition:\n  WP-1: OAuth Integration\n    - OAuth provider setup (Google, GitHub)\n    - Token management and refresh\n    - Callback handlers\n    Files: src\u002Fauth\u002Foauth.ts, src\u002Fauth\u002Fproviders\u002F\n\n  WP-2: RBAC Implementation\n    - Role and permission models\n    - Authorization middleware\n    - Role assignment API\n    Files: src\u002Fauth\u002Frbac.ts, src\u002Fmiddleware\u002Fauthorize.ts\n\n  WP-3: Audit Logging\n    - Audit event model\n    - Logging middleware\n    - Audit query API\n    Files: src\u002Faudit\u002Flogger.ts, src\u002Faudit\u002Fevents.ts\n\nEach WP runs as independent claude -p with full Octopus plugin.\nResults aggregated after all complete.\n```\n\n### Example: Migration (batch-style)\n\n```\nUser: \u002Focto:batch migrate all components in src\u002Fcomponents\u002F from class components to functional React with hooks\n\nDecomposition:\n  WP-1: Form components (src\u002Fcomponents\u002Fforms\u002F)\n  WP-2: Layout components (src\u002Fcomponents\u002Flayout\u002F)\n  WP-3: Data display components (src\u002Fcomponents\u002Ftables\u002F, src\u002Fcomponents\u002Fcharts\u002F)\n  WP-4: Navigation components (src\u002Fcomponents\u002Fnav\u002F)\n\nEach WP migrates its directory, runs existing tests, fixes any failures.\nNo overlapping files — safe to merge all results.\n```\n\n### Example: Fix multiple issues in parallel\n\n```\nUser: \u002Focto:parallel fix issue #12, issue #15, and issue #22\n\nDecomposition (after reading each issue):\n  WP-1: Fix #12 — login redirect loop (src\u002Fauth\u002Flogin.ts)\n  WP-2: Fix #15 — pagination off-by-one (src\u002Fapi\u002Fpagination.ts)\n  WP-3: Fix #22 — dark mode toggle not persisting (src\u002Fhooks\u002FuseTheme.ts)\n\nNo file overlaps detected — all three run in Wave 1.\nEach WP runs related tests before marking complete.\n```\n\n### Example: Build independent tools in parallel\n\n```\nUser: \u002Focto:parallel build a confluence scraper in go, a markdown-to-obsidian converter, a qdrant vectorizer, and a CLI search tool\n\nDecomposition:\n  WP-1: Confluence scraper (cmd\u002Fscraper\u002F) — Wave 1\n  WP-2: Markdown-to-Obsidian converter (cmd\u002Fconverter\u002F) — Wave 2 (depends on WP-1 output format)\n  WP-3: Qdrant vectorizer (cmd\u002Fvectorizer\u002F) — Wave 2 (depends on WP-2 output format)\n  WP-4: CLI search tool (cmd\u002Fsearch\u002F) — Wave 2 (depends on WP-3 schema)\n\nWave 1 completes first, output format injected into Wave 2 instructions.\nEach WP builds, runs go test, and verifies the binary works.\n```\n",{"name":5,"description":7,"disable-model-invocation":39},true,"main","70b6a3a3a7c774671e45af646306e1448baf0511","plugins\u002Fnyldn\u002Fclaude-octopus\u002Fskills\u002Fflow-parallel",491,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 14:06:13",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":39},[52,55,58],{"tool":53,"command":54},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill flow-parallel",{"tool":56,"command":57},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill flow-parallel",{"tool":59,"command":60},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill flow-parallel","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fnyldn\u002Fclaude-octopus\u002Fskills\u002Fflow-parallel\u002FSKILL.md",[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"agents\u002Fopenai.yaml","REFERENCE","参考文档",159,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fnyldn\u002Fclaude-octopus\u002Fskills\u002Fflow-parallel\u002Fagents\u002Fopenai.yaml",[70,80,88,96,104,112],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":75,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":79},"01M7DV332YQMGD8WTRJ9DZQXTB","worktable-review-with-annotations","Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.","MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":79},"01M7DV2YGHCZVBEB1AHYB6CGHE","worktable-find-and-synthesize-context","Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":79},"01M7DV2TQN1H11ME2SAF9MXN7V","worktable-create-or-update-docs","Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\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":74,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":79},"01M7DV2NE452NEA8TXATKSNAJH","worktable-create-or-manage-records","Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":108,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":79},"01M7DV2HENRBR2KSCVM064WH0Y","worktable-create-or-manage-interactive-html","Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":79},"01M7DV2CADR5R7RQFFYPNAGR9Y","worktable-collaborate-threads","Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FSKILL.md",[],[]]