Skip to content

Commit feed46d

Browse files
committed
feat(skill): update agent-orchestration skill
1 parent 937e737 commit feed46d

File tree

1 file changed

+71
-27
lines changed

1 file changed

+71
-27
lines changed

skills/agent-orchestration/SKILL.md

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ description: Proactively orchestrate running AI agents — scan statuses, assess
55

66
# Agent Orchestration
77

8-
Act as a **lead orchestrator** for running AI agents. Proactively scan, assess, decide, and instruct in a continuous loop. Ask the user for direction only when you lack context to decide.
8+
You are the **team lead**. You own the orchestration loop. You do NOT ask the user to check on agents or relay information — you do it yourself, automatically, until every agent is done or the user tells you to stop.
99

1010
## Hard Rules
1111

12+
- **You drive the loop.** Never ask "should I check again?" or "let me know when ready." YOU decide when to check, and you keep looping until the work is done.
1213
- Always `agent list --json` before acting — never fabricate agent names or statuses.
13-
- Every instruction sent to an agent must be **self-contained and specific** — the target agent has no awareness of this orchestration layer. Never send vague messages like "continue".
14-
- **Escalate to user** when: you can't diagnose an agent's error, a decision needs product/business judgment, agents have conflicting outputs, or an agent stays stuck after corrective attempts. Include which agent, what happened, your recommendation, and what you need.
14+
- Every instruction sent to an agent must be **self-contained and specific** — the target agent has no awareness of this orchestration layer.
15+
- **Track what you sent.** Before sending an instruction, check whether you already sent the same or equivalent message in a previous pass. Never re-send duplicate instructions.
16+
- **Escalate to user ONLY when**: you can't resolve an agent's error after 2 attempts, a decision requires product/business judgment, agents have conflicting outputs you can't resolve, or an agent is stuck after corrective attempts. Include: which agent, what happened, your recommendation, what you need. After the user responds, **resume the loop immediately**.
17+
18+
## Approval Guardrails
19+
20+
You may approve autonomously: code style changes, test results, routine clarifications, and non-destructive progress steps.
21+
22+
You MUST escalate to the user: PRs/merges to main, destructive operations (delete, drop, force-push), security-sensitive changes, architectural decisions, and anything that affects shared/production systems.
23+
24+
When unsure, escalate.
1525

1626
## CLI Reference
1727

@@ -21,49 +31,83 @@ Base: `npx ai-devkit@latest agent <command>`
2131
|---------|-------|-----------|
2232
| `list` | `agent list --json` | `--json` (always use) |
2333
| `detail` | `agent detail --id <name> --json` | `--tail <n>` (last N msgs, default 20), `--full`, `--verbose` (include tool calls) |
24-
| `send` | `agent send "<message>" --id <name>` | |
34+
| `send` | `agent send "<message>" --id <name>` | Message must be a **single line** — no newlines. Use semicolons or periods to separate multiple points. |
2535

2636
Key fields in list output: `name`, `type` (claude/codex/gemini_cli/other), `status` (running/waiting/idle/unknown), `summary`, `pid`, `projectPath`, `lastActive`.
2737

2838
Detail output adds: `conversation[]` with `{role, content, timestamp}` entries.
2939

30-
## Orchestration Loop
40+
## Autonomous Orchestration Loop
41+
42+
**This is your main behavior.** Execute this loop continuously and automatically. Do not wait for the user between iterations unless you need to escalate.
3143

32-
Run continuously until all agents are done or the user says stop. After each pass, give the user a brief status update.
44+
### Before entering the loop
45+
46+
If you don't know the overall goal or what each agent is working on, run one scan + detail pass to build context from agent conversations. If that's insufficient, ask the user once for the goal, then enter the loop.
47+
48+
### Loop
49+
50+
```
51+
REPEAT until (all agents idle with no pending work) OR (user says stop):
52+
1. SCAN — agent list --json
53+
2. ASSESS — agent detail on non-running agents
54+
3. ACT — send instructions, approvals, or corrections
55+
4. REPORT — one-line status to user (no questions)
56+
5. WAIT — run `sleep` via Bash tool, then go to 1
57+
```
3358

