mindlore 0.6.1 → 0.6.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/LICENSE +661 -21
- package/README.md +3 -3
- package/dist/scripts/cc-session-sync.d.ts +2 -0
- package/dist/scripts/cc-session-sync.d.ts.map +1 -1
- package/dist/scripts/cc-session-sync.js +56 -0
- package/dist/scripts/cc-session-sync.js.map +1 -1
- package/dist/scripts/fetch-raw.js +133 -8
- package/dist/scripts/fetch-raw.js.map +1 -1
- package/dist/scripts/init.js +28 -43
- package/dist/scripts/init.js.map +1 -1
- package/dist/scripts/lib/chunker.d.ts +12 -0
- package/dist/scripts/lib/chunker.d.ts.map +1 -0
- package/dist/scripts/lib/chunker.js +94 -0
- package/dist/scripts/lib/chunker.js.map +1 -0
- package/dist/scripts/lib/episodes.d.ts +1 -1
- package/dist/scripts/lib/episodes.d.ts.map +1 -1
- package/dist/scripts/lib/episodes.js +1 -1
- package/dist/scripts/lib/episodes.js.map +1 -1
- package/dist/scripts/lib/fuzzy.d.ts +10 -0
- package/dist/scripts/lib/fuzzy.d.ts.map +1 -0
- package/dist/scripts/lib/fuzzy.js +88 -0
- package/dist/scripts/lib/fuzzy.js.map +1 -0
- package/dist/scripts/lib/hybrid-search.d.ts +1 -0
- package/dist/scripts/lib/hybrid-search.d.ts.map +1 -1
- package/dist/scripts/lib/hybrid-search.js.map +1 -1
- package/dist/scripts/lib/merge-defaults.d.ts +5 -0
- package/dist/scripts/lib/merge-defaults.d.ts.map +1 -0
- package/dist/scripts/lib/merge-defaults.js +25 -0
- package/dist/scripts/lib/merge-defaults.js.map +1 -0
- package/dist/scripts/lib/migrations-v062.d.ts +3 -0
- package/dist/scripts/lib/migrations-v062.d.ts.map +1 -0
- package/dist/scripts/lib/migrations-v062.js +35 -0
- package/dist/scripts/lib/migrations-v062.js.map +1 -0
- package/dist/scripts/lib/migrations-v063.d.ts +7 -0
- package/dist/scripts/lib/migrations-v063.d.ts.map +1 -0
- package/dist/scripts/lib/migrations-v063.js +58 -0
- package/dist/scripts/lib/migrations-v063.js.map +1 -0
- package/dist/scripts/lib/proximity.d.ts +3 -0
- package/dist/scripts/lib/proximity.d.ts.map +1 -0
- package/dist/scripts/lib/proximity.js +53 -0
- package/dist/scripts/lib/proximity.js.map +1 -0
- package/dist/scripts/lib/rrf.d.ts +23 -0
- package/dist/scripts/lib/rrf.d.ts.map +1 -0
- package/dist/scripts/lib/rrf.js +63 -0
- package/dist/scripts/lib/rrf.js.map +1 -0
- package/dist/scripts/lib/search-cache.d.ts +20 -0
- package/dist/scripts/lib/search-cache.d.ts.map +1 -0
- package/dist/scripts/lib/search-cache.js +60 -0
- package/dist/scripts/lib/search-cache.js.map +1 -0
- package/dist/scripts/lib/search-engine.d.ts +22 -0
- package/dist/scripts/lib/search-engine.d.ts.map +1 -0
- package/dist/scripts/lib/search-engine.js +105 -0
- package/dist/scripts/lib/search-engine.js.map +1 -0
- package/dist/scripts/lib/session-payload.d.ts +2 -4
- package/dist/scripts/lib/session-payload.d.ts.map +1 -1
- package/dist/scripts/lib/session-payload.js +43 -43
- package/dist/scripts/lib/session-payload.js.map +1 -1
- package/dist/scripts/lib/snippet.d.ts +2 -0
- package/dist/scripts/lib/snippet.d.ts.map +1 -0
- package/dist/scripts/lib/snippet.js +32 -0
- package/dist/scripts/lib/snippet.js.map +1 -0
- package/dist/scripts/lib/triage.d.ts +18 -0
- package/dist/scripts/lib/triage.d.ts.map +1 -0
- package/dist/scripts/lib/triage.js +81 -0
- package/dist/scripts/lib/triage.js.map +1 -0
- package/dist/scripts/mindlore-doctor.d.ts +1 -0
- package/dist/scripts/mindlore-doctor.d.ts.map +1 -1
- package/dist/scripts/mindlore-doctor.js +26 -1
- package/dist/scripts/mindlore-doctor.js.map +1 -1
- package/dist/scripts/mindlore-fts5-index.js +44 -3
- package/dist/scripts/mindlore-fts5-index.js.map +1 -1
- package/dist/scripts/mindlore-fts5-search.d.ts +3 -5
- package/dist/scripts/mindlore-fts5-search.d.ts.map +1 -1
- package/dist/scripts/mindlore-fts5-search.js +41 -116
- package/dist/scripts/mindlore-fts5-search.js.map +1 -1
- package/dist/scripts/mindlore-health-check.d.ts +10 -0
- package/dist/scripts/mindlore-health-check.d.ts.map +1 -1
- package/dist/scripts/mindlore-health-check.js +26 -1
- package/dist/scripts/mindlore-health-check.js.map +1 -1
- package/dist/scripts/mindlore-perf.d.ts +3 -3
- package/dist/scripts/mindlore-perf.d.ts.map +1 -1
- package/dist/scripts/mindlore-perf.js +10 -8
- package/dist/scripts/mindlore-perf.js.map +1 -1
- package/dist/tests/chunker.test.d.ts +2 -0
- package/dist/tests/chunker.test.d.ts.map +1 -0
- package/dist/tests/chunker.test.js +40 -0
- package/dist/tests/chunker.test.js.map +1 -0
- package/dist/tests/chunks-migration.test.d.ts +2 -0
- package/dist/tests/chunks-migration.test.d.ts.map +1 -0
- package/dist/tests/chunks-migration.test.js +55 -0
- package/dist/tests/chunks-migration.test.js.map +1 -0
- package/dist/tests/compaction-snapshot.test.d.ts +2 -0
- package/dist/tests/compaction-snapshot.test.d.ts.map +1 -0
- package/dist/tests/compaction-snapshot.test.js +102 -0
- package/dist/tests/compaction-snapshot.test.js.map +1 -0
- package/dist/tests/daemon-integration.test.js +5 -5
- package/dist/tests/daemon-integration.test.js.map +1 -1
- package/dist/tests/diary.test.js +3 -3
- package/dist/tests/diary.test.js.map +1 -1
- package/dist/tests/doctor.test.js +13 -0
- package/dist/tests/doctor.test.js.map +1 -1
- package/dist/tests/fetch-raw.test.js +12 -5
- package/dist/tests/fetch-raw.test.js.map +1 -1
- package/dist/tests/fuzzy.test.d.ts +2 -0
- package/dist/tests/fuzzy.test.d.ts.map +1 -0
- package/dist/tests/fuzzy.test.js +70 -0
- package/dist/tests/fuzzy.test.js.map +1 -0
- package/dist/tests/health-check-memory.test.js +27 -0
- package/dist/tests/health-check-memory.test.js.map +1 -1
- package/dist/tests/helpers/db.d.ts.map +1 -1
- package/dist/tests/helpers/db.js +4 -1
- package/dist/tests/helpers/db.js.map +1 -1
- package/dist/tests/init.test.js +20 -0
- package/dist/tests/init.test.js.map +1 -1
- package/dist/tests/merge-defaults.test.d.ts +2 -0
- package/dist/tests/merge-defaults.test.d.ts.map +1 -0
- package/dist/tests/merge-defaults.test.js +35 -0
- package/dist/tests/merge-defaults.test.js.map +1 -0
- package/dist/tests/migrations-v062.test.d.ts +2 -0
- package/dist/tests/migrations-v062.test.d.ts.map +1 -0
- package/dist/tests/migrations-v062.test.js +61 -0
- package/dist/tests/migrations-v062.test.js.map +1 -0
- package/dist/tests/migrations-v063.test.d.ts +2 -0
- package/dist/tests/migrations-v063.test.d.ts.map +1 -0
- package/dist/tests/migrations-v063.test.js +84 -0
- package/dist/tests/migrations-v063.test.js.map +1 -0
- package/dist/tests/nomination.test.js +1 -1
- package/dist/tests/proximity.test.d.ts +2 -0
- package/dist/tests/proximity.test.d.ts.map +1 -0
- package/dist/tests/proximity.test.js +31 -0
- package/dist/tests/proximity.test.js.map +1 -0
- package/dist/tests/rrf.test.d.ts +2 -0
- package/dist/tests/rrf.test.d.ts.map +1 -0
- package/dist/tests/rrf.test.js +100 -0
- package/dist/tests/rrf.test.js.map +1 -0
- package/dist/tests/savings.test.d.ts +2 -0
- package/dist/tests/savings.test.d.ts.map +1 -0
- package/dist/tests/savings.test.js +87 -0
- package/dist/tests/savings.test.js.map +1 -0
- package/dist/tests/search-cache.test.d.ts +2 -0
- package/dist/tests/search-cache.test.d.ts.map +1 -0
- package/dist/tests/search-cache.test.js +95 -0
- package/dist/tests/search-cache.test.js.map +1 -0
- package/dist/tests/search-engine.test.d.ts +2 -0
- package/dist/tests/search-engine.test.d.ts.map +1 -0
- package/dist/tests/search-engine.test.js +125 -0
- package/dist/tests/search-engine.test.js.map +1 -0
- package/dist/tests/search-hook.test.js +3 -3
- package/dist/tests/search-hook.test.js.map +1 -1
- package/dist/tests/session-payload.test.d.ts +1 -1
- package/dist/tests/session-payload.test.js +1 -14
- package/dist/tests/session-payload.test.js.map +1 -1
- package/dist/tests/session-summary.test.d.ts +2 -0
- package/dist/tests/session-summary.test.d.ts.map +1 -0
- package/dist/tests/session-summary.test.js +138 -0
- package/dist/tests/session-summary.test.js.map +1 -0
- package/dist/tests/snippet.test.d.ts +2 -0
- package/dist/tests/snippet.test.d.ts.map +1 -0
- package/dist/tests/snippet.test.js +30 -0
- package/dist/tests/snippet.test.js.map +1 -0
- package/dist/tests/telemetry-perf.test.js +7 -0
- package/dist/tests/telemetry-perf.test.js.map +1 -1
- package/dist/tests/triage.test.d.ts +2 -0
- package/dist/tests/triage.test.d.ts.map +1 -0
- package/dist/tests/triage.test.js +69 -0
- package/dist/tests/triage.test.js.map +1 -0
- package/hooks/lib/mindlore-common.cjs +74 -13
- package/hooks/mindlore-index.cjs +6 -0
- package/hooks/mindlore-post-compact.cjs +23 -3
- package/hooks/mindlore-pre-compact.cjs +86 -3
- package/hooks/mindlore-search.cjs +90 -214
- package/hooks/mindlore-session-end.cjs +22 -18
- package/hooks/mindlore-session-focus.cjs +92 -71
- package/package.json +6 -5
- package/plugin.json +1 -1
- package/skills/mindlore-maintain/SKILL.md +1 -0
- package/templates/config.json +1 -1
|
@@ -10,33 +10,99 @@
|
|
|
10
10
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
|
-
const { findMindloreDir, readConfig, openDatabase, hasEpisodesTable, querySupersededChains, formatSupersededChains, hookLog, getProjectName, parseFrontmatter, withTelemetry } = require('./lib/mindlore-common.cjs');
|
|
13
|
+
const { findMindloreDir, readConfig, openDatabase, hasEpisodesTable, querySupersededChains, formatSupersededChains, hookLog, getProjectName, parseFrontmatter, withTelemetry, withTimeoutDb, listSnapshots, isCorruptionError, recoverCorruptDb } = require('./lib/mindlore-common.cjs');
|
|
14
|
+
|
|
15
|
+
function tryOpenDb(dbPath) {
|
|
16
|
+
return openDatabase(dbPath, { readonly: true });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function loadDbContent(db, baseDir, config, output, timings, latestDeltaContent) {
|
|
20
|
+
// Session payload: Session summary, Decisions, Friction, Learnings
|
|
21
|
+
const tPayload = Date.now();
|
|
22
|
+
try {
|
|
23
|
+
const { buildSessionPayload } = require('../dist/scripts/lib/session-payload.js');
|
|
24
|
+
const project = path.basename(process.cwd());
|
|
25
|
+
const payloadBudget = config?.tokenBudget?.sessionInject ?? 2000;
|
|
26
|
+
const payload = buildSessionPayload(db, baseDir, project, payloadBudget, latestDeltaContent);
|
|
27
|
+
for (const section of payload.sections) {
|
|
28
|
+
output.push(`[Mindlore ${section.label}]\n${section.content}`);
|
|
29
|
+
}
|
|
30
|
+
} catch (_payloadErr) {
|
|
31
|
+
// Session payload is optional — don't break session start
|
|
32
|
+
}
|
|
33
|
+
timings.db_payload = Date.now() - tPayload;
|
|
34
|
+
|
|
35
|
+
// Supersedes chain display
|
|
36
|
+
const tSuperseded = Date.now();
|
|
37
|
+
if (hasEpisodesTable(db)) {
|
|
38
|
+
const project = path.basename(process.cwd());
|
|
39
|
+
|
|
40
|
+
const chains = querySupersededChains(db, { project, days: 7, limit: 5 });
|
|
41
|
+
if (chains.length > 0) {
|
|
42
|
+
output.push(`[Mindlore Supersedes]\n${formatSupersededChains(chains)}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Episode consolidation reminder
|
|
46
|
+
try {
|
|
47
|
+
const rawCount = withTimeoutDb(db,
|
|
48
|
+
"SELECT COUNT(*) as cnt FROM episodes WHERE consolidation_status = 'raw' OR consolidation_status IS NULL",
|
|
49
|
+
[], { mode: 'get' });
|
|
50
|
+
const cnt = rawCount?.cnt ?? 0;
|
|
51
|
+
const consolThreshold = config?.consolidation?.threshold ?? 50;
|
|
52
|
+
if (cnt >= consolThreshold) {
|
|
53
|
+
output.push(`[Mindlore] ${cnt} raw episode birikti — \`/mindlore-maintain consolidate\` ile birleştirmeyi düşün.`);
|
|
54
|
+
}
|
|
55
|
+
} catch (_err) { /* consolidation_status column may not exist yet */ }
|
|
56
|
+
}
|
|
57
|
+
timings.db_episodes = Date.now() - tSuperseded;
|
|
58
|
+
|
|
59
|
+
// Stale content check
|
|
60
|
+
const tStale = Date.now();
|
|
61
|
+
try {
|
|
62
|
+
const thirtyDaysAgo = new Date(Date.now() - (30 * 24 * 60 * 60 * 1000)).toISOString();
|
|
63
|
+
const row = withTimeoutDb(db, 'SELECT COUNT(*) as cnt FROM file_hashes WHERE last_indexed < ?', [thirtyDaysAgo], { mode: 'get' });
|
|
64
|
+
const staleCount = row?.cnt ?? 0;
|
|
65
|
+
if (staleCount > 3) {
|
|
66
|
+
output.push(`[Mindlore: ${staleCount} dosya 30+ gundur guncellenmemis — \`/mindlore-evolve\` dusun]`);
|
|
67
|
+
}
|
|
68
|
+
} catch (_staleErr) { /* file_hashes may not exist */ }
|
|
69
|
+
timings.db_stale = Date.now() - tStale;
|
|
70
|
+
}
|
|
14
71
|
|
|
15
72
|
function main() {
|
|
73
|
+
const t0 = Date.now();
|
|
16
74
|
const baseDir = findMindloreDir();
|
|
17
75
|
if (!baseDir) return; // No .mindlore/ found, silently skip
|
|
18
76
|
|
|
19
77
|
const output = [];
|
|
20
78
|
const config = readConfig(baseDir);
|
|
79
|
+
const timings = {};
|
|
80
|
+
let sourceChars = 0;
|
|
21
81
|
|
|
22
82
|
// Inject INDEX.md
|
|
83
|
+
const tIndex = Date.now();
|
|
23
84
|
const indexPath = path.join(baseDir, 'INDEX.md');
|
|
24
85
|
if (fs.existsSync(indexPath)) {
|
|
86
|
+
sourceChars += fs.statSync(indexPath).size;
|
|
25
87
|
const content = fs.readFileSync(indexPath, 'utf8').trim();
|
|
26
88
|
output.push(`[Mindlore INDEX]\n${content}`);
|
|
27
89
|
}
|
|
90
|
+
timings.index_read = Date.now() - tIndex;
|
|
28
91
|
|
|
29
92
|
// Inject latest delta + reflect trigger (single readdirSync)
|
|
93
|
+
const tDiary = Date.now();
|
|
30
94
|
const diaryDir = path.join(baseDir, 'diary');
|
|
95
|
+
let latestDeltaContent = undefined;
|
|
31
96
|
if (fs.existsSync(diaryDir)) {
|
|
32
97
|
try {
|
|
33
|
-
const diaryFiles =
|
|
98
|
+
const diaryFiles = listSnapshots(diaryDir).filter(f => f.startsWith('delta-'));
|
|
34
99
|
|
|
35
100
|
if (diaryFiles.length > 0) {
|
|
36
|
-
const
|
|
37
|
-
const latestName = sorted[sorted.length - 1];
|
|
101
|
+
const latestName = diaryFiles[diaryFiles.length - 1];
|
|
38
102
|
const latestPath = path.join(diaryDir, latestName);
|
|
103
|
+
sourceChars += fs.statSync(latestPath).size;
|
|
39
104
|
const deltaContent = fs.readFileSync(latestPath, 'utf8').trim();
|
|
105
|
+
latestDeltaContent = deltaContent;
|
|
40
106
|
const { meta } = parseFrontmatter(deltaContent);
|
|
41
107
|
const deltaProject = meta.project || null;
|
|
42
108
|
const currentProject = getProjectName();
|
|
@@ -52,8 +118,10 @@ function main() {
|
|
|
52
118
|
}
|
|
53
119
|
} catch (_err) { /* skip */ }
|
|
54
120
|
}
|
|
121
|
+
timings.diary_walk = Date.now() - tDiary;
|
|
55
122
|
|
|
56
123
|
// Version check: compare .version (installed) vs .pkg-version (package)
|
|
124
|
+
const tVersion = Date.now();
|
|
57
125
|
// Both are flat strings written by init — no JSON parse needed on session start
|
|
58
126
|
const versionPath = path.join(baseDir, '.version');
|
|
59
127
|
const pkgVersionPath = path.join(baseDir, '.pkg-version');
|
|
@@ -66,87 +134,36 @@ function main() {
|
|
|
66
134
|
}
|
|
67
135
|
}
|
|
68
136
|
} catch (_err) { /* skip */ }
|
|
137
|
+
timings.version_check = Date.now() - tVersion;
|
|
69
138
|
|
|
70
139
|
// v0.5.4: Consolidated session payload (replaces scattered episodes/activity/alerts injection)
|
|
140
|
+
const tDb = Date.now();
|
|
141
|
+
const outputLenBeforeDb = output.reduce((s, o) => s + o.length, 0);
|
|
71
142
|
try {
|
|
72
143
|
const dbPath = path.join(baseDir, 'mindlore.db');
|
|
73
|
-
const
|
|
144
|
+
const tDbOpen = Date.now();
|
|
145
|
+
const db = tryOpenDb(dbPath);
|
|
146
|
+
timings.db_open = Date.now() - tDbOpen;
|
|
147
|
+
timings.db_integrity = 0;
|
|
74
148
|
|
|
75
149
|
if (db) {
|
|
76
|
-
// v0.6.1: Integrity check — auto-recover corrupt DB
|
|
77
|
-
const recoverCorruptDb = (reason) => {
|
|
78
|
-
db.close();
|
|
79
|
-
const bakPath = dbPath + '.corrupt.bak';
|
|
80
|
-
try { fs.copyFileSync(dbPath, bakPath); } catch { /* best effort */ }
|
|
81
|
-
try { fs.unlinkSync(dbPath); } catch { /* best effort */ }
|
|
82
|
-
hookLog('session-focus', 'warn', reason);
|
|
83
|
-
if (output.length > 0) process.stdout.write(output.join('\n\n'));
|
|
84
|
-
};
|
|
85
150
|
try {
|
|
86
|
-
|
|
87
|
-
const result = Array.isArray(check) ? check[0]?.integrity_check : check;
|
|
88
|
-
if (result !== 'ok') {
|
|
89
|
-
recoverCorruptDb(`Corrupt DB detected, backed up. Run 'npm run index' to rebuild.`);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
151
|
+
loadDbContent(db, baseDir, config, output, timings, latestDeltaContent);
|
|
92
152
|
} catch (err) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
// Session payload: Session summary, Decisions, Friction, Learnings
|
|
98
|
-
try {
|
|
99
|
-
const { buildSessionPayload } = require('../dist/scripts/lib/session-payload.js');
|
|
100
|
-
const project = path.basename(process.cwd());
|
|
101
|
-
const payloadBudget = config?.tokenBudget?.sessionInject ?? 2000;
|
|
102
|
-
const payload = buildSessionPayload(db, baseDir, project, payloadBudget);
|
|
103
|
-
if (!payload.skipInjection) {
|
|
104
|
-
for (const section of payload.sections) {
|
|
105
|
-
output.push(`[Mindlore ${section.label}]\n${section.content}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} catch (_payloadErr) {
|
|
109
|
-
// Session payload is optional — don't break session start
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// v0.4.1: Supersedes chain display (kept — not covered by session-payload)
|
|
113
|
-
if (hasEpisodesTable(db)) {
|
|
114
|
-
const project = path.basename(process.cwd());
|
|
115
|
-
|
|
116
|
-
const chains = querySupersededChains(db, { project, days: 7, limit: 5 });
|
|
117
|
-
if (chains.length > 0) {
|
|
118
|
-
output.push(`[Mindlore Supersedes]\n${formatSupersededChains(chains)}`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// v0.5.3: Episode consolidation reminder (kept — threshold-based reminder)
|
|
122
|
-
try {
|
|
123
|
-
const rawCount = db.prepare(
|
|
124
|
-
"SELECT COUNT(*) as cnt FROM episodes WHERE consolidation_status = 'raw' OR consolidation_status IS NULL"
|
|
125
|
-
).get();
|
|
126
|
-
const cnt = rawCount?.cnt ?? 0;
|
|
127
|
-
const consolThreshold = config?.consolidation?.threshold ?? 50;
|
|
128
|
-
if (cnt >= consolThreshold) {
|
|
129
|
-
output.push(`[Mindlore] ${cnt} raw episode birikti — \`/mindlore-maintain consolidate\` ile birleştirmeyi düşün.`);
|
|
130
|
-
}
|
|
131
|
-
} catch (_err) { /* consolidation_status column may not exist yet */ }
|
|
153
|
+
if (isCorruptionError(err)) {
|
|
154
|
+
recoverCorruptDb(db, dbPath, 'session-focus');
|
|
132
155
|
}
|
|
133
|
-
|
|
134
|
-
// v0.5.5: Stale content check (reuses open DB handle)
|
|
135
|
-
try {
|
|
136
|
-
const thirtyDaysAgo = new Date(Date.now() - (30 * 24 * 60 * 60 * 1000)).toISOString();
|
|
137
|
-
const row = db.prepare('SELECT COUNT(*) as cnt FROM file_hashes WHERE last_indexed < ?').get(thirtyDaysAgo);
|
|
138
|
-
const staleCount = row?.cnt ?? 0;
|
|
139
|
-
if (staleCount > 3) {
|
|
140
|
-
output.push(`[Mindlore: ${staleCount} dosya 30+ gundur guncellenmemis — \`/mindlore-evolve\` dusun]`);
|
|
141
|
-
}
|
|
142
|
-
} catch (_staleErr) { /* file_hashes may not exist */ }
|
|
143
156
|
} finally {
|
|
144
|
-
db.close();
|
|
157
|
+
try { db.close(); } catch { /* already closed by recovery */ }
|
|
145
158
|
}
|
|
146
159
|
}
|
|
147
160
|
} catch (_err) { /* graceful skip */ }
|
|
161
|
+
const outputLenAfterDb = output.reduce((s, o) => s + o.length, 0);
|
|
162
|
+
sourceChars += (outputLenAfterDb - outputLenBeforeDb);
|
|
163
|
+
timings.db_total = Date.now() - tDb;
|
|
148
164
|
|
|
149
|
-
|
|
165
|
+
timings.total = Date.now() - t0;
|
|
166
|
+
hookLog('session-focus', 'info', `timings: ${JSON.stringify(timings)}`);
|
|
150
167
|
|
|
151
168
|
// Token budget for session inject
|
|
152
169
|
// Defaults match DEFAULT_TOKEN_BUDGET in scripts/lib/constants.ts
|
|
@@ -163,6 +180,10 @@ function main() {
|
|
|
163
180
|
if (joined.length > 0) {
|
|
164
181
|
process.stdout.write(joined + '\n');
|
|
165
182
|
}
|
|
183
|
+
|
|
184
|
+
const inject_tokens = Math.ceil(joined.length / 4);
|
|
185
|
+
const source_tokens = Math.ceil(sourceChars / 4);
|
|
186
|
+
return { inject_tokens, source_tokens };
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
withTelemetry('mindlore-session-focus', main).catch(err => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindlore",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "AI-native knowledge system for Claude Code",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"cc-sync": "node dist/scripts/cc-memory-bulk-sync.js",
|
|
23
23
|
"cleanup": "node dist/scripts/maintain-cleanup.js",
|
|
24
24
|
"perf": "node dist/scripts/mindlore-perf.js",
|
|
25
|
-
"doctor": "node dist/scripts/mindlore-doctor.js"
|
|
25
|
+
"doctor": "node dist/scripts/mindlore-doctor.js",
|
|
26
|
+
"audit": "npm audit --audit-level=moderate"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
28
29
|
"claude-code",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"wiki"
|
|
36
37
|
],
|
|
37
38
|
"author": "omrfc",
|
|
38
|
-
"license": "
|
|
39
|
+
"license": "AGPL-3.0-only",
|
|
39
40
|
"repository": {
|
|
40
41
|
"type": "git",
|
|
41
42
|
"url": "git+https://github.com/mindlore/mindlore.git"
|
|
@@ -52,12 +53,12 @@
|
|
|
52
53
|
"zod": "^4.3.6"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
56
|
+
"@huggingface/transformers": "^4.2.0",
|
|
55
57
|
"@types/better-sqlite3": "^7.6.13",
|
|
56
58
|
"@types/jest": "^30.0.0",
|
|
57
59
|
"@types/node": "^25.6.0",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
59
61
|
"@typescript-eslint/parser": "^8.58.1",
|
|
60
|
-
"@huggingface/transformers": "^4.2.0",
|
|
61
62
|
"eslint": "^10.2.0",
|
|
62
63
|
"globals": "^17.5.0",
|
|
63
64
|
"jest": "^30.3.0",
|
package/plugin.json
CHANGED
|
@@ -24,6 +24,7 @@ KB bakım skill'i. Reflect düşünür, maintain temizler.
|
|
|
24
24
|
- `/mindlore-maintain decay` — stale doc listesi + archive flow
|
|
25
25
|
- `/mindlore-maintain consolidate` — episode gruplama + dosyaya promote
|
|
26
26
|
- `/mindlore-maintain contradictions` — çelişki analizi
|
|
27
|
+
- `/mindlore-maintain triage` — unpromoted raw dosyaları listele + metadata göster
|
|
27
28
|
|
|
28
29
|
## Decay Mode
|
|
29
30
|
|
package/templates/config.json
CHANGED