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.
Files changed (150) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -2
  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/mcp-server.cjs +37928 -0
  138. package/package.json +7 -3
  139. package/plugin.json +1 -1
  140. package/skills/mindlore-decide/SKILL.md +1 -1
  141. package/skills/mindlore-diary/SKILL.md +4 -4
  142. package/skills/mindlore-evolve/SKILL.md +2 -2
  143. package/skills/mindlore-health/SKILL.md +2 -2
  144. package/skills/mindlore-ingest/SKILL.md +7 -7
  145. package/skills/mindlore-log/SKILL.md +1 -1
  146. package/skills/mindlore-maintain/SKILL.md +2 -2
  147. package/skills/mindlore-query/SKILL.md +1 -1
  148. package/skills/mindlore-reflect/SKILL.md +30 -16
  149. package/start.cjs +141 -0
  150. package/templates/config.json +1 -1
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "mindlore",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
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": {
@@ -78,6 +80,8 @@
78
80
  "skills/",
79
81
  "templates/",
80
82
  "SCHEMA.md",
81
- "plugin.json"
83
+ "plugin.json",
84
+ "mcp-server.cjs",
85
+ "start.cjs"
82
86
  ]
83
87
  }
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.6",
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)
package/start.cjs ADDED
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Mindlore MCP Server bootstrap (context-mode pattern).
4
+ *
5
+ * CC plugin marketplace install pipeline does NOT run `npm install` —
6
+ * it just extracts the tarball. Native deps (better-sqlite3, sqlite-vec)
7
+ * need install-time platform binaries that bundledDependencies cannot
8
+ * ship cross-platform (sqlite-vec uses optionalDependencies pattern with
9
+ * per-platform packages, better-sqlite3 v12 ships no prebuilds/ dir).
10
+ *
11
+ * Strategy: this wrapper runs BEFORE mcp-server.cjs. It detects missing
12
+ * or wrong-platform native binaries and self-heals via `npm install` in
13
+ * the plugin cache dir. First boot is 5-30s (one-time), subsequent boots
14
+ * are <100ms (existsSync fast path).
15
+ *
16
+ * Why a separate wrapper instead of inlining in mcp-server.cjs:
17
+ * 1. mcp-server.cjs is an esbuild bundle — adding logic before the
18
+ * require('better-sqlite3') happens at the top of the bundle is hard
19
+ * 2. Single source of truth — hooks can also import ensure-deps later
20
+ * 3. Easier to swap out if CC plugin spec adds postinstall hooks
21
+ *
22
+ * See: feedback_cc_plugin_self_contained.md, feedback_multi_platform_binary.md
23
+ */
24
+
25
+ 'use strict';
26
+
27
+ const fs = require('node:fs');
28
+ const path = require('node:path');
29
+ const { execSync, spawn } = require('node:child_process');
30
+
31
+ const __dirname_ = __dirname;
32
+ const NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm';
33
+
34
+ // Native dep manifest — package + expected binary location after install
35
+ const NATIVE_DEPS = [
36
+ {
37
+ pkg: 'better-sqlite3',
38
+ binary: ['build', 'Release', 'better_sqlite3.node'],
39
+ },
40
+ // sqlite-vec uses optionalDependencies for per-platform packages
41
+ // (sqlite-vec-{linux,darwin,win32}-{x64,arm64}). npm picks the right one
42
+ // at install time. We just check the wrapper package presence — the
43
+ // platform-specific binary is auto-selected by sqlite-vec loader.
44
+ {
45
+ pkg: 'sqlite-vec',
46
+ binary: null, // loader handles platform selection
47
+ },
48
+ ];
49
+
50
+ const RUNTIME_DEPS = [
51
+ '@modelcontextprotocol/sdk',
52
+ 'zod',
53
+ ];
54
+
55
+ function log(msg) {
56
+ // stderr — stdout is reserved for MCP JSON-RPC
57
+ process.stderr.write(`[mindlore-bootstrap] ${msg}\n`);
58
+ }
59
+
60
+ function depPresent({ pkg, binary }) {
61
+ const pkgDir = path.join(__dirname_, 'node_modules', pkg);
62
+ if (!fs.existsSync(pkgDir)) return false;
63
+ if (binary && !fs.existsSync(path.join(pkgDir, ...binary))) return false;
64
+ return true;
65
+ }
66
+
67
+ function probeBetterSqlite3() {
68
+ // Child process probe — in-process require() caches dlopen, can't detect
69
+ // on-disk binary swaps (ABI mismatch or wrong-platform binary).
70
+ try {
71
+ execSync(
72
+ `node -e "new (require('better-sqlite3'))(':memory:').close()"`,
73
+ { cwd: __dirname_, stdio: 'pipe', timeout: 10000 }
74
+ );
75
+ return true;
76
+ } catch {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ function installMissing(packages) {
82
+ if (packages.length === 0) return true;
83
+ log(`installing missing packages: ${packages.join(', ')}`);
84
+ log('(first boot only — subsequent boots <100ms)');
85
+ try {
86
+ execSync(
87
+ `${NPM} install ${packages.join(' ')} --no-package-lock --no-save --silent`,
88
+ { cwd: __dirname_, stdio: 'pipe', timeout: 180000, shell: true }
89
+ );
90
+ log('install complete');
91
+ return true;
92
+ } catch (err) {
93
+ log(`install failed: ${err && err.message ? err.message : String(err)}`);
94
+ log('MCP server may not function — check network + write permissions in plugin cache dir');
95
+ return false;
96
+ }
97
+ }
98
+
99
+ function rebuildBetterSqlite3() {
100
+ log('rebuilding better-sqlite3 for current platform/ABI');
101
+ try {
102
+ execSync(`${NPM} rebuild better-sqlite3 --silent`, {
103
+ cwd: __dirname_, stdio: 'pipe', timeout: 120000, shell: true,
104
+ });
105
+ return true;
106
+ } catch (err) {
107
+ log(`rebuild failed: ${err && err.message ? err.message : String(err)}`);
108
+ return false;
109
+ }
110
+ }
111
+
112
+ function ensureDeps() {
113
+ // Fast path: everything present
114
+ const allDeps = [...NATIVE_DEPS, ...RUNTIME_DEPS.map((pkg) => ({ pkg, binary: null }))];
115
+ const missing = allDeps.filter((d) => !depPresent(d));
116
+
117
+ if (missing.length > 0) {
118
+ const installed = installMissing(missing.map((d) => d.pkg));
119
+ if (!installed) return false;
120
+ }
121
+
122
+ // ABI probe — even if binary file exists, it may be wrong platform
123
+ // (someone copied tarball cross-platform, or `prebuild-install` cached wrong arch).
124
+ if (!probeBetterSqlite3()) {
125
+ log('better-sqlite3 binary present but fails probe (likely ABI mismatch or wrong platform)');
126
+ rebuildBetterSqlite3();
127
+ // Re-probe after rebuild
128
+ if (!probeBetterSqlite3()) {
129
+ log('rebuild did not fix the probe — MCP boot may fail');
130
+ // Don't exit — let downstream require() surface the actual error
131
+ }
132
+ }
133
+
134
+ return true;
135
+ }
136
+
137
+ // Run ensure layer
138
+ ensureDeps();
139
+
140
+ // Boot the actual MCP server
141
+ require('./mcp-server.cjs');
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.4",
2
+ "version": "0.7.6",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",