overmind-mcp 2.8.21 β†’ 2.8.23

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,606 @@
1
+ # πŸš€ PLAN DE REFACTORISATION β€” Overmind β†’ RΓ©seau Agentique DΓ©centralisΓ© (AGI-Ready)
2
+
3
+ > **Objectif** : Transformer Overmind d'un orchestrateur mono-machine en un **rΓ©seau de noeuds RPC agentiques** capable d'Γ©mergence collective. Ambitieux mais ancrΓ© dans la rΓ©alitΓ© du code existant.
4
+
5
+ > **Auteur** : Sniperbot Analyst
6
+ > **Date** : Juin 2026
7
+ > **Status** : PROPOSITION β€” En attente de validation
8
+
9
+ ---
10
+
11
+ ## πŸ“Š Γ‰TAT DES LIEUX β€” Ce qu'on a MAINTENANT
12
+
13
+ ### Architecture Actuelle (Mono-Machine)
14
+
15
+ ```
16
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
17
+ β”‚ MACHINE LOCALE (Windows) β”‚
18
+ β”‚ β”‚
19
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” HTTP/JSON-RPC β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
20
+ β”‚ β”‚ Hermes β”‚ ◄──────────────► β”‚ Overmind β”‚ β”‚
21
+ β”‚ β”‚ Gateway β”‚ localhost:3099 β”‚ MCP Server β”‚ β”‚
22
+ β”‚ β”‚ (Agent) β”‚ β”‚ (port 3099) β”‚ β”‚
23
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
24
+ β”‚ β”‚ β”‚
25
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
26
+ β”‚ β”‚ β”‚ β”‚
27
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚
28
+ β”‚ β”‚ PostgreSQL β”‚ β”‚ PostgreSQL β”‚ β”‚
29
+ β”‚ β”‚ overmind_coreβ”‚ β”‚ agent_sniper β”‚ β”‚
30
+ β”‚ β”‚ (partagΓ©) β”‚ β”‚ (agent-local) β”‚ β”‚
31
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
32
+ β”‚ β”‚ β”‚
33
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚
34
+ β”‚ β”‚ PostgreSQL β”‚ β”‚
35
+ β”‚ β”‚ agent_miniX β”‚ (1 DB par agent) β”‚
36
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
37
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
38
+ ```
39
+
40
+ ### Ce qui existe DÉJA dans le code
41
+
42
+ | Composant | Fichier | Status |
43
+ |---|---|---|
44
+ | **JSON-RPC 2.0 Bridge** | `src/bridge/types.ts` | βœ… OpΓ©rationnel |
45
+ | **Circuit Breaker** | `src/bridge/BridgeProxy.ts` | βœ… Closedβ†’Openβ†’Half-Open |
46
+ | **Memory Factory** | `src/memory/MemoryFactory.ts` | βœ… PostgreSQL only |
47
+ | **DB par agent** | `PostgresMemoryProvider.ts:91` | βœ… `agent_<name>` isolΓ© |
48
+ | **DB partagΓ©e** | `PostgresMemoryProvider.ts:77` | βœ… `overmind_core` |
49
+ | **Recherche cross-DB** | `PostgresMemoryProvider.ts:465` | βœ… Agent DB + Core DB |
50
+ | **pgvector embeddings** | `PostgresMemoryProvider.ts:442` | βœ… Qwen 8B, 4096D |
51
+ | **Process Registry** | `src/lib/processRegistry.ts` | βœ… PID tracking |
52
+ | **Swarm orchestration** | `src/lib/orchestration/swarm.ts` | ⚠️ Existe, à explorer |
53
+ | **14 outils MCP** | `src/server.ts` | βœ… Complets |
54
+
55
+ ### Le VRAI problème mémoire
56
+
57
+ ```typescript
58
+ // PostgresMemoryProvider.ts lignes 91-94
59
+ private getDbName(agentName?: string): string {
60
+ if (!agentName) return this.coreDbName; // "overmind_core"
61
+ return `agent_${this.sanitizeIdentifier(agentName)}`; // "agent_sniper"
62
+ }
63
+ ```
64
+
65
+ **RΓ©alitΓ©** :
66
+ - ❌ **Pas de vraie mΓ©moire communautaire** β€” `overmind_core` existe mais n'est alimentΓ© QUE par `memory_store` sans `agentName`
67
+ - ❌ **Pas de sync inter-machines** β€” PostgreSQL est local (127.0.0.1:5432)
68
+ - ❌ **Pas de gossip protocol** β€” les agents ne partagent pas entre eux
69
+ - βœ… **La base technique existe** β€” DB par agent + DB core + vector search
70
+
71
+ ---
72
+
73
+ ## 🎯 VISION β€” Ce qu'on veut ATTEINDRE
74
+
75
+ ### Architecture Cible (RΓ©seau Multi-Noeuds)
76
+
77
+ ```
78
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
79
+ β”‚ NOEUD A (Machine 1) β”‚ β”‚ NOEUD B (Machine 2) β”‚
80
+ β”‚ Windows/Desktop β”‚ β”‚ Linux/Cloud β”‚
81
+ β”‚ β”‚ β”‚ β”‚
82
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
83
+ β”‚ β”‚ Hermes β”‚ β”‚ Overmind β”‚ β”‚ β”‚ β”‚ Hermes β”‚ β”‚ Overmind β”‚ β”‚
84
+ β”‚ β”‚ Agents β”‚ β”‚ Node A β”‚ β”‚ β”‚ β”‚ Agents β”‚ β”‚ Node B β”‚ β”‚
85
+ β”‚ β”‚ (x N) β”‚ β”‚ (RPC) β”‚ β”‚ β”‚ β”‚ (x N) β”‚ β”‚ (RPC) β”‚ β”‚
86
+ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚
87
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
88
+ β”‚ β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”‚
89
+ β”‚ β”‚ PG Localβ”‚ β”‚ Sync β”‚ β”‚ β”‚ β”‚ PG Localβ”‚ β”‚ Sync β”‚ β”‚
90
+ β”‚ β”‚ agents β”‚ β”‚ Engine │◄┼─────┼─►│ agents β”‚ β”‚ Engine β”‚ β”‚
91
+ β”‚ β”‚ + core β”‚ β”‚ (Gossip) β”‚ β”‚ β”‚ β”‚ + core β”‚ β”‚ (Gossip) β”‚ β”‚
92
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
93
+ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
94
+ β”‚ β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”‚
95
+ β”‚ β”‚ Mesh β”‚ β”‚ β”‚ β”‚ Mesh β”‚ β”‚
96
+ β”‚ β”‚ Layer β”‚ β”‚ β”‚ β”‚ Layer β”‚ β”‚
97
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
98
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
99
+ β”‚ β”‚
100
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
101
+ β”‚
102
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
103
+ β”‚ Shared Core β”‚
104
+ β”‚ (PostgreSQL β”‚
105
+ β”‚ RΓ©pliquΓ©) β”‚
106
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
107
+ ```
108
+
109
+ ---
110
+
111
+ ## πŸ“‹ PHASE 1 β€” Fondations RΓ©seau (2-3 semaines)
112
+
113
+ ### 1.1 Refactor du Memory Provider β†’ Multi-Source
114
+
115
+ **Problème actuel** : `PostgresMemoryProvider` hardcode `127.0.0.1:5432`.
116
+
117
+ **Solution** : Config multi-sources.
118
+
119
+ ```typescript
120
+ // NOUVEAU : memory/MemoryConfig.ts
121
+ interface MemorySource {
122
+ name: string;
123
+ type: 'local' | 'remote' | 'shared';
124
+ host: string;
125
+ port: number;
126
+ database: string;
127
+ auth: 'env' | 'token';
128
+ priority: number; // 0 = primaire, 1+ = fallback
129
+ syncMode: 'none' | 'push' | 'pull' | 'bidirectional';
130
+ }
131
+ ```
132
+
133
+ **Fichiers Γ  modifier** :
134
+ - `src/memory/PostgresMemoryProvider.ts` β†’ Accepter config dynamique
135
+ - `src/memory/MemoryFactory.ts` β†’ Multi-provider pool
136
+ - Nouveau : `src/memory/MemorySync.ts` β†’ Sync engine
137
+
138
+ ### 1.2 Noeud RPC β€” Transport Layer
139
+
140
+ **Existant** : BridgeProxy utilise dΓ©jΓ  JSON-RPC 2.0 sur HTTP.
141
+
142
+ **Extension** : Ajouter un mode "server" au Bridge.
143
+
144
+ ```typescript
145
+ // NOUVEAU : src/bridge/RpcNode.ts
146
+ interface RpcNode {
147
+ nodeId: string; // UUID du noeud
148
+ endpoints: string[]; // ["http://192.168.1.10:3099/mcp"]
149
+ capabilities: string[]; // ["memory", "run_agent", "orchestration"]
150
+ status: 'online' | 'offline' | 'syncing';
151
+ lastHeartbeat: number;
152
+ agentCount: number;
153
+ }
154
+ ```
155
+
156
+ **Comment Γ§a marche entre 2 PC distants** :
157
+
158
+ ```
159
+ Machine A (Windows, IP: 192.168.1.10)
160
+ β†’ Overmind MCP Server Γ©coute sur 0.0.0.0:3099 (pas juste localhost)
161
+ β†’ DΓ©clare ses agents locaux
162
+ β†’ Se connecte Γ  Machine B via HTTP
163
+
164
+ Machine B (Linux, IP: 192.168.1.20)
165
+ β†’ Overmind MCP Server Γ©coute sur 0.0.0.0:3099
166
+ β†’ DΓ©clare ses agents locaux
167
+ β†’ Se connecte Γ  Machine A via HTTP
168
+
169
+ Flux RPC:
170
+ A.run_agent("analyse_crypto")
171
+ β†’ A check si agent local disponible
172
+ β†’ Si non, forward Γ  B via RPC
173
+ β†’ B exΓ©cute, retourne rΓ©sultat Γ  A
174
+ β†’ A stocke en mΓ©moire locale + notifie B (sync)
175
+ ```
176
+
177
+ **Pas besoin de WebSocket** β€” HTTP + polling/heartbeat suffit pour 2 noeuds.
178
+
179
+ ### 1.3 Gossip Protocol (Light)
180
+
181
+ ```typescript
182
+ // NOUVEAU : src/bridge/GossipEngine.ts
183
+ class GossipEngine {
184
+ // Chaque noeud partage :
185
+ // 1. Sa liste d'agents disponibles
186
+ // 2. Ses capabilities (memory, compute, models)
187
+ // 3. Son statut (load, queue depth)
188
+
189
+ async broadcastKnowledge(chunk: KnowledgeChunk): Promise<void> {
190
+ // Pousse un knowledge_chunk vers les autres noeuds
191
+ // Pas de sync complet β€” seulement les nouveautΓ©s
192
+ }
193
+
194
+ async requestKnowledge(query: string): Promise<SearchResult[]> {
195
+ // Demande aux autres noeuds de chercher dans leur mΓ©moire
196
+ // Agrège les résultats
197
+ }
198
+ }
199
+ ```
200
+
201
+ **FrΓ©quence** : Heartbeat toutes les 30s, sync knowledge toutes les 5min.
202
+
203
+ ---
204
+
205
+ ## πŸ“‹ PHASE 2 β€” MΓ©moire DistribuΓ©e (2-3 semaines)
206
+
207
+ ### 2.1 Le Problème Mémoire — Diagnostic Précis
208
+
209
+ **Ce qui existe RÉELLEMENT** :
210
+
211
+ | Couche | ImplΓ©mentation | Isolation | Partage |
212
+ |---|---|---|---|
213
+ | **Fichiers plats Hermes** | MEMORY.md, USER.md | Par agent | ❌ Aucun |
214
+ | **DB locale Overmind** | `agent_<name>` PostgreSQL | Par agent | ❌ Aucun |
215
+ | **DB Core** | `overmind_core` PostgreSQL | Global | ⚠️ Existe mais vide |
216
+ | **Cross-DB search** | `searchMemory()` lignes 458-521 | Lit agent + core | βœ… Code prΓ©sent |
217
+
218
+ **Le "overmind_core" EST la mΓ©moire partagΓ©e**. Elle fonctionne. Mais :
219
+ - Personne n'y Γ©crit systΓ©matiquement
220
+ - Pas de mΓ©canisme de push automatique
221
+ - Pas de sync entre machines
222
+
223
+ ### 2.2 Solution β€” 3 Zones MΓ©moire
224
+
225
+ ```
226
+ Zone 1: PRIVATE (agent-local, jamais partagΓ©)
227
+ β†’ DB: agent_<name>
228
+ β†’ Contenu: prΓ©fΓ©rences user, corrections, notes perso
229
+ β†’ Flag: source = "private"
230
+
231
+ Zone 2: SHARED (noeud-local, partagΓ© entre agents du mΓͺme noeud)
232
+ β†’ DB: overmind_core
233
+ β†’ Contenu: dΓ©cisions architecturales, patterns, erreurs communes
234
+ β†’ Flag: source = "shared"
235
+ β†’ Auto-sync: tout knowledge avec source="shared" β†’ gossip push
236
+
237
+ Zone 3: FEDERATED (cross-noeuds, partagΓ© entre toutes les machines)
238
+ β†’ DB: overmind_federation (nouvelle)
239
+ β†’ Contenu: discoveries, breakthroughs, AGI-signals
240
+ β†’ Flag: source = "federation"
241
+ β†’ Sync: gossip protocol β†’ tous les noeuds
242
+ ```
243
+
244
+ ### 2.3 Modifications Code MΓ©moire
245
+
246
+ ```typescript
247
+ // MODIFIER : PostgresMemoryProvider.ts
248
+
249
+ // Avant :
250
+ private getDbName(agentName?: string): string {
251
+ if (!agentName) return this.coreDbName;
252
+ return `agent_${this.sanitizeIdentifier(agentName)}`;
253
+ }
254
+
255
+ // Après :
256
+ private getDbName(agentName?: string, zone?: 'private' | 'shared' | 'federation'): string {
257
+ switch (zone) {
258
+ case 'private': return `agent_${this.sanitizeIdentifier(agentName!)}`;
259
+ case 'shared': return this.coreDbName;
260
+ case 'federation': return 'overmind_federation';
261
+ default:
262
+ if (!agentName) return this.coreDbName;
263
+ return `agent_${this.sanitizeIdentifier(agentName)}`;
264
+ }
265
+ }
266
+
267
+ // searchMemory() Γ©tendu :
268
+ async searchMemory(params: SearchMemoryParams): Promise<SearchResult[]> {
269
+ const dbsToSearch = [
270
+ this.getDbName(params.agentName, 'private'), // Zone 1
271
+ this.getDbName(undefined, 'shared'), // Zone 2
272
+ ];
273
+
274
+ // Si federation activΓ©e, interroger les autres noeuds
275
+ if (params.includeFederation) {
276
+ const remoteResults = await this.gossipEngine.queryRemote(params.query);
277
+ dbsToSearch.push(...remoteResults);
278
+ }
279
+ // ... reste du code existant
280
+ }
281
+ ```
282
+
283
+ ### 2.4 PostgreSQL Replication β€” RΓ©alitΓ© Technique
284
+
285
+ **Pour 2 machines distantes, 3 options** :
286
+
287
+ | Option | ComplexitΓ© | Performance | Recommandation |
288
+ |---|---|---|---|
289
+ | **A. Logical Replication PG** | πŸ”΄ Haute | 🟒 Excellente | Si les 2 machines ont PG |
290
+ | **B. Application-level sync** | 🟑 Moyenne | 🟑 Bonne | βœ… **RecommandΓ©** |
291
+ | **C. Shared remote PG** | 🟒 Simple | 🟑 Dépend réseau | Pour débuter |
292
+
293
+ **Recommandation** : **Option B** (application-level sync via GossipEngine).
294
+
295
+ Pourquoi :
296
+ - Pas besoin de config PG replication
297
+ - Marche avec n'importe quel hΓ©bergement PG
298
+ - ContrΓ΄le total sur quoi sync et quand
299
+ - Le code Overmind gère le sync, pas PostgreSQL
300
+
301
+ ```typescript
302
+ // Flux de sync entre 2 machines :
303
+ //
304
+ // Machine A β†’ stocke knowledge "Bitcoin pattern dΓ©tectΓ©"
305
+ // β†’ GossipEngine.broadcastKnowledge(chunk)
306
+ // β†’ HTTP POST vers Machine B /sync/knowledge
307
+ // → Machine B reçoit, insère dans overmind_federation
308
+ // β†’ Machine B ACK
309
+ // β†’ Machine A marque comme "synced"
310
+ ```
311
+
312
+ ---
313
+
314
+ ## πŸ“‹ PHASE 3 β€” Noeud RPC & Communication Distante (2 semaines)
315
+
316
+ ### 3.1 Architecture RPC RΓ©elle
317
+
318
+ ```
319
+ MACHINE A (Chez toi, Windows)
320
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
321
+ IP: 192.168.1.10 (ou IP publique avec port-forward)
322
+
323
+ Process 1: Overmind MCP Server (port 3099)
324
+ β†’ Γ‰coute 0.0.0.0:3099 (pas 127.0.0.1 !)
325
+ β†’ HTTP + JSON-RPC 2.0
326
+ β†’ Auth: Bearer token
327
+
328
+ Process 2: Hermes Gateway (sniperbot)
329
+ β†’ Se connecte Γ  localhost:3099
330
+
331
+ Process 3: PostgreSQL (port 5432)
332
+ β†’ Γ‰coute 0.0.0.0:5432
333
+ β†’ Auth: password + pg_hba.conf pour IP distante
334
+
335
+ MACHINE B (Distant, Linux/VPS)
336
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
337
+ IP: xx.xx.xx.xx
338
+
339
+ Process 1: Overmind MCP Server (port 3099)
340
+ Process 2: Hermes Gateway (autres agents)
341
+ Process 3: PostgreSQL (port 5432)
342
+ ```
343
+
344
+ ### 3.2 Configuration Noeud
345
+
346
+ ```yaml
347
+ # NOUVEAU FICHIER : overmind.config.yaml
348
+
349
+ node:
350
+ id: "node_alpha"
351
+ bind: "0.0.0.0:3099"
352
+ auth:
353
+ type: "bearer"
354
+ token: "${OVERMIND_NODE_TOKEN}" # env var
355
+
356
+ peers:
357
+ - id: "node_beta"
358
+ endpoint: "http://xx.xx.xx.xx:3099/mcp"
359
+ token: "${OVERMIND_PEER_BETA_TOKEN}"
360
+ sync:
361
+ knowledge: true # sync connaissances
362
+ runs: false # ne pas sync les runs (trop lourd)
363
+ interval_ms: 300000 # sync toutes les 5 min
364
+
365
+ memory:
366
+ local:
367
+ host: "127.0.0.1"
368
+ port: 5432
369
+ zones:
370
+ private: true # agent_<name> DB
371
+ shared: true # overmind_core DB
372
+ federation: true # overmind_federation DB
373
+ embedding:
374
+ model: "qwen-8b"
375
+ dimensions: 4096
376
+
377
+ agents:
378
+ - name: "sniperbot_analyst"
379
+ runner: "hermes"
380
+ memory_zone: ["private", "shared"]
381
+ - name: "federation_scanner"
382
+ runner: "hermes"
383
+ memory_zone: ["shared", "federation"] # agent dΓ©diΓ© au partage
384
+ ```
385
+
386
+ ### 3.3 Comment le partage fonctionne RÉELLEMENT
387
+
388
+ **ScΓ©nario : 2 ordinateurs, 1 rΓ©seau**
389
+
390
+ ```
391
+ Étape 1: DÉMARRAGE
392
+ Node A dΓ©marre β†’ heartbeat vers Node B
393
+ Node B dΓ©marre β†’ heartbeat vers Node A
394
+ Chacun dΓ©clare ses agents et capabilities
395
+
396
+ Étape 2: EXÉCUTION LOCALE
397
+ User sur Discord β†’ "Analyse BTC"
398
+ Node A β†’ sniperbot analyse β†’ rΓ©sultat stockΓ© dans:
399
+ - agent_sniperbot (private) βœ…
400
+ - overmind_core (shared) si info importante βœ…
401
+
402
+ Γ‰tape 3: SYNC
403
+ Toutes les 5 min:
404
+ Node A β†’ POST /sync/knowledge β†’ Node B
405
+ "J'ai appris que BTC pattern X..."
406
+ Node B → reçoit → insère dans overmind_federation
407
+ Node B β†’ POST /sync/knowledge β†’ Node A
408
+ "J'ai dΓ©couvert que ETH pattern Y..."
409
+ Node A → reçoit → insère dans overmind_federation
410
+
411
+ Γ‰tape 4: RECHERCHE CROSS-NODE
412
+ User β†’ "Qu'est-ce qu'on sait sur DeFi ?"
413
+ Node A β†’ searchMemory()
414
+ β†’ DB locale (agent + core) βœ…
415
+ β†’ DB federation (sync de B) βœ…
416
+ β†’ RPC query vers B en temps rΓ©el (optionnel)
417
+ RΓ©sultat = merge des 2 sources
418
+ ```
419
+
420
+ **Pas besoin de** :
421
+ - ❌ Blockchain réelle (trop lent pour du RPC)
422
+ - ❌ IPFS (overkill pour 2 noeuds)
423
+ - ❌ WebSocket persistant (HTTP suffit)
424
+ - ❌ Docker/K8s (2 machines = config simple)
425
+
426
+ ### 3.4 SΓ©curitΓ©
427
+
428
+ | Couche | MΓ©canisme |
429
+ |---|---|
430
+ | **Transport** | HTTPS (Let's Encrypt ou self-signed) |
431
+ | **Auth** | Bearer token par paire de noeuds |
432
+ | **DonnΓ©es** | Pas de clΓ©s API dans les syncs |
433
+ | **PG** | pg_hba.conf restrictif + password |
434
+ | **Memory** | Zone private JAMAIS sync |
435
+
436
+ ---
437
+
438
+ ## πŸ“‹ PHASE 4 β€” Agents FΓ©dΓ©rΓ©s (2 semaines)
439
+
440
+ ### 4.1 Federation Agent (Nouveau)
441
+
442
+ Un agent dΓ©diΓ© Γ  la communication inter-noeuds :
443
+
444
+ ```typescript
445
+ // NOUVEAU : src/agents/FederationAgent.ts
446
+ // RΓ΄le : passerelle entre noeuds
447
+
448
+ class FederationAgent {
449
+ // Push : dΓ©couvertes locales β†’ autres noeuds
450
+ async pushDiscoveries(): Promise<void> {
451
+ const recent = await memory.searchRecent({
452
+ zone: 'shared',
453
+ since: this.lastSyncTimestamp,
454
+ minScore: 0.7 // que les dΓ©couvertes importantes
455
+ });
456
+ for (const peer of this.peers) {
457
+ await peer.syncKnowledge(recent);
458
+ }
459
+ }
460
+
461
+ // Pull : demander aux autres noeuds
462
+ async pullKnowledge(query: string): Promise<SearchResult[]> {
463
+ const results = await Promise.all(
464
+ this.peers.map(p => p.search(query))
465
+ );
466
+ return this.mergeAndDedup(results);
467
+ }
468
+
469
+ // Discover : trouver de nouveaux noeuds
470
+ async discoverNodes(): Promise<RpcNode[]> {
471
+ // Pour l'instant: config statique
472
+ // Futur: DNS-based discovery ou DHT
473
+ }
474
+ }
475
+ ```
476
+
477
+ ### 4.2 Agent Mobility (Futur)
478
+
479
+ ```typescript
480
+ // Un agent peut-il migrer entre noeuds ?
481
+ // Oui, si on sΓ©rialise son Γ©tat :
482
+
483
+ interface AgentPackage {
484
+ name: string;
485
+ prompt: string;
486
+ config: object;
487
+ memory_snapshot: KnowledgeChunk[]; // top 100 connaissances
488
+ model: string;
489
+ runner: string;
490
+ }
491
+
492
+ // Node A → Node B : "Je te délègue sniperbot pour 1h"
493
+ // Node B restaure l'agent localement avec son snapshot mΓ©moire
494
+ ```
495
+
496
+ ---
497
+
498
+ ## πŸ“‹ PHASE 5 β€” Γ‰mergence & AGI Signals (3-4 semaines)
499
+
500
+ ### 5.1 Pattern Detection Engine
501
+
502
+ ```typescript
503
+ // NOUVEAU : src/emergence/PatternDetector.ts
504
+
505
+ class PatternDetector {
506
+ // Surveille les connaissances cross-agents pour dΓ©tecter
507
+ // des patterns Γ©mergents
508
+
509
+ async scanForEmergence(): Promise<EmergenceSignal[]> {
510
+ // 1. Collecter les connaissances rΓ©centes de tous les agents
511
+ const recentKnowledge = await this.gatherRecent();
512
+
513
+ // 2. Vector clustering β€” est-ce que des agents
514
+ // arrivent Γ  des conclusions similaires indΓ©pendamment ?
515
+ const clusters = await this.clusterBySimilarity(recentKnowledge);
516
+
517
+ // 3. Convergence detection
518
+ // Si 3+ agents indΓ©pendants dΓ©couvrent la mΓͺme chose
519
+ // = signal d'Γ©mergence
520
+ return clusters
521
+ .filter(c => c.agentDiversity >= 3)
522
+ .map(c => ({
523
+ type: 'convergence',
524
+ topic: c.centroid,
525
+ agents: c.agentNames,
526
+ confidence: c.score,
527
+ timestamp: Date.now()
528
+ }));
529
+ }
530
+ }
531
+ ```
532
+
533
+ ### 5.2 AGI Signal Scoring
534
+
535
+ ```typescript
536
+ interface AGISignal {
537
+ type: 'convergence' | 'novelty' | 'self_modification' | 'cross_domain';
538
+ confidence: number; // 0-1
539
+ agentCount: number; // combien d'agents contribuent
540
+ crossNode: boolean; // span across nodes ?
541
+ novelty: number; // jamais vu avant ?
542
+ }
543
+
544
+ // Score AGI = f(convergence, cross-domain, self-modification, cross-node)
545
+ function calculateAGIScore(signals: AGISignal[]): number {
546
+ const weights = {
547
+ convergence: 0.3,
548
+ cross_domain: 0.3,
549
+ self_modification: 0.2,
550
+ cross_node: 0.2
551
+ };
552
+ // ... scoring logic
553
+ }
554
+ ```
555
+
556
+ ---
557
+
558
+ ## πŸ“… TIMELINE CONSOLIDΓ‰
559
+
560
+ | Phase | DurΓ©e | Livrables | PrioritΓ© |
561
+ |---|---|---|---|
562
+ | **Phase 1** | 2-3 sem | Config multi-source, RpcNode, GossipEngine | πŸ”΄ Haute |
563
+ | **Phase 2** | 2-3 sem | 3 zones mΓ©moire, sync engine | πŸ”΄ Haute |
564
+ | **Phase 3** | 2 sem | Config YAML, auth, PG distant | πŸ”΄ Haute |
565
+ | **Phase 4** | 2 sem | FederationAgent, agent mobility | 🟑 Moyenne |
566
+ | **Phase 5** | 3-4 sem | PatternDetector, AGIScoring | 🟒 Future |
567
+
568
+ **Total estimΓ©** : 11-14 semaines pour le full stack.
569
+
570
+ **MVP (Phases 1-3)** : 6-8 semaines = 2 noeuds qui communiquent avec mΓ©moire sync.
571
+
572
+ ---
573
+
574
+ ## ⚠️ PIÈGES IDENTIFIΓ‰S
575
+
576
+ ### MΓ©moire
577
+ 1. **"overmind_core" est vide en pratique** β€” Personne n'y Γ©crit. Il faut un mΓ©canisme auto-push.
578
+ 2. **Embedding Qwen 8B = 4096D** β€” Trop grand pour HNSW (>2000D). Le code fallback sur SeqScan. OK pour 2 noeuds mais pas scalable Γ  100+.
579
+ 3. **Pas de garbage collection** β€” Les knowledge_chunks s'accumulent sans limite.
580
+
581
+ ### RPC
582
+ 4. **localhost seulement** β€” BridgeProxy hardcode `localhost:3099`. Faut rendre configurable.
583
+ 5. **Pas d'auth** β€” Aucune sΓ©curitΓ© sur le MCP server. N'importe qui peut interroger.
584
+ 6. **Pas de retry distribuΓ©** β€” Si le noeud B est down, A ne sait pas retry.
585
+
586
+ ### RΓ©seau
587
+ 7. **NAT/Firewall** — Si Machine B est derrière un NAT, faut port-forward ou VPN.
588
+ 8. **Latence** β€” HTTP RPC sur Internet = 50-200ms par appel. Acceptable pour sync, trop lent pour inference.
589
+ 9. **Split brain** β€” Si les 2 noeuds perdent connexion, ils divergent. Faut merge conflict resolution.
590
+
591
+ ---
592
+
593
+ ## 🎯 PROCHAINES Γ‰TAPES IMMΓ‰DIATES
594
+
595
+ 1. **Valider ce plan** β€” Feedback du chef
596
+ 2. **CrΓ©er la branche git** `feature/network-refactor`
597
+ 3. **Phase 1.1** β€” Refactor `PostgresMemoryProvider` pour accepter config dynamique
598
+ 4. **Phase 1.2** β€” CrΓ©er `RpcNode.ts` avec config YAML
599
+ 5. **Test local** β€” 2 instances Overmind sur la mΓͺme machine, ports diffΓ©rents
600
+ 6. **Test distant** β€” DΓ©ployer sur 2 machines rΓ©elles
601
+
602
+ ---
603
+
604
+ *Ce plan est vivant. Il sera mis Γ  jour au fur et Γ  mesure de l'avancement.*
605
+
606
+ *β€” Sniperbot Analyst, Juin 2026*