Boomerang Tasks:编排复杂工作流
Boomerang Tasks(也称为子任务或任务编排)允许您使用内置的 🪃 Orchestrator 模式(又称 Boomerang 模式) 将复杂项目分解为更小、更易于管理的部分。可以将其想象为将部分工作委派给专门的助手。每个子任务都在其自身的上下文中运行,通常会使用不同的 Roo Code 模式来专门处理特定工作(例如 💻 Code、🏗️ Architect 或 🪲 Debug)。Orchestrator 模式负责管理此过程。
🪃 Orchestrator 模式(以前通过自定义的“Boomerang 模式”实现)现在是一个专门用于编排工作流的内置模式,它通过将任务分解并委派给其他模式来实现。您不再需要为此功能创建自定义模式。
了解有关内置模式的更多信息。
为何使用 Boomerang Tasks?
- 处理复杂性: 将大型、多步骤的项目(例如构建完整功能)分解为专注的子任务(例如设计、实现、文档)。
- 使用专门的模式: 自动将子任务委派给最适合该特定工作的模式,利用专门的功能获得最佳结果。
- 保持专注和效率: 每个子任务都在其自身隔离的上下文中运行,并具有单独的对话历史。这可以防止父任务(编排器)被详细的执行步骤(如代码差异或文件分析结果)弄乱,从而使其能够高效地专注于高级工作流,并根据已完成子任务的简明摘要来管理整个过程。
- 简化工作流: 一个子任务的结果可以自动传递给下一个子任务,从而创建流畅的流程(例如,架构决策输入到编码任务中)。
工作原理
-
当处于
🪃 Orchestrator模式(又称 Boomerang 模式)时,Roo 会分析复杂任务并建议将其分解为子任务1。 -
父任务(在 Orchestrator 模式下)暂停,新的子任务开始在另一个专门的模式下运行2。
-
当子任务的目标达成时,Roo 会发出完成信号。
-
父任务仅使用子任务的摘要3恢复。父任务使用此摘要继续主要工作流。
关键注意事项
- 需要批准: 默认情况下,您必须批准每个子任务的创建和完成。如果需要,可以通过 Auto-Approving Actions 设置实现自动化。
- 上下文隔离和传递: 每个子任务都在完全隔离的环境中运行,并具有其自身的对话历史。它不会自动继承父任务的上下文。信息必须明确传递:
- 向下传递: 通过创建子任务时提供的初始指令。
- 向上传递: 通过子任务完成时提供的最终摘要。请注意,只有此摘要会返回到父任务。
- 导航: Roo 的界面可帮助您查看任务的层次结构(哪个任务是父任务,哪些是子任务)。您通常可以在活动和暂停的任务之间导航。
Boomerang Tasks 提供了一种在 Roo Code 中直接管理复杂开发工作流的强大方法,利用专门的模式实现最大效率。
使用子任务(通过 Orchestrator 模式委派)来保持清晰度。如果请求显著改变了焦点或需要不同的专业知识(模式),请考虑创建子任务,而不是使当前任务过载。
常见问题解答
为什么 Orchestrator 模式不能读取文件、写入文件、调用 MCP 或运行命令?
Orchestrator 模式被有意限制,以专注于高级工作流管理。默认情况下赋予其读取文件的能力会导致上下文被文件读取填满,从而妨碍其专注于编排的能力。设计理念是子任务应处理详细工作,并仅将必要信息(通过其完成摘要)返回给编排器,以便编排器有效地委派进一步的任务。
这种限制有助于防止上下文中毒,即无关或过多信息污染模型的活动上下文,导致性能下降和任务偏离。
如何覆盖 Orchestrator 模式的限制?
您可以通过遵循配置优先级系统来自定义 Orchestrator 模式,以添加文件读取等功能:
- 打开命令面板并选择 “Edit Global Modes”
- 复制并粘贴此配置:
{
"customModes": [
{
"slug": "orchestrator",
"name": "🪃 Orchestrator",
"roleDefinition": "You are Roo, a strategic workflow orchestrator who coordinates complex tasks by delegating them to appropriate specialized modes. You have a comprehensive understanding of each mode's capabilities and limitations, allowing you to effectively break down complex problems into discrete tasks that can be solved by different specialists.",
"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.",
"groups": [
"read"
],
"source": "global"
}
]
}
- 保存文件。现在,您的全局 Orchestrator 模式将具备读取能力。
为 Orchestrator 模式添加功能时应谨慎考虑。有限的默认功能有助于保持对编排工作的专注,而不是实现细节。