Skip to content

Commit

Permalink
feat: make next step suggestions official
Browse files Browse the repository at this point in the history
- Remove next_step_suggest from experiments
- Make next step suggestions a required parameter in attempt_completion
- Update documentation to reflect next step suggestions as core functionality
- Remove experimental conditionals from objective and rules sections
  • Loading branch information
samhvw8 committed Feb 21, 2025
1 parent daf0593 commit ec14df6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/core/prompts/sections/objective.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function getObjectiveSection(experiments?: Record<string, boolean>): string {
export function getObjectiveSection(_?: Record<string, boolean>): string {
return `====
OBJECTIVE
Expand All @@ -8,6 +8,6 @@ You accomplish a given task iteratively, breaking it down into clear steps and w
1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
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.
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.
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. ${experiments?.["next_step_suggest"] ? "You must provide next step for user via attempt_completion tool by suggest next step" : ""}
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. You must provide next step for user via attempt_completion tool by suggest next step.
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.`
}
2 changes: 1 addition & 1 deletion src/core/prompts/sections/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ${getEditingInstructions(diffStrategy, experiments)}
- Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.
* For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$"
- When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices.
- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. ${experiments?.["next_step_suggest"] ? "You must provide for user next step with attempt_completion tool. " : ""}The user may provide feedback, which you can use to make improvements and try again.
- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. You must provide for user next step with attempt_completion tool. The user may provide feedback, which you can use to make improvements and try again.
- You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves.
- When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you.
- The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it.
Expand Down
33 changes: 9 additions & 24 deletions src/core/prompts/tools/attempt-completion.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,39 @@
import { ToolArgs } from "./types"

export function getAttemptCompletionDescription({ experiments }: ToolArgs): string {
export function getAttemptCompletionDescription(_: ToolArgs): string {
return `## attempt_completion
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. Optionally you may provide a CLI command to showcase the result of your work. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.
Parameters:
- result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance.
- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.${
experiments?.["next_step_suggest"]
? `
- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.
- next_step: (required) A list of suggested next tasks that logically follow from the completed work. Each suggestion must:
1. Be provided in its own <suggest> tag with two fields:
- task: The description of the suggested task
- mode: The available mode slug to execute the task in (e.g., "code", "architect", "ask")
2. Be specific, actionable, and directly related to the completed task
3. Be ordered by priority or logical sequence
4. Provide minimum 2-4 suggestions and maximum 12 suggestions`
: ``
}
4. Provide minimum 2-4 suggestions and maximum 12 suggestions
Usage:
<attempt_completion>
<result>
Your final result description here
</result>${
experiments?.["next_step_suggest"]
? `
</result>
<next_step>
<suggest>
<task>Implement authentication service tests</task>
<mode>code</mode>
</suggest>
</next_step>`
: ``
}
</next_step>
<command>Command to demonstrate result (optional)</command>
</attempt_completion>
Example: Basic completion with result and command
<attempt_completion>
<result>
I've updated the CSS styling for the navigation menu
</result>${
experiments?.["next_step_suggest"]
? `
</result>
<next_step>
<suggest>
<task>Add responsive design breakpoints for mobile devices</task>
Expand All @@ -56,13 +47,9 @@ I've updated the CSS styling for the navigation menu
<task>Create documentation for styling guidelines</task>
<mode>architect</mode>
</suggest>
</next_step>`
: ""
}
</next_step>
<command>open index.html</command>
</attempt_completion>${
experiments?.["next_step_suggest"]
? `
</attempt_completion>
Example: Completion with next step suggestions
<attempt_completion>
Expand Down Expand Up @@ -100,6 +87,4 @@ Note: When providing next step suggestions:
3. Provide minimum 2-4 suggestions and maximum 12 suggestions
4. Make each suggestion specific and actionable
5. Include appropriate mode for each suggestion based on the task type`
: ``
}`
}
7 changes: 0 additions & 7 deletions src/shared/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const EXPERIMENT_IDS = {
DIFF_STRATEGY: "experimentalDiffStrategy",
SEARCH_AND_REPLACE: "search_and_replace",
INSERT_BLOCK: "insert_content",
NEXT_STEP_SUGGEST: "next_step_suggest",
} as const

export type ExperimentKey = keyof typeof EXPERIMENT_IDS
Expand Down Expand Up @@ -36,12 +35,6 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
"Enable the experimental insert content tool, allowing Roo to insert content at specific line numbers without needing to create a diff.",
enabled: false,
},
NEXT_STEP_SUGGEST: {
name: "Use experimental next step suggest tool",
description:
"Enable the experimental next step suggest tool, allowing Roo to suggest prompts at task complete for you.",
enabled: false,
},
}

export const experimentDefault = Object.fromEntries(
Expand Down

0 comments on commit ec14df6

Please sign in to comment.