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.
In this repository44 other files it gives its agents.
- llms-full.txtllms.txt
- llms.txtllms.txt
- ai-prompt-engineering-safety-reviewSkill
- ast-codemapSkill
- ast-grepSkill
- autoharnessSkill
- autonomous-backlog-driverSkill
- claude-kimi-mcp-normalizationSkill
- cli-self-updaterSkill
- code-frugalitySkill
- codemode-gatewaySkill
- codemode-typesSkill
- consequence-simulationSkill
- context-pruningSkill
- github-update-checkerSkill
- google-agents-cli-evalSkill
- google-agents-cli-scaffoldSkill
- history-searchSkill
- hook-gatingSkill
- hybrid-semantic-searchSkill
- kimi-code-agent-integrationSkill
- kimi-mcp-configurationSkill
- leann-vectorSkill
- log-summarizerSkill
- markdown-vagueSkill
- memory-reconciliationSkill
- mode-classificationSkill
- multiagent-orchestrationSkill
- output-compressionSkill
- prompt-injectionSkill
- python-anti-patternsSkill
- regression-sentinelSkill
- restart-trackingSkill
- rollback-guardSkill
- rust-call-graphSkill
- secrets-managementSkill
- security-best-practicesSkill
- session-compactorSkill
- sqlite-memorySkill
- swarm-dagSkill
- autoharnessSkill
- code-reliability-checksSkill
- skill-threat-rulesSkill
- autoharnessSkill
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
- Very specific: line 9
Use during multi-agent DAG planning and execution (autoharness swarm init/run/verify) when:
- Very specific: line 18
Add barrier_assertions specifying conditions:
- Distinctive: line 29
After task executor finishes, evaluate all declared barriers against the filesystem.
- Very specific: line 30
If any barrier fails, mark task failed with barrier failure diagnostics, preventing downstream tasks from proceeding.
- Very specific: line 32
Run autoharness swarm verify <plan_id> or use harness_swarm_verify to check DAG readiness and validate all completed task barriers.
- Very specific: line 35
Run pytest tests/test_swarm_barriers.py to confirm contract barrier evaluation and role enforcement.
- Very specific: line 36
Run autoharness swarm verify on plans with valid and invalid artifact contracts to ensure blocking behavior.
≈ “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.
Files
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
- Define Artifact Contracts & Barrier Assertions:
- In
SwarmTask, declareexpected_artifacts(e.g.["src/module.py", "tests/test_module.py"]). - Add
barrier_assertionsspecifying 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.
- In
- 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.
- Assign explicit roles to each task (
- Execute Contract Barrier Verification:
- After task executor finishes, evaluate all declared barriers against the filesystem.
- If any barrier fails, mark task
failedwith barrier failure diagnostics, preventing downstream tasks from proceeding.
- Audit and Verify Swarm Plan:
- Run
autoharness swarm verify <plan_id>or useharness_swarm_verifyto check DAG readiness and validate all completed task barriers.
- Run
How to verify
- Run
pytest tests/test_swarm_barriers.pyto confirm contract barrier evaluation and role enforcement. - Run
autoharness swarm verifyon 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%.
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.

