agentleFS
D-SheyD-Shey/autoharness/.agents/skills/swarm-dag/SKILL.md

swarm-dag

Skill10 starsChanged yesterdayMITView on GitHub

Topological DAG scheduling and dependency resolution for multi-agent workflows

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    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 a complex task or epic consists of multiple interrelated subtasks where some subtasks can run in parallel, while others require …

    line 9
  2. Very specific:

    If any prerequisite node fails, mark downstream dependent nodes as blocked/skipped.

    line 20
  3. Distinctive:

    Test acyclic linear graph (A -> B -> C): verify sequential execution order.

    line 24
  4. Distinctive:

    Test branching parallel graph (A -> [B, C] -> D): verify B and C run concurrently after A finishes, and D waits for both B and C.

    line 25
  5. Distinctive:

    Test cycle detection (A -> B -> A): ensure ValueError or CycleDetectedError is raised with cycle path.

    line 26
  6. Distinctive:

    Verify graceful handling of failure: if B fails, D is blocked while independent tasks finish.

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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

swarm-dag

When to use

Use when a complex task or epic consists of multiple interrelated subtasks where some subtasks can run in parallel, while others require predecessor outputs or verification gates before starting.

Steps

  1. Parse the workflow plan (JSON/YAML) containing nodes with id, name, dependencies (or depends_on), role, and command or action.
  2. Construct adjacency list and in-degree maps.
  3. Validate acyclicity using Kahn's algorithm or depth-first search cycle detection. Reject execution if circular dependencies exist.
  4. Compute topological execution tiers (generations):
    • Tier 0: nodes with in-degree 0 (no prerequisites).
    • Tier N+1: nodes whose prerequisites are strictly satisfied by Tier <= N.
  5. Execute nodes within the current tier concurrently using a worker pool (concurrent.futures.ThreadPoolExecutor or asyncio).
  6. Enforce barrier synchronization: wait for all nodes in the current tier to reach terminal status (completed or failed) before dispatching dependent nodes.
  7. If any prerequisite node fails, mark downstream dependent nodes as blocked/skipped.
  8. Persist graph execution state and per-node output artifacts to .autoharness/swarm/<plan_id>.json.

How to verify

  1. Test acyclic linear graph (A -> B -> C): verify sequential execution order.
  2. Test branching parallel graph (A -> [B, C] -> D): verify B and C run concurrently after A finishes, and D waits for both B and C.
  3. Test cycle detection (A -> B -> A): ensure ValueError or CycleDetectedError is raised with cycle path.
  4. Verify graceful handling of failure: if B fails, D is blocked while independent tasks finish.

Facts found here

  • Standard library graphlib.TopologicalSorter is built into Python 3.9+, enabling zero-dependency topological sorting.

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.