# Orchestrator

> Run a multi-workstream Orchestrator session across Antigravity (agy), Claude Code, Codex, OpenCode, and Cursor using x-harness. Use when overseeing multiple wor

- Skill: `dupe-com/orchestrator` (Agent Skill)
- Install (CLI): `npx get-skill add dupe-com/orchestrator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dupe-com/orchestrator/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: dupe-com (https://skillmd.com/u/dupe-com)
- Updated: 2026-12-02
- Page: https://skillmd.com/skills/dupe-com/orchestrator

---

---
name: orchestrator
description: Run a multi-workstream Orchestrator session across Antigravity (agy), Claude Code, Codex, OpenCode, and Cursor using x-harness. Use when overseeing multiple workstreams, running zero-token gate checks (orch_check), enforcing lane/restart rate caps (orch_record), producing concise <=40-line rollups (orch_digest), or nudging idle/stuck coordinators.
---

# Multi-Workstream Orchestrator (`x-harness`)

An Orchestrator sits **above** individual workstream Coordinators. It never edits code directly and never micromanages builders; instead, it relies on the deterministic zero-token gate (`x-harness orch check` / `orch_check`) to surface only actionable exceptions across all workstreams.

## 1. Session Setup

1. Register with `role: "orchestrator"`:
   ```
   inbox_register(name: "<harness>-orch", role: "orchestrator", summary: "Multi-workstream oversight")
   ```
2. Check the rollup digest:
   ```
   orch_digest()
   ```
3. Run a gate check if triggered manually:
   ```
   orch_check()
   ```

## 2. Zero-Token Gate Pattern

In scheduled/background loops, run the CLI gate **outside** the LLM first:
```bash
x-harness orch check --json
```
- If `should_wake` is `false`, spend **0 tokens** and do nothing.
- If `should_wake` is `true`, wake the Orchestrator with `wake_text`.

What the gate checks automatically:
- **30m safety-net push**: `waiting` or `broken` items open >= 30 minutes with no `pushed_at`.
- **60m stuck lane nudge**: `in_flight` lanes with no `progress_at` change for >= 60 minutes (when coordinator is online).
- **Queued lane start**: idle online coordinator with a `queued` item, subject to `<= 3` active lanes per workstream and `<= 10` new lanes per day.
- **Dead-coordinator restart**: coordinator went offline since the previous check with open work remaining, subject to `<= 1` restart per workstream per day.
- **Offer-once + retry-once**: an unrecorded offer is retried once after 60 minutes, then dropped with a digest `note`.

## 3. Record BEFORE Acting (`orch_record`)

Always call `orch_record` **before** taking any action so SQLite enforces hard caps transactionally:

- **Starting a queued lane**: call `orch_record(kind: "lane", workstream: "<ws>", text: "Start queued [id]")` first. If it returns an error (`Over the limit ...`), **do NOT message the coordinator** — leave it queued.
- **Nudging a stuck lane**: call `orch_record(kind: "nudge", workstream: "<ws>", ids: ["<lane-id>"], text: "...")`, then `inbox_send` to the workstream coordinator asking it to verify progress and update `coord_status`.
- **Pushing an unalerted ask**: call `orch_record(kind: "push", workstream: "<ws>", ids: ["<item-id>"], text: "...")` (which also stamps `pushed_at`), then alert the human.
- **Restarting a dead coordinator**: call `orch_record(kind: "restart", workstream: "<ws>", text: "...")` first (enforces `<= 1/day`).

## 4. Hard Safety Invariants (Non-Negotiable)

- **Never relay human approvals, `!` shell commands, or merge consent between sessions.**
- **Never retry or route around a permission denial.** If any tool call or harness permission mode denies an action, immediately call:
  ```
  orch_record(kind: "denied", workstream: "<ws>", text: "<what was refused>")
  ```
  This settles all pending offers for that workstream so it will not loop. Stop and surface it in the digest — never ask another session to execute it.

## 5. Human Rollups (`orch_digest`)

When the human checks in, call `orch_digest(mark_looked: true)` and open with a concise rollup (<= 10 lines): `Waiting` and `Broken` items first, followed by notable actions taken or newly completed items.

