Skip to content

Commit 64a20ee

Browse files
committed
Initialize the repository with tests
0 parents  commit 64a20ee

37 files changed

Lines changed: 6444 additions & 0 deletions

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:16
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: agentsync
20+
ports:
21+
- 5432:5432
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: '22'
34+
cache: 'npm'
35+
36+
- run: npm ci
37+
- run: npm run build
38+
- run: npm test
39+
env:
40+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/agentsync

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
.env
4+
*.tsbuildinfo

CLAUDE.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
AgentSync 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.
8+
9+
**Status:** Alpha — all 19 MCP tools implemented, integration tests written. See SPEC.md for the full design.
10+
11+
## Philosophy & Positioning
12+
13+
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.
14+
15+
**Key differentiator:** Every existing tool (Claude Code Agent Teams, CCPM, tick-md, Agent-MCP, 1Code, etc.) solves single-developer multi-agent coordination. AgentSync solves multi-human multi-agent coordination across teams. See LANDSCAPE.md for the full competitive analysis.
16+
17+
When making implementation decisions:
18+
- **Protocol over product.** Keep it minimal and composable. Resist feature creep toward traditional PM concepts (sprints, boards, velocity, story points).
19+
- **MCP-native is the differentiator.** The "UI" is Claude Code itself. No REST API or web dashboard in v1.
20+
- **Ship fast, iterate in public.** This is a first-mover play on the "agent coordination protocol" category. Simplicity and speed of adoption matter more than feature completeness.
21+
- **The CLAUDE.md integration pattern is as important as the server itself.** The drop-in snippet in `claude-md/COORDINATION.md` is what makes adoption zero-friction — agents coordinate automatically without humans configuring anything.
22+
23+
## Tech Stack
24+
25+
- Node.js + TypeScript
26+
- PostgreSQL (raw SQL via `pg` driver, no ORM)
27+
- `@modelcontextprotocol/sdk` for the MCP server
28+
- No auth layer or UI in v1
29+
30+
## Build & Development Commands
31+
32+
```bash
33+
docker compose up -d # start PostgreSQL
34+
npm install # install dependencies
35+
npm run build # compile TypeScript
36+
npm start # start the MCP server (stdio transport)
37+
npm test # run integration tests (needs PostgreSQL)
38+
npm run dev # watch mode for TypeScript compilation
39+
```
40+
41+
Database: PostgreSQL on `localhost:5432`, database `agentsync`. Schema auto-applies on startup via `initDb()`. Connection string via `DATABASE_URL` env var (default: `postgresql://postgres:postgres@localhost:5432/agentsync`).
42+
43+
Tests: Vitest, integration tests against real PostgreSQL. No mocks. Run `npm test` — requires a running PostgreSQL instance.
44+
45+
## Architecture
46+
47+
### Four Core Primitives
48+
49+
1. **Intent** — A unit of desired work outcome (not a ticket). Lifecycle: `draft → open → claimed → blocked/done/cancelled`. Intents can have parent-child relationships (decomposition) and depend on other intents.
50+
51+
2. **Claim** — Declaration that an agent/human is actively working on an intent. Tracks files being touched, branch name, and has a heartbeat mechanism (30-min stale threshold). Key for conflict detection.
52+
53+
3. **Signal** — Event notifications (completion, blocked, conflict, info, request) that flow between agents. Completion signals can unblock dependent intents.
54+
55+
4. **Context Package** — Assembled on-demand when an agent picks up work. Bundles the intent, dependencies, overlapping claims, recent signals, and team conventions into a single response.
56+
57+
### MCP Tools (the entire interface)
58+
59+
All interaction happens through 19 MCP tools — no REST API. Tools are grouped into:
60+
- **Intent Management:** create, publish, list, get, update, decompose
61+
- **Claim Management:** claim_work, heartbeat, release, complete
62+
- **Conflict Detection:** check_conflicts (the key safety check before starting work)
63+
- **Signals:** send_signal, get_signals
64+
- **Context:** get_context (first call when an agent starts work)
65+
- **Team/Overview:** list_teams, get_team_status, get_overview
66+
67+
### Key Design Decisions
68+
69+
- Conflicts are **advisory, not enforced** — no file-level locking
70+
- `claimed_by` is a trust-based string identifier (auth deferred to v2)
71+
- Single PostgreSQL instance (designed for <1000 users)
72+
- Polling via MCP tools, no WebSocket subscriptions in v1
73+
74+
## Source Layout
75+
76+
All source goes under `src/`. Key entry point is `src/index.ts` (MCP server). Database layer in `src/db/` (schema, connection pool, query functions). Each tool group gets its own file in `src/tools/`. Shared types in `src/types.ts`.

