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

swarm-barrier

Skill10 starsChanged yesterdayMITView on GitHub

Contract-first artifact verification, barrier assertions, and role isolation for multi-agent DAG swarms. Use when coordinating multiple agent roles (researcher, coder, verifier, critic) in a DAG to ensure required files, schema checks, and test conditions are satisfied before unblocking downstream tasks.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use during multi-agent DAG planning and execution (autoharness swarm init/run/verify) when:

    line 9
  2. Very specific:

    Add barrier_assertions specifying conditions:

    line 18
  3. Distinctive:

    After task executor finishes, evaluate all declared barriers against the filesystem.

    line 29
  4. Very specific:

    If any barrier fails, mark task failed with barrier failure diagnostics, preventing downstream tasks from proceeding.

    line 30
  5. Very specific:

    Run autoharness swarm verify <plan_id> or use harness_swarm_verify to check DAG readiness and validate all completed task barriers.

    line 32
  6. Very specific:

    Run pytest tests/test_swarm_barriers.py to confirm contract barrier evaluation and role enforcement.

    line 35
  7. Very specific:

    Run autoharness swarm verify on plans with valid and invalid artifact contracts to ensure blocking behavior.

    line 36

≈ “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 Barrier: Contract-First Artifact Verification & Role Isolation

When to use

Use during multi-agent DAG planning and execution (autoharness swarm init/run/verify) when:

  • Independent agents pass artifacts (source files, test suites, schemas, diffs) to downstream agents.
  • You must guarantee that required output files exist, are non-empty, and meet barrier assertions before downstream tasks start.
  • Role boundaries must be enforced (e.g. a researcher agent cannot modify application code; a verifier cannot rewrite implementation logic).
  • Early task failures must immediately halt dependent branches instead of propagating broken state.

Steps

  1. Define Artifact Contracts & Barrier Assertions:
    • In SwarmTask, declare expected_artifacts (e.g. ["src/module.py", "tests/test_module.py"]).
    • Add barrier_assertions specifying conditions:
      • file_exists: <relpath> — verify target path exists and is a file.
      • file_non_empty: <relpath> — verify target path is non-empty (>0 bytes).
      • file_contains: <relpath> <pattern> — verify target file contains expected substring.
      • exit_code: <0|int> — verify command exited cleanly.
      • min_lines: <relpath> <count> — ensure minimum substantive content.
  2. Enforce Role Isolation Policies:
    • Assign explicit roles to each task (researcher, coder, verifier, critic, coordinator).
    • researcher / critic: read-only or restricted to .autoharness/ and doc/spec folders.
    • verifier: restricted to test execution and reporting, prohibited from mutating source code directly.
  3. Execute Contract Barrier Verification:
    • After task executor finishes, evaluate all declared barriers against the filesystem.
    • If any barrier fails, mark task failed with barrier failure diagnostics, preventing downstream tasks from proceeding.
  4. Audit and Verify Swarm Plan:
    • Run autoharness swarm verify <plan_id> or use harness_swarm_verify to check DAG readiness and validate all completed task barriers.

How to verify

  1. Run pytest tests/test_swarm_barriers.py to confirm contract barrier evaluation and role enforcement.
  2. Run autoharness swarm verify on plans with valid and invalid artifact contracts to ensure blocking behavior.

Facts found here

  • Over 70% of multi-agent swarm failures stem from silent failure to produce intermediate files or empty/mock stubs passed to downstream consumers.
  • Enforcing deterministic contract barriers between DAG tiers eliminates cascading hallucinations and reduces token waste by up to 60%.

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.