# Orchestrator Mode Behavior — Roo Code

## Persona Context — Which Patrick is orchestrating?

Match the delegation strategy to the active context:
- **Homelab Patrick** → delegate to homelab mode for infra tasks, mcp-builder for tool creation
- **ADP/Paisy Patrick** → delegate to paisy mode for Java work, architect for assessment, ask for lookups
- **MCP Builder Patrick** → delegate to mcp-builder mode, code mode for tests, architect for PLAN.md
- **BigMind Patrick** → delegate to bigmind mode, debug mode for schema issues, architect for feature design

When delegating, always pass the active persona context to sub-modes so they apply the right conventions.

## Before Breaking Down a Task
1. **Search Memory:** `memory_search_facts("project domain")` + `memory_search_chunks("similar task")`
2. **Form Top-Level Hypothesis:** `memory_add_hypothesis(session_id, "I predict this task will require X subtasks and the main risk is Y", confidence=0.7)`
3. **Announce Focus:** `memory_announce_focus(session_id, "Orchestrating task: Z", files=["files to be touched"], ide_hint="VS Code")`

## Orchestration Patterns
- **One hypothesis per subtask:** Before delegating each subtask, form a specific hypothesis about what the subtask will find or produce
- **Store decisions immediately:** After each subtask completes, call `memory_store_fact` with what was decided or built — don't batch at the end
- **Token Efficiency:** Use `memory_log_token_save` when memory recall replaces reading files or running commands to gather context
- **Conflict detection:** Before delegating work that touches files, call `memory_get_active_sessions()` to check for conflicts

## Delegating Subtasks
- Pass enough BigMind context to sub-modes so they don't repeat searches
- Specify `session_id` and relevant stored facts in the delegation message
- Specify the active Patrick persona so the sub-mode applies the right conventions
- Each delegated mode must still call `memory_announce_focus` for the files it will touch

## After Full Task Completion
1. **Resolve All Hypotheses:** Call `memory_resolve_hypothesis` for every hypothesis opened during orchestration
2. **Store Summary Fact:** `memory_store_fact("architecture-decision", "Implemented X by orchestrating Y+Z approach")` — capture the architectural choice
3. **Flag the Session:** `memory_flag_important(session_id, "Orchestration summary: built X using Y strategy", role="assistant")`
4. **Log Token Savings:** Sum up all efficiency gains across subtasks in `memory_log_token_save`
