agent-relay 1.0.8 → 1.0.9
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/README.md +158 -0
- package/dist/bridge/config.d.ts +41 -0
- package/dist/bridge/config.d.ts.map +1 -0
- package/dist/bridge/config.js +143 -0
- package/dist/bridge/config.js.map +1 -0
- package/dist/bridge/index.d.ts +10 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +10 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/multi-project-client.d.ts +99 -0
- package/dist/bridge/multi-project-client.d.ts.map +1 -0
- package/dist/bridge/multi-project-client.js +386 -0
- package/dist/bridge/multi-project-client.js.map +1 -0
- package/dist/bridge/spawner.d.ts +46 -0
- package/dist/bridge/spawner.d.ts.map +1 -0
- package/dist/bridge/spawner.js +223 -0
- package/dist/bridge/spawner.js.map +1 -0
- package/dist/bridge/types.d.ts +55 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/bridge/types.js +6 -0
- package/dist/bridge/types.js.map +1 -0
- package/dist/bridge/utils.d.ts +30 -0
- package/dist/bridge/utils.d.ts.map +1 -0
- package/dist/bridge/utils.js +54 -0
- package/dist/bridge/utils.js.map +1 -0
- package/dist/cli/index.js +564 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/daemon/agent-registry.d.ts.map +1 -1
- package/dist/daemon/agent-registry.js +6 -1
- package/dist/daemon/agent-registry.js.map +1 -1
- package/dist/daemon/connection.d.ts +22 -0
- package/dist/daemon/connection.d.ts.map +1 -1
- package/dist/daemon/connection.js +59 -13
- package/dist/daemon/connection.js.map +1 -1
- package/dist/daemon/router.d.ts +27 -0
- package/dist/daemon/router.d.ts.map +1 -1
- package/dist/daemon/router.js +108 -3
- package/dist/daemon/router.js.map +1 -1
- package/dist/daemon/server.d.ts +8 -0
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +95 -23
- package/dist/daemon/server.js.map +1 -1
- package/dist/dashboard/metrics.d.ts +105 -0
- package/dist/dashboard/metrics.d.ts.map +1 -0
- package/dist/dashboard/metrics.js +192 -0
- package/dist/dashboard/metrics.js.map +1 -0
- package/dist/dashboard/needs-attention.d.ts +24 -0
- package/dist/dashboard/needs-attention.d.ts.map +1 -0
- package/dist/dashboard/needs-attention.js +78 -0
- package/dist/dashboard/needs-attention.js.map +1 -0
- package/dist/dashboard/public/bridge.html +1272 -0
- package/dist/dashboard/public/index.html +2017 -879
- package/dist/dashboard/public/js/app.js +184 -0
- package/dist/dashboard/public/js/app.js.map +7 -0
- package/dist/dashboard/public/metrics.html +999 -0
- package/dist/dashboard/server.d.ts +13 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +568 -13
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/start.js +1 -1
- package/dist/dashboard/start.js.map +1 -1
- package/dist/dashboard-v2/index.d.ts +10 -0
- package/dist/dashboard-v2/index.d.ts.map +1 -0
- package/dist/dashboard-v2/index.js +54 -0
- package/dist/dashboard-v2/index.js.map +1 -0
- package/dist/dashboard-v2/lib/api.d.ts +95 -0
- package/dist/dashboard-v2/lib/api.d.ts.map +1 -0
- package/dist/dashboard-v2/lib/api.js +270 -0
- package/dist/dashboard-v2/lib/api.js.map +1 -0
- package/dist/dashboard-v2/lib/colors.d.ts +61 -0
- package/dist/dashboard-v2/lib/colors.d.ts.map +1 -0
- package/dist/dashboard-v2/lib/colors.js +198 -0
- package/dist/dashboard-v2/lib/colors.js.map +1 -0
- package/dist/dashboard-v2/lib/hierarchy.d.ts +74 -0
- package/dist/dashboard-v2/lib/hierarchy.d.ts.map +1 -0
- package/dist/dashboard-v2/lib/hierarchy.js +196 -0
- package/dist/dashboard-v2/lib/hierarchy.js.map +1 -0
- package/dist/dashboard-v2/types/index.d.ts +154 -0
- package/dist/dashboard-v2/types/index.d.ts.map +1 -0
- package/dist/dashboard-v2/types/index.js +6 -0
- package/dist/dashboard-v2/types/index.js.map +1 -0
- package/dist/storage/adapter.d.ts +21 -1
- package/dist/storage/adapter.d.ts.map +1 -1
- package/dist/storage/adapter.js +36 -0
- package/dist/storage/adapter.js.map +1 -1
- package/dist/storage/sqlite-adapter.d.ts +34 -0
- package/dist/storage/sqlite-adapter.d.ts.map +1 -1
- package/dist/storage/sqlite-adapter.js +253 -12
- package/dist/storage/sqlite-adapter.js.map +1 -1
- package/dist/utils/agent-config.d.ts +45 -0
- package/dist/utils/agent-config.d.ts.map +1 -0
- package/dist/utils/agent-config.js +118 -0
- package/dist/utils/agent-config.js.map +1 -0
- package/dist/wrapper/client.d.ts +8 -0
- package/dist/wrapper/client.d.ts.map +1 -1
- package/dist/wrapper/client.js +26 -0
- package/dist/wrapper/client.js.map +1 -1
- package/dist/wrapper/parser.d.ts +17 -0
- package/dist/wrapper/parser.d.ts.map +1 -1
- package/dist/wrapper/parser.js +334 -10
- package/dist/wrapper/parser.js.map +1 -1
- package/dist/wrapper/tmux-wrapper.d.ts +37 -2
- package/dist/wrapper/tmux-wrapper.d.ts.map +1 -1
- package/dist/wrapper/tmux-wrapper.js +178 -18
- package/dist/wrapper/tmux-wrapper.js.map +1 -1
- package/docs/AGENTS.md +105 -0
- package/docs/ARCHITECTURE_DECISIONS.md +175 -0
- package/docs/COMPETITIVE_ANALYSIS.md +897 -0
- package/docs/DESIGN_BRIDGE_STAFFING.md +878 -0
- package/docs/MONETIZATION.md +1679 -0
- package/docs/agent-relay-snippet.md +61 -0
- package/docs/dashboard-v2-plan.md +179 -0
- package/package.json +5 -2
package/docs/AGENTS.md
CHANGED
|
@@ -79,6 +79,60 @@ relay wrap -n PlayerO claude
|
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
82
|
+
## Agent Role Auto-Detection
|
|
83
|
+
|
|
84
|
+
When you start an agent with `-n`, the name is matched against agent definitions in your project. If a matching agent file exists, the agent automatically assumes that role.
|
|
85
|
+
|
|
86
|
+
**Supported locations:**
|
|
87
|
+
- `.claude/agents/<name>.md` - Claude Code agents
|
|
88
|
+
- `.openagents/<name>.md` - OpenAgents format
|
|
89
|
+
|
|
90
|
+
### Example
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# If .claude/agents/lead.md exists:
|
|
94
|
+
relay wrap -n lead claude
|
|
95
|
+
# → Agent automatically assumes the Lead role defined in lead.md
|
|
96
|
+
|
|
97
|
+
# If .claude/agents/implementer.md exists:
|
|
98
|
+
relay wrap -n implementer claude
|
|
99
|
+
# → Agent assumes the Implementer role
|
|
100
|
+
|
|
101
|
+
# No matching file? Agent starts with default behavior
|
|
102
|
+
relay wrap -n CustomName claude
|
|
103
|
+
# → Standard agent, no role injection
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### How It Works
|
|
107
|
+
|
|
108
|
+
1. Agent name from `-n` flag is matched **case-insensitively**
|
|
109
|
+
2. System checks for `<project>/.claude/agents/<name>.md` or `<project>/.openagents/<name>.md`
|
|
110
|
+
3. If found, the agent definition is injected into the agent's initial context
|
|
111
|
+
4. Agent assumes the persona, instructions, and behaviors defined in the file
|
|
112
|
+
|
|
113
|
+
**Case insensitive matching:**
|
|
114
|
+
```bash
|
|
115
|
+
relay wrap -n Lead claude # matches lead.md
|
|
116
|
+
relay wrap -n LEAD claude # matches lead.md
|
|
117
|
+
relay wrap -n lead claude # matches lead.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Creating Role Agents
|
|
121
|
+
|
|
122
|
+
Create agent files for your team roles:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
.claude/agents/
|
|
126
|
+
├── lead.md # Coordinator, delegates work
|
|
127
|
+
├── implementer.md # Writes code, fixes bugs
|
|
128
|
+
├── designer.md # UI/UX, frontend work
|
|
129
|
+
└── reviewer.md # Code review, quality checks
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Each file follows the standard Claude agent format with frontmatter and instructions.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
82
136
|
## Team Communication
|
|
83
137
|
|
|
84
138
|
If you have an INSTRUCTIONS.md file in `/tmp/agent-relay-team/{YourName}/`, use these commands:
|
|
@@ -111,6 +165,15 @@ relay team status
|
|
|
111
165
|
->relay:* Broadcast to all agents
|
|
112
166
|
```
|
|
113
167
|
|
|
168
|
+
**Fenced format** (multi-line with blank lines/code):
|
|
169
|
+
```
|
|
170
|
+
->relay:AgentName <<<
|
|
171
|
+
Multi-line message here.
|
|
172
|
+
|
|
173
|
+
Can include blank lines and code.
|
|
174
|
+
>>>
|
|
175
|
+
```
|
|
176
|
+
|
|
114
177
|
**Block format** (structured data):
|
|
115
178
|
```
|
|
116
179
|
[[RELAY]]{"to":"AgentName","type":"message","body":"Your message"}[[/RELAY]]
|
|
@@ -355,6 +418,48 @@ Requirements:
|
|
|
355
418
|
|
|
356
419
|
---
|
|
357
420
|
|
|
421
|
+
## Spawning Agents
|
|
422
|
+
|
|
423
|
+
Any agent can spawn worker agents to delegate tasks. Workers run in separate tmux windows and can communicate via relay.
|
|
424
|
+
|
|
425
|
+
### Spawn a Worker
|
|
426
|
+
|
|
427
|
+
Output this pattern to spawn a new agent:
|
|
428
|
+
```
|
|
429
|
+
->relay:spawn WorkerName cli "task description"
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Examples:**
|
|
433
|
+
```
|
|
434
|
+
->relay:spawn Dev1 claude "Implement the login endpoint with JWT auth"
|
|
435
|
+
->relay:spawn Reviewer claude "Review the auth module in src/auth/"
|
|
436
|
+
->relay:spawn Tester claude "Write unit tests for the user service"
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Release a Worker
|
|
440
|
+
|
|
441
|
+
When a worker is done, release it:
|
|
442
|
+
```
|
|
443
|
+
->relay:release WorkerName
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### How It Works
|
|
447
|
+
|
|
448
|
+
1. The spawn command creates a new tmux window
|
|
449
|
+
2. Launches `agent-relay -n WorkerName cli --dangerously-skip-permissions`
|
|
450
|
+
3. Waits for the agent to register with the daemon
|
|
451
|
+
4. Injects the task as the initial prompt
|
|
452
|
+
5. Worker can communicate back via `->relay:` patterns
|
|
453
|
+
|
|
454
|
+
### Best Practices
|
|
455
|
+
|
|
456
|
+
- Give workers specific, well-scoped tasks
|
|
457
|
+
- Use descriptive names that indicate the worker's purpose
|
|
458
|
+
- Release workers when they complete their tasks
|
|
459
|
+
- Workers can spawn their own workers if needed (nested spawning)
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
358
463
|
## Agent Naming
|
|
359
464
|
|
|
360
465
|
Agent names follow the AdjectiveNoun format:
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Multi-Agent Coordination: Architecture Decisions
|
|
2
|
+
|
|
3
|
+
This document compares approaches to multi-agent coordination and explains when to use each.
|
|
4
|
+
|
|
5
|
+
## Two Approaches
|
|
6
|
+
|
|
7
|
+
### 1. Subagents (Hierarchical)
|
|
8
|
+
|
|
9
|
+
Spawn child agents from a parent, collect results, continue.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
┌─────────┐
|
|
13
|
+
│ Parent │
|
|
14
|
+
└────┬────┘
|
|
15
|
+
│ spawn
|
|
16
|
+
┌───────┼───────┐
|
|
17
|
+
▼ ▼ ▼
|
|
18
|
+
┌───────┐┌───────┐┌───────┐
|
|
19
|
+
│ Child ││ Child ││ Child │
|
|
20
|
+
└───────┘└───────┘└───────┘
|
|
21
|
+
│ │ │
|
|
22
|
+
└───────┼───────┘
|
|
23
|
+
▼ return
|
|
24
|
+
┌─────────┐
|
|
25
|
+
│ Parent │
|
|
26
|
+
└─────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Characteristics:**
|
|
30
|
+
- Tree topology (parent orchestrates)
|
|
31
|
+
- Synchronous - parent waits for children
|
|
32
|
+
- Ephemeral - children die after returning
|
|
33
|
+
- State held by parent
|
|
34
|
+
- No peer-to-peer communication
|
|
35
|
+
|
|
36
|
+
### 2. Agent-Relay (Mesh)
|
|
37
|
+
|
|
38
|
+
Persistent agents communicate via message passing.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
┌───────┐ ┌───────┐
|
|
42
|
+
│ Agent │◄───►│ Agent │
|
|
43
|
+
└───┬───┘ └───┬───┘
|
|
44
|
+
│ │
|
|
45
|
+
└──────┬──────┘
|
|
46
|
+
▼
|
|
47
|
+
┌─────────────┐
|
|
48
|
+
│ Daemon │ ← routes messages
|
|
49
|
+
│ (router) │ ← persists history
|
|
50
|
+
└─────────────┘
|
|
51
|
+
│
|
|
52
|
+
┌──────┴──────┐
|
|
53
|
+
▼ ▼
|
|
54
|
+
┌───────┐ ┌───────┐
|
|
55
|
+
│ Agent │◄───►│ Agent │
|
|
56
|
+
└───────┘ └───────┘
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Characteristics:**
|
|
60
|
+
- Mesh topology (any-to-any)
|
|
61
|
+
- Asynchronous - fire and respond
|
|
62
|
+
- Persistent - agents live across tasks
|
|
63
|
+
- Distributed state + message log
|
|
64
|
+
- Direct peer communication
|
|
65
|
+
|
|
66
|
+
## Decision Matrix
|
|
67
|
+
|
|
68
|
+
| Requirement | Subagents | Agent-Relay |
|
|
69
|
+
|-------------|:---------:|:-----------:|
|
|
70
|
+
| Simple one-shot tasks | ✅ | ⚠️ overkill |
|
|
71
|
+
| Clear parent/child hierarchy | ✅ | ✅ |
|
|
72
|
+
| No infrastructure to manage | ✅ | ❌ |
|
|
73
|
+
| Agents debate/negotiate | ❌ | ✅ |
|
|
74
|
+
| Long-running agents | ❌ | ✅ |
|
|
75
|
+
| Mix different AI providers | ⚠️ limited | ✅ |
|
|
76
|
+
| Audit trail / replay | ❌ | ✅ |
|
|
77
|
+
| External observability | ❌ | ✅ |
|
|
78
|
+
| Horizontal scaling | ❌ | ✅ |
|
|
79
|
+
| Resume after crash | ❌ | ✅ |
|
|
80
|
+
|
|
81
|
+
## When to Use Subagents
|
|
82
|
+
|
|
83
|
+
Choose subagents when:
|
|
84
|
+
|
|
85
|
+
1. **Tasks are independent** - Fan out, collect, aggregate
|
|
86
|
+
2. **Hierarchy is natural** - One coordinator, many workers
|
|
87
|
+
3. **No persistence needed** - Results matter, not the conversation
|
|
88
|
+
4. **Same provider** - All agents are Claude (or same SDK)
|
|
89
|
+
5. **Simplicity wins** - Fewer moving parts
|
|
90
|
+
|
|
91
|
+
**Example use cases:**
|
|
92
|
+
- Parallel code analysis (security, perf, style)
|
|
93
|
+
- Research tasks with multiple queries
|
|
94
|
+
- Map-reduce style workloads
|
|
95
|
+
- One-time batch processing
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Subagent pattern
|
|
99
|
+
const [security, perf, style] = await Promise.all([
|
|
100
|
+
analyzeSecurityAgent(code),
|
|
101
|
+
analyzePerfAgent(code),
|
|
102
|
+
analyzeStyleAgent(code),
|
|
103
|
+
]);
|
|
104
|
+
return summarize(security, perf, style);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## When to Use Agent-Relay
|
|
108
|
+
|
|
109
|
+
Choose agent-relay when:
|
|
110
|
+
|
|
111
|
+
1. **Agents need to discuss** - Back-and-forth negotiation
|
|
112
|
+
2. **Persistence matters** - Audit, debug, replay conversations
|
|
113
|
+
3. **Mixed ecosystem** - Claude + Codex + Gemini + custom bots
|
|
114
|
+
4. **External integration** - Dashboard, Slack, webhooks
|
|
115
|
+
5. **Long-running sessions** - Agents stay alive, handle multiple tasks
|
|
116
|
+
6. **Decoupling** - Add/remove agents without code changes
|
|
117
|
+
|
|
118
|
+
**Example use cases:**
|
|
119
|
+
- Collaborative document editing
|
|
120
|
+
- Multi-agent game playing
|
|
121
|
+
- Continuous monitoring systems
|
|
122
|
+
- Team simulations with distinct personas
|
|
123
|
+
- Human-in-the-loop workflows
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Agent-relay pattern
|
|
127
|
+
const daemon = new Daemon({ socketPath, storagePath });
|
|
128
|
+
await daemon.start();
|
|
129
|
+
|
|
130
|
+
// Agents live independently, communicate async
|
|
131
|
+
const architect = new RelayClient({ name: 'Architect', socketPath });
|
|
132
|
+
const developer = new RelayClient({ name: 'Developer', socketPath });
|
|
133
|
+
const reviewer = new RelayClient({ name: 'Reviewer', socketPath });
|
|
134
|
+
|
|
135
|
+
// They message each other directly
|
|
136
|
+
architect.send({ to: 'Developer', body: 'Implement auth module' });
|
|
137
|
+
// Developer works, then...
|
|
138
|
+
developer.send({ to: 'Reviewer', body: 'Ready for review' });
|
|
139
|
+
// Reviewer responds to Developer directly
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Hybrid Approach
|
|
143
|
+
|
|
144
|
+
You can combine both:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
┌─────────────────────────────────────┐
|
|
148
|
+
│ Orchestrator │
|
|
149
|
+
│ (agent-relay) │
|
|
150
|
+
└──────┬──────────────┬───────────────┘
|
|
151
|
+
│ │
|
|
152
|
+
▼ ▼
|
|
153
|
+
┌─────────────┐ ┌─────────────┐
|
|
154
|
+
│ Team Lead │ │ Team Lead │
|
|
155
|
+
│ (relay) │ │ (relay) │
|
|
156
|
+
└──────┬──────┘ └──────┬──────┘
|
|
157
|
+
│ │
|
|
158
|
+
┌───┴───┐ ┌───┴───┐
|
|
159
|
+
▼ ▼ ▼ ▼
|
|
160
|
+
┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
|
|
161
|
+
│Sub 1│ │Sub 2│ │Sub 3│ │Sub 4│ ← subagents
|
|
162
|
+
└─────┘ └─────┘ └─────┘ └─────┘
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- **Agent-relay** for cross-team coordination
|
|
166
|
+
- **Subagents** for parallelizable work within a team
|
|
167
|
+
|
|
168
|
+
## Summary
|
|
169
|
+
|
|
170
|
+
| Approach | Mental Model | Best For |
|
|
171
|
+
|----------|--------------|----------|
|
|
172
|
+
| Subagents | Function calls | Hierarchical, stateless, one-shot |
|
|
173
|
+
| Agent-Relay | Microservices | Mesh, persistent, observable |
|
|
174
|
+
|
|
175
|
+
**Rule of thumb:** Start with subagents. Move to agent-relay when you need persistence, observability, or peer-to-peer communication.
|