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
@@ -265,13 +277,15 @@ function buildImplementationInstructionsPrompt({
265
277
isMax,
266
278
isLite,
267
279
hasNoValidation,
280
+
useEditor,
268
281
}: {
269
282
isSonnet: boolean
270
283
isFast: boolean
271
284
isDefault: boolean
272
285
isMax: boolean
273
286
isLite: boolean
274
287
hasNoValidation: boolean
288
+
useEditor: boolean
275
289
}){
276
290
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. Don't surprise the user. For example, don't modify files if the user has not asked you to do so at least implicitly.
277
291
@@ -287,8 +301,10 @@ ${buildArray(
287
301
`- 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.`,
288
302
isLite&&
289
303
'- IMPORTANT: You must spawn the editor-gpt-5 agent to implement the changes after you have gathered all the context you need. This agent will do the best job of implementing the changes so you must spawn it for all changes.',
304
+
useEditor&&
305
+
'- IMPORTANT: You must spawn the editor agent to implement the changes after you have gathered all the context you need. This agent will do the best job of implementing the changes so you must spawn it for all non-trivial changes. Do not pass any prompt or params to the editor agent when spawning it. It will make its own best choices of what to do.',
290
306
isMax&&
291
-
`- 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.`,
307
+
`- 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. Do not pass any prompt or params to the editor agent when spawning it. It will make its own best choices of what to do.`,
292
308
(isDefault||isFast)&&
293
309
'- Implement the changes using the str_replace or write_file tools.',
294
310
isFast&&
@@ -308,15 +324,19 @@ function buildImplementationStepPrompt({
308
324
isMax,
309
325
hasNoValidation,
310
326
isSonnet,
327
+
useEditor,
311
328
}: {
312
329
isFast: boolean
313
330
isMax: boolean
314
331
hasNoValidation: boolean
315
332
isSonnet: boolean
333
+
useEditor: boolean
316
334
}){
317
335
returnbuildArray(
318
336
isMax&&
319
337
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}, or until you require more information from the user.`,
338
+
useEditor&&
339
+
`You must spawn the 'editor' agent to implement code changes, since it will do the best job of implementing the changes.`,
320
340
isMax&&
321
341
`You must spawn the 'editor-best-of-n-max' agent to implement code changes, since it will generate the best code changes.`,
322
342
isMax&&'Spawn the thinker-best-of-n-opus to solve complex problems.',
@@ -114,12 +109,10 @@ Try to select an implementation that fulfills all the requirements in the user's
114
109
## Response Format
115
110
116
111
${
117
-
isSonnet
118
-
? `Use <think> tags to briefly consider the implementations as needed to pick the best implementation.
119
-
120
-
If the best one is obvious or the implementations are very similar, you may not need to think very much (a few words suffice) or you may not need to use think tags at all, just pick the best one and output it. You have a dual goal of picking the best implementation and being fast (using as few words as possible).
112
+
isSonnet||isOpus
113
+
? `Use <think> tags to write out your thoughts about the implementations as needed to pick the best implementation. IMPORTANT: You should think really really hard to make sure you pick the absolute best implementation! As soon as you know for sure which implementation is the best, you should output your choice.
121
114
122
-
Then, do not write any other explanations AT ALL. You should directly output a single tool call to set_output with the selected implementationId.`
115
+
Then, do not write any other explanations AT ALL. You should directly output a single tool call to set_output with the selected implementationId and short reason.`
123
116
: `Output a single tool call to set_output with the selected implementationId. Do not write anything else.`
Copy file name to clipboardExpand all lines: .agents/editor/best-of-n/editor-best-of-n.ts
+14-15Lines changed: 14 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ export function createBestOfNEditor(
52
52
properties: {
53
53
n: {
54
54
type: 'number',
55
-
description: `Number of parallel implementor agents to spawn. Defaults to ${isDefault ? 4 : 5}. Use fewer for simple tasks and max of 10 for complex tasks.`,
55
+
description: `Number of parallel implementor agents to spawn. Defaults to ${isMax ? 4 : 3}. Use fewer for simple tasks and max of 10 for complex tasks.`,
56
56
},
57
57
},
58
58
},
@@ -73,7 +73,7 @@ function* handleStepsDefault({
73
73
}: AgentStepContext): ReturnType<
74
74
NonNullable<SecretAgentDefinition['handleSteps']>
75
75
>{
76
-
constDEFAULT_N=4
76
+
constDEFAULT_N=3
77
77
constselectorAgent='best-of-n-selector'
78
78
constn=Math.min(
79
79
10,
@@ -235,7 +235,7 @@ function* handleStepsMax({
235
235
}: AgentStepContext): ReturnType<
236
236
NonNullable<SecretAgentDefinition['handleSteps']>
237
237
>{
238
-
constMAX_N=5
238
+
constMAX_N=4
239
239
constselectorAgent='best-of-n-selector-opus'
240
240
constn=Math.min(
241
241
10,
@@ -245,12 +245,14 @@ function* handleStepsMax({
245
245
// Model selection pattern for max mode, using opus and gpt-5
246
246
constMAX_MODEL_PATTERN=[
247
247
'editor-implementor-opus',
248
-
'editor-implementor-gemini',
248
+
'editor-implementor-opus',
249
+
// 'editor-implementor-gemini',
249
250
'editor-implementor-gpt-5',
250
251
'editor-implementor-opus',
251
252
'editor-implementor-opus',
252
253
'editor-implementor-gpt-5',
253
-
'editor-implementor-gemini',
254
+
// 'editor-implementor-gemini',
255
+
'editor-implementor-opus',
254
256
'editor-implementor-opus',
255
257
'editor-implementor-opus',
256
258
'editor-implementor-opus',
@@ -296,6 +298,10 @@ function* handleStepsMax({
296
298
implementorResults,
297
299
)asany[]
298
300
301
+
logger.info(
302
+
{ implementorResults, spawnedImplementations },
303
+
'spawnedImplementations',
304
+
)
299
305
// Extract all the plans from the structured outputs
Copy file name to clipboardExpand all lines: .agents/editor/best-of-n/editor-implementor.ts
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -72,12 +72,14 @@ ${
72
72
isGpt5||isGemini
73
73
? ``
74
74
: `
75
-
You can also use <think> tags interspersed between tool calls to think about the best way to implement the changes. Keep these thoughts very brief. You may not need to use think tags at all.
75
+
IMPORTANT: Before you start writing your implementation, you should use <think> tags to think about the best way to implement the changes. You should think really really hard to make sure you implement the changes in the best way possible. Take as much time as you to think through all the cases to produce the best changes.
76
+
77
+
You can also use <think> tags interspersed between tool calls to think about the best way to implement the changes.
76
78
77
79
<example>
78
80
79
81
<think>
80
-
[ Thoughts about the best way to implement the feature ]
82
+
[ Long think about the best way to implement the changes ]
81
83
</think>
82
84
83
85
<codebuff_tool_call>
@@ -99,7 +101,7 @@ You can also use <think> tags interspersed between tool calls to think about the
99
101
</example>`
100
102
}
101
103
102
-
After the edit tool calls, you can optionally mention any follow-up steps to take, like deleting a file, or a sepcific way to validate the changes. There's no need to use the set_output tool as your entire response will be included in the output.
104
+
After the edit tool calls, you can optionally mention any follow-up steps to take, like deleting a file, or a specific way to validate the changes. There's no need to use the set_output tool as your entire response will be included in the output.
0 commit comments