Skip to content

Commit 7d86d87

Browse files
committed
Updated docs
1 parent eda0b22 commit 7d86d87

11 files changed

Lines changed: 444 additions & 69 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1214

1315
services:
1416
postgres:

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
Swarm Protocol is a headless MCP server for AI agent team coordination. It solves state synchronization when multiple people work through AI agents (Claude Code, etc.) on the same codebase simultaneously — preventing file conflicts, tracking work in flight, and managing task dependencies.
88

9-
**Status:** Alpha — all 19 MCP tools implemented, integration tests written. See SPEC.md for the full design.
9+
**Status:** Alpha — all 19 MCP tools implemented, integration tests written. See docs/SPEC.md for the full design.
1010

1111
## Philosophy & Positioning
1212

1313
This is a **coordination protocol, not a project management tool**. The origin insight: "Jira was built for humans clicking buttons. This is coordination infrastructure for agent-first teams." The problem isn't Kanban or sprints — it's state synchronization when agents are the primary interface.
1414

15-
**Key differentiator:** Every existing tool (Claude Code Agent Teams, CCPM, tick-md, Agent-MCP, 1Code, etc.) solves single-developer multi-agent coordination. Swarm Protocol solves multi-human multi-agent coordination across teams. See LANDSCAPE.md for the full competitive analysis.
15+
**Key differentiator:** Every existing tool (Claude Code Agent Teams, CCPM, tick-md, Agent-MCP, 1Code, etc.) solves single-developer multi-agent coordination. Swarm Protocol solves multi-human multi-agent coordination across teams. See docs/LANDSCAPE.md for the full competitive analysis.
1616

1717
When making implementation decisions:
1818
- **Protocol over product.** Keep it minimal and composable. Resist feature creep toward traditional PM concepts (sprints, boards, velocity, story points).

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ npm test
2525

2626
1. Fork the repo and create a branch from `main`
2727
2. Make your changes
28-
3. Add or update tests — we use integration tests against real PostgreSQL (see [TESTING.md](TESTING.md))
28+
3. Add or update tests — we use integration tests against real PostgreSQL (see [TESTING.md](docs/TESTING.md))
2929
4. Run `npm test` and make sure all 67+ tests pass
3030
5. Open a PR with a clear description of what and why
3131

@@ -68,7 +68,7 @@ Open an issue with:
6868

6969
## Design Philosophy
7070

71-
Before proposing large changes, read [SPEC.md](SPEC.md) and the Philosophy section in [CLAUDE.md](CLAUDE.md). The key principles:
71+
Before proposing large changes, read [SPEC.md](docs/SPEC.md) and the Philosophy section in [CLAUDE.md](CLAUDE.md). The key principles:
7272

7373
- **Protocol over product** — resist feature creep toward traditional PM tools
7474
- **MCP-native** — the interface is MCP tools, not REST or UI

README.md

Lines changed: 153 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,154 @@
11
# Swarm Protocol
22

