You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **Tone:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
49
-
- **Orchestrate only** Coordinate between agents but do not implement code yourself.
50
-
- **Rely on agents** Ask your spawned agents to complete a whole task. Instead of asking to see each relevant file and building up the plan yourself, ask an agent to come up with a plan or do the task or at least give you higher level information than what each section of code is. You shouldn't be trying to read each section of code yourself.
51
-
- **Give as many instructions upfront as possible** When spawning agents, write a prompt that includes all your instructions for each agent so you don't need to spawn them again.
52
-
- **Spawn mentioned agents:** If the users uses "@AgentName" in their message, you must spawn that agent. Spawn all the agents that the user mentions.
53
-
- **Be concise:** Do not write unnecessary introductions or final summaries in your responses. Be concise and focus on efficiently completing the user's request, without adding explanations longer than 1 sentence.
54
-
- **No final summary:** Never write a final summary of what work was done when the user's request is complete. Instead, inform the user in one sentence that the task is complete.
55
-
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
50
+
- **Orchestrate only:** Coordinate between agents but do not implement code yourself.
51
+
- **Understand first, act second:** Always gather context and read relevant files BEFORE spawning editors.
52
+
- **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed agents are better than many rushed ones.
53
+
- **Spawn mentioned agents:** If the user uses "@AgentName" in their message, you must spawn that agent.
54
+
- **No final summary:** When the task is complete, inform the user in one sentence.
55
+
- **Validate assumptions:** Use researchers, file pickers, and the read_files tool to verify assumptions about libraries and APIs before implementing.
56
56
- **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
57
57
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
instructionsPrompt: `Orchestrate the completion of the user's request using your specialized sub-agents.
70
70
71
-
## Example workflow
71
+
You spawn agents in "layers". Each layer is one spawn_agents tool call composed of multiple agents that answer your questions, do research, think, edit, and review.
72
+
73
+
In between layers, you are encouraged to use the read_files tool to read files that you think are relevant to the user's request.
74
+
75
+
Continue to spawn layers of agents until have completed the user's request or require more information from the user.
76
+
77
+
## Example layers
78
+
79
+
The user asks you to implement a new feature. You respond in multiple steps:
80
+
81
+
1. Spawn a file explorer with different prompts to find relevant files; spawn a find-all-referencer to find more relevant files and answer questions about the codebase; spawn 1 docs research to find relevant docs;
82
+
1a. Read all the relevant files using the read_files tool.
83
+
2. Spawn one more file explorer and one more find-all-referencer with different prompts to find relevant files; spawn a decomposing thinker with questions on a key decision; spawn a decomposing thinker to plan out the feature part-by-part. Spawn a code sketcher to sketch out one key section of the code that is the most important or difficult.
84
+
2a. Read all the relevant files using the read_files tool.
85
+
3. Spawn a decomposing-thinker to think about remaining key decisions; spawn one more code sketcher to sketch another key section.
86
+
4. Spawn two editors to implement all the changes.
87
+
5. Spawn a reviewer to review the changes made by the editors.
72
88
73
-
Use this workflow to solve a medium or complex coding task:
74
-
1. Spawn relevant researchers in parallel (researcher-file-explorer, researcher-web, researcher-docs)
75
-
2. Read all the relevant files using the read_files tool.
76
-
3. Repeat steps 1 and/or 2 until you have all the information you could possibly need to complete the task. You should aim to read as many files as possible, up to 20+ files to have broader codebase context.
77
-
4. Spawn a decomposing planner to come up with a plan.
78
-
5. Spawn an editor to implement the plan. If there are totally disjoint parts of the plan, you can spawn multiple editors to implement each part in parallel.
79
-
6. Spawn a reviewer to review the changes made by the editor. If more changes are needed, go back to step 5, but no more than once.
80
-
7. You must stop before spawning too many sequential agents, because that this takes too much time and the user will get impatient.
81
89
82
-
Feel free to modify this workflow as needed. It's good to spawn different agents in sequence: spawn a researcher before a planner because then the planner can use the researcher's results to come up with a better plan. You can however spawn mulitple researchers, planners, editors, and read-only-commanders, at the same time if needed.
90
+
## Spawning agents guidelines
83
91
84
-
## Guidelines
92
+
- **Sequence agents properly:** Keep in mind dependencies when spawning different agents:
93
+
- Spawn file explorers, find-all-referencer, and researchers before thinkers because then the thinkers can use the file/research results to come up with a better conclusions
94
+
- Spawn thinkers before editors so editors can use the insights from the thinkers.
95
+
- Reviewers should be spawned after editors.
96
+
- **Use the decomposing thinker also to check what context you are missing:** Ask what context you don't have for specific subtasks that you should could still acquire (with file pickers or find-all-referencers or researchers or using the read_files tool). Getting more context is one of the most important things you should do before planning or editing or coding anything.
97
+
- **Once you've gathered all the context you need, create a plan:** Write out your plan as a bullet point list. The user wants to see you write out your plan so they know you are on track.
98
+
- **Spawn editors later** Only spawn editors after gathering all the context and creating a plan.
99
+
- **No need to include context:** When prompting an agent, realize that many agents can already see the entire conversation history, so you can be brief in prompting them without needing to include context.
85
100
86
-
- Spawn agents to help you complete the task. Iterate by spawning more agents as needed.
87
-
- Don't mastermind the task. Rely on your agents' judgement to research, plan, edit, and review the code.
88
-
- You should feel free to stop and ask the user for guidance if you're stuck or don't know what to try next, or need a clarification.
89
-
- Give as many instructions upfront as possible to each agent so you're less likely to need to spawn them again.
90
-
- When prompting an agent, realize that many agents can already see the entire conversation history, so you can be brief in prompting them without needing to include context.
91
-
- Be careful about instructing subagents to run terminal commands that could be destructive or have effects that are hard to undo (e.g. git push, running scripts that could alter production environments, installing packages globally, etc). Don't do any of these unless the user explicitly asks you to.
101
+
## General guidelines
102
+
- **Stop and ask for guidance:** You should feel free to stop and ask the user for guidance if you're stuck or don't know what to try next, or need a clarification.
103
+
- **Be careful about terminal commands:** Be careful about instructing subagents to run terminal commands that could be destructive or have effects that are hard to undo (e.g. git push, running scripts that could alter production environments, installing packages globally, etc). Don't do any of these unless the user explicitly asks you to.
92
104
`,
93
105
94
-
stepPrompt: `Don't forget to spawn agents that could help, especially: the researcher-file-explorer to get codebase context, the decomposing-planner to craft a great plan, and the reviewer-max to review code changes made by the editor.`,
106
+
stepPrompt: `Don't forget to spawn agents that could help, especially: the file-explorer and find-all-referencer to get codebase context, the decomposing thinker to think about key decisions, the code sketcher to sketch out the key sections of code, and the reviewer/decomposing-reviewer to review code changes made by the editor(s).`,
'Spawn to sketch the code that will be needed to accomplish the task, focusing on the the key sections of logic or interfaces. Cannot use tools to edit files - instead describes all changes using markdown code blocks. Does not spawn other agents.',
11
+
inputSchema: {
12
+
prompt: {
13
+
type: 'string',
14
+
description: 'The coding task to sketch out, including the key sections of logic or interfaces it should focus on.',
15
+
},
16
+
},
17
+
outputMode: 'last_message',
18
+
includeMessageHistory: true,
19
+
inheritParentSystemPrompt: true,
20
+
toolNames: [],
21
+
spawnableAgents: [],
22
+
23
+
instructionsPrompt: `You are an expert programmer who sketches out the code that will be needed to accomplish the task.
24
+
25
+
You do not have access to tools to modify files. Instead, you describe all code changes using markdown code blocks.
26
+
27
+
Instructions:
28
+
- Think about the best way to accomplish the task
29
+
- Write out the sketch for each file that needs to be changed
30
+
- Use markdown code blocks with the file path as the language identifier
31
+
- For each file, show the only the code changes needed, don't include the entire file
32
+
33
+
Important: Focus on the key sections of logic or interfaces that are needed to accomplish the task! You don't need to sketch out the more obvious parts of the code.
34
+
You can skip over parts of the code using psuedo code or placeholder comments.
35
+
36
+
Guidelines:
37
+
- Pay close attention to the user's request and address all requirements
38
+
- Focus on the simplest solution that accomplishes the task
39
+
- Reuse existing code patterns and conventions from the codebase
40
+
- Keep naming consistent with the existing codebase
41
+
- Try not to modify more files than necessary
42
+
- Avoid comments unless absolutely necessary to understand the code
43
+
- Do not add try/catch blocks unless needed
44
+
- Do not write duplicate code that could use existing helpers
'Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-t ts" for TypeScript files only, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match, "--type-not test" to exclude test files)',
28
+
},
29
+
cwd: {
30
+
type: 'string'asconst,
31
+
description:
32
+
'Optional working directory to search within, relative to the project root. Defaults to searching the entire project',
33
+
},
34
+
maxResults: {
35
+
type: 'number'asconst,
36
+
description:
37
+
'Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files',
38
+
},
39
+
},
40
+
required: ['pattern'],
41
+
},
42
+
description: 'Array of code search queries to execute',
43
+
},
44
+
},
45
+
required: ['searchQueries'],
46
+
}
47
+
48
+
constcodeSearcher: SecretAgentDefinition={
49
+
id: 'code-searcher',
50
+
displayName: 'Code Searcher',
51
+
spawnerPrompt:
52
+
'Mechanically runs multiple code search queries (using ripgrep line-oriented search) and returns all results',
'Orchestrates multiple exploration agents to comprehensively analyze the codebase and answer questions.',
10
+
model: 'anthropic/claude-sonnet-4.5',
11
+
publisher,
12
+
outputMode: 'last_message',
13
+
includeMessageHistory: false,
14
+
toolNames: ['spawn_agents'],
15
+
spawnableAgents: [
16
+
'file-picker',
17
+
'code-searcher',
18
+
'directory-lister',
19
+
'glob-matcher',
20
+
'file-q-and-a',
21
+
],
22
+
inputSchema: {
23
+
prompt: {
24
+
type: 'string',
25
+
description: 'A question or exploration goal for the codebase.',
26
+
},
27
+
},
28
+
systemPrompt: `You are a codebase exploration orchestrator. Your job is to spawn multiple specialized agents in parallel waves to comprehensively explore the codebase and answer the user's question.
29
+
30
+
Strategy:
31
+
1. Analyze the user's question to determine what exploration approach would be most effective.
32
+
2. You may spawn agents to help you answer the user's question. Feel free to spawn multiple agents in parallel to gather information from different angles.
33
+
3. Synthesize all findings into a comprehensive answer.`,
34
+
35
+
instructionsPrompt: `Analyze the user's prompt and spawn appropriate exploration agents.
36
+
37
+
Finally, synthesize all findings into a comprehensive answer.`,
0 commit comments