mindlore 0.7.4 → 0.7.5

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.
Files changed (148) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +18 -0
  4. package/dist/scripts/bundle-hooks.js +3 -4
  5. package/dist/scripts/bundle-hooks.js.map +1 -1
  6. package/dist/scripts/init.js +69 -3
  7. package/dist/scripts/init.js.map +1 -1
  8. package/dist/scripts/lib/constants.d.ts +20 -0
  9. package/dist/scripts/lib/constants.d.ts.map +1 -1
  10. package/dist/scripts/lib/constants.js +32 -1
  11. package/dist/scripts/lib/constants.js.map +1 -1
  12. package/dist/scripts/lib/db-helpers.d.ts +1 -0
  13. package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
  14. package/dist/scripts/lib/db-helpers.js +37 -0
  15. package/dist/scripts/lib/db-helpers.js.map +1 -1
  16. package/dist/scripts/lib/detect-plugin.js +1 -1
  17. package/dist/scripts/lib/detect-plugin.js.map +1 -1
  18. package/dist/scripts/lib/episodes.d.ts +1 -1
  19. package/dist/scripts/lib/episodes.d.ts.map +1 -1
  20. package/dist/scripts/lib/episodes.js +1 -1
  21. package/dist/scripts/lib/episodes.js.map +1 -1
  22. package/dist/scripts/lib/session-payload.d.ts.map +1 -1
  23. package/dist/scripts/lib/session-payload.js +3 -5
  24. package/dist/scripts/lib/session-payload.js.map +1 -1
  25. package/dist/scripts/lib/skill-runner.d.ts +3 -0
  26. package/dist/scripts/lib/skill-runner.d.ts.map +1 -0
  27. package/dist/scripts/lib/skill-runner.js +78 -0
  28. package/dist/scripts/lib/skill-runner.js.map +1 -0
  29. package/dist/scripts/lib/telemetry-scan.d.ts +19 -0
  30. package/dist/scripts/lib/telemetry-scan.d.ts.map +1 -0
  31. package/dist/scripts/lib/telemetry-scan.js +42 -0
  32. package/dist/scripts/lib/telemetry-scan.js.map +1 -0
  33. package/dist/scripts/mindlore-clean-cache.d.ts +3 -0
  34. package/dist/scripts/mindlore-clean-cache.d.ts.map +1 -0
  35. package/dist/scripts/mindlore-clean-cache.js +65 -0
  36. package/dist/scripts/mindlore-clean-cache.js.map +1 -0
  37. package/dist/scripts/mindlore-doctor.d.ts.map +1 -1
  38. package/dist/scripts/mindlore-doctor.js +10 -13
  39. package/dist/scripts/mindlore-doctor.js.map +1 -1
  40. package/dist/scripts/reflect-failure-scan.d.ts +3 -0
  41. package/dist/scripts/reflect-failure-scan.d.ts.map +1 -0
  42. package/dist/scripts/reflect-failure-scan.js +41 -0
  43. package/dist/scripts/reflect-failure-scan.js.map +1 -0
  44. package/dist/tests/clean-cache.test.d.ts +2 -0
  45. package/dist/tests/clean-cache.test.d.ts.map +1 -0
  46. package/dist/tests/clean-cache.test.js +59 -0
  47. package/dist/tests/clean-cache.test.js.map +1 -0
  48. package/dist/tests/db-helpers-vec.test.d.ts +2 -0
  49. package/dist/tests/db-helpers-vec.test.d.ts.map +1 -0
  50. package/dist/tests/db-helpers-vec.test.js +32 -0
  51. package/dist/tests/db-helpers-vec.test.js.map +1 -0
  52. package/dist/tests/db-helpers.test.d.ts +2 -0
  53. package/dist/tests/db-helpers.test.d.ts.map +1 -0
  54. package/dist/tests/db-helpers.test.js +30 -0
  55. package/dist/tests/db-helpers.test.js.map +1 -0
  56. package/dist/tests/diary.test.js +3 -3
  57. package/dist/tests/diary.test.js.map +1 -1
  58. package/dist/tests/episodes-inject.test.js +5 -5
  59. package/dist/tests/episodes-inject.test.js.map +1 -1
  60. package/dist/tests/init-spawn-cleanup.test.d.ts +2 -0
  61. package/dist/tests/init-spawn-cleanup.test.d.ts.map +1 -0
  62. package/dist/tests/init-spawn-cleanup.test.js +21 -0
  63. package/dist/tests/init-spawn-cleanup.test.js.map +1 -0
  64. package/dist/tests/install-matrix.test.js +39 -0
  65. package/dist/tests/install-matrix.test.js.map +1 -1
  66. package/dist/tests/learnings-loader.test.d.ts +2 -0
  67. package/dist/tests/learnings-loader.test.d.ts.map +1 -0
  68. package/dist/tests/learnings-loader.test.js +64 -0
  69. package/dist/tests/learnings-loader.test.js.map +1 -0
  70. package/dist/tests/mindlore-home-env.test.d.ts +2 -0
  71. package/dist/tests/mindlore-home-env.test.d.ts.map +1 -0
  72. package/dist/tests/mindlore-home-env.test.js +33 -0
  73. package/dist/tests/mindlore-home-env.test.js.map +1 -0
  74. package/dist/tests/no-hardcoded-cache.test.d.ts +2 -0
  75. package/dist/tests/no-hardcoded-cache.test.d.ts.map +1 -0
  76. package/dist/tests/no-hardcoded-cache.test.js +40 -0
  77. package/dist/tests/no-hardcoded-cache.test.js.map +1 -0
  78. package/dist/tests/nomination.test.js +1 -1
  79. package/dist/tests/nomination.test.js.map +1 -1
  80. package/dist/tests/reflect-failure-scan.test.d.ts +2 -0
  81. package/dist/tests/reflect-failure-scan.test.d.ts.map +1 -0
  82. package/dist/tests/reflect-failure-scan.test.js +49 -0
  83. package/dist/tests/reflect-failure-scan.test.js.map +1 -0
  84. package/dist/tests/reflect-trigger.test.d.ts +2 -0
  85. package/dist/tests/reflect-trigger.test.d.ts.map +1 -0
  86. package/dist/tests/reflect-trigger.test.js +31 -0
  87. package/dist/tests/reflect-trigger.test.js.map +1 -0
  88. package/dist/tests/session-focus-episode-counter.test.d.ts +2 -0
  89. package/dist/tests/session-focus-episode-counter.test.d.ts.map +1 -0
  90. package/dist/tests/session-focus-episode-counter.test.js +41 -0
  91. package/dist/tests/session-focus-episode-counter.test.js.map +1 -0
  92. package/dist/tests/session-focus-learnings-inject.test.d.ts +2 -0
  93. package/dist/tests/session-focus-learnings-inject.test.d.ts.map +1 -0
  94. package/dist/tests/session-focus-learnings-inject.test.js +29 -0
  95. package/dist/tests/session-focus-learnings-inject.test.js.map +1 -0
  96. package/dist/tests/session-focus-nomination-inject.test.d.ts +2 -0
  97. package/dist/tests/session-focus-nomination-inject.test.d.ts.map +1 -0
  98. package/dist/tests/session-focus-nomination-inject.test.js +50 -0
  99. package/dist/tests/session-focus-nomination-inject.test.js.map +1 -0
  100. package/dist/tests/session-focus-reflect-nudge.test.d.ts +2 -0
  101. package/dist/tests/session-focus-reflect-nudge.test.d.ts.map +1 -0
  102. package/dist/tests/session-focus-reflect-nudge.test.js +62 -0
  103. package/dist/tests/session-focus-reflect-nudge.test.js.map +1 -0
  104. package/dist/tests/session-payload.test.js +6 -12
  105. package/dist/tests/session-payload.test.js.map +1 -1
  106. package/dist/tests/skill-md-uses-runner.test.d.ts +2 -0
  107. package/dist/tests/skill-md-uses-runner.test.d.ts.map +1 -0
  108. package/dist/tests/skill-md-uses-runner.test.js +31 -0
  109. package/dist/tests/skill-md-uses-runner.test.js.map +1 -0
  110. package/dist/tests/skill-runner-failure-e2e.test.d.ts +10 -0
  111. package/dist/tests/skill-runner-failure-e2e.test.d.ts.map +1 -0
  112. package/dist/tests/skill-runner-failure-e2e.test.js +64 -0
  113. package/dist/tests/skill-runner-failure-e2e.test.js.map +1 -0
  114. package/dist/tests/skill-runner.test.d.ts +2 -0
  115. package/dist/tests/skill-runner.test.d.ts.map +1 -0
  116. package/dist/tests/skill-runner.test.js +55 -0
  117. package/dist/tests/skill-runner.test.js.map +1 -0
  118. package/dist/tests/sync-scripts.test.d.ts +2 -0
  119. package/dist/tests/sync-scripts.test.d.ts.map +1 -0
  120. package/dist/tests/sync-scripts.test.js +26 -0
  121. package/dist/tests/sync-scripts.test.js.map +1 -0
  122. package/dist/tests/telemetry-scan.test.d.ts +2 -0
  123. package/dist/tests/telemetry-scan.test.d.ts.map +1 -0
  124. package/dist/tests/telemetry-scan.test.js +32 -0
  125. package/dist/tests/telemetry-scan.test.js.map +1 -0
  126. package/hooks/cc-memory-bulk-sync.cjs +19 -1
  127. package/hooks/cc-session-sync.cjs +19 -1
  128. package/hooks/lib/constants.cjs +1 -1
  129. package/hooks/lib/learnings-loader.cjs +70 -0
  130. package/hooks/lib/mindlore-common.cjs +5 -0
  131. package/hooks/lib/reflect-trigger.cjs +29 -0
  132. package/hooks/lib/sync-scripts.cjs +12 -0
  133. package/hooks/mindlore-search.cjs +97 -1
  134. package/hooks/mindlore-session-focus.cjs +76 -10
  135. package/hooks/src/lib/mindlore-common.cjs +5 -0
  136. package/hooks/src/mindlore-session-focus.cjs +47 -5
  137. package/package.json +4 -2
  138. package/plugin.json +1 -1
  139. package/skills/mindlore-decide/SKILL.md +1 -1
  140. package/skills/mindlore-diary/SKILL.md +4 -4
  141. package/skills/mindlore-evolve/SKILL.md +2 -2
  142. package/skills/mindlore-health/SKILL.md +2 -2
  143. package/skills/mindlore-ingest/SKILL.md +7 -7
  144. package/skills/mindlore-log/SKILL.md +1 -1
  145. package/skills/mindlore-maintain/SKILL.md +2 -2
  146. package/skills/mindlore-query/SKILL.md +1 -1
  147. package/skills/mindlore-reflect/SKILL.md +30 -16
  148. package/templates/config.json +1 -1
