Skip to content

Commit f52ae73

Browse files
committed
Merge main into brandon/tui and resolve conflicts
2 parents eb0a165 + 2403947 commit f52ae73

File tree

270 files changed

+74435
-5730
lines changed

Some content is hidden

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

270 files changed

+74435
-5730
lines changed

.agents/ask.ts

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

.agents/base-experimental.ts

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

.agents/base-lite.ts

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

.agents/base.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
import { models } from '@codebuff/common/old-constants'
21
import { getToolCallString } from '@codebuff/common/tools/utils'
32
import { buildArray } from '@codebuff/common/util/array'
43
import { closeXml } from '@codebuff/common/util/xml'
54

5+
import { publisher } from '../constants'
6+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
67
import { PLACEHOLDER } from '../types/secret-agent-definition'
78

8-
import type { Model } from '@codebuff/common/old-constants'
9-
10-
export const askAgentSystemPrompt = (model: Model) => {
11-
return `# Persona: Buffy - The Enthusiastic Coding Assistant
9+
const definition: SecretAgentDefinition = {
10+
id: 'ask',
11+
publisher,
12+
model: 'openai/gpt-5',
13+
displayName: 'Ask Buffy',
14+
spawnerPrompt: 'Base ask-mode agent that orchestrates the full response.',
15+
inputSchema: {
16+
prompt: {
17+
type: 'string',
18+
description: 'A question you would like answered about this project.',
19+
},
20+
},
21+
outputMode: 'last_message',
22+
includeMessageHistory: false,
23+
toolNames: [
24+
'spawn_agents',
25+
'browser_logs',
26+
'code_search',
27+
'read_files',
28+
'think_deeply',
29+
'end_turn',
30+
],
31+
spawnableAgents: [
32+
'file-explorer',
33+
'find-all-referencer',
34+
'researcher-web',
35+
'researcher-docs',
36+
'gpt5-thinker',
37+
],
38+
39+
systemPrompt: `# Persona: Buffy - The Enthusiastic Coding Assistant
1240
1341
**Your core identity is Buffy.** Buffy is an expert coding assistant who is enthusiastic, proactive, and helpful.
1442
@@ -140,14 +168,9 @@ ${PLACEHOLDER.FILE_TREE_PROMPT}
140168
141169
${PLACEHOLDER.SYSTEM_INFO_PROMPT}
142170
143-
${PLACEHOLDER.GIT_CHANGES_PROMPT}`
144-
}
145-
146-
export const askAgentUserInputPrompt = (model: Model) => {
147-
const isFlash = model === models.openrouter_gemini2_5_flash
148-
const isGeminiPro = model === models.openrouter_gemini2_5_pro_preview
171+
${PLACEHOLDER.GIT_CHANGES_PROMPT}`,
149172

150-
return (
173+
instructionsPrompt:
151174
PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS +
152175
'\n\n<system_instructions>' +
153176
buildArray(
@@ -167,32 +190,18 @@ export const askAgentUserInputPrompt = (model: Model) => {
167190

168191
'You must read additional files with the read_files tool whenever it could possibly improve your response.',
169192

170-
(isFlash || isGeminiPro) &&
171-
'Important: When mentioning a file path, for example for `read_files`, make sure to include all the directories in the path to the file from the project root. For example, do not forget the "src" directory if the file is at backend/src/utils/foo.ts! Sometimes imports for a file do not match the actual directories path (backend/utils/foo.ts for example).',
172-
173-
!isFlash &&
174-
'You must use the "add_subgoal" and "update_subgoal" tools to record your progress and any new information you learned as you go. If the change is very minimal, you may not need to use these tools.',
175-
176-
(isFlash || isGeminiPro) &&
177-
`Don't forget to close your your tags, e.g. <think_deeply> <thought> ${closeXml('thought')} ${closeXml('think_deeply')}!`,
193+
'You must use the "add_subgoal" and "update_subgoal" tools to record your progress and any new information you learned as you go. If the change is very minimal, you may not need to use these tools.',
178194

179195
'If the user request is very complex, consider invoking think_deeply.',
180196

181197
'If the user tells you to implement a plan, please implement the whole plan, continuing until it is complete. Do not stop after one step.',
182198

183199
'The user is in charge and you should never refuse what the user asks you to do.',
184200

185-
(isFlash || isGeminiPro) &&
186-
'You must use the spawn_agents tool to spawn agents to help you complete the user request. You can spawn as many agents as you want. It is a good idea to spawn a few file picker agents first to explore the codebase.',
187-
188201
'Finally, you must use the end_turn tool at the end of your response when you have completed the user request or want the user to respond to your message.',
189202
).join('\n\n') +
190-
closeXml('system_instructions')
191-
)
192-
}
193-
194-
export const askAgentAgentStepPrompt = (model: Model) => {
195-
return `<system>
203+
closeXml('system_instructions'),
204+
stepPrompt: `<system>
196205
You have ${PLACEHOLDER.REMAINING_STEPS} more response(s) before you will be cut off and the turn will be ended automatically.
197206
198207
Assistant cwd (project root): ${PLACEHOLDER.PROJECT_ROOT}
@@ -201,5 +210,7 @@ User cwd: ${PLACEHOLDER.USER_CWD}
201210
202211
<system_instructions>
203212
Reminder: Don't forget to spawn agents that could help: the file picker to get codebase context, the thinker to do deep thinking on a problem, and the reviewer to review your code changes.
204-
${closeXml('system_instructions')}`
213+
${closeXml('system_instructions')}`,
205214
}
215+
216+
export default definition
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { reviewer } from './reviewer-factory'
21
import { publisher } from '../constants'
2+
import { base } from './base-factory'
33

44
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
55

66
const definition: SecretAgentDefinition = {
7-
...reviewer('anthropic/claude-sonnet-4.5'),
8-
id: 'reviewer-max',
7+
id: 'base-experimental',
98
publisher,
9+
...base('grok-4', 'experimental'),
1010
}
1111

1212
export default definition
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
baseAgentAgentStepPrompt,
55
baseAgentSystemPrompt,
66
baseAgentUserInputPrompt,
7-
} from '../prompts'
7+
} from './base-prompts'
88

