Skip to content

Commit 47e3bc5

Browse files
committed
Merge branch 'main' into charles/native-tools
2 parents 45c91d0 + 53fa653 commit 47e3bc5

File tree

72 files changed

+4611
-1399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4611
-1399
lines changed

.agents/base2/base2.ts

Lines changed: 25 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export function createBase2(
1818
const isFast = mode === 'fast'
1919
const isMax = mode === 'max'
2020

21-
const isOpus = isMax
22-
const isSonnet = isDefault || isFast
21+
const isOpus = true
22+
const isSonnet = false
2323
const isGemini = false
2424

2525
return {
2626
publisher,
27-
model: isOpus ? 'anthropic/claude-opus-4.5' : 'anthropic/claude-sonnet-4.5',
27+
model: 'anthropic/claude-opus-4.5',
2828
displayName: 'Buffy the Orchestrator',
2929
spawnerPrompt:
3030
'Advanced base agent that orchestrates planning, editing, and reviewing for complex coding tasks',
@@ -62,12 +62,9 @@ export function createBase2(
6262
'researcher-web',
6363
'researcher-docs',
6464
'commander',
65-
isDefault && 'editor-best-of-n',
6665
isMax && 'editor-best-of-n-max',
67-
isDefault && 'thinker-best-of-n',
6866
isMax && 'thinker-best-of-n-opus',
69-
isDefault && 'code-reviewer-gemini',
70-
isMax && 'code-reviewer-opus',
67+
'code-reviewer-opus',
7168
'context-pruner',
7269
),
7370

@@ -119,10 +116,11 @@ Use the spawn_agents tool to spawn specialized agents to help you complete the u
119116
'- Spawn context-gathering agents (file pickers, code-searcher, directory-lister, glob-matcher, and web/docs researchers) before making edits.',
120117
isMax &&
121118
'- 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.`,
123121
'- Spawn commanders sequentially if the second command depends on the the first.',
124122
!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.',
126124
).join('\n ')}
127125
- **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.
128126
@@ -151,95 +149,9 @@ ${buildArray(
151149
'- **Keep final summary extremely concise:** Write only a few words for each change you made in the final summary.',
152150
).join('\n')}
153151
${
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+
: `
243155
# Response examples
244156
245157
<example>
@@ -249,17 +161,17 @@ Do this:
249161
<response>
250162
[ You spawn 3 file-pickers, a code-searcher, and a docs researcher in parallel to find relevant files and do research online ]
251163
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 ]
253165
254166
[ You spawn one more code-searcher and file-picker ]
255167
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 ]
257169
258-
[ You spawn an editor to implement the changes ]
170+
[ You implement the changes using the str_replace or write_file tools ]
259171
260172
[ You spawn a code-reviewer, a commander to typecheck the changes, and another commander to run tests, all in parallel ]
261173
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 ]
263175
264176
[ All tests & typechecks pass -- you write a very short final summary of the changes you made ]
265177
</reponse>
@@ -276,7 +188,7 @@ Do this:
276188
277189
</example>
278190
`
279-
}
191+
}
280192
281193
${PLACEHOLDER.FILE_TREE_PROMPT_SMALL}
282194
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}
@@ -328,7 +240,7 @@ ${PLACEHOLDER.GIT_CHANGES_PROMPT}
328240
}
329241
}
330242

331-
const EXPLORE_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+
const EXPLORE_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.`
332244

333245
function buildImplementationInstructionsPrompt({
334246
isSonnet,
@@ -351,18 +263,20 @@ The user asks you to implement a new feature. You respond in multiple steps:
351263
352264
${buildArray(
353265
EXPLORE_PROMPT,
354-
!isFast &&
266+
isMax &&
355267
`- 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.`,
356268
!isFast &&
357269
`- 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.',
358274
isFast &&
359275
'- Implement the changes in one go. Pause after making all the changes to see the tool results of your edits.',
360276
isFast &&
361277
'- Do a single typecheck targeted for your changes at most (if applicable for the project). Or skip this step if the change was small.',
362278
!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.)',
366280
!hasNoValidation &&
367281
`- 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!`,
368282
`- 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({
383297
return buildArray(
384298
isMax &&
385299
`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.`,
388302
isMax && 'Spawn the thinker-best-of-n-opus to solve complex problems.',
389303
`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.`,
390304
).join('\n')
@@ -435,7 +349,7 @@ This is more like an extremely short PRD which describes the end result of what
435349

436350
function buildPlanOnlyStepPrompt({}: {}) {
437351
return buildArray(
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.`,
439353
).join('\n')
440354
}
441355

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ export const createBestOfNSelector = (options: {
2626
effort: 'high',
2727
},
2828
}),
29+
...(isOpus && {
30+
reasoningOptions: {
31+
max_tokens: 4000,
32+
},
33+
}),
2934
displayName: isGpt5
3035
? 'Best-of-N GPT-5 Implementation Selector'
3136
: isGemini
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createBestOfNEditor } from './editor-best-of-n'
2+
3+
const definition = {
4+
...createBestOfNEditor('opus'),
5+
id: 'editor-best-of-n-opus',
6+
}
7+
export default definition

0 commit comments

Comments
 (0)