You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/core/prompts/sections/capabilities.ts
+25-20Lines changed: 25 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -7,26 +7,31 @@ export function getCapabilitiesSection(
7
7
mcpHub?: McpHub,
8
8
diffStrategy?: DiffStrategy,
9
9
): string{
10
-
return`====
11
-
12
-
CAPABILITIES
13
-
14
-
- You have access to tools that let you execute CLI commands on the user's computer, list files, view source code definitions, regex search${
15
-
supportsComputerUse ? ", use the browser" : ""
16
-
}, read and write files, and ask follow-up questions. These tools help you effectively accomplish a wide range of tasks, such as writing code, making edits or improvements to existing files, understanding the current state of a project, performing system operations, and much more.
17
-
- When the user initially gives you a task, a recursive list of all filepaths in the current working directory ('${cwd}') will be included in environment_details. This provides an overview of the project's file structure, offering key insights into the project from directory/file names (how developers conceptualize and organize their code) and file extensions (the language used). This can also guide decision-making on which files to explore further. If you need to further explore directories such as outside the current working directory, you can use the list_files tool. If you pass 'true' for the recursive parameter, it will list files recursively. Otherwise, it will list files at the top level, which is better suited for generic directories where you don't necessarily need the nested structure, like the Desktop.
18
-
- You can use search_files to perform regex searches across files in a specified directory, outputting context-rich results that include surrounding lines. This is particularly useful for understanding code patterns, finding specific implementations, or identifying areas that need refactoring.
19
-
- You can use the list_code_definition_names tool to get an overview of source code definitions for all files at the top level of a specified directory. This can be particularly useful when you need to understand the broader context and relationships between certain parts of the code. You may need to call this tool multiple times to understand various parts of the codebase related to the task.
20
-
- For example, when asked to make edits or improvements you might analyze the file structure in the initial environment_details to get an overview of the project, then use list_code_definition_names to get further insight using source code definitions for files located in relevant directories, then read_file to examine the contents of relevant files, analyze the code and suggest improvements or make necessary edits, then use ${diffStrategy ? "the apply_diff or write_to_file" : "the write_to_file"} tool to apply the changes. If you refactored code that could affect other parts of the codebase, you could use search_files to ensure you update other files as needed.
21
-
- You can use the execute_command tool to run commands on the user's computer whenever you feel it can help accomplish the user's task. When you need to execute a CLI command, you must provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, since they are more flexible and easier to run. Interactive and long-running commands are allowed, since the commands are run in the user's VSCode terminal. The user may keep commands running in the background and you will be kept updated on their status along the way. Each command you execute is run in a new terminal instance.${
5. Apply changes with ${diffStrategy ? "apply_diff/write_to_file" : "write_to_file"}
28
+
6. Update related files if needed
29
+
- execute_command: Run CLI commands
30
+
- Prefer direct commands over scripts
31
+
- Supports interactive/long-running commands
32
+
- Runs in new terminal instance${
22
33
supportsComputerUse
23
-
? "\n- You can use the browser_action tool to interact with websites (including html files and locally running development servers) through a Puppeteer-controlled browser when you feel it is necessary in accomplishing the user's task. This tool is particularly useful for web development tasks as it allows you to launch a browser, navigate to pages, interact with elements through clicks and keyboard input, and capture the results through screenshots and console logs. This tool may be useful at key stages of web development tasks-such as after implementing new features, making substantial changes, when troubleshooting issues, or to verify the result of your work. You can analyze the provided screenshots to ensure correct rendering or identify errors, and review console logs for runtime issues.\n - For example, if asked to add a component to a react website, you might create the necessary files, use execute_command to run the site locally, then use browser_action to launch the browser, navigate to the local server, and verify the component renders & functions correctly before closing the browser."
24
-
: ""
25
-
}${
26
-
mcpHub
27
-
? `
28
-
- You have access to MCP servers that may provide additional tools and resources. Each server may provide different capabilities that you can use to accomplish tasks more effectively.
29
-
`
34
+
? "\n- browser_action: Web interaction tool\n - Launch/navigate pages\n - Interact with elements\n - Capture screenshots/logs\n - Example: Test React components locally"
Copy file name to clipboardExpand all lines: src/core/prompts/sections/custom-instructions.ts
+1-8Lines changed: 1 addition & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -90,13 +90,6 @@ export async function addCustomInstructions(
90
90
constjoinedSections=sections.join("\n\n")
91
91
92
92
returnjoinedSections
93
-
? `
94
-
====
95
-
96
-
USER'S CUSTOM INSTRUCTIONS
97
-
98
-
The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines.
99
-
100
-
${joinedSections}`
93
+
? `\n## USER'S CUSTOM INSTRUCTIONS\n\nFollow these additional instructions while respecting TOOL USE guidelines:\n\n${joinedSections}`
Copy file name to clipboardExpand all lines: src/core/prompts/sections/mcp-servers.ts
+9-15Lines changed: 9 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -47,16 +47,16 @@ export async function getMcpServersSection(
47
47
.join("\n\n")}`
48
48
: "(No MCP servers currently connected)"
49
49
50
-
constbaseSection=`MCP SERVERS
50
+
constbaseSection=`## MCP SERVERS
51
51
52
-
The Model Context Protocol (MCP) enables communication between the system and MCP servers that provide additional tools and resources to extend your capabilities. MCP servers can be one of two types:
52
+
MCP servers provide additional tools/resources:
53
+
- Local (Stdio-based): Run on user's machine
54
+
- Remote (SSE-based): Connect via HTTP/HTTPS
53
55
54
-
1. Local (Stdio-based) servers: These run locally on the user's machine and communicate via standard input/output
55
-
2. Remote (SSE-based) servers: These run on remote machines and communicate via Server-Sent Events (SSE) over HTTP/HTTPS
56
-
57
-
# Connected MCP Servers
58
-
59
-
When a server is connected, you can use the server's tools via the \`use_mcp_tool\` tool, and access the server's resources via the \`access_mcp_resource\` tool.
56
+
# Connected Servers
57
+
Use tools via:
58
+
- use_mcp_tool
59
+
- access_mcp_resource
60
60
61
61
${connectedServers}`
62
62
@@ -66,12 +66,6 @@ ${connectedServers}`
66
66
67
67
return(
68
68
baseSection+
69
-
`
70
-
## Creating an MCP Server
71
-
72
-
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:
73
-
<fetch_instructions>
74
-
<task>create_mcp_server</task>
75
-
</fetch_instructions>`
69
+
`\n## Creating MCP Server\nUse fetch_instructions when asked to create tools:\n<fetch_instructions>\n<task>create_mcp_server</task>\n</fetch_instructions>`
You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically.
7
-
8
-
1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
9
-
2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go.
10
-
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided.
11
-
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built.
12
-
5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`
5
+
1. Analyze task and set prioritized goals
6
+
2. Work through goals using tools one at a time
7
+
3. Before tool use:
8
+
- Analyze environment_details
9
+
- Select most relevant tool
10
+
- Verify required parameters are available
11
+
- Use ask_followup_question if missing params
12
+
4. Present results with attempt_completion
13
+
- Optional CLI demo command
14
+
5. Incorporate feedback without unnecessary conversation`
0 commit comments