Skip to content

Commit 04689f2

Browse files
committed
Decomposing planner agent
1 parent fac01f8 commit 04689f2

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { publisher } from '../constants'
2+
import {
3+
PLACEHOLDER,
4+
type SecretAgentDefinition,
5+
} from '../types/secret-agent-definition'
6+
7+
const definition: SecretAgentDefinition = {
8+
id: 'decomposing-planner',
9+
publisher,
10+
model: 'anthropic/claude-sonnet-4.5',
11+
displayName: 'Decomposing Planner',
12+
spawnerPrompt:
13+
'Creates the best possible implementation plan by decomposing the task into smaller plans in parallel and synthesizing them into a final plan. Includes full code changes.',
14+
inputSchema: {
15+
prompt: {
16+
type: 'string',
17+
description:
18+
'The task to plan for. Include the requirements and expected behavior after implementing the plan. Include quotes from the user of what they expect the plan to accomplish.',
19+
},
20+
},
21+
outputMode: 'last_message',
22+
includeMessageHistory: true,
23+
toolNames: ['spawn_agents', 'read_files'],
24+
spawnableAgents: ['file-explorer', 'implementation-planner'],
25+
26+
systemPrompt: `You are an expert programmer, architect, and problem solver who excels at breaking down complex tasks.
27+
28+
${PLACEHOLDER.FILE_TREE_PROMPT}
29+
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
30+
31+
instructionsPrompt: `Instructions:
32+
33+
Step 1: Task Decomposition
34+
- Spawn a file-explorer agent to explore the codebase and read all the relevant files
35+
- Carefully analyze the user's request
36+
- Break it down into 3-5 focused subtasks that:
37+
- Cover different aspects of the implementation (e.g., data layer, business logic, UI, testing)
38+
- Are specific and actionable
39+
- Together address the complete requirements
40+
41+
Step 2: Parallel Planning
42+
- Spawn 3-5 implementation-planner agents in parallel (one spawn_agents call with multiple agents)
43+
- Give each agent a focused subtask from your decomposition
44+
- Each subtask prompt should be specific about what that agent should focus on
45+
46+
Step 3: Synthesis
47+
- Review all the plans from the spawned agents
48+
- Create a unified implementation plan that:
49+
- Combines insights from all subtask plans
50+
- Resolves any conflicts or overlaps
51+
- Presents a coherent, step-by-step implementation
52+
- Includes all necessary code changes in markdown code blocks
53+
- Follows the guidelines below
54+
55+
<guidelines>
56+
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.
57+
58+
For the final synthesized plan:
59+
- Focus on implementing the simplest solution that will accomplish the task in a high quality manner
60+
- Reuse existing code whenever possible
61+
- Use existing patterns and conventions from the codebase
62+
- Keep naming consistent
63+
- Try not to modify more files than necessary
64+
65+
Things to avoid:
66+
- try/catch blocks for error handling unless absolutely necessary
67+
- writing duplicate code that could be replaced with a helper function
68+
- unnecessary comments
69+
- over-engineering or adding features not requested
70+
</guidelines>
71+
`,
72+
}
73+
74+
export default definition

0 commit comments

Comments
 (0)