plugins/claude-ops/skills/ops-orchestrate/SKILL.md
Autonomous multi-project orchestration engine. Audits all registered projects, structures work into dependency-wired tasks, dispatches parallel agents (subagents or Agent Teams), audits completions, and ships PRs. Registry-driven — works for any user with a configured project registry.
npx skillsauth add davepoon/buildwithclaude ops-orchestrateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before orchestrating, load:
cat ${CLAUDE_PLUGIN_DATA_DIR:-$HOME/.claude/plugins/data/ops-ops-marketplace}/preferences.json — read owner, timezone, yolo_enabled, registry pathcat ${CLAUDE_PLUGIN_DATA_DIR}/daemon-health.json — ensure all services healthy before dispatchingGITHUB_TOKEN, SENTRY_AUTH_TOKEN, LINEAR_API_KEY, ANTHROPIC_API_KEY${CLAUDE_PLUGIN_DATA_DIR}/memories/topics_active.md for priority context| Command | Usage | Output |
|---------|-------|--------|
| gh pr list --state open --json number,title,statusCheckRollup,reviewDecision,mergeable,isDraft | Open PRs with status | JSON array |
| gh pr view <n> --repo <repo> --json files,additions,deletions | PR file diff summary | JSON |
| gh pr checks <n> | CI check status | Check list |
| gh pr merge <n> --squash --admin | Squash merge PR | Merge result |
| gh run list --repo <repo> --workflow "<workflow>" --limit 5 --json conclusion,headBranch | CI runs for workflow | JSON array |
| gh run view <id> --repo <repo> --log-failed | Failed CI logs | Log output |
| gh issue list --state open | Open issues | JSON array |
| Command | Usage | Output |
|---------|-------|--------|
| sentry-cli issues list --project <slug> --status unresolved | Unresolved issues | Issue list |
| curl -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" "https://sentry.io/api/0/projects/<org>/<proj>/issues/?query=is:unresolved" | API fallback | JSON array |
| Command | Usage | Output |
|---------|-------|--------|
| curl -X POST https://api.linear.app/graphql -H "Authorization: $LINEAR_API_KEY" -H "Content-Type: application/json" -d '{"query":"{ issues(filter: {state: {type: {in: [\"started\",\"unstarted\"]}}}) { nodes { id title state { name } priority assignee { name } } } }"}' | Active issues | JSON |
You are the master orchestrator. Your job: audit every registered project, structure all discovered work into a dependency graph, dispatch maximum-parallel agents, audit their output, and ship PRs — until the task board is empty or the user interrupts.
No preamble. No "would you like me to". Execute immediately.
Detect where this skill was invoked:
# If invoked from a specific project directory (not ~), scope to that project
CWD="$(pwd)"
if [ "$CWD" != "$HOME" ] && [ -d "$CWD/.git" ]; then
echo "SCOPED:$CWD"
else
echo "GLOBAL"
fi
If $ARGUMENTS contains --project <alias>, use SCOPED mode for that alias regardless of CWD.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ORCHESTRATION MODE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
--subagents (default) Fire-and-forget. Cheapest. Best for:
- Independent single-repo fixes
- Tasks that don't need mid-flight changes
- Cost: ~1.5-2x base token usage
--teams Agent Teams with mid-flight steering. Best for:
- Cross-repo contract changes (API + consumer)
- Security/auth work touching 2+ repos
- When you need to redirect agents based on findings
- Cost: ~3-7x base token usage
--hybrid (recommended) Auto-selects per task. Teams for cross-repo
and security work, subagents for everything else.
Best balance of speed, cost, and coordination.
Cost: ~2-4x base token usage
--dry-run Audit + plan only. Shows what would be dispatched
without executing. Good for reviewing before committing.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
If no flag is passed, use AskUserQuestion:
[Subagents — fast & cheap] [Agent Teams — steerable] [Hybrid — auto-select] [Dry run — plan only]
--hybrid mode)Tag each task during Phase 2:
| Condition | Mode | Why |
|-----------|------|-----|
| Task touches 1 repo, no auth/payments/PII | subagent | Isolated, no coordination needed |
| Task touches 2+ repos (API schema + consumer) | team | Teammates coordinate schema handoff |
| Task touches auth, payments, PII, secrets | team | Security-reviewer teammate audits in real-time |
| Task is read-only (audit, report, analysis) | subagent | No risk, no coordination |
| Task depends on another in-flight task's output | team | SendMessage delivers output without re-dispatch |
Agent Teams requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. Check before using:
[ "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-0}" = "1" ] && echo "teams_available" || echo "teams_unavailable"
If --teams or --hybrid is requested but the flag is off, warn and fall back to --subagents.
SCOPED mode: Use only the current directory. Read .planning/STATE.md if it exists.
GLOBAL mode: Scan the project registry:
REGISTRY="${CLAUDE_PLUGIN_ROOT}/scripts/registry.json"
jq -r '.projects[] | "\(.alias)|\(.paths[0])|\(.repos[0] // "none")|\(.gsd // false)"' "$REGISTRY" 2>/dev/null
For each project path, verify it exists on disk. Skip missing paths.
Group projects into batches of ~8. Dispatch one audit subagent per batch (always subagents — audit is read-only, no steering needed):
Each audit agent checks:
git status --porcelain — uncommitted changesgit log origin/dev..HEAD --oneline — unpushed commitsgh pr list --state open --json number,title,statusCheckRollup,reviewDecision,mergeable,isDraft — open PRs + CIgh run list --limit 5 --json status,conclusion,name,headBranch,createdAt — recent CI runs.planning/STATE.md — current GSD phase + progress.planning/ROADMAP.md — upcoming phasesBefore creating tasks for CI failures:
# If latest run on dev/main is success → skip (intermittent or already fixed)
gh run list --repo <repo> --workflow "<workflow>" --limit 5 --json conclusion,headBranch \
--jq '[.[] | select(.headBranch == "dev" or .headBranch == "main")] | .[0].conclusion'
success → skipfailure AND 2+ prior also failure → create task (persistent)failure but prior = success → create P2 task (new regression)Run these in parallel with the audit agents:
mcp__sentry__search_issues or sentry-cli issues list — P0/P1 unresolved errorsmcp__linear__list_issues for current sprint — in-progress and unstartedgh issue list --state open per repoTaskList — check current task board. Flag:
completedEach task should be:
TaskCreate({
title: "fix: resolve auth middleware race condition",
description: "File: src/middleware/auth.ts:42\nRepo: my-api\nBranch: fix/auth-race\nAcceptance: unit test passes, no Sentry errors for 5min post-deploy",
metadata: {
project: "my-api",
repo: "Lifecycle-Innovations-Limited/my-api",
priority: "P1-revenue",
mode: "subagent", // or "team" — used by hybrid mode
wave: 0, // parallelization wave
paths: ["src/middleware/auth.ts", "tests/auth/"],
quality_gate: "npm run type-check && npm run lint && npm run test:unit"
}
})
Rules for dependency wiring:
addBlockedBy when the output of task A is genuinely required as input for task B.Common dependency patterns:
Anti-patterns to AVOID:
Wave 0: All tasks with ZERO dependencies → dispatch ALL simultaneously
Wave 1: Tasks blocked only by wave 0 items → dispatch as each blocker clears
Wave N: Cascade — but NEVER wait for the full wave to clear.
Start each task the MOMENT its specific blockers resolve.
Apply the decision matrix from above to tag each task as subagent or team.
Rules:
isolation: "worktree"model: "sonnet" on every Agent() call (saves quota)run_in_background: true — never block waitingin_progress via TaskUpdate before dispatchingAgent({
description: "Fix auth race condition in my-api",
model: "sonnet",
isolation: "worktree",
run_in_background: true,
prompt: "<full task brief with repo path, file paths, branch strategy, acceptance criteria, quality gate>"
})
Only when mode is --teams or task is tagged team in hybrid:
TeamCreate("wave-0-cross-repo")
Agent(team_name="wave-0-cross-repo", name="api-worker", model="sonnet", isolation="worktree",
prompt="<task brief with FILE OWNERSHIP boundaries>")
Agent(team_name="wave-0-cross-repo", name="mobile-worker", model="sonnet", isolation="worktree",
prompt="<task brief with FILE OWNERSHIP boundaries>")
File ownership (CRITICAL — prevents overwrites): Each teammate prompt MUST include:
Your files: src/api/auth.ts, src/middleware/*.ts, tests/auth/
Do NOT edit: src/api/users.ts (owned by api-worker), src/frontend/ (owned by mobile-worker)
Mid-flight steering (the killer feature):
SendMessage(to="api-worker", content="Schema changed — DTO is now UserResponseV2. Update imports.")
SendMessage(to="mobile-worker", content="API endpoint ready. New: POST /v2/users. Proceed with consumer.")
Cross-repo coordination pattern:
api-worker and consumer-worker on same teamSendMessage to consumer with the new types/endpointWHILE tasks remain:
1. TaskList → find ALL unblocked tasks
2. Dispatch up to 5 simultaneously (subagent or team per task tag)
3. As EACH agent completes → immediately audit (Phase 4)
4. As EACH audit passes → immediately ship (Phase 5)
5. As EACH ship completes → TaskList again, dispatch newly-unblocked
6. NEVER wait for full wave to clear before starting next items
Use Monitor to stream CI output from running checks instead of sleep-polling.
When an agent reports back, verify before marking complete:
gh pr view <n> --repo <repo> --json files,additions,deletions# From task metadata
cd <worktree> && eval "<quality_gate command>"
gh pr checks <n> — all green?security-reviewer subagentSendMessage(to="<worker>", content="Audit failed: <issue>. Fix and re-submit.")For each PR that passed audit:
gh api, resolve eachgh pr checks <n> — wait via Monitor if still runningmergeable state, resolve if neededgh pr merge <n> --squash --admin (use AskUserQuestion to confirm unless --force)# Check each in-flight agent's worktree for recent writes
for wt in .worktrees/*/; do
last_write=$(find "$wt" -maxdepth 3 -type f -newer /tmp/ops-orchestrate-start 2>/dev/null | wc -l)
echo "$(basename $wt): $last_write files changed since start"
done
Stalled agent protocol (>15 min since last write):
TaskStop → assess partial progress → re-dispatch with narrowed scopeSendMessage(to="<worker>", content="Status check — are you stuck?") → wait 60s → if no response, TaskStop and replaceNever re-dispatch the exact same prompt. The agent stalled for a reason. Narrow scope, add file paths, or split the task.
WHILE true:
TaskList → check board state
IF all tasks completed/blocked → print final report, HALT
IF pending unblocked tasks exist → go to Phase 3
IF all pending are blocked → surface blockers to user, HALT
Run Phase 5.5 liveness check on in-flight agents
Do NOT stop until:
completed, deleted, or explicitly blocked on user inputBetween waves:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OPS ► ORCHESTRATE — Wave N | Mode: [subagents/teams/hybrid]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TASK OWNER STATUS PR CI DEPLOY
──────────────────────────────────────────────────────────
fix auth api-worker ✓ done #4417 ✓ dev merged
update types mobile-worker ◉ wip #488 … —
add tests test-agent ○ queue — — —
Completed: N/T | In-flight: N | Queued: N | Blocked: N
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Final report:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OPS ► ORCHESTRATION COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Mode: [subagents/teams/hybrid]
Completed: N tasks, M PRs shipped, K promoted to main
Blocked: [list with rationale]
Follow-ups:[list with task IDs]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
security-reviewer audit.env, credentials, or secrets files — flag and skipgit reset --hard on shared branches| Flag | Effect |
|------|--------|
| (empty) | Full audit + execution, ask for mode |
| --subagents | Force subagent mode (cheapest) |
| --teams | Force Agent Teams mode (steerable, 3-7x cost) |
| --hybrid | Auto-select per task (recommended) |
| --dry-run | Phase 1+2 only, print plan, don't dispatch |
| --project <alias> | Scope to one project |
| --fires-only | Only P0 production-broken tasks |
| --no-main | Stop at dev merge, never touch main |
| --max-waves N | Cap at N waves then halt |
| --force | Skip merge confirmations |
Begin with Phase 1 immediately. Do not ask for confirmation (except mode selection if no flag).
development
Show drill-me learning progress — topics studied, cards due for review, weakest concepts, and what to study next. Use when the user asks what's due, how their learning is going, or for their drill-me status.
development
Teach the user a topic as an adaptive tutor — retrieval practice, spaced repetition with decay, and persistent memory in ~/.drill-me/. Use when the user wants to learn or be drilled on something, says "drill me on X", "teach me X", or wants to study a topic, a codebase, or a document.
development
Turn any codebase into evidence-grounded Markdown docs plus a machine-readable index.json. Every claim cites its source; never invents deployment steps.
tools
Assesses the current state of the startup project and recommends what to focus on next. Use when there is a need or a question from the user to understand what the next steps are or what to focus on next.