编辑 | blame | 历史 | 原始文档

AI Agent Routing and Orchestration

Project

<Project-specific overview and generated-system scope.>

Instruction priority

  1. Follow higher-priority system, safety, user, and human-authored repository instructions.
  2. Preserve an Agent or Skill explicitly named by the user.
  3. Run automatic Agent matching only when the user names neither an Agent nor a Skill, unless automatic validation, replacement, or supplementation was explicitly requested.

Skill boundary

  • Repository Skills under .agents/skills are project-local and may be used when requested or referenced by the selected project Agent or workflow.
  • Skills outside this repository are global. Use one only when the user explicitly names or authorizes it.
  • Agent definitions and workflows cannot grant permission to activate a global Skill.
  • Prefer the project-local Skill when a local and global Skill share a name, unless the user clearly identifies the global one.

Agent routing

When automatic matching is allowed:

  1. Match the task goal, affected modules, required output, and stable inputs to one primary Agent.
  2. Add a supporting Agent only when its distinct output is required.
  3. Load only selected Agent definitions and their referenced project Skills/workflows.
  4. Fall back to <general-agent> when no specialized Agent matches.

Primary Agent: <primary-agent>

Task surface Agent Definition
<agent-name> .ai/agents/<agent-name>.md

Execution planning

  1. Split work into bounded items and record their dependencies.
  2. Assign inline, subagent-readonly, subagent-shared, or subagent-worktree; default to inline.
  3. Start only the minimum SubAgents whose inputs are stable, outputs are structured, and isolation or parallelism has clear value.
  4. Assign one writer per file/module per phase. Keep concurrent write scopes disjoint.
  5. Keep exploration, QA, security, and review read-only by default.
  6. Use sequential inline execution when SubAgents or worktrees are unavailable.

SubAgent handoff and return

Every handoff includes objective, acceptance criteria, source of truth, inputs, read/write scope, required project Skills, prohibited actions, verification, escalation conditions, and return format.

Every result includes status, summary, findings_or_changes, artifacts, files_inspected, files_changed, assumptions, risks, verification, unresolved_items, and recommended_next_action.

Project Skills

Procedure Skill
.agents/skills/<skill-name>/SKILL.md

Workflows and orchestration

  • Workflow: .ai/workflows/<workflow-name>.md
  • Execution policy: .ai/orchestration/execution-policy.md
  • SubAgent contract: .ai/orchestration/subagent-contract.md
  • Context policy: .ai/orchestration/context-policy.md
  • Merge policy: .ai/orchestration/merge-policy.md

Integration and completion

The primary Agent or main orchestrator owns conflict decisions, integration, final verification, and completion claims. Report rejected recommendations, failed or unperformed checks, partial results, and remaining risks.