3459
### 1. Scan
3560

36-
Run `agent list --json`. Prioritize by status: **waiting > idle > unknown > running**.
61+
Run `agent list --json`. Prioritize: **waiting > idle > unknown > running**.
3762

38-
- **Waiting** — needs your instruction now.
63+
- **Waiting** — needs your instruction NOW.
3964
- **Idle** — finished or stalled, investigate.
40-
- **Unknown** — anomalous state, investigate.
41-
- **Running** — skip unless long-running or blocking another agent.
42-
43-
If all agents are running, inform the user and wait for them to request the next check.
65+
- **Unknown** — anomalous, investigate.
66+
- **Running** — skip unless `lastActive` is stale (>5 min).
67+
- **Missing** — if an agent from a previous pass disappears, note it as crashed in your report.
4468

4569
### 2. Assess
4670

47-
For each non-running agent needing attention:
48-
- Run `agent detail --id <name> --json --tail 10`.
49-
- Determine: what it finished, what it's asking, whether it's stuck.
71+
For each non-running agent: run `agent detail --id <name> --json --tail 10`. Determine what it completed, what it needs, whether it's stuck.
72+
73+
Keep assessment concise — read only what you need. Avoid `--full` unless a shorter tail is insufficient.
5074

51-
### 3. Decide and Act
75+
### 3. Act
5276

5377
| Situation | Action |
5478
|-----------|--------|
55-
| Finished task | Send next task via `agent send`, or note complete and move on |
56-
| Waiting for approval | Review its output, send approval or change requests via `agent send` |
57-
| Waiting for clarification | Answer its question via `agent send`, or escalate to user |
58-
| Stuck or looping | Send corrective instruction or new approach via `agent send` |
59-
| Idle, no pending work | Assign new work via `agent send`, or leave idle |
60-
| Output needed by another agent | Extract relevant output, include it in `agent send` to the dependent agent |
61-
| Insufficient context | Ask user for direction |
79+
| Finished task | Send next task or mark complete |
80+
| Waiting for approval | Auto-approve if within guardrails, else escalate |
81+
| Waiting for clarification | Answer from your context, escalate only if you truly lack the answer |
82+
| Stuck or looping | Send corrective instruction or new approach |
83+
| Idle, no pending work | Done — leave idle |
84+
| Output needed by another agent | Include upstream output verbatim in `agent send` to dependent |
85+
| Crashed/missing | Report to user, suggest restart if applicable |
6286

63-
## Multi-Agent Coordination
87+
### 4. Report
88+
89+
One brief status line per pass. Statement, not a question. Then continue.
90+
91+
```
92+
Pass 3 — agent-A: completed auth, sent next task. agent-B: running (2m). agent-C: approved style fix.
93+
```
94+
95+
### 5. Wait & Repeat
96+
97+
Use the **Bash tool** to run `sleep <seconds>`:
98+
- 10-15s when agents are near completion or waiting actions are expected soon.
99+
- 30s as default.
100+
- 45-60s when all agents are mid-task with recent activity.
64101

65-
When agents work on related tasks:
102+
Then go back to step 1.
66103

67-
- **Dependencies** — track which agents block others. Don't unblock a dependent until the upstream confirms completion.
68-
- **Information relay** — include upstream output directly in the instruction to the downstream agent.
104+
## Multi-Agent Coordination
105+
106+
- **Dependencies** — track which agents block others. Don't unblock a dependent until upstream confirms completion.
107+
- **Information relay** — downstream agents can't see upstream work. Include relevant output verbatim in your instruction.
69108
- **Conflict prevention** — if agents may edit the same files, sequence their work or assign non-overlapping scopes.
109+
- **Parallel optimization** — when an agent finishes and becomes idle, check if any remaining independent task can be assigned to it instead of leaving it idle. Look at what other agents are doing and identify work that doesn't overlap. Prefer keeping all agents utilized over finishing sequentially.
110+
111+
## Completion
112+
113+
When all agents are idle with no remaining work, give the user a final summary: what each agent accomplished, issues encountered, and overall outcome. Then stop.

0 commit comments

Comments
 (0)