mindlore 0.7.4 → 0.7.6
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +18 -0
- package/dist/scripts/bundle-hooks.js +3 -4
- package/dist/scripts/bundle-hooks.js.map +1 -1
- package/dist/scripts/init.js +69 -3
- package/dist/scripts/init.js.map +1 -1
- package/dist/scripts/lib/constants.d.ts +20 -0
- package/dist/scripts/lib/constants.d.ts.map +1 -1
- package/dist/scripts/lib/constants.js +32 -1
- package/dist/scripts/lib/constants.js.map +1 -1
- package/dist/scripts/lib/db-helpers.d.ts +1 -0
- package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
- package/dist/scripts/lib/db-helpers.js +37 -0
- package/dist/scripts/lib/db-helpers.js.map +1 -1
- package/dist/scripts/lib/detect-plugin.js +1 -1
- package/dist/scripts/lib/detect-plugin.js.map +1 -1
- 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/session-payload.d.ts.map +1 -1
- package/dist/scripts/lib/session-payload.js +3 -5
- package/dist/scripts/lib/session-payload.js.map +1 -1
- package/dist/scripts/lib/skill-runner.d.ts +3 -0
- package/dist/scripts/lib/skill-runner.d.ts.map +1 -0
- package/dist/scripts/lib/skill-runner.js +78 -0
- package/dist/scripts/lib/skill-runner.js.map +1 -0
- package/dist/scripts/lib/telemetry-scan.d.ts +19 -0
- package/dist/scripts/lib/telemetry-scan.d.ts.map +1 -0
- package/dist/scripts/lib/telemetry-scan.js +42 -0
- package/dist/scripts/lib/telemetry-scan.js.map +1 -0
- package/dist/scripts/mindlore-clean-cache.d.ts +3 -0
- package/dist/scripts/mindlore-clean-cache.d.ts.map +1 -0
- package/dist/scripts/mindlore-clean-cache.js +65 -0
- package/dist/scripts/mindlore-clean-cache.js.map +1 -0
- package/dist/scripts/mindlore-doctor.d.ts.map +1 -1
- package/dist/scripts/mindlore-doctor.js +10 -13
- package/dist/scripts/mindlore-doctor.js.map +1 -1
- package/dist/scripts/reflect-failure-scan.d.ts +3 -0
- package/dist/scripts/reflect-failure-scan.d.ts.map +1 -0
- package/dist/scripts/reflect-failure-scan.js +41 -0
- package/dist/scripts/reflect-failure-scan.js.map +1 -0
- package/dist/tests/clean-cache.test.d.ts +2 -0
- package/dist/tests/clean-cache.test.d.ts.map +1 -0
- package/dist/tests/clean-cache.test.js +59 -0
- package/dist/tests/clean-cache.test.js.map +1 -0
- package/dist/tests/db-helpers-vec.test.d.ts +2 -0
- package/dist/tests/db-helpers-vec.test.d.ts.map +1 -0
- package/dist/tests/db-helpers-vec.test.js +32 -0
- package/dist/tests/db-helpers-vec.test.js.map +1 -0
- package/dist/tests/db-helpers.test.d.ts +2 -0
- package/dist/tests/db-helpers.test.d.ts.map +1 -0
- package/dist/tests/db-helpers.test.js +30 -0
- package/dist/tests/db-helpers.test.js.map +1 -0
- package/dist/tests/diary.test.js +3 -3
- package/dist/tests/diary.test.js.map +1 -1
- package/dist/tests/episodes-inject.test.js +5 -5
- package/dist/tests/episodes-inject.test.js.map +1 -1
- package/dist/tests/init-spawn-cleanup.test.d.ts +2 -0
- package/dist/tests/init-spawn-cleanup.test.d.ts.map +1 -0
- package/dist/tests/init-spawn-cleanup.test.js +21 -0
- package/dist/tests/init-spawn-cleanup.test.js.map +1 -0
- package/dist/tests/install-matrix.test.js +39 -0
- package/dist/tests/install-matrix.test.js.map +1 -1
- package/dist/tests/learnings-loader.test.d.ts +2 -0
- package/dist/tests/learnings-loader.test.d.ts.map +1 -0
- package/dist/tests/learnings-loader.test.js +64 -0
- package/dist/tests/learnings-loader.test.js.map +1 -0
- package/dist/tests/mindlore-home-env.test.d.ts +2 -0
- package/dist/tests/mindlore-home-env.test.d.ts.map +1 -0
- package/dist/tests/mindlore-home-env.test.js +33 -0
- package/dist/tests/mindlore-home-env.test.js.map +1 -0
- package/dist/tests/no-hardcoded-cache.test.d.ts +2 -0
- package/dist/tests/no-hardcoded-cache.test.d.ts.map +1 -0
- package/dist/tests/no-hardcoded-cache.test.js +40 -0
- package/dist/tests/no-hardcoded-cache.test.js.map +1 -0
- package/dist/tests/nomination.test.js +1 -1
- package/dist/tests/nomination.test.js.map +1 -1
- package/dist/tests/reflect-failure-scan.test.d.ts +2 -0
- package/dist/tests/reflect-failure-scan.test.d.ts.map +1 -0
- package/dist/tests/reflect-failure-scan.test.js +49 -0
- package/dist/tests/reflect-failure-scan.test.js.map +1 -0
- package/dist/tests/reflect-trigger.test.d.ts +2 -0
- package/dist/tests/reflect-trigger.test.d.ts.map +1 -0
- package/dist/tests/reflect-trigger.test.js +31 -0
- package/dist/tests/reflect-trigger.test.js.map +1 -0
- package/dist/tests/session-focus-episode-counter.test.d.ts +2 -0
- package/dist/tests/session-focus-episode-counter.test.d.ts.map +1 -0
- package/dist/tests/session-focus-episode-counter.test.js +41 -0
- package/dist/tests/session-focus-episode-counter.test.js.map +1 -0
- package/dist/tests/session-focus-learnings-inject.test.d.ts +2 -0
- package/dist/tests/session-focus-learnings-inject.test.d.ts.map +1 -0
- package/dist/tests/session-focus-learnings-inject.test.js +29 -0
- package/dist/tests/session-focus-learnings-inject.test.js.map +1 -0
- package/dist/tests/session-focus-nomination-inject.test.d.ts +2 -0
- package/dist/tests/session-focus-nomination-inject.test.d.ts.map +1 -0
- package/dist/tests/session-focus-nomination-inject.test.js +50 -0
- package/dist/tests/session-focus-nomination-inject.test.js.map +1 -0
- package/dist/tests/session-focus-reflect-nudge.test.d.ts +2 -0
- package/dist/tests/session-focus-reflect-nudge.test.d.ts.map +1 -0
- package/dist/tests/session-focus-reflect-nudge.test.js +62 -0
- package/dist/tests/session-focus-reflect-nudge.test.js.map +1 -0
- package/dist/tests/session-payload.test.js +6 -12
- package/dist/tests/session-payload.test.js.map +1 -1
- package/dist/tests/skill-md-uses-runner.test.d.ts +2 -0
- package/dist/tests/skill-md-uses-runner.test.d.ts.map +1 -0
- package/dist/tests/skill-md-uses-runner.test.js +31 -0
- package/dist/tests/skill-md-uses-runner.test.js.map +1 -0
- package/dist/tests/skill-runner-failure-e2e.test.d.ts +10 -0
- package/dist/tests/skill-runner-failure-e2e.test.d.ts.map +1 -0
- package/dist/tests/skill-runner-failure-e2e.test.js +64 -0
- package/dist/tests/skill-runner-failure-e2e.test.js.map +1 -0
- package/dist/tests/skill-runner.test.d.ts +2 -0
- package/dist/tests/skill-runner.test.d.ts.map +1 -0
- package/dist/tests/skill-runner.test.js +55 -0
- package/dist/tests/skill-runner.test.js.map +1 -0
- package/dist/tests/sync-scripts.test.d.ts +2 -0
- package/dist/tests/sync-scripts.test.d.ts.map +1 -0
- package/dist/tests/sync-scripts.test.js +26 -0
- package/dist/tests/sync-scripts.test.js.map +1 -0
- package/dist/tests/telemetry-scan.test.d.ts +2 -0
- package/dist/tests/telemetry-scan.test.d.ts.map +1 -0
- package/dist/tests/telemetry-scan.test.js +32 -0
- package/dist/tests/telemetry-scan.test.js.map +1 -0
- package/hooks/cc-memory-bulk-sync.cjs +19 -1
- package/hooks/cc-session-sync.cjs +19 -1
- package/hooks/lib/constants.cjs +1 -1
- package/hooks/lib/learnings-loader.cjs +70 -0
- package/hooks/lib/mindlore-common.cjs +5 -0
- package/hooks/lib/reflect-trigger.cjs +29 -0
- package/hooks/lib/sync-scripts.cjs +12 -0
- package/hooks/mindlore-search.cjs +97 -1
- package/hooks/mindlore-session-focus.cjs +76 -10
- package/hooks/src/lib/mindlore-common.cjs +5 -0
- package/hooks/src/mindlore-session-focus.cjs +47 -5
- package/mcp-server.cjs +37928 -0
- package/package.json +7 -3
- package/plugin.json +1 -1
- package/skills/mindlore-decide/SKILL.md +1 -1
- package/skills/mindlore-diary/SKILL.md +4 -4
- package/skills/mindlore-evolve/SKILL.md +2 -2
- package/skills/mindlore-health/SKILL.md +2 -2
- package/skills/mindlore-ingest/SKILL.md +7 -7
- package/skills/mindlore-log/SKILL.md +1 -1
- package/skills/mindlore-maintain/SKILL.md +2 -2
- package/skills/mindlore-query/SKILL.md +1 -1
- package/skills/mindlore-reflect/SKILL.md +30 -16
- package/start.cjs +141 -0
- package/templates/config.json +1 -1
|
@@ -26,6 +26,10 @@ function globalDir() {
|
|
|
26
26
|
return path.join(os.homedir(), MINDLORE_DIR);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
function resolveMindloreHome() {
|
|
30
|
+
return globalDir();
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
// Convenience export — snapshot at load time for simple references.
|
|
30
34
|
const GLOBAL_MINDLORE_DIR = globalDir();
|
|
31
35
|
|
|
@@ -773,6 +777,7 @@ module.exports = {
|
|
|
773
777
|
MINDLORE_DIR,
|
|
774
778
|
GLOBAL_MINDLORE_DIR,
|
|
775
779
|
globalDir,
|
|
780
|
+
resolveMindloreHome,
|
|
776
781
|
DB_NAME,
|
|
777
782
|
SKIP_FILES,
|
|
778
783
|
findMindloreDir,
|
|
@@ -10,7 +10,9 @@
|
|
|
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, withTimeoutDb, listSnapshots, isCorruptionError, recoverCorruptDb, getNominationCounts } = require('./lib/mindlore-common.cjs');
|
|
13
|
+
const { findMindloreDir, readConfig, openDatabase, hasEpisodesTable, querySupersededChains, formatSupersededChains, hookLog, getProjectName, parseFrontmatter, withTelemetry, withTimeoutDb, listSnapshots, isCorruptionError, recoverCorruptDb, getNominationCounts, resolveMindloreHome } = require('./lib/mindlore-common.cjs');
|
|
14
|
+
const { loadLearningsBlock } = require('./lib/learnings-loader.cjs');
|
|
15
|
+
const { shouldNudgeReflect } = require('../lib/reflect-trigger.cjs');
|
|
14
16
|
|
|
15
17
|
function truncateSection(content, sectionRegex, keepCount, label) {
|
|
16
18
|
const match = content.match(sectionRegex);
|
|
@@ -30,7 +32,7 @@ function truncateChangedFiles(content) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
function tryOpenDb(dbPath) {
|
|
33
|
-
return openDatabase(dbPath, { readonly: true });
|
|
35
|
+
return openDatabase(dbPath, { readonly: false }) || openDatabase(dbPath, { readonly: true });
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function getEpisodeStats(db, config, project) {
|
|
@@ -38,8 +40,11 @@ function getEpisodeStats(db, config, project) {
|
|
|
38
40
|
let consolidationMsg = null;
|
|
39
41
|
try {
|
|
40
42
|
const rawCount = withTimeoutDb(db,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
`SELECT COUNT(*) as cnt FROM episodes
|
|
44
|
+
WHERE (consolidation_status = 'raw' OR consolidation_status IS NULL)
|
|
45
|
+
AND kind IN ('learning','discovery','friction','decision','nomination')
|
|
46
|
+
AND project = ?`,
|
|
47
|
+
[project], { mode: 'get' });
|
|
43
48
|
const cnt = rawCount?.cnt ?? 0;
|
|
44
49
|
const consolThreshold = config?.consolidation?.threshold ?? 50;
|
|
45
50
|
if (cnt >= consolThreshold) {
|
|
@@ -63,7 +68,7 @@ function checkStaleContent(db) {
|
|
|
63
68
|
|
|
64
69
|
function loadDbContent({ db, baseDir, config, output, timings, latestDeltaContent, sessionId }) {
|
|
65
70
|
const project = path.basename(process.cwd());
|
|
66
|
-
// Session payload: Session summary, Decisions, Friction
|
|
71
|
+
// Session payload: Session summary, Decisions, Friction (Learnings via file-based loadLearningsBlock)
|
|
67
72
|
const tPayload = Date.now();
|
|
68
73
|
try {
|
|
69
74
|
const { buildSessionPayload } = require('../dist/scripts/lib/session-payload.js');
|
|
@@ -101,6 +106,9 @@ function loadDbContent({ db, baseDir, config, output, timings, latestDeltaConten
|
|
|
101
106
|
// Auto reflect trigger (Q1) + Graduated lesson count (Q3)
|
|
102
107
|
try {
|
|
103
108
|
const counts = getNominationCounts(db, project);
|
|
109
|
+
if (counts.staged > 0) {
|
|
110
|
+
output.push(`[Mindlore Nomination] ${counts.staged} karar bekliyor — /mindlore-reflect ile onayla`);
|
|
111
|
+
}
|
|
104
112
|
if (counts.staged >= (config?.graduation?.reflectThreshold ?? 5)) {
|
|
105
113
|
output.push(`[Mindlore] ${counts.staged} bekleyen nomination var — \`/mindlore-reflect\` çalıştır`);
|
|
106
114
|
}
|
|
@@ -209,6 +217,27 @@ function main() {
|
|
|
209
217
|
timings.schema_check = Date.now() - tSchema;
|
|
210
218
|
|
|
211
219
|
loadDbContent({ db, baseDir, config, output, timings, latestDeltaContent, sessionId });
|
|
220
|
+
|
|
221
|
+
// Auto-reflect nudge (7-day threshold + 24h cooldown)
|
|
222
|
+
try {
|
|
223
|
+
const reflectRow = db.prepare(
|
|
224
|
+
"SELECT value FROM skill_memory WHERE skill_name = 'mindlore-reflect' AND key = 'last_reflect_date'"
|
|
225
|
+
).get();
|
|
226
|
+
const nudgeRow = db.prepare(
|
|
227
|
+
"SELECT value FROM skill_memory WHERE skill_name = 'mindlore-reflect' AND key = 'last_nudge_date'"
|
|
228
|
+
).get();
|
|
229
|
+
if (shouldNudgeReflect(reflectRow?.value ?? null, nudgeRow?.value ?? null, new Date())) {
|
|
230
|
+
output.push('[Mindlore] 7+ gün reflect yapılmadı — `/mindlore-reflect` çalıştır');
|
|
231
|
+
const nowIso = new Date().toISOString();
|
|
232
|
+
db.prepare(`
|
|
233
|
+
INSERT INTO skill_memory (skill_name, key, value, updated_at)
|
|
234
|
+
VALUES ('mindlore-reflect', 'last_nudge_date', ?, ?)
|
|
235
|
+
ON CONFLICT(skill_name, key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at
|
|
236
|
+
`).run(nowIso, nowIso);
|
|
237
|
+
}
|
|
238
|
+
} catch (_err) {
|
|
239
|
+
// never block session-start on nudge failure
|
|
240
|
+
}
|
|
212
241
|
} catch (err) {
|
|
213
242
|
if (isCorruptionError(err)) {
|
|
214
243
|
recoverCorruptDb(db, dbPath, 'session-focus');
|
|
@@ -222,6 +251,19 @@ function main() {
|
|
|
222
251
|
sourceChars += (outputLenAfterDb - outputLenBeforeDb);
|
|
223
252
|
timings.db_total = Date.now() - tDb;
|
|
224
253
|
|
|
254
|
+
// Inject [Mindlore Learnings] block
|
|
255
|
+
try {
|
|
256
|
+
const mindloreDir = resolveMindloreHome();
|
|
257
|
+
const project = getProjectName();
|
|
258
|
+
const learningsBlock = loadLearningsBlock(mindloreDir, project);
|
|
259
|
+
if (learningsBlock) {
|
|
260
|
+
output.push(learningsBlock);
|
|
261
|
+
sourceChars += learningsBlock.length;
|
|
262
|
+
}
|
|
263
|
+
} catch (_err) {
|
|
264
|
+
// never block session-start on lessons loader failure
|
|
265
|
+
}
|
|
266
|
+
|
|
225
267
|
timings.total = Date.now() - t0;
|
|
226
268
|
hookLog('session-focus', 'info', `timings: ${JSON.stringify(timings)}`);
|
|
227
269
|
|