AI Agent Routing and Orchestration
Project
<Project-specific overview and generated-system scope.>
Instruction priority
- Follow higher-priority system, safety, user, and human-authored repository instructions.
- Preserve an Agent or Skill explicitly named by the user.
- 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:
- Match the task goal, affected modules, required output, and stable inputs to one primary Agent.
- Add a supporting Agent only when its distinct output is required.
- Load only selected Agent definitions and their referenced project Skills/workflows.
- 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
- Split work into bounded items and record their dependencies.
- Assign
inline, subagent-readonly, subagent-shared, or subagent-worktree; default to inline.
- Start only the minimum SubAgents whose inputs are stable, outputs are structured, and isolation or parallelism has clear value.
- Assign one writer per file/module per phase. Keep concurrent write scopes disjoint.
- Keep exploration, QA, security, and review read-only by default.
- 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.