@elyracode/subagents 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/extensions/agents.ts +147 -0
- package/extensions/index.ts +188 -0
- package/package.json +27 -0
- package/skills/elyra-subagents/SKILL.md +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @elyracode/subagents
|
|
2
|
+
|
|
3
|
+
Subagent delegation for Elyra -- scout, review, plan, implement, and get second opinions with focused child agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
elyra install npm:@elyracode/subagents
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Agents
|
|
12
|
+
|
|
13
|
+
| Agent | Use when you want... |
|
|
14
|
+
|-------|---------------------|
|
|
15
|
+
| `scout` | Fast codebase recon: files, structure, data flow, risks |
|
|
16
|
+
| `reviewer` | Code review: correctness, tests, edge cases, security, simplicity |
|
|
17
|
+
| `planner` | Implementation plan: concrete steps with file paths |
|
|
18
|
+
| `worker` | Implementation: edits files, validates, follows the plan |
|
|
19
|
+
| `oracle` | Second opinion: challenges assumptions, catches drift |
|
|
20
|
+
| `researcher` | External research: docs, specs, recent changes |
|
|
21
|
+
| `delegate` | General-purpose child agent for ad-hoc tasks |
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Natural language
|
|
26
|
+
```
|
|
27
|
+
Use reviewer to review this diff.
|
|
28
|
+
Ask oracle for a second opinion on my plan.
|
|
29
|
+
Use scout to understand the auth flow.
|
|
30
|
+
Run parallel reviewers: one for correctness, one for tests, one for complexity.
|
|
31
|
+
Have worker implement this plan, then run reviewer to check it.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Commands
|
|
35
|
+
```
|
|
36
|
+
/run scout analyze the authentication flow
|
|
37
|
+
/run reviewer review the changes in the last commit
|
|
38
|
+
/run oracle challenge my current approach
|
|
39
|
+
/parallel reviewer 'check correctness' -> reviewer 'check tests' -> reviewer 'check complexity'
|
|
40
|
+
/agents
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Recommended workflow
|
|
44
|
+
```
|
|
45
|
+
scout -> planner -> worker -> reviewer -> worker (fixes)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
1. You ask for delegation (naturally or via commands)
|
|
51
|
+
2. Elyra selects the right agent and gives it focused instructions
|
|
52
|
+
3. The agent executes the task with appropriate tool access
|
|
53
|
+
4. Read-only agents (scout, reviewer, planner, oracle) cannot edit files
|
|
54
|
+
5. Results are brought back for synthesis
|
|
55
|
+
|
|
56
|
+
Each agent is narrow and focused -- one task, one perspective. This produces better results than asking one agent to do everything.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtin agent definitions for elyra-subagents.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface AgentDefinition {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
systemPrompt: string;
|
|
9
|
+
tools?: string[];
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const BUILTIN_AGENTS: Record<string, AgentDefinition> = {
|
|
14
|
+
scout: {
|
|
15
|
+
name: "scout",
|
|
16
|
+
description: "Fast codebase reconnaissance: files, structure, entry points, data flow, risks",
|
|
17
|
+
systemPrompt: `You are a codebase scout. Your job is to quickly understand a codebase or specific area of code.
|
|
18
|
+
|
|
19
|
+
Tasks:
|
|
20
|
+
- Map the file structure and identify key modules
|
|
21
|
+
- Trace data flow and control flow for the requested feature
|
|
22
|
+
- Identify entry points, dependencies, and potential risks
|
|
23
|
+
- Report what you find concisely
|
|
24
|
+
|
|
25
|
+
Rules:
|
|
26
|
+
- Read files, don't edit them
|
|
27
|
+
- Be fast and focused -- don't analyze everything, focus on what's relevant
|
|
28
|
+
- Report findings in a structured format with file paths
|
|
29
|
+
- Flag anything unusual or risky`,
|
|
30
|
+
tools: ["read", "grep", "find", "ls", "bash"],
|
|
31
|
+
readOnly: true,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
reviewer: {
|
|
35
|
+
name: "reviewer",
|
|
36
|
+
description: "Code review: correctness, tests, edge cases, simplicity, security",
|
|
37
|
+
systemPrompt: `You are a code reviewer. Review the code changes or files for quality.
|
|
38
|
+
|
|
39
|
+
Check for:
|
|
40
|
+
- Correctness: does the code do what it claims?
|
|
41
|
+
- Tests: are there tests? Do they cover edge cases?
|
|
42
|
+
- Security: SQL injection, XSS, auth bypasses, data leaks
|
|
43
|
+
- Simplicity: is there unnecessary complexity?
|
|
44
|
+
- Performance: obvious N+1 queries, missing indexes, expensive loops
|
|
45
|
+
- Conventions: does it follow project patterns?
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
- Be specific: reference file paths and line numbers
|
|
49
|
+
- Categorize issues as: critical, warning, suggestion
|
|
50
|
+
- Suggest fixes, not just problems
|
|
51
|
+
- Keep it concise -- no praise, just findings`,
|
|
52
|
+
tools: ["read", "grep", "find", "ls", "bash"],
|
|
53
|
+
readOnly: true,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
planner: {
|
|
57
|
+
name: "planner",
|
|
58
|
+
description: "Implementation planning: concrete steps from existing context",
|
|
59
|
+
systemPrompt: `You are an implementation planner. Create a concrete, actionable plan for the requested change.
|
|
60
|
+
|
|
61
|
+
Deliverables:
|
|
62
|
+
- Step-by-step implementation plan with file paths
|
|
63
|
+
- Which files to create, modify, or delete
|
|
64
|
+
- Dependencies and order of operations
|
|
65
|
+
- Migration steps if database changes are needed
|
|
66
|
+
- Test strategy
|
|
67
|
+
|
|
68
|
+
Rules:
|
|
69
|
+
- Read code to understand current state before planning
|
|
70
|
+
- Be specific: include file paths, function names, class names
|
|
71
|
+
- Consider edge cases and error handling
|
|
72
|
+
- Do NOT edit files -- planning only
|
|
73
|
+
- Flag risks and decisions that need human input`,
|
|
74
|
+
tools: ["read", "grep", "find", "ls", "bash"],
|
|
75
|
+
readOnly: true,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
worker: {
|
|
79
|
+
name: "worker",
|
|
80
|
+
description: "Implementation: edits files, validates, follows the plan",
|
|
81
|
+
systemPrompt: `You are an implementation worker. Execute the plan or task by editing code.
|
|
82
|
+
|
|
83
|
+
Rules:
|
|
84
|
+
- Follow the plan exactly unless you find a problem
|
|
85
|
+
- Edit files carefully and validate changes
|
|
86
|
+
- Run tests or checks after making changes
|
|
87
|
+
- If something is unclear, report it instead of guessing
|
|
88
|
+
- Keep changes minimal and focused on the task
|
|
89
|
+
- Commit nothing -- leave that to the parent session`,
|
|
90
|
+
tools: ["read", "write", "edit", "bash", "grep", "find", "ls"],
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
oracle: {
|
|
94
|
+
name: "oracle",
|
|
95
|
+
description: "Second opinion: challenges assumptions, catches drift, recommends safest move",
|
|
96
|
+
systemPrompt: `You are an oracle -- a critical thinking partner. Your job is to challenge assumptions and find problems before they happen.
|
|
97
|
+
|
|
98
|
+
Tasks:
|
|
99
|
+
- Review the proposed plan or approach
|
|
100
|
+
- Challenge assumptions: what could go wrong?
|
|
101
|
+
- Identify risks, edge cases, and missed requirements
|
|
102
|
+
- Suggest the safest path forward
|
|
103
|
+
- If a decision is needed, lay out the options with tradeoffs
|
|
104
|
+
|
|
105
|
+
Rules:
|
|
106
|
+
- Do NOT edit files
|
|
107
|
+
- Be constructive but direct -- no sugarcoating
|
|
108
|
+
- Prioritize: what's the most dangerous assumption?
|
|
109
|
+
- End with a clear recommendation`,
|
|
110
|
+
tools: ["read", "grep", "find", "ls"],
|
|
111
|
+
readOnly: true,
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
researcher: {
|
|
115
|
+
name: "researcher",
|
|
116
|
+
description: "External research: docs, specs, recent changes, benchmarks",
|
|
117
|
+
systemPrompt: `You are a researcher. Find accurate, current information from documentation and the web.
|
|
118
|
+
|
|
119
|
+
Tasks:
|
|
120
|
+
- Search for official documentation on the topic
|
|
121
|
+
- Find recent changes, migration guides, or breaking changes
|
|
122
|
+
- Gather benchmarks or comparisons if relevant
|
|
123
|
+
- Compile a concise research brief with sources
|
|
124
|
+
|
|
125
|
+
Rules:
|
|
126
|
+
- Prefer official sources over blog posts
|
|
127
|
+
- Note the version/date of information
|
|
128
|
+
- If using read_url_content, fetch the actual docs
|
|
129
|
+
- Be concise: bullet points, not essays
|
|
130
|
+
- Cite your sources`,
|
|
131
|
+
tools: ["read", "grep", "find", "ls", "bash"],
|
|
132
|
+
readOnly: true,
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
delegate: {
|
|
136
|
+
name: "delegate",
|
|
137
|
+
description: "General-purpose child agent for ad-hoc tasks",
|
|
138
|
+
systemPrompt: `You are a delegate agent. Execute the task you've been given by the parent session.
|
|
139
|
+
|
|
140
|
+
Rules:
|
|
141
|
+
- Focus exclusively on the assigned task
|
|
142
|
+
- Report results clearly and concisely
|
|
143
|
+
- If the task is unclear, state what you understood and what's ambiguous
|
|
144
|
+
- Do not take on additional work beyond the task`,
|
|
145
|
+
tools: ["read", "write", "edit", "bash", "grep", "find", "ls"],
|
|
146
|
+
},
|
|
147
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@elyracode/coding-agent";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import { BUILTIN_AGENTS, type AgentDefinition } from "./agents.js";
|
|
4
|
+
|
|
5
|
+
export default function (elyra: ExtensionAPI): void {
|
|
6
|
+
|
|
7
|
+
// -- Tool: subagent --
|
|
8
|
+
elyra.registerTool({
|
|
9
|
+
name: "subagent",
|
|
10
|
+
label: "Delegate to Subagent",
|
|
11
|
+
description:
|
|
12
|
+
"Delegate a focused task to a specialized child agent. " +
|
|
13
|
+
"Available agents: scout (codebase recon), reviewer (code review), " +
|
|
14
|
+
"planner (implementation planning), worker (implementation), " +
|
|
15
|
+
"oracle (second opinion), researcher (docs/web research), delegate (general). " +
|
|
16
|
+
"Use this when a task benefits from focused analysis, parallel review, " +
|
|
17
|
+
"or a second opinion. Each subagent gets its own context and returns results.",
|
|
18
|
+
parameters: Type.Object({
|
|
19
|
+
agent: Type.String({
|
|
20
|
+
description: "Agent name: scout, reviewer, planner, worker, oracle, researcher, delegate",
|
|
21
|
+
}),
|
|
22
|
+
task: Type.String({
|
|
23
|
+
description: "The specific task to delegate (be clear and detailed)",
|
|
24
|
+
}),
|
|
25
|
+
context: Type.Optional(
|
|
26
|
+
Type.String({
|
|
27
|
+
description: "Additional context to provide to the subagent (e.g., file contents, previous analysis)",
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
}),
|
|
31
|
+
execute: async (_toolCallId, params) => {
|
|
32
|
+
const agentDef = BUILTIN_AGENTS[params.agent];
|
|
33
|
+
if (!agentDef) {
|
|
34
|
+
const available = Object.keys(BUILTIN_AGENTS).join(", ");
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: `Unknown agent: ${params.agent}. Available: ${available}` }],
|
|
37
|
+
details: {},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const subagentPrompt = formatSubagentPrompt(agentDef, params.task, params.context);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
content: [{
|
|
45
|
+
type: "text",
|
|
46
|
+
text: `## Subagent: ${agentDef.name}\n\n` +
|
|
47
|
+
`**Role**: ${agentDef.description}\n\n` +
|
|
48
|
+
`**Task**: ${params.task}\n\n` +
|
|
49
|
+
`**Instructions**: Execute this task following the subagent's role and rules:\n\n` +
|
|
50
|
+
`${subagentPrompt}\n\n` +
|
|
51
|
+
`**Allowed tools**: ${agentDef.tools?.join(", ") ?? "all"}\n` +
|
|
52
|
+
`**Read-only**: ${agentDef.readOnly ? "Yes -- do not edit files" : "No -- can edit files"}\n\n` +
|
|
53
|
+
`When done, provide a clear summary of findings/results under a "## ${agentDef.name} Report" heading.`,
|
|
54
|
+
}],
|
|
55
|
+
details: {
|
|
56
|
+
agent: agentDef.name,
|
|
57
|
+
readOnly: agentDef.readOnly ?? false,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// -- Tool: parallel_subagents --
|
|
64
|
+
elyra.registerTool({
|
|
65
|
+
name: "parallel_subagents",
|
|
66
|
+
label: "Run Parallel Subagents",
|
|
67
|
+
description:
|
|
68
|
+
"Run multiple subagents in parallel on different aspects of a task. " +
|
|
69
|
+
"Useful for parallel code review (correctness + tests + complexity), " +
|
|
70
|
+
"parallel research (docs + code), or any task that benefits from multiple focused perspectives. " +
|
|
71
|
+
"Returns combined results from all agents.",
|
|
72
|
+
parameters: Type.Object({
|
|
73
|
+
tasks: Type.Array(
|
|
74
|
+
Type.Object({
|
|
75
|
+
agent: Type.String({ description: "Agent name" }),
|
|
76
|
+
task: Type.String({ description: "Task for this agent" }),
|
|
77
|
+
}),
|
|
78
|
+
{ description: "Array of agent+task pairs to run in parallel" },
|
|
79
|
+
),
|
|
80
|
+
}),
|
|
81
|
+
execute: async (_toolCallId, params) => {
|
|
82
|
+
const results: string[] = [
|
|
83
|
+
`# Parallel Subagent Execution (${params.tasks.length} agents)`,
|
|
84
|
+
"",
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
for (const [index, taskDef] of params.tasks.entries()) {
|
|
88
|
+
const agentDef = BUILTIN_AGENTS[taskDef.agent];
|
|
89
|
+
if (!agentDef) {
|
|
90
|
+
results.push(`## Agent ${index + 1}: ${taskDef.agent} (unknown)`);
|
|
91
|
+
results.push(`Error: Unknown agent. Available: ${Object.keys(BUILTIN_AGENTS).join(", ")}`);
|
|
92
|
+
results.push("");
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const subagentPrompt = formatSubagentPrompt(agentDef, taskDef.task);
|
|
97
|
+
|
|
98
|
+
results.push(`## Agent ${index + 1}: ${agentDef.name}`);
|
|
99
|
+
results.push(`**Role**: ${agentDef.description}`);
|
|
100
|
+
results.push(`**Task**: ${taskDef.task}`);
|
|
101
|
+
results.push(`**Allowed tools**: ${agentDef.tools?.join(", ") ?? "all"}`);
|
|
102
|
+
results.push(`**Read-only**: ${agentDef.readOnly ? "Yes" : "No"}`);
|
|
103
|
+
results.push("");
|
|
104
|
+
results.push("**Instructions**:");
|
|
105
|
+
results.push(subagentPrompt);
|
|
106
|
+
results.push("");
|
|
107
|
+
results.push(`Provide results under a "### ${agentDef.name} Report (${index + 1})" heading.`);
|
|
108
|
+
results.push("");
|
|
109
|
+
results.push("---");
|
|
110
|
+
results.push("");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
results.push("Execute each agent's task. For read-only agents, do not edit files. Synthesize all findings at the end under a ## Summary heading.");
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
content: [{ type: "text", text: results.join("\n") }],
|
|
117
|
+
details: { agentCount: params.tasks.length },
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// -- Command: /run --
|
|
123
|
+
elyra.registerCommand("run", {
|
|
124
|
+
description: "Run a subagent: /run <agent> <task>",
|
|
125
|
+
handler: async (args, _ctx) => {
|
|
126
|
+
const parts = args.trim().split(/\s+/);
|
|
127
|
+
const agentName = parts[0];
|
|
128
|
+
const task = parts.slice(1).join(" ");
|
|
129
|
+
|
|
130
|
+
if (!agentName) {
|
|
131
|
+
const agentList = Object.entries(BUILTIN_AGENTS)
|
|
132
|
+
.map(([name, def]) => ` ${name}: ${def.description}`)
|
|
133
|
+
.join("\n");
|
|
134
|
+
elyra.sendUserMessage(`Available subagents:\n${agentList}\n\nUsage: /run <agent> <task>`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!task) {
|
|
139
|
+
elyra.sendUserMessage(`/run ${agentName}: please provide a task. Example: /run ${agentName} analyze the auth flow`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
elyra.sendUserMessage(`Delegate to ${agentName}: ${task}`);
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// -- Command: /parallel --
|
|
148
|
+
elyra.registerCommand("parallel", {
|
|
149
|
+
description: "Run agents in parallel: /parallel reviewer 'check correctness' -> reviewer 'check tests'",
|
|
150
|
+
handler: async (args, _ctx) => {
|
|
151
|
+
if (!args.trim()) {
|
|
152
|
+
elyra.sendUserMessage(
|
|
153
|
+
"Usage: /parallel agent1 'task1' -> agent2 'task2'\n\n" +
|
|
154
|
+
"Example: /parallel reviewer 'check correctness' -> reviewer 'check tests' -> reviewer 'check complexity'",
|
|
155
|
+
);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
elyra.sendUserMessage(`Run parallel subagents: ${args}`);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// -- Command: /agents --
|
|
164
|
+
elyra.registerCommand("agents", {
|
|
165
|
+
description: "List available subagents",
|
|
166
|
+
handler: async (_args, ctx) => {
|
|
167
|
+
const agentList = Object.entries(BUILTIN_AGENTS)
|
|
168
|
+
.map(([name, def]) => `- **${name}**: ${def.description}`)
|
|
169
|
+
.join("\n");
|
|
170
|
+
ctx.ui.notify(`Available subagents:\n${agentList}`);
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function formatSubagentPrompt(agent: AgentDefinition, task: string, context?: string): string {
|
|
176
|
+
const parts: string[] = [
|
|
177
|
+
agent.systemPrompt,
|
|
178
|
+
"",
|
|
179
|
+
"## Task",
|
|
180
|
+
task,
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
if (context) {
|
|
184
|
+
parts.push("", "## Additional Context", context);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return parts.join("\n");
|
|
188
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elyracode/subagents",
|
|
3
|
+
"version": "0.4.8",
|
|
4
|
+
"description": "Elyra extension for subagent delegation -- scout, reviewer, planner, worker, oracle, and parallel execution",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": ["elyra-package", "subagents", "delegation", "multi-agent", "parallel", "code-review"],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Knut W. Horne",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/kwhorne/elyra.git",
|
|
12
|
+
"directory": "packages/subagents"
|
|
13
|
+
},
|
|
14
|
+
"elyra": {
|
|
15
|
+
"extensions": ["./extensions/index.ts"],
|
|
16
|
+
"skills": ["./skills"]
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@elyracode/coding-agent": "*",
|
|
20
|
+
"typebox": "*"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "echo 'nothing to clean'",
|
|
24
|
+
"build": "echo 'nothing to build'",
|
|
25
|
+
"check": "echo 'nothing to check'"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: elyra-subagents
|
|
3
|
+
description: Delegation patterns for subagent orchestration. Use when the user asks to delegate work, get a second opinion, run code review, scout a codebase, or execute parallel tasks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subagent Delegation Patterns
|
|
7
|
+
|
|
8
|
+
## Available Agents
|
|
9
|
+
|
|
10
|
+
| Agent | Purpose |
|
|
11
|
+
|-------|---------|
|
|
12
|
+
| `scout` | Fast codebase reconnaissance: files, structure, entry points, data flow, risks |
|
|
13
|
+
| `reviewer` | Code review: correctness, tests, edge cases, simplicity, security |
|
|
14
|
+
| `planner` | Implementation planning: concrete steps from existing context |
|
|
15
|
+
| `worker` | Implementation: edits files, validates, follows the plan |
|
|
16
|
+
| `oracle` | Second opinion: challenges assumptions, catches drift, recommends safest move |
|
|
17
|
+
| `researcher` | External research: docs, specs, recent changes (uses read_url_content if available) |
|
|
18
|
+
| `delegate` | General-purpose child agent for ad-hoc tasks |
|
|
19
|
+
|
|
20
|
+
## When to Use Each Agent
|
|
21
|
+
|
|
22
|
+
- **scout** before you understand the code
|
|
23
|
+
- **researcher** before you trust external facts
|
|
24
|
+
- **planner** before a bigger change
|
|
25
|
+
- **worker** to implement
|
|
26
|
+
- **reviewer** to check
|
|
27
|
+
- **oracle** when the decision feels risky
|
|
28
|
+
|
|
29
|
+
## Execution Modes
|
|
30
|
+
|
|
31
|
+
### Single
|
|
32
|
+
```
|
|
33
|
+
Use scout to analyze the authentication flow.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Parallel
|
|
37
|
+
```
|
|
38
|
+
Run parallel reviewers: one for correctness, one for tests, one for complexity.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Chain
|
|
42
|
+
```
|
|
43
|
+
Scout the codebase, then plan the refactor, then implement it, then review.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Orchestration Pattern
|
|
47
|
+
|
|
48
|
+
The recommended loop for implementation work:
|
|
49
|
+
```
|
|
50
|
+
clarify -> planner -> worker -> reviewer -> worker (fixes)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
- Subagents are focused and narrow -- one task per agent
|
|
55
|
+
- Each subagent gets its own context and instructions
|
|
56
|
+
- Results are brought back to the parent for synthesis
|
|
57
|
+
- Subagents do not spawn their own subagents (max depth: 1)
|