@theihtisham/agent-shadow-brain 6.0.2 → 6.0.3
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 +372 -0
- package/README.md +366 -455
- package/dist/brain/auto-update.js +1 -1
- package/dist/brain/brain-portability.js +3 -3
- package/dist/brain/brain-portability.js.map +1 -1
- package/dist/brain/context-continuity.d.ts +78 -0
- package/dist/brain/context-continuity.d.ts.map +1 -0
- package/dist/brain/context-continuity.js +341 -0
- package/dist/brain/context-continuity.js.map +1 -0
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +35 -9
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/live-brain.d.ts +119 -0
- package/dist/brain/live-brain.d.ts.map +1 -0
- package/dist/brain/live-brain.js +405 -0
- package/dist/brain/live-brain.js.map +1 -0
- package/dist/brain/mcp-server.d.ts +4 -0
- package/dist/brain/mcp-server.d.ts.map +1 -1
- package/dist/brain/mcp-server.js +81 -5
- package/dist/brain/mcp-server.js.map +1 -1
- package/dist/brain/memory-seeder.d.ts +78 -0
- package/dist/brain/memory-seeder.d.ts.map +1 -0
- package/dist/brain/memory-seeder.js +326 -0
- package/dist/brain/memory-seeder.js.map +1 -0
- package/dist/brain/orchestrator.js +1 -1
- package/dist/brain/token-economy.d.ts +2 -0
- package/dist/brain/token-economy.d.ts.map +1 -1
- package/dist/brain/token-economy.js +80 -24
- package/dist/brain/token-economy.js.map +1 -1
- package/dist/cli.js +240 -31
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/server.d.ts +5 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +355 -2
- package/dist/dashboard/server.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 +755 -85
- package/dist/dashboard/v6-dashboard-html.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +17 -12
- package/dist/types.d.ts.map +1 -1
- package/docs/launch/README.md +61 -0
- package/docs/launch/RELEASE_CHECKLIST_v6.0.3.md +102 -0
- package/docs/launch/RELEASE_NOTES_v6.0.3.md +111 -0
- package/package.json +25 -13
- package/tools/export-resume-pack.mjs +56 -0
- package/tools/record-global-memory.mjs +72 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Shadow Brain v6.0.3
|
|
2
|
+
|
|
3
|
+
Date: 2026-06-03
|
|
4
|
+
|
|
5
|
+
v6.0.3 is a practical memory-quality release. It focuses on making Shadow Brain useful for real long-running agent work instead of adding more marketing claims.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- Added the Live Brain module.
|
|
10
|
+
- Added live memory health reports.
|
|
11
|
+
- Added source coverage, stale-memory, duplicate, and low-quality memory checks.
|
|
12
|
+
- Added recall evals for common agent workflows.
|
|
13
|
+
- Added markdown agent briefings for fresh sessions and handoffs.
|
|
14
|
+
- Added JSONL training/eval pack export.
|
|
15
|
+
- Added dashboard API route and dashboard Live Brain tab for Live Brain reports.
|
|
16
|
+
- Added Memory Seeder: dashboard/API draft creation, source capture, user approval, agent approval, dual approval, rejection, and seed-to-global-brain commit.
|
|
17
|
+
- Added Memory Intelligence API and dashboard cards for source coverage, freshness, categories, agents, tags, recent writes, and seed queue counts.
|
|
18
|
+
- Fixed Token Economy dashboard wording and data split so the active runtime agent is shown separately from historical model spend.
|
|
19
|
+
- Added MCP tools for Live Brain status, briefing, and training-pack export.
|
|
20
|
+
- Added dashboard `--host` and `--no-analysis` controls for reliable local UI launches on large repos.
|
|
21
|
+
- Fixed CLI config merging so commands that request one-shot mode can actually disable watch mode.
|
|
22
|
+
- Rewrote the README to describe real behavior and release workflow.
|
|
23
|
+
- Updated npm metadata to 6.0.3 with a realistic package description.
|
|
24
|
+
|
|
25
|
+
## New CLI Commands
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
shadow-brain live-brain status .
|
|
29
|
+
shadow-brain live-brain brief . -o SHADOW_BRAIN_AGENT_BRIEF.md
|
|
30
|
+
shadow-brain live-brain eval .
|
|
31
|
+
shadow-brain live-brain hygiene .
|
|
32
|
+
shadow-brain live-brain train-pack . --out shadow-brain-training.jsonl
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Short alias:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
shadow-brain live status .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## New API
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
GET/POST /api/v6/live-brain
|
|
45
|
+
GET /api/v6/memory-intelligence
|
|
46
|
+
GET /api/v6/seed-drafts
|
|
47
|
+
POST /api/v6/seed-draft
|
|
48
|
+
POST /api/v6/seed-approve
|
|
49
|
+
POST /api/v6/seed-reject
|
|
50
|
+
POST /api/v6/seed-commit
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use `format=markdown` to return the agent briefing instead of JSON.
|
|
54
|
+
|
|
55
|
+
## New Dashboard Surface
|
|
56
|
+
|
|
57
|
+
The v6 dashboard now includes a Live Brain tab showing memory quality, source coverage, recall eval results, recommended hygiene actions, top memories, and the markdown briefing that agents can use during handoffs.
|
|
58
|
+
|
|
59
|
+
The Memory Browser now includes live memory intelligence: total memory count, source coverage, fresh learning, seed queue, top categories, agent coverage, and tags.
|
|
60
|
+
|
|
61
|
+
The Memory Seeder tab turns research into durable memory safely. A draft can be prepared by a selected research agent, checked against sources and existing memory, then approved by the user, by a selected agent, or by both before it is written to the global brain.
|
|
62
|
+
|
|
63
|
+
## New MCP Tools
|
|
64
|
+
|
|
65
|
+
- `live_brain_status`
|
|
66
|
+
- `live_brain_brief`
|
|
67
|
+
- `live_brain_train_pack`
|
|
68
|
+
|
|
69
|
+
## What "Training" Means Here
|
|
70
|
+
|
|
71
|
+
Shadow Brain does not train remote model weights. The new training pack exports source-backed memory examples as JSONL so users can run their own eval, distillation, or local fine-tuning workflows.
|
|
72
|
+
|
|
73
|
+
## Verification
|
|
74
|
+
|
|
75
|
+
Validated locally:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm.cmd run build
|
|
79
|
+
npm.cmd test
|
|
80
|
+
npm.cmd pack --dry-run
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Result:
|
|
84
|
+
|
|
85
|
+
- TypeScript build passed.
|
|
86
|
+
- Full Vitest suite passed.
|
|
87
|
+
- npm package dry run passed.
|
|
88
|
+
|
|
89
|
+
## Files Added
|
|
90
|
+
|
|
91
|
+
- `src/brain/live-brain.ts`
|
|
92
|
+
- `src/brain/memory-seeder.ts`
|
|
93
|
+
- `tests/brain/live-brain.test.ts`
|
|
94
|
+
- `tests/brain/memory-seeder.test.ts`
|
|
95
|
+
- `docs/launch/RELEASE_NOTES_v6.0.3.md`
|
|
96
|
+
|
|
97
|
+
## Files Updated
|
|
98
|
+
|
|
99
|
+
- `README.md`
|
|
100
|
+
- `CHANGELOG.md`
|
|
101
|
+
- `package.json`
|
|
102
|
+
- `package-lock.json`
|
|
103
|
+
- `src/cli.ts`
|
|
104
|
+
- `src/index.ts`
|
|
105
|
+
- `src/dashboard/server.ts`
|
|
106
|
+
- `src/dashboard/v6-dashboard-html.ts`
|
|
107
|
+
- `src/brain/context-continuity.ts`
|
|
108
|
+
- `src/brain/mcp-server.ts`
|
|
109
|
+
- `src/brain/auto-update.ts`
|
|
110
|
+
- `src/brain/brain-portability.ts`
|
|
111
|
+
- `src/brain/orchestrator.ts`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theihtisham/agent-shadow-brain",
|
|
3
|
-
"version": "6.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "6.0.3",
|
|
4
|
+
"description": "Local-first memory and coordination layer for AI coding agents. Shadow Brain stores source-backed project lessons, recalls them across Codex, Claude Code, Cursor, Cline, OpenCode, and other tools, generates resume briefings, audits memory quality, exports training/eval JSONL, and exposes CLI/API/MCP surfaces with zero telemetry.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js"
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
"build": "tsc",
|
|
15
15
|
"dev": "ts-node src/cli.ts",
|
|
16
16
|
"watch": "tsc --watch",
|
|
17
|
-
"test": "vitest run",
|
|
18
|
-
"lint": "tsc --noEmit",
|
|
19
|
-
"
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"lint": "tsc --noEmit",
|
|
19
|
+
"verify": "npm run build && npm test",
|
|
20
|
+
"pack:dry": "npm pack --dry-run",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
20
22
|
"postinstall": "node dist/brain/auto-setup.js 2>>~/.shadow-brain/install.log || true"
|
|
21
23
|
},
|
|
22
24
|
"keywords": [
|
|
@@ -135,9 +137,14 @@
|
|
|
135
137
|
"brain-exchange",
|
|
136
138
|
"local-first",
|
|
137
139
|
"ollama",
|
|
138
|
-
"forgetting-curve",
|
|
139
|
-
"sleep-consolidation"
|
|
140
|
-
|
|
140
|
+
"forgetting-curve",
|
|
141
|
+
"sleep-consolidation",
|
|
142
|
+
"live-brain",
|
|
143
|
+
"resume-pack",
|
|
144
|
+
"memory-quality",
|
|
145
|
+
"training-jsonl",
|
|
146
|
+
"source-backed-memory"
|
|
147
|
+
],
|
|
141
148
|
"author": "ihtisham",
|
|
142
149
|
"license": "MIT",
|
|
143
150
|
"dependencies": {
|
|
@@ -170,11 +177,16 @@
|
|
|
170
177
|
"engines": {
|
|
171
178
|
"node": ">=18.0.0"
|
|
172
179
|
},
|
|
173
|
-
"files": [
|
|
174
|
-
"dist/**/*",
|
|
175
|
-
"README.md",
|
|
176
|
-
"
|
|
177
|
-
|
|
180
|
+
"files": [
|
|
181
|
+
"dist/**/*",
|
|
182
|
+
"README.md",
|
|
183
|
+
"CHANGELOG.md",
|
|
184
|
+
"LICENSE",
|
|
185
|
+
"docs/launch/RELEASE_CHECKLIST_v6.0.3.md",
|
|
186
|
+
"docs/launch/RELEASE_NOTES_v6.0.3.md",
|
|
187
|
+
"tools/export-resume-pack.mjs",
|
|
188
|
+
"tools/record-global-memory.mjs"
|
|
189
|
+
],
|
|
178
190
|
"publishConfig": {
|
|
179
191
|
"access": "public"
|
|
180
192
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { generateContextResumePack } from '../dist/brain/context-continuity.js';
|
|
5
|
+
import { getGlobalBrain, GlobalBrain } from '../dist/brain/global-brain.js';
|
|
6
|
+
|
|
7
|
+
function readArg(name, fallback = undefined) {
|
|
8
|
+
const index = process.argv.indexOf(name);
|
|
9
|
+
if (index < 0) return fallback;
|
|
10
|
+
return process.argv[index + 1] ?? fallback;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function readFlag(name) {
|
|
14
|
+
return process.argv.includes(name);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const projectDir = path.resolve(readArg('--project-dir', process.cwd()));
|
|
18
|
+
const out = readArg('--out', '');
|
|
19
|
+
const format = String(readArg('--format', 'markdown')).toLowerCase();
|
|
20
|
+
const limit = Number.parseInt(readArg('--limit', '12'), 10);
|
|
21
|
+
const globalFallback = readFlag('--global-fallback');
|
|
22
|
+
|
|
23
|
+
const brain = getGlobalBrain();
|
|
24
|
+
await brain.init();
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const projectId = GlobalBrain.projectIdFor(projectDir);
|
|
28
|
+
let entries = brain.recall({ projectId, minImportance: 0, limit: 500 });
|
|
29
|
+
let projectScoped = true;
|
|
30
|
+
if (!entries.length && globalFallback) {
|
|
31
|
+
projectScoped = false;
|
|
32
|
+
entries = brain.recall({ minImportance: 0, limit: 500 });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const pack = generateContextResumePack({
|
|
36
|
+
projectDir,
|
|
37
|
+
projectId,
|
|
38
|
+
projectName: path.basename(projectDir),
|
|
39
|
+
entries,
|
|
40
|
+
maxMemories: Number.isFinite(limit) ? Math.max(1, Math.min(30, limit)) : 12,
|
|
41
|
+
});
|
|
42
|
+
const payload = format === 'json'
|
|
43
|
+
? JSON.stringify({ ...pack, projectScoped }, null, 2)
|
|
44
|
+
: pack.markdown;
|
|
45
|
+
|
|
46
|
+
if (out) {
|
|
47
|
+
const outPath = path.resolve(out);
|
|
48
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
49
|
+
fs.writeFileSync(outPath, payload, 'utf-8');
|
|
50
|
+
console.log(JSON.stringify({ ok: true, out: outPath, format, projectScoped, memoryCount: entries.length }, null, 2));
|
|
51
|
+
} else {
|
|
52
|
+
process.stdout.write(payload);
|
|
53
|
+
}
|
|
54
|
+
} finally {
|
|
55
|
+
await brain.shutdown();
|
|
56
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getGlobalBrain } from '../dist/brain/global-brain.js';
|
|
4
|
+
|
|
5
|
+
function readArg(name, fallback = undefined) {
|
|
6
|
+
const index = process.argv.indexOf(name);
|
|
7
|
+
if (index < 0) return fallback;
|
|
8
|
+
return process.argv[index + 1] ?? fallback;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function readFlag(name) {
|
|
12
|
+
return process.argv.includes(name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function splitList(value) {
|
|
16
|
+
return (value ?? '')
|
|
17
|
+
.split(',')
|
|
18
|
+
.map(item => item.trim())
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const projectDir = path.resolve(readArg('--project-dir', process.cwd()));
|
|
23
|
+
const projectName = readArg('--project-name', path.basename(projectDir));
|
|
24
|
+
const agentTool = readArg('--agent', 'codex');
|
|
25
|
+
const category = readArg('--category', 'learning');
|
|
26
|
+
const content = readArg('--content');
|
|
27
|
+
const importance = Number.parseFloat(readArg('--importance', '0.75'));
|
|
28
|
+
const tags = splitList(readArg('--tags', ''));
|
|
29
|
+
const sources = splitList(readArg('--sources', ''));
|
|
30
|
+
const seedId = readArg('--seed-id', '');
|
|
31
|
+
|
|
32
|
+
if (!content) {
|
|
33
|
+
console.error('Missing --content "memory text"');
|
|
34
|
+
process.exit(2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const brain = getGlobalBrain();
|
|
38
|
+
await brain.init();
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const projectId = brain.registerProject(projectDir, projectName);
|
|
42
|
+
brain.registerAgent(agentTool);
|
|
43
|
+
|
|
44
|
+
if (seedId) {
|
|
45
|
+
const existing = brain.recall({ keywords: [seedId], category, limit: 1 });
|
|
46
|
+
if (existing.length && !readFlag('--force')) {
|
|
47
|
+
console.log(JSON.stringify({ skipped: true, seedId, existingId: existing[0].id }, null, 2));
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const id = brain.writeSync({
|
|
53
|
+
projectId,
|
|
54
|
+
projectName,
|
|
55
|
+
agentTool,
|
|
56
|
+
category,
|
|
57
|
+
content: seedId ? `[seed:${seedId}] ${content}` : content,
|
|
58
|
+
importance: Number.isFinite(importance) ? importance : 0.75,
|
|
59
|
+
metadata: {
|
|
60
|
+
seedId: seedId || undefined,
|
|
61
|
+
tags,
|
|
62
|
+
sources,
|
|
63
|
+
recordedBy: 'tools/record-global-memory.mjs',
|
|
64
|
+
recordedAt: new Date().toISOString(),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
await brain.sync();
|
|
69
|
+
console.log(JSON.stringify({ id, projectId, projectName, category, tags, sources }, null, 2));
|
|
70
|
+
} finally {
|
|
71
|
+
await brain.shutdown();
|
|
72
|
+
}
|