@theihtisham/agent-shadow-brain 6.3.0 → 7.0.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/CHANGELOG.md +411 -391
- package/LICENSE +21 -21
- package/README.md +428 -438
- package/dist/adapters/aider.js +13 -13
- package/dist/adapters/base-adapter.js +14 -14
- package/dist/adapters/codex.js +8 -8
- package/dist/adapters/roo-code.js +18 -18
- package/dist/brain/adr-engine.js +11 -11
- package/dist/brain/analyzer.js +30 -30
- package/dist/brain/auto-update.js +1 -1
- package/dist/brain/global-brain.d.ts +52 -63
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +577 -339
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/health-score.js +19 -19
- package/dist/brain/learning-engine.js +59 -59
- package/dist/brain/mcp-server.d.ts +1 -0
- package/dist/brain/mcp-server.d.ts.map +1 -1
- package/dist/brain/mcp-server.js +16 -6
- package/dist/brain/mcp-server.js.map +1 -1
- package/dist/brain/plugin-system.js +23 -23
- package/dist/brain/pr-generator.js +19 -19
- package/dist/brain/project-context.js +1 -1
- package/dist/brain/project-context.js.map +1 -1
- package/dist/brain/report-generator.js +270 -270
- package/dist/cli.js +105 -34
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
- package/dist/dashboard/v6-dashboard-html.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +28 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/watchers/git-watcher.d.ts.map +1 -1
- package/dist/watchers/git-watcher.js +1 -1
- package/dist/watchers/git-watcher.js.map +1 -1
- package/docs/launch/RELEASE_CHECKLIST_v7.0.0.md +24 -0
- package/docs/launch/RELEASE_NOTES_v7.0.0.md +44 -0
- package/package.json +17 -14
- package/docs/launch/README.md +0 -61
package/README.md
CHANGED
|
@@ -1,438 +1,428 @@
|
|
|
1
|
-
# Agent Shadow Brain
|
|
2
|
-
|
|
3
|
-
Local-first memory and coordination for AI coding agents.
|
|
4
|
-
|
|
5
|
-
Version:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
- **
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
###
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
- **
|
|
281
|
-
- **
|
|
282
|
-
- **
|
|
283
|
-
- **
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
```text
|
|
309
|
-
GET/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
- `global_recall_scored`
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
- `
|
|
343
|
-
- `
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
npm
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
npm
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
- this README
|
|
430
|
-
- `CHANGELOG.md`
|
|
431
|
-
- `docs/launch/RELEASE_NOTES_v6.0.3.md`
|
|
432
|
-
- `docs/launch/RELEASE_CHECKLIST_v6.0.3.md`
|
|
433
|
-
- build/test output
|
|
434
|
-
- npm package dry-run output
|
|
435
|
-
|
|
436
|
-
## License
|
|
437
|
-
|
|
438
|
-
MIT
|
|
1
|
+
# Agent Shadow Brain
|
|
2
|
+
|
|
3
|
+
Local-first memory and coordination for AI coding agents.
|
|
4
|
+
|
|
5
|
+
Version: 7.0.0
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Agent Shadow Brain gives tools like Codex, Claude Code, Cursor, Cline, OpenCode, Aider, and related MCP clients a shared local memory layer. It stores compact, source-backed lessons about projects, recalls them later, generates fresh-session briefings, audits memory quality, and exports JSONL training/eval packs.
|
|
9
|
+
|
|
10
|
+
It does not change model weights by itself. It helps agents work better by giving them relevant, current, source-linked context before and during complex work.
|
|
11
|
+
|
|
12
|
+
## What's New in 7.0.0
|
|
13
|
+
|
|
14
|
+
- **Durable multi-agent memory.** Saves lock, reload, and merge the latest store so independent agents cannot replace each other's new memories. Queued writes acknowledge success after persistence. Failed operations remain retryable and visible in storage health.
|
|
15
|
+
- **Explainable recall.** Results include matched keywords, score components, and identities reporting the same normalized content within the same project and category. Unrelated notes no longer inflate scores. Scores are ranking heuristics, not probabilities of truth or proof of independent verification.
|
|
16
|
+
- **Storage diagnostics.** Use `shadow-brain storage-health --json` or MCP `global_storage_health` to inspect errors and pending operations. Invalid or unsupported stores fail explicitly and remain unchanged.
|
|
17
|
+
- **Safer setup and packaging.** Installation no longer edits agent settings. Help, version, and memory diagnostics do not load provider configuration. Dependencies are refreshed, activity-log text is escaped, and package tests install a real tarball into a fresh consumer project.
|
|
18
|
+
|
|
19
|
+
### Upgrade from 6.x
|
|
20
|
+
|
|
21
|
+
Use Node.js 22.12+ within 22.x, Node 24.x, or Node 26+. Back up your existing `global.json` before upgrading and stop older Shadow Brain writers; older versions do not participate in the new lock protocol. The schema remains version 1. Start integrations explicitly using the existing setup/attach commands after installation.
|
|
22
|
+
|
|
23
|
+
`writeSync()` remains an in-memory operation; call `await brain.sync()` for durable persistence. `await brain.write()` resolves after the background sync or an explicit sync; a false result means persistence failed or the queue was full. Failed accepted operations remain pending for retry. Recall reads the process snapshot, refreshed by sync; it is not an instantaneous cross-process read.
|
|
24
|
+
|
|
25
|
+
### New commands
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
shadow-brain storage-health --json
|
|
29
|
+
shadow-brain storage-health --db ./global.json --json
|
|
30
|
+
shadow-brain recall-explain "deployment rollback" --limit 5
|
|
31
|
+
shadow-brain recall-explain "database migration" --project . --min-confidence 0.4
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`storage-health` validates readability and schema, reports JSON even on failure, and exits with code 1 for an invalid store. It does not repair or rewrite an existing store; when checking a missing store it may create its parent directory. `lastSuccessfulSync` describes the current process only. The MCP health tool inspects existing process state without initializing or flushing it.
|
|
35
|
+
|
|
36
|
+
The library exports `GlobalBrain`, `getGlobalBrain`, and their public types:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { getGlobalBrain } from '@theihtisham/agent-shadow-brain';
|
|
40
|
+
const brain = getGlobalBrain({ dbPath: './global.json' });
|
|
41
|
+
await brain.init();
|
|
42
|
+
console.log(brain.recallScored({ keywords: ['deployment'], limit: 5 }));
|
|
43
|
+
console.log(brain.getStorageHealth());
|
|
44
|
+
await brain.shutdown();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Details: [release notes](docs/launch/RELEASE_NOTES_v7.0.0.md).
|
|
48
|
+
|
|
49
|
+
## Earlier dashboard features
|
|
50
|
+
|
|
51
|
+
- **Simple by default, Advanced on demand.** The dashboard opens with eight plain-English tabs (Home, Brain Map, Memories, Ask the Brain, Activity, Connected Tools, Brain Health, Settings). Flip to Advanced to reveal every feature — nothing was removed, just tidied.
|
|
52
|
+
- **Brain Map.** An interactive graph of everything the brain remembers — memories, projects, tools, and tags — sized by importance (PageRank) and linked by shared context. Zoom, pan, click a node for details, and watch it grow live as new memories arrive.
|
|
53
|
+
- **Realtime activity.** Memory writes, reflections, and tool events stream live over WebSocket instead of polling, with a live pulse on Home.
|
|
54
|
+
- **Live Network.** A refreshed animation of your tools talking to the brain, with flowing signal pulses.
|
|
55
|
+
- **Two-way knowledge seeding.** Quick-Save captures knowledge in one click; "Hand to Agent" generates a ready briefing to pass context back to any tool.
|
|
56
|
+
- **Plain-language everywhere.** Cryptic feature names rewritten (e.g. Calibration → Accuracy, Pre-Mortem → Risk Check, Tokens → Cost & Usage), each with a hover description.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## What It Actually Does
|
|
60
|
+
|
|
61
|
+
- Stores cross-project and cross-agent memories in a local JSON brain at `~/.shadow-brain/global.json`.
|
|
62
|
+
- Recalls memories by project, agent, category, and keywords.
|
|
63
|
+
- Generates source-backed resume packs for fresh sessions, account switches, context compaction, and handoffs.
|
|
64
|
+
- Audits memory quality: source coverage, stale entries, duplicates, low-quality notes, recall health.
|
|
65
|
+
- Creates verified memory seed drafts from dashboard/API, then requires user, agent, or dual approval before writing to durable memory.
|
|
66
|
+
- Exports JSONL rows for evals, distillation, or local fine-tuning pipelines.
|
|
67
|
+
- Provides CLI, dashboard API, and MCP tool surfaces.
|
|
68
|
+
- Includes safety helpers such as hook audit, detach, and action firewall checks.
|
|
69
|
+
- Works without telemetry and without an API key for local memory features.
|
|
70
|
+
|
|
71
|
+
## What It Does Not Claim
|
|
72
|
+
|
|
73
|
+
- It does not secretly train GPT, Claude, Gemini, or any remote model.
|
|
74
|
+
- It does not guarantee perfect recall.
|
|
75
|
+
- It does not replace project docs, tests, source control, or human review.
|
|
76
|
+
- It does not make every listed agent automatically available. Agent support depends on local installation and hook/config compatibility.
|
|
77
|
+
- It does not publish or sync data unless you explicitly use export, sync, or other sharing commands.
|
|
78
|
+
|
|
79
|
+
## Install
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install -g @theihtisham/agent-shadow-brain
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
CLI binaries:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
shadow-brain --help
|
|
89
|
+
asb --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
You can also run without global install:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx @theihtisham/agent-shadow-brain@latest --help
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Safe First Run
|
|
99
|
+
|
|
100
|
+
Start by auditing before attaching hooks:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
shadow-brain audit-hooks .
|
|
104
|
+
shadow-brain live-brain status .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Only attach after you review what will be changed:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
shadow-brain attach-all .
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Detach later if needed:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
shadow-brain detach-all .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## v6.0.3: Live Brain
|
|
120
|
+
|
|
121
|
+
The 6.0.3 release focuses on practical long-memory improvement for agents.
|
|
122
|
+
|
|
123
|
+
### Live Brain Status
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
shadow-brain live-brain status .
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Shows:
|
|
130
|
+
|
|
131
|
+
- memory count
|
|
132
|
+
- average memory quality
|
|
133
|
+
- source coverage
|
|
134
|
+
- stale memories
|
|
135
|
+
- duplicate clusters
|
|
136
|
+
- recall eval score
|
|
137
|
+
- recommended cleanup actions
|
|
138
|
+
|
|
139
|
+
JSON output:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
shadow-brain live-brain status . --json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Agent Briefing
|
|
146
|
+
|
|
147
|
+
Generate a markdown briefing for a fresh agent session:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
shadow-brain live-brain brief . -o SHADOW_BRAIN_AGENT_BRIEF.md
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The briefing includes:
|
|
154
|
+
|
|
155
|
+
- rules for agents
|
|
156
|
+
- top source-backed memories
|
|
157
|
+
- memory warnings
|
|
158
|
+
- recall health
|
|
159
|
+
- commands agents should run next
|
|
160
|
+
|
|
161
|
+
### Recall Eval
|
|
162
|
+
|
|
163
|
+
Check whether the brain can retrieve useful memories for common agent tasks:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
shadow-brain live-brain eval .
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Custom eval queries use pipe separators:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
shadow-brain live-brain eval . --queries "current blocker|do not repeat|verified command"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Memory Hygiene
|
|
176
|
+
|
|
177
|
+
List concrete cleanup and learning actions:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
shadow-brain live-brain hygiene .
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This highlights missing sources, stale memories, duplicates, weak recall, and missing project-scoped memories.
|
|
184
|
+
|
|
185
|
+
### Training/Eval Export
|
|
186
|
+
|
|
187
|
+
Export source-backed memories as JSONL:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
shadow-brain live-brain train-pack . --out shadow-brain-training.jsonl
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
This is useful for:
|
|
194
|
+
|
|
195
|
+
- retrieval evals
|
|
196
|
+
- local distillation experiments
|
|
197
|
+
- supervised fine-tuning datasets
|
|
198
|
+
- memory regression tests
|
|
199
|
+
|
|
200
|
+
The export is only data preparation. You choose the downstream training/eval tool.
|
|
201
|
+
|
|
202
|
+
## Core Memory Commands
|
|
203
|
+
|
|
204
|
+
Recall from the global brain:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
shadow-brain global recall --query "current blocker next step" --json --limit 8
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Show global stats:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
shadow-brain global stats
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Create a source-backed resume seed:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
shadow-brain resume-seed . -o SHADOW_BRAIN_RESUME_SEED.md
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Show what a project has learned:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
shadow-brain timeline . --limit 30
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Create a cross-agent handoff packet:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
shadow-brain handoff codex claude-code . --task "continue release verification"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Record a durable memory from a script:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
node tools/record-global-memory.mjs ^
|
|
238
|
+
--project-dir "." ^
|
|
239
|
+
--project-name "my-project" ^
|
|
240
|
+
--agent codex ^
|
|
241
|
+
--category "project.lesson" ^
|
|
242
|
+
--importance 0.8 ^
|
|
243
|
+
--tags "memory,release" ^
|
|
244
|
+
--sources "README.md,CHANGELOG.md" ^
|
|
245
|
+
--content "Keep release notes source-backed and verify npm metadata before publish."
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Dashboard
|
|
249
|
+
|
|
250
|
+
Start the local dashboard:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
shadow-brain dash . --no-open --port 7341
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
For a fast UI/API-only launch on a large repo:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
shadow-brain dash . --no-open --no-analysis --host 127.0.0.1 --port 7341
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Open:
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
http://127.0.0.1:7341
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
The v6 dashboard includes a **Live Brain** tab for memory health, source coverage, recall evals, hygiene actions, top memories, and the generated agent briefing.
|
|
269
|
+
|
|
270
|
+
It also includes:
|
|
271
|
+
|
|
272
|
+
- **Memory Browser intelligence cards** for total memories, source coverage, fresh learning, seed queue, top categories, agent coverage, and top tags.
|
|
273
|
+
- **Memory Seeder** for controlled research-to-memory workflows. Drafts stay out of the global brain until approval is complete.
|
|
274
|
+
- **Token Economy accuracy split**: current runtime agent is shown separately from historical model spend, so old Claude/Cursor spend records do not imply the dashboard is running that agent.
|
|
275
|
+
|
|
276
|
+
### Realtime Activity (new in 6.1.0)
|
|
277
|
+
|
|
278
|
+
The dashboard now streams brain activity live over its WebSocket instead of polling. Memory writes, dreams, seed drafts/commits, collisions, sub-agent spawns, and consolidation cycles appear the instant they happen.
|
|
279
|
+
|
|
280
|
+
- **Live Pulse** card on the Overview with a streaming mini-feed and an events/min rate.
|
|
281
|
+
- **Activity Log** tab with filter chips, a pulsing LIVE badge, pause/resume, clear, search, and an events/min sparkline.
|
|
282
|
+
- **Connection indicator** in the header — green when the realtime socket is live, amber while reconnecting.
|
|
283
|
+
- **Cross-process aware**: a memory written by an agent in a *different* terminal is picked up by watching `~/.shadow-brain/global.json`, so the feed reflects the whole machine, not just this process.
|
|
284
|
+
|
|
285
|
+
Polling remains as a 15-second reconciliation fallback; live events arrive in well under a second.
|
|
286
|
+
|
|
287
|
+
### Intelligence Hub — Memory Constellation (new in 6.2.0)
|
|
288
|
+
|
|
289
|
+
A new **Intelligence** tab turns the brain into an interactive graph. Every memory, project, agent, and tag is a node in a force-directed **Memory Constellation**, sized by importance (PageRank blended with each memory's own score) and linked by project, author, tags, and shared-tag relatedness.
|
|
290
|
+
|
|
291
|
+
- **Interactive**: scroll to zoom, drag to pan, click a node to focus its neighborhood and open a detail drawer; hover for a tooltip.
|
|
292
|
+
- **Filters + search** by node type (memory / project / agent / tag).
|
|
293
|
+
- **Live**: new memories pulse into the graph over the realtime stream.
|
|
294
|
+
- **Analytics strip**: source-coverage gauge, agent-contribution and category charts, tag cloud, and a recent-memory feed.
|
|
295
|
+
- Works instantly on your existing `~/.shadow-brain/global.json` — no project analysis or setup step.
|
|
296
|
+
|
|
297
|
+
Several previously sparse tabs were also rebuilt with real visualizations: **Pre-Mortem** (risk matrix + failure cards), **Attention** (weighted heat bars), **Calibration** (Brier/trust chart), **Reputation** (trust rings), **Causal Chains** (node-link DAG), and **Branch Brains** (stat cards).
|
|
298
|
+
|
|
299
|
+
Constellation API:
|
|
300
|
+
|
|
301
|
+
```text
|
|
302
|
+
GET /api/v6/memory-graph
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
Memory seeding API:
|
|
307
|
+
|
|
308
|
+
```text
|
|
309
|
+
GET /api/v6/seed-drafts
|
|
310
|
+
POST /api/v6/seed-draft
|
|
311
|
+
POST /api/v6/seed-approve
|
|
312
|
+
POST /api/v6/seed-reject
|
|
313
|
+
POST /api/v6/seed-commit
|
|
314
|
+
GET /api/v6/memory-intelligence
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Useful API endpoints:
|
|
318
|
+
|
|
319
|
+
```text
|
|
320
|
+
GET/POST /api/v6/live-brain
|
|
321
|
+
GET/POST /api/v6/resume-pack
|
|
322
|
+
GET/POST /api/v6/ww2br-recall
|
|
323
|
+
GET/POST /api/v6/memory-browser
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Example:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
curl "http://127.0.0.1:7341/api/v6/live-brain?projectDir=C:/path/to/project"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## MCP Tools
|
|
333
|
+
|
|
334
|
+
The MCP server exposes memory and agent-control tools for compatible clients.
|
|
335
|
+
|
|
336
|
+
New in 6.3.0:
|
|
337
|
+
|
|
338
|
+
- `global_recall_scored` — recall with a per-memory confidence score (recency, author importance, cross-agent corroboration, prior usage, keyword relevance). Results are ranked by confidence so agents can weight memories instead of trusting every hit equally. Supports `minConfidence` to drop low-trust hits.
|
|
339
|
+
|
|
340
|
+
New in 6.0.3:
|
|
341
|
+
|
|
342
|
+
- `live_brain_status`
|
|
343
|
+
- `live_brain_brief`
|
|
344
|
+
- `live_brain_train_pack`
|
|
345
|
+
|
|
346
|
+
Existing useful tools include:
|
|
347
|
+
|
|
348
|
+
- `global_recall`
|
|
349
|
+
- `global_recall_scored`
|
|
350
|
+
- `global_stats`
|
|
351
|
+
- `global_timeline`
|
|
352
|
+
- `subconscious_inject`
|
|
353
|
+
- `agent_handoff`
|
|
354
|
+
- `firewall_check`
|
|
355
|
+
|
|
356
|
+
Start MCP from the dashboard API or existing CLI/server integration, depending on your setup.
|
|
357
|
+
|
|
358
|
+
## How Agents Should Use It
|
|
359
|
+
|
|
360
|
+
Recommended workflow for complex work:
|
|
361
|
+
|
|
362
|
+
1. Run `shadow-brain live-brain status <project>`.
|
|
363
|
+
2. Generate or read a live briefing.
|
|
364
|
+
3. Verify current project docs and source files.
|
|
365
|
+
4. Work normally.
|
|
366
|
+
5. Record only durable, source-backed lessons after proof.
|
|
367
|
+
6. Run recall evals when memory quality starts to drift.
|
|
368
|
+
|
|
369
|
+
Good memories are short, action-oriented, and source-backed:
|
|
370
|
+
|
|
371
|
+
```text
|
|
372
|
+
[lesson:release-readme-v1] Before publishing, verify package.json version, package-lock root version, README install commands, build output, and npm pack contents.
|
|
373
|
+
Sources: package.json; package-lock.json; README.md
|
|
374
|
+
Tags: release,npm,verification
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Bad memories are vague:
|
|
378
|
+
|
|
379
|
+
```text
|
|
380
|
+
Make project better.
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## Local Data
|
|
384
|
+
|
|
385
|
+
Default global brain:
|
|
386
|
+
|
|
387
|
+
```text
|
|
388
|
+
~/.shadow-brain/global.json
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Project-local generated files may include:
|
|
392
|
+
|
|
393
|
+
```text
|
|
394
|
+
SHADOW_BRAIN_AGENT_BRIEF.md
|
|
395
|
+
SHADOW_BRAIN_RESUME_SEED.md
|
|
396
|
+
shadow-brain-training.jsonl
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Do not store secrets, API keys, passwords, private keys, or raw credentials in memory content, metadata, tags, prompts, reports, or exported training data.
|
|
400
|
+
|
|
401
|
+
## Development
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
npm ci --ignore-scripts
|
|
405
|
+
npm run verify
|
|
406
|
+
npm run test:package
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Focused tests:
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
npx vitest run tests/brain/live-brain.test.ts tests/brain/context-continuity.test.ts
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
On Windows PowerShell, if execution policy blocks `npm.ps1`, use:
|
|
416
|
+
|
|
417
|
+
```powershell
|
|
418
|
+
npm.cmd run build
|
|
419
|
+
npx.cmd vitest run tests\brain\live-brain.test.ts
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Release Checklist
|
|
423
|
+
|
|
424
|
+
Run `npm run verify`, `npm audit --audit-level=high`, and `npm run test:package`. Inspect the package allowlist, then publish the verified tarball. Confirm the npm version, integrity, and GitHub tag before announcing a release. See [the complete release checklist](docs/launch/RELEASE_CHECKLIST_v7.0.0.md).
|
|
425
|
+
|
|
426
|
+
## License
|
|
427
|
+
|
|
428
|
+
MIT
|