3-
> MCP server for AI agent team coordination. No UI. No sprints. Just state sync.
3+
[![Tests](https://github.com/phuryn/swarm-protocol/actions/workflows/test.yml/badge.svg)](https://github.com/phuryn/swarm-protocol/actions/workflows/test.yml)
4+
![GitHub stars](https://img.shields.io/github/stars/phuryn/swarm-protocol?style=flat-square&color=0d9488)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-0d9488?style=flat-square)](https://github.com/phuryn/swarm-protocol/blob/main/LICENSE)
6+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-0d9488?style=flat-square)](https://github.com/phuryn/swarm-protocol/blob/main/CONTRIBUTING.md)
47

5-
**Status: Alpha — building in public**
8+
**Coordination protocol for agent-first teams. No UI. No sprints. Just state sync.**
9+
10+
![Swarm Protocol](docs/welcome.png)
11+
12+
**Status: Alpha — building in public. [19 MCP tools](#all-19-tools) implemented, integration tests passing.**
13+
14+
## The Coordination Loop
15+
16+
Drop [`COORDINATION.md`](claude-md/COORDINATION.md) into your repo's `CLAUDE.md` and agents coordinate automatically:
17+
18+
```
19+
Agent starts session
20+
→ get_team_status "What's in flight?"
21+
→ claim_work "I'm taking this — here are my files"
22+
→ check_conflicts "Anyone else touching src/api/router.ts?"
23+
→ heartbeat "Still working" (every 10-15 min)
24+
→ complete_claim "Done — this unblocks intent_xyz"
25+
↳ intent_xyz status: blocked → open
26+
↳ Next agent picks it up automatically
27+
```
28+
29+
Zero Slack messages. Zero status meetings. Agents coordinate through shared state.
30+
31+
## What This Is
32+
33+
A headless coordination layer exposed as an MCP server — the same protocol Claude Code already speaks. No REST API. No dashboard. Agents query it to see what's in flight, claim work, detect file conflicts, and hand off unblocked tasks.
34+
35+
This is a **coordination protocol, not a project management tool.** Jira was built for humans clicking buttons. This is state synchronization infrastructure for teams where agents are the primary development interface.
36+
37+
The CLAUDE.md integration pattern is as important as the server itself. Agents coordinate automatically without humans configuring anything.
38+
39+
## Who Is This For
40+
41+
Teams of 2+ developers where AI agents (Claude Code, etc.) are the primary development interface. If your workflow is "open terminal → tell Claude Code what to build → review the PR" and teammates are doing the same thing at the same time — this is the missing layer.
42+
43+
**Not for:** solo devs running multiple agents in parallel (tools like [CCPM](https://github.com/automazeio/ccpm) and [1Code](https://www.1code.io/) solve that). Not a Jira replacement. Not a project management tool.
644

745
## The Problem
846

9-
When multiple people work through AI agents simultaneously:
10-
- No one knows what's in flight right now
11-
- Two agents edit the same files and create conflicts
12-
- Completed work sits idle because no one picks up the next dependent task
47+
Every existing tool in this space solves **single-player** multi-agent coordination: one developer dispatching 3-5 agents. Useful, but insufficient.
48+
49+
Nobody is solving **multiplayer**: multiple humans, each working through agents, across teams. That's not a project management problem — it's a state synchronization problem.
50+
51+
What happens without coordination:
52+
- Two agents edit the same files → ugly merge conflicts
53+
- Completed work sits idle — no one picks up the next dependent task
1354
- Context is lost between agent sessions
14-
- There's no shared state of "done / in progress / blocked"
55+
- No shared state of what's done, in progress, or blocked
1556

16-
Every existing tool solves **single-developer** multi-agent coordination. Nobody is solving: **"We're a team of 8 humans, each working through agents, across multiple repos and teams. How do we stay in sync?"**
57+
See [LANDSCAPE.md](docs/LANDSCAPE.md) for the full competitive breakdown.
1758

18-
This isn't a project management problem. It's a state synchronization problem.
59+
## Four Primitives
1960

20-
## What This Is
61+
| Primitive | What It Does |
62+
|-----------|-------------|
63+
| **Intent** | A unit of desired outcome — not a ticket. Lifecycle: `draft → open → claimed → done`. Has constraints, acceptance criteria, and dependency chains. |
64+
| **Claim** | "I'm working on this." Tracks which files are being touched. Includes heartbeat — claims with no heartbeat for 30 min get flagged as stale. |
65+
| **Signal** | Event notification: completion, blocked, conflict, info. When a completion signal fires, dependent intents auto-unblock. |
66+
| **Context Package** | Everything an agent needs to start work — intent, dependencies, active claims on overlapping files, recent signals, team conventions — assembled in one call via `get_context`. |
67+
68+
## Architecture
69+
70+
![Architecture](docs/architecture.png)
71+
72+
**Stack:** Node.js + TypeScript · PostgreSQL (raw SQL, no ORM) · `@modelcontextprotocol/sdk`
73+
74+
**Design decisions:**
75+
- Conflicts are advisory, not enforced — no file-level locking
76+
- Auth is trust-based in v1 (`claimed_by` is a string the agent passes)
77+
- Single PostgreSQL instance (designed for <1000 users)
78+
- Polling via MCP tools, no WebSocket subscriptions
79+
- Protocol over product — minimal and composable by design
80+
81+
## Key Tools
2182

22-
A headless coordination layer exposed as an MCP server. Agents query it to see what's in flight, claim work, detect file conflicts, and hand off unblocked tasks — all without human overhead.
83+
### `check_conflicts` — Prevent file collisions before they happen
2384

24-
The "UI" is Claude Code itself. Drop a snippet in your repo's CLAUDE.md and agents coordinate automatically.
85+
```
86+
→ check_conflicts({ files: ["src/api/router.ts", "src/middleware/auth.ts"] })
87+
88+
← { conflicts: [{
89+
file: "src/api/router.ts",
90+
claimed_by: "anna",
91+
intent: "Refactor API error handling",
92+
claim_id: "claim_abc123"
93+
}]}
94+
```
95+
96+
### `get_context` — One call, full onboarding
97+
98+
```
99+
→ get_context({ intent_id: "intent_abc123" })
100+
101+
← { intent: { title, description, constraints, acceptance_criteria },
102+
parent: null,
103+
dependencies: [{ id: "intent_xyz", status: "done" }],
104+
active_claims: [{ file: "src/middleware/rateLimit.ts", claimed_by: "pawel" }],
105+
recent_signals: [...],
106+
team_conventions: "Use Prettier. Tests required. No console.log in production." }
107+
```
108+
109+
### `complete_claim` — Done. Dependents auto-unblock.
110+
111+
```
112+
→ complete_claim({ claim_id: "claim_def456", unblocks: ["intent_xyz"] })
113+
114+
← intent_abc123: claimed → done
115+
intent_xyz: blocked → open (all dependencies met)
116+
signal: completion created
117+
```
118+
119+
### All 19 Tools
120+
121+
<details>
122+
<summary>Full tool reference</summary>
123+
124+
| Group | Tools |
125+
|-------|-------|
126+
| **Teams** | `create_team`, `list_teams`, `get_team_status`, `get_overview` |
127+
| **Intents** | `create_intent`, `publish_intent`, `list_intents`, `get_intent`, `update_intent`, `decompose_intent` |
128+
| **Claims** | `claim_work`, `heartbeat`, `release_claim`, `complete_claim` |
129+
| **Conflicts** | `check_conflicts` |
130+
| **Signals** | `send_signal`, `get_signals` |
131+
| **Context** | `get_context` |
132+
133+
See [SPEC.md](docs/SPEC.md) for full parameter specs and data model.
134+
135+
</details>
25136

26137
## Quick Start
27138

28139
**Prerequisites:** Docker, Node.js 22+
29140

30141
```bash
31-
# 1. Clone and set up
142+
# Clone and set up
32143
git clone https://github.com/phuryn/swarm-protocol.git
33144
cd swarm-protocol
34145

35-
# 2. Start PostgreSQL
146+
# Start PostgreSQL
36147
docker compose up -d
37148

38-
# 3. Build
149+
# Build and test
39150
npm install
40151
npm run build
41-
42-
# 4. Test
43152
npm test
44153
```
45154

@@ -59,66 +168,45 @@ npm test
59168
}
60169
```
61170

62-
**Enable automatic coordination** — copy [`claude-md/COORDINATION.md`](claude-md/COORDINATION.md) into your repo's CLAUDE.md. Agents will automatically check for conflicts, claim work, and signal completions.
63-
64-
## How It Works
65-
66-
### Four Primitives
67-
68-
| Primitive | What It Does |
69-
|-----------|-------------|
70-
| **Intent** | Unit of desired outcome. Lifecycle: `draft → open → claimed → done`. Not a ticket — an outcome. |
71-
| **Claim** | "I'm working on this." Tracks files being touched, includes heartbeat for stale detection. |
72-
| **Signal** | Event notification — completion, blocked, conflict, info. Flows to whoever needs to know. |
73-
| **Context Package** | Everything an agent needs to start work, assembled in one call. |
74-
75-
### The Coordination Loop
76-
77-
```
78-
Agent starts session
79-
→ get_team_status (what's in flight?)
80-
→ claim_work (I'm taking this, here are my files)
81-
→ check_conflicts (am I stepping on anyone?)
82-
→ heartbeat (still working, every 10-15 min)
83-
→ complete_claim (done — this unblocks X, Y, Z)
84-
```
85-
86-
### 19 MCP Tools
171+
**Enable automatic coordination** — copy [`claude-md/COORDINATION.md`](claude-md/COORDINATION.md) into your repo's `CLAUDE.md`. That's it.
87172

88-
| Group | Tools |
89-
|-------|-------|
90-
| **Teams** | `create_team`, `list_teams`, `get_team_status`, `get_overview` |
91-
| **Intents** | `create_intent`, `publish_intent`, `list_intents`, `get_intent`, `update_intent`, `decompose_intent` |
92-
| **Claims** | `claim_work`, `heartbeat`, `release_claim`, `complete_claim` |
93-
| **Conflicts** | `check_conflicts` |
94-
| **Signals** | `send_signal`, `get_signals` |
95-
| **Context** | `get_context` |
173+
## What's Not in v1
96174

97-
## Architecture
175+
Intentional omissions, not missing features:
98176

99-
- **Runtime:** Node.js + TypeScript
100-
- **Database:** PostgreSQL (raw SQL, no ORM)
101-
- **Interface:** MCP-native via `@modelcontextprotocol/sdk`
102-
- **Auth:** Trust-based v1 (agent passes user identifier)
177+
- **No web UI** — agents and terminal are the interface
178+
- **No auth** — trust-based identity. Auth layer comes when it needs to.
179+
- **No real-time subscriptions** — MCP polling is sufficient
180+
- **No notifications** — Slack/Discord integration is a natural v2 extension
181+
- **No file locking** — conflicts are advisory by design
182+
- **No multi-repo** — single repo per team assumed
103183

104-
See [SPEC.md](SPEC.md) for the full design. See [LANDSCAPE.md](LANDSCAPE.md) for competitive analysis. See [TESTING.md](TESTING.md) for test architecture, coverage, and assumptions.
184+
## Looking for Co-Builders
105185

106-
## What Makes This Different
186+
The market for agent-team coordination is tiny today and enormous in 12-18 months. Every team adopting Claude Code, Codex, or similar tools will hit this exact problem the moment they scale past one developer.
107187

108-
Every tool in this space — Claude Code Agent Teams, CCPM, tick-md, Agent-MCP, 1Code — solves the **single-player** version: one dev running multiple agents in parallel. That's useful but insufficient.
188+
This isn't a side project looking for drive-by PRs. It's a category that needs to be built. I'm looking for people who want to **own parts of this protocol** — lead feature areas, review PRs, shape the design.
109189

110-
Swarm Protocol solves the **multiplayer** version: multiple humans, each working through agents, across teams. Cross-human conflict detection, dependency chains that auto-unblock, context packages that onboard agents instantly.
190+
**Where to plug in:**
111191

112-
See [LANDSCAPE.md](LANDSCAPE.md) for the full competitive breakdown.
192+
- **Tool groups** (`src/tools/`) are natural ownership boundaries — each one is a self-contained module with its own tests
193+
- **The protocol design itself** — the four primitives are v1. What's missing? What's wrong? Open an issue and make the case.
194+
- **Adapters** — SQLite backend, auth layer, Slack signal forwarding, dashboard read-model. Each is a standalone contribution.
195+
- **The CLAUDE.md pattern** — better coordination instructions, support for other agents beyond Claude Code
113196

114-
## Contributing
197+
The raw SQL + no-framework design is intentional — fork it, swap PostgreSQL for SQLite, add auth, build custom tools.
115198

116-
This is early-stage, building in public. We're looking for **contributors and maintainers** — people who want to own parts of this project, not just submit patches.
199+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. Or just open an issue with your idea.
117200

118-
Interested in leading a feature area, reviewing PRs, or managing releases? See [CONTRIBUTING.md](CONTRIBUTING.md).
201+
## Docs
119202

120-
The tool groups (`src/tools/`) are natural contribution boundaries. The raw SQL + no-framework design is intentional — fork it, swap PostgreSQL for SQLite, add auth, build custom tools.
203+
| Doc | What's In It |
204+
|-----|-------------|
205+
| [SPEC.md](docs/SPEC.md) | Full protocol design, data model, SQL schema, tool specifications |
206+
| [LANDSCAPE.md](docs/LANDSCAPE.md) | Competitive analysis — every tool in the space and why this is different |
207+
| [TESTING.md](docs/TESTING.md) | Test architecture, coverage, assumptions |
208+
| [COORDINATION.md](claude-md/COORDINATION.md) | Drop-in CLAUDE.md snippet for your repo |
121209

122210
## License
123211

124-
MIT
212+
MIT

docs/EXAMPLE_TEST_RESULTS.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Example Test Results
2+
3+
**Run date:** 2026-03-13 16:40 UTC+1
4+
**Environment:** Windows 11, Node.js 22, PostgreSQL 16 (Docker), Vitest 3.2.4
5+
6+
```
7+
✓ tests/edge-cases.test.ts (22 tests) 1328ms
8+
✓ tests/intents.test.ts (10 tests) 619ms
9+
✓ tests/claims.test.ts (8 tests) 552ms
10+
✓ tests/teams.test.ts (7 tests) 388ms
11+
✓ tests/scenarios.test.ts (4 tests) 387ms
12+
✓ tests/overview.test.ts (5 tests) 386ms
13+
✓ tests/conflicts.test.ts (5 tests) 348ms
14+
✓ tests/signals.test.ts (4 tests) 290ms
15+
✓ tests/context.test.ts (2 tests) 158ms
16+
17+
Test Files 9 passed (9)
18+
Tests 67 passed (67)
19+
Start at 16:40:36
20+
Duration 6.80s (transform 104ms, setup 0ms, collect 905ms, tests 4.46s, environment 1ms, prepare 527ms)
21+
```
22+
23+
## Test Breakdown
24+
25+
| File | Tests | What It Covers |
26+
|------|-------|----------------|
27+
| `edge-cases.test.ts` | 22 | Error paths, boundary conditions, invalid state transitions |
28+
| `intents.test.ts` | 10 | Create/publish lifecycle, filtering, draft visibility, decomposition |
29+
| `claims.test.ts` | 8 | Claim lifecycle, heartbeat, release/reopen, completion, dependency unblocking |
30+
| `teams.test.ts` | 7 | Team CRUD, duplicate rejection, empty list, null handling |
31+
| `scenarios.test.ts` | 4 | End-to-end coordination stories |
32+
| `overview.test.ts` | 5 | Team status, stale claims, blocked intents, conflicts, completed |
33+
| `conflicts.test.ts` | 5 | File overlap detection, ignoring completed/abandoned claims |
34+
| `signals.test.ts` | 4 | Send/retrieve, filtering by type/team, limit |
35+
| `context.test.ts` | 2 | Full context package assembly, non-existent intent |
36+
37+
For live CI results, see the [Actions tab](https://github.com/phuryn/swarm-protocol/actions).
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/architecture.png

371 KB
Loading

0 commit comments

Comments
 (0)