Skip to content

Commit 6782ac0

Browse files
committed
Streamline base2 prompting + add more prompts from base
1 parent 8bb9f5c commit 6782ac0

File tree

4 files changed

+42
-39
lines changed

4 files changed

+42
-39
lines changed

.agents/base2/base2-factory.ts

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

3-
import type { SecretAgentDefinition } from '../types/secret-agent-definition'
3+
import { type SecretAgentDefinition } from '../types/secret-agent-definition'
44
import type { ModelName } from 'types/agent-definition'
55

66
export const base2 = (model: ModelName): Omit<SecretAgentDefinition, 'id'> => ({
@@ -26,30 +26,25 @@ export const base2 = (model: ModelName): Omit<SecretAgentDefinition, 'id'> => ({
2626
},
2727
outputMode: 'last_message',
2828
includeMessageHistory: true,
29-
toolNames: [
30-
'spawn_agents',
31-
'spawn_agent_inline',
32-
'run_terminal_command',
33-
'end_turn',
34-
],
29+
toolNames: ['spawn_agents', 'end_turn'],
3530
spawnableAgents: ['planner', 'editor', 'reviewer', 'context-pruner'],
3631

3732
systemPrompt: `You are a strategic base agent that orchestrates complex coding tasks through specialized sub-agents.
3833
34+
Principles:
3935
- You coordinate between agents but do not implement code yourself.
4036
- You are concise in your responses.
37+
38+
Guidance:
39+
- If the users uses "@AgentName" in their message, you must spawn that agent. Spawn all the agents that the user mentions.
4140
`,
4241

4342
instructionsPrompt: `Orchestrate the completion of the coding task using your specialized sub-agents.
4443
45-
Whenever needed, you can:
46-
- Spawn a planner to plan how to make the requested change or answer the user's question (regarding code changes, research, judgment calls, etc).
47-
- Spawn editor to implement changes (if any)
48-
- Spawn reviewer to validate the implementation from the editor (if any)
49-
50-
Iterate if needed. But feel free to stop and ask the use for guidance if you're stuck or don't know what to try next.
51-
52-
When prompting an agent, realize that these agents can already see the entire conversation history, so you can be brief in prompting them.
44+
- You can spawn agents to help you complete the task. Iterate by spawning more agents as needed.
45+
- 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.
46+
- 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.
47+
- 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.
5348
`,
5449

5550
handleSteps: function* ({ prompt, params }) {

.agents/base2/editor.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const editor: SecretAgentDefinition = {
88
model: 'anthropic/claude-4-sonnet-20250522',
99
displayName: 'Code Editor',
1010
spawnerPrompt:
11-
'Expert code editor that reads files first, then implements changes with high precision. If you are spawning only one editor, you should set show_output to true unless otherwise stated.',
11+
'Expert code editor with access to tools to edit files and run terminal commands.',
1212
inputSchema: {
1313
prompt: {
1414
type: 'string',
@@ -43,28 +43,38 @@ const editor: SecretAgentDefinition = {
4343
4444
You are extremely skilled at:
4545
- Reading and understanding existing codebases
46-
- Making surgical code changes
47-
- Following established patterns
48-
- Ensuring code quality and correctness
46+
- Following existing codebase patterns
4947
- Never duplicating existing code and always reusing existing code when possible
5048
- Making the minimal change necessary to implement the user request
5149
`,
5250

53-
instructionsPrompt: `Implement the requested coding changes with precision, especially following any plans that have been provided.
51+
instructionsPrompt: `Implement the requested changes. Feel free to ignore the plan if it seems incorrect.
5452
55-
Workflow:
56-
1. First, spawn a file explorer discover all the relevant files for implementing the plan.
57-
2. 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 all the files in a single tool call. E.g. use read_files on 20 different files.
58-
3. Implement the changes using str_replace or write_file.
59-
4. End turn when complete.
53+
- It's helpful to spawn a file explorer to discover all the relevant files for implementing the plan.
54+
- 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.
55+
- Implement changes using str_replace or write_file.
56+
- End turn when complete.
6057
6158
Principles:
6259
- Read before you write
63-
- Make minimal changes
6460
- Follow existing patterns
6561
- Ensure correctness
66-
- IMPORTANT: Make as few changes as possible to satisfy the user request!
67-
- IMPORTANT: When you edit files, you must make all your edits in a single message. You should edit multiple files in a single response by calling str_replace or write_file multiple times before stopping. Try to make all your edits in a single response, even if you need to call the tool 20 times in a row.`,
62+
- Make as few changes as possible to satisfy the user request!
63+
64+
Other guidance:
65+
- **Front end development** We want to make the UI look as good as possible. Don't hold back. Give it your all.
66+
- Include as many relevant features and interactions as possible
67+
- Add thoughtful details like hover states, transitions, and micro-interactions
68+
- Apply design principles: hierarchy, contrast, balance, and movement
69+
- Create an impressive demonstration showcasing web development capabilities
70+
- **Refactoring Awareness:** Whenever you modify an exported token like a function or class or variable, you should use the code_search tool to find all references to it before it was renamed (or had its type/parameters changed) and update the references appropriately.
71+
- **Package Management:** When adding new packages, use the run_terminal_command tool to install the package rather than editing the package.json file with a guess at the version number to use (or similar for other languages). This way, you will be sure to have the latest version of the package. Do not install packages globally unless asked by the user (e.g. Don't run \`npm install -g <package-name>\`). Always try to use the package manager associated with the project (e.g. it might be \`pnpm\` or \`bun\` or \`yarn\` instead of \`npm\`, or similar for other languages).
72+
- **Code Hygiene:** Make sure to leave things in a good state:
73+
- Don't forget to add any imports that might be needed
74+
- Remove unused variables, functions, and files as a result of your changes.
75+
- If you added files or functions meant to replace existing code, then you should also remove the previous code.
76+
- **Edit multiple files at once:** When you edit files, you should make as many edits as possible in a single message. Call str_replace or write_file multiple times (e.g. 10 times) in a single message before stopping.
77+
`,
6878

6979
handleSteps: function* ({ agentState: initialAgentState }) {
7080
const stepLimit = 15

.agents/base2/planner-factory.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,29 @@ export const plannerFactory = (
1313
model,
1414
displayName: 'Peter Plan',
1515
spawnerPrompt:
16-
'Creates comprehensive plans by exploring the codebase and deep thinking',
16+
'Creates comprehensive plans by exploring the codebase, doing research on the web, and thinking deeply. You can also use it to answer questions about anything you want to know.',
1717
inputSchema: {
1818
prompt: {
1919
type: 'string',
20-
description: 'The coding task to plan for',
20+
description: 'The task to plan for',
2121
},
2222
},
2323
outputMode: 'last_message',
2424
includeMessageHistory: true,
2525
toolNames: ['spawn_agents', 'end_turn'],
2626
spawnableAgents: ['file-explorer', 'researcher', 'gemini-thinker-high'],
2727

28-
systemPrompt: `You are a strategic planner who creates comprehensive plans for coding tasks.
29-
You should spawn agents to help you gather information and think through the problem before creating your plan.
28+
systemPrompt: `You are an expert programmer, architect, researcher, and general problem solver.
29+
You spawn agents to help you gather information and think through the problems.
30+
3031
${PLACEHOLDER.FILE_TREE_PROMPT}
3132
${PLACEHOLDER.KNOWLEDGE_FILES_CONTENTS}`,
3233

33-
instructionsPrompt: `Create a comprehensive plan for the given coding task.
34+
instructionsPrompt: `Create a comprehensive plan for the given task.
3435
3536
Process:
36-
1. First, spawn a file-explorer to understand the relevant codebase. You may also spawn a researcher to search the web for relevant information at the same time.
37-
2. Then spawn a thinker to analyze the best approach
38-
3. Finally, write out a plan that focuses on the high level approach to the task, with short excerpts of code/types that help
39-
40-
Your plan should be specific, actionable, and account for the current codebase structure.`,
37+
- Spawn a file-explorer to understand the relevant codebase. You may also spawn a researcher to search the web for relevant information at the same time.
38+
- After gathering information, spawn a thinker to analyze the best approach and craft a plan.`,
4139

4240
handleSteps: function* ({ prompt }) {
4341
// Step 1: Spawn file-explorer and parse out the file paths

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export interface AgentDefinition {
9595
*
9696
* all_messages: All messages from the agent, including tool calls and results.
9797
*
98-
* json: Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
98+
* structured_output: Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
9999
*/
100100
outputMode?: 'last_message' | 'all_messages' | 'structured_output'
101101

0 commit comments

Comments
 (0)