SwarmWeaver MCP Server
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
SwarmWeaver
Deterministic Multi-Agent DAG Orchestrator, File-Scope Lease Conflict Guard & Crash-Safe Checkpoint Resume Engine (with MCP Server).
Why swarmweaver?
Engineering teams running parallel multi-agent swarms (subagents editing code, running analyses, and synthesizing reports concurrently) repeatedly hit three critical production failures:
File Clobbering & Race Conditions: Two parallel subagents edit overlapping files, directory globs, or AST symbols simultaneously, silently overwriting each other's patches.
Crash Amnesia on Long-Running DAGs: A 15-node multi-agent workflow fails at node 12 due to a transient rate limit or timeout, forcing the orchestrator to re-run nodes 1–11 from scratch and burn duplicate tokens.
Unvalidated Handoffs & Cyclic Deadlocks: Agents pass unstructured prose between steps ("telephone game" drift) or declare cyclic task dependencies that deadlock execution.
SwarmWeaver solves all three problems in a zero-dependency Python 3.11+ engine and JSON-RPC 2.0 Model Context Protocol (MCP) server:
Conflict-Aware Parallel Wave Compiler (
DAGCompiler): Groups tasks by topological level, detects cycles with exact cycle path reporting (A -> B -> C -> A), and automatically splits tasks with write-write or read-write file-glob overlaps (fnmatch, directory prefix, andfile.py::symbolscope) into sequential sub-waves so parallel subagents never clobber the same file.Pessimistic/Optimistic File-Scope Lease Guard (
FileScopeLeaseManager): EnforcesSHARED_READandEXCLUSIVE_WRITElocks at runtime with deadlock-free canonical acquisition order, TTL expiration, cryptographic SHA-256 lease tokens, and an immutableLeaseConflictaudit log.Hash-Chained Crash-Safe Checkpoint Journal (
CheckpointJournal): Content-addressable JSONL journal (prev_hash -> entry_hash) that replays completed nodes whoseinput_digestmatches in0.007 ms/nodewith0tokens spent when resuming a crashed workflow (engine.execute(resume=True)).Schema-Enforced Shared State (
TypedBlackboard): Validates requiredinput_contractkeys and inline/custom type schemas before a downstream agent starts, and verifiesoutput_contractartifacts before a task can mark itselfCOMPLETED.
Related MCP server: Foremerge
System Architecture
flowchart TD
Specs["TaskSpec Graph\n(depends_on, read_globs, write_globs, contracts)"] --> Compiler["DAGCompiler\nCycle & Contract Validator"]
Compiler --> WaveSplitter["Conflict-Aware Wave Planner\n(Splits W/W & R/W Glob Collisions into Sub-Waves)"]
WaveSplitter --> Engine["SwarmOrchestrator\nWave-Synchronous Execution Loop"]
Engine <--> Journal["CheckpointJournal\nSHA-256 Hash Chain (prev_hash -> entry_hash)"]
Engine <--> Blackboard["TypedBlackboard\nSchema & Lineage Contract Guard"]
Engine <--> Leases["FileScopeLeaseManager\nSHARED_READ / EXCLUSIVE_WRITE Tokens"]
Journal -- "Hit (input_digest match)" --> Replay["Deterministic Zero-Token Replay\n(0.007 ms/node, 0 tokens)"]
Leases -- "Grant Acquired" --> Workers["Parallel Subagent Pool\n(Retry Budget & Fault Isolation)"]
Workers --> Report["DAGExecutionReport\n(Critical Path, Saved Tokens, Audit Log)"]
Replay --> ReportVerified Benchmark Results (v1.0.0)
Reproducible via swarmweaver benchmark (65 unit & concurrency tests, zero external runtime dependencies):
Benchmark Dimension | Workload | Verified Result | Key Metric |
1. DAG Compilation & Wave Scheduling | 200-task, 10-layer multi-agent DAG (160 file conflicts) | P50: |
|
2. Parallel File-Scope Conflict Guard | 50 concurrent conflicting file/glob edit tasks |
|
|
3. Crash-Recovery Token Savings | 20 workflows (10 steps each), crash injected at 70% |
|
|
4. Cycle & Contract Violation Guard | 15 malformed DAGs (cycles, missing deps, bad contracts) |
|
|
Quickstart
Installation
git clone https://github.com/codesphere-u/swarmweaver.git
cd swarmweaver
pip install -e ".[dev]"CLI Usage
# 1. Compile the 10-agent full-stack refactoring swarm into conflict-free parallel waves
swarmweaver plan
# 2. Run the 10-agent swarm demo with an injected crash at node 8 + instant zero-token resume
swarmweaver demo
# 3. Run the reproducible 4-part benchmark suite (human-readable or JSON)
swarmweaver benchmark
swarmweaver benchmark --json
# 4. Verify the SHA-256 hash chain of a persisted checkpoint journal
swarmweaver verify-journal ./path/to/checkpoint.jsonlPython SDK Usage
from swarmweaver import SwarmOrchestrator, TaskSpec
tasks = [
TaskSpec(
task_id="scan_ast",
title="Audit auth module AST",
agent_role="auditor",
read_globs=["src/auth/**/*.py"],
output_contract=["ast_report:dict"],
estimated_tokens=800,
),
TaskSpec(
task_id="patch_jwt",
title="Harden JWT token verifier",
agent_role="auth-coder",
depends_on=["scan_ast"],
write_globs=["src/auth/jwt.py"],
input_contract=["ast_report:dict"],
output_contract=["jwt_patch:dict"],
estimated_tokens=1200,
),
TaskSpec(
task_id="patch_rbac",
title="Update RBAC claims in jwt.py",
agent_role="policy-coder",
depends_on=["scan_ast"],
# Overlaps with patch_jwt on src/auth/jwt.py -> automatically split into a sequential sub-wave!
write_globs=["src/auth/jwt.py", "src/auth/rbac.py"],
input_contract=["ast_report:dict"],
output_contract=["rbac_patch:dict"],
estimated_tokens=950,
),
]
orchestrator = SwarmOrchestrator(
tasks,
workflow_id="auth-hardening-v1",
journal_path=".swarmweaver/auth_journal.jsonl",
validate_contracts_at_compile=True,
)
# If a prior run crashed midway, resume=True replays completed nodes in <0.01ms with 0 tokens!
report = orchestrator.execute(resume=True)
print(f"Status: {report.status} | Waves: {report.wave_plan.waves}")
print(f"Tokens Spent: {report.tokens_spent} | Tokens Saved: {report.tokens_saved_by_replay}")MCP Server Integration
swarmweaver includes a built-in JSON-RPC 2.0 Stdio MCP server (swarmweaver mcp) exposing 4 tools to Claude Code, Cursor, Antigravity, and custom MCP clients:
MCP Tool Name | Description |
| Compiles a list of tasks into conflict-free parallel execution waves and critical-path metrics. |
| Tests whether a proposed batch of parallel subagent tasks has write/write or read/write file-glob collisions. |
| Verifies a checkpoint journal's SHA-256 hash chain ( |
| Runs the deterministic SwarmWeaver benchmark suite and returns structured telemetry. |
Claude Code / Cursor / Antigravity mcpServers Config
{
"mcpServers": {
"swarmweaver": {
"command": "swarmweaver",
"args": ["mcp"]
}
}
}Part of the Codesphere Agentic Infrastructure Ecosystem
SwarmWeaver is built by Akandwanaho Ivan Alvin (@codesphere-u), Founder & Managing Director of Codesphere Innovations (U) Limited (Kampala, Uganda), as part of a modular open-source stack for production-grade AI engineering:
swarmweaver— Deterministic Multi-Agent DAG Orchestrator, File-Scope Lease Conflict Guard & Crash-Safe Checkpoint Resume Engine.patchpilot— Autonomous Code Repair Engine: Stack-Trace & AST Fault Localizer, Anti-Reward-Hacking Patch Verifier & Transactional Sandbox.synapse-router— Complexity-Aware Multi-Model LLM Router, LinUCB Contextual Bandit, Semantic Cache & Budget Guard.agentflight— Deterministic Flight Recorder, Cryptographic Action Ledger & Chaos Replay Engine for Autonomous AI Agents.cortex-mcp— AST-Native Codebase Graph, Hybrid RRF Semantic Search & Token-Budgeted Context Engine.agentshield— Zero-Trust Runtime Security Firewall, Prompt-Injection Detector & Tool-Call Policy Enforcer for AI Agents.ARGUS-AI— Multi-Modal Enterprise Intelligence & Observability Platform.
License
Released under the MIT License. Copyright (c) 2026 Akandwanaho Ivan Alvin (Codesphere Innovations (U) Limited).
This server cannot be deployed
Maintenance
Related MCP Connectors
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Coordinate multiple AI agents over MCP: atomic claims, leases, shared ledger, handoffs, tasks.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables multi-model leader-worker agent orchestration, workflow execution, and deterministic validation via structured MCP tools.10 npmApache 2.0
- AlicenseAqualityBmaintenanceCoordination protocol for parallel coding agents, built above Git. The MCP server exposes the full 17-tool lifecycle over stdio: register agents, publish intents with semantic scopes and declared operations, claim work, check for conflicts before code is written, publish ChangeSets, run trusted named verification checks, and record accepted work. Deterministic rules raise findings when two agents'18442Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceEnables MCP clients to run distributed Raft leader election, quorum voting, vector-clock causality tracking, LWW CRDT reconciliation, epidemic gossip, and two-phase commit coordination using only Python standard library. It supports local benchmarking and integration with Claude Desktop, Cursor, and Windsurf via JSON-RPC stdio.7MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables agents and MCP-compliant clients to resolve tool execution graphs as topological dependency DAGs, batching independent calls in parallel and speculatively prefetching arguments to cut latency and token burn. Runs deterministically as a zero-dependency JSON-RPC 2.0 stdio server for frameworks like LangGraph, CrewAI, AutoGen, and IDEs such as Cursor, Windsurf, and Claude Desktop.-