Skip to content

Commit 00a9acd

Browse files
committed
Merge remote-tracking branch 'origin/main' into brandon/upgrade-opentui-2025-10-28
# Conflicts: # cli/src/chat.tsx
2 parents 145ca63 + f6b7413 commit 00a9acd

Some content is hidden

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

62 files changed

+3060
-1096
lines changed

.agents/base2/base2-gpt-5.ts

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

.agents/base2/base2-plan.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createBase2 } from './base2'
2+
3+
const definition = {
4+
...createBase2('fast', { planOnly: true }),
5+
id: 'base2-plan',
6+
displayName: 'Buffy the Plan-Only Orchestrator',
7+
}
8+
export default definition

.agents/base2/base2.ts

Lines changed: 123 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@ import {
66
type SecretAgentDefinition,
77
} from '../types/secret-agent-definition'
88

9-
export const createBase2: (
9+
export function createBase2(
1010
mode: 'fast' | 'max',
1111
options?: {
1212
hasNoValidation?: boolean
13-
bestOfN?: boolean
14-
bestOfNFast?: boolean
13+
planOnly?: boolean
1514
},
16-
) => Omit<SecretAgentDefinition, 'id'> = (mode, options) => {
17-
const {
18-
hasNoValidation = false,
19-
bestOfN = false,
20-
bestOfNFast = false,
21-
} = options ?? {}
15+
): Omit<SecretAgentDefinition, 'id'> {
16+
const { hasNoValidation = false, planOnly = false } = options ?? {}
2217
const isFast = mode === 'fast'
2318
const isMax = mode === 'max'
19+
const isGpt5 = isMax
2420

2521
return {
2622
publisher,
27-
model: 'anthropic/claude-sonnet-4.5',
23+
model: isGpt5 ? 'openai/gpt-5' : 'anthropic/claude-sonnet-4.5',
24+
...(isGpt5 && {
25+
reasoningModel: {
26+
effort: 'high',
27+
},
28+
}),
2829
displayName: 'Buffy the Orchestrator',
2930
spawnerPrompt:
3031
'Advanced base agent that orchestrates planning, editing, and reviewing for complex coding tasks',
@@ -47,24 +48,21 @@ export const createBase2: (
4748
includeMessageHistory: true,
4849
toolNames: buildArray(
4950
'spawn_agents',
50-
isMax && 'spawn_agent_inline',
5151
'read_files',
5252
'write_todos',
5353
'str_replace',
5454
'write_file',
55+
isGpt5 && 'task_completed',
5556
),
5657
spawnableAgents: buildArray(
57-
'file-researcher',
5858
'file-picker-max',
5959
'code-searcher',
6060
'directory-lister',
6161
'glob-matcher',
6262
'researcher-web',
6363
'researcher-docs',
6464
'commander',
65-
bestOfN && 'best-of-n-orchestrator',
66-
bestOfNFast && 'best-of-n-orchestrator-fast',
67-
isMax && 'base2-gpt-5-worker',
65+
isGpt5 ? 'best-of-n-editor-gpt-5' : 'best-of-n-editor',
6866
'context-pruner',
6967
),
7068

@@ -81,11 +79,11 @@ Continue to spawn layers of agents until have completed the user's request or re
8179
## Spawning agents guidelines
8280
8381
- **Sequence agents properly:** Keep in mind dependencies when spawning different agents. Don't spawn agents in parallel that depend on each other. Be conservative sequencing agents so they can build on each other's insights:
84-
- Spawn file pickers, code-searcher, directory-lister, glob-matcher, commanders, and researchers before making edits.
82+
- Spawn file pickers, code-searcher, directory-lister, glob-matcher, commanders, and web/docs researchers before making edits.
8583
${buildArray(
86-
isMax &&
87-
'- Spawn a base2-gpt-5-worker agent inline after you have gathered all the context you need (and not before!).',
84+
`- Spawn a ${isGpt5 ? 'best-of-n-editor-gpt-5' : 'best-of-n-editor'} agent to implement the changes after you have gathered all the context you need (and not before!).`,
8885
).join('\n ')}
86+
- **Spawn with the correct prompt and/or params:** Each agent has a schema for the input it expects. The prompt is an optional string, and the params is a json object. Note that some agents don't take any input prompt or params.
8987
- **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.
9088
9189
# Core Mandates
@@ -141,33 +139,17 @@ The following is the state of the git repository at the start of the conversatio
141139
${PLACEHOLDER.GIT_CHANGES_PROMPT}
142140
`,
143141

144-
instructionsPrompt: `Orchestrate the completion of the user's request using your specialized sub-agents. Take your time and be comprehensive.
145-
146-
## Example response
147-
148-
The user asks you to implement a new feature. You respond in multiple steps:
142+
instructionsPrompt: planOnly
143+
? buildPlanOnlyInstructionsPrompt({})
144+
: buildImplementationInstructionsPrompt({
145+
isGpt5,
146+
isFast,
147+
hasNoValidation,
148+
}),
149+
stepPrompt: planOnly
150+
? buildPlanOnlyStepPrompt({})
151+
: buildImplementationStepPrompt({ isMax, isGpt5, hasNoValidation }),
149152

150-
${buildArray(
151-
'- First, you must spawn a file-researcher to find relevant files; consider also spawning a web and/or docs researcher to find relevant information online. (Note: For the first layer, only spawn researchers, not other agents. Do not spawn a code-searcher yet!)',
152-
'- Read **ALL** the files that the file-researcher found using the read_files tool. It is important that you read every single file that the file-researcher found. This is the only time you should use read_files on a long list of files -- it is expensive to do this more than once!',
153-
`- Consider spawning other agents or reading more files as needed to gather comprehensive context to answer the user's request.`,
154-
isFast &&
155-
`- Use the write_todos tool to write out your step-by-step implementation plan.${hasNoValidation ? '' : ' You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc.'}`,
156-
bestOfN &&
157-
`- You must spawn the best-of-n-orchestrator agent to implement the code changes, since it will generate multiple implementation proposals and select the best one, which the user wants you to do.`,
158-
bestOfNFast &&
159-
`- You must spawn the best-of-n-orchestrator-fast agent to implement the code changes, since it will generate multiple implementation proposals and select the best one, which the user wants you to do.`,
160-
!bestOfN &&
161-
!bestOfNFast &&
162-
isFast &&
163-
`- Use the str_replace or write_file tool to make the changes. (Pause after making all the changes to see the tool results of your edits and double check they went through correctly.)`,
164-
isMax &&
165-
`- IMPORTANT: You must spawn a base2-gpt-5-worker agent inline (with spawn_agent_inline tool) to do the planning and editing.`,
166-
!hasNoValidation &&
167-
`- Test your changes${isFast ? ' briefly' : ''} by running appropriate validation commands for the project (e.g. typechecks, tests, lints, etc.). You may have to explore the project to find the appropriate commands. Don't skip this step!`,
168-
`- Inform the user that you have completed the task in one sentence or a few short bullet points. Don't create any markdown summary files, unless asked by the user. If you already finished the user request and said you're done, then don't say anything else.`,
169-
).join('\n')}`,
170-
stepPrompt: `${isMax ? "Keep working until the user's request is completely satisfied. " : ''}${bestOfN ? "You must spawn the best-of-n-orchestrator agent to implement the code changes. Don't forget to do this! " : ''}After completing the user request, summarize your changes in a sentence or a few short bullet points. Do not create any summary markdown files or example documentation files, unless asked by the user. If you already summarized your changes, then end turn and don't say anything else.`,
171153
handleSteps: function* ({ params }) {
172154
let steps = 0
173155
while (true) {
@@ -191,3 +173,100 @@ ${buildArray(
191173

192174
const definition = { ...createBase2('fast'), id: 'base2' }
193175
export default definition
176+
177+
function buildImplementationInstructionsPrompt({
178+
isGpt5,
179+
isFast,
180+
hasNoValidation,
181+
}: {
182+
isGpt5: boolean
183+
isFast: boolean
184+
hasNoValidation: boolean
185+
}) {
186+
return `Orchestrate the completion of the user's request using your specialized sub-agents. Take your time and be comprehensive.
187+
188+
## Example response
189+
190+
The user asks you to implement a new feature. You respond in multiple steps:
191+
192+
${buildArray(
193+
`- Spawn file pickers, code-searcher, directory-lister, glob-matcher, commanders, and web/docs researchers to gather context as needed. The file-picker-max agent in particular is very useful to use to find relevant files. Read all the relevant files using the read_files tool. Read as many files as possible so that you have a comprehensive context on the user's request.`,
194+
`- Important: Read as many files as could possibly be relevant to the task to improve your understanding of the user's request and produce the best possible code changes. This is frequently 12-20 files, depending on the task.`,
195+
`- Use the write_todos tool to write out your step-by-step implementation plan.${hasNoValidation ? '' : ' You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc.'}`,
196+
`- You must spawn the ${isGpt5 ? 'best-of-n-editor-gpt-5' : 'best-of-n-editor'} 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 small and trivial.`,
197+
!hasNoValidation &&
198+
`- Test your changes${isFast ? ' briefly' : ''} by running appropriate validation commands for the project (e.g. typechecks, tests, lints, etc.). You may have to explore the project to find the appropriate commands. Don't skip this step!`,
199+
`- Inform the user that you have completed the task in one sentence or a few short bullet points. Don't create any markdown summary files or example documentation files, unless asked by the user. If you already finished the user request and said you're done, then don't say anything else.`,
200+
isGpt5 && `- Use the task_completed tool.`,
201+
).join('\n')}`
202+
}
203+
204+
function buildPlanOnlyInstructionsPrompt({}: {}) {
205+
return `Orchestrate the completion of the user's request using your specialized sub-agents. Take your time and be comprehensive.
206+
207+
## Example response
208+
209+
The user asks you to implement a new feature. You respond in multiple steps:
210+
211+
${buildArray(
212+
`- Spawn file pickers, code-searcher, directory-lister, glob-matcher, commanders, and researchers to gather context as needed. The file-picker-max agent in particular is very useful to use to find relevant files. Read all the relevant files using the read_files tool. Read as many files as possible so that you have a comprehensive context on the user's request.`,
213+
`- After exploring the codebase, translate the user request into a clear and concise spec:
214+
215+
# Creating a spec
216+
217+
The spec should include:
218+
- A brief title and overview. For the title is preferred to call it a "Plan" rather than a "Spec".
219+
- A bullet point list of the requirements.
220+
- An optional "Notes" section detailing any key considerations or constraints or testing requirements.
221+
- A section with a list of relevant files.
222+
223+
It should not include:
224+
- A lot of analysis.
225+
- Sections of actual code.
226+
- A list of the benefits, performance benefits, or challenges.
227+
- A step-by-step plan for the implementation.
228+
- A summary of the spec.
229+
230+
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.
231+
232+
Finally, the last optional section is Questions, which can be a numbered list, with alternate choices for each question demarcated by letters.
233+
234+
For example, here is nice short question, where the options are helpfully written out for the user:
235+
236+
1. Do you want to:
237+
a) (DEFAULT) Keep Express and integrate Bun WebSockets
238+
b) Migrate the entire HTTP server to Bun.serve()
239+
240+
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.
241+
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.
242+
243+
The questions section should be last and there should be no summary or further elaboration. Just end your turn.
244+
245+
On subsequent turns with the user, you should rewrite the spec to reflect the user's choices.`,
246+
).join('\n')}`
247+
}
248+
249+
function buildImplementationStepPrompt({
250+
isMax,
251+
isGpt5,
252+
hasNoValidation,
253+
}: {
254+
isMax: boolean
255+
isGpt5: boolean
256+
hasNoValidation: boolean
257+
}) {
258+
return buildArray(
259+
isMax &&
260+
`Keep working until the user's request is completely satisfied${!hasNoValidation ? ' and validated' : ''}. `,
261+
`You must spawn the ${isGpt5 ? 'best-of-n-editor-gpt-5' : 'best-of-n-editor'} agent to implement any code changes. Don't forget to do this! `,
262+
`After completing the user request, summarize your changes in a sentence or a few short bullet points. Do not create any summary markdown files or example documentation files, unless asked by the user. If you already summarized your changes, then end turn and don't say anything else.`,
263+
isGpt5 &&
264+
`IMPORTANT: if you are completely done with the user's request, you must call the task_completed tool to end your turn.`,
265+
).join('\n')
266+
}
267+
268+
function buildPlanOnlyStepPrompt({}: {}) {
269+
return buildArray(
270+
`Your are in plan mode. Do not make any file changes. Do not call write_file or str_replace. Do not spawn the best-of-n-editor agent to implement. Do not use the write_todos tool.`,
271+
).join('\n')
272+
}

.agents/base2/best-of-n/base2-best-of-n-fast.ts

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

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

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createBestOfNEditor } from './best-of-n-editor'
2+
3+
const definition = {
4+
...createBestOfNEditor('gpt-5'),
5+
id: 'best-of-n-editor-gpt-5',
6+
}
7+
export default definition

0 commit comments

Comments
 (0)