multiagents 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mcp.json +12 -0
- package/README.md +184 -0
- package/adapters/base-adapter.ts +1493 -0
- package/adapters/claude-adapter.ts +66 -0
- package/adapters/codex-adapter.ts +135 -0
- package/adapters/gemini-adapter.ts +129 -0
- package/broker.ts +1263 -0
- package/cli/commands.ts +194 -0
- package/cli/dashboard.ts +988 -0
- package/cli/session.ts +278 -0
- package/cli/setup.ts +257 -0
- package/cli.ts +17 -0
- package/index.ts +41 -0
- package/noop-mcp.ts +63 -0
- package/orchestrator/guardrails.ts +243 -0
- package/orchestrator/launcher.ts +433 -0
- package/orchestrator/monitor.ts +285 -0
- package/orchestrator/orchestrator-server.ts +1000 -0
- package/orchestrator/progress.ts +214 -0
- package/orchestrator/recovery.ts +176 -0
- package/orchestrator/session-control.ts +343 -0
- package/package.json +70 -0
- package/scripts/postinstall.ts +84 -0
- package/scripts/version.ts +62 -0
- package/server.ts +52 -0
- package/shared/broker-client.ts +243 -0
- package/shared/constants.ts +148 -0
- package/shared/summarize.ts +97 -0
- package/shared/types.ts +419 -0
- package/shared/utils.ts +121 -0
- package/tsconfig.json +29 -0
package/.mcp.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"agent-peers": {
|
|
4
|
+
"command": "/Users/armanandreasyan/.bun/bin/bun",
|
|
5
|
+
"args": ["/Users/armanandreasyan/Documents/multi-agent-peers/server.ts"]
|
|
6
|
+
},
|
|
7
|
+
"agent-peers-orchestrator": {
|
|
8
|
+
"command": "/Users/armanandreasyan/.bun/bin/bun",
|
|
9
|
+
"args": ["/Users/armanandreasyan/Documents/multi-agent-peers/orchestrator/orchestrator-server.ts"]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# multiagents
|
|
2
|
+
|
|
3
|
+
Multi-agent orchestration platform for **Claude Code**, **Codex CLI**, and **Gemini CLI**. Enables AI agents to discover each other, communicate in real-time, coordinate file edits, and work as a team on shared codebases.
|
|
4
|
+
|
|
5
|
+
Built on [MCP (Model Context Protocol)](https://modelcontextprotocol.io/).
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
11
|
+
│ Claude Code │ │ Codex CLI │ │ Gemini CLI │
|
|
12
|
+
│ (Architect) │ │ (Builder) │ │ (Reviewer) │
|
|
13
|
+
└──────┬───────┘ └──────┬──────┘ └──────┬──────┘
|
|
14
|
+
│ MCP (stdio) │ │
|
|
15
|
+
└────────────┬───────┴────────────────────┘
|
|
16
|
+
│
|
|
17
|
+
┌───────▼────────┐
|
|
18
|
+
│ Broker Daemon │ SQLite + HTTP on localhost
|
|
19
|
+
│ (one per machine)
|
|
20
|
+
└────────────────┘
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- Agents discover each other via `list_peers`
|
|
24
|
+
- Send messages with `send_message` (instant for Claude, 1-3s for Codex/Gemini)
|
|
25
|
+
- Assign roles at runtime: `assign_role`, `rename_peer`
|
|
26
|
+
- Coordinate file edits with locks and ownership zones
|
|
27
|
+
- Persistent sessions that survive agent restarts
|
|
28
|
+
- TUI dashboard for real-time monitoring
|
|
29
|
+
- Orchestration from Claude Desktop (spawn teams, monitor progress, control sessions)
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install
|
|
35
|
+
bun install
|
|
36
|
+
|
|
37
|
+
# Setup (detects installed CLIs, configures MCP, starts broker)
|
|
38
|
+
bun cli.ts setup
|
|
39
|
+
|
|
40
|
+
# Start agents in separate terminals
|
|
41
|
+
claude # auto-connects via MCP
|
|
42
|
+
codex # auto-connects via MCP
|
|
43
|
+
gemini # auto-connects via MCP
|
|
44
|
+
|
|
45
|
+
# Monitor
|
|
46
|
+
bun cli.ts dashboard
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Agent Support
|
|
50
|
+
|
|
51
|
+
| Agent | Push Delivery | Effective Latency | Config Location |
|
|
52
|
+
|-------|--------------|-------------------|-----------------|
|
|
53
|
+
| Claude Code | `notifications/claude/channel` | Instant | `~/.claude/settings.json` |
|
|
54
|
+
| Codex CLI | Piggyback on tool responses | 1-3 seconds | `~/.codex/config.toml` |
|
|
55
|
+
| Gemini CLI | Piggyback on tool responses | 1-3 seconds | `~/.gemini/settings.json` |
|
|
56
|
+
|
|
57
|
+
## MCP Tools (Available to All Agents)
|
|
58
|
+
|
|
59
|
+
| Tool | Description |
|
|
60
|
+
|------|-------------|
|
|
61
|
+
| `list_peers` | Discover agents (filter by scope, type) |
|
|
62
|
+
| `send_message` | Send text message to a peer |
|
|
63
|
+
| `check_messages` | Manually poll for messages |
|
|
64
|
+
| `set_summary` | Update your status/summary |
|
|
65
|
+
| `assign_role` | Assign/change a peer's role |
|
|
66
|
+
| `rename_peer` | Give a peer a friendly name |
|
|
67
|
+
| `acquire_file` | Request exclusive edit access to a file |
|
|
68
|
+
| `release_file` | Release your lock on a file |
|
|
69
|
+
| `view_file_locks` | See active locks and ownership zones |
|
|
70
|
+
| `get_history` | Query session message history |
|
|
71
|
+
|
|
72
|
+
## Orchestrator Tools (Claude Desktop)
|
|
73
|
+
|
|
74
|
+
| Tool | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| `create_team` | Spawn a team of agents with roles |
|
|
77
|
+
| `get_team_status` | Live status of all agents |
|
|
78
|
+
| `broadcast_to_team` | Message all agents at once |
|
|
79
|
+
| `direct_agent` | Message a specific agent by name/role |
|
|
80
|
+
| `add_agent` | Spawn an additional agent mid-session |
|
|
81
|
+
| `remove_agent` | Gracefully stop an agent |
|
|
82
|
+
| `control_session` | Pause/resume all or individual agents |
|
|
83
|
+
| `adjust_guardrail` | View or change session limits |
|
|
84
|
+
| `get_session_log` | Full message history |
|
|
85
|
+
| `end_session` | Stop all agents, archive session |
|
|
86
|
+
|
|
87
|
+
## Sessions
|
|
88
|
+
|
|
89
|
+
Sessions persist across agent restarts:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Create a session
|
|
93
|
+
bun cli.ts session create "Auth Implementation"
|
|
94
|
+
|
|
95
|
+
# List sessions
|
|
96
|
+
bun cli.ts session list
|
|
97
|
+
|
|
98
|
+
# Resume a previous session (reconnects agents to their slots)
|
|
99
|
+
bun cli.ts session resume auth-implementation
|
|
100
|
+
|
|
101
|
+
# Export transcript
|
|
102
|
+
bun cli.ts session export auth-implementation
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## File Coordination
|
|
106
|
+
|
|
107
|
+
Two mechanisms prevent agents from stepping on each other:
|
|
108
|
+
|
|
109
|
+
**Ownership Zones** (static, zero overhead):
|
|
110
|
+
```
|
|
111
|
+
Architect assigns: Builder-1 owns src/auth/*, Builder-2 owns src/email/*
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**File Locks** (dynamic, for shared files):
|
|
115
|
+
```
|
|
116
|
+
Builder-1: acquire_file("package.json", "adding dependency")
|
|
117
|
+
-> Lock acquired, auto-expires in 5 minutes
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Guardrails
|
|
121
|
+
|
|
122
|
+
Dynamic limits that protect against runaway sessions:
|
|
123
|
+
|
|
124
|
+
| Guardrail | Default | Action |
|
|
125
|
+
|-----------|---------|--------|
|
|
126
|
+
| Session Duration | 30 min | Pause |
|
|
127
|
+
| Messages Per Agent | 200 | Pause |
|
|
128
|
+
| Max Agents | 6 | Stop |
|
|
129
|
+
| Restarts Per Agent | 3 | Stop |
|
|
130
|
+
| Files Changed | 50 | Warn |
|
|
131
|
+
| Agent Idle Timeout | 3 min | Warn |
|
|
132
|
+
|
|
133
|
+
All adjustable at runtime. When triggered, agents pause and the user can increase the limit to resume.
|
|
134
|
+
|
|
135
|
+
## CLI Commands
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
multiagents setup Interactive setup wizard
|
|
139
|
+
multiagents dashboard Live TUI dashboard
|
|
140
|
+
multiagents session create <name> Create session
|
|
141
|
+
multiagents session list List all sessions
|
|
142
|
+
multiagents session resume [id] Resume a session
|
|
143
|
+
multiagents session pause [id] Pause all agents
|
|
144
|
+
multiagents session archive <id> Archive session
|
|
145
|
+
multiagents session export <id> Export transcript
|
|
146
|
+
multiagents send <target> <msg> Send message
|
|
147
|
+
multiagents peers List active peers
|
|
148
|
+
multiagents status Broker health + peers
|
|
149
|
+
multiagents broker start|stop|status Manage broker
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Architecture
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
multiagents/
|
|
156
|
+
├── shared/ Type definitions, broker client, constants, utils
|
|
157
|
+
├── adapters/ Agent-specific MCP servers (Claude, Codex, Gemini)
|
|
158
|
+
├── orchestrator/ Claude Desktop orchestration (team management)
|
|
159
|
+
├── cli/ CLI tools (setup, dashboard, session management)
|
|
160
|
+
├── broker.ts SQLite broker daemon (sessions, slots, locks, guardrails)
|
|
161
|
+
├── server.ts Thin entry point (dispatches to adapter by --agent-type)
|
|
162
|
+
└── cli.ts CLI entry point
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Environment Variables
|
|
166
|
+
|
|
167
|
+
| Variable | Default | Purpose |
|
|
168
|
+
|----------|---------|---------|
|
|
169
|
+
| `MULTIAGENTS_PORT` | 7899 | Broker HTTP port |
|
|
170
|
+
| `MULTIAGENTS_DB` | `~/.multiagents/peers.db` | SQLite database path |
|
|
171
|
+
| `ANTHROPIC_API_KEY` | - | Auto-summary via Claude |
|
|
172
|
+
| `OPENAI_API_KEY` | - | Auto-summary via OpenAI (fallback) |
|
|
173
|
+
| `MULTIAGENTS_SESSION` | - | Session ID (set by orchestrator) |
|
|
174
|
+
| `MULTIAGENTS_ROLE` | - | Agent role (set by orchestrator) |
|
|
175
|
+
| `MULTIAGENTS_NAME` | - | Agent display name (set by orchestrator) |
|
|
176
|
+
|
|
177
|
+
## Requirements
|
|
178
|
+
|
|
179
|
+
- [Bun](https://bun.sh/) runtime
|
|
180
|
+
- At least one of: Claude Code, Codex CLI, or Gemini CLI
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|