-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: add boomerang mode for deep planning with automatic task delegation #8277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,4 +192,16 @@ export const DEFAULT_MODES: readonly ModeConfig[] = [ | |
| customInstructions: | ||
| "Your role is to coordinate complex workflows by delegating tasks to specialized modes. As an orchestrator, you should:\n\n1. When given a complex task, break it down into logical subtasks that can be delegated to appropriate specialized modes.\n\n2. For each subtask, use the `new_task` tool to delegate. Choose the most appropriate mode for the subtask's specific goal and provide comprehensive instructions in the `message` parameter. These instructions must include:\n * All necessary context from the parent task or previous subtasks required to complete the work.\n * A clearly defined scope, specifying exactly what the subtask should accomplish.\n * An explicit statement that the subtask should *only* perform the work outlined in these instructions and not deviate.\n * An instruction for the subtask to signal completion by using the `attempt_completion` tool, providing a concise yet thorough summary of the outcome in the `result` parameter, keeping in mind that this summary will be the source of truth used to keep track of what was completed on this project.\n * A statement that these specific instructions supersede any conflicting general instructions the subtask's mode might have.\n\n3. Track and manage the progress of all subtasks. When a subtask is completed, analyze its results and determine the next steps.\n\n4. Help the user understand how the different subtasks fit together in the overall workflow. Provide clear reasoning about why you're delegating specific tasks to specific modes.\n\n5. When all subtasks are completed, synthesize the results and provide a comprehensive overview of what was accomplished.\n\n6. Ask clarifying questions when necessary to better understand how to break down complex tasks effectively.\n\n7. Suggest improvements to the workflow based on the results of completed subtasks.\n\nUse subtasks to maintain clarity. If a request significantly shifts focus or requires a different expertise (mode), consider creating a subtask rather than overloading the current one.", | ||
| }, | ||
| { | ||
| slug: "boomerang", | ||
| name: "🪃 Boomerang", | ||
| roleDefinition: | ||
| "You are Roo, a strategic planner and workflow orchestrator who combines deep analysis with automatic task delegation. You first thoroughly analyze and plan complex projects, then automatically delegate the implementation to appropriate specialized modes based on your analysis.", | ||
| whenToUse: | ||
| "Use this mode when you need both deep planning analysis and automatic task execution. Perfect for complex projects that benefit from upfront strategic planning followed by coordinated implementation across multiple specialties.", | ||
| description: "Deep planning followed by automatic task delegation", | ||
| groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"], | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fileRegex currently matches only lowercase ".md". Consider supporting ".MD" and ".markdown" variants. Suggested patterns without flags: ".(?:[Mm][Dd]|[Mm]arkdown)$". If you prefer just markdown + md, ".(?:md|markdown)$" is fine but stays case-sensitive. Update tests accordingly if behavior changes. |
||
| customInstructions: | ||
| "Your role is to combine deep planning with automatic task delegation. Follow this workflow:\n\n## Phase 1: Deep Analysis and Planning\n\n1. **Information Gathering**: Use available tools to thoroughly understand the project context, existing codebase, requirements, and constraints.\n\n2. **Strategic Planning**: Break down the complex task into clear, actionable steps. Create a comprehensive plan that includes:\n - Project overview and objectives\n - Technical architecture and design decisions\n - Detailed task breakdown with dependencies\n - Risk assessment and mitigation strategies\n - Success criteria for each component\n\n3. **Documentation**: Create or update a markdown file (e.g., `boomerang-plan.md`) with your analysis and plan using the `update_todo_list` tool to track tasks.\n\n## Phase 2: Automatic Task Delegation\n\n4. **Task Creation**: Based on your plan, automatically create subtasks using the `new_task` tool. For each subtask:\n - Choose the most appropriate mode based on the task requirements\n - Provide comprehensive context from your analysis\n - Include specific implementation details from your plan\n - Set clear success criteria\n - Ensure tasks are properly sequenced based on dependencies\n\n5. **Workflow Management**: \n - Track the progress of delegated tasks\n - Analyze results as they complete\n - Adjust the plan if needed based on outcomes\n - Create follow-up tasks as necessary\n\n6. **Synthesis**: When all tasks are complete, provide a comprehensive summary of:\n - What was planned vs what was accomplished\n - Any deviations from the original plan and why\n - Lessons learned and recommendations\n\n## Key Principles:\n\n- **Think First, Act Second**: Always complete thorough analysis before delegating tasks\n- **Context is King**: Provide rich context to each subtask based on your analysis\n- **Adaptive Planning**: Be ready to adjust based on subtask results\n- **Clear Communication**: Explain your planning rationale and delegation decisions\n\nThis mode is ideal for complex projects where upfront planning significantly improves execution efficiency and quality.", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding guardrails in the instructions (e.g., token budget, max subtasks, or confirmation threshold) before spawning many subtasks. This addresses cost concerns raised in Issue #8276 and reduces the risk of runaway delegation. |
||
| }, | ||
| ] as const | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,6 +400,90 @@ describe("FileRestrictionError", () => { | |
| }) | ||
| }) | ||
|
|
||
| describe("boomerang mode", () => { | ||
| it("is configured correctly", () => { | ||
| const boomerangMode = modes.find((mode) => mode.slug === "boomerang") | ||
| expect(boomerangMode).toBeDefined() | ||
| expect(boomerangMode).toMatchObject({ | ||
| slug: "boomerang", | ||
| name: "🪃 Boomerang", | ||
| roleDefinition: | ||
| "You are Roo, a strategic planner and workflow orchestrator who combines deep analysis with automatic task delegation. You first thoroughly analyze and plan complex projects, then automatically delegate the implementation to appropriate specialized modes based on your analysis.", | ||
| groups: [ | ||
| "read", | ||
| ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], | ||
| "browser", | ||
| "mcp", | ||
| ], | ||
| }) | ||
| expect(boomerangMode?.customInstructions).toContain("Phase 1: Deep Analysis and Planning") | ||
| expect(boomerangMode?.customInstructions).toContain("Phase 2: Automatic Task Delegation") | ||
| expect(boomerangMode?.whenToUse).toContain( | ||
| "Use this mode when you need both deep planning analysis and automatic task execution", | ||
| ) | ||
| expect(boomerangMode?.description).toBe("Deep planning followed by automatic task delegation") | ||
| }) | ||
|
|
||
| it("allows boomerang mode to edit markdown files only", () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add parity tests to ensure file restrictions apply to all edit tools for "boomerang" (search_and_replace, insert_content), similar to the architect-mode tests above. This prevents regressions that could bypass markdown-only constraints. |
||
| // Should allow editing markdown files | ||
| expect( | ||
| isToolAllowedForMode("write_to_file", "boomerang", [], undefined, { | ||
| path: "plan.md", | ||
| content: "# Project Plan", | ||
| }), | ||
| ).toBe(true) | ||
|
|
||
| // Should allow applying diffs to markdown files | ||
| expect( | ||
| isToolAllowedForMode("apply_diff", "boomerang", [], undefined, { | ||
| path: "boomerang-plan.md", | ||
| diff: "- old\n+ new", | ||
| }), | ||
| ).toBe(true) | ||
|
|
||
| // Should reject non-markdown files | ||
| expect(() => | ||
| isToolAllowedForMode("write_to_file", "boomerang", [], undefined, { | ||
| path: "script.js", | ||
| content: "console.log('test')", | ||
| }), | ||
| ).toThrow(FileRestrictionError) | ||
| expect(() => | ||
| isToolAllowedForMode("write_to_file", "boomerang", [], undefined, { | ||
| path: "script.js", | ||
| content: "console.log('test')", | ||
| }), | ||
| ).toThrow(/Markdown files only/) | ||
|
|
||
| // Should maintain read capabilities | ||
| expect(isToolAllowedForMode("read_file", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("browser_action", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("use_mcp_tool", "boomerang", [])).toBe(true) | ||
| }) | ||
|
|
||
| it("has access to new_task tool for delegation", () => { | ||
| // Should have access to new_task tool (part of ALWAYS_AVAILABLE_TOOLS) | ||
| expect(isToolAllowedForMode("new_task", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("update_todo_list", "boomerang", [])).toBe(true) | ||
| }) | ||
|
|
||
| it("has access to planning and analysis tools", () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a negative test to verify "execute_command" is NOT allowed for "boomerang" (since the "command" group is absent). Example: expect(isToolAllowedForMode("execute_command","boomerang",[])).toBe(false). This protects the permission boundary from future changes. |
||
| // Should have access to read tools for analysis | ||
| expect(isToolAllowedForMode("read_file", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("search_files", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("list_files", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("list_code_definition_names", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("codebase_search", "boomerang", [])).toBe(true) | ||
|
|
||
| // Should have access to browser for research | ||
| expect(isToolAllowedForMode("browser_action", "boomerang", [])).toBe(true) | ||
|
|
||
| // Should have access to MCP tools | ||
| expect(isToolAllowedForMode("use_mcp_tool", "boomerang", [])).toBe(true) | ||
| expect(isToolAllowedForMode("access_mcp_resource", "boomerang", [])).toBe(true) | ||
| }) | ||
| }) | ||
|
|
||
| describe("getFullModeDetails", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "🪃" emoji is also used by the Orchestrator mode name, which can be confusing in icon-first UIs. Consider a distinct emoji (e.g., "🔁" or "🏹") to improve scannability.