mindlore 0.5.6 → 0.5.8
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/README.md +1 -1
- package/dist/scripts/cc-memory-bulk-sync.d.ts.map +1 -1
- package/dist/scripts/cc-memory-bulk-sync.js +6 -15
- package/dist/scripts/cc-memory-bulk-sync.js.map +1 -1
- package/dist/scripts/cc-session-sync.d.ts +32 -0
- package/dist/scripts/cc-session-sync.d.ts.map +1 -0
- package/dist/scripts/cc-session-sync.js +289 -0
- package/dist/scripts/cc-session-sync.js.map +1 -0
- package/dist/scripts/lib/constants.d.ts +2 -0
- package/dist/scripts/lib/constants.d.ts.map +1 -1
- package/dist/scripts/lib/constants.js +3 -1
- package/dist/scripts/lib/constants.js.map +1 -1
- package/dist/scripts/lib/privacy-filter.d.ts.map +1 -1
- package/dist/scripts/lib/privacy-filter.js +32 -14
- package/dist/scripts/lib/privacy-filter.js.map +1 -1
- package/dist/scripts/lib/sync-helpers.d.ts +37 -0
- package/dist/scripts/lib/sync-helpers.d.ts.map +1 -0
- package/dist/scripts/lib/sync-helpers.js +17 -0
- package/dist/scripts/lib/sync-helpers.js.map +1 -0
- package/dist/tests/cc-memory-bulk-sync.test.js +3 -0
- package/dist/tests/cc-memory-bulk-sync.test.js.map +1 -1
- package/dist/tests/cc-session-sync.test.d.ts +2 -0
- package/dist/tests/cc-session-sync.test.d.ts.map +1 -0
- package/dist/tests/cc-session-sync.test.js +306 -0
- package/dist/tests/cc-session-sync.test.js.map +1 -0
- package/dist/tests/helpers/db.d.ts.map +1 -1
- package/dist/tests/helpers/db.js +9 -1
- package/dist/tests/helpers/db.js.map +1 -1
- package/dist/tests/init.test.js +2 -0
- package/dist/tests/init.test.js.map +1 -1
- package/dist/tests/pre-compact.test.d.ts +2 -0
- package/dist/tests/pre-compact.test.d.ts.map +1 -0
- package/dist/tests/pre-compact.test.js +46 -0
- package/dist/tests/pre-compact.test.js.map +1 -0
- package/dist/tests/privacy-filter.test.js +10 -0
- package/dist/tests/privacy-filter.test.js.map +1 -1
- package/hooks/mindlore-pre-compact.cjs +27 -9
- package/hooks/mindlore-search.cjs +5 -3
- package/hooks/mindlore-session-end.cjs +17 -17
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/skills/mindlore-decide/SKILL.md +3 -4
- package/skills/mindlore-diary/SKILL.md +4 -4
- package/skills/mindlore-evolve/SKILL.md +4 -4
- package/skills/mindlore-explore/SKILL.md +1 -0
- package/skills/mindlore-health/SKILL.md +3 -5
- package/skills/mindlore-ingest/SKILL.md +3 -4
- package/skills/mindlore-log/SKILL.md +3 -4
- package/skills/mindlore-maintain/SKILL.md +10 -5
- package/skills/mindlore-query/SKILL.md +3 -4
- package/skills/mindlore-reflect/SKILL.md +4 -4
- package/templates/INDEX.md +2 -0
- package/templates/config.json +1 -1
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* mindlore-pre-compact — PreCompact hook
|
|
6
6
|
*
|
|
7
7
|
* Before context compaction:
|
|
8
|
-
* 1.
|
|
9
|
-
* 2.
|
|
8
|
+
* 1. Ensure FTS5 index is up to date
|
|
9
|
+
* 2. Write pre-compact episode to episodes/ and append log entry
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
@@ -31,16 +31,34 @@ function main() {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (!fs.existsSync(diaryDir)) return;
|
|
34
|
+
const now = new Date();
|
|
35
|
+
const iso = now.toISOString();
|
|
37
36
|
|
|
37
|
+
// Write pre-compact episode
|
|
38
|
+
const episodesDir = path.join(baseDir, 'episodes');
|
|
39
|
+
try {
|
|
40
|
+
const ts = iso.replace(/[:.]/g, '-');
|
|
41
|
+
const episodePath = path.join(episodesDir, `pre-compact-${ts}.md`);
|
|
42
|
+
const content = [
|
|
43
|
+
'---',
|
|
44
|
+
'type: episode',
|
|
45
|
+
'subtype: pre-compact',
|
|
46
|
+
`date: ${iso.slice(0, 10)}`,
|
|
47
|
+
`project: ${path.basename(process.cwd())}`,
|
|
48
|
+
'---',
|
|
49
|
+
'',
|
|
50
|
+
`Pre-compact snapshot at ${iso}.`,
|
|
51
|
+
`Working directory: ${process.cwd()}`,
|
|
52
|
+
].join('\n');
|
|
53
|
+
fs.writeFileSync(episodePath, content, 'utf8');
|
|
54
|
+
} catch (_err) { /* episodes dir may not exist */ }
|
|
55
|
+
|
|
56
|
+
// Append log entry
|
|
38
57
|
const logPath = path.join(baseDir, 'log.md');
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const entry = `| ${now.slice(0, 10)} | pre-compact | FTS5 flush before compaction |\n`;
|
|
58
|
+
try {
|
|
59
|
+
const entry = `| ${iso.slice(0, 10)} | pre-compact | FTS5 flush before compaction |\n`;
|
|
42
60
|
fs.appendFileSync(logPath, entry, 'utf8');
|
|
43
|
-
}
|
|
61
|
+
} catch (_err) { /* log file may not exist */ }
|
|
44
62
|
|
|
45
63
|
process.stdout.write('[Mindlore: pre-compact FTS5 flush complete]\n');
|
|
46
64
|
}
|
|
@@ -90,9 +90,11 @@ function searchDb(dbPath, keywords) {
|
|
|
90
90
|
for (const r of fusedResults) {
|
|
91
91
|
const filePath = r.path || '';
|
|
92
92
|
let headings = [];
|
|
93
|
-
if (filePath
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
if (filePath) {
|
|
94
|
+
try {
|
|
95
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
96
|
+
headings = extractHeadings(content, 3);
|
|
97
|
+
} catch (_err) { /* file may have been deleted */ }
|
|
96
98
|
}
|
|
97
99
|
results.push({
|
|
98
100
|
path: filePath,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
const path = require('path');
|
|
14
14
|
const os = require('os');
|
|
15
|
-
const { execSync, spawn } = require('child_process');
|
|
15
|
+
const { execSync, execFileSync, spawn } = require('child_process');
|
|
16
16
|
const { findMindloreDir, globalDir, getProjectName, openDatabase, ensureEpisodesTable, hasEpisodesTable, insertBareEpisode, insertFtsRow, hookLog, SHARED_EXPORT_DIRS, resolveWin32Bin } = require('./lib/mindlore-common.cjs');
|
|
17
17
|
|
|
18
18
|
const EXPORT_DIRS = SHARED_EXPORT_DIRS;
|
|
@@ -46,23 +46,23 @@ if (process.argv.includes('--worker')) {
|
|
|
46
46
|
await safeRunAsync(() => writeBareEpisode(baseDir, project, commits, changedFiles, reads), 'episode');
|
|
47
47
|
await safeRunAsync(() => writeEpisodeFile(baseDir, project, commits, changedFiles, reads), 'episode-file');
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} catch (syncErr) {
|
|
62
|
-
hookLog('session-end', 'warn', `CC memory sync failed: ${syncErr?.message || syncErr}`);
|
|
63
|
-
}
|
|
49
|
+
function runSyncScript(scriptName, args, timeoutMs, label) {
|
|
50
|
+
const scriptPath = path.join(__dirname, '..', 'dist', 'scripts', scriptName);
|
|
51
|
+
if (!fs.existsSync(scriptPath)) return;
|
|
52
|
+
const nodeExe = resolveWin32Bin('node') || process.execPath;
|
|
53
|
+
try {
|
|
54
|
+
execFileSync(nodeExe, [scriptPath, ...args], {
|
|
55
|
+
timeout: timeoutMs,
|
|
56
|
+
env: { ...process.env, MINDLORE_HOME: baseDir },
|
|
57
|
+
});
|
|
58
|
+
hookLog('session-end', 'info', label + ' completed');
|
|
59
|
+
} catch (err) {
|
|
60
|
+
hookLog('session-end', 'warn', `${label} failed: ${err?.message || err}`);
|
|
64
61
|
}
|
|
65
|
-
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
await safeRunAsync(() => runSyncScript('cc-memory-bulk-sync.js', ['--auto'], 10000, 'CC memory sync'), 'cc-memory-sync');
|
|
65
|
+
await safeRunAsync(() => runSyncScript('cc-session-sync.js', [], 30000, 'CC session sync'), 'cc-session-sync');
|
|
66
66
|
|
|
67
67
|
// Embed trigger — detached, fire-and-forget
|
|
68
68
|
await safeRunAsync(async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindlore",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "AI-native knowledge system for Claude Code",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@xenova/transformers": "^2.17.2",
|
|
58
58
|
"eslint": "^10.2.0",
|
|
59
59
|
"globals": "^17.5.0",
|
|
60
|
-
"jest": "^
|
|
60
|
+
"jest": "^30.3.0",
|
|
61
61
|
"sqlite-vec": "^0.1.9",
|
|
62
62
|
"ts-jest": "^29.4.9",
|
|
63
63
|
"typescript": "^6.0.2"
|
package/plugin.json
CHANGED
|
@@ -4,11 +4,10 @@ Record and list decisions in the `.mindlore/decisions/` directory.
|
|
|
4
4
|
|
|
5
5
|
## Script Resolution
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
8
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-decide" → `MINDLORE_PKG = {base_directory}/../..`
|
|
9
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
9
10
|
|
|
10
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-decide".
|
|
11
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
12
11
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
13
12
|
|
|
14
13
|
## Scope
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mindlore-diary
|
|
3
3
|
description: LLM-powered session analysis — decisions, discoveries, frictions, learnings. Promotes episodes to semantic knowledge.
|
|
4
|
+
context: fork
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
## Script Resolution
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
10
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-diary" → `MINDLORE_PKG = {base_directory}/../..`
|
|
11
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
10
12
|
|
|
11
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-diary".
|
|
12
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
13
13
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
14
14
|
|
|
15
15
|
# /mindlore-diary
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
name: mindlore-evolve
|
|
3
3
|
description: Knowledge schema co-evolution — scan domains+sources, detect inconsistencies, suggest updates
|
|
4
4
|
effort: medium
|
|
5
|
+
context: fork
|
|
5
6
|
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
## Script Resolution
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
12
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-evolve" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
12
14
|
|
|
13
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-evolve".
|
|
14
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
15
15
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
16
16
|
|
|
17
17
|
# /mindlore-evolve
|
|
@@ -8,11 +8,9 @@ allowed-tools: [Bash, Read]
|
|
|
8
8
|
|
|
9
9
|
## Script Resolution
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-health".
|
|
15
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
11
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
12
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-health" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
16
14
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
17
15
|
|
|
18
16
|
# /mindlore-health
|
|
@@ -9,11 +9,10 @@ agent: coder
|
|
|
9
9
|
|
|
10
10
|
## Script Resolution
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
13
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-ingest" → `MINDLORE_PKG = {base_directory}/../..`
|
|
14
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
14
15
|
|
|
15
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-ingest".
|
|
16
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
17
16
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
18
17
|
|
|
19
18
|
# /mindlore-ingest
|
|
@@ -4,11 +4,10 @@ Session logging, pattern extraction, and wiki updates.
|
|
|
4
4
|
|
|
5
5
|
## Script Resolution
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
8
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-log" → `MINDLORE_PKG = {base_directory}/../..`
|
|
9
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
9
10
|
|
|
10
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-log".
|
|
11
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
12
11
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
13
12
|
|
|
14
13
|
## Scope
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
name: mindlore-maintain
|
|
3
3
|
description: KB maintenance — decay/archive, episode consolidation, contradiction detection
|
|
4
4
|
effort: medium
|
|
5
|
+
context: fork
|
|
5
6
|
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
## Script Resolution
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
12
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-maintain" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
12
14
|
|
|
13
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-maintain".
|
|
14
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
15
15
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
16
16
|
|
|
17
17
|
# /mindlore-maintain
|
|
@@ -36,7 +36,12 @@ KB bakım skill'i. Reflect düşünür, maintain temizler.
|
|
|
36
36
|
const path = require('path'), os = require('os');
|
|
37
37
|
const dbPath = path.join(os.homedir(), '.mindlore', 'mindlore.db');
|
|
38
38
|
const db = new Database(dbPath, {readonly: true});
|
|
39
|
-
|
|
39
|
+
let decayConfig = {};
|
|
40
|
+
try {
|
|
41
|
+
const configPath = path.join(os.homedir(), '.mindlore', 'config.json');
|
|
42
|
+
decayConfig = JSON.parse(require('fs').readFileSync(configPath, 'utf8')).decay || {};
|
|
43
|
+
} catch (_err) { /* use defaults if config missing or malformed */ }
|
|
44
|
+
const stale = listStaleDocuments(db, undefined, decayConfig);
|
|
40
45
|
console.log(JSON.stringify(stale, null, 2));
|
|
41
46
|
db.close();
|
|
42
47
|
" "$DECAY_MOD"
|
|
@@ -11,11 +11,10 @@ Search, ask, analyze, and retrieve knowledge from `.mindlore/`.
|
|
|
11
11
|
|
|
12
12
|
## Script Resolution
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
15
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-query" → `MINDLORE_PKG = {base_directory}/../..`
|
|
16
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
16
17
|
|
|
17
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-query".
|
|
18
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
19
18
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
20
19
|
|
|
21
20
|
## Scope
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mindlore-reflect
|
|
3
3
|
description: Pattern extraction from episodes — 3-tier confidence, nomination pipeline, CLAUDE.md update proposals.
|
|
4
|
+
context: fork
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
## Script Resolution
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
10
|
+
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-reflect" → `MINDLORE_PKG = {base_directory}/../..`
|
|
11
|
+
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
10
12
|
|
|
11
|
-
When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-reflect".
|
|
12
|
-
Compute: `MINDLORE_PKG = {base_directory}/../..`
|
|
13
13
|
Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
|
|
14
14
|
|
|
15
15
|
# /mindlore-reflect
|
package/templates/INDEX.md
CHANGED
package/templates/config.json
CHANGED