Skip to content

Commit 6c8960c

Browse files
committed
Update orchestrator subagents to use inheritParentSystemPrompt
1 parent 238cce7 commit 6c8960c

File tree

7 files changed

+41
-93
lines changed

7 files changed

+41
-93
lines changed

.agents/editor/editor.ts

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { Message } from 'types/util-types'
22
import { publisher } from '../constants'
3-
import {
4-
PLACEHOLDER,
5-
type SecretAgentDefinition,
6-
} from '../types/secret-agent-definition'
3+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
74

85
const editor: SecretAgentDefinition = {
96
id: 'editor',
@@ -28,7 +25,6 @@ const editor: SecretAgentDefinition = {
2825
},
2926
},
3027
outputMode: 'structured_output',
31-
includeMessageHistory: true,
3228
toolNames: [
3329
'read_files',
3430
'write_file',
@@ -42,7 +38,10 @@ const editor: SecretAgentDefinition = {
4238
],
4339
spawnableAgents: ['file-explorer', 'web-researcher', 'docs-researcher'],
4440

45-
systemPrompt: `You are an expert code editor with deep understanding of software engineering principles.
41+
includeMessageHistory: true,
42+
inheritParentSystemPrompt: true,
43+
44+
instructionsPrompt: `You are an expert code editor with deep understanding of software engineering principles.
4645
4746
# Core Mandates
4847
@@ -66,52 +65,8 @@ const editor: SecretAgentDefinition = {
6665
- Remove unused variables, functions, and files as a result of your changes.
6766
- If you added files or functions meant to replace existing code, then you should also remove the previous code.
6867
- **Edit multiple files at once:** When you edit files, you must make as many tool calls as possible in a single message. This is faster and much more efficient than making all the tool calls in separate messages. It saves users thousands of dollars in credits if you do this!
69-
<example>
70-
Assistant: I will now implement feature X.
71-
72-
<codebuff_tool_call>
73-
{
74-
"toolName": "str_replace",
75-
"input": {
76-
"filePath": "src/components/Button.tsx",
77-
"oldContent": "...",
78-
"newContent": "...",
79-
}
80-
}
81-
</codebuff_tool_call>
82-
83-
<codebuff_tool_call>
84-
{
85-
"toolName": "str_replace",
86-
"input": {
87-
"filePath": "src/components/Button.tsx",
88-
"oldContent": "...",
89-
"newContent": "...",
90-
}
91-
}
92-
</codebuff_tool_call>
93-
94-
// ... 8 more str_replace tool calls ...
95-
96-
Let's see what the code looks like now.
97-
98-
User: <tool_result>
99-
<tool>str_replace</tool>
100-
<result>...</result>
101-
</tool_result>
102-
103-
<tool_result>
104-
<tool>str_replace</tool>
105-
<result>...</result>
106-
</tool_result>
107-
108-
// ... 8 more tool_result blocks ...
109-
</example>
11068
- **Summarize with set_output:** 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. Do not write a separate summary outside of the set_output tool.
111-
112-
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
113-
114-
instructionsPrompt: `Implement the requested changes, using your judgment as needed, but referring to the original <user-message> as the most important source of information.
69+
Implement the requested changes, using your judgment as needed, but referring to the original <user-message> as the most important source of information.
11570
11671
# Instructions
11772

.agents/planners/decomposing-planner-lite.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const definition: SecretAgentDefinition = {
99
spawnerPrompt:
1010
'Creates a better implementation plan by decomposing the task into smaller plans in parallel and synthesizing them into a final plan. Includes full code changes.',
1111
spawnableAgents: ['researcher-file-explorer', 'implementation-planner-lite'],
12-
includeMessageHistory: false,
1312
}
1413

1514
export default definition

.agents/planners/decomposing-planner.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { publisher } from '../constants'
2-
import {
3-
PLACEHOLDER,
4-
type SecretAgentDefinition,
5-
} from '../types/secret-agent-definition'
2+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
63

74
const definition: SecretAgentDefinition = {
85
id: 'decomposing-planner',
@@ -19,27 +16,25 @@ const definition: SecretAgentDefinition = {
1916
},
2017
},
2118
outputMode: 'last_message',
22-
includeMessageHistory: true,
2319
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.
20+
spawnableAgents: ['researcher-file-explorer', 'implementation-planner'],
2721

28-
${PLACEHOLDER.FILE_TREE_PROMPT}
29-
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
22+
includeMessageHistory: true,
23+
inheritParentSystemPrompt: true,
3024

31-
instructionsPrompt: `Instructions:
25+
instructionsPrompt: `You are an expert programmer, architect, and problem solver who excels at breaking down complex tasks.
26+
Instructions:
3227
3328
Step 1: Task Decomposition
34-
- Spawn a file-explorer agent to explore the codebase and read all the relevant files
29+
- Spawn a researcher-file-explorer agent to explore the codebase and read all the relevant files
3530
- Carefully analyze the user's request
36-
- Break it down into 3-5 focused subtasks that:
31+
- Break it down into 2-10 focused subtasks that:
3732
- Cover different aspects of the implementation (e.g., data layer, business logic, UI, testing)
3833
- Are specific and actionable
3934
- Together address the complete requirements
4035
4136
Step 2: Parallel Planning
42-
- Spawn 3-5 implementation-planner agents in parallel (one spawn_agents call with multiple agents)
37+
- Spawn 2-10 implementation-planner agents in parallel (one spawn_agents call with multiple agents)
4338
- Give each agent a focused subtask from your decomposition
4439
- Each subtask prompt should be specific about what that agent should focus on
4540

.agents/planners/implementation-planner.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { publisher } from '../constants'
2-
import {
3-
PLACEHOLDER,
4-
type SecretAgentDefinition,
5-
} from '../types/secret-agent-definition'
2+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
63

74
const definition: SecretAgentDefinition = {
85
id: 'implementation-planner',
@@ -20,22 +17,16 @@ const definition: SecretAgentDefinition = {
2017
},
2118
outputMode: 'last_message',
2219
includeMessageHistory: true,
20+
inheritParentSystemPrompt: true,
2321
toolNames: ['spawn_agents', 'read_files'],
24-
spawnableAgents: [
25-
'file-explorer',
26-
'web-researcher',
27-
'docs-researcher',
28-
],
22+
spawnableAgents: ['file-explorer', 'web-researcher', 'docs-researcher'],
2923

30-
systemPrompt: `You are an expert programmer, architect, researcher, and general problem solver.
24+
instructionsPrompt: `You are an expert programmer, architect, researcher, and general problem solver.
3125
You spawn agents to help you gather information, and then describe a full change to the codebase that will accomplish the task.
3226
3327
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.
3428
35-
${PLACEHOLDER.FILE_TREE_PROMPT}
36-
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
37-
38-
instructionsPrompt: `Instructions:
29+
Instructions:
3930
- 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.
4031
- Read all the file paths that are relevant using the read_files tool.
4132
- 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.

.agents/reviewer/reviewer-factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export const reviewer = (model: Model): Omit<SecretAgentDefinition, 'id'> => ({
1515
},
1616
},
1717
outputMode: 'last_message',
18-
includeMessageHistory: true,
1918
toolNames: ['end_turn', 'run_file_change_hooks'],
2019
spawnableAgents: [],
2120

22-
systemPrompt: `You are an expert programmer who can articulate very clear feedback on code changes.`,
21+
inheritParentSystemPrompt: true,
22+
includeMessageHistory: true,
2323

2424
instructionsPrompt: `Your task is to provide helpful feedback on the last file changes made by the assistant.
2525

.agents/types/agent-definition.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export interface AgentDefinition {
9595
/** Whether to include conversation history from the parent agent in context.
9696
*
9797
* Defaults to false.
98-
* Use this if the agent needs to know all the previous messages in the conversation.
98+
* Use this when the agent needs to know all the previous messages in the conversation.
9999
*/
100100
includeMessageHistory?: boolean
101101

@@ -121,6 +121,14 @@ export interface AgentDefinition {
121121
* This field is key if the agent is intended to be spawned by other agents. */
122122
spawnerPrompt?: string
123123

124+
/** Whether to inherit the parent agent's system prompt instead of using this agent's own systemPrompt.
125+
*
126+
* Defaults to false.
127+
* Use this when you want to enable prompt caching by preserving the same system prompt prefix.
128+
* Cannot be used together with the systemPrompt field.
129+
*/
130+
inheritParentSystemPrompt?: boolean
131+
124132
/** Background information for the agent. Fairly optional. Prefer using instructionsPrompt for agent instructions. */
125133
systemPrompt?: string
126134

@@ -289,7 +297,7 @@ export type ModelName =
289297
| 'openai/gpt-5-nano'
290298

291299
// Anthropic
292-
| 'anthropic/claude-sonnet-4'
300+
| 'anthropic/claude-sonnet-4.5'
293301
| 'anthropic/claude-opus-4.1'
294302

295303
// Gemini
@@ -326,8 +334,8 @@ export type ModelName =
326334
// Other open source models
327335
| 'moonshotai/kimi-k2'
328336
| 'moonshotai/kimi-k2:nitro'
329-
| 'z-ai/glm-4.5'
330-
| 'z-ai/glm-4.5:nitro'
337+
| 'z-ai/glm-4.6'
338+
| 'z-ai/glm-4.6:nitro'
331339
| (string & {})
332340

333341
export type { Tools }

common/src/templates/initial-agents-dir/types/agent-definition.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ export interface AgentDefinition {
9292
params?: JsonObjectSchema
9393
}
9494

95-
/** Whether to include conversation history from the parent agent in context.
96-
*
97-
* Defaults to false.
98-
* Use this when the agent needs to know all the previous messages in the conversation.
99-
*/
100-
includeMessageHistory?: boolean
101-
10295
/** How the agent should output a response to its parent (defaults to 'last_message')
10396
*
10497
* last_message: The last message from the agent, typically after using tools.
@@ -121,6 +114,13 @@ export interface AgentDefinition {
121114
* This field is key if the agent is intended to be spawned by other agents. */
122115
spawnerPrompt?: string
123116

117+
/** Whether to include conversation history from the parent agent in context.
118+
*
119+
* Defaults to false.
120+
* Use this when the agent needs to know all the previous messages in the conversation.
121+
*/
122+
includeMessageHistory?: boolean
123+
124124
/** Whether to inherit the parent agent's system prompt instead of using this agent's own systemPrompt.
125125
*
126126
* Defaults to false.

0 commit comments

Comments
 (0)