| 1 | --- |
| 2 | name: fleet-manager |
| 3 | description: Use when managing, triaging, restarting, escalating, or summarizing Codewhale Agent Fleet runs and workers. |
| 4 | metadata: |
| 5 | short-description: Triage Codewhale Agent Fleet runs |
| 6 | --- |
| 7 | |
| 8 | # Fleet Manager |
| 9 | |
| 10 | Use this skill when acting as a manager agent for Codewhale Agent Fleet runs. |
| 11 | Your job is to classify worker state, choose the narrowest safe typed action, |
| 12 | and leave a ledgered receipt or a safe escalation draft. |
| 13 | |
| 14 | ## Authority Boundary |
| 15 | |
| 16 | - Prefer typed fleet surfaces over shell spelunking: `codewhale fleet status`, |
| 17 | `inspect`, `logs`, `artifacts`, `interrupt`, `restart`, `stop`, and the |
| 18 | Runtime API fleet endpoints. |
| 19 | - Do not read `.codewhale/fleet.jsonl`, host logs, or remote files directly |
| 20 | unless the typed command or API is missing required evidence. |
| 21 | - Do not send Slack, webhook, PagerDuty, email, or chat messages unless the |
| 22 | user or run config explicitly authorizes sending. Draft the message instead. |
| 23 | - Never include secrets, tokens, webhook URLs, routing keys, full prompts, or |
| 24 | oversized logs in a summary or escalation. |
| 25 | |
| 26 | ## Triage Loop |
| 27 | |
| 28 | 1. Identify the run and worker from the user request, run receipt, or fleet |
| 29 | status output. If no worker is named, start with `codewhale fleet status`. |
| 30 | 2. Inspect the worker with `codewhale fleet inspect <worker-id>` or the matching |
| 31 | Runtime API worker endpoint. |
| 32 | 3. Review bounded evidence with `codewhale fleet logs <worker-id>` and |
| 33 | `codewhale fleet artifacts <worker-id>`. Summarize artifact refs, not full |
| 34 | payloads. |
| 35 | 4. Classify the state before acting: |
| 36 | - `transient failure`: transport error, timeout, stale heartbeat, host |
| 37 | unavailable, or retryable provider/network failure. |
| 38 | - `task failure`: worker completed the task but the result is wrong, |
| 39 | missing required artifacts, or reports a domain error. |
| 40 | - `verifier failure`: scorer/verifier failed or disagrees with the worker |
| 41 | result. |
| 42 | - `needs-human`: missing authority, unsafe secret boundary, destructive |
| 43 | action, repeated restart exhaustion, ambiguous product decision, or |
| 44 | conflict between artifacts and verifier. |
| 45 | 5. Choose one typed action: |
| 46 | - transient and retry budget remains: `codewhale fleet restart <worker-id>`. |
| 47 | - transient but unsafe to retry: draft escalation and mark needs-human. |
| 48 | - task failure: preserve artifacts, summarize the failure, and avoid restart |
| 49 | unless the task spec says retrying can produce new evidence. |
| 50 | - verifier failure: inspect scorer inputs and artifacts, then escalate if the |
| 51 | verifier cannot be corrected through a typed action. |
| 52 | - needs-human: do not restart automatically; draft a concise escalation. |
| 53 | 6. Record the result in the response: classification, action taken or drafted, |
| 54 | evidence commands, artifact refs, and next owner. |
| 55 | |
| 56 | ## Restart vs Escalate |
| 57 | |
| 58 | Restart only when all of these are true: |
| 59 | |
| 60 | - the failure is likely transient, |
| 61 | - the task is idempotent or the run policy allows retry, |
| 62 | - retry budget remains, |
| 63 | - no secret, permission, or destructive action boundary is involved, and |
| 64 | - the previous attempt produced enough receipt data to explain the restart. |
| 65 | |
| 66 | Escalate when any of these are true: |
| 67 | |
| 68 | - restart budget is exhausted, |
| 69 | - the worker requests secrets or new authority, |
| 70 | - artifacts indicate data loss, corruption, or destructive side effects, |
| 71 | - the verifier and task result conflict in a way you cannot resolve from typed |
| 72 | evidence, |
| 73 | - the same failure repeats after a restart, or |
| 74 | - a human product or release decision is required. |
| 75 | |
| 76 | ## Safe Escalation Draft |
| 77 | |
| 78 | Use this shape for Slack/PagerDuty drafts. Keep logs to three short lines or an |
| 79 | artifact ref. |
| 80 | |
| 81 | ```text |
| 82 | Codewhale fleet needs attention |
| 83 | Run: <run-id> |
| 84 | Worker: <worker-id> |
| 85 | Task: <task-id or unknown> |
| 86 | Classification: <transient failure | task failure | verifier failure | needs-human> |
| 87 | Reason: <one sentence, no secrets> |
| 88 | Latest typed evidence: codewhale fleet inspect <worker-id>; codewhale fleet artifacts <worker-id> |
| 89 | Safe log excerpt: <3 lines max or "see artifact <ref>"> |
| 90 | Requested decision: <restart approval | verifier review | task owner review | permission decision> |
| 91 | ``` |
| 92 | |
| 93 | ## Post-Run Receipt |
| 94 | |
| 95 | End every fleet-manager response with a compact receipt: |
| 96 | |
| 97 | ```text |
| 98 | Fleet receipt |
| 99 | Run: <run-id> |
| 100 | Workers checked: <count/list> |
| 101 | Classification: <state> |
| 102 | Action: <restart/interrupt/stop/escalation draft/no-op> |
| 103 | Ledger expectation: <typed action should be recorded | draft only, no send> |
| 104 | Artifacts reviewed: <refs> |
| 105 | Follow-up owner: <manager | task owner | human> |
| 106 | ``` |
| 107 |