CONTRIBUTING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Contributing to AgentSync
2+
3+
AgentSync is early-stage and building in public. We're looking for contributors at every level — from bug fixes to leading entire feature areas.
4+
5+
## We're Looking for Co-Maintainers
6+
7+
This isn't just "submit a PR and we'll review it." We're looking for people who want to **co-own this project** — review PRs, shape the roadmap, make design calls, help the community. Everyone pitches in on everything.
8+
9+
If you're interested, open an issue titled "Maintainer interest" and tell us what drew you to the project. No prior contributions required.
10+
11+
## Contributing Code
12+
13+
### Setup
14+
15+
```bash
16+
git clone https://github.com/phuryn/SwarmProtocol.git
17+
cd agentsync
18+
docker compose up -d
19+
npm install
20+
npm run build
21+
npm test
22+
```
23+
24+
### Making Changes
25+
26+
1. Fork the repo and create a branch from `main`
27+
2. Make your changes
28+
3. Add or update tests — we use integration tests against real PostgreSQL (see [TESTING.md](TESTING.md))
29+
4. Run `npm test` and make sure all 67+ tests pass
30+
5. Open a PR with a clear description of what and why
31+
32+
### Where to Contribute
33+
34+
The codebase is organized into natural contribution boundaries:
35+
36+
| Area | Files | Complexity |
37+
|------|-------|------------|
38+
| Tool groups | `src/tools/*.ts` | Low — each file is independent |
39+
| Database queries | `src/db/queries.ts` | Medium — SQL + state transitions |
40+
| Tests | `tests/*.test.ts` | Low — add new scenarios |
41+
| CLAUDE.md integration | `claude-md/` | Low — improve the drop-in snippet |
42+
| Documentation | `*.md` | Low |
43+
44+
### Good First Contributions
45+
46+
- Add a new signal type
47+
- Improve error messages in query functions
48+
- Add a `since` filter test for `get_signals`
49+
- Write a SQLite adapter for `src/db/connection.ts`
50+
- Add a `--port` flag for HTTP/SSE transport alongside stdio
51+
- Improve `get_overview` with additional aggregations
52+
53+
### Code Style
54+
55+
- TypeScript strict mode
56+
- Raw SQL with parameterized queries (`$1`, `$2`) — no ORM, no query builder
57+
- Each tool group in its own file under `src/tools/`
58+
- Tests are integration tests against real PostgreSQL — no mocks
59+
- Keep it simple. If you're adding a dependency, explain why in the PR.
60+
61+
## Reporting Issues
62+
63+
Open an issue with:
64+
- What you expected
65+
- What happened
66+
- Steps to reproduce (if applicable)
67+
- Your environment (Node version, PostgreSQL version, OS)
68+
69+
## Design Philosophy
70+
71+
Before proposing large changes, read [SPEC.md](SPEC.md) and the Philosophy section in [CLAUDE.md](CLAUDE.md). The key principles:
72+
73+
- **Protocol over product** — resist feature creep toward traditional PM tools
74+
- **MCP-native** — the interface is MCP tools, not REST or UI
75+
- **Advisory, not enforced** — conflicts are warnings, not locks
76+
- **Simple by default** — raw SQL, no frameworks, no magic
77+
78+
If your proposal adds significant complexity, open an issue to discuss the design before writing code.

