Skip to content

Commit 85c1c33

Browse files
committed
Merge branch 'new-best-of-n'
2 parents 01d7aa0 + 0fc03f4 commit 85c1c33

15 files changed

+385
-348
lines changed

.agents/base2/task-researcher/base2-gpt-5-worker.ts renamed to .agents-graveyard/base2-gpt-5-worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { buildArray } from '@codebuff/common/util/array'
22

3-
import { createBase2 } from '../base2'
3+
import { createBase2 } from '../.agents/base2/base2'
44

5-
import type { SecretAgentDefinition } from '../../types/secret-agent-definition'
5+
import type { SecretAgentDefinition } from '../.agents/types/secret-agent-definition'
66

77
const base2 = createBase2('max')
88

.agents/base2/task-researcher/base2-with-task-researcher.ts renamed to .agents-graveyard/base2-with-task-researcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { buildArray } from '@codebuff/common/util/array'
22

3-
import { publisher } from '../../constants'
4-
import { type SecretAgentDefinition } from '../../types/secret-agent-definition'
3+
import { publisher } from '../.agents/constants'
4+
import { type SecretAgentDefinition } from '../.agents/types/secret-agent-definition'
55

66
import type { ToolCall } from 'types/agent-definition'
77
import type { UserMessage } from 'types/util-types'

.agents/base2/base2-gemini-editor.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

.agents/base2/base2-gemini.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

.agents/base2/base2.ts

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,22 @@ export function createBase2(
1111
options?: {
1212
hasNoValidation?: boolean
1313
planOnly?: boolean
14-
withGemini?: boolean
15-
useGeminiEditor?: boolean
1614
},
1715
): Omit<SecretAgentDefinition, 'id'> {
1816
const {
1917
hasNoValidation = mode === 'fast',
2018
planOnly = false,
21-
withGemini = false,
22-
useGeminiEditor = false,
2319
} = options ?? {}
2420
const isDefault = mode === 'default'
2521
const isFast = mode === 'fast'
2622
const isMax = mode === 'max'
2723

28-
const isSonnet = !withGemini
29-
const isGemini = withGemini
24+
const isSonnet = true
25+
const isGemini = false
3026

3127
return {
3228
publisher,
33-
model: withGemini
34-
? 'google/gemini-3-pro-preview'
35-
: 'anthropic/claude-sonnet-4.5',
29+
model: 'anthropic/claude-sonnet-4.5',
3630
displayName: 'Buffy the Orchestrator',
3731
spawnerPrompt:
3832
'Advanced base agent that orchestrates planning, editing, and reviewing for complex coding tasks',
@@ -69,17 +63,12 @@ export function createBase2(
6963
'researcher-web',
7064
'researcher-docs',
7165
'commander',
72-
useGeminiEditor
73-
? 'editor-implementor-gemini'
74-
: buildArray(
75-
withGemini && 'editor-best-of-n-gemini',
76-
!withGemini && isDefault && 'editor-best-of-n',
77-
!withGemini && isMax && 'editor-best-of-n-gpt-5',
78-
!withGemini && isDefault && 'thinker-best-of-n',
79-
!withGemini && isMax && 'thinker-best-of-n-gpt-5',
80-
),
81-
!withGemini && isDefault && 'code-reviewer',
82-
!withGemini && isMax && 'code-reviewer-best-of-n-gpt-5',
66+
isDefault && 'editor-best-of-n',
67+
isMax && 'editor-best-of-n-max',
68+
isDefault && 'thinker-best-of-n',
69+
isMax && 'thinker-best-of-n-gpt-5',
70+
isDefault && 'code-reviewer',
71+
isMax && 'code-reviewer-best-of-n-gpt-5',
8372
'context-pruner',
8473
),
8574

@@ -131,7 +120,7 @@ Use the spawn_agents tool to spawn specialized agents to help you complete the u
131120
'- Spawn context-gathering agents (file pickers, code-searcher, directory-lister, glob-matcher, and web/docs researchers) before making edits.',
132121
isMax &&
133122
'- Spawn the thinker-best-of-n-gpt-5 after gathering context to solve complex problems.',
134-
`- Spawn a ${useGeminiEditor ? 'editor-implementor-gemini' : isMax ? '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.`,
123+
`- 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.`,
135124
'- Spawn commanders sequentially if the second command depends on the the first.',
136125
!isFast &&
137126
`- Spawn a ${isDefault ? 'code-reviewer' : 'code-reviewer-best-of-n-gpt-5'} to review the changes after you have implemented the changes.`,
@@ -309,7 +298,6 @@ ${PLACEHOLDER.GIT_CHANGES_PROMPT}
309298
isDefault,
310299
isMax,
311300
hasNoValidation,
312-
useGeminiEditor,
313301
}),
314302
stepPrompt: planOnly
315303
? buildPlanOnlyStepPrompt({})
@@ -318,7 +306,6 @@ ${PLACEHOLDER.GIT_CHANGES_PROMPT}
318306
isMax,
319307
hasNoValidation,
320308
isSonnet,
321-
useGeminiEditor,
322309
}),
323310

324311
handleSteps: function* ({ params }) {
@@ -350,14 +337,12 @@ function buildImplementationInstructionsPrompt({
350337
isDefault,
351338
isMax,
352339
hasNoValidation,
353-
useGeminiEditor,
354340
}: {
355341
isSonnet: boolean
356342
isFast: boolean
357343
isDefault: boolean
358344
isMax: boolean
359345
hasNoValidation: boolean
360-
useGeminiEditor: boolean
361346
}) {
362347
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.
363348
@@ -376,7 +361,7 @@ ${buildArray(
376361
isFast &&
377362
'- Do a single typecheck targeted for your changes at most (if applicable for the project). Or skip this step if the change was small.',
378363
!isFast &&
379-
`- IMPORTANT: You must spawn the ${useGeminiEditor ? 'editor-implementor-gemini' : isMax ? '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.`,
364+
`- 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.`,
380365
!isFast &&
381366
`- Spawn a ${isDefault ? 'code-reviewer' : 'code-reviewer-best-of-n-gpt-5'} to review the changes after you have implemented the changes. (Skip this step only if the change is extremely straightforward and obvious.)`,
382367
!hasNoValidation &&
@@ -390,19 +375,17 @@ function buildImplementationStepPrompt({
390375
isMax,
391376
hasNoValidation,
392377
isSonnet,
393-
useGeminiEditor,
394378
}: {
395379
isFast: boolean
396380
isMax: boolean
397381
hasNoValidation: boolean
398382
isSonnet: boolean
399-
useGeminiEditor: boolean
400383
}) {
401384
return buildArray(
402385
isMax &&
403386
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}, or until you require more information from the user.`,
404387
!isFast &&
405-
`You must spawn the ${useGeminiEditor ? 'editor-implementor-gemini' : isMax ? 'editor-best-of-n-gpt-5' : 'editor-best-of-n'} agent to implement code changes, since it will generate the best code changes.`,
388+
`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.`,
406389
isMax && 'Spawn the thinker-best-of-n-gpt-5 to solve complex problems.',
407390
`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." : ''}.`,
408391
).join('\n')

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

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createBestOfNEditor } from './editor-best-of-n'
22

33
const definition = {
4-
...createBestOfNEditor('gpt-5'),
5-
id: 'editor-best-of-n-gpt-5',
4+
...createBestOfNEditor('max'),
5+
id: 'editor-best-of-n-max',
66
}
77
export default definition

0 commit comments

Comments
 (0)