agentleFS
aemerson-commitsaemerson-commits/shareable-skills/skills/cascade-orchestration/SKILL.md

cascade-orchestration

Skill1 starsChanged 8 months agoMITView on GitHub

Reusable agent team cascade patterns — parallel dispatch, sequential pipelines, fan-out/fan-in, and cross-project propagation

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when N independent tasks produce results that need synthesis.

    line 12
  2. Distinctive:

    If any agent fails, report partial results + failure reason

    line 29
  3. Distinctive:

    Use when each stage depends on the previous stage's output.

    line 33
  4. Distinctive:

    Never skip stages; if a stage produces no issues, note "clean" and proceed

    line 51
  5. Distinctive:

    Use when a shared change must be verified/applied across all projects.

    line 55
  6. Distinctive:

    If ANY project fails, block the operation

    line 71
  7. Distinctive:

    Use when a domain agent needs deeper analysis than one agent can provide.

    line 75
  8. Distinctive:

    Use when some agents are only needed based on what changed.

    line 94
  9. Distinctive:

    Only dispatch agents for affected areas

    line 108
  10. Distinctive:

    After deploying multiple projects, capture screenshots for a permanent audit trail of "what shipped today":

    line 120
  11. Very specific:

    Write a Node smoke script at test-results/smoke-YYYY-MM-DD/run-smoke-p1.mjs (keep in a dated directory for audit history).

    line 122

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cascade Orchestration Patterns

Reusable patterns for orchestrating agent teams across projects. Every dispatch carries an explicit model: — your cheapest capable model is the default and the floor; escalate only for critical review, security audits, architecture and migration gates (see /model-selection). Route effort per task, never max it globally.

Pattern 1: Fan-Out / Fan-In

Use when N independent tasks produce results that need synthesis.

Main Agent
├── dispatch N agents in parallel (fan-out)
│   ├── Agent 1 → result 1
│   ├── Agent 2 → result 2
│   └── Agent N → result N
└── synthesize all results (fan-in)

Used by: /audit-components, /env-audit, /pre-merge-review, /skill-audit

Implementation:

  • Each agent gets a focused scope (one project, one domain, one file set)
  • Agents use isolation: "worktree" when modifying code
  • Main agent waits for all agents, then merges results
  • If any agent fails, report partial results + failure reason

Pattern 2: Sequential Pipeline

Use when each stage depends on the previous stage's output.

Stage 1 (parallel research agents)
    ↓ results
Stage 2 (parallel implementation agents)
    ↓ code changes
Stage 3 (parallel review agents)
    ↓ findings
Stage 4 (synthesis + report)

Used by: /research-gate → /write-plan → build → /review-impl

Implementation:

  • Each stage can internally use Fan-Out/Fan-In
  • Stage transitions are explicit — main agent gates progression
  • Context from earlier stages passed to later stages via structured summaries
  • Never skip stages; if a stage produces no issues, note "clean" and proceed

Pattern 3: Per-Project Propagation

Use when a shared change must be verified/applied across all projects.

Trigger: shared/ file changed
├── Agent: Project A Verifier — check imports, build, test
├── Agent: Project B Verifier — check imports, build, test
├── Agent: Project C Verifier — check imports, build, test
└── Agent: Project D Verifier — check imports, build, test

Used by: /audit-components (after shared util changes), /deploy-all

Implementation:

  • Each agent gets the same verification checklist
  • Agents run in their project's directory
  • Results compiled into per-project pass/fail matrix
  • If ANY project fails, block the operation

Pattern 4: Cascading Sub-Teams

Use when a domain agent needs deeper analysis than one agent can provide.

Domain Agent (e.g., Security Review)
├── Sub-agent: Profile A (unauthenticated attacker)
├── Sub-agent: Profile B (compromised user)
└── Sub-agent: Profile C (compromised admin)

Used by: /pre-merge-review (security, performance, UX sub-agents)

Implementation:

  • Parent agent defines sub-agent scope and shares relevant context
  • Sub-agents report to parent, not directly to main
  • Parent synthesizes sub-agent results before reporting to main
  • Max depth: 2 levels (main → domain → sub-agent). Never go deeper.

Pattern 5: Conditional Dispatch

Use when some agents are only needed based on what changed.

Main Agent reads git diff
├── If project-a/ changed → dispatch Project A agents
├── If shared/ changed → dispatch ALL project agents
├── If workers/ changed → dispatch Worker agents
└── If backend/ changed → dispatch Backend agent

Used by: /deploy-all (selective), /session-notes (conditional steps)

Implementation:

  • Main agent determines scope from git diff or user input
  • Only dispatch agents for affected areas
  • Skip unnecessary agents to save context and cost
  • Log which agents were dispatched and which were skipped

Seed Agents With Known Hub Paths

When fanning out audit/research agents for a cross-cutting concern (auth, caching, email, shared utilities), list the convergence files explicitly in EVERY agent's prompt instead of letting each agent rediscover them independently via grep. If your codebase has a shared/ or common/ layer imported by many consumers (CORS/auth helpers, rate limiting, alert/notification plumbing, shared UI utilities), name those specific files up front.

