overmind-mcp 2.8.21 β†’ 2.8.22

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.
@@ -0,0 +1,414 @@
1
+ # πŸ”₯ OVERMIND v2 β€” Plan de Refactorisation DistribuΓ©e
2
+
3
+ > **Objectif** : Transformer Overmind d'un orchestrateur mono-machine en un **rΓ©seau d'agents distribuΓ©**, capable de devenir un noeud d'un rΓ©seau blockchain agentique RCP.
4
+
5
+ > **Ambition** : L'AGI Γ©mergera de la coopΓ©ration d'agents sur un rΓ©seau dΓ©centralisΓ©. Overmind doit devenir un noeud de ce rΓ©seau.
6
+
7
+ ---
8
+
9
+ ## πŸ“Š Γ‰TAT ACTUEL β€” Audit des Fondations
10
+
11
+ ### Ce qu'on a (positif)
12
+
13
+ | Composant | Fichier | Status | Note |
14
+ |---|---|---|---|
15
+ | Transport JSON-RPC 2.0 | `bridge/BridgeProxy.ts` | βœ… Existe | Localhost seulement |
16
+ | Circuit Breaker | `bridge/types.ts` | βœ… Existe | Closedβ†’Openβ†’Half-Open |
17
+ | MΓ©moire PostgreSQL | `memory/PostgresMemoryProvider.ts` | βœ… Existe | 1 DB par agent + DB core |
18
+ | Embeddings Vectoriels | `embedText()` | βœ… Existe | Qwen 8B, 4096D |
19
+ | MCP Server (14 outils) | `server.ts` | βœ… Existe | FastMCP, local |
20
+ | Process Registry | `lib/processRegistry.ts` | βœ… Existe | Locaux seulement |
21
+ | Orchestration parallΓ¨le | `run_agents_parallel` | βœ… Existe | Local seulement |
22
+ | Swarm | `lib/orchestration/swarm.ts` | ⚠️ Existe | Γ€ vΓ©rifier |
23
+
24
+ ### Ce qui manque (blockers)
25
+
26
+ | Problème | Impact | Priorité |
27
+ |---|---|---|
28
+ | **Pas de RPC distant** | Impossible de connecter 2 machines | πŸ”΄ CRITIQUE |
29
+ | **Pas de discovery/pairing** | Les noeuds ne se trouvent pas | πŸ”΄ CRITIQUE |
30
+ | **MΓ©moire non synchronisΓ©e** | Chaque machine a sa propre DB isolΓ©e | πŸ”΄ CRITIQUE |
31
+ | **Pas d'authentification inter-noeuds** | Sécurité inexistante en distributed | 🟑 HIGH |
32
+ | **Pas de consensus** | Pas de résolution de conflits | 🟑 HIGH |
33
+ | **Pas de tokenomics** | Pas d'incitation économique | 🟒 MEDIUM |
34
+
35
+ ---
36
+
37
+ ## 🧠 MΓ‰MOIRE β€” Diagnostic PrΓ©cis
38
+
39
+ ### Architecture Actuelle (vΓ©rifiΓ©e dans le code)
40
+
41
+ ```
42
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
43
+ β”‚ POSTGRESQL LOCAL β”‚
44
+ β”‚ β”‚
45
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
46
+ β”‚ β”‚ overmind_core β”‚ β”‚ agent_sniperbot β”‚ β”‚
47
+ β”‚ β”‚ (partagΓ©) β”‚ β”‚ (DB propre/agent) β”‚ β”‚
48
+ β”‚ β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
49
+ β”‚ β”‚ knowledge_ β”‚ β”‚ agent_minimax_1 β”‚ β”‚
50
+ β”‚ β”‚ chunks β”‚ β”‚ (DB propre/agent) β”‚ β”‚
51
+ β”‚ β”‚ agent_runs β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
52
+ β”‚ β”‚ β”‚ β”‚ agent_minimax_2 β”‚ β”‚
53
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
54
+ β”‚ β”‚
55
+ β”‚ + Fichiers plats Hermes (MEMORY.md, USER.md) β”‚
56
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
57
+ ```
58
+
59
+ ### La rΓ©alitΓ© du "partagΓ©"
60
+
61
+ En lisant `PostgresMemoryProvider.ts` (lignes 458-521) :
62
+
63
+ 1. **`storeKnowledge()`** β†’ Stocke dans la DB de l'agent (`agent_<name>`)
64
+ 2. **`searchMemory()`** β†’ Cherche dans **DEUX** DBs :
65
+ - `agent_<name>` (DB locale agent)
66
+ - `overmind_core` (DB "partagΓ©e")
67
+ 3. **Mais** β†’ `overmind_core` n'est JAMAIS Γ©crite directement par les agents !
68
+
69
+ **BUG** : La DB "partagΓ©e" (`overmind_core`) existe mais n'est peuplΓ©e que si `agentName` est `undefined`. Les agents avec nom Γ©crivent UNIQUEMENT dans leur DB locale.
70
+
71
+ ### Correction nΓ©cessaire
72
+
73
+ ```typescript
74
+ // storeKnowledge() actuel (ligne 431)
75
+ const dbName = this.getDbName(params.agentName); // β†’ toujours agent_<name>
76
+
77
+ // CORRECTION : Γ©crire dans les DEUX
78
+ // 1. DB locale agent (toujours)
79
+ // 2. DB core si flagged "shared=true"
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 🌐 RPC DISTRIBUΓ‰ β€” Comment Γ§a va marcher en vrai
85
+
86
+ ### ScΓ©nario : 2 ordinateurs distants
87
+
88
+ ```
89
+ MACHINE A (Paris) MACHINE B (Lyon)
90
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
91
+ β”‚ Overmind Node A │◄──WebSocket──►│ Overmind Node B β”‚
92
+ β”‚ β”‚ (encrypted) β”‚ β”‚
93
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
94
+ β”‚ β”‚ PostgreSQL A β”‚ β”‚ β”‚ β”‚ PostgreSQL B β”‚ β”‚
95
+ β”‚ β”‚ (agent_sniperβ”‚ β”‚ β”‚ β”‚ (agent_minim β”‚ β”‚
96
+ β”‚ β”‚ + core) β”‚ β”‚ β”‚ β”‚ + core) β”‚ β”‚
97
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
98
+ β”‚ β”‚ β”‚ β”‚
99
+ β”‚ MCP Server :3099 β”‚ β”‚ MCP Server :3099 β”‚
100
+ β”‚ RPC Relay :3100 β”‚ β”‚ RPC Relay :3100 β”‚
101
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
102
+ β”‚ β”‚
103
+ └──────── Internet (TLS) β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
104
+ ```
105
+
106
+ ### Phase de connexion (handshake)
107
+
108
+ ```
109
+ 1. Node A β†’ Node B : POST /rpc/handshake
110
+ { nodeId: "overmind_paris", version: "2.0", capabilities: [...] }
111
+
112
+ 2. Node B β†’ Node A : POST /rpc/handshake-response
113
+ { nodeId: "overmind_lyon", accepted: true, authToken: "xxx" }
114
+
115
+ 3. WebSocket Γ©tabli β†’ keep-alive bi-directionnel
116
+
117
+ 4. Sync initiale :
118
+ - Node A envoie son catalogue d'agents
119
+ - Node B envoie son catalogue d'agents
120
+ - Γ‰change des schemas de DB
121
+ ```
122
+
123
+ ### Protocole RPC inter-noeuds
124
+
125
+ ```typescript
126
+ interface OvermindRpcMessage {
127
+ jsonrpc: '2.0';
128
+ id: string;
129
+ method: string;
130
+ params: {
131
+ sourceNode: string; // ID du noeud Γ©metteur
132
+ targetAgent?: string; // Agent cible (optionnel)
133
+ authToken: string; // Token de session
134
+ payload: unknown; // DonnΓ©es spΓ©cifiques
135
+ };
136
+ }
137
+
138
+ // MΓ©thodes supportΓ©es :
139
+ // - "agent.run" β†’ Lancer un agent distant
140
+ // - "memory.search" β†’ Chercher dans la mΓ©moire d'un noeud distant
141
+ // - "memory.store" β†’ Γ‰crire dans la mΓ©moire partagΓ©e distante
142
+ // - "agent.stream" β†’ Stream output d'un agent distant
143
+ // - "discovery.ping" β†’ VΓ©rifier la prΓ©sence d'un noeud
144
+ // - "sync.knowledge" β†’ Synchroniser knowledge_chunks
145
+ // - "consensus.propose" β†’ Proposer une dΓ©cision collective
146
+ ```
147
+
148
+ ### Résolution du problème mémoire
149
+
150
+ ```
151
+ AVANT (v1 - actuel) :
152
+ Chaque PostgreSQL est ISOLÉ. Aucune synchronisation.
153
+
154
+ APRÈS (v2 - distribué) :
155
+
156
+ COUCHE 1 : MΓ©moire locale (dΓ©jΓ  lΓ )
157
+ β†’ agent_<name> DB β†’ rapide, privΓ©, pas de sync
158
+
159
+ COUCHE 2 : MΓ©moire partagΓ©e (correction + sync)
160
+ β†’ overmind_core DB β†’ sync entre noeuds via RPC
161
+ β†’ Flag "shared=true" sur storeKnowledge()
162
+ β†’ RΓ©plication eventuelle ou sync pΓ©riodique
163
+
164
+ COUCHE 3 : MΓ©moire globale rΓ©seau (nouveau)
165
+ β†’ Table "network_knowledge" dans overmind_core
166
+ β†’ Source = nodeId + agentName
167
+ β†’ Vector search cross-noeuds via RPC relay
168
+ β†’ Chaque noeud maintient un index des embeddings distants
169
+ ```
170
+
171
+ ---
172
+
173
+ ## πŸ—οΈ PHASES DE REFACTORISATION
174
+
175
+ ### Phase 1 β€” Fondations DistribuΓ©es (2-3 semaines)
176
+
177
+ **Objectif** : 2 machines Overmind qui communiquent
178
+
179
+ | TΓ’che | Fichier | Description |
180
+ |---|---|---|
181
+ | 1.1 | `src/rpc/RpcServer.ts` | Serveur WebSocket + HTTP pour RPC inter-noeuds |
182
+ | 1.2 | `src/rpc/RpcClient.ts` | Client pour appeler des mΓ©thodes sur un noeud distant |
183
+ | 1.3 | `src/rpc/NodeIdentity.ts` | IdentitΓ© crypto du noeud (keypair, nodeId, signature) |
184
+ | 1.4 | `src/rpc/Handshake.ts` | Protocole de handshake sΓ©curisΓ© (challenge-response) |
185
+ | 1.5 | `src/rpc/config.ts` | Config distributed : peers, ports, TLS |
186
+ | 1.6 | `.env` | Variables `OVERMIND_NODE_ID`, `OVERMIND_PEERS`, `OVERMIND_RPC_PORT` |
187
+
188
+ **Livrable** : `node A` peut ping `node B` via RPC.
189
+
190
+ ### Phase 2 β€” MΓ©moire DistribuΓ©e (2 semaines)
191
+
192
+ **Objectif** : La mΓ©moire partagΓ©e sync entre 2 machines
193
+
194
+ | TΓ’che | Fichier | Description |
195
+ |---|---|---|
196
+ | 2.1 | `src/memory/PostgresMemoryProvider.ts` | **PATCH** : storeKnowledge() Γ©crit aussi dans core si `shared=true` |
197
+ | 2.2 | `src/memory/DistributedMemoryProvider.ts` | Nouveau provider qui wrap PostgresMemory + RPC relay |
198
+ | 2.3 | `src/rpc/methods/memory_search.ts` | RPC method : chercher dans la mΓ©moire d'un noeud distant |
199
+ | 2.4 | `src/rpc/methods/memory_store.ts` | RPC method : Γ©crire dans la mΓ©moire partagΓ©e distante |
200
+ | 2.5 | `src/memory/SyncEngine.ts` | Moteur de sync incrΓ©mental (last_sync_timestamp) |
201
+ | 2.6 | `src/memory/VectorIndexCache.ts` | Cache local des embeddings distants pour search rapide |
202
+
203
+ **Livrable** : Agent sur Machine A peut chercher dans la mΓ©moire de Machine B.
204
+
205
+ ### Phase 3 β€” ExΓ©cution DistribuΓ©e (2-3 semaines)
206
+
207
+ **Objectif** : Lancer un agent sur une machine distante
208
+
209
+ | TΓ’che | Fichier | Description |
210
+ |---|---|---|
211
+ | 3.1 | `src/rpc/methods/agent_run.ts` | RPC method : lancer un agent distant |
212
+ | 3.2 | `src/rpc/methods/agent_stream.ts` | Stream output d'un agent distant via WebSocket |
213
+ | 3.3 | `src/tools/run_agent.ts` | **PATCH** : ajout du paramètre `targetNode?` |
214
+ | 3.4 | `src/tools/run_agents_parallel.ts` | **PATCH** : dispatch sur plusieurs noeuds |
215
+ | 3.5 | `src/lib/NodeSelector.ts` | SΓ©lection intelligente du noeud (latence, charge, capabilities) |
216
+ | 3.6 | `src/lib/TaskQueue.ts` | File d'attente distribuΓ©e (priority, retry, failover) |
217
+
218
+ **Livrable** : `run_agents_parallel` distribue les tΓ’ches sur Machine A et Machine B.
219
+
220
+ ### Phase 4 β€” RΓ©silience & Consensus (2 semaines)
221
+
222
+ **Objectif** : Le rΓ©seau survit Γ  la perte d'un noeud
223
+
224
+ | TΓ’che | Fichier | Description |
225
+ |---|---|---|
226
+ | 4.1 | `src/rpc/HealthMonitor.ts` | Heartbeat entre noeuds, dΓ©tection de panne |
227
+ | 4.2 | `src/rpc/Failover.ts` | Bascule automatique si un noeud meurt |
228
+ | 4.3 | `src/memory/ConflictResolver.ts` | RΓ©solution de conflits (last-write-wins ou vector clocks) |
229
+ | 4.4 | `src/rpc/methods/consensus.ts` | Consensus simple (majoritΓ©) pour dΓ©cisions collectives |
230
+ | 4.5 | `src/lib/ProcessMigration.ts` | Migration d'un agent d'un noeud Γ  l'autre |
231
+
232
+ **Livrable** : Si Machine B meurt, Machine A prend le relais.
233
+
234
+ ### Phase 5 β€” Couche Blockchain RCP (3-4 semaines)
235
+
236
+ **Objectif** : Overmind devient un noeud d'un rΓ©seau agentique dΓ©centralisΓ©
237
+
238
+ | TΓ’che | Description |
239
+ |---|---|
240
+ | 5.1 | Smart contract de registration d'agent (Solidity β†’ Base/Arbitrum) |
241
+ | 5.2 | Agent Commerce Protocol : agents qui paient des agents |
242
+ | 5.3 | Token de rΓ©compense pour contribution intellectuelle |
243
+ | 5.4 | Discovery on-chain : trouver des agents sur le rΓ©seau mondial |
244
+ | 5.5 | VΓ©rifiable execution : preuve cryptographique qu'un agent a tourΓ© (TEE) |
245
+ | 5.6 | Agent Wallet : chaque agent a son propre wallet on-chain |
246
+
247
+ **Livrable** : Overmind est un noeud du rΓ©seau blockchain agentique RCP.
248
+
249
+ ---
250
+
251
+ ## πŸ” SΓ‰CURITΓ‰ β€” ModΓ¨le de Confiance
252
+
253
+ ```
254
+ NIVEAU 1 : Pair-Γ -pair privΓ© (Phase 1-4)
255
+ β†’ 2 machines qu'on contrΓ΄le
256
+ β†’ Auth par keypair Ed25519
257
+ β†’ TLS obligatoire
258
+ β†’ Pas de tokenomics nΓ©cessaire
259
+
260
+ NIVEAU 2 : RΓ©seau ouvert (Phase 5)
261
+ β†’ N'importe qui peut rejoindre
262
+ β†’ Staking + slashing pour mauvais comportement
263
+ β†’ RΓ©putation on-chain
264
+ β†’ Audit trail immuable
265
+ ```
266
+
267
+ ---
268
+
269
+ ## πŸ“ ARCHITECTURE CIBLE
270
+
271
+ ```
272
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
273
+ β”‚ BLOCKCHAIN LAYER β”‚
274
+ β”‚ (Base / Arbitrum) β”‚
275
+ β”‚ β”‚
276
+ β”‚ β€’ Agent Registry β”‚
277
+ β”‚ β€’ Commerce Protocol β”‚
278
+ β”‚ β€’ Token Rewards β”‚
279
+ β”‚ β€’ Discovery β”‚
280
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
281
+ β”‚
282
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
283
+ β”‚ OVERMIND NODE β”‚
284
+ β”‚ β”‚
285
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
286
+ β”‚ β”‚ RPC Relay :3100 β”‚ β”‚
287
+ β”‚ β”‚ (WebSocket + HTTP) β”‚ β”‚
288
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
289
+ β”‚ β”‚ β”‚
290
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
291
+ β”‚ β”‚ MCP Server :3099 β”‚ β”‚
292
+ β”‚ β”‚ (14 outils + RPC) β”‚ β”‚
293
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
294
+ β”‚ β”‚ β”‚
295
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
296
+ β”‚ β”‚ Memory Layer β”‚ β”‚
297
+ β”‚ β”‚ β€’ Local (agent_*) β”‚ β”‚
298
+ β”‚ β”‚ β€’ Shared (core) β”‚ β”‚
299
+ β”‚ β”‚ β€’ Network (RPC) β”‚ β”‚
300
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
301
+ β”‚ β”‚ β”‚
302
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
303
+ β”‚ β”‚ Agent Runners β”‚ β”‚
304
+ β”‚ β”‚ claude/hermes/kilo β”‚ β”‚
305
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
306
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
307
+ ```
308
+
309
+ ---
310
+
311
+ ## πŸš€ QUICK WINS β€” Ce qu'on peut faire MAINTENANT
312
+
313
+ ### 1. Patch mΓ©moire partagΓ©e (30 min)
314
+
315
+ ```typescript
316
+ // Dans PostgresMemoryProvider.ts, modifier storeKnowledge()
317
+ async storeKnowledge(params: {
318
+ text: string;
319
+ source?: string;
320
+ agentName?: string;
321
+ shared?: boolean; // ← NOUVEAU
322
+ }): Promise<string> {
323
+ // Γ‰crire dans DB agent (local, toujours)
324
+ const agentDbName = this.getDbName(params.agentName);
325
+ const agentPool = await this.getPoolFor(agentDbName);
326
+ await this.initializeDb(agentDbName, agentPool);
327
+
328
+ const id = `k_${sha256(params.text)}_${randomId()}`;
329
+ const source = params.agentName ? `agent|${params.agentName}` : (params.source || 'user');
330
+ const { embedding, model } = await embedText(params.text);
331
+ const embStr = embedding.length > 0 ? `[${embedding.join(',')}]` : null;
332
+
333
+ await agentPool.query(
334
+ `INSERT INTO knowledge_chunks (id, source, text, embedding, model)
335
+ VALUES ($1, $2, $3, $4, $5)
336
+ ON CONFLICT (id) DO UPDATE SET text = EXCLUDED.text, embedding = EXCLUDED.embedding,
337
+ updated_at = extract(epoch from now()) * 1000`,
338
+ [id, source, params.text, embStr, model]
339
+ );
340
+
341
+ // Si partagΓ© β†’ Γ©crire AUSSI dans overmind_core
342
+ if (params.shared && params.agentName) {
343
+ const corePool = await this.getPoolFor(this.coreDbName);
344
+ await this.initializeDb(this.coreDbName, corePool);
345
+ const coreId = `k_shared_${sha256(params.text)}_${randomId()}`;
346
+ await corePool.query(
347
+ `INSERT INTO knowledge_chunks (id, source, text, embedding, model)
348
+ VALUES ($1, $2, $3, $4, $5)
349
+ ON CONFLICT (id) DO UPDATE SET text = EXCLUDED.text, embedding = EXCLUDED.embedding,
350
+ updated_at = extract(epoch from now()) * 1000`,
351
+ [coreId, `shared|${params.agentName}`, params.text, embStr, model]
352
+ );
353
+ }
354
+
355
+ return id;
356
+ }
357
+ ```
358
+
359
+ ### 2. Config .env pour distributed
360
+
361
+ ```env
362
+ # Overmind Distributed Config
363
+ OVERMIND_NODE_ID=overmind_paris
364
+ OVERMIND_RPC_PORT=3100
365
+ OVERMIND_RPC_ENABLED=true
366
+
367
+ # Peers (format: nodeId:host:port)
368
+ OVERMIND_PEERS=overmind_lyon:192.168.1.50:3100
369
+
370
+ # Security
371
+ OVERMIND_NODE_PRIVATE_KEY=<ed25519_key>
372
+ OVERMIND_TLS_ENABLED=true
373
+ ```
374
+
375
+ ### 3. Tunnel entre 2 machines (immΓ©diat, sans code)
376
+
377
+ ```bash
378
+ # Machine A (Paris) β€” tunnel SSH vers Machine B
379
+ ssh -R 3100:localhost:3100 user@machine-b-ip
380
+
381
+ # Ou avec WireGuard (meilleur pour prod)
382
+ wg-quick up overmind-vpn
383
+ ```
384
+
385
+ ---
386
+
387
+ ## πŸ“Š TIMELINE
388
+
389
+ ```
390
+ Semaine 1-3 : Phase 1 β€” RPC Foundations
391
+ Semaine 4-5 : Phase 2 β€” Distributed Memory
392
+ Semaine 6-8 : Phase 3 β€” Distributed Execution
393
+ Semaine 9-10 : Phase 4 β€” Resilience & Consensus
394
+ Semaine 11-14 : Phase 5 β€” Blockchain RCP Layer
395
+
396
+ Total estimΓ© : ~14 semaines (3.5 mois)
397
+ ```
398
+
399
+ ---
400
+
401
+ ## 🎯 INDICATEURS DE SUCCÈS
402
+
403
+ | Phase | KPI | Target |
404
+ |---|---|---|
405
+ | Phase 1 | Latence RPC inter-noeuds | < 100ms |
406
+ | Phase 2 | Search mΓ©moire distante | < 500ms |
407
+ | Phase 3 | Dispatch multi-noeuds | Transparent pour l'utilisateur |
408
+ | Phase 4 | Uptime avec 1 noeud down | 99.9% |
409
+ | Phase 5 | Agents on-chain | 10+ agents enregistrΓ©s |
410
+
411
+ ---
412
+
413
+ *Plan gΓ©nΓ©rΓ© par Sniperbot Analyst β€” 2 Juin 2026*
414
+ *BasΓ© sur l'audit du code source Overmind actuel*