Skip to content

Commit 8c0a638

Browse files
committed
feat: add boomerang mode for deep planning with automatic task delegation
- Combines deep analysis/planning phase with automatic task delegation - Similar to orchestrator but with upfront strategic planning - Allows editing markdown files for documentation - Has access to read, browser, and MCP tools for analysis - Includes comprehensive tests for the new mode - Addresses issue #8276 request for Cline deepplan-like functionality
1 parent 8dbd8c4 commit 8c0a638

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

packages/types/src/mode.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,16 @@ export const DEFAULT_MODES: readonly ModeConfig[] = [
192192
customInstructions:
193193
"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.",
194194
},
195+
{
196+
slug: "boomerang",
197+
name: "🪃 Boomerang",
198+
roleDefinition:
199+
"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.",
200+
whenToUse:
201+
"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.",
202+
description: "Deep planning followed by automatic task delegation",
203+
groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"],
204+
customInstructions:
205+
"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.",
206+
},
195207
] as const

src/shared/__tests__/modes.spec.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,90 @@ describe("FileRestrictionError", () => {
400400
})
401401
})
402402

403+
describe("boomerang mode", () => {
404+
it("is configured correctly", () => {
405+
const boomerangMode = modes.find((mode) => mode.slug === "boomerang")
406+
expect(boomerangMode).toBeDefined()
407+
expect(boomerangMode).toMatchObject({
408+
slug: "boomerang",
409+
name: "🪃 Boomerang",
410+
roleDefinition:
411+
"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.",
412+
groups: [
413+
"read",
414+
["edit", { fileRegex: "\\.md$", description: "Markdown files only" }],
415+
"browser",
416+
"mcp",
417+
],
418+
})
419+
expect(boomerangMode?.customInstructions).toContain("Phase 1: Deep Analysis and Planning")
420+
expect(boomerangMode?.customInstructions).toContain("Phase 2: Automatic Task Delegation")
421+
expect(boomerangMode?.whenToUse).toContain(
422+
"Use this mode when you need both deep planning analysis and automatic task execution",
423+
)
424+
expect(boomerangMode?.description).toBe("Deep planning followed by automatic task delegation")
425+
})
426+
427+
it("allows boomerang mode to edit markdown files only", () => {
428+
// Should allow editing markdown files
429+
expect(
430+
isToolAllowedForMode("write_to_file", "boomerang", [], undefined, {
431+
path: "plan.md",
432+
content: "# Project Plan",
433+
}),
434+
).toBe(true)
435+
436+
// Should allow applying diffs to markdown files
437+
expect(
438+
isToolAllowedForMode("apply_diff", "boomerang", [], undefined, {
439+
path: "boomerang-plan.md",
440+
diff: "- old\n+ new",
441+
}),
442+
).toBe(true)
443+
444+
// Should reject non-markdown files
445+
expect(() =>
446+
isToolAllowedForMode("write_to_file", "boomerang", [], undefined, {
447+
path: "script.js",
448+
content: "console.log('test')",
449+
}),
450+
).toThrow(FileRestrictionError)
451+
expect(() =>
452+
isToolAllowedForMode("write_to_file", "boomerang", [], undefined, {
453+
path: "script.js",
454+
content: "console.log('test')",
455+
}),
456+
).toThrow(/Markdown files only/)
457+
458+
// Should maintain read capabilities
459+
expect(isToolAllowedForMode("read_file", "boomerang", [])).toBe(true)
460+
expect(isToolAllowedForMode("browser_action", "boomerang", [])).toBe(true)
461+
expect(isToolAllowedForMode("use_mcp_tool", "boomerang", [])).toBe(true)
462+
})
463+
464+
it("has access to new_task tool for delegation", () => {
465+
// Should have access to new_task tool (part of ALWAYS_AVAILABLE_TOOLS)
466+
expect(isToolAllowedForMode("new_task", "boomerang", [])).toBe(true)
467+
expect(isToolAllowedForMode("update_todo_list", "boomerang", [])).toBe(true)
468+
})
469+
470+
it("has access to planning and analysis tools", () => {
471+
// Should have access to read tools for analysis
472+
expect(isToolAllowedForMode("read_file", "boomerang", [])).toBe(true)
473+
expect(isToolAllowedForMode("search_files", "boomerang", [])).toBe(true)
474+
expect(isToolAllowedForMode("list_files", "boomerang", [])).toBe(true)
475+
expect(isToolAllowedForMode("list_code_definition_names", "boomerang", [])).toBe(true)
476+
expect(isToolAllowedForMode("codebase_search", "boomerang", [])).toBe(true)
477+
478+
// Should have access to browser for research
479+
expect(isToolAllowedForMode("browser_action", "boomerang", [])).toBe(true)
480+
481+
// Should have access to MCP tools
482+
expect(isToolAllowedForMode("use_mcp_tool", "boomerang", [])).toBe(true)
483+
expect(isToolAllowedForMode("access_mcp_resource", "boomerang", [])).toBe(true)
484+
})
485+
})
486+
403487
describe("getFullModeDetails", () => {
404488
beforeEach(() => {
405489
vi.clearAllMocks()

0 commit comments

Comments
 (0)