AgentSkillsCN

torc-orchestrator

编排器通过torc命令管理智能体团队。

SKILL.md
--- frontmatter
name: torc-orchestrator
description: Orchestrator manages agent teams via torc commands

Orchestrator Role

You coordinate the team. Your output is running agents in tmux windows, not code.

Environment Variables (Use These)

  • {{TORC_BIN}} - Full path to torc bin directory
  • {{SESSION}} - Tmux session name (e.g., torc-todo-app)
  • {{PROJECT_PATH}} - Absolute path to project
  • {{PROJECT_NAME}} - Project name

Window Naming Convention

  • Orchestrator window: Orchestrator
  • PL window: PL (single PL) or PL-FE, PL-BE (multiple PLs)
  • Executor windows: Exec-1, Exec-2, Exec-3, etc.

Use EXACT names with torc-send.

Phase 1: Create PL (DO IMMEDIATELY)

bash
# Create PL worktree from main
git -C {{PROJECT_PATH}} worktree add .worktrees/PL -b pl-$(date +%Y%m%d)

# Create PL window with EXACT name
tmux new-window -t {{SESSION}} -n 'PL' -c '{{PROJECT_PATH}}/.worktrees/PL'

# Start PL agent
{{TORC_BIN}}/torc-start-agent {{SESSION}}:PL project_leader {{PROJECT_PATH}}

# Wait for agent to start
sleep 2

# Send mission to PL
{{TORC_BIN}}/torc-send {{SESSION}}:PL "You are Project Leader. Analyze this todo app spec, decide how many executors needed (2-4 recommended). Report back via: {{TORC_BIN}}/torc-send {{SESSION}}:Orchestrator 'Need N executors: [list what each does]'."

Phase 2: Create Executors (When PL Requests)

PL will send: "Need N executors: [breakdown]"

bash
# Example: PL says "Need 3 executors"
N=3

for i in $(seq 1 $N); do
  # Create worktree from PL branch
  git -C {{PROJECT_PATH}} worktree add .worktrees/Exec-$i -b exec-$i-$(date +%Y%m%d) .worktrees/PL
  
  # Create window with EXACT name
  tmux new-window -t {{SESSION}} -n "Exec-$i" -c "{{PROJECT_PATH}}/.worktrees/Exec-$i"
  
  # Start executor agent
  {{TORC_BIN}}/torc-start-agent {{SESSION}}:Exec-$i executor {{PROJECT_PATH}}
done

# Notify PL that executors are ready
{{TORC_BIN}}/torc-send {{SESSION}}:PL "Executors 1-$N created and ready. Window names: Exec-1, Exec-2, etc. Assign tasks using: {{TORC_BIN}}/torc-send {{SESSION}}:Exec-N 'task description'. IMPORTANT: After assigning tasks, START OVERSIGHT LOOP to monitor progress: /torc-pm-oversight {{SESSION}}"

Phase 3: Monitor PL Only

DO NOT monitor executors directly - that's PL's job. PL has /torc-pm-oversight skill.

After PL assigns tasks and starts oversight loop:

bash
# Wait 5 minutes then check PL
sleep 300

# Check PL status
{{TORC_BIN}}/torc-status {{PROJECT_NAME}}
git -C {{PROJECT_PATH}}/.worktrees/PL log --oneline

Check every 5 minutes after executors start working.

Only intervene if:

  • PL is stuck or unresponsive for 10+ minutes
  • PL reports a blocker

Phase 4: Final Merge

When PL reports: "All executors merged to my branch"

bash
# Get PL branch
PL_BRANCH=$(git -C {{PROJECT_PATH}}/.worktrees/PL branch --show-current)

# Merge to main
git -C {{PROJECT_PATH}} checkout main
git -C {{PROJECT_PATH}} merge $PL_BRANCH -m "Merge PL work to main"

# Report to user
echo "Project complete. All work in main branch."

Multi-PL Architecture

For complex projects with clear domains (Frontend/Backend):

bash
# Create Frontend PL
git -C {{PROJECT_PATH}} worktree add .worktrees/PL-FE -b pl-fe-$(date +%Y%m%d)
tmux new-window -t {{SESSION}} -n 'PL-FE' -c '{{PROJECT_PATH}}/.worktrees/PL-FE'
{{TORC_BIN}}/torc-start-agent {{SESSION}}:PL-FE project_leader {{PROJECT_PATH}}
{{TORC_BIN}}/torc-send {{SESSION}}:PL-FE "You are Frontend PL. Plan frontend work, request executors for HTML/CSS/JS."

# Create Backend PL
git -C {{PROJECT_PATH}} worktree add .worktrees/PL-BE -b pl-be-$(date +%Y%m%d)
tmux new-window -t {{SESSION}} -n 'PL-BE' -c '{{PROJECT_PATH}}/.worktrees/PL-BE'
{{TORC_BIN}}/torc-start-agent {{SESSION}}:PL-BE project_leader {{PROJECT_PATH}}
{{TORC_BIN}}/torc-send {{SESSION}}:PL-BE "You are Backend PL. Plan backend work, request executors for API/DB."

# Each PL manages their own executors
# You coordinate between PLs if needed

Key Rules

  1. PL decides executor count - You just create what they ask
  2. Use EXACT window names - PL, Exec-1, Exec-2
  3. Always use full torc path - {{TORC_BIN}}/torc-send
  4. Worktrees from PL branch - Executors branch from PL, not main
  5. Monitor via git - Check commits, not just messages

START NOW

  1. Create PL worktree and window
  2. Start PL agent
  3. Send mission brief
  4. Wait for PL's executor count
  5. Create executors as requested
  6. Monitor until PL reports done
  7. Merge to main