/onex:multi_agentfrom onex
Coordinates parallel debugging, parallel building, and sequential review workflows by dispatching independent tasks to concurrent sub-agents.
Ships in onex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Multi-agent coordination with three modes:
Announce at start: "I'm using the multi-agent skill in {mode} mode."
When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
Core principle: Dispatch one agent per independent problem domain. Let them work concurrently.
Use when:
Don't use when:
Group failures by what's broken:
Each domain is independent - fixing tool approval doesn't affect abort tests.
Each agent gets:
// In Claude Code / AI environment
Task("Fix agent-tool-abort.test.ts failures")
Task("Fix batch-completion-behavior.test.ts failures")
Task("Fix tool-approval-race-conditions.test.ts failures")
// All three run concurrently
When agents return:
When agents return outputs that overlap (modify the same fields), use geometric conflict classification to merge intelligently.
Within hook scripts, the plugin lib directory (plugins/onex/hooks/lib/) is already on sys.path, so the import is a bare module name:
from reconcile_agent_outputs import reconcile_outputs
If importing from tests or other code outside the plugin context, add the plugin lib to sys.path first:
import sys
from pathlib import Path
root = Path(__file__).resolve().parent
while not (root / "pyproject.toml").exists():
root = root.parent
sys.path.insert(0, str(root / "plugins" / "onex" / "hooks" / "lib"))
from reconcile_agent_outputs import reconcile_outputs
agent_outputs = {
"agent-1": agent_1_result,
"agent-2": agent_2_result,
"agent-3": agent_3_result,
}
base_values = original_state # state before agents ran
result = reconcile_outputs(base_values, agent_outputs)
If result.requires_approval is False: Apply result.merged_values directly. To reconstruct a nested structure:
from reconcile_agent_outputs import unflatten_paths
nested = unflatten_paths(result.merged_values)
If result.requires_approval is True: STOP. Use AskUserQuestion to present each approval-required field with the competing values from each agent. Do NOT attempt to resolve these yourself.
chosen_value=None for these.result.merged_values from the helper. Do not construct merge results manually.result.optional_review_fields) if time permits.Good agent prompts are:
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
1. "should abort tool with partial output capture" - expects 'interrupted at' in message
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
3. "should properly track pendingToolCount" - expects 3 results but gets 0
These are timing/race condition issues. Your task:
1. Read the test file and understand what each test verifies
2. Identify root cause - timing issues or actual bugs?
3. Fix by:
- Replacing arbitrary timeouts with event-based waiting
- Fixing bugs in abort implementation if found
- Adjusting test expectations if testing changed behavior
Do NOT just increase timeouts - find the real issue.
Return: Summary of what you found and what you fixed.
Smart context-aware task executor. Gathers requirements, plans sub-tasks, executes them in parallel via general-purpose agents, validates results, and reports.
This section governs execution. Follow it exactly.
You are an orchestrator. You coordinate general-purpose agents. You do NOT implement code yourself.
Rule: NEVER call Edit(), Write(), or Bash(code-modifying) directly. Rule: ALL Task() calls MUST use subagent_type="general-purpose". No exceptions. Rule: NO git operations in spawned agents. Git is coordinator-only, user-approved only.
Before execution, analyze scope:
Task(
subagent_type="general-purpose",
description="Requirements gathering: analyze task scope",
prompt="Analyze the task and produce a structured breakdown.
Task: {task_description}
Context: {conversation_context}
Produce:
1. Independent sub-tasks (can run in parallel)
2. Sequential dependencies (must run in order)
3. Files/modules involved per sub-task
4. Validation criteria per sub-task
5. Risk assessment
Return structured JSON:
{
\"parallel_tasks\": [{\"id\": \"t1\", \"description\": \"...\", \"files\": [...], \"validation\": \"...\"}],
\"sequential_tasks\": [{\"id\": \"t2\", \"depends_on\": [\"t1\"], \"description\": \"...\"}],
\"risks\": [\"...\"]
}"
)
For each independent task from requirements:
Task(
subagent_type="general-purpose",
description="{task_type}: {description}",
prompt="**Task**: {detailed_description}
**Context**: {context}
**Actions**: {numbered_list}
**Success Criteria**: {validation}
**DO NOT**: Run git commands."
)
Dispatch ALL independent tasks in a single message. Wait before dispatching dependents.
Task(
subagent_type="general-purpose",
description="Quality validation: verify changes",
prompt="Validate changes. Run linting, type checking, tests as applicable.
Files modified: {file_list}
Report: pass/fail per check, issues found."
)
Task(
subagent_type="general-purpose",
description="Refactor: fix quality issues (attempt {n}/3)",
prompt="Fix quality issues: {issues}. Do NOT commit."
)
Present results. Show:
git status --porcelain output (exact list of changed files)Ask the user: "Approve committing these changes and creating a PR with automerge enabled? (yes/no)"
If user says no: stop. All changes remain on disk. If user says yes: proceed to Phase 6.
Prerequisite: Must be on a named branch (not detached HEAD) inside the target git repo root.
# 0. Auth + detached HEAD guard
gh auth status || { echo "ERROR: not logged into GitHub CLI"; exit 1; }
HEAD_BRANCH=$(git branch --show-current)
test -n "$HEAD_BRANCH" || { echo "ERROR: detached HEAD — cannot create PR"; exit 1; }
# 1. Show and stage changes (user already approved in Phase 5)
git status --porcelain
git add -A
# 2. Commit
git commit -m "feat: <concise description from Phase 1 task summary>"
# 3. Resolve repo and push
REPO=$(git remote get-url origin | sed -E 's#^.*github\.com[:/]##; s#\.git$##')
git push -u origin "$HEAD_BRANCH"
# 4. Create PR — resolve number from the PR URL (deterministic anchor)
# PR Title Rule: The title MUST contain an OMN-XXXX ticket reference unless the
# PR is a dependency bump or release. The PR Title Check CI workflow blocks merge without it.
BODY_FILE=$(mktemp)
cat > "$BODY_FILE" <<'EOF'
## Summary
<bullet points from Phase 1 requirements>
## Test Plan
- CI must pass
- Changes validated by Phase 3 quality checks
EOF
# pr-create prints the write node's terminal event, not a URL: read the number back from the watcher's state
# (onex scm pr-list), which shows the PR after its next tick
onex scm pr-create "$REPO" --head "$HEAD_BRANCH" --base <base> \
--title "<conventional commit>: <description> [OMN-XXXX]" \
--body-file "$BODY_FILE"
PR_NUMBER=$(onex scm pr-list "$REPO" | python3 -c "import json,sys; b=sys.argv[1]; p=[x['number'] for x in json.loads(sys.stdin.read().strip().splitlines()[-1])['result']['prs'] if x['head_ref']==b]; print(p[0] if p else '')" "$HEAD_BRANCH")
test -n "$PR_NUMBER" || { echo "ERROR: the watcher does not list a PR for $HEAD_BRANCH yet; retry after its next tick"; exit 1; }
PR_URL="https://github.com/${REPO}/pull/${PR_NUMBER}"
# 5. Hand the PR to the landing controller (a session never arms or merges; the controller arms it)
echo "PR #$PR_NUMBER: $PR_URL"
echo "Handed to landing: the controller arms and merges when all branch protection requirements are satisfied."
Rule: Phase 6 is git-only coordinator work. Do NOT dispatch to general-purpose agents.
By Type:
By Priority:
Full orchestration logic (execution patterns, refactor tracking, examples, reporting phases)
is documented in prompt.md. The dispatch contracts above are sufficient to execute the skill.
Load prompt.md only if you need reference details for execution patterns, refactor tracking,
or edge case handling.
Execute plan by dispatching fresh subagent per task, with code review after each.
Core principle: Fresh subagent per task + review between tasks = high quality, fast iteration
When NOT to use:
Read plan file, create TodoWrite with all tasks.
For each task:
Dispatch fresh subagent:
Task tool (general-purpose):
description: "Implement Task N: [task name]"
prompt: |
You are implementing Task N from [plan-file].
Read that task carefully. Your job is to:
1. Implement exactly what the task specifies
2. Write tests (following TDD if task says to)
3. Verify implementation works
4. Commit your work
5. Report back
Work from: [directory]
Report: What you implemented, what you tested, test results, files changed, any issues
Subagent reports back with summary of work.
Dispatch code-reviewer subagent:
Task tool (code-reviewer):
Use template at ${CLAUDE_PLUGIN_ROOT}/skills/requesting-code-review/code-reviewer.md
WHAT_WAS_IMPLEMENTED: [from subagent's report]
PLAN_OR_REQUIREMENTS: Task N from [plan-file]
BASE_SHA: [commit before task]
HEAD_SHA: [current commit]
DESCRIPTION: [task summary]
Code reviewer returns: Strengths, Issues (Critical/Important/Minor), Assessment
If issues found:
Dispatch follow-up subagent if needed:
"Fix issues from code review: [list issues]"
After all tasks complete, dispatch final code-reviewer:
After final review passes:
Never:
If subagent fails task:
Skill development -- editing SKILL.md, prompt.md, skill helpers -- is a primary use case. Skill sessions are high-token and consistently exhaust the main context window when done inline.
Pattern:
Skill(skill="onex:multi_agent --mode sequential-with-review")
Then break the skill work into tasks:
Required workflow skills:
ticket-pipeline skill (structured ticket-based pipeline)ticket-work skill (single-ticket implementation)local-review skill (code review)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (omninode-ai/omniclaude) — no native marketplace selected
npx claudepluginhub p/omninode-ai-onex-plugins-onex128 skills in this plugin
/adversarial_pipelineAdversarial PipelineAutonomous 3-stage adversarial plan-to-ticket pipeline — design_to_plan → hostile_reviewer gate (≥3 issues required) → plan_to_tickets. All stages run as background agents. Zero foreground work./agent_healthcheck/onex:agent_healthcheck — dispatch-only shimDispatch-only shim for agent stall detection and recovery. All detection and recovery logic lives in node_worker_stall_recovery (omnimarket). The skill parses args, builds the input envelope, dispatches to the node, and renders the receipt./aislop_sweep/onex:aislop_sweep — one command, one typed resultDetect AI-generated quality anti-patterns across all repos — phantom callables in skill markdown, backwards compat shims, prohibited env var patterns, hardcoded topic strings, hardcoded absolute paths and LAN IPs, agent-left TODO/FIXME markers, and empty implementations./architectural_invariant_loopArchitectural Invariant LoopEvaluate architectural invariant contracts across repos — convert CLAUDE.md/doctrine principles into typed YAML invariant contracts and report violations across STATIC_ARCHITECTURE, CI_GATE, PRE_TOOL_USE, RUNTIME_VALIDATION, and CONTRACT_VALIDATION surfaces./authorizeGrant work authorization for Edit/Write operations in this session/auto_merge/onex:auto_merge — one command, one typed resultMerge a GitHub PR when all gates pass; proceeds automatically after CI is clean