Skip to content

Commit 736dc61

Browse files
committed
Thinker prompt tweaks, use editor-best-of-n-opus
1 parent c8ecac6 commit 736dc61

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

.agents/base2/base2.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function createBase2(
6767
isDefault && 'thinker',
6868
isLite && 'editor-gpt-5',
6969
isDefault && 'editor',
70-
isMax && 'editor-best-of-n-max',
70+
isMax && 'editor-best-of-n-opus',
7171
isMax && 'thinker-best-of-n-opus',
7272
!isLite && 'code-reviewer-opus',
7373
'context-pruner',
@@ -123,10 +123,10 @@ Use the spawn_agents tool to spawn specialized agents to help you complete the u
123123
'- Spawn the editor-gpt-5 agent to implement the changes after you have gathered all the context you need.',
124124
isDefault &&
125125
'- Spawn the editor agent to implement the changes after you have gathered all the context you need.',
126+
(isDefault || isMax) &&
127+
`- Spawn the ${isDefault ? 'thinker' : 'thinker-best-of-n-opus'} after gathering context to solve complex problems or when the user asks you to think about a problem.`,
126128
isMax &&
127-
'- Spawn the thinker-best-of-n-opus after gathering context to solve complex problems.',
128-
isMax &&
129-
`- 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.`,
129+
`- Spawn the editor-best-of-n-opus 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.`,
130130
'- Spawn commanders sequentially if the second command depends on the the first.',
131131
!isFast &&
132132
!isLite &&
@@ -172,16 +172,15 @@ ${buildArray(
172172
173173
[ You spawn one more code-searcher and file-picker ]
174174
175-
[ You read a few other relevant files using the read_files tool ]
176-
175+
[ You read a few other relevant files using the read_files tool ]${isMax ? `\n\n[ You spawn the thinker-best-of-n-opus to help solve a tricky part of the feature ]` : ``}
177176
${
178177
isDefault
179178
? `[ You implement the changes using the editor agent ]`
180179
: isFast
181180
? '[ You implement the changes using the str_replace or write_file tools ]'
182181
: isLite
183182
? '[ You implement the changes using the editor-gpt-5 agent ]'
184-
: '[ You implement the changes using the editor-best-of-n-max agent ]'
183+
: '[ You implement the changes using the editor-best-of-n-opus agent ]'
185184
}
186185
187186
${
@@ -292,12 +291,16 @@ ${buildArray(
292291
`- 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.`,
293292
(isDefault || isMax) &&
294293
`- 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.`,
294+
isDefault &&
295+
`- For complex problems, spawn the thinker agent to help find the best solution, or when the user asks you to think about a problem.`,
296+
isMax &&
297+
`- Important: Spawn the thinker-best-of-n-opus to help find the best solution before implementing changes, or especially when the user asks you to think about a problem.`,
295298
isLite &&
296299
'- 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. 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.',
297300
isDefault &&
298301
'- 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.',
299302
isMax &&
300-
`- 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.`,
303+
`- IMPORTANT: You must spawn the editor-best-of-n-opus 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.`,
301304
isFast &&
302305
'- Implement the changes using the str_replace or write_file tools. Implement all the changes in one go.',
303306
isFast &&
@@ -327,7 +330,7 @@ function buildImplementationStepPrompt({
327330
isMax &&
328331
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}, or until you require more information from the user.`,
329332
isMax &&
330-
`You must spawn the 'editor-best-of-n-max' agent to implement code changes, since it will generate the best code changes.`,
333+
`You must spawn the 'editor-best-of-n-opus' agent to implement code changes, since it will generate the best code changes.`,
331334
isMax && 'Spawn the thinker-best-of-n-opus to solve complex problems.',
332335
(isDefault || isMax) &&
333336
'Spawn code-reviewer-opus to review the changes after you have implemented the changes and in parallel with typechecking or testing.',

.agents/editor/best-of-n/editor-best-of-n.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function createBestOfNEditor(
5252
properties: {
5353
n: {
5454
type: 'number',
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.`,
55+
description: `Number of parallel implementor agents to spawn. Defaults to ${isMax ? 3 : 3}. Use fewer for simple tasks and max of 6 for complex tasks.`,
5656
},
5757
},
5858
},
@@ -235,7 +235,7 @@ function* handleStepsMax({
235235
}: AgentStepContext): ReturnType<
236236
NonNullable<SecretAgentDefinition['handleSteps']>
237237
> {
238-
const MAX_N = 4
238+
const MAX_N = 3
239239
const selectorAgent = 'best-of-n-selector-opus'
240240
const n = Math.min(
241241
10,

.agents/thinker/best-of-n/thinker-best-of-n.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ export function createThinkerBestOfN(
3737
inputSchema: {
3838
prompt: {
3939
type: 'string',
40-
description: 'The problem you are trying to solve',
40+
description: 'The problem you are trying to solve, very briefly. No need to provide context, as the thinker agent can see the entire conversation history.',
4141
},
4242
params: {
4343
type: 'object',
4444
properties: {
4545
n: {
4646
type: 'number',
4747
description:
48-
'Number of parallel thinker agents to spawn. Defaults to 5. Use fewer for simple questions and max of 10 for complex questions.',
48+
'Number of parallel thinker agents to spawn. Defaults to 3. Use fewer for simple questions and max of 6 for complex questions.',
4949
},
5050
},
5151
},
@@ -70,7 +70,7 @@ function* handleStepsDefault({
7070
NonNullable<SecretAgentDefinition['handleSteps']>
7171
> {
7272
const selectorAgentType = 'thinker-selector'
73-
const n = Math.min(10, Math.max(1, (params?.n as number | undefined) ?? 5))
73+
const n = Math.min(10, Math.max(1, (params?.n as number | undefined) ?? 3))
7474

7575
// Use GENERATE_N to generate n thinking outputs
7676
const { nResponses = [] } = yield {
@@ -155,7 +155,7 @@ function* handleStepsOpus({
155155
NonNullable<SecretAgentDefinition['handleSteps']>
156156
> {
157157
const selectorAgentType = 'thinker-selector-opus'
158-
const n = Math.min(10, Math.max(1, (params?.n as number | undefined) ?? 5))
158+
const n = Math.min(10, Math.max(1, (params?.n as number | undefined) ?? 3))
159159

160160
// Use GENERATE_N to generate n thinking outputs
161161
const { nResponses = [] } = yield {

.agents/thinker/thinker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const definition: SecretAgentDefinition = {
1212
inputSchema: {
1313
prompt: {
1414
type: 'string',
15-
description: 'The problem you are trying to solve',
15+
description:
16+
'The problem you are trying to solve, very briefly. No need to provide context, as the thinker agent can see the entire conversation history.',
1617
},
1718
},
1819
outputSchema: {

0 commit comments

Comments
 (0)