Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.
中文简介正在准备中。当前显示原文说明。
Agent task delegation patterns — spawn protocols, handoff metadata, drain gate, parallel limits, and model selection for multi-agent orchestration
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Skill({ skill: 'task-delegation' });
Use when:
Every delegation sequence follows three phases:
1. SPAWN — Task({ task_id, subagent_type, prompt })
2. UPDATE — TaskUpdate({ taskId, status: 'in_progress', owner: 'router' }) [immediately after spawn]
3. DRAIN — TaskList() → verify zero in_progress/pending tasks before claiming done
Skipping any phase causes invisible work, stuck tasks, or duplicate execution.
Every Task() call MUST include a task_id parameter. Missing task_id is hard-blocked by spawn hooks.
Task({
task_id: 'task-7',
subagent_type: 'developer',
prompt: `
## Task ID: task-7
## Agent: developer
### Context
<brief description of what this agent needs to know>
### Objective
<single concrete deliverable>
### Instructions
1. Call TaskUpdate({ taskId: 'task-7', status: 'in_progress' }) IMMEDIATELY.
2. <step-by-step work instructions>
3. Call TaskUpdate({ taskId: 'task-7', status: 'completed', metadata: { summary: '...', filesModified: [...] } }).
### Constraints
- Scope: only files listed above
- Do NOT modify unrelated files
`,
});
After every Task(...) spawn, immediately call TaskUpdate for that task:
// Spawn the agent
Task({ task_id: 'task-7', subagent_type: 'developer', prompt: '...' });
// Immediately record as in_progress (router-owned until agent picks it up)
TaskUpdate({ taskId: 'task-7', status: 'in_progress', owner: 'router' });
This guarantees task visibility even before the spawned agent emits its first tool call.
NEVER spawn more than 2 heavy agents simultaneously.
Heavy agents: architect, security-architect, code-reviewer, qa, developer, devops
Light agents: researcher, general-assistant, technical-writer
// CORRECT: Max 2 heavy agents in parallel
Task({ task_id: 'task-3', subagent_type: 'developer', prompt: '...' });
Task({ task_id: 'task-4', subagent_type: 'qa', prompt: '...' });
// WRONG: 3+ heavy agents causes context overflow
Task({ task_id: 'task-3', subagent_type: 'developer', prompt: '...' });
Task({ task_id: 'task-4', subagent_type: 'qa', prompt: '...' });
Task({ task_id: 'task-5', subagent_type: 'architect', prompt: '...' }); // DO NOT
For 3+ parallel workstreams, use master-orchestrator to manage sequencing.
Use structured metadata on TaskUpdate(completed) to enable downstream agents to pick up context without re-reading files:
TaskUpdate({
taskId: 'task-5',
status: 'completed',
metadata: {
summary: 'Implemented JWT auth middleware with refresh tokens',
filesModified: ['src/middleware/auth.ts', 'src/lib/jwt.ts', 'tests/middleware/auth.test.ts'],
outputArtifacts: ['.claude/context/plans/auth-design.md'],
keyDecisions: [
'Used RS256 (asymmetric) over HS256 for key rotation support',
'Refresh tokens stored in Redis with 7-day TTL',
],
discoveredFiles: ['src/auth/legacy-session.ts'], // existing code to reuse/replace
worktreePath: process.env.AGENT_WORKTREE_PATH || process.cwd(),
completedAt: new Date().toISOString(),
},
});
Downstream agents read this via TaskGet({ taskId: 'task-5' }):
const task = TaskGet({ taskId: 'task-5' });
const { keyDecisions, filesModified, discoveredFiles } = task.metadata;
Before claiming "pipeline complete", execute all drain-gate checks in order:
// Step 1: Task drain
const tasks = TaskList();
const openTasks = tasks.filter(t => ['in_progress', 'pending', 'blocked'].includes(t.status));
if (openTasks.length > 0) {
// Report open task IDs, continue orchestration
console.log(
'Still open:',
openTasks.map(t => t.id)
);
}
// Step 2: Reflection queue check
// Read .claude/context/runtime/reflection-spawn-request.json
// If any entries exist with status: 'pending', spawn reflection-agent first
// Step 3: Only after steps 1 and 2 pass — write completion summary
Never claim completion with open tasks or unprocessed reflections.
| Task Type | Model | Rationale |
|---|---|---|
| Simple Q&A, research, summarization | haiku | Cost-effective, fast |
| Implementation, bug fixes, tests | sonnet | Balanced capability/cost (default) |
| Architecture, security review, planning | opus | Highest reasoning for complex tasks |
| Orchestrators (master, evolution) | opus | Must coordinate many subtasks |
| Context compression | haiku | Token-efficient, low complexity |
Task({
task_id: 'task-8',
subagent_type: 'security-architect',
model: 'claude-opus-4-5', // explicit override
prompt: '...',
});
Model precedence (highest to lowest):
model: in Task() callmodel: fieldconfig.yaml agents.{type}.modelFor tasks that must run in order, use addBlockedBy:
TaskCreate({ subject: 'Design auth', taskId: 'task-1' });
TaskCreate({ subject: 'Implement auth', taskId: 'task-2' });
TaskCreate({ subject: 'Test auth', taskId: 'task-3' });
TaskUpdate({ taskId: 'task-2', addBlockedBy: ['task-1'] });
TaskUpdate({ taskId: 'task-3', addBlockedBy: ['task-2'] });
Poll with TaskList() to detect when blocked tasks become unblocked, then spawn the next agent.
Before spawning developer, check if a specialist matches. Developer is the LAST RESORT.
| Request Type | Correct Agent |
|---|---|
| Update documentation | technical-writer |
| Refactor/clean up code | code-simplifier |
| Review code | code-reviewer |
| Run tests / QA | qa |
| Deploy / CI / Docker | devops |
| Database design | database-architect |
| Research / investigate | researcher |
| Security-sensitive work | security-architect |
| Debug production | devops-troubleshooter |
task_id — spawn hooks hard-block missing IDsTaskList() drain — open tasks = invisible workdevopsrun_in_background: true — breaks atomic handshakeBefore calling TaskUpdate({ status: 'completed' }), output this block:
IMPLEMENTATION_RESULT:
summary: <one-line description>
filesModified:
- path/to/file1
- path/to/file2
testsRun: <command>
testResult: <PASS/FAIL + counts>
worktreePath: <AGENT_WORKTREE_PATH or cwd>
The pre-completion-validation.cjs hook reads this block to validate completion.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.
中文简介正在准备中。当前显示原文说明。
Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.
中文简介正在准备中。当前显示原文说明。
N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.
中文简介正在准备中。当前显示原文说明。
Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze
中文简介正在准备中。当前显示原文说明。
Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.
中文简介正在准备中。当前显示原文说明。
LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations
中文简介正在准备中。当前显示原文说明。