Skip to content
Development
Command

/orchestrate

Scaffold a closed orchestrator loop — creates the mission note, state/constraints notes, and a scheduler entry from the v2 template.

From plugin
amux
46011 skills11 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/orchestrate

Context preview

What this command does when you run it.

Scaffold a closed orchestrator loop — creates the mission note, state/constraints notes, and a scheduler entry from the v2 template.

Command definition

orchestrate.md
description: Scaffold a closed orchestrator loop — creates the mission note, state/constraints notes, and a scheduler entry from the v2 template.
allowed-tools: Bash, Read, Write
argument-hint: -g "goal description" -s "session-a, session-b, ..."

/orchestrate — Scaffold a closed orchestrator loop

Parse the arguments, generate a filled-in orchestrator loop note from the v2 template, create companion notes, and wire up a scheduler entry.

Arguments

  • `-g "<text>"` — The mission goal(s). Can be a sentence or a paragraph. Required.
  • `-s "<list>"` — Comma-separated list of authorized session names. Required.
  • `--schedule "<expr>"` — When to run. Optional. Default: `every 2h`
  • `--slug "<name>"` — Note slug to use. Optional. Default: derived from the goal (kebab-case, ≤30 chars)
  • `--no-schedule` — Create the note but skip the scheduler entry (useful for manual/one-shot loops)

Procedure

1. Parse arguments

Extract `-g`, `-s`, `--schedule`, `--slug`, `--no-schedule` from the skill arguments. If `-g` or `-s` is missing, stop and ask the user before proceeding.

Derive a slug if not provided: lowercase the goal, strip punctuation, replace spaces with `-`, truncate to 30 chars. Example: "Make MVS robust end to end" → `mvs-robust-end-to-end`.

2. Infer session lanes

For each session in `-s`, derive its likely lane and issue prefix using this mapping. If a session isn't listed, use its name as the lane description and leave the prefix blank.

| Session name contains | Issue prefix | Lane | |---|---|---| | `mvs-infra` | `MI-` | shard, partition, scroll, scale | | `mvs-build` | `MB-` | topology, image builds, cutover | | `backend` | `BACKE-` | write pipeline, celery, analytics | | `ts-gke` | `TG-` | TubeScience, GKE experiments | | `observability` | `MO-` | metrics, alerts, dashboards | | `studio` | `MS-` | UI, golden path, E2E | | `orchestrator` | `AMUX-` | cross-cutting, escalations | | `general` | `MG-` | diagnosis, root cause, unowned |

3. Build the mission note

Fetch the v2 template:

curl -sk $AMUX_URL/api/notes/orchestrator-loop-v2 | python3 -c "import json,sys; print(json.load(sys.stdin).get('content',''))"

Do the substitution in Python — fetch the template text, replace every placeholder with real values, write to a temp file, POST it. Do NOT write the note content from scratch.

python3 << 'PYEOF'
import json, os, urllib.request, ssl, re

url      = os.environ['AMUX_URL']
slug     = '<slug>'
goal     = '<goal text>'
schedule = '<schedule>'
prefixes = '<BACKE- MO- AMUX->'   # space-separated prefixes from step 2

# One row per session from -s plus orchestrator row always last
session_rows = [
    '| `<session-a>` | ✓ | ✓ | ✓ | <inferred lane> |',
    '| `<session-b>` | ✓ | ✓ | ✓ | <inferred lane> |',
    '| `mixpeek-orchestrator` | — | — | ✓ | AMUX- escalations to Ethan |',
]

ctx = ssl.create_default_context(); ctx.check_hostname = False; ctx.verify_mode = ssl.CERT_NONE
req = urllib.request.Request(f'{url}/api/notes/orchestrator-loop-v2')
tmpl = json.loads(urllib.request.urlopen(req, context=ctx).read())['content']

