agent-fleet-guard
Skill1 starsChanged 3 months agoMITView on GitHub
Use before launching any large agent orchestration (fan-out) — roughly ≥20 subagents or an estimated ≥1M subagent tokens — and while such a fleet is in flight. Covers: quoting the cost to the human before dispatch, refusing to launch during unstable API connections, in-flight budget stop-loss, T+60s batch health checks, resume-cache traps, and two shell pitfalls that silently break wait loops. 触发词:大编排 / 批量派代理 / fan-out / 20 个代理 / 先报价 / 连接不稳 / 会不会烧太多 token / 这批代理要不要报价。English: “quote this fan-out first”, “is the fleet healthy”, “we're burning tokens”. Not for dispatching one or two agents — that needs no gate.
In this repository12 other files it gives its agents.
- audience-briefSkill
- blind-ab-verifySkill
- change-triageSkill
- codex-review-gateSkill
- group-discussion-reviewer-methodologySkill
- group-discussion-reviewerSkill
- lark-comment-loopSkill
- lark-peer-feedback-draftingSkill
- meeting-notesSkill
- metric-change-attributionSkill
- session-handoffSkill
- skill-evolve-loopSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before dispatch, run the estimator (same directory):
- Distinctive: line 31
No existing signal but the fan-out is over threshold?
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
agent-fleet-guard — guardrails for large agent orchestrations
Dispatching one agent is routine. Dispatching twenty is a spend decision — and a fleet that half-dies silently poisons everything downstream. Six guardrails, all paid for with real incidents.
Threshold: fan-out ≥ 20 subagents, or estimated ≥ 1M subagent tokens. Below that, just dispatch.
① Quote gate — quote first, wait for approval
Before dispatch, run the estimator (same directory):
./fleet_estimate.sh --agents <N> --per <rough-tokens-per-agent> --jsonExit 10 = over threshold (agents ≥ 20 or corrected estimate ≥ 1M) → you must quote and wait:
"Planning N agents, rough estimate X tokens, ×3 corrected ≈ Y tokens (both are floors, not ceilings) — the output is Z. Approve?"
Give both numbers — the rough estimate and the ×3 correction. Why ×3: a real fleet quoted at ~0.9M tokens burned ~2.7M — roughly 3×, and that was a lower bound. Per-agent guesses run low; the estimator's default --factor 3 bakes this in.
② Don't launch on an unstable connection
If this session has recently seen Connection closed / connection-lost errors: treat that as the signal, no probing needed — crashed agents burn their tokens for nothing, and fail-closed pipelines then demand a full rerun. The classic failure is seeing scattered disconnects and not counting them as a signal.
No existing signal but the fan-out is over threshold? Send 3 one-token probe agents first; any probe timing out >10s or erroring → unstable. Unstable → don't force it: split into smaller batches or wait.
③ In-flight stop-loss
While the fleet runs, track cumulative spend (orchestration frameworks expose a budget/spent counter; with散派 agents, sum their usage by hand). The moment spend crosses the approved number Y — stop and re-quote, without waiting to be asked.
Anchor on the approved number, not the rough estimate — you quoted ×3, so anchoring on the rough estimate false-alarms at ⅓ of every normal run.
./fleet_estimate.sh --agents N --per K --spent <spent> [--approved <approved>] # → over_budget④ Batch health check at T+60s
After a mass dispatch, verify at T+60s: launched count ≠ dispatched count, or empty returns → abort and report the gap. A fleet of 10 once died silently — nobody knew until a human asked. And never feed empty results downstream: three critics once faithfully reviewed a DRAFT: [] — reviewers working on a false premise produce confident garbage.
⑤ Resume-cache trap
Concurrent-pipeline resume caches match on (prompt, opts). One upstream crash → its output changes → every downstream prompt changes → the whole cache misses = full rerun anyway. Don't budget on resume saving you money in a concurrent pipeline. Recover with a deterministic continuation script reading your own journal instead.
⑥ Two wait-loop pitfalls (both silently break "wait for the fleet")
- Never use
pgrep -fto test liveness — it matches the wait loop itself (until ! pgrep -f "run.js"never exits, and no notification ever fires; the failure surfaces only when a human asks what those background jobs are doing). Watch for a completion marker in the output file instead:until grep -q "DONE" "$LOG"; do sleep 4; done. - Never pipe a long task into
head -N—headexits once it has enough, the next upstream write gets SIGPIPE and the task dies mid-run, leaving a stale artifact that you'll then validate new code against. Write to a log (> log 2>&1), then read the beginning withsed -n '1,30p'.
Scope note: this skill covers only what is specific to large fleets. Per-dispatch context construction and result integration belong to your normal dispatch workflow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