@@ -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
- "SELECT COUNT(*) as cnt FROM episodes WHERE consolidation_status = 'raw' OR consolidation_status IS NULL",
42
- [], { mode: 'get' });
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, Learnings
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
 
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "mindlore",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "AI-native knowledge system for Claude Code",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
- "mindlore": "dist/scripts/init.js"
7
+ "mindlore": "dist/scripts/init.js",
8
+ "mindlore-clean-cache": "dist/scripts/mindlore-clean-cache.js"
8
9
  },
9
10
  "scripts": {
10
11
  "build": "tsc",
@@ -55,6 +56,7 @@
55
56
  "dependencies": {
56
57
  "@modelcontextprotocol/sdk": "^1.29.0",
57
58
  "better-sqlite3": "^12.9.0",
59
+ "sqlite-vec": "^0.1.9",
58
60
  "zod": "^4.3.6"
59
61
  },
60
62
  "devDependencies": {
package/plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "manifestVersion": 2,
3
3
  "name": "mindlore",
4
4
  "description": "AI-native knowledge system for Claude Code. Persistent, searchable, evolving knowledge base with FTS5 and Knowledge Graph.",
5
- "version": "0.7.4",
5
+ "version": "0.7.5",
6
6
  "skills": [
7
7
  {
8
8
  "name": "mindlore-ingest",
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
15
15
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-decide" → `MINDLORE_PKG = {base_directory}/../..`
16
16
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
17
17
 
18
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
18
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-decide <script> [args...]` for all script commands.
19
19
 
20
20
  ## Scope
21
21
 
@@ -10,7 +10,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
10
10
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-diary" → `MINDLORE_PKG = {base_directory}/../..`
11
11
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
12
12
 
13
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
13
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary <script> [args...]` for all script commands.
14
14
 
15
15
  # /mindlore-diary
16
16
 
@@ -27,7 +27,7 @@ Determine target using `getActiveMindloreDir()` logic:
27
27
  ## On Start — Read skill_memory
28
28
 
29
29
  ```bash
30
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-diary last_diary_date
30
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js get mindlore-diary last_diary_date
31
31
  ```
32
32
  If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
33
33
 
@@ -73,8 +73,8 @@ If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
73
73
  ## On End — Write skill_memory
74
74
 
75
75
  ```bash
76
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-diary last_diary_date "$(date -I)"
77
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-diary last_episode_count "{N}"
76
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js set mindlore-diary last_diary_date "$(date -I)"
77
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js set mindlore-diary last_episode_count "{N}"
78
78
  ```
79
79
 
80
80
  ## Rules
@@ -12,7 +12,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
12
12
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-evolve" → `MINDLORE_PKG = {base_directory}/../..`
13
13
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
14
14
 
15
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-evolve <script> [args...]` for all script commands.
16
16
 
17
17
  # /mindlore-evolve
18
18
 
@@ -107,7 +107,7 @@ Apply suggested changes with user approval.
107
107
  **Rules:**
108
108
  - NEVER make automatic changes — always require user approval
109
109
  - Show diff preview before applying
110
- - After changes, run `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-index.js"` for FTS5 sync
110
+ - After changes, run `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-evolve mindlore-fts5-index.js` for FTS5 sync
111
111
  - Log every change to log.md with timestamp
112
112
  - The `[mindlore:evolve]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (sonnet by default)
113
113
 
@@ -11,7 +11,7 @@ allowed-tools: [Bash, Read]
11
11
  Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
12
12
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-health" → `MINDLORE_PKG = {base_directory}/../..`
13
13
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
14
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
14
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-health <script> [args...]` for all script commands.
15
15
 
16
16
  # /mindlore-health
17
17
 
@@ -33,7 +33,7 @@ User says "health check", "mindlore health", "bilgi sistemi kontrol", "saglik ko
33
33
 
34
34
  1. Run the health check script:
35
35
  ```bash
36
- node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
36
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-health mindlore-health-check.js
37
37
  ```
38
38
 
39
39
  2. Read the output and provide LLM interpretation:
@@ -13,7 +13,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
13
13
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-ingest" → `MINDLORE_PKG = {base_directory}/../..`
14
14
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
15
15
 
16
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest <script> [args...]` for all script commands.
17
17
 
18
18
  # /mindlore-ingest
19
19
 
@@ -59,7 +59,7 @@ Birden fazla URL verildiğinde (boşluk veya virgülle ayrılmış):
59
59
 
60
60
  **Pre-check (before fetch):**
61
61
  ```bash
62
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-ingest last_ingest_urls
62
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/skill-memory.js get mindlore-ingest last_ingest_urls
63
63
  ```
64
64
  If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
65
65
 
@@ -67,7 +67,7 @@ If URL already in the list, warn user: "This URL was ingested recently. Re-inges
67
67
 
68
68
  1. **Fetch raw content (zero token):**
69
69
  ```bash
70
- node "$MINDLORE_PKG/dist/scripts/fetch-raw.js" "$URL" --out-dir "$MINDLORE_DIR/raw"
70
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest fetch-raw.js "$URL" --out-dir "$MINDLORE_DIR/raw"
71
71
  ```
72
72
  Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
73
73
 
@@ -88,7 +88,7 @@ If URL already in the list, warn user: "This URL was ingested recently. Re-inges
88
88
 
89
89
  5. **Update skill_memory:**
90
90
  ```bash
91
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-ingest last_ingest_urls "$URL"
91
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/skill-memory.js set mindlore-ingest last_ingest_urls "$URL"
92
92
  ```
93
93
 
94
94
  6. **Return to caller (this is all the ana session sees):**
@@ -176,7 +176,7 @@ After every ingest, verify all 7 checkpoints before reporting success:
176
176
 
177
177
  0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
178
178
  ```bash
179
- node "$MINDLORE_PKG/dist/scripts/lib/similarity.js" "<title or first 100 chars>"
179
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/similarity.js "<title or first 100 chars>"
180
180
  ```
181
181
  Eğer score > 0.7 olan sonuç varsa KULLANICIYA SOR: "Bu içerik '${slug}' ile benzer görünüyor. Yine de eklensin mi?"
182
182
  Kullanıcı onaylarsa devam et, yoksa atla.
@@ -185,11 +185,11 @@ After every ingest, verify all 7 checkpoints before reporting success:
185
185
  3. **INDEX.md updated** — stats line incremented, Recent section has new entry
186
186
  4. **Domain updated** — if relevant domain exists, new finding added (max 1 domain per ingest)
187
187
  5. **log.md entry** — append `| {date} | ingest | {slug}.md |`
188
- 6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-search.js" "{keyword}"` returns the new file
188
+ 6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest mindlore-fts5-search.js "{keyword}"` returns the new file
189
189
 
190
190
  If any checkpoint fails, fix it before reporting "ingest complete". Do NOT skip steps.
191
191
 
192
192
  Optional: run full health check for structural integrity:
193
193
  ```bash
194
- node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
194
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest mindlore-health-check.js
195
195
  ```
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
15
15
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-log" → `MINDLORE_PKG = {base_directory}/../..`
16
16
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
17
17
 
18
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
18
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-log <script> [args...]` for all script commands.
19
19
 
20
20
  ## Scope
21
21
 
@@ -12,7 +12,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
12
12
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-maintain" → `MINDLORE_PKG = {base_directory}/../..`
13
13
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
14
14
 
15
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-maintain <script> [args...]` for all script commands.
16
16
 
17
17
  # /mindlore-maintain
18
18
 
@@ -97,7 +97,7 @@ KB bakım skill'i. Reflect düşünür, maintain temizler.
97
97
 
98
98
  1. Deterministic wiki-lint:
99
99
  ```bash
100
- node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js" ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
100
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-maintain mindlore-health-check.js ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
101
101
  ```
102
102
 
103
103
  2. Semantic analiz (opsiyonel, token harcar)
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
15
15
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-query" → `MINDLORE_PKG = {base_directory}/../..`
16
16
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
17
17
 
18
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
18
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-query <script> [args...]` for all script commands.
19
19
 
20
20
  ## Scope
21
21
 
@@ -10,7 +10,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
10
10
  1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-reflect" → `MINDLORE_PKG = {base_directory}/../..`
11
11
  2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
12
12
 
13
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
13
+ Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect <script> [args...]` for all script commands.
14
14
 
15
15
  # /mindlore-reflect
16
16
 
@@ -25,8 +25,8 @@ Scans both project + global `~/.mindlore/` diary/ for patterns.
25
25
  ## On Start — Check pending nominations + skill_memory
26
26
 
27
27
  ```bash
28
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-reflect last_reflect_date
29
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-reflect nomination_count
28
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect lib/skill-memory.js get mindlore-reflect last_reflect_date
29
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect lib/skill-memory.js get mindlore-reflect nomination_count
30
30
  ```
31
31
 
32
32
  Check pending nominations:
@@ -48,15 +48,22 @@ Onaylamak istediklerini sec, veya 'skip':
48
48
  ## Flow
49
49
 
50
50
  1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
51
- 2. Filter by time: `--days 7` (default), `--days 30`
52
- 3. Present summary: "Found N episodes spanning DATE1 to DATE2"
53
- 4. LLM analyzes episodes for recurring patterns:
51
+ 2. **Run skill failure scan (NEW v0.7.5):**
52
+
53
+ ```bash
54
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect reflect-failure-scan
55
+ ```
56
+
57
+ This populates `episodes` table with `kind: 'skill_failure'` rows from `telemetry.jsonl`. Subsequent pattern analysis treats these like any other episode — 3+ repetitions of the same `(skill, script, error)` triple → nomination via existing 3-tier confidence logic.
58
+ 3. Filter by time: `--days 7` (default), `--days 30`
59
+ 4. Present summary: "Found N episodes spanning DATE1 to DATE2"
60
+ 5. LLM analyzes episodes for recurring patterns:
54
61
  - Repeated decisions (same choice 2+ times)
55
62
  - Recurring frictions (same blocker/error)
56
63
  - Discovery patterns (assumptions that keep breaking)
57
64
  - Workflow patterns that worked well
58
65
 
59
- 5. **3-Tier Confidence Assessment:**
66
+ 6. **3-Tier Confidence Assessment:**
60
67
 
61
68
  | Tekrar | Tier | Aksiyon |
62
69
  |--------|------|---------|
@@ -64,7 +71,7 @@ Onaylamak istediklerini sec, veya 'skip':
64
71
  | 2x | Learning | `kind: learning` episode olustur, learnings/ dosyasina yaz |
65
72
  | 3x+ | Nomination | `kind: nomination, status: staged, source: reflect` episode olustur |
66
73
 
67
- 6. **Structured report:**
74
+ 7. **Structured report:**
68
75
  ```
69
76
  -- Reflect Raporu (son {days} gun, {N} episode) --
70
77
 
@@ -83,23 +90,25 @@ Onaylamak istediklerini sec, veya 'skip':
83
90
  [ ] {rule} ({repeat_count}x, {confidence} confidence)
84
91
  ```
85
92
 
86
- 7. **Nomination creation (3x+ tekrar):**
93
+ 8. **Nomination creation (3x+ tekrar):**
87
94
  ```sql
88
95
  INSERT INTO episodes (summary, body, kind, status, source, project, created_at)
89
96
  VALUES (?, ?, 'nomination', 'staged', 'reflect', ?, ?)
90
97
  ```
91
98
 
92
- 8. **Nomination approval flow:**
99
+ 9. **Nomination approval flow:**
93
100
  User approves -> `status: staged -> approved` -> write to target:
94
- - `learnings` -> `learnings/{topic}.md`
95
- - `claude.md` -> project CLAUDE.md'ye kural ekle
96
- - `domain:{slug}` -> ilgili domain sayfasina ekle
101
+ - **`learnings/{topic}.md`** (DEFAULT — selected if user presses Enter / leaves blank)
102
+ - `claude.md` -> project CLAUDE.md'ye kural ekle (opt-in)
103
+ - `domain:{slug}` -> ilgili domain sayfasina ekle (opt-in)
97
104
 
98
105
  Approval SQL:
99
106
  ```sql
100
107
  UPDATE episodes SET status = 'approved', graduated_at = datetime('now') WHERE id = ?
101
108
  ```
102
109
 
110
+ When writing to `learnings/`, also write `project: <currentProject|global>` to the lesson frontmatter (A4 dependency).
111
+
103
112
  User rejects -> `status: staged -> rejected` + rejection reason
104
113
 
105
114
  Rejection SQL:
@@ -107,11 +116,16 @@ Onaylamak istediklerini sec, veya 'skip':
107
116
  UPDATE episodes SET status = 'rejected', rejected_at = datetime('now'), rejection_reason = ? WHERE id = ?
108
117
  ```
109
118
 
110
- ## On End — Write skill_memory
119
+ ## On End — Write skill_memory (success-only)
111
120
 
112
121
  ```bash
113
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-reflect last_reflect_date "$(date -I)"
114
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-reflect nomination_count "{staged_count}"
122
+ # ONLY update last_reflect_date if reflect completed successfully (no parse errors,
123
+ # no DB errors). If any failure occurred during pattern extraction, leave the date
124
+ # unchanged so the next session retries.
125
+ if [ "$REFLECT_EXIT_CODE" = "0" ]; then
126
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect skill-memory set mindlore-reflect last_reflect_date "$(date -I)"
127
+ fi
128
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect skill-memory set mindlore-reflect nomination_count "{staged_count}"
115
129
  ```
116
130
 
117
131
  ## Quick Health Summary (v0.5.3)
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.4",
2
+ "version": "0.7.5",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",