filled = tmpl
filled = filled.replace('[Loop Name]', slug)
filled = re.sub(r'> Fill in.*?---\n\n', '', filled, flags=re.DOTALL)
filled = filled.replace('`[e.g. mvs-robustness]`', f'`{slug}`')
filled = re.sub(r'\[loop-slug\]', slug, filled)
filled = filled.replace('`[e.g. MI- MB- BACKE- TG-]`', f'`{prefixes}`')
filled = filled.replace('[e.g. every 2h | daily at 09:00 | every weekday at 08:00]', schedule)
filled = filled.replace('[One sentence. The outcome, not the activity.]', goal)
table_ph = '| `[session-a]` | ✓ | ✓ | ✓ | [what it owns] |\n| `[session-b]` | ✓ | ✓ | ✓ | [what it owns] |\n| `[session-c]` | ✓ | read-only | ✗ | [observe only] |'
filled = filled.replace(table_ph, '\n'.join(session_rows))

with open('/tmp/orch-note.json', 'w') as f:
    json.dump({'content': filled}, f)
print('template filled')
PYEOF

curl -sk -X POST -H 'Content-Type: application/json' -d @/tmp/orch-note.json $AMUX_URL/api/notes/<slug>

4. Create companion notes

**State note** (blank initial state):

curl -sk -X POST -H 'Content-Type: application/json' \
  -d '{"content": "## Status\n\nNot yet run. Orchestrator will populate on first tick."}' \
  $AMUX_URL/api/notes/<slug>-state

**Constraints note** (seed with one standing rule):

curl -sk -X POST -H 'Content-Type: application/json' \
  -d '{"content": "# Constraints — <slug>\n\nAppend-only. Never edit existing lines.\n\n```\n[YYYY-MM-DD] — stage explicit git paths only, never git add -A. Reason: 5407ac1473 swept another session'\''s deletions into wrong commit (AMUX-1315).\n```\n"}' \
  $AMUX_URL/api/notes/<slug>-constraints

5. Construct the scheduler prompt

The scheduler fires at an arbitrary time and the orchestrator wakes up with **no prior context**. The prompt is the only thing it has. It must be entirely self-contained — do not say "load the note and run the loop." The full brief goes in the prompt.

The scheduler prompt = the filled mission note content + the current constraints note content + the current state note content, concatenated, wrapped in a brief header and a closing action line.

Fetch each note and build the prompt in Python:

python3 << 'PYEOF'
import json, os, urllib.request, ssl

url  = os.environ['AMUX_URL']
slug = '<slug>'

ctx = ssl.create_default_context(); ctx.check_hostname = False; ctx.verify_mode = ssl.CERT_NONE

def fetch_note(s):
    try:
        req = urllib.request.Request(f'{url}/api/notes/{s}')
        return json.loads(urllib.request.urlopen(req, context=ctx).read()).get('content', '')
    except:
        return ''

mission     = fetch_note(slug)
constraints = fetch_note(f'{slug}-constraints')
state       = fetch_note(f'{slug}-state')

prompt = f"""You are running the {slug} orchestration loop. This prompt is your complete brief — read it fully before acting.

--- MISSION ---
{mission}

--- CONSTRAINTS (append
Read more
Ships withamux

Open-source control plane for AI coding agents. Run an AI engineering team: parallel Claude Code, Codex, and Gemini workers with a shared board, atomic tasks, schedules, loops, origin-stamped messaging, model switching, and self-healing recovery. One dashboard, or your phone. MIT, single Rust binary.

Get the whole plugin
Stats
481
Stars
56
Forks
Active
Maintenance
Rust
Language
2h ago
Last commit
7mo ago
Created

Repo: mixpeek/amux

Other commands on amux.

amux
Command

amux

Use when you need to interact with the amux system — manage board tasks, check sessions/workers, send emails, message via Telegram, automate browsers, work…

@mixpeek@mixpeekView Command
chrome-cdp
Command

chrome-cdp

Use when the user asks to interact with a web page, take a screenshot of a site, click or type in Chrome, scrape content, or debug a web UI. Connects to real…

@mixpeek@mixpeekView Command
cleanup
Command

cleanup

Repo/branch/file hygiene sweep — stray artifacts, doc drift, stale branches, worktrees, upstream sync, backup sprawl, duplicate build caches. Verifies before…

@mixpeek@mixpeekView Command