@theihtisham/agent-shadow-brain 6.0.3 → 6.2.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 +40 -40
- package/README.md +427 -366
- package/dist/brain/brain-bus.d.ts +40 -0
- package/dist/brain/brain-bus.d.ts.map +1 -0
- package/dist/brain/brain-bus.js +94 -0
- package/dist/brain/brain-bus.js.map +1 -0
- package/dist/brain/collision-detective.d.ts.map +1 -1
- package/dist/brain/collision-detective.js +16 -0
- package/dist/brain/collision-detective.js.map +1 -1
- package/dist/brain/dream-engine.d.ts.map +1 -1
- package/dist/brain/dream-engine.js +12 -0
- package/dist/brain/dream-engine.js.map +1 -1
- package/dist/brain/forgetting-curve.d.ts.map +1 -1
- package/dist/brain/forgetting-curve.js +19 -0
- package/dist/brain/forgetting-curve.js.map +1 -1
- package/dist/brain/global-brain.d.ts +4 -0
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +26 -0
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/memory-graph.d.ts +51 -0
- package/dist/brain/memory-graph.d.ts.map +1 -0
- package/dist/brain/memory-graph.js +267 -0
- package/dist/brain/memory-graph.js.map +1 -0
- package/dist/brain/memory-seeder.d.ts.map +1 -1
- package/dist/brain/memory-seeder.js +23 -0
- package/dist/brain/memory-seeder.js.map +1 -1
- package/dist/brain/subagent-bridge.d.ts.map +1 -1
- package/dist/brain/subagent-bridge.js +12 -0
- package/dist/brain/subagent-bridge.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/dashboard/server.d.ts +19 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +169 -5
- 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 +2129 -942
- package/dist/dashboard/v6-dashboard-html.js.map +1 -1
- package/docs/launch/RELEASE_CHECKLIST_v6.0.3.md +102 -102
- package/docs/launch/RELEASE_NOTES_v6.0.3.md +111 -111
- package/docs/launch/RELEASE_NOTES_v6.1.0.md +38 -0
- package/docs/launch/RELEASE_NOTES_v6.2.0.md +54 -0
- package/package.json +27 -25
- package/tools/export-resume-pack.mjs +56 -56
- package/tools/record-global-memory.mjs +72 -72
|
@@ -1,56 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,72 +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
|
-
}
|
|
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
|
+
}
|