Skip to content

Commit 0e13094

Browse files
committed
Update impl planner agents to focus on simple solutions, fix errors, tweak base-max prompts
1 parent cf8c1d9 commit 0e13094

File tree

3 files changed

+39
-14
lines changed

3 files changed

+39
-14
lines changed

.agents/implementation-planner/implementation-planner.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const definition: SecretAgentDefinition = {
2020
},
2121
outputMode: 'last_message',
2222
includeMessageHistory: true,
23-
toolNames: ['spawn_agents', 'read_files', 'end_turn'],
23+
toolNames: ['spawn_agents', 'read_files'],
2424
spawnableAgents: [
2525
'file-explorer',
2626
'web-researcher',
@@ -30,6 +30,8 @@ const definition: SecretAgentDefinition = {
3030
systemPrompt: `You are an expert programmer, architect, researcher, and general problem solver.
3131
You spawn agents to help you gather information, and then describe a full change to the codebase that will accomplish the task.
3232
33+
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.
34+
3335
${PLACEHOLDER.FILE_TREE_PROMPT}
3436
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
3537

@@ -39,7 +41,23 @@ ${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
3941
- 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.
4042
- Think about the best way to accomplish the task.
4143
- 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.
42-
- Then use the end_turn tool immediately after describing all the changes.
44+
45+
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.
46+
47+
<guidelines>
48+
IMPORTANT: You must pay attention to the user's request! Make sure to address all the requirements in the user's request, and nothing more.
49+
50+
For the changes:
51+
- Focus on implementing the simplest solution that will accomplish the task in a high quality manner.
52+
- Reuse existing code whenever possible -- you may need to seek out helpers from other parts of the codebase.
53+
- Use existing patterns and conventions from the codebase. Keep naming consistent. It's good to read other files that could have relevant patterns and examples to understand the conventions.
54+
- Try not to modify more files than necessary.
55+
56+
Things to avoid:
57+
- try/catch blocks for error handling unless absolutely necessary.
58+
- writing duplicate code that could be replaced with a helper function or especially an existing function.
59+
- comments. You can mostly leave out comments unless absolutely necessary to understand the code.
60+
</guidelines>
4361
`,
4462
}
4563

.agents/implementation-planner/plan-selector.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,33 @@ const definition: SecretAgentDefinition = {
5151
},
5252
required: ['reasoning', 'selectedPlanId'],
5353
},
54-
includeMessageHistory: false,
54+
includeMessageHistory: true,
5555
systemPrompt: `You are an expert plan evaluator with deep experience in software engineering, architecture, and project management.
5656
57-
Your task is to analyze multiple implementations and select the best one based on:
58-
1. **Completeness** - How well does it address the requirements?
59-
2. **Simplicity** - How clean and easy to understand is the implementation? Is the code overcomplicated?
57+
We're interested in the simplest solution that will accomplish the task correctly! You got this!
58+
59+
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
60+
61+
instructionsPrompt: `Analyze all the provided implementations and select the best one based on:
62+
63+
1. **Simplicity** - How clean and easy to understand is the implementation? Is the code overcomplicated or over-engineered?
64+
2. **Correctness** - Does the implementation correctly address the requirements?
6065
3. **Quality** - How well does it work? How clear is the implementation?
6166
4. **Efficiency** - How minimal and focused are the changes? Were more files changed than necessary? Is the code verbose?
6267
5. **Maintainability** - How well will this approach work long-term?
63-
6. **Risk** - What are the potential downsides or failure points?
64-
65-
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
68+
6. **Does what the user expects** - Make sure the implementation addresses all the requirements in the user's request, and does not do other stuff that the user did not ask for.
6669
67-
instructionsPrompt: `Analyze all the provided plans and select the best one.
70+
More on **Simplicity**:
71+
- We don't want an over-engineered solution.
72+
- We're not interested in endless safety and correctness checks.
73+
- Modifying fewer files is better.
74+
- Reusing existing code is better than writing new code.
75+
- It's good to match existing patterns and conventions in the codebase, including naming conventions, code style, and architecture.
6876
69-
For each plan, evaluate:
77+
For each implementation, evaluate:
7078
- Strengths and weaknesses
7179
- Implementation complexity
7280
- Alignment with the original task
73-
- Potential risks or issues
7481
7582
Use the set_output tool to return your selection.`,
7683
}

.agents/prompts/base-prompts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const baseAgentUserInputPrompt = (
254254
`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 ${isLite ? '8' : '20'} files. The more files you read, the better context you have on the codebase and the better your response will be.`,
255255

256256
isMax &&
257-
`Important: You must spawn the implementation-planner-max agent for all medium-to-hard coding tasks. It will help you come up with the best possible code changes.`,
257+
`IMPORTANT: You must spawn the implementation-planner-max agent for all non-trivial coding tasks. It will help you come up with the best possible code changes. This is non-negotiable. The user needs you to spawn this agent to get the best possible code changes. Use your judgment to deviate from the plan whereever you see fit.`,
258258

259259
'If the users uses "@agent-id" or "@AgentName" in their message, you must spawn that agent. If you don\'t know what input parameters that agent expects, use the lookup_agent_info tool to get the agent metadata. Spawn all the agents that the user mentions.',
260260

@@ -310,7 +310,7 @@ export const baseAgentUserInputPrompt = (
310310
`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 agent first to explore the codebase. ${isLite ? '' : 'Finally, you must spawn the reviewer agent to review your code changes.'}`,
311311

312312
isMax &&
313-
`Important: You must spawn the implementation-planner-max agent for all medium-to-hard coding tasks. It will help you come up with the best possible code changes.`,
313+
`IMPORTANT: You must spawn the implementation-planner-max agent for all non-trivial coding tasks. It will help you come up with the best possible code changes. This is non-negotiable. The user needs you to spawn this agent to get the best possible code changes. Use your judgment to deviate from the plan whereever you see fit.`,
314314

315315
!isGPT5 &&
316316
'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.',

0 commit comments

Comments
 (0)