memorix 1.0.7 → 1.0.8
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/CHANGELOG.md +36 -9
- package/README.md +469 -409
- package/README.zh-CN.md +468 -415
- package/TEAM.md +106 -0
- package/dist/cli/index.js +31325 -26915
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/static/app.js +49 -49
- package/dist/dashboard/static/index.html +2 -2
- package/dist/index.js +1061 -234
- package/dist/index.js.map +1 -1
- package/dist/sdk.d.ts +677 -0
- package/dist/sdk.js +18962 -0
- package/dist/sdk.js.map +1 -0
- package/dist/types.d.ts +10 -10
- package/dist/types.js +10 -10
- package/dist/types.js.map +1 -1
- package/docs/AGENT_OPERATOR_PLAYBOOK.md +684 -0
- package/docs/AI_CONTEXT.md +18 -0
- package/docs/API_REFERENCE.md +687 -0
- package/docs/ARCHITECTURE.md +488 -0
- package/docs/CLOUD_SYNC_AND_MULTI_AGENT_RESEARCH.md +470 -0
- package/docs/CONFIGURATION.md +265 -0
- package/docs/DESIGN_DECISIONS.md +358 -0
- package/docs/DEVELOPMENT.md +317 -0
- package/docs/DOCKER.md +138 -0
- package/docs/GIT_MEMORY.md +221 -0
- package/docs/KNOWN_ISSUES_AND_ROADMAP.md +149 -0
- package/docs/MEMORY_FORMATION_PIPELINE.md +224 -0
- package/docs/MODULES.md +383 -0
- package/docs/PERFORMANCE.md +64 -0
- package/docs/README.md +79 -0
- package/docs/SETUP.md +521 -0
- package/docs/hooks-architecture.md +108 -0
- package/package.json +24 -23
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# Historical Cross-IDE Collaboration Research
|
|
2
|
+
|
|
3
|
+
> Historical note: this document records early research. Memorix 1.0.8 product semantics do not promise an automatic chat room between unrelated IDE conversation windows. The supported Agent Team path is explicit autonomous CLI-agent orchestration plus task/message/lock state.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Issue #4 Summary (by AIdeaStudio/Mournight)
|
|
8
|
+
|
|
9
|
+
Three core requests:
|
|
10
|
+
|
|
11
|
+
1. **Parallel Scheduling** — DAG-based task dependencies, contract-based collaboration (agents negotiate schemas first), async execution
|
|
12
|
+
2. **Visual Progress Dashboard** — real-time task graph, agent activity, inter-agent communication logs
|
|
13
|
+
3. **File Locking / Edit Conflicts** — each agent's file scope declared upfront, occupied files visible, prevent conflicting changes
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Deep Dive: How Existing Systems Work
|
|
18
|
+
|
|
19
|
+
### 2.1 Claude Code Agent Teams (Reference Implementation)
|
|
20
|
+
|
|
21
|
+
The most mature coding-agent team system. Key architectural details:
|
|
22
|
+
|
|
23
|
+
#### Architecture
|
|
24
|
+
- **Lead + Teammates** model — one lead session spawns N teammate sessions
|
|
25
|
+
- Each teammate is a **separate Claude Code process** (not a thread)
|
|
26
|
+
- Display: in-process (single terminal, Shift+Down to cycle) or split-panes (tmux/iTerm2)
|
|
27
|
+
- Config stored in `~/.claude/teams/{team-name}/config.json`
|
|
28
|
+
- Task list stored in `~/.claude/tasks/{team-name}/`
|
|
29
|
+
|
|
30
|
+
#### Communication Protocol
|
|
31
|
+
- **`message(to, content)`** — send to one specific teammate (1:1)
|
|
32
|
+
- **`broadcast(content)`** — send to all teammates (1:N, cost scales linearly)
|
|
33
|
+
- **Automatic delivery** — messages are delivered without polling
|
|
34
|
+
- **Idle notifications** — teammate auto-notifies lead when finished
|
|
35
|
+
- The communication is **intra-process** (all sessions on same machine), likely via IPC (Unix domain sockets or named pipes) or file-based message queues
|
|
36
|
+
|
|
37
|
+
#### Task Management
|
|
38
|
+
- **Shared task list** — all agents see task status and can claim available work
|
|
39
|
+
- **Self-claim** — after finishing, a teammate picks up the next unassigned, unblocked task
|
|
40
|
+
- **Lead assigns** — or lead explicitly assigns tasks
|
|
41
|
+
- Hooks: `TeammateIdle` (runs when teammate finishes), `TaskCompleted` (quality gate before marking done)
|
|
42
|
+
|
|
43
|
+
#### File Conflict Strategy
|
|
44
|
+
- **NO file locking mechanism** — relies on best practice: "Avoid file conflicts"
|
|
45
|
+
- Assign different files/modules to different teammates at planning time
|
|
46
|
+
- This works because all agents are on the **same machine, same codebase, same git checkout**
|
|
47
|
+
|
|
48
|
+
#### Limitations (= Memorix Opportunity)
|
|
49
|
+
- **Single-IDE only** — all teammates must be Claude Code sessions
|
|
50
|
+
- **Single-machine only** — no remote teammates
|
|
51
|
+
- **No nested teams** — teammates can't spawn sub-teams
|
|
52
|
+
- **Lead is fixed** — can't transfer leadership
|
|
53
|
+
- **No cross-session persistence** — in-process teammates don't survive `/resume`
|
|
54
|
+
- **No file locking** — relies on human-guided task partitioning
|
|
55
|
+
|
|
56
|
+
### 2.2 Claude Code Subagents (Lightweight Delegation)
|
|
57
|
+
|
|
58
|
+
Different from teams — subagents run **within** a single session:
|
|
59
|
+
|
|
60
|
+
- **Foreground**: blocks main conversation, passes permission prompts through
|
|
61
|
+
- **Background**: runs concurrently, pre-approved permissions, auto-denies unapproved
|
|
62
|
+
- Storage: `~/.claude/projects/{project}/{sessionId}/subagents/agent-{agentId}.jsonl`
|
|
63
|
+
- **Auto-compaction**: each subagent has its own context window, compacts independently
|
|
64
|
+
- Patterns: isolate heavy ops, parallel research, chained subagents
|
|
65
|
+
- **No cross-IDE capability** — purely within Claude Code
|
|
66
|
+
|
|
67
|
+
### 2.3 CrewAI (Python Multi-Agent Framework)
|
|
68
|
+
|
|
69
|
+
#### Communication Model
|
|
70
|
+
- Agents get two auto-injected tools when `allow_delegation=True`:
|
|
71
|
+
- **`Delegate work to coworker(task, context, coworker)`** — assign work to another agent
|
|
72
|
+
- **`Ask question to coworker(question, context, coworker)`** — query another agent
|
|
73
|
+
- Communication is **synchronous** — delegator waits for response
|
|
74
|
+
|
|
75
|
+
#### Process Types
|
|
76
|
+
- **Sequential** — agents take turns in order
|
|
77
|
+
- **Hierarchical** — manager agent coordinates, specialists execute
|
|
78
|
+
- Agents have: role, goal, backstory, tools, allow_delegation flag
|
|
79
|
+
|
|
80
|
+
#### Key Design Choice
|
|
81
|
+
- **Tool-based communication** — agents communicate by calling tools, not via a message bus
|
|
82
|
+
- This means any LLM that can call tools can participate
|
|
83
|
+
- **No real-time awareness** — agents don't know what others are doing in parallel
|
|
84
|
+
|
|
85
|
+
### 2.4 AutoGen (Microsoft Multi-Agent Framework)
|
|
86
|
+
|
|
87
|
+
#### Team Types
|
|
88
|
+
- **RoundRobinGroupChat** — agents take turns speaking
|
|
89
|
+
- **SelectorGroupChat** — an LLM selects the next speaker after each message
|
|
90
|
+
- **MagenticOneGroupChat** — generalist system for web/file tasks
|
|
91
|
+
- **Swarm** — agents use `HandoffMessage` to signal transitions
|
|
92
|
+
|
|
93
|
+
#### Key Patterns
|
|
94
|
+
- **Group chat as shared context** — all agents see the full conversation
|
|
95
|
+
- **Termination conditions** — `TextMentionTermination("APPROVE")`, max messages, etc.
|
|
96
|
+
- **State management** — via `StateGraph` with reducers
|
|
97
|
+
|
|
98
|
+
#### Design Insight
|
|
99
|
+
- AutoGen treats multi-agent as a **conversation** problem, not a task-scheduling problem
|
|
100
|
+
- Agents share a group chat, take turns, and build on each other's messages
|
|
101
|
+
- **No file locking, no task DAG** — purely conversational coordination
|
|
102
|
+
|
|
103
|
+
### 2.5 LangGraph (LangChain's Graph-Based Orchestration)
|
|
104
|
+
|
|
105
|
+
#### Architecture
|
|
106
|
+
- **StateGraph** — nodes are agents/functions, edges define flow
|
|
107
|
+
- **Send** — fan-out to multiple nodes in parallel (map-reduce)
|
|
108
|
+
- **Command** — combine state updates with control flow navigation
|
|
109
|
+
- **Subgraphs** — nested graphs for hierarchical agent teams
|
|
110
|
+
|
|
111
|
+
#### Key Pattern
|
|
112
|
+
- Agents are **graph nodes** that read/write shared state
|
|
113
|
+
- State has **reducers** (like Redux) to merge concurrent updates
|
|
114
|
+
- Control flow is explicit (edges), not emergent (conversation)
|
|
115
|
+
- **Checkpointing** — save/resume execution state
|
|
116
|
+
|
|
117
|
+
### 2.6 MCP Streamable HTTP Transport (Real-Time Foundation)
|
|
118
|
+
|
|
119
|
+
The MCP spec (2025-03-26) defines Streamable HTTP transport:
|
|
120
|
+
|
|
121
|
+
#### How It Works
|
|
122
|
+
- Client sends JSON-RPC via **HTTP POST** to server endpoint
|
|
123
|
+
- Server can respond with `application/json` (simple) or `text/event-stream` (SSE)
|
|
124
|
+
- **SSE enables server-initiated messages** — server can push notifications/requests to client
|
|
125
|
+
- Client can also **GET** the endpoint to open a long-lived SSE stream for server pushes
|
|
126
|
+
|
|
127
|
+
#### Key Capabilities
|
|
128
|
+
- **Bidirectional** — server can send requests TO the client (not just responses)
|
|
129
|
+
- **Session management** — `Mcp-Session-Id` header for stateful connections
|
|
130
|
+
- **Resumability** — streams can be resumed after disconnection via `Last-Event-ID`
|
|
131
|
+
- **Batching** — multiple JSON-RPC messages in a single request/response
|
|
132
|
+
|
|
133
|
+
#### Why This Matters for Memorix
|
|
134
|
+
- Currently Memorix uses **stdio** transport (single-process, single-client)
|
|
135
|
+
- Switching to **Streamable HTTP** enables:
|
|
136
|
+
- Multiple agents connecting to ONE Memorix server
|
|
137
|
+
- Server pushing messages TO agents (real-time notifications)
|
|
138
|
+
- Cross-machine communication (agents on different machines)
|
|
139
|
+
- The Dashboard can also connect as a client (live updates)
|
|
140
|
+
|
|
141
|
+
### 2.7 mcp-memory-service (Cloud Sync Reference)
|
|
142
|
+
|
|
143
|
+
- **Hybrid backend**: 5ms local SQLite + background Cloudflare D1 sync
|
|
144
|
+
- **Zero user-facing latency** — writes go to local SQLite, async sync to cloud
|
|
145
|
+
- **WAL mode** — concurrent read/write without locks
|
|
146
|
+
- **OAuth 2.1** — team members authenticate, share memories
|
|
147
|
+
- **HTTP transport** — team members connect via `claude mcp add --transport http`
|
|
148
|
+
- **Cloudflare D1 free tier**: 100K reads/day, 5M rows, 5GB storage
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 3. Pattern Comparison Matrix
|
|
153
|
+
|
|
154
|
+
| Feature | Claude Code Teams | CrewAI | AutoGen | LangGraph | Memorix (proposed) |
|
|
155
|
+
|---------|------------------|--------|---------|-----------|-------------------|
|
|
156
|
+
| **Cross-IDE** | No | No (Python only) | No (Python only) | No | **Yes** |
|
|
157
|
+
| **Communication** | message/broadcast | Tool calls | Group chat | Shared state | Message bus + SSE |
|
|
158
|
+
| **Task Management** | Shared task list | Sequential/Hierarchical | Turn-based | Graph edges | DAG + self-claim |
|
|
159
|
+
| **File Locking** | No (best practice) | N/A | N/A | N/A | Advisory + TTL |
|
|
160
|
+
| **Real-time** | Yes (intra-process) | No (sync calls) | No (turn-based) | No (batch) | Yes (SSE push) |
|
|
161
|
+
| **Persistence** | Session-scoped | None | None | Checkpoints | Memorix observations |
|
|
162
|
+
| **Dashboard** | Terminal UI | No | No | LangSmith | Web Dashboard |
|
|
163
|
+
| **Transport** | IPC/tmux | In-process | In-process | In-process | **MCP Streamable HTTP** |
|
|
164
|
+
| **Protocol** | Proprietary | Python API | Python API | Python API | **MCP standard** |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 4. Proposed Architecture: Memorix Agent Teams
|
|
169
|
+
|
|
170
|
+
### 4.1 Core Insight
|
|
171
|
+
|
|
172
|
+
Claude Code's agent teams are powerful but **single-IDE, single-machine**. Memorix can be the **cross-IDE coordination layer** because:
|
|
173
|
+
1. Memorix is already installed across all IDEs via MCP
|
|
174
|
+
2. All agents already connect to a shared Memorix server
|
|
175
|
+
3. Memorix already persists context across sessions
|
|
176
|
+
4. The MCP protocol supports Streamable HTTP for real-time communication
|
|
177
|
+
|
|
178
|
+
### 4.2 Transport Evolution
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
Current: IDE ──stdio──► memorix serve (1 client per server instance)
|
|
182
|
+
|
|
183
|
+
Proposed: IDE A ──HTTP──►┐
|
|
184
|
+
IDE B ──HTTP──►├─► memorix serve --http (N clients, 1 server)
|
|
185
|
+
IDE C ──HTTP──►│ + SSE push for real-time notifications
|
|
186
|
+
Dashboard ────►┘
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Step 1**: Add MCP Streamable HTTP transport to `memorix serve`
|
|
190
|
+
- Multiple agents connect to one server via HTTP POST
|
|
191
|
+
- Server pushes events via SSE (new messages, task updates, lock changes)
|
|
192
|
+
- Dashboard connects as another SSE client for live visualization
|
|
193
|
+
|
|
194
|
+
### 4.3 Layer Architecture
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
┌─────────────────────────────────────────────────────────┐
|
|
198
|
+
│ Dashboard (Web UI) │
|
|
199
|
+
│ Task DAG graph, Agent activity, Message logs, File locks│
|
|
200
|
+
└──────────────────────┬──────────────────────────────────┘
|
|
201
|
+
│ SSE
|
|
202
|
+
┌──────────────────────┴──────────────────────────────────┐
|
|
203
|
+
│ Memorix Server (HTTP) │
|
|
204
|
+
│ │
|
|
205
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌──────────────────┐ │
|
|
206
|
+
│ │ Agent │ │ Task │ │ File Lock │ │
|
|
207
|
+
│ │ Registry & │ │ DAG & │ │ Registry │ │
|
|
208
|
+
│ │ Message Bus │ │ Scheduler │ │ (Advisory + TTL) │ │
|
|
209
|
+
│ └─────────────┘ └─────────────┘ └──────────────────┘ │
|
|
210
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌──────────────────┐ │
|
|
211
|
+
│ │ Memory │ │ Diff & │ │ Cloud Sync │ │
|
|
212
|
+
│ │ Store │ │ Contract │ │ (Cloudflare D1) │ │
|
|
213
|
+
│ │ (existing) │ │ Exchange │ │ │ │
|
|
214
|
+
│ └─────────────┘ └─────────────┘ └──────────────────┘ │
|
|
215
|
+
└──┬──────────┬──────────┬──────────┬─────────────────────┘
|
|
216
|
+
│ │ │ │
|
|
217
|
+
▼ ▼ ▼ ▼
|
|
218
|
+
Cursor Windsurf Claude Codex
|
|
219
|
+
Agent A Agent B Code C Agent D
|
|
220
|
+
(Frontend) (Backend) (Test) (Docs)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 4.4 MCP Tools Design
|
|
224
|
+
|
|
225
|
+
#### Layer 1: Agent Registry (agent knows who else is working)
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// Register this agent with the team
|
|
229
|
+
memorix_team_join({
|
|
230
|
+
agent: "windsurf-frontend", // unique agent ID
|
|
231
|
+
role: "frontend", // role in team
|
|
232
|
+
capabilities: ["react", "css"], // what this agent can do
|
|
233
|
+
currentIDE: "windsurf" // which IDE
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
// See who's on the team right now
|
|
237
|
+
memorix_team_status()
|
|
238
|
+
// → [{ agent: "windsurf-frontend", role: "frontend", status: "active",
|
|
239
|
+
// currentFile: "src/App.tsx", currentTask: "task-3", lastSeen: "..." },
|
|
240
|
+
// { agent: "claude-backend", role: "backend", status: "idle", ... }]
|
|
241
|
+
|
|
242
|
+
// Leave the team
|
|
243
|
+
memorix_team_leave({ agent: "windsurf-frontend" })
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Layer 2: Message Bus (agents talk to each other)
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
// Send a message to a specific agent
|
|
250
|
+
memorix_team_send({
|
|
251
|
+
to: "claude-backend",
|
|
252
|
+
type: "question", // question | task | status | diff | contract
|
|
253
|
+
content: "What's the API schema for /api/users?",
|
|
254
|
+
attachments: [{ file: "src/types.ts", diff: "..." }] // optional
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
// Broadcast to all agents
|
|
258
|
+
memorix_team_broadcast({
|
|
259
|
+
type: "status",
|
|
260
|
+
content: "Frontend routing complete. Ready for API integration."
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
// Check my inbox (polling — MCP stdio has no push)
|
|
264
|
+
memorix_team_inbox({ agent: "windsurf-frontend" })
|
|
265
|
+
// → [{ from: "claude-backend", type: "contract", content: "...", time: "..." }]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
When using **HTTP transport with SSE**, inbox messages are **pushed** in real-time instead of polled.
|
|
269
|
+
|
|
270
|
+
#### Layer 3: Task DAG (coordinated parallel work)
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
// Create tasks with dependencies
|
|
274
|
+
memorix_task_create({
|
|
275
|
+
tasks: [
|
|
276
|
+
{ id: "design-api", desc: "Design REST API schema", deps: [] },
|
|
277
|
+
{ id: "impl-frontend", desc: "Implement React frontend", deps: ["design-api"] },
|
|
278
|
+
{ id: "impl-backend", desc: "Implement Express API", deps: ["design-api"] },
|
|
279
|
+
{ id: "write-tests", desc: "Write integration tests", deps: ["impl-frontend", "impl-backend"] }
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
// Claim an available task
|
|
284
|
+
memorix_task_claim({ taskId: "impl-frontend", agent: "windsurf-frontend" })
|
|
285
|
+
|
|
286
|
+
// Complete a task with result summary
|
|
287
|
+
memorix_task_complete({
|
|
288
|
+
taskId: "impl-frontend",
|
|
289
|
+
result: "Implemented 12 components, all rendering correctly",
|
|
290
|
+
filesModified: ["src/App.tsx", "src/components/*.tsx"]
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
// View task board
|
|
294
|
+
memorix_task_list()
|
|
295
|
+
// → [{ id: "design-api", status: "completed", assignee: "claude-backend" },
|
|
296
|
+
// { id: "impl-frontend", status: "in_progress", assignee: "windsurf-frontend" },
|
|
297
|
+
// { id: "impl-backend", status: "available", assignee: null }, ← unblocked!
|
|
298
|
+
// { id: "write-tests", status: "blocked", blockedBy: ["impl-frontend", "impl-backend"] }]
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Layer 4: File Lock Registry (prevent edit conflicts)
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
// Claim files before editing
|
|
305
|
+
memorix_file_lock({
|
|
306
|
+
files: ["src/api/routes.ts", "src/api/middleware.ts"],
|
|
307
|
+
agent: "claude-backend",
|
|
308
|
+
ttl: 600 // auto-release after 10 minutes
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
// Check what's locked
|
|
312
|
+
memorix_file_status()
|
|
313
|
+
// → [{ file: "src/api/routes.ts", agent: "claude-backend", since: "...", ttl: 600 },
|
|
314
|
+
// { file: "src/App.tsx", agent: "windsurf-frontend", since: "...", ttl: 300 }]
|
|
315
|
+
|
|
316
|
+
// Release when done
|
|
317
|
+
memorix_file_unlock({
|
|
318
|
+
files: ["src/api/routes.ts"],
|
|
319
|
+
agent: "claude-backend"
|
|
320
|
+
})
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Layer 5: Diff & Contract Exchange (share work artifacts)
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
// Share a contract (interface definition) with the team
|
|
327
|
+
memorix_team_send({
|
|
328
|
+
to: "*", // broadcast
|
|
329
|
+
type: "contract",
|
|
330
|
+
content: JSON.stringify({
|
|
331
|
+
endpoint: "POST /api/users",
|
|
332
|
+
request: { name: "string", email: "string" },
|
|
333
|
+
response: { id: "number", name: "string", email: "string" }
|
|
334
|
+
}),
|
|
335
|
+
format: "json-schema"
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
// Share a diff for review
|
|
339
|
+
memorix_team_send({
|
|
340
|
+
to: "claude-backend",
|
|
341
|
+
type: "diff",
|
|
342
|
+
content: "--- a/src/types.ts\n+++ b/src/types.ts\n@@ ...",
|
|
343
|
+
attachments: [{ file: "src/types.ts", action: "modified" }]
|
|
344
|
+
})
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### 4.5 Communication Patterns
|
|
348
|
+
|
|
349
|
+
#### Pattern A: Contract-First Parallel Development
|
|
350
|
+
```
|
|
351
|
+
1. Lead agent creates task DAG and contracts
|
|
352
|
+
2. Frontend agent claims frontend tasks, locks relevant files
|
|
353
|
+
3. Backend agent claims backend tasks, locks relevant files
|
|
354
|
+
4. Both develop in parallel against shared contracts
|
|
355
|
+
5. Test agent watches for task completions, claims test tasks when ready
|
|
356
|
+
6. Agents exchange diffs and status updates via message bus
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### Pattern B: Competing Hypotheses (Debug)
|
|
360
|
+
```
|
|
361
|
+
1. User describes bug, lead creates N investigation tasks
|
|
362
|
+
2. Each agent claims one hypothesis, investigates independently
|
|
363
|
+
3. Agents broadcast findings and challenge each other's theories
|
|
364
|
+
4. Agents vote/converge on root cause
|
|
365
|
+
5. Winner implements fix
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### Pattern C: Review Pipeline
|
|
369
|
+
```
|
|
370
|
+
1. Dev agent completes implementation, marks task done
|
|
371
|
+
2. Security agent auto-claims review task (dependency resolved)
|
|
372
|
+
3. Performance agent auto-claims review task (parallel)
|
|
373
|
+
4. Both review, send findings back to dev agent
|
|
374
|
+
5. Dev agent addresses feedback, marks final task done
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### 4.6 Real-Time via MCP Streamable HTTP
|
|
378
|
+
|
|
379
|
+
For agents using HTTP transport (Claude Code, future IDE support):
|
|
380
|
+
|
|
381
|
+
```
|
|
382
|
+
Agent A (POST) ──► Memorix Server
|
|
383
|
+
│
|
|
384
|
+
├──► SSE push to Agent B: "New message from A"
|
|
385
|
+
├──► SSE push to Dashboard: "Agent A sent message"
|
|
386
|
+
└──► SSE push to Agent C: "Task X now unblocked"
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
For agents using stdio transport (Windsurf, Cursor):
|
|
390
|
+
- Fall back to **polling** via `memorix_team_inbox()`
|
|
391
|
+
- Agent's rules file can include instruction: "Check inbox every N turns"
|
|
392
|
+
- Or use hooks (PostToolUse) to auto-check inbox
|
|
393
|
+
|
|
394
|
+
### 4.7 Hybrid Transport Strategy
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
// Server supports both transports simultaneously
|
|
398
|
+
memorix serve --http --port 3211 // HTTP + SSE for agents that support it
|
|
399
|
+
memorix serve // stdio for current IDE integrations
|
|
400
|
+
|
|
401
|
+
// IDE MCP config examples:
|
|
402
|
+
// Cursor/Windsurf (stdio — polling):
|
|
403
|
+
{ "command": "memorix", "args": ["serve"] }
|
|
404
|
+
|
|
405
|
+
// Claude Code (HTTP — real-time push):
|
|
406
|
+
{ "transport": "http", "url": "http://localhost:3211/mcp" }
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## 5. Cloud Sync Options
|
|
412
|
+
|
|
413
|
+
Given user constraints (VPS unstable, shared resources):
|
|
414
|
+
|
|
415
|
+
| Option | Pros | Cons | Recommendation |
|
|
416
|
+
|--------|------|------|----------------|
|
|
417
|
+
| **Cloudflare D1** | Free, 99.99% uptime, SQLite-compat, zero ops | Vendor lock-in | **Best for memory sync** |
|
|
418
|
+
| **Turso** (libSQL) | Native SQLite sync, 9GB free, edge replicas | Newer | Good alternative |
|
|
419
|
+
| **Supabase** | Real-time WebSocket, PostgreSQL, auth built-in | Schema conversion needed | Good for real-time features |
|
|
420
|
+
| **GitHub** | Free, version history, PRs | Not real-time, merge conflicts | Too slow for agent teams |
|
|
421
|
+
| **Self-hosted VPS** | Full control | Unstable, shared resources | **Not recommended** |
|
|
422
|
+
|
|
423
|
+
**Recommendation**: Cloudflare D1 for memory/observation sync (proven by mcp-memory-service). For agent team real-time state (messages, tasks, locks), keep everything **local** on the shared Memorix HTTP server — no cloud needed for same-machine coordination.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## 6. Implementation Roadmap
|
|
428
|
+
|
|
429
|
+
| Phase | Feature | New MCP Tools | Complexity | Dependencies |
|
|
430
|
+
|-------|---------|---------------|------------|--------------|
|
|
431
|
+
| **P0** | HTTP transport for `memorix serve` | 0 | Medium | MCP SDK HTTP support |
|
|
432
|
+
| **P1** | Agent registry + message bus | `team_join`, `team_leave`, `team_status`, `team_send`, `team_broadcast`, `team_inbox` | Medium | P0 |
|
|
433
|
+
| **P2** | File lock registry | `file_lock`, `file_unlock`, `file_status` | Low | P1 |
|
|
434
|
+
| **P3** | Task DAG + scheduler | `task_create`, `task_claim`, `task_complete`, `task_list` | Medium | P1 |
|
|
435
|
+
| **P4** | Dashboard: team activity panel | 0 (extends existing dashboard) | Medium | P1 |
|
|
436
|
+
| **P5** | Contract/diff exchange | Extends `team_send` with attachment types | Low | P1 |
|
|
437
|
+
| **P6** | SSE push notifications | 0 (transport-level) | Medium | P0 |
|
|
438
|
+
| **P7** | Cloud sync (Cloudflare D1) | `team_cloud_setup`, `team_cloud_sync` | Medium | P1 |
|
|
439
|
+
|
|
440
|
+
**Estimated total**: ~13 new MCP tools + HTTP transport upgrade
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## 7. Memorix Differentiator vs Claude Code Teams
|
|
445
|
+
|
|
446
|
+
| Aspect | Claude Code Teams | Memorix Teams |
|
|
447
|
+
|--------|------------------|---------------|
|
|
448
|
+
| IDE support | Claude Code only | Any MCP-compatible IDE |
|
|
449
|
+
| Machine scope | Single machine | Local or remote (via HTTP) |
|
|
450
|
+
| Persistence | Session-scoped | Persistent (observations + cloud) |
|
|
451
|
+
| File locking | None | Advisory + TTL |
|
|
452
|
+
| Task management | Simple list | DAG with dependency resolution |
|
|
453
|
+
| Communication | IPC (proprietary) | MCP standard (portable) |
|
|
454
|
+
| Dashboard | Terminal UI | Web Dashboard with graph visualization |
|
|
455
|
+
| Memory | No cross-session | Full Memorix memory system |
|
|
456
|
+
| Contract sharing | No formal system | Typed contract exchange |
|
|
457
|
+
| Cost | Anthropic API only | Any LLM provider |
|
|
458
|
+
|
|
459
|
+
**Memorix's unique value proposition**: "Claude Code agent teams, but for ANY IDE and ANY LLM."
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## 8. Key Design Decisions to Make
|
|
464
|
+
|
|
465
|
+
1. **Transport priority** — Start with HTTP-only, or support stdio+HTTP hybrid from day one?
|
|
466
|
+
2. **Message persistence** — Store agent messages as observations, or separate ephemeral store?
|
|
467
|
+
3. **Lock enforcement** — Pure advisory (warn only) or block file writes via hooks?
|
|
468
|
+
4. **Task DAG format** — Simple JSON list, or full DAG with contract attachments?
|
|
469
|
+
5. **Cloud scope** — Sync memories only, or also sync team state (tasks, messages)?
|
|
470
|
+
6. **Auto-rules injection** — Should `memorix_session_start` inject "check inbox" instructions?
|