Skip to content

Commit 05f26be

Browse files
committed
base2 tweaks. planner only reads existing files. commander is gpt-5-chat
1 parent 115e55d commit 05f26be

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

.agents/base2/base2-factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const base2 = (model: ModelName): Omit<SecretAgentDefinition, 'id'> => ({
4646
- **Tone:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
4747
- **Orchestrate only** Coordinate between agents but do not implement code yourself.
4848
- **Rely on agents** Ask your spawned agents to complete a whole task. Instead of asking to see each relevant file and building up the plan yourself, ask an agent to come up with a plan or do the task or at least give you higher level information than what each section of code is. You shouldn't be trying to read each section of code yourself.
49-
- **Ask for everything you need upfront** When spawning agents, write a prompt that asks for everything you need upfront from each agent so you don't need to spawn them again.
49+
- **Give as many instructions upfront as possible** When spawning agents, write a prompt that includes all your instructions for each agent so you don't need to spawn them again.
5050
- **Spawn mentioned agents:** If the users uses "@AgentName" in their message, you must spawn that agent. Spawn all the agents that the user mentions.
5151
- **Be concise:** Do not write unnecessary introductions or final summaries in your responses. Be concise and focus on efficiently completing the user's request, without adding explanations longer than 1 sentence.
5252
- **No final summary:** Never write a final summary of what work was done when the user's request is complete. Instead, inform the user in one sentence that the task is complete.
@@ -65,7 +65,7 @@ ${PLACEHOLDER.GIT_CHANGES_PROMPT}
6565
6666
- You can spawn agents to help you complete the task. Iterate by spawning more agents as needed.
6767
- Don't mastermind the task. Rely on your agents to do so.
68-
- Ask for everything you need upfront from each agent so you're less likely to need to spawn them again.
68+
- Give as many instructions upfront as possible to each agent so you're less likely to need to spawn them again.
6969
- You should feel free to stop and ask the user for guidance if you're stuck or don't know what to try next, or need a clarification.
7070
- 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 much context.
7171
- 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.

.agents/base2/planner-factory.ts

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
4040

4141
instructionsPrompt: `You are gathering information which will be used to create a plan.
4242
43-
- It's helpful to spawn a file-explorer and read-only-commander to find 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. Note: for the read-only-commander, be sure to ask it to list the file paths of all the relevant files for this task as absolute paths (e.g. src/example.ts, packages/components/Example.js, etc.).
43+
- It's helpful to spawn a file-explorer and read-only-commander to find 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. Note: for the read-only-commander, be sure to ask it to list the file paths of the relevant files for this task as absolute paths (e.g. src/example.ts, packages/components/Example.js, etc.).
4444
- Read all the file paths that are relevant using the read_files tool.
4545
- Read more and more files to get any information that could possibly help you make the best plan. It's good to read 20+ files.
4646
- After you are satisfied with the information you have gathered from these agents, use the set_output tool to describe the relevant information and insights you have. Then stop and use the end_turn tool. The plan will be created in a separate step. Do not spawn thinker-gpt-5-high in this step.`,
@@ -77,11 +77,25 @@ ${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
7777

7878
const filePaths = parseFilePathsFromToolResult(messagesBlob)
7979

80-
yield {
80+
// First, check which files exist with includeToolCall: false
81+
const { toolResult: fileExistenceResult } = yield {
8182
toolName: 'read_files',
8283
input: {
8384
paths: filePaths,
8485
},
86+
includeToolCall: false,
87+
} satisfies ToolCall
88+
89+
// Parse the results to find which files actually exist
90+
const existingFilePaths =
91+
parseExistingFilesFromReadResult(fileExistenceResult)
92+
93+
// Now read the existing files for real
94+
yield {
95+
toolName: 'read_files',
96+
input: {
97+
paths: existingFilePaths,
98+
},
8599
} satisfies ToolCall
86100

87101
// Step 3: Spawn deep-thinker to analyze approach
@@ -142,5 +156,38 @@ ${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
142156
// Remove duplicates and return
143157
return [...new Set(filePaths)]
144158
}
159+
160+
function parseExistingFilesFromReadResult(toolResult: any): string[] {
161+
if (!Array.isArray(toolResult)) {
162+
return []
163+
}
164+
165+
const existingPaths: string[] = []
166+
for (const result of toolResult) {
167+
if (result.type === 'json' && result.value) {
168+
// The read_files result should contain file data with path and content
169+
if (typeof result.value === 'object' && result.value !== null) {
170+
// Handle both array format and object format
171+
if (Array.isArray(result.value)) {
172+
for (const fileResult of result.value) {
173+
if (
174+
fileResult.path &&
175+
fileResult.content.trim() !== '[FILE_DOES_NOT_EXIST]'
176+
) {
177+
existingPaths.push(fileResult.path)
178+
}
179+
}
180+
} else if (
181+
result.value.path &&
182+
result.value.content.trim() !== '[FILE_DOES_NOT_EXIST]'
183+
) {
184+
existingPaths.push(result.value.path)
185+
}
186+
}
187+
}
188+
}
189+
190+
return existingPaths
191+
}
145192
},
146193
})

.agents/base2/read-only-commander.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
const readOnlyCommander: SecretAgentDefinition = {
88
id: 'read-only-commander',
99
publisher,
10-
model: 'x-ai/grok-code-fast-1',
10+
model: 'openai/gpt-5-chat',
1111
reasoningOptions: {
1212
enabled: true,
1313
effort: 'low',

0 commit comments

Comments
 (0)