LANDSCAPE.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# AgentSync — Competitive Landscape & Market Signals
2+
3+
## The Gap
4+
5+
Every existing tool solves: **"I'm one developer running 3-5 agents in parallel, how do I prevent them from colliding?"**
6+
7+
Nobody is solving: **"We're a team of 8 humans, each working through agents, across multiple repos and teams. How do we know what's in flight, avoid stepping on each other, and automatically hand off unblocked work?"**
8+
9+
This is single-player multiplayer vs. true multiplayer. Different product category.
10+
11+
---
12+
13+
## Existing Tools (All Single-Developer Focus)
14+
15+
### 1. Claude Code Agent Teams (Anthropic, experimental)
16+
- One lead agent coordinates teammates within a single session
17+
- Shared task list, file locking, inter-agent messaging
18+
- Intra-session only — not cross-team, not cross-human
19+
- Still experimental, known limitations around session resumption
20+
- https://code.claude.com/docs/en/agent-teams
21+
22+
### 2. Claude Code Tasks (Anthropic, native)
23+
- Task management persisting to `~/.claude/tasks/`
24+
- Can share state across sessions via `CLAUDE_CODE_TASK_LIST_ID` env var
25+
- Session-scoped by design — no cross-human coordination
26+
- Dependencies and blockers supported
27+
- https://venturebeat.com/orchestration/claude-codes-tasks-update-lets-agents-work-longer-and-coordinate-across
28+
29+
### 3. CCPM — Claude Code Project Manager (automazeio)
30+
- GitHub Issues as database, git worktrees for parallel execution
31+
- PRD → Epic → Task → Issue → Code → Commit pipeline
32+
- Closer to our idea but assumes single developer dispatching agents
33+
- No cross-team coordination or conflict detection
34+
- https://github.com/automazeio/ccpm
35+
36+
### 4. tick-md (Purple Horizons)
37+
- Markdown file as database, git-backed, MCP server included
38+
- 7 GitHub stars — tiny traction
39+
- File locking, dependency tracking, real-time monitoring
40+
- Elegant but single-file approach doesn't scale to multiple teams
41+
- No intent/outcome abstraction — still task/ticket-oriented
42+
- https://www.tick.md/
43+
- https://github.com/Purple-Horizons (org page)
44+
45+
### 5. Agent-MCP (rinadelph)
46+
- Shared memory graph ("Obsidian for AI agents"), file locking, task management
47+
- Real-time dashboard visualization
48+
- Single-repo, single-developer scope
49+
- https://github.com/rinadelph/Agent-MCP
50+
51+
### 6. 1Code (21st.dev, YC W26)
52+
- GUI wrapper for Claude Code / OpenAI Codex
53+
- Cloud-based background execution, kanban board
54+
- Git worktree isolation per agent
55+
- GitHub/Linear/Slack automation triggers
56+
- Orchestration client, not a coordination protocol
57+
- https://dev.to/_46ea277e677b888e0cd13/1code-managing-multiple-ai-coding-agents-without-terminal-hell-14o4
58+
59+
### 7. multi-agent-coordination-mcp (AndrewDavidRivers)
60+
- MCP server for Cursor IDE specifically
61+
- File locking, dependency management, Projects → Tasks → Todo Items
62+
- Single-developer scope
63+
- https://github.com/AndrewDavidRivers/multi-agent-coordination-mcp
64+
65+
### 8. GitButler
66+
- Auto-sorts parallel Claude Code sessions into separate git branches via hooks
67+
- Each session gets its own branch automatically
68+
- Smart but solves git conflict isolation, not team coordination
69+
- https://blog.gitbutler.com/parallel-claude-code
70+
71+
### 9. multi-agent-coordination-framework (timothyjrainwater-lab)
72+
- Methodology/protocol repo, not a tool
73+
- Built by a non-technical operator coordinating Claude + GPT agents
74+
- Handoff checklists, consistency gates, structured memo formats
75+
- "If it's not in a file, it doesn't exist" — core principle
76+
- Proves the pain is real but solution is manual protocols
77+
- https://github.com/timothyjrainwater-lab/multi-agent-coordination-framework
78+
79+
---
80+
81+
## What Jira Is Doing
82+
83+
- Atlassian launched **"agents in Jira"** (open beta, Feb 2026) — assign tasks to AI agents from the same dashboard as human employees
84+
- Rovo Dev — AI agent for developers working with Jira + Bitbucket
85+
- Agentic CI/CD in Bitbucket Pipelines — natural language workflow automation
86+
- All of this is bolting agents onto the existing ticket model — opposite of agent-native
87+
- https://techcrunch.com/2026/02/25/jiras-latest-update-allows-ai-agents-and-humans-to-work-side-by-side/
88+
- https://www.atlassian.com/blog/announcements/ai-agents-in-jira
89+
90+
---
91+
92+
## Pain Signals From the Community
93+
94+
### "Recipe for disaster"
95+
> One developer called multi-agent coding "a recipe for disaster" with "too much code to review" and "ugly conflicts due to agents all modifying the same files in different ways."
96+
- Source: https://www.eqengineered.com/insights/multiple-coding-agents
97+
98+
### "You're the synchronization layer"
99+
> "With two agents it's manageable. With three it gets stressful. With five — it's impossible. The difference is whether the agents can operate autonomously... In a shared directory, the answer is no."
100+
- Source: https://vibehackers.io/blog/git-worktrees-multi-agent-development
101+
102+
### "Agents forget everything between sessions"
103+
> A non-technical builder coordinating Claude + GPT over 100+ sessions found: "Agents forget everything between sessions. Parallel agents conflict. Nobody holds the full picture. Documents drift from reality. The human coordinator becomes the bottleneck."
104+
- Source: https://github.com/timothyjrainwater-lab/multi-agent-coordination-framework
105+
106+
### "Terminal hell"
107+
> 1Code's creator after 4 months with Claude Code: "Running 3-4 agents in parallel, the CLI became painful." No visibility, git diffs scattered, merge conflicts waiting to happen.
108+
- Source: https://dev.to/_46ea277e677b888e0cd13/1code-managing-multiple-ai-coding-agents-without-terminal-hell-14o4
109+
110+
### "Productivity decreased by 23%"
111+
> A Medium article reported one e-commerce team's productivity actually decreased by 23% after introducing their third AI tool, because tools were fighting each other with conflicting suggestions.
112+
- Source: https://medium.com/@techdigesthq/when-ai-tools-fight-each-other-the-hidden-chaos-of-multi-agent-workflows-83169e8dcc6f
113+
114+
### Reddit/community signals
115+
> From r/programming: "Spent 4 hours debugging why my tests kept failing only to discover that my AI code formatter and my AI test generator were in a literal fight over syntax preferences."
116+
> From r/ExperiencedDevs: "Junior devs think AI tools are magic, but they don't understand that each tool has its own 'opinion' about best practices."
117+
118+
---
119+
120+
## AgentSync Differentiation
121+
122+
| Dimension | Existing Tools | AgentSync |
123+
|-----------|---------------|-----------|
124+
| Scope | One dev, multiple agents | Multiple humans + agents across teams |
125+
| Primitive | Tasks / Tickets | Intents (outcome-oriented) |
126+
| Coordination | File locking, git worktrees | Claims + conflict detection + signals |
127+
| Context | Per-session, lost between sessions | Context packages assembled on demand |
128+
| Interface | GUI / CLI / Markdown files | MCP-native, embedded in CLAUDE.md |
129+
| Team support | None | Multi-team with conventions |
130+
| State sharing | Env vars, shared files | PostgreSQL, real-time via MCP |
131+
| Draft workflow | No | Draft → publish → claim |
132+
133+
## Key Positioning
134+
135+
- Not "Jira but with AI" — that's what Atlassian is doing and they'll always do it better
136+
- Not "one dev managing agent fleet" — that's what 1Code, CCPM, tick-md do
137+
- **"Coordination infrastructure for agent-first teams"** — a new category
138+
- The market for this is tiny today and enormous in 12-18 months
139+
- First mover who names the category owns the narrative

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 AgentSync Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)