Skip to content

Commit efe00bc

Browse files
committed
Updates for base2 and editor agent
1 parent ed5f79b commit efe00bc

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.agents/base2/base2-factory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const base2 = (model: ModelName): Omit<SecretAgentDefinition, 'id'> => ({
3333
3434
Principles:
3535
- You coordinate between agents but do not implement code yourself.
36+
- You try to ask for everything you need upfront from each agent so you don't need to spawn them again.
3637
- You are concise in your responses.
3738
3839
Guidance:
@@ -42,6 +43,7 @@ Guidance:
4243
instructionsPrompt: `Orchestrate the completion of the coding task using your specialized sub-agents.
4344
4445
- You can spawn agents to help you complete the task. Iterate by spawning more agents as needed.
46+
- Ask for everything you need upfront from each agent so you're less likely to need to spawn them again.
4547
- 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.
4648
- 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.
4749
- 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/editor.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { publisher } from '../constants'
22

3-
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
3+
import {
4+
PLACEHOLDER,
5+
type SecretAgentDefinition,
6+
} from '../types/secret-agent-definition'
47

58
const editor: SecretAgentDefinition = {
69
id: 'editor',
@@ -46,14 +49,18 @@ You are extremely skilled at:
4649
- Following existing codebase patterns
4750
- Never duplicating existing code and always reusing existing code when possible
4851
- Making the minimal change necessary to implement the user request
49-
`,
52+
- Calling the set_output tool to with a clear explanation of the changes made or with an answer to the user's question
53+
- Not writing a final summary outside of the one that you include in the set_output tool
54+
55+
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
5056

5157
instructionsPrompt: `Implement the requested changes. Feel free to ignore the plan if it seems incorrect.
5258
5359
- It's helpful to spawn a file explorer to discover all the relevant files for implementing the plan.
5460
- You must read all relevant files to understand the current state. You must read any file that could be relevant to the plan, especially files you need to modify, but also files that could show codebase patterns you could imitate. Try to read a lot of files in a single tool call. E.g. use read_files on 12 different files, and then use read_files on 6 more files that fill in the gaps.
5561
- Implement changes using str_replace or write_file.
56-
- End turn when complete.
62+
- You must use the set_output tool before finishing and include a clear explanation of the changes made or an answer to the user prompt.
63+
- Do not write a further summary outside of the one that you include in the set_output tool. It is inefficient and unnecessary to write a summary outside of the set_output tool, since no one will see it.
5764
5865
Principles:
5966
- Read before you write
@@ -110,11 +117,12 @@ Other guidance:
110117
}
111118

112119
// Collect all the edits from the conversation
113-
const { messageHistory } = agentState
120+
const { messageHistory, output } = agentState
114121
const editToolResults: string[] = []
115122
for (const message of messageHistory) {
116123
if (
117124
message.role === 'user' &&
125+
typeof message.content === 'string' &&
118126
message.content.includes('<tool_result>')
119127
) {
120128
// Parse out tool results for write_file and str_replace
@@ -146,14 +154,11 @@ Other guidance:
146154
}
147155
}
148156
}
149-
const lastAssistantMessage =
150-
messageHistory.findLast((message) => message.role === 'assistant')
151-
?.content ?? ''
152157

153158
yield {
154159
toolName: 'set_output',
155160
input: {
156-
message: lastAssistantMessage,
161+
...output,
157162
edits: editToolResults,
158163
},
159164
}

0 commit comments

Comments
 (0)