Each hub file is imported by many consumers. An agent that doesn't already know that spends its first pass rediscovering the hub via grep; a parallel sibling agent independently burns the same effort rediscovering it a second time. Seeding the list up front turns N redundant discovery passes into zero — cheap to do (one line per file) and it compounds with agent count.

Multi-Project Deploy-Time Smoke Pattern

After deploying multiple projects, capture screenshots for a permanent audit trail of "what shipped today":

  1. Write a Node smoke script at test-results/smoke-YYYY-MM-DD/run-smoke-p1.mjs (keep in a dated directory for audit history).
  2. Inject authentication credentials via request headers or session cookies on the browser context.
  3. Navigate each deployed URL, wait for hydration, take stage-named screenshots:
    • app-a-01-initial.png, app-a-02-main-view.png
    • app-b-01-initial.png, app-b-02-loaded.png
  4. Execute: node test-results/smoke-YYYY-MM-DD/run-smoke-p1.mjs
  5. Review each PNG visually. Screenshot review consistently surfaces issues (missing data, broken layouts, wrong colors) that HTTP 200 and unit tests miss entirely.
  6. Iterate: write run-smoke-p2.mjs for deeper views (modals, admin settings, theme toggle), run-smoke-p3.mjs for admin-only areas.

The screenshot directory becomes the audit trail for the deploy. Archive it alongside the deploy commit SHA.

Anti-Patterns

Anti-PatternWhy It's BadDo This Instead
Dispatching without an explicit model:Unpinned agents inherit the main-loop model (often the most expensive available); subagents can account for the majority of token spendEvery Agent(...) / workflow agent() call carries model: — use your cheapest capable model by default, escalate to a more powerful model only for critical review/security/migration gates (see /model-selection)
Agent spawns agent spawns agent (3+ deep)Context loss, coordination overheadMax 2 levels deep
All agents share one worktreeRace conditions on file writesEach code-modifying agent gets own worktree
Agent does research + implementationScope creep, context bloatSeparate research agents from implementation agents
Sequential when parallel is possibleWastes timeIf tasks have no data dependency, parallelize
Fan-out when stages actually depend on each otherRedundant context re-fed to every agent, no real concurrency gained — a later "parallel" agent just re-derives what an earlier one already producedCheck for a real data dependency chain before splitting into parallel agents; collapse to a sequential pipeline (or one agent) if a later stage reads what an earlier stage wrote
Parallelizing tiny tasksAgent overhead > task timeOnly parallelize tasks that take 30s+ each

Skill Integration Map

WorkflowPatternAgents
/start-dayFan-Out/Fan-In4 parallel: git pull, index, session review, memory check
/research-gateFan-Out/Fan-In4-5 parallel research agents → synthesis
/audit-componentsPer-Project PropagationN project auditors + cross-project auditors
/env-auditFan-Out/Fan-InN context scanners → cross-reference synthesis
/review-implSequential Pipeline3 context agents → 3-7 reviewers → synthesis
/pre-merge-reviewCascading Sub-Teams5 domains x 1-3 sub-agents each (up to 12 total)
/deploy-allPer-Project Propagation + ConditionalN Pages agents, then Worker agents
/session-notesSequential Pipeline (1 agent)ONE agent runs stages in order (vault note → docs → memory) instead of N parallel agents — the stages read each other's output, so parallelizing them re-fed overlapping context without buying real concurrency; deterministic bookkeeping steps collapse into a single script call
/debug-collaborateFan-Out/Fan-In3-4 hypothesis investigators → synthesis
/write-planSequential PipelineResearch → decompose → task list with file paths
/skill-auditFan-Out/Fan-In4 parallel checks → compliance check → report
/persistent-issueSequential Pipeline + ConditionalTriage → dispatch Team A-E → auto-escalate (cascade mode)
/deep-root-causeFan-Out/Fan-In3 agents: Reproducer, Data Flow Tracer, Assumption Auditor
/full-stack-traceSequential Pipeline4 agents: Frontend → API → Backend → Infrastructure
/isolation-testFan-Out/Fan-In + Conditional3 agents: Component Isolator, Data Minimizer, Environment Comparator
/temporal-forensicsFan-Out/Fan-In3 agents: Race Condition Hunter, Stale State Detective, Timing Profiler
/regression-bisectSequential Pipeline3 agents: Git Bisector, Side Effect Analyzer, Rollback Verifier
/full-stack-buildSequential Pipeline + Fan-Out/Fan-In2 designers → 2 builders (worktree) → 4 verifiers
/worker-buildFan-Out/Fan-In3 builders (worktree) → 2 verifiers
/propagate-featureSequential Pipeline + Fan-Out/Fan-In2 differs → adapt plan → 1 propagator (worktree) → 2 verifiers
/data-reconciliationFan-Out/Fan-In4 layer samplers → reconciliation matrix
/grill-meSequential (conversation)Intent interrogation → Intent Summary for /research-gate

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.