/flow-extras:ultracode [task to run at fleet scale — omit to arm posture for the session]from flow-extras
Maximum-scale multi-agent coding orchestration — turn a task into a Sonnet agent fleet (developer implementers + adversary reviewers) run through the Workflow tool with a spec gate, trial run, and adversarial verification. Use when the user says 'ultracode' or '/ultracode <task>', asks for an agent fleet/swarm, a massive parallel implementation, migration, audit, or refactor, says 'use sonnet agents like there is no tomorrow', 'fan out agents', 'maximum effort on this', or wants a big coding task done at fleet scale. Bare /ultracode (no args) arms ultracode posture for the rest of the session. Do NOT use for: a single feature needing TDD + user-verification gates (/flow:next), research-only fan-outs with no code written (/overkill, /deep-research), or critiquing an idea (/scrutinize-idea).
Ships in flow-extras. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You (the orchestrator) already know the Workflow API and the house delegation loop (CLAUDE.md: plan → Sonnet writes → verify). This skill is the part neither teaches: when a fleet pays, how to keep 4-64 agents from sabotaging each other, and how to make verification real instead of theatrical. Every number here is cross-validated against primary sources; load references/evidence.md only if the user asks for the receipts.
Two modes:
/ultracode <task> — run the task through the pipeline below (Phase 0 → 5)./ultracode (bare) — arm posture: every substantive coding task this session runs through this pipeline by default; solo work only for conversational turns and one-line diffs. Say so in one line, then continue.Fan-out is a deliberate purchase (~15x the tokens of a single-context pass), and coding parallelizes worse than research — Anthropic's own multi-agent team says so — because code has shared context and interface coupling. Gate before spawning:
| Signal | Decision |
|---|---|
| Diff describable in one sentence | No fleet, no plan. Just do it. |
| One strong agent could nearly solo it (≳45% likely to succeed alone) | Don't decompose — added agents are measured negative returns above that line. One Sonnet worker, whole task, adversary review after. |
| Work splits into units where each agent OWNS files/modules no other agent touches | Fleet. This ownership test — not size — is the real criterion. |
| Units share an interface, schema, or causal chain | Fix the contract first (sequentially, in the spec), then fleet the now-independent remainder. Parallelizing causally-linked units produces semantic conflicts that each pass tests alone and fail together. |
You can't measure "45% solo-success" mid-flight — use proxies: the change lives in one file/module; repo history has a comparable single-PR diff; the oracle runs in seconds; nothing needs a frozen contract. Two or more of these → skip the fleet, one worker + adversary review.
Scale by adding units (pipeline stages, waves), never by widening one unit past 3-4 agents — per-agent reasoning capacity thins out beyond that regardless of model tier. A 40-file migration is 40 small units through a pipeline, not 40 agents in one barrier.
Script before fleet. If one deterministic tool (a codemod, sed, a script) can process every unit in one pass, run it instead of fanning agents out to hand-apply the same edit; the agents then review the tool's output, which is cheaper and consistent.
Prove the tool before the wide run, because a subtle error in a codemod repeats in every unit. Do unit 1 by hand and commit it. Check out the base commit into a scratch worktree (git worktree add "$(mktemp -d)" <base-sha>), run the tool on unit 1 there, and diff the result against the hand version. The diff must be empty, or each hunk must be explained in SPEC.md, before the tool touches the other units. Remove the scratch worktree afterwards.
Read references/spec-template.md before writing the spec.
Spec quality is the highest-leverage token you will spend: 41.77% of measured multi-agent failures are specification/design flaws, and ambiguous specs measurably raise reward-hacking rates (33-44% on ambiguous vs well-specified tasks) — a vague spec doesn't just get misread, it invites the fleet to game it. Fleet agents cannot ask follow-ups; the SPEC is their only lifeline.
## Standing orders section, empty by default. When the user gives a directive mid-run, append it there before acting on it, then paste the section verbatim into every brief, respawn and fix-round prompt. Workflow agents cannot ask follow-ups, so a directive that reached only you never reaches the spawns that come later.## Standing orders into one ORDERS constant and every prompt builder (devPrompt, reviewPrompt, fix and respawn prompts) interpolates it. Retyping the orders per builder is how one prompt ends up without them..ultracode/<slug>/SPEC.md.adversary (lens: spec) against SPEC.md. The Bun rewrite reviewed PORTING.md harder than most teams review code, then let $165k of agents run off it.When the lever is a script or codemod, the hand-done unit 1 from Phase 0 is the oracle for this trial: the trial does not start until its diff check has passed.
Have the script write every rendered prompt to .ultracode/<slug>/prompts/<label>.md before it calls agent(). Then run scripts/check-orders .ultracode/<slug>/SPEC.md .ultracode/<slug>/prompts/. It exits 1 and names each prompt file missing a numbered order, so a builder that dropped the orders is caught before the fleet inherits it. Check the rendered files, not the script: the orders are interpolated at run time and never appear literally in the script text.
Read the plan before fan-out on four points: a phase that depends on a list that can be empty; how the prompts define words like "passed" or "confirmed"; values one phase returns that no later phase uses; and agents meant to judge independently whose prompts do not keep them out of each other's files.
Run the full loop — developer → adversaries → fixes → merge — on 1-3 representative units before the fleet. You are smoke-testing the orchestration, not the product: Bun's agents git-stomped each other 2 minutes into full fan-out; a trial surfaces that class of failure for the price of one unit.
When trial output is weak: edit the SPEC or the agent prompts and re-run the trial. Never hand-fix the output. A hand-fix repairs one artifact; a process-fix repairs the other N-1 agents that would have made the same mistake. (This rule holds all the way through Phase 3 — mid-fleet, a recurring defect means stop, patch the prompt, resume.)
Roles — the stable ratio is 1 developer : 2+ adversaries per diff, hard-separated: the implementer never reviews, the reviewer never implements. Fix application goes back to the developer (or a fresh developer acting as fixer on large batches) — a reviewer who edits inherits the implementer's bias the whole split exists to kill.
Model pinning — the silent 5x trap. Subagent model: frontmatter defaults to inherit: an unpinned agent on a Fable/Opus session silently bills the frontier tier for bulk code-writing. The developer and adversary agents are pinned model: sonnet; when writing raw agent() calls, set model: 'sonnet' (or 'haiku' for mechanical transforms) explicitly, every call. Never use Fable/Opus as fan-out workers — one Fable 2k-line diff costs what 4-5 Sonnet implementer calls cost. Full arithmetic: load references/fleet-economics.md before sizing a fleet, picking non-default tiers, or quoting costs; do not load it for posture-only turns.
Work queue. Prefer a mechanically-enumerable list as the queue — compiler errors, failing tests, lint violations, a file list — sharded along module/crate/directory ownership boundaries. Enumerate ONCE up front; never re-run slow global commands (full builds, repo-wide greps) inside agent loops — one slow command from one agent can stall the whole fleet's I/O.
Isolation is a spectrum, priced by repo size × agent count:
| Scale | Isolation |
|---|---|
| ≤4 writers | isolation: 'worktree' per agent — cheap, zero discipline needed |
| Many writers, big repo | Shard worktrees: N agents share one worktree per shard (Bun: 4 × 16) |
| Any shared checkout | Git whitelist in every prompt: commit-only-your-assigned-files; banned: stash, reset, checkout, pull, merge, and any slow global command. Agents each "reasonably managing their own work" destroy each other's without this. |
Worktrees only convert invisible overwrites into visible merge conflicts — they do not prevent semantic conflicts. That prevention happened in Phase 1 (contracts frozen before fan-out).
Artifacts to disk. Workers write full output to .ultracode/<slug>/ and return summary + paths + evidence — never full file contents through your context. Each prompt carries: objective, output format + path, tool guidance, boundaries (what it must not touch), and the SPEC verbatim.
Circuit breaker. Set the workflow budget from your estimate and check at phase boundaries: spend past ~2x estimate with under half the units done means a process defect (retry loops, bloated prompts, agents re-deriving shared context) — stop the run, read the journal, patch the prompt/spec, and resume with resumeFromRunId (completed agents replay from cache; you pay only for the fix). Pushing on at 2x burn "to finish" is how five-figure runaway incidents happen.
Skeleton (agentType resolves the pinned agents; FINDINGS mirrors the adversary's verdict format):
const FINDINGS = { type: 'object', required: ['verdict', 'findings'], properties: {
verdict: { enum: ['BLOCK', 'FIX-THEN-MERGE', 'PASS'] },
checked: { type: 'string' }, // deterministic-sweep receipts — required even on PASS
findings: { type: 'array', items: { type: 'object', required: ['predicate', 'severity', 'scenario'],
properties: { predicate: { type: 'string' }, severity: { enum: ['fatal', 'significant', 'improvable', 'cosmetic'] },
scenario: { type: 'string' }, receipt: { type: 'string' }, status: { enum: ['CONFIRMED', 'PLAUSIBLE', 'NEEDS-TOOL'] } } } } } }
phase('Implement')
const results = await pipeline(units,
u => agent(devPrompt(u), { agentType: 'developer', phase: 'Implement', label: `dev:${u.name}` }),
(r, u) => parallel(['correctness', 'gaming'].map(lens => () =>
agent(reviewPrompt(u, lens), { agentType: 'adversary', phase: 'Review', label: `adv:${lens}:${u.name}`, schema: FINDINGS })))
.then(vs => ({ unit: u, dev: r, reviews: vs.filter(Boolean) })))
LLM review alone plateaus near coin-flip at catching false success (AUROC ≤0.65) — and a trivial string-level detector beats it (0.83-0.95). So: deterministic checks first, LLM lenses second, execution as the tiebreaker.
Deterministic sweep (run before spending review tokens):
skip, xfail, .skip(, todo, commented-out asserts; for assertions made structurally weaker; for literals in source matching test-expected values.LLM lenses. Give each adversary only the diff + SPEC — never the developer's reasoning, never "tests are green" (an auditor told the outcome succeeded rationalizes the process; the adversary self-commits to expected behavior before looking, which is what collapses false-acceptance from 72% to ~1%). Assign distinct lenses — correctness / security-authz / gaming / cross-file — because N identical reviewers share correlated blind spots; a 3-judge ensemble of duplicates still waves through 55% of false positives.
Structural blind spots. Race conditions, TOCTOU, timing, complex authorization logic: no prompt fixes these — the model isn't executing a scheduler. Route these classes to a sanitizer/analyzer/fuzzer co-signer or human eyes; an adversary verdict on them is only ever PLAUSIBLE.
Answer-retrieval. On tasks with a findable upstream fix (known CVEs, public bug fixes), the dominant hack is retrieval, not stubbing — 63% of audited "successful" frontier-model resolutions copied the fix from the web or mined it from git history. The fix is environmental, not a smarter reviewer: run developers with network denied and .git history stripped to one commit, restore at merge time.
Disagreement (adversary vs adversary, or developer pushes back): never average, never let insistence win. Spawn ONE Opus adjudicator scoped to that specific finding — this is the only place a higher tier enters the loop, and it's cheaper than upgrading any fleet role wholesale.
Triage. Adversaries over-report by design — a reviewer asked for gaps will find some in sound code. Only Fatal/Significant findings (correctness or stated requirements) block or get fixed; Improvable/Cosmetic are logged, not chased — chasing them buys over-engineering with fleet tokens.
/flow:next's gates (TDD, browser + user verification) — hand it over rather than duplicating them here.| Situation | Tier |
|---|---|
| Default: implement, test-write, review, refactor | sonnet (pinned in the agents) |
| Mechanical transforms, file discovery, formatting | haiku |
| No verification oracle exists (design docs, novel-algorithm correctness no test will exercise, threat models) | opus for that worker — the adversary+tests mechanism that lets Sonnet suffice isn't available |
| Single-shot high-blast-radius edit (no fast red/green loop before damage lands) | opus for that worker |
| A Sonnet worker would need max thinking effort to cope | opus at normal effort — often cheaper than Sonnet's inflated reasoning tokens |
| Adjudicating a contested finding | ONE opus call, scoped to the finding |
| Bulk code-writing on Fable/Mythos | Never. |
Sonnet-by-default is an economics + oracle argument, not a capability claim — it holds because Phase 4 exists. No verification gate → no cheap workers.
inherit is the default; on a Fable session that's a silent 5x cost multiplier on every worker. Pin every call.| File | Load when | Do not load |
|---|---|---|
references/spec-template.md | Phase 1, every pipeline run | — |
references/fleet-economics.md | Sizing/costing a fleet; any non-default tier choice | Posture-only turns |
scripts/check-orders | Phase 2, after the trial logged its prompts (run it, do not read it) | — |
scripts/analyze-sessions.mjs | The user asks what a fleet or a week of sessions cost, or whether the cache broke (on demand only, never per turn) | Routine runs |
references/evidence.md | User asks "why" / wants citations | Normal runs — the numbers above are already the distillation |
Credit: standing orders, hand-made oracle unit and the script-before-fleet check adapted from cursor/plugins pstack poteto-mode/playbooks/orchestrate.md and principle-build-the-lever @ ccb5507 (MIT). Credit: unit gate and the four-point plan read adapted from anthropics/skills skills/claude-api/shared/managed-agents-multiagent.md @ dbd4588 (Apache-2.0) and addyosmani/agent-skills orchestration-patterns.md @ 1be8e34 (MIT). Credit: analyze-sessions.mjs adapted from anthropics/claude-plugins-official plugins/session-report/skills/session-report/analyze-sessions.mjs @ a9fd216 (Apache-2.0).
references/evidence.md (opens in a new tab)references/fleet-economics.md (opens in a new tab)references/spec-template.md (opens in a new tab)scripts/analyze-sessions.mjs (opens in a new tab)scripts/check-orders (opens in a new tab)tests/test_analyze_sessions.py (opens in a new tab)tests/test_check_orders.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub tomaspalsson/flow --plugin flow-extras20 skills in this plugin
/auditStage-gated parallel code audit for a whole codebase or module: recon → 6 parallel detection agents (correctness, security, performance, design, tests, style) → dedup + triage → user approval gate → fix planning → second approval gate → serialized apply with revert-on-failure → verification. Use for whole-codebase/module debt inventory, health checks, modernization, production-readiness sweeps, or quality audits. Triggers on: /audit, audit this codebase, audit repo, find tech debt, pay down debt, code health check, make production-ready, refactor everything, apply clean code, quality sweep. Do NOT use for: single-PR or branch review ≤10 files (use /pr-reviewer), one-file cleanup (use /simplify), bug fix (use /fix), feature work (use /flow:next), style-only formatting (run the formatter), or uncommitted-change review (use /review). Scope threshold: whole-codebase or whole-module only — not for incremental branch work./babysitDrive one open pull request, or several independent ones, toward merge-ready after flow ships a draft: fix failing CI and resolve merge conflicts. Use when asked to babysit a PR, get it green, fix the CI, resolve the conflicts, or check on one or more PRs. Modes: check (one read-only report) or drive (loop until CI is green and the PR merges clean, or a hard stop). Open review threads are reported and left to the user. Never merges and never marks a draft ready. Not for opening the PR (use /flow:next), not for reviewing someone else's PR (use /pr-reviewer), not for diagnosing a bug from scratch (use /flow:fix)./benchmark-checklistVet a measured number before reporting or acting on it: a speedup, regression, latency, throughput or p95 claim, a before/after in a PR body, or a choice between two libraries or configs based on a run. Names what limits the number, checks warm vs cold, errors, repeated runs with range, end-to-end relevance and a same-way baseline, then gives a verdict (faster, slower, no difference, inconclusive). Also holds the order to try performance fixes in. Not for finding why code is slow with no number yet (use /flow:fix) and not for eval-score significance (use agent-evals)./better-planPresent a plan, design, proposal, or architecture as a polished, interactive, REVIEWABLE page instead of flat markdown — using the locally-installed `better-plan` CLI. Use WHENEVER you are about to show a human a plan they will read and approve: a build/implementation plan, a design doc, an architecture proposal, an API design, a migration plan, an RFC, or a "here's what I'm going to do" before starting work. Renders MDX with diagrams, interactive API specs, annotated code, wireframes, decision records, comparison matrices, timelines, and more, and gives the reviewer an in-page Approve / Request-changes control you can poll. Triggers on - better-plan, /better-plan, "write a plan", "show me the plan", "render the plan", "make a visual plan", "plan this out", "design doc", "proposal", "before you build", "present the plan", "let me review the plan", "plan I can approve", "make the plan readable". Do NOT use for - a one-line answer, a quick code diff, or work you are executing rather than proposing./brainstormBrainstorms fresh, project-specific improvement ideas for an existing codebase and shows each as a plain-word card with 2-4 small pictures: safe bets, something to remove, stretches, wild cards, and a couple of real bugs worth a quick fix. Use when the user asks to brainstorm, 'what should I build next', 'how can I improve this', 'ideas for this repo', 'what's missing', 'what would make this better', or wants product, UX or DX ideas for code they have. Not for growing one idea the user already has (use develop-idea), judging an idea (use scrutinize-idea), or explaining how code works (use design:smoothbrain)./claude-improverScan a repo with a parallel subagent swarm to find and generate genuinely useful Claude Code improvements — new skills, slash commands, subagents, hooks, or CLAUDE.md updates. Use WHENEVER the user says /claude-improver, "improve my claude setup", "scan my repo for claude improvements", "find useful skills for me", "build me claude commands", "what claude stuff should I add", "claude party", "subagent party". Triggers on: improve claude, claude improvements, generate skills, scan repo claude, claude-improver, useful commands. Uses a 5-lens parallel swarm grounded in actual file evidence, applies precision filters (max 5 recommendations, no duplication of existing tools), and generates artifacts that pass skill-judge. Do NOT use for: general code review (use /review), fixing bugs (use /fix), auditing CLAUDE.md only (use claude-md-improver), one-off skill authoring (use skill-forge).