Orchestrate

From epicsagas/epic-harness · View interactive version

Orchestrate is an AI agent skill from the GitHub repository epicsagas/epic-harness. Trigger: active multi-agent run. Handles inbox reading, dep resolution, message formatting, handoffs. Also provides status dashboard and intervention control via internal modes.

How to use this skill

Skill file

Skill: Orchestrate

CRITICAL: Run HARNESS_DIR=$(epic-harness path) first. NEVER use .harness/ in the project directory.

Mode: auto (default)

Triggered automatically when an active multi-agent orchestration is detected.

Step 1: Check orchestration state

  1. Run HARNESS_DIR=$(epic-harness path)
  2. Read $HARNESS_DIR/orchestrator/run.json
  3. If no active run, this skill does not apply — return

Step 2: Read agent inbox

  1. Read $HARNESS_DIR/orchestrator/agents/{my_id}/inbox.jsonl
  2. Process any pending messages from other agents or user interventions
  3. Messages from other agents: integrate into current task context
  4. Messages from user (via intervene redirect): adjust task accordingly

Step 3: Check control directives

  1. Read $HARNESS_DIR/orchestrator/control.json
  2. If a directive targets this agent (or "all"), act on it:
  1. After acting on a directive, increment generation in control.json to acknowledge

Step 4: Check dependencies

  1. Read $HARNESS_DIR/orchestrator/run.json dependency graph
  2. Identify which agents this agent depends on
  3. Read their status.json — if any dependency is not DONE, wait
  4. If all dependencies are DONE, proceed with task

Step 5: Execute with progress reporting

While working on the assigned task:

  1. The Rust orchestrate hook automatically appends events to stream.jsonl on each tool call
  2. Status updates happen automatically via the hook
  3. No manual progress reporting needed — the hook handles it

Step 6: Complete and hand off

When task is complete:

  1. Report status via structured output format (DONE/DONE_WITH_CONCERNS/BLOCKED/NEEDS_CONTEXT)
  2. The orchestrate hook will evaluate dependencies and notify downstream agents
  3. If results should be shared with specific agents, include in the output summary

Mode: status — Orchestration Dashboard

Read-only view of the current orchestration run. Displayed when user runs /status or asks about orchestration state.

Step 1: Check orchestration state

  1. Check if $HARNESS_DIR/orchestrator/run.json exists
  2. If the file does not exist, output:

> No active orchestration. Run /go or /orbit to start.

  1. If status is not "running", output:

> Last orchestration ended with status: {status}. No active run.

  1. If status is "running", proceed to Step 2.

Step 2: Read all agent states

Extract the agent list from run.json.agents. For each agent {id}:

  1. Read agent status from $HARNESS_DIR/orchestrator/agents/{id}/status.json (mark unknown if missing)
  2. Read the last 5 events from $HARNESS_DIR/orchestrator/agents/{id}/stream.jsonl (show "no events yet" if missing)
  3. Calculate elapsed time:
  1. Read the dependency graph from run.json.dependencies

Step 3: Render dashboard

Output a formatted dashboard (keep total under 30 lines):

## Orchestration Dashboard

- **Run ID**: {run.id}
- **Status**: {run.status}
- **Elapsed**: {total_elapsed since run.started_at}
- **Agents**: {count where status=running} / {total} active

| Agent | Role | Status | Elapsed | Last Event |
|-------|------|--------|---------|------------|
| {id} | {role} | {status} | {elapsed} | {summary of last event} |

### Dependency Graph
{render with ASCII arrows, e.g.:}
  builder ──→ reviewer ──→ integrator
  builder ──→ tester

### Recent Events (last 5 across all agents)
- [{timestamp}] {agent_id}: {event_summary}

### User Interventions
{read control.json; show directives if any, else "none"}

Dependency graph rendering rules:

Event summary formatting:

Step 4: Optional — file change summary

git diff --stat

If changes exist, append:

### File Changes
- {count} files modified ({insertions} insertions, {deletions} deletions)
- Key changes: {list up to 5 file paths}

Note: This mode is read-only — never modify orchestration state.


Mode: intervene — Agent Intervention

Write control directives that the orchestrate hook reads on the next agent tool call. Triggered when user runs /intervene.

Step 1: Check active orchestration

  1. Read $HARNESS_DIR/orchestrator/run.json
  2. If the action is resume, continue whenever run.json exists, whatever its status (resume is the documented way out of a pause or cancel block, also on aborted and complete runs). If run.json is missing, output: "No orchestration run to resume." and stop. For every other action, if status != "running", output: "No active orchestration to intervene in."
  3. Show current agent list with statuses

Step 2: Parse user command

Invocation format:

If the user provides no arguments, ask which action and target they want.

Validate the agent_id against the agent list in run.json (skip this for all). If not found, output: "Agent '{agent_id}' not found in active orchestration. Available agents: {list}" and stop.

Step 3: Write control directive

Read current generation from $HARNESS_DIR/orchestrator/control.json (or 0 if file doesn't exist). Increment by 1.

Write to $HARNESS_DIR/orchestrator/control.json:

{
  "action": "pause|cancel|redirect|resume",
  "target": "agent_id or 'all'",
  "message": "optional user message",
  "generation": <current_generation + 1>
}

For redirect, the message field contains the new instruction.

For pause/cancel, the message field is optional — use an empty string if none provided.

For resume, set action to "resume" and target to the agent_id or "all".

Additional actions by type:

Step 4: Confirm

Output confirmation:

Intervention recorded: {action} {target}
The {target} agent will respond on its next tool call.
Use /status to monitor.

For pause and cancel, also output: "New spawns stay blocked until /intervene resume {target} or 2 hours without run activity."

Notes:


Message Format Convention

When agents need to communicate (via SendMessage or future inbox/outbox):

{
  "from": "agent_id",
  "to": "agent_id",
  "type": "handoff|question|blocked|result",
  "body": "message content",
  "timestamp": "ISO-8601"
}

Anti-Rationalization

| Excuse | Rebuttal | What to do instead |

|--------|----------|-------------------|

| "I'll just work independently" | Orchestration exists to prevent conflicts and duplication | Check dependencies first, report status |

| "Progress reporting slows me down" | The hook does it automatically on every tool call | No manual action needed |

| "I'll read all agents' state" | Only read your own inbox and dependencies | Respect isolation boundaries |

| "I'll intervene directly in agent files" | Direct file edits bypass the generation protocol | Always write to control.json |

| "I'll skip the status check" | Stale state leads to incorrect interventions | Always read run.json first |

Evidence Required

Red Flags

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.