|
| 1 | +# attempt_completion |
| 2 | + |
| 3 | +The `attempt_completion` tool signals that Roo believes a task is complete and presents results to the user. It provides a summary of what was accomplished, optionally includes a command to demonstrate the result, and supports continued refinement through user feedback. |
| 4 | + |
| 5 | +## Parameters |
| 6 | + |
| 7 | +The tool accepts these parameters: |
| 8 | + |
| 9 | +- `result` (required): The final result description summarizing what was accomplished |
| 10 | +- `command` (optional): A CLI command to execute to demonstrate the result |
| 11 | + |
| 12 | +## What It Does |
| 13 | + |
| 14 | +This tool marks the end of a task by presenting a final summary of what was accomplished. It signals to both the user and the system that the current task is complete. When a command is provided, it can also demonstrate the result through a live execution. |
| 15 | + |
| 16 | +## When is it used? |
| 17 | + |
| 18 | +- When Roo believes the user's task has been completed |
| 19 | +- When summarizing what changes or improvements were made |
| 20 | +- When demonstrating the current result with a command execution |
| 21 | +- When providing a checkpoint for user feedback on the solution |
| 22 | +- When transitioning from one phase of work to potential refinements |
| 23 | + |
| 24 | +## Key Features |
| 25 | + |
| 26 | +- Provides a clear signal that Roo believes the task is complete |
| 27 | +- Summarizes accomplishments in a concise message |
| 28 | +- Optionally demonstrates results through command execution |
| 29 | +- Enables user feedback for further refinements |
| 30 | +- Displays results in a special UI format distinct from regular messages |
| 31 | +- Captures task completion telemetry for system analytics |
| 32 | +- Maintains a structured conversation flow by providing checkpoints |
| 33 | +- Supports subtask completion within larger workflows |
| 34 | +- Ensures users receive a clear summary of what was done |
| 35 | +- Available in all modes as part of the "always available" tool group |
| 36 | + |
| 37 | +## Limitations |
| 38 | + |
| 39 | +- Should not be used until previous tool uses are confirmed successful (guideline, not enforced) |
| 40 | +- Limited to a single command for result demonstration |
| 41 | +- Cannot present multiple command options |
| 42 | +- Commands require user approval before execution |
| 43 | +- Limited to demonstrating results that can be shown via CLI commands |
| 44 | +- Cannot be used for partial task completion or progress updates |
| 45 | +- Result formatting strips XML closing tags through internal processing |
| 46 | + |
| 47 | +## How It Works |
| 48 | + |
| 49 | +When the `attempt_completion` tool is invoked, it follows this process: |
| 50 | + |
| 51 | +1. **Safety Consideration** (guideline, not enforced): |
| 52 | + - The AI is instructed to confirm previous tool uses were successful |
| 53 | + - This is a best practice rather than a programmatically enforced mechanism |
| 54 | + |
| 55 | +2. **Result Presentation**: |
| 56 | + - Displays the completion message to the user in a special "completion_result" UI format |
| 57 | + - Removes XML closing tags from the result text using the `removeClosingTag` function |
| 58 | + - Presents the result differently than regular messages for visual distinction |
| 59 | + |
| 60 | +3. **Command Execution** (if provided): |
| 61 | + - Requests user approval before executing the command |
| 62 | + - Only executes if the user approves |
| 63 | + - Executes the command using the system's command execution functionality |
| 64 | + - Shows the result of the command to the user |
| 65 | + |
| 66 | +4. **Feedback Collection**: |
| 67 | + - Waits for user feedback on the completion result |
| 68 | + - Processes this feedback and returns it to the AI |
| 69 | + - Enables continued refinement based on user input |
| 70 | + |
| 71 | +5. **Task Completion and Continuation**: |
| 72 | + - Signals the task as completed in the system |
| 73 | + - Captures telemetry data for the completed task |
| 74 | + - For subtasks, offers to finish the subtask and resume the parent task |
| 75 | + - Supports continued conversation through the feedback mechanism |
| 76 | + |
| 77 | +6. **Implementation Integration**: |
| 78 | + - Tool results are parsed through the system's parsing mechanism in `parse-assistant-message.ts` |
| 79 | + - The tool is part of the "ALWAYS_AVAILABLE_TOOLS" constant, making it available in all modes |
| 80 | + |
| 81 | +## Result Formatting Guidelines |
| 82 | + |
| 83 | +The result message should follow these guidelines: |
| 84 | + |
| 85 | +- Clearly communicate what was accomplished |
| 86 | +- Be concise but complete |
| 87 | +- Focus on the value delivered to the user |
| 88 | +- Avoid unnecessary pleasantries or filler text |
| 89 | +- Maintain a professional, straightforward tone |
| 90 | +- Present information in a way that's easy to scan and understand |
| 91 | +- Acknowledge that the user may provide feedback for further refinements |
| 92 | + |
| 93 | +Note: The system automatically strips XML closing tags from the result text through the `removeClosingTag` function. |
| 94 | + |
| 95 | +## Command Selection Guidelines |
| 96 | + |
| 97 | +When including a command, follow these guidelines: |
| 98 | + |
| 99 | +- Choose commands that visually demonstrate the result |
| 100 | +- Prefer commands that show the user what was created or modified |
| 101 | +- Examples include: |
| 102 | + * `open index.html` to display a created website |
| 103 | + * `npm start` to launch a development server |
| 104 | + * `python app.py` to run a created application |
| 105 | +- Avoid commands that merely print text (like `echo` or `cat`) |
| 106 | +- Remember that commands require user approval before execution |
| 107 | +- Ensure the command is valid for the user's operating system |
| 108 | + |
| 109 | +## Feedback and UI Representation |
| 110 | + |
| 111 | +The `attempt_completion` tool has a unique feedback mechanism: |
| 112 | + |
| 113 | +- Results appear in a special "completion_result" UI format distinct from regular messages |
| 114 | +- The system waits for user feedback after presenting the result |
| 115 | +- Feedback is processed and returned to Roo for further refinements |
| 116 | +- This creates an iterative improvement cycle rather than ending the conversation |
| 117 | +- The UI includes special elements for providing feedback |
| 118 | +- Results serve as clear checkpoints in the conversation flow |
| 119 | + |
| 120 | +When used within subtasks: |
| 121 | +- The system offers to finish the subtask and resume the parent task |
| 122 | +- If approved, the subtask is completed with a summary |
| 123 | +- The parent task resumes with context from the completed subtask |
| 124 | +- This enables complex, nested workflows while maintaining context |
| 125 | + |
| 126 | +## Examples When Used |
| 127 | + |
| 128 | +- When creating a website, Roo presents the solution and uses `open index.html` to show the result. The user provides feedback, and Roo refines the design. |
| 129 | +- When implementing a feature, Roo summarizes the changes and their impact. The user requests additional test coverage, and Roo continues the task. |
| 130 | +- When fixing bugs, Roo explains what was fixed and how the solution addresses the root cause. The user confirms the fix works. |
| 131 | +- When setting up a development environment, Roo confirms all components are installed. The user requests additional configuration, and Roo continues. |
| 132 | +- When creating a data processing script, Roo summarizes the functionality. The user suggests performance improvements, and Roo optimizes the code. |
| 133 | + |
| 134 | +## Usage Examples |
| 135 | + |
| 136 | + |
| 137 | +Completing a task with just a result summary: |
| 138 | +``` |
| 139 | +<attempt_completion> |
| 140 | +<result> |
| 141 | +I've updated the CSS for the navigation bar to match the design mockup. The changes include: |
| 142 | +1. Updated color scheme to use the new brand colors |
| 143 | +2. Added responsive behavior for mobile devices |
| 144 | +3. Fixed the alignment issues in the dropdown menus |
| 145 | +</result> |
| 146 | +</attempt_completion> |
| 147 | +``` |
| 148 | + |
| 149 | +Completing a task with a result and demonstration command: |
| 150 | +``` |
| 151 | +<attempt_completion> |
| 152 | +<result> |
| 153 | +I've created a simple React application with the following features: |
| 154 | +1. A responsive landing page with the requested hero section |
| 155 | +2. A working contact form with validation |
| 156 | +3. Navigation between all three requested pages |
| 157 | +4. Styling that matches the provided design mockup |
| 158 | +</result> |
| 159 | +<command>npm start</command> |
| 160 | +</attempt_completion> |
| 161 | +``` |
| 162 | + |
| 163 | +Completing a Python script task with execution: |
| 164 | +``` |
| 165 | +<attempt_completion> |
| 166 | +<result> |
| 167 | +I've created a data processing script that: |
| 168 | +1. Reads the CSV files from the data directory |
| 169 | +2. Cleans and normalizes the data as requested |
| 170 | +3. Generates the summary statistics in JSON format |
| 171 | +4. Outputs the processed data to the output directory |
| 172 | +</result> |
| 173 | +<command>python process_data.py</command> |
| 174 | +</attempt_completion> |
| 175 | +``` |
0 commit comments