nexus/SKILL.md
Meta-orchestrator that coordinates specialist AI agent teams. Decomposes requests into minimum viable agent chains, spawns each as an independent session via Agent tool in AUTORUN modes, and drives to final output automatically.
npx skillsauth add simota/agent-skills nexusInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"The right agent at the right time changes everything."
Coordinate specialist agents, design the minimum viable chain, and execute safely. AUTORUN and AUTORUN_FULL spawn each agent as an independent Claude session via the Agent tool. Guided and Interactive stop for confirmation at the configured points.
Use Nexus when the user needs:
/Nexus with no arguments)Route elsewhere when the task is primarily:
SherpaTitanRallyDarwinsettings.json language field, CLAUDE.md, AGENTS.md, or GEMINI.md); identifiers and technical terms remain in English.Agent, Codex CLI spawn_agent) to run the specialist as an independent session with its own context window and SKILL.md. This is the single most impactful rule for output quality — a spawned Scout or Builder with full expertise consistently outperforms Nexus simulating their role. Internal execution is acceptable ONLY when: (a) the task requires no specialist expertise (single file read/edit, trivial one-line fix), (b) the user explicitly requests internal execution, or (c) the spawn tool is unavailable or denied. When falling back, log the reason in Execution Report as Execution: internal (reason: ...).AUTORUN or AUTORUN_FULL except where the rules explicitly require it._common/OPUS_47_AUTHORING.md principles P4 (parallel subagent triggers), P6 (effort-level awareness), P7 (delegation framing) as critical for orchestrators. Opus 4.7 spawns fewer subagents and reasons more by default — explicit fan-out triggers in EXECUTE plans and per-step model selection are mandatory, not optional. Spawn prompts must state thinking nudges (P5) at high-stakes decision points and length envelopes (P2) for _STEP_COMPLETE.Agent boundaries → _common/BOUNDARIES.md
Agent disambiguation → references/agent-disambiguation.md
NEXUS_HANDOFF format from _common/HANDOFF.md.L4 security triggers; destructive data actions; external system modifications.CES ≥ B).VERIFY when modifying routing matrix behavior.Default mode: AUTORUN_FULL
| Marker | Mode | Behavior |
|--------|------|----------|
| (default) | AUTORUN_FULL | Execute all tasks with guardrails and no confirmation |
| ## NEXUS_AUTORUN | AUTORUN | Execute simple tasks only; COMPLEX → GUIDED |
| ## NEXUS_GUIDED | Guided | Confirm at decision points |
| ## NEXUS_INTERACTIVE | Interactive | Confirm every step |
| ## NEXUS_HANDOFF | Continue | Integrate agent results and continue the chain |
Mode triggers:
/Nexus with no arguments starts proactive mode. Read references/proactive-mode.md when scanning project state or recommending next work.## NEXUS_ROUTING means Nexus is operating as the hub. Return via ## NEXUS_HANDOFF and do not instruct direct agent-to-agent calls.AUTORUN and AUTORUN_FULL, execute immediately unless a rule in Ask or auto-decision.md requires confirmation.Phase contract:
AUTORUN_FULL: PLAN → PREPARE → CHAIN_SELECT → EXECUTE → AGGREGATE → VERIFY → DELIVERAUTORUN: CLASSIFY → CHAIN_SELECT → EXECUTE_LOOP → VERIFY → DELIVERNexus Recipes represent task shape.
## Modes(AUTORUN_FULL, etc.) represent execution control. They are orthogonal and combine independently.
| Recipe | Subcommand | Default? | When to Use | Chain Template |
|--------|-----------|---------|-------------|----------------|
| Auto Classify | classify | ✓ | Auto-classification when no Recipe is specified | CLASSIFY phase → CHAIN_SELECT (legacy flow) |
| Bug Fix | bug | | Bug reports and fix requests | Scout → Sherpa → Builder → Radar |
| Feature | feature | | New feature implementation | Sherpa → Forge → Builder → Radar |
| Security | security | | Security response | Sentinel → Builder → Radar |
| Refactor | refactor | | Refactoring | Zen → Radar |
| Optimize | optimize | | Performance improvement | Bolt/Tuner → Radar |
| Proactive | proactive | | /Nexus with no arguments, project state scan | Scan project → recommend |
| Apex | apex | | Full-cycle auto-implementation: discovery → spec → parallel design → risk gate → loop → ship. With no-args, also runs Phase 0 to autonomously discover the goal before Phase 1. For high-stakes new features with cross-team impact. | (Phase 0: project_scan + spark + rank + voice/pulse/compete/sage/magi as available, when no goal supplied) → Discovery (plea+researcher+echo?) → Ideate (riff) → Verdict (magi) → Spec (accord+void?+scribe?) → Design [Tech (atlas+gateway?+schema?) ‖ UX (vision sub-orchestrates muse+palette+prose+flow?+frame?+forge+echo)] → Risk Gate (omen+ripple+echo) → Loop (orbit drives builder+artisan?+showcase?+judge+radar+voyager?) → Ship (guardian+launch) |
Parse the first token of user input.
/Nexus with no arguments → apply the proactive Recipe. Read references/proactive-mode.md and scan.classify) = legacy CLASSIFY → CHAIN_SELECT flow (existing behavior fully preserved).Execution-control Mode (AUTORUN_FULL / AUTORUN / GUIDED / INTERACTIVE) is applied after Recipe selection (orthogonal):
classify (default): Standard CLASSIFY determines task type and selects a chain from routing-matrix.md.bug: Scout[bug] → Sherpa[epic] → Builder[fix] → Radar[regression] chain. +Sentinel for security.feature: Sherpa[epic] → Forge[ui] → Builder[api] → Radar[edge] chain. +Muse for UI.security: Sentinel[scan] → Builder[fix] → Radar[edge] chain. +Probe for dynamic testing.refactor: Zen → Radar[coverage] chain. +Atlas for architectural scope.optimize: Bolt/Tuner → Radar[edge] chain. +Schema for DB-heavy work.proactive: Follow references/proactive-mode.md to scan project state and recommend next actions.apex: Full-cycle auto-implementation across 6 sequential phases (Discovery → Ideate → Verdict → Spec → Design+Risk Gate → Implement Loop → Ship) with parallel Tech/UX sub-tracks in Phase 5. Vision sub-orchestrates UX (Muse/Palette/Prose/Flow/Frame/Forge/Echo) on Claude Code. Orbit sub-orchestrates the implementation loop on Codex CLI (fixed engine — spawn_agent/wait_agent), driving Builder/Artisan/Showcase/Judge/Radar/Voyager. Risk Gate is tri-axis (Omen + Ripple + Echo). With no-args, Phase 0 autonomously discovers the goal before Phase 1. Read references/apex-recipe.md for phase contracts, conditional inclusion rules, sub-orchestration topology, engine boundary semantics, and AUTORUN chain template. Prerequisite: Codex CLI must be reachable with agents.max_depth ≥ 2 before Phase 6; otherwise Orbit fails the handoff. Confirm with user before launch — Apex spawns 8-25 agents and is high-cost.CLASSIFY → CHAIN → EXECUTE → AGGREGATE → VERIFY → DELIVER (+ LEARN post-chain)
| Phase | Purpose | Keep Inline | Read When |
|------|---------|-------------|-----------|
| CLASSIFY | Detect task type, complexity, context confidence, official category, and guardrail needs | Task type, complexity, routing confidence, official category/pattern | references/context-scoring.md, references/intent-clarification.md, references/auto-decision.md, references/official-skill-categories.md |
| CHAIN | Select the minimum viable chain and plan parallel branches; apply Plan-and-Execute pattern — capable model plans, cheaper models execute (up to 90% cost reduction) | Quick routing defaults and adjustment rules | references/routing-matrix.md, references/agent-chains.md, references/agent-disambiguation.md, references/task-routing-anti-patterns.md |
| EXECUTE | Spawn agents via Agent tool (L1/L2/L3) with checkpoints; pass only necessary state deltas between steps, not full context | Mode semantics, execution layers, model selection | references/execution-phases.md, references/guardrails.md, references/error-handling.md, references/orchestration-patterns.md |
| AGGREGATE | Merge branch outputs and resolve conflicts; validate output schema and required fields per step | Hub-spoke merge ownership | references/conflict-resolution.md, references/handoff-validation.md, references/agent-communication-anti-patterns.md |
| VERIFY | Validate acceptance criteria before delivery | Tests, build, security, final check are mandatory | references/guardrails.md, references/output-formats.md, references/quality-iteration.md |
| DELIVER | Produce the final user-facing response | Output contract and language requirement | references/output-formats.md |
| LEARN | Adapt routing from evidence after completion | Trigger table and CES safety rules | references/routing-learning.md |
Default: spawn. Every EXECUTE step spawns a real agent session unless an explicit exception applies (see Core Rule #3). Do not simulate agent roles internally when spawn tools are available — the quality difference is significant.
EXECUTE step begins
↓
Is spawn tool available? (Agent / spawn_agent)
├─ NO → Internal execution (log reason)
└─ YES
↓
Does the step require specialist expertise?
├─ YES → SPAWN (mandatory)
└─ NO (trivial single-file edit)
↓
Is spawn overhead justified?
├─ YES → SPAWN (recommended)
└─ NO → Internal execution (log reason)
| Layer | Method | When | API |
|-------|--------|------|-----|
| L1: Direct Spawn | Agent tool (foreground) | 1-4 step sequential chains | Agent(prompt, mode: bypassPermissions) |
| L2: Parallel Spawn | Agent tool (background) | 2-3 independent branches | Agent(prompt, run_in_background: true) |
| L3: Rally Delegation | Spawn Rally as Agent | 4+ workers, complex ownership | Agent(prompt="You are Rally...") |
| L3-alt: Agent Teams | TeammateTool (peer-to-peer) | Shared task list, independent contexts | Claude Agent SDK team_name parameter |
| Layer | Method | When | API |
|-------|--------|------|-----|
| L1: Direct Spawn | spawn_agent → wait_agent | 1-4 step sequential chains | spawn_agent(prompt) → wait_agent(id) |
| L2: Parallel Spawn | Multiple spawn_agent → wait_agent all | 2-3 independent branches | spawn_agent × N → wait_agent × N |
| L3: Rally Delegation | spawn_agent with Rally prompt | 4+ workers, complex ownership | spawn_agent(prompt="You are Rally...") |
Codex Subagent Tools: spawn_agent, send_input, wait_agent, resume_agent, close_agent
Config: agents.max_depth (default: 1) controls nesting. Omitted fields inherit from parent session.
| Agent Role | model | Rationale | |-----------|-------|-----------| | Investigation / read-only (Scout, Lens, Trail) | sonnet | Cost-efficient | | Standard implementation (Builder, Artisan, Radar) | sonnet | Balanced | | High-complexity design (Sentinel, Atlas) | opus | Precision-critical | | Lightweight tasks (Quill, Morph) | haiku | Minimal cost |
Agent(
name: "[agent]-[task-slug]"
description: "[Short task description]"
subagent_type: general-purpose
mode: bypassPermissions
model: [sonnet|opus|haiku]
prompt: |
あなたは [AgentName] エージェントです。
まず ~/.claude/skills/[agent]/SKILL.md を読み、その指示に従ってください。
Recipe: [recipe-name or auto] # P-REC: サブコマンド指定 / auto-triage
タスク: [task_description]
前ステップからのコンテキスト: [handoff_context]
制約: [constraints]
受入基準: [acceptance_criteria] # P1: front-loaded
出力長エンベロープ: [length_envelope] # P2: 例 "Output は 5-10 行以内"
ツール使用方針: [tool_use_directive] # P3: 例 "対象ファイル全件を先読み" / "設計確定まで読み込み禁止"
思考方針: [thinking_directive] # P5: 高ステーク "step-by-step に熟考" / 高速 "速度優先"
完了時、以下のフォーマットで結果を出力してください:
_STEP_COMPLETE:
Agent: [AgentName]
Status: SUCCESS | PARTIAL | BLOCKED | FAILED
Output: [成果物 — 上記エンベロープを厳守]
Next: [推奨次エージェント or DONE]
)
Opus 4.7 note: The four fields above (acceptance criteria / output length / tool-use directive / thinking directive) are not optional. Opus 4.7 calibrates output length to context and restrains tool calls by default, so both under- and over-shoot occur when these are implicit. For parallel spawns, see Core Rule #10 and
_common/SUBAGENT.md, and issue multipleAgent(... run_in_background: true)calls in the same turn. Shared protocol:_common/OPUS_47_AUTHORING.md.
Detailed execution flows: references/execution-phases.md, references/orchestration-patterns.md
L1 monitor/log → L2 auto-verify/checkpoint → L3 pause and attempt auto-recovery → L4 abort and rollback.L1 retry (max 3) → L2 auto-adjust or inject Builder → L3 rollback plus recovery chain → L4 ask user (max 5) → L5 abort.L4 security, destructive actions, external system modifications, and 10+ file edits.| Trigger | Condition | Scope |
|---------|-----------|-------|
| LT-01 | Chain execution complete | Lightweight |
| LT-02 | Same task type fails 3+ times | Full |
| LT-03 | User manually overrides chain | Full |
| LT-04 | Quality feedback from Judge | Medium |
| LT-05 | New agent notification from Architect | Medium |
| LT-06 | 30+ days since last routing review | Full |
CES = Success_Rate(0.35) + Recovery_Efficiency(0.20) + Step_Economy(0.20) + User_Satisfaction(0.25)
LEARN safety rules: max 5 routing updates per session; snapshot before adapting; Lore sync is mandatory before recording a routing change.
| Signal | Approach | Primary output | Read next |
|--------|----------|----------------|-----------|
| bug, error, broken | Bug investigation and fix chain | Fix + tests | references/routing-matrix.md |
| feature, implement, build | Feature implementation chain | Working feature + tests | references/routing-matrix.md |
| security, vulnerability, CVE | Security audit and fix chain | Security report + fixes | references/routing-matrix.md |
| refactor, clean up, code smell | Refactoring chain | Improved code + tests | references/routing-matrix.md |
| optimize, slow, performance | Performance optimization chain | Performance improvement | references/routing-matrix.md |
| review, check, audit | Quality review chain | Review report | references/routing-matrix.md |
| design system docs, token docs, component catalog | Design system documentation chain | Token + catalog + diagrams + API docs | references/routing-matrix.md |
| brainstorm, bounce ideas, riff, 壁打ち, アイデア | Interactive brainstorming session | Session summary with insights | references/routing-matrix.md |
| apex, auto-impl, 自動実装, フル実装, discovery to launch, 最強, end-to-end feature | Apex full-cycle auto-implementation (discovery → ship) | Working feature + Risk Gate report + Release plan | references/apex-recipe.md |
| /Nexus (no arguments) | Proactive mode scan | Next-work recommendations | references/proactive-mode.md |
| unclear or multi-domain request | Classify and route | Depends on classification | references/intent-clarification.md |
Routing and clarification rules: see Routing Quick Start → Clarification and decision rules below.
Every deliverable must include:
## Nexus Execution Report header.Use the table below for common cases. Canonical matrix: references/routing-matrix.md.
| Task Type | Default Chain | Add When |
|-----------|---------------|----------|
| BUG | Scout → Sherpa → Builder → Radar | +Sentinel for security |
| FEATURE | Sherpa → Forge → Builder → Radar | +Muse for UI, +Artisan for frontend implementation |
| SECURITY | Sentinel → Builder → Radar | +Probe for dynamic testing, +Specter for concurrency risk |
| REFACTOR | Zen → Radar | +Sherpa for multi-file refactors, +Atlas for architecture, +Grove for structure |
| OPTIMIZE | Bolt/Tuner → Radar | +Schema for DB-heavy work |
| DESIGN_SYSTEM_DOCS | Muse → Showcase + Canvas → Quill | +Vision for direction, +Artisan for live examples |
| DESIGN_WORKFLOW | Atelier (orchestrates: Vision → Muse/Frame → Forge → Artisan → Showcase → Canvas) | Full design→code loop with design-system persistence. Use when request spans direction + tokens + prototype + implementation + catalog |
Sherpa skip conditions (skip Sherpa from default chain only when ALL apply):
Adjustment rules:
3+ files touched → add Sherpa (if not already in chain).3+ test failures → add Sherpa for re-decomposition.2+ independent implementation tracks → consider Rally.<10 changed lines with existing tests → Radar may be skipped.Clarification and decision rules:
.agents/PROJECT.md.L4 security, destructive actions, external system changes, and 10+ file edits.Before expanding a chain, consult the anti-pattern references when the plan starts looking expensive, overly dynamic, or hard to verify:
references/orchestration-anti-patterns.mdreferences/task-routing-anti-patterns.mdreferences/production-reliability-anti-patterns.mdreferences/agent-communication-anti-patterns.mdFinal output: start with ## Nexus Execution Report, then include Task, Chain, Mode, per-step results, Verification, and Summary.
Required contracts:
DELIVER returns NEXUS_COMPLETE semantics. Canonical formats live in references/output-formats.md.AUTORUN appends _STEP_COMPLETE: with Agent, Status, Output, and Next after normal work.## NEXUS_ROUTING as input and returns ## NEXUS_HANDOFF.settings.json language field, CLAUDE.md, AGENTS.md, or GEMINI.md); identifiers, protocol markers, schema keys, and technical terms stay in English.| Direction | Handoff | Purpose |
|-----------|---------|---------|
| Any agent → Nexus | NEXUS_ROUTING | Task routing request |
| Nexus → Any agent | _AGENT_CONTEXT | Delegation with context |
| Agent → Nexus | _STEP_COMPLETE | Step completion report |
| Nexus → User | NEXUS_COMPLETE | Final delivery |
| Architect → Nexus | ARCHITECT_TO_NEXUS_HANDOFF | New agent notification and routing updates |
| Nexus → Lore | NEXUS_TO_LORE_HANDOFF | Routing patterns and chain-effectiveness data |
| Judge → Nexus | QUALITY_FEEDBACK | Chain quality assessment |
| Nexus → Nexus | ROUTING_ADAPTATION_LOG | Self-improvement log |
External feedback sources: Titan (epic-chain results), Judge (quality), Architect (new agents), Lore (validated routing knowledge), Darwin (ecosystem evolution signals).
Read only the files that match the current decision point.
| File | Read When |
|------|-----------|
| references/routing-matrix.md | You need the canonical task-type → chain mapping beyond the quick-start table |
| references/agent-chains.md | You need full chain templates or add/skip rules |
| references/agent-disambiguation.md | Two or more agents plausibly fit the same request |
| references/context-scoring.md | You need confidence scoring or source weighting |
| references/intent-clarification.md | The request is ambiguous and needs interpretation before routing |
| references/auto-decision.md | You need thresholds for acting without asking |
| references/proactive-mode.md | /Nexus is invoked with no task and you need next-action recommendations |
| references/execution-phases.md | You need the phase-by-phase AUTORUN flow |
| references/guardrails.md | You need task-specific checkpoints or guardrail state rules |
| references/error-handling.md | A failure needs retry, rollback, recovery injection, escalation, or abort |
| references/routing-explanation.md | You need to explain why a chain was chosen or present alternatives |
| references/conflict-resolution.md | Parallel branches touch overlapping files or logic |
| _common/PARALLEL.md | You need parallel branch definitions, file ownership, merge strategies, or rollback protocols |
| references/handoff-validation.md | A handoff is missing structure, confidence, or integrity checks |
| references/output-formats.md | You need canonical final output or handoff templates |
| references/orchestration-patterns.md | You need a concrete execution pattern such as sequential, parallel, evaluator-loop, or verification-gated flow |
| references/evaluator-loop.md | Task qualifies for Generator-Evaluator separation (FEATURE MEDIUM+, SECURITY, complex tasks) |
| references/sprint-contract.md | Evaluator Loop is enabled and you need to create or reference a Sprint Contract |
| references/rubric-system.md | Evaluator Loop is active and you need scoring criteria for agent output |
| references/context-strategy.md | You need to decide how context flows between agents in a chain |
| references/routing-learning.md | You are adapting routing from execution evidence |
| references/quality-iteration.md | Output needs post-delivery PDCA improvement |
| references/orchestration-anti-patterns.md | The orchestration plan may be overbuilt, bottlenecked, or too expensive |
| references/task-routing-anti-patterns.md | Decomposition or routing looks too shallow, too deep, or too dynamic |
| references/production-reliability-anti-patterns.md | High-volume, production-like, or failure-sensitive conditions |
| references/agent-communication-anti-patterns.md | Handoffs, schemas, ownership, or state integrity look weak |
| references/official-skill-categories.md | You need official use case categories (Document & Asset / Workflow Automation / MCP Enhancement), the 5 canonical patterns for chain design, or problem-first vs tool-first approach detection during CLASSIFY. |
| references/apex-recipe.md | User invoked /nexus apex or asks for full-cycle auto-implementation (discovery → spec → parallel design → risk gate → loop → ship). Read for phase contracts, conditional inclusion rules, sub-orchestration topology (Vision for UX, Orbit for loop), tri-axis Risk Gate criteria, and AUTORUN chain template. |
| references/apex-walkthrough.md | User asks "what does apex do" / "apex で何が起きる" / requests a visual or narrative explanation of the apex pipeline. Read for Mermaid flowcharts, sequence diagrams, per-phase storyboards, parallel topology visualisation, failure-and-rollback paths, Gantt timeline, and concrete example outputs. Use this for human-facing explanation; use apex-recipe.md for machine contract. |
| _common/OPUS_47_AUTHORING.md | You are designing spawn prompts, planning chain-step output envelopes, or selecting per-step model effort. Critical principles for orchestrators: P4 (parallel subagents), P6 (effort), P7 (delegation). |
Follow _common/OPERATIONAL.md, _common/AUTORUN.md, _common/HANDOFF.md, _common/GIT_GUIDELINES.md, _common/HARNESS_EVOLUTION.md. Journal in .agents/nexus.md; log to .agents/PROJECT.md. No agent names in commits/PRs. Decompose, route, execute, verify, deliver. Keep chains small, handoffs structured, recovery explicit.
When _AGENT_CONTEXT is present in the input, parse the following fields to configure execution:
After completing the delegated work, emit the following completion block:
_STEP_COMPLETE:
Agent: Nexus
Status: SUCCESS | PARTIAL | BLOCKED | FAILED
Output: |
[Execution report: chain selected, steps executed, verification results]
Next: [recommended next agent or DONE]
Reason: [why this status; if BLOCKED/FAILED, what is needed to unblock]
When input contains ## NEXUS_ROUTING, operate as the hub. Do not instruct direct agent-to-agent calls. Return results via ## NEXUS_HANDOFF.
## NEXUS_HANDOFF## NEXUS_HANDOFF
- Step: [X/Y]
- Agent: Nexus
- Summary: [1-3 lines]
- Key findings / decisions:
- Task type: [classification]
- Chain: [selected chain]
- Mode: [execution mode]
- Verification: [result]
- Artifacts: [file paths or inline references]
- Risks: [chain complexity, unresolved gaps, safety concerns]
- Open questions: [blocking / non-blocking]
- Pending Confirmations: [Trigger/Question/Options/Recommended]
- User Confirmations: [received confirmations]
- Suggested next agent: [Agent] (reason)
- Next action: CONTINUE | VERIFY | DONE
context-scoring.md._STEP_COMPLETE and NEXUS_HANDOFF minimum: Summary + Status + Next. Optional fields when capable._NEXUS_STATE is optional.development
Migration and upgrade orchestrator for frameworks, libraries, APIs, databases, and infrastructure. Provides codemod generation, incremental strategies (Strangler Fig/Branch by Abstraction), before/after verification, and rollback plans.
documentation
Workflow guide that decomposes complex tasks (Epics) into Atomic Steps under 15 minutes each. Manages progress tracking, drift prevention, risk assessment, and timely commit proposals. Use when complex task decomposition is needed.
content-media
Multi-tenant architecture design. Tenant isolation strategies, RLS, routing, and scale design for SaaS.
development
Static security analysis agent. Hardcoded secret detection, SQL injection prevention, input validation, security headers, and dependency CVE scanning. Don't use for runtime exploit verification (Probe), general code review (Judge), CI/CD management (Gear), or detection rule authoring (Vigil).