Skip to content

Commit aab6d92

Browse files
committed
bunch of stuff
1 parent 01a087f commit aab6d92

File tree

11 files changed

+1773
-24
lines changed

11 files changed

+1773
-24
lines changed

.agents/base2/base2.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const definition: SecretAgentDefinition = {
3535
'researcher-web',
3636
'researcher-docs',
3737
'decomposing-thinker',
38-
'decomposing-planner',
38+
'requirements-planner',
3939
'editor',
4040
'reviewer-max',
4141
'context-pruner',
@@ -74,7 +74,7 @@ Use this workflow to solve a medium or complex coding task:
7474
1. Spawn relevant researchers in parallel (researcher-file-explorer, researcher-web, researcher-docs)
7575
2. Read all the relevant files using the read_files tool.
7676
3. Repeat steps 1 and/or 2 until you have all the information you could possibly need to complete the task. You should aim to read as many files as possible, up to 20+ files to have broader codebase context.
77-
4. Spawn a decomposing planner to come up with a plan.
77+
4. Spawn a requirements-planner to come up with a plan.
7878
5. Spawn an editor to implement the plan. If there are totally disjoint parts of the plan, you can spawn multiple editors to implement each part in parallel.
7979
6. Spawn a reviewer to review the changes made by the editor. If more changes are needed, go back to step 5, but no more than once.
8080
7. You must stop before spawning too many sequential agents, because that this takes too much time and the user will get impatient.
@@ -91,7 +91,7 @@ Feel free to modify this workflow as needed. It's good to spawn different agents
9191
- Be careful about instructing subagents to run terminal commands that could be destructive or have effects that are hard to undo (e.g. git push, running scripts that could alter production environments, installing packages globally, etc). Don't do any of these unless the user explicitly asks you to.
9292
`,
9393

94-
stepPrompt: `Don't forget to spawn agents that could help, especially: the researcher-file-explorer to get codebase context, the decomposing-planner to craft a great plan, and the reviewer-max to review code changes made by the editor.`,
94+
stepPrompt: `Don't forget to spawn agents that could help, especially: the researcher-file-explorer to get codebase context, the requirements-planner to craft a great plan, and the reviewer-max to review code changes made by the editor.`,
9595

9696
handleSteps: function* ({ prompt, params }) {
9797
let steps = 0
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { AgentTemplateTypes } from '@codebuff/common/types/session-state'
22

3-
import { publisher } from './constants'
3+
import { publisher } from '../constants'
44

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

77
const paramsSchema = {
88
type: 'object' as const,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { publisher } from '../constants'
2+
import { filePicker } from '../factory/file-picker'
3+
4+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
5+
6+
const definition: SecretAgentDefinition = {
7+
id: 'file-picker',
8+
publisher,
9+
...filePicker('google/gemini-2.5-flash'),
10+
}
11+
12+
export default definition
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { publisher } from '../constants'
2+
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
3+
4+
const paramsSchema = {
5+
type: 'object' as const,
6+
properties: {
7+
prompts: {
8+
type: 'array' as const,
9+
items: { type: 'string' },
10+
description:
11+
'List of 1-4 different parts of the codebase that could be useful to explore',
12+
},
13+
},
14+
required: ['prompts'],
15+
}
16+
17+
const inlineFileExplorer: SecretAgentDefinition = {
18+
id: 'inline-file-explorer',
19+
displayName: 'Inline File Explorer',
20+
spawnerPrompt:
21+
'Explores the codebase by spawning file pickers and reading all found files inline',
22+
model: 'anthropic/claude-sonnet-4.5',
23+
publisher,
24+
outputMode: 'last_message',
25+
toolNames: ['spawn_agents', 'read_files'],
26+
spawnableAgents: ['researcher-file-picker'],
27+
inputSchema: {
28+
prompt: {
29+
type: 'string',
30+
description: 'What you need to accomplish by exploring the codebase',
31+
},
32+
params: paramsSchema,
33+
},
34+
includeMessageHistory: true,
35+
inheritParentSystemPrompt: true,
36+
instructionsPrompt:
37+
'Please use the read_files tool to read all the files found by the file-picker agents in a single step, except for any files that are obviously not relevant.',
38+
39+
handleSteps: function* ({ prompt, params }) {
40+
const prompts: string[] = params?.prompts ?? []
41+
const filePickerPrompts = prompts.map(
42+
(focusPrompt) =>
43+
`Based on the overall goal "${prompt}", find files related to this specific area: ${focusPrompt}`,
44+
)
45+
46+
yield {
47+
toolName: 'spawn_agents',
48+
input: {
49+
agents: filePickerPrompts.map((promptText) => ({
50+
agent_type: 'researcher-file-picker',
51+
prompt: promptText,
52+
})),
53+
},
54+
}
55+
56+
yield 'STEP'
57+
},
58+
}
59+
60+
export default inlineFileExplorer

.agents/file-picker.ts

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

.agents/planners/implementation-planner.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ const definition: SecretAgentDefinition = {
1818
outputMode: 'last_message',
1919
includeMessageHistory: true,
2020
inheritParentSystemPrompt: true,
21-
toolNames: ['spawn_agents', 'read_files'],
22-
spawnableAgents: ['file-explorer', 'web-researcher', 'docs-researcher'],
2321

24-
instructionsPrompt: `You are an expert programmer, architect, researcher, and general problem solver.
25-
You spawn agents to help you gather information, and then describe a full change to the codebase that will accomplish the task.
22+
instructionsPrompt: `You are an expert programmer, architect, and general problem solver.
23+
You describe a full change to the codebase that will accomplish the task.
2624
2725
You do not have access to tools to modify files (e.g. the write_file or str_replace tools). You are describing all the code changes that should be made as a full implementation.
2826
2927
Instructions:
30-
- Spawn file-explorer twice to find all the relevant parts of the codebase. Use different prompts for each file-explorer to ensure you get all the relevant parts of the codebase. In parallel as part of the same spawn_agents tool call, you may also spawn a web-researcher or docs-researcher to search the web or technical documentation for relevant information.
31-
- Read any relevant files that have not already been read.
3228
- Think about the best way to accomplish the task.
33-
- Finally, describe the full change to the codebase that will accomplish the task (or other steps, e.g. terminal commands to run). Use markdown code blocks to describe the changes for each file.
29+
- Describe the full change to the codebase that will accomplish the task (or other steps, e.g. terminal commands to run). Use markdown code blocks to describe the changes for each file.
3430
3531
Note that you are not allowed to use tools to modify files. You are instead describing a full implementation of the changes that should be made with all the code changes using markdown code blocks.
3632
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { publisher } from '../constants'
2+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
3+
4+
const definition: SecretAgentDefinition = {
5+
id: 'requirements-planner',
6+
publisher,
7+
model: 'anthropic/claude-sonnet-4.5',
8+
displayName: 'Requirements Planner',
9+
spawnerPrompt:
10+
'Come up with a list of requirements for a user request, and plan how to implement them.',
11+
inputSchema: {
12+
prompt: {
13+
type: 'string',
14+
description: 'The user request to plan for',
15+
},
16+
},
17+
outputMode: 'structured_output',
18+
toolNames: ['spawn_agents', 'set_output', 'end_turn'],
19+
spawnableAgents: [
20+
'researcher-file-explorer',
21+
'researcher-web',
22+
'researcher-docs',
23+
'two-wave-planner',
24+
],
25+
26+
includeMessageHistory: true,
27+
inheritParentSystemPrompt: true,
28+
29+
instructionsPrompt: `You are an expert requirements planner with deep experience in software engineering, architecture, and project management.
30+
31+
Instructions:
32+
1. Spawn a researcher-file-explorer agent to get more context about the codebase. Optionally, in parallel, spawn a researcher-web and/or researcher-docs agent to get context about the web and docs.
33+
2. Read any new files that have not already been read that could possibly be relevant to the user request or could help with planning.
34+
3. Analyze the user request in "<analysis>" tags. Explain the key steps and components that will be needed to accomplish the task.
35+
4. Come up with 2-8 explicit requirements. Try to keep the requirements disjoint, cover the whole task, and focus on the important and challenging parts of the task.
36+
5. Spawn a two-wave-planner agent with the requirements as input.
37+
6. End turn.
38+
`,
39+
40+
handleSteps: function* () {
41+
const { agentState } = yield 'STEP_ALL'
42+
const toolResults = agentState.messageHistory.filter(
43+
(message) =>
44+
message.role === 'tool' && message.content.toolName === 'spawn_agents',
45+
)
46+
const lastToolResult = toolResults[toolResults.length - 1]
47+
const lastToolResultJson =
48+
lastToolResult &&
49+
lastToolResult.role === 'tool' &&
50+
lastToolResult.content.output[0]?.type === 'json'
51+
? lastToolResult.content.output[0].value
52+
: 'No results'
53+
54+
yield {
55+
toolName: 'set_output',
56+
input: {
57+
plans: lastToolResultJson,
58+
},
59+
}
60+
},
61+
}
62+
63+
export default definition
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { publisher } from '../constants'
2+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
3+
4+
const definition: SecretAgentDefinition = {
5+
id: 'two-wave-planner',
6+
publisher,
7+
model: 'anthropic/claude-sonnet-4.5',
8+
displayName: 'Two Wave Planner',
9+
spawnerPrompt:
10+
'Plans how to implement a list of requirements for a user request across two waves for deep refinement.',
11+
inputSchema: {
12+
params: {
13+
type: 'object',
14+
properties: {
15+
requirements: {
16+
type: 'array',
17+
items: { type: 'string' },
18+
description: 'A list of explicit requirements to plan for, in the order they should be implemented',
19+
},
20+
},
21+
required: ['requirements'],
22+
},
23+
},
24+
outputMode: 'structured_output',
25+
toolNames: ['spawn_agents', 'set_output'],
26+
spawnableAgents: ['implementation-planner'],
27+
28+
includeMessageHistory: true,
29+
inheritParentSystemPrompt: true,
30+
31+
handleSteps: function* ({ params }) {
32+
const requirements: string[] = params?.requirements ?? []
33+
34+
yield {
35+
toolName: 'spawn_agents',
36+
input: {
37+
agents: requirements.map((requirement) => ({
38+
agent_type: 'implementation-planner',
39+
prompt: `Research and give insights and proposals for this requirement: ${requirement}`,
40+
})),
41+
},
42+
}
43+
44+
const { toolResult: planResults } = yield {
45+
toolName: 'spawn_agents',
46+
input: {
47+
agents: requirements.map((requirement, idx) => ({
48+
agent_type: 'implementation-planner',
49+
prompt: `Create a new plan for the following requirement: <requirement>${requirement}</requirement>
50+
51+
You can see the previous plans for the list of requirements in the message history above, including the previous plan for this requirement. Review them to:
52+
- Simplify your plan based on the broader context
53+
- Identify overlaps or conflicts with other plans
54+
- Find opportunities for code reuse across requirements
55+
- Ensure your plan integrates well with other requirements
56+
- Make your plan as concise as possible! A good plan is short and sweet.`,
57+
})),
58+
},
59+
}
60+
61+
const plans = planResults
62+
? planResults.map((result) =>
63+
result.type === 'json' ? result.value : '',
64+
)
65+
: []
66+
67+
yield {
68+
toolName: 'set_output',
69+
input: {
70+
plans,
71+
},
72+
}
73+
},
74+
}
75+
76+
export default definition

0 commit comments

Comments
 (0)