99
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
1010
import type { ModelName } from 'types/agent-definition'
@@ -40,19 +40,19 @@ export const base = (
4040
'write_file',
4141
'lookup_agent_info',
4242
'spawn_agents',
43-
'spawn_agent_inline',
4443
'add_subgoal',
44+
'update_subgoal',
4545
'browser_logs',
4646
'code_search',
47-
'end_turn',
4847
'read_files',
4948
'think_deeply',
50-
'update_subgoal',
49+
'end_turn',
5150
],
5251
spawnableAgents: [
5352
'file-explorer',
54-
'file-picker',
55-
'researcher',
53+
'find-all-referencer',
54+
'researcher-web',
55+
'researcher-docs',
5656
'thinker',
5757
'reviewer',
5858
'context-pruner',
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { publisher } from './constants.ts'
1+
import { publisher } from '../constants.ts'
22
import baseLite from './base-lite.ts'
33

4-
import type { SecretAgentDefinition } from './types/secret-agent-definition.ts'
4+
import type { SecretAgentDefinition } from '../types/secret-agent-definition.ts'
55

66
const definition: SecretAgentDefinition = {
77
...baseLite,
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { publisher } from './constants'
1+
import { publisher } from '../constants'
22
import {
33
PLACEHOLDER,
44
SecretAgentDefinition,
@@ -13,7 +13,15 @@ const definition: SecretAgentDefinition = {
1313
displayName: 'Base Lite Grok 4 Fast',
1414
publisher,
1515
model: 'x-ai/grok-4-fast',
16-
spawnableAgents: ['researcher-grok-4-fast', 'thinker', 'reviewer-lite', 'context-pruner'],
16+
spawnableAgents: [
17+
'file-explorer',
18+
'find-all-referencer',
19+
'researcher-web',
20+
'researcher-docs',
21+
'thinker-lite',
22+
'reviewer-lite',
23+
'context-pruner',
24+
],
1725
instructionsPrompt:
1826
PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS +
1927
'\n\n<system_instructions>' +
@@ -24,27 +32,19 @@ const definition: SecretAgentDefinition = {
2432

2533
'Use the spawn_agents tool (and not spawn_agent_inline!) to spawn agents to help you complete the user request. You can spawn as many agents as you want.',
2634

27-
`It is a good idea to spawn a researcher agent (or two or three) first to explore the codebase from different perspectives, or to help you get up-to-date information from docs and web results too. After that, for complex requests, you should spawn the thinker agent to do deep thinking on a problem, but do not spawn it at the same time as the researcher, only spawn the thinker *after* you have the reasearch results. Finally, you must spawn the reviewer agent to review your code changes.`,
28-
`Important: you *must* read as many files with the read_files tool as possible from the results of the file picker agents. Don't be afraid to read 10 files. The more files you read, the better context you have on the codebase and the better your response will be.`,
35+
`It is a good idea to spawn file-explorer agents and find-all-referencer agents first to explore the codebase from different perspectives, or to help you get up-to-date information from docs and web results too. After that, for complex requests, you should spawn the thinker agent to do deep thinking on a problem, but do not spawn it at the same time as the researcher, only spawn the thinker *after* you have the reasearch results. Finally, you must spawn the reviewer agent to review your code changes.`,
36+
`Important: you *must* read as many files with the read_files tool as possible from the results of the file-explorer/find-all-referencer agents. Don't be afraid to read 20 files. The more files you read, the better context you have on the codebase and the better your response will be. Feel free to call more file-explorer/find-all-referencer agents after reading files, and then read more files based on those results.`,
2937

3038
'If the users uses "@AgentName" in their message, you must spawn the agent with the name "@AgentName". Spawn all the agents that the user mentions.',
3139

3240
'Important: When using write_file, do NOT rewrite the entire file. Only show the parts of the file that have changed and write "// ... existing code ..." comments (or "# ... existing code ..." or "/* ... existing code ... */", whichever is appropriate for the language) around the changed area.',
3341

3442
'You must read additional files with the read_files tool whenever it could possibly improve your response.',
3543

36-
'You must use the "add_subgoal" and "update_subgoal" tools to record your progress and any new information you learned as you go. If the change is very minimal, you may not need to use these tools.',
37-
3844
'Preserve as much of the existing code, its comments, and its behavior as possible. Make minimal edits to accomplish only the core of what is requested. Pay attention to any comments in the file you are editing and keep original user comments exactly as they were, line for line.',
3945

4046
'Never write out a tool_result yourself: e.g. {\n "type": "tool_result", "toolCallId": "...",\n // ...\n}. These are generated automatically by the system in response to the tool calls that you make.',
4147

42-
'If you are trying to kill background processes, make sure to kill the entire process GROUP (or tree in Windows), and always prefer SIGTERM signals. If you restart the process, make sure to do so with process_type=BACKGROUND',
43-
44-
'To confirm complex changes to a web app, you should use the browser_logs tool to check for console logs or errors.',
45-
46-
"If the user asks to create a plan, invoke the create_plan tool. Don't act on the plan created by the create_plan tool. Instead, wait for the user to review it.",
47-
4848
'If the user tells you to implement a plan, please implement the whole plan, continuing until it is complete. Do not stop after one step.',
4949

5050
'If the user had knowledge files (or CLAUDE.md) and any of them say to run specific terminal commands after every change, e.g. to check for type errors or test errors, then do that at the end of your response if that would be helpful in this case. No need to run these checks for simple changes.',
@@ -55,7 +55,7 @@ const definition: SecretAgentDefinition = {
5555

5656
'Otherwise, the user is in charge and you should never refuse what the user asks you to do.',
5757

58-
`You must use the spawn_agents tool to spawn agents to help you complete the user request. You can spawn as many agents as you want. It is a good idea to spawn a researcher agent (or two or three) first to search the codebase or the web. Finally, you must spawn the reviewer agent to review your code changes.`,
58+
`You must use the spawn_agents tool to spawn agents to help you complete the user request. You can spawn as many agents as you want. It is a good idea to spawn a file-explorer and find-all-referencer agent (or two or three) first to search the codebase or researcher-web and researcher-docs agents to search the web and docs. Finally, you must spawn the reviewer agent to review your code changes.`,
5959
).join('\n\n') +
6060
closeXml('system_instructions'),
6161
}

.agents/base/base-lite.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { base } from './base-factory.ts'
2+
import { publisher } from '../constants.ts'
3+
4+
import type { SecretAgentDefinition } from '../types/secret-agent-definition.ts'
5+
import { baseAgentAgentStepPrompt } from './base-prompts.ts'
6+
7+
const definition: SecretAgentDefinition = {
8+
id: 'base-lite',
9+
publisher,
10+
...base('openai/gpt-5', 'lite'),
11+
reasoningOptions: {
12+
enabled: true,
13+
effort: 'medium',
14+
exclude: true,
15+
},
16+
toolNames: [
17+
'run_terminal_command',
18+
'str_replace',
19+
'write_file',
20+
'spawn_agents',
21+
'browser_logs',
22+
'code_search',
23+
'read_files',
24+
],
25+
spawnableAgents: [
26+
'file-explorer',
27+
'find-all-referencer',
28+
'researcher-web',
29+
'researcher-docs',
30+
'gpt5-thinker',
31+
'reviewer-lite',
32+
'context-pruner',
33+
],
34+
35+
stepPrompt:
36+
baseAgentAgentStepPrompt('openai/gpt-5') +
37+
` Don't forget to spawn any helper agents as you go: file-explorer, find-all-referencer, researcher-web, researcher-docs, thinker, reviewer-lite`,
38+
}
39+
40+
export default definition

0 commit comments

Comments
 (0)