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
'Advanced base agent that orchestrates planning, editing, and reviewing for complex coding tasks',
@@ -62,12 +62,9 @@ export function createBase2(
62
62
'researcher-web',
63
63
'researcher-docs',
64
64
'commander',
65
-
isDefault&&'editor-best-of-n',
66
65
isMax&&'editor-best-of-n-max',
67
-
isDefault&&'thinker-best-of-n',
68
66
isMax&&'thinker-best-of-n-opus',
69
-
isDefault&&'code-reviewer-gemini',
70
-
isMax&&'code-reviewer-opus',
67
+
'code-reviewer-opus',
71
68
'context-pruner',
72
69
),
73
70
@@ -119,10 +116,11 @@ Use the spawn_agents tool to spawn specialized agents to help you complete the u
119
116
'- Spawn context-gathering agents (file pickers, code-searcher, directory-lister, glob-matcher, and web/docs researchers) before making edits.',
120
117
isMax&&
121
118
'- Spawn the thinker-best-of-n-opus after gathering context to solve complex problems.',
122
-
`- Spawn a ${isMax ? 'editor-best-of-n-max' : 'editor-best-of-n'} agent to implement the changes after you have gathered all the context you need. You must spawn this agent for non-trivial changes, since it writes much better code than you would with the str_replace or write_file tools. Don't spawn the editor in parallel with context-gathering agents.`,
119
+
isMax&&
120
+
`- Spawn the editor-best-of-n-max agent to implement the changes after you have gathered all the context you need. You must spawn this agent for non-trivial changes, since it writes much better code than you would with the str_replace or write_file tools. Don't spawn the editor in parallel with context-gathering agents.`,
123
121
'- Spawn commanders sequentially if the second command depends on the the first.',
124
122
!isFast&&
125
-
`- Spawn a ${isDefault ? 'code-reviewer-gemini' : 'code-reviewer-opus'} to review the changes after you have implemented the changes.`,
123
+
'- Spawn a code-reviewer-opus to review the changes after you have implemented the changes.',
126
124
).join('\n ')}
127
125
- **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.
128
126
@@ -151,95 +149,9 @@ ${buildArray(
151
149
'- **Keep final summary extremely concise:** Write only a few words for each change you made in the final summary.',
152
150
).join('\n')}
153
151
${
154
-
isGemini
155
-
? `
156
-
## Note on tool call formatting
157
-
158
-
Later on, there is a more complete explanation of how to call tools.
159
-
160
-
Some quick gotchas:
161
-
162
-
1. **Don't include a trailing comma after the last parameter.**
163
-
<codebuff_tool_call>
164
-
{
165
-
"cb_tool_name": "tool_name",
166
-
"parameter_name": "value", <- Don't include a trailing comma after the last parameter.
167
-
}
168
-
</codebuff_tool_call>
169
-
170
-
2. Don't call multiple tools in a single tool call.
171
-
172
-
Don't do this:
173
-
174
-
<codebuff_tool_call>
175
-
{
176
-
"cb_tool_name": "tool_name_1",
177
-
"parameter_name_1": "value",
178
-
"cb_tool_name": "tool_name_2",
179
-
"parameter_name_2": "value",
180
-
}
181
-
</codebuff_tool_call>
182
-
183
-
Do this:
184
-
185
-
<codebuff_tool_call>
186
-
{
187
-
"cb_tool_name": "tool_name_1",
188
-
"parameter_name_1": "value",
189
-
}
190
-
</codebuff_tool_call>
191
-
192
-
<codebuff_tool_call>
193
-
{
194
-
"cb_tool_name": "tool_name_2",
195
-
"parameter_name_2": "value",
196
-
}
197
-
</codebuff_tool_call>
198
-
199
-
3. Every response message should include at least one tool call, except for your last.
200
-
201
-
Don't do this:
202
-
203
-
I will read some files.
204
-
205
-
Do this:
206
-
207
-
I will read some files:
208
-
209
-
<codebuff_tool_call>
210
-
[ Read files tool call json ]
211
-
</codebuff_tool_call>
212
-
213
-
4. Agents are not tools. Call them using the spawn_agents tool.
214
-
215
-
Don't do this:
216
-
217
-
<codebuff_tool_call>
218
-
{
219
-
"cb_tool_name": "agent-name",
220
-
"prompt": "[your prompt here]",
221
-
}
222
-
</codebuff_tool_call>
223
-
224
-
Do this:
225
-
226
-
<codebuff_tool_call>
227
-
{
228
-
"cb_tool_name": "spawn_agents",
229
-
"agents": [
230
-
{
231
-
"agent_type": "agent-name",
232
-
"prompt": "[your prompt here]",
233
-
}
234
-
],
235
-
"cb_easp": true
236
-
}
237
-
</codebuff_tool_call>`
238
-
: ''
239
-
}${
240
-
isFast
241
-
? ''
242
-
: `
152
+
isFast
153
+
? ''
154
+
: `
243
155
# Response examples
244
156
245
157
<example>
@@ -249,17 +161,17 @@ Do this:
249
161
<response>
250
162
[ You spawn 3 file-pickers, a code-searcher, and a docs researcher in parallel to find relevant files and do research online ]
251
163
252
-
[ You read 12 of the relevant files using the read_files tool in two separate tool calls ]
164
+
[ You read a few of the relevant files using the read_files tool in two separate tool calls ]
253
165
254
166
[ You spawn one more code-searcher and file-picker ]
255
167
256
-
[ You read 8 other relevant files using the read_files tool ]
168
+
[ You read a few other relevant files using the read_files tool ]
257
169
258
-
[ You spawn an editor to implement the changes ]
170
+
[ You implement the changes using the str_replace or write_file tools ]
259
171
260
172
[ You spawn a code-reviewer, a commander to typecheck the changes, and another commander to run tests, all in parallel ]
261
173
262
-
[ You spawn the editor to fix the issues found by the code-reviewer and type/test errors ]
174
+
[ You fix the issues found by the code-reviewer and type/test errors ]
263
175
264
176
[ All tests & typechecks pass -- you write a very short final summary of the changes you made ]
constEXPLORE_PROMPT=`- Iteratively spawn file pickers, code-searchers, directory-listers, glob-matchers, commanders, and web/docs researchers to gather context as needed. The file-picker agent in particular is very useful to find relevant files -- try spawning multiple in parallel (say, 2-5) to explore different parts of the codebase. Use read_subtree if you need to grok a particular part of the codebase. Read all the relevant files using the read_files tool. Read as many files as possible so that you have comprehensive context on the user's request.`
243
+
constEXPLORE_PROMPT=`- Iteratively spawn file pickers, code-searchers, directory-listers, glob-matchers, commanders, and web/docs researchers to gather context as needed. The file-picker agent in particular is very useful to find relevant files -- try spawning multiple in parallel (say, 2-5) to explore different parts of the codebase. Use read_subtree if you need to grok a particular part of the codebase. Read all the relevant files using the read_files tool.`
332
244
333
245
functionbuildImplementationInstructionsPrompt({
334
246
isSonnet,
@@ -351,18 +263,20 @@ The user asks you to implement a new feature. You respond in multiple steps:
351
263
352
264
${buildArray(
353
265
EXPLORE_PROMPT,
354
-
!isFast&&
266
+
isMax&&
355
267
`- Important: Read as many files as could possibly be relevant to the task over several steps to improve your understanding of the user's request and produce the best possible code changes. Find more examples within the codebase similar to the user's request, dependencies that help with understanding how things work, tests, etc. This is frequently 12-20 files, depending on the task.`,
356
268
!isFast&&
357
269
`- For any task requiring 3+ steps, use the write_todos tool to write out your step-by-step implementation plan. Include ALL of the applicable tasks in the list.${isFast ? '' : ' You should include a step to review the changes after you have implemented the changes.'}:${hasNoValidation ? '' : ' You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc.'} You may be able to do reviewing and validation in parallel in the same step. Skip write_todos for simple tasks like quick edits or answering questions.`,
270
+
isMax&&
271
+
`- IMPORTANT: You must spawn the editor-best-of-n-max agent to implement non-trivial code changes, since it will generate the best code changes from multiple implementation proposals. This is the best way to make high quality code changes -- strongly prefer using this agent over the str_replace or write_file tools, unless the change is very straightforward and obvious.`,
272
+
!isMax&&
273
+
'- Implement the changes using the str_replace or write_file tools.',
358
274
isFast&&
359
275
'- Implement the changes in one go. Pause after making all the changes to see the tool results of your edits.',
360
276
isFast&&
361
277
'- Do a single typecheck targeted for your changes at most (if applicable for the project). Or skip this step if the change was small.',
362
278
!isFast&&
363
-
`- IMPORTANT: You must spawn the ${isMax ? 'editor-best-of-n-max' : 'editor-best-of-n'} agent to implement non-trivial code changes, since it will generate the best code changes from multiple implementation proposals. This is the best way to make high quality code changes -- strongly prefer using this agent over the str_replace or write_file tools, unless the change is very straightforward and obvious.`,
364
-
!isFast&&
365
-
`- Spawn a ${isDefault ? 'code-reviewer-gemini' : 'code-reviewer-opus'} to review the changes after you have implemented the changes. (Skip this step only if the change is extremely straightforward and obvious.)`,
279
+
'- Spawn a code-reviewer-opus to review the changes after you have implemented the changes. (Skip this step only if the change is extremely straightforward and obvious.)',
366
280
!hasNoValidation&&
367
281
`- Test your changes by running appropriate validation commands for the project (e.g. typechecks, tests, lints, etc.). Try to run all appropriate commands in parallel. ${isMax ? ' Typecheck and test the specific area of the project that you are editing *AND* then typecheck and test the entire project if necessary.' : ' If you can, only test the area of the project that you are editing, rather than the entire project.'} You may have to explore the project to find the appropriate commands. Don't skip this step!`,
368
282
`- Inform the user that you have completed the task in one sentence or a few short bullet points.${isSonnet ? " Don't create any markdown summary files or example documentation files, unless asked by the user." : ''}`,
@@ -383,8 +297,8 @@ function buildImplementationStepPrompt({
383
297
returnbuildArray(
384
298
isMax&&
385
299
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}, or until you require more information from the user.`,
386
-
!isFast&&
387
-
`You must spawn the ${isMax ? 'editor-best-of-n-max' : 'editor-best-of-n'} agent to implement code changes, since it will generate the best code changes.`,
300
+
isMax&&
301
+
`You must spawn the 'editor-best-of-n-max' agent to implement code changes, since it will generate the best code changes.`,
388
302
isMax&&'Spawn the thinker-best-of-n-opus to solve complex problems.',
389
303
`After completing the user request, summarize your changes in a sentence${isFast ? '' : ' or a few short bullet points'}.${isSonnet ? " Don't create any summary markdown files or example documentation files, unless asked by the user." : ''}. Don't repeat yourself, especially if you have already concluded and summarized the changes in a previous step -- just end your turn.`,
390
304
).join('\n')
@@ -435,7 +349,7 @@ This is more like an extremely short PRD which describes the end result of what
435
349
436
350
functionbuildPlanOnlyStepPrompt({}: {}){
437
351
returnbuildArray(
438
-
`Your are in plan mode. Do not make any file changes. Do not call write_file or str_replace. Do not spawn the editor-best-of-n agent. Do not use the write_todos tool.`,
352
+
`You are in plan mode. Do not make any file changes. Do not call write_file or str_replace. Do not use the write_todos tool.`,
0 commit comments