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
@@ -123,8 +133,12 @@ Use the spawn_agents tool to spawn specialized agents to help you complete the u
123
133
- **Sequence agents properly:** Keep in mind dependencies when spawning different agents. Don't spawn agents in parallel that depend on each other.
124
134
${buildArray(
125
135
'- Spawn context-gathering agents (file pickers, code-searcher, directory-lister, glob-matcher, and web/docs researchers) before making edits.',
126
-
`- Spawn a ${isGpt5 ? 'editor-best-of-n-gpt-5' : 'editor-best-of-n'} agent to implement the changes after you have gathered all the context you need. Don't spawn the editor in parallel with context-gathering agents.`,
136
+
`- Spawn a ${isGpt5 ? 'editor-best-of-n-gpt-5' : '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.`,
127
137
'- Spawn commanders sequentially if the second command depends on the the first.',
138
+
hasCodeReviewer&&
139
+
'- Spawn a code-reviewer agent to review the code changes after you have made them.',
140
+
hasCodeReviewerBestOfN&&
141
+
'- Spawn a code-reviewer-best-of-n agent to review the code changes after you have made them.',
128
142
).join('\n ')}
129
143
- **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.
@@ -210,13 +227,17 @@ function buildImplementationInstructionsPrompt({
210
227
isDefault,
211
228
isMax,
212
229
hasNoValidation,
230
+
hasCodeReviewer,
231
+
hasCodeReviewerBestOfN,
213
232
}: {
214
233
isSonnet: boolean
215
234
isGpt5: boolean
216
235
isFast: boolean
217
236
isDefault: boolean
218
237
isMax: boolean
219
238
hasNoValidation: boolean
239
+
hasCodeReviewer: boolean
240
+
hasCodeReviewerBestOfN: boolean
220
241
}){
221
242
return`Act as a helpful assistant and freely respond to the user's request however would be most helpful to the user. Use your judgement to orchestrate the completion of the user's request using your specialized sub-agents and tools as needed. Take your time and be comprehensive.
222
243
@@ -227,9 +248,13 @@ The user asks you to implement a new feature. You respond in multiple steps:
227
248
${buildArray(
228
249
EXPLORE_PROMPT,
229
250
`- 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.`,
230
-
`- 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.${hasNoValidation ? '' : ' You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc.'} Skip write_todos for simple tasks like quick edits or answering questions.`,
251
+
`- 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.${hasCodeReviewer ? ' Include a step to review the code changes with the code-reviewer agent after you have made them.' : ''}${hasCodeReviewerBestOfN ? ' Include a step to review the code changes with the code-reviewer-best-of-n agent after you have made them.' : ''}${hasNoValidation ? '' : ' You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc.'} Skip write_todos for simple tasks like quick edits or answering questions.`,
231
252
!isFast&&
232
-
`- You must spawn the ${isGpt5 ? 'editor-best-of-n-gpt-5' : '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.`,
253
+
`- IMPORTANT: You must spawn the ${isGpt5 ? 'editor-best-of-n-gpt-5' : '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.`,
254
+
hasCodeReviewer&&
255
+
`- Spawn a code-reviewer agent to review the code changes after you have made them. You can skip this step for small changes that are obvious and don't require a review.`,
256
+
hasCodeReviewerBestOfN&&
257
+
`- Spawn a code-reviewer-best-of-n agent to review the code changes after you have made them. You can skip this step for small changes that are obvious and don't require a review.`,
233
258
!hasNoValidation&&
234
259
`- Test your changes${isMax ? '' : ' briefly'} by running appropriate validation commands for the project (e.g. typechecks, tests, lints, etc.).${isMax ? ' Start by type checking the specific area of the project that you are editing and then test the entire project if necessary.' : ' If you can, only typecheck/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!`,
235
260
`- 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." : ''}`,
@@ -238,11 +263,13 @@ ${buildArray(
238
263
}
239
264
240
265
functionbuildImplementationStepPrompt({
266
+
isFast,
241
267
isMax,
242
268
isGpt5,
243
269
hasNoValidation,
244
270
isSonnet,
245
271
}: {
272
+
isFast: boolean
246
273
isMax: boolean
247
274
isGpt5: boolean
248
275
hasNoValidation: boolean
@@ -251,9 +278,11 @@ function buildImplementationStepPrompt({
251
278
returnbuildArray(
252
279
isMax&&
253
280
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}, or until you require more information from the user.`,
254
-
`After completing the user request, summarize your changes in a sentence 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.`,
281
+
!isFast&&
282
+
`You must spawn the ${isGpt5 ? 'editor-best-of-n-gpt-5' : 'editor-best-of-n'} agent to implement code changes, since it will generate the best code changes.`,
283
+
`After completing the user request, summarize your changes in a sentence 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 already summarized your changes then just end your turn.`,
255
284
isGpt5&&
256
-
`IMPORTANT: You should include at least one tool call ("<codebuff_tool_call>") per message response. If you are completely done with the user's request or require more information from the user, you must call the task_completed tool to end your turn.`,
285
+
`IMPORTANT: You must include at least one tool call ("<codebuff_tool_call>") per message response. If you are completely done with the user's request or require more information from the user, you must call the task_completed tool to end your turn.`,
257
286
).join('\n')
258
287
}
259
288
@@ -289,20 +318,23 @@ It should not include:
289
318
290
319
This is more like an extremely short PRD which describes the end result of what the user wants. Think of it like fleshing out the user's prompt to make it more precise, although it should be as short as possible.
291
320
292
-
## Questions
321
+
## Follow-up questions
293
322
294
-
After closing the <PLAN> tags, the last optional section is Questions, which is a Questions header with a numbered list of questions and alternate choices demarcated by letters.
323
+
After closing the <PLAN> tags, the last optional section is Follow-up questions, which has a numbered list of questions and alternate choices demarcated by letters to clarify and improve upon the spec. These questions are optional for to complete for the user.
295
324
296
-
For example, here is a nice short question, where the options are helpfully written out for the user:
325
+
For example, here is a nice short follow-up question, where the options are helpfully written out for the user, with the answers a) and b) indented with two spaces for readability:
297
326
298
-
Questions:
327
+
<example>
328
+
## Optional follow-up questions:
299
329
300
330
1. Do you want to:
301
-
a) (DEFAULT) Keep Express and integrate Bun WebSockets
331
+
a) (CURRENT) Keep Express and integrate Bun WebSockets
302
332
b) Migrate the entire HTTP server to Bun.serve()
333
+
</example>
303
334
304
335
Try to have as few questions as possible (even none), and focus on the most important decisions or assumptions that it would be helpful to clarify with the user.
305
-
You should also let them know what you plan to do by default, and let them know that they can choose a different option if they want to.
336
+
337
+
You should also let them know what the plan currently does by default by labeling that option with "(CURRENT)", and let them know that they can choose a different option if they want to.
306
338
307
339
The questions section should be last and there should be no summary or further elaboration. Just end your turn.
0 commit comments