mindlore 0.6.8 → 0.7.0

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 (209) hide show
  1. package/README.md +259 -259
  2. package/SCHEMA.md +292 -292
  3. package/dist/scripts/cc-memory-bulk-sync.d.ts.map +1 -1
  4. package/dist/scripts/cc-memory-bulk-sync.js +4 -2
  5. package/dist/scripts/cc-memory-bulk-sync.js.map +1 -1
  6. package/dist/scripts/cc-session-sync.d.ts.map +1 -1
  7. package/dist/scripts/cc-session-sync.js +9 -7
  8. package/dist/scripts/cc-session-sync.js.map +1 -1
  9. package/dist/scripts/fetch-raw.js +5 -4
  10. package/dist/scripts/fetch-raw.js.map +1 -1
  11. package/dist/scripts/init.js +16 -12
  12. package/dist/scripts/init.js.map +1 -1
  13. package/dist/scripts/lib/consolidation.js +10 -10
  14. package/dist/scripts/lib/constants.d.ts +3 -0
  15. package/dist/scripts/lib/constants.d.ts.map +1 -1
  16. package/dist/scripts/lib/constants.js +11 -1
  17. package/dist/scripts/lib/constants.js.map +1 -1
  18. package/dist/scripts/lib/decay.js +9 -9
  19. package/dist/scripts/lib/episodes.js +23 -23
  20. package/dist/scripts/lib/err-msg.d.ts +2 -0
  21. package/dist/scripts/lib/err-msg.d.ts.map +1 -0
  22. package/dist/scripts/lib/err-msg.js +7 -0
  23. package/dist/scripts/lib/err-msg.js.map +1 -0
  24. package/dist/scripts/lib/mcp-namespace.d.ts +2 -0
  25. package/dist/scripts/lib/mcp-namespace.d.ts.map +1 -0
  26. package/dist/scripts/lib/mcp-namespace.js +21 -0
  27. package/dist/scripts/lib/mcp-namespace.js.map +1 -0
  28. package/dist/scripts/lib/mcp-telemetry.d.ts +11 -0
  29. package/dist/scripts/lib/mcp-telemetry.d.ts.map +1 -0
  30. package/dist/scripts/lib/mcp-telemetry.js +37 -0
  31. package/dist/scripts/lib/mcp-telemetry.js.map +1 -0
  32. package/dist/scripts/lib/mcp-tools.d.ts +10 -0
  33. package/dist/scripts/lib/mcp-tools.d.ts.map +1 -0
  34. package/dist/scripts/lib/mcp-tools.js +121 -0
  35. package/dist/scripts/lib/mcp-tools.js.map +1 -0
  36. package/dist/scripts/lib/migrations-v061.js +21 -21
  37. package/dist/scripts/lib/migrations-v062.js +11 -11
  38. package/dist/scripts/lib/migrations-v063.js +14 -14
  39. package/dist/scripts/lib/migrations-v067.js +11 -11
  40. package/dist/scripts/lib/rrf.d.ts.map +1 -1
  41. package/dist/scripts/lib/rrf.js +2 -1
  42. package/dist/scripts/lib/rrf.js.map +1 -1
  43. package/dist/scripts/lib/schema-version.js +6 -6
  44. package/dist/scripts/lib/search-cache.js +11 -11
  45. package/dist/scripts/lib/search-engine.d.ts +1 -0
  46. package/dist/scripts/lib/search-engine.d.ts.map +1 -1
  47. package/dist/scripts/lib/search-engine.js +9 -5
  48. package/dist/scripts/lib/search-engine.js.map +1 -1
  49. package/dist/scripts/lib/secure-io.d.ts +11 -0
  50. package/dist/scripts/lib/secure-io.d.ts.map +1 -0
  51. package/dist/scripts/lib/secure-io.js +26 -0
  52. package/dist/scripts/lib/secure-io.js.map +1 -0
  53. package/dist/scripts/lib/session-payload.js +7 -7
  54. package/dist/scripts/lib/slugify.d.ts +2 -0
  55. package/dist/scripts/lib/slugify.d.ts.map +1 -0
  56. package/dist/scripts/lib/slugify.js +13 -0
  57. package/dist/scripts/lib/slugify.js.map +1 -0
  58. package/dist/scripts/lib/smart-snippet.d.ts +9 -0
  59. package/dist/scripts/lib/smart-snippet.d.ts.map +1 -0
  60. package/dist/scripts/lib/smart-snippet.js +47 -0
  61. package/dist/scripts/lib/smart-snippet.js.map +1 -0
  62. package/dist/scripts/lib/tool-adapters/brief-adapter.d.ts +15 -0
  63. package/dist/scripts/lib/tool-adapters/brief-adapter.d.ts.map +1 -0
  64. package/dist/scripts/lib/tool-adapters/brief-adapter.js +66 -0
  65. package/dist/scripts/lib/tool-adapters/brief-adapter.js.map +1 -0
  66. package/dist/scripts/lib/tool-adapters/decide-adapter.d.ts +31 -0
  67. package/dist/scripts/lib/tool-adapters/decide-adapter.d.ts.map +1 -0
  68. package/dist/scripts/lib/tool-adapters/decide-adapter.js +71 -0
  69. package/dist/scripts/lib/tool-adapters/decide-adapter.js.map +1 -0
  70. package/dist/scripts/lib/tool-adapters/ingest-adapter.d.ts +16 -0
  71. package/dist/scripts/lib/tool-adapters/ingest-adapter.d.ts.map +1 -0
  72. package/dist/scripts/lib/tool-adapters/ingest-adapter.js +58 -0
  73. package/dist/scripts/lib/tool-adapters/ingest-adapter.js.map +1 -0
  74. package/dist/scripts/lib/tool-adapters/recall-adapter.d.ts +20 -0
  75. package/dist/scripts/lib/tool-adapters/recall-adapter.d.ts.map +1 -0
  76. package/dist/scripts/lib/tool-adapters/recall-adapter.js +69 -0
  77. package/dist/scripts/lib/tool-adapters/recall-adapter.js.map +1 -0
  78. package/dist/scripts/lib/tool-adapters/search-adapter.d.ts +22 -0
  79. package/dist/scripts/lib/tool-adapters/search-adapter.d.ts.map +1 -0
  80. package/dist/scripts/lib/tool-adapters/search-adapter.js +32 -0
  81. package/dist/scripts/lib/tool-adapters/search-adapter.js.map +1 -0
  82. package/dist/scripts/lib/tool-adapters/stats-adapter.d.ts +15 -0
  83. package/dist/scripts/lib/tool-adapters/stats-adapter.d.ts.map +1 -0
  84. package/dist/scripts/lib/tool-adapters/stats-adapter.js +66 -0
  85. package/dist/scripts/lib/tool-adapters/stats-adapter.js.map +1 -0
  86. package/dist/scripts/lib/triage.js +3 -3
  87. package/dist/scripts/lib/validate-manifest.d.ts +8 -0
  88. package/dist/scripts/lib/validate-manifest.d.ts.map +1 -0
  89. package/dist/scripts/lib/validate-manifest.js +80 -0
  90. package/dist/scripts/lib/validate-manifest.js.map +1 -0
  91. package/dist/scripts/maintain-cleanup.d.ts.map +1 -1
  92. package/dist/scripts/maintain-cleanup.js +3 -2
  93. package/dist/scripts/maintain-cleanup.js.map +1 -1
  94. package/dist/scripts/mcp-server.d.ts +3 -0
  95. package/dist/scripts/mcp-server.d.ts.map +1 -0
  96. package/dist/scripts/mcp-server.js +85 -0
  97. package/dist/scripts/mcp-server.js.map +1 -0
  98. package/dist/scripts/mindlore-backup.js +9 -9
  99. package/dist/scripts/mindlore-doctor.d.ts.map +1 -1
  100. package/dist/scripts/mindlore-doctor.js +4 -6
  101. package/dist/scripts/mindlore-doctor.js.map +1 -1
  102. package/dist/scripts/mindlore-fts5-index.js +12 -12
  103. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  104. package/dist/scripts/mindlore-health-check.d.ts.map +1 -1
  105. package/dist/scripts/mindlore-health-check.js +2 -2
  106. package/dist/scripts/mindlore-health-check.js.map +1 -1
  107. package/dist/scripts/validate-manifest-cli.d.ts +2 -0
  108. package/dist/scripts/validate-manifest-cli.d.ts.map +1 -0
  109. package/dist/scripts/validate-manifest-cli.js +38 -0
  110. package/dist/scripts/validate-manifest-cli.js.map +1 -0
  111. package/dist/tests/cc-memory-sync.test.js +3 -3
  112. package/dist/tests/chunks-migration.test.js +1 -1
  113. package/dist/tests/compaction-snapshot.test.js +2 -2
  114. package/dist/tests/consolidation.test.js +3 -3
  115. package/dist/tests/decay.test.js +9 -9
  116. package/dist/tests/diary.test.js +4 -4
  117. package/dist/tests/episode-file.test.js +2 -1
  118. package/dist/tests/episode-file.test.js.map +1 -1
  119. package/dist/tests/episodes-inject.test.js +9 -9
  120. package/dist/tests/err-msg.test.d.ts +2 -0
  121. package/dist/tests/err-msg.test.d.ts.map +1 -0
  122. package/dist/tests/err-msg.test.js +24 -0
  123. package/dist/tests/err-msg.test.js.map +1 -0
  124. package/dist/tests/fetch-raw.test.js +1 -2
  125. package/dist/tests/fetch-raw.test.js.map +1 -1
  126. package/dist/tests/fts5.test.js +75 -75
  127. package/dist/tests/fuzzy.test.js +1 -1
  128. package/dist/tests/git-snapshot.test.js +3 -5
  129. package/dist/tests/git-snapshot.test.js.map +1 -1
  130. package/dist/tests/helpers/db.d.ts +1 -2
  131. package/dist/tests/helpers/db.d.ts.map +1 -1
  132. package/dist/tests/helpers/db.js +18 -26
  133. package/dist/tests/helpers/db.js.map +1 -1
  134. package/dist/tests/manifest-v2.test.d.ts +2 -0
  135. package/dist/tests/manifest-v2.test.d.ts.map +1 -0
  136. package/dist/tests/manifest-v2.test.js +67 -0
  137. package/dist/tests/manifest-v2.test.js.map +1 -0
  138. package/dist/tests/mcp-server.test.d.ts +2 -0
  139. package/dist/tests/mcp-server.test.d.ts.map +1 -0
  140. package/dist/tests/mcp-server.test.js +118 -0
  141. package/dist/tests/mcp-server.test.js.map +1 -0
  142. package/dist/tests/mcp-tools.test.d.ts +2 -0
  143. package/dist/tests/mcp-tools.test.d.ts.map +1 -0
  144. package/dist/tests/mcp-tools.test.js +243 -0
  145. package/dist/tests/mcp-tools.test.js.map +1 -0
  146. package/dist/tests/migrations-v053.test.js +16 -16
  147. package/dist/tests/migrations-v061.test.js +10 -10
  148. package/dist/tests/migrations-v063.test.js +4 -4
  149. package/dist/tests/migrations-v068.test.js +6 -3
  150. package/dist/tests/migrations-v068.test.js.map +1 -1
  151. package/dist/tests/nomination-counts.test.js +6 -6
  152. package/dist/tests/nomination-counts.test.js.map +1 -1
  153. package/dist/tests/pre-compact.test.js +2 -1
  154. package/dist/tests/pre-compact.test.js.map +1 -1
  155. package/dist/tests/recall-telemetry.test.js +12 -11
  156. package/dist/tests/recall-telemetry.test.js.map +1 -1
  157. package/dist/tests/rrf.test.js +3 -3
  158. package/dist/tests/search-engine.test.js +1 -1
  159. package/dist/tests/search-hook.test.js +2 -2
  160. package/dist/tests/search-offload.test.js +1 -1
  161. package/dist/tests/search-offload.test.js.map +1 -1
  162. package/dist/tests/secure-io.test.d.ts +2 -0
  163. package/dist/tests/secure-io.test.d.ts.map +1 -0
  164. package/dist/tests/secure-io.test.js +65 -0
  165. package/dist/tests/secure-io.test.js.map +1 -0
  166. package/dist/tests/session-payload.test.js +1 -1
  167. package/dist/tests/session-summary.test.js +1 -1
  168. package/dist/tests/similarity.test.js +1 -1
  169. package/dist/tests/skill-path-resolution.test.js +22 -3
  170. package/dist/tests/skill-path-resolution.test.js.map +1 -1
  171. package/dist/tests/smart-snippet.test.d.ts +2 -0
  172. package/dist/tests/smart-snippet.test.d.ts.map +1 -0
  173. package/dist/tests/smart-snippet.test.js +67 -0
  174. package/dist/tests/smart-snippet.test.js.map +1 -0
  175. package/dist/tests/triage.test.js +1 -1
  176. package/hooks/lib/constants.cjs +15 -15
  177. package/hooks/lib/mindlore-common.cjs +975 -974
  178. package/hooks/mindlore-cwd-changed.cjs +57 -57
  179. package/hooks/mindlore-decision-detector.cjs +54 -54
  180. package/hooks/mindlore-dont-repeat.cjs +222 -222
  181. package/hooks/mindlore-fts5-sync.cjs +98 -97
  182. package/hooks/mindlore-index.cjs +230 -229
  183. package/hooks/mindlore-model-router.cjs +54 -54
  184. package/hooks/mindlore-post-compact.cjs +69 -69
  185. package/hooks/mindlore-post-read.cjs +106 -106
  186. package/hooks/mindlore-pre-compact.cjs +154 -154
  187. package/hooks/mindlore-read-guard.cjs +105 -105
  188. package/hooks/mindlore-research-guard.cjs +176 -176
  189. package/hooks/mindlore-search.cjs +200 -200
  190. package/hooks/mindlore-session-end.cjs +510 -509
  191. package/hooks/mindlore-session-focus.cjs +256 -256
  192. package/package.json +77 -75
  193. package/plugin.json +8 -1
  194. package/skills/mindlore-diary/SKILL.md +85 -85
  195. package/skills/mindlore-evolve/SKILL.md +126 -126
  196. package/skills/mindlore-explore/SKILL.md +109 -109
  197. package/skills/mindlore-ingest/SKILL.md +195 -195
  198. package/skills/mindlore-maintain/SKILL.md +125 -125
  199. package/skills/mindlore-query/SKILL.md +151 -151
  200. package/skills/mindlore-reflect/SKILL.md +141 -141
  201. package/skills/mindlore-stats/SKILL.md +106 -106
  202. package/templates/INDEX.md +14 -14
  203. package/templates/SCHEMA.md +292 -292
  204. package/templates/config.json +1 -1
  205. package/templates/extraction/article.md +15 -15
  206. package/templates/extraction/changelog.md +15 -15
  207. package/templates/extraction/default.md +15 -15
  208. package/templates/extraction/docs.md +15 -15
  209. package/templates/extraction/github-repo.md +17 -17
@@ -1,125 +1,125 @@
1
- ---
2
- name: mindlore-maintain
3
- description: KB maintenance — decay/archive, episode consolidation, contradiction detection
4
- effort: medium
5
- context: fork
6
- allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
7
- ---
8
-
9
- ## Script Resolution
10
-
11
- Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
12
- 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-maintain" → `MINDLORE_PKG = {base_directory}/../..`
13
- 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
14
-
15
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
-
17
- # /mindlore-maintain
18
-
19
- KB bakım skill'i. Reflect düşünür, maintain temizler.
20
-
21
- ## Trigger
22
-
23
- - `/mindlore-maintain` — full rapor (decay + consolidation + contradiction)
24
- - `/mindlore-maintain decay` — stale doc listesi + archive flow
25
- - `/mindlore-maintain consolidate` — episode gruplama + dosyaya promote
26
- - `/mindlore-maintain contradictions` — çelişki analizi
27
- - `/mindlore-maintain triage` — unpromoted raw dosyaları listele + metadata göster
28
-
29
- ## Decay Mode
30
-
31
- 1. Stale documents listele:
32
- ```bash
33
- DECAY_MOD="$MINDLORE_PKG/dist/scripts/lib/decay.js"
34
- node -e "
35
- const { listStaleDocuments } = require(process.argv[1]);
36
- const Database = require('better-sqlite3');
37
- const path = require('path'), os = require('os');
38
- const dbPath = path.join(os.homedir(), '.mindlore', 'mindlore.db');
39
- const db = new Database(dbPath, {readonly: true});
40
- let decayConfig = {};
41
- try {
42
- const configPath = path.join(os.homedir(), '.mindlore', 'config.json');
43
- decayConfig = JSON.parse(require('fs').readFileSync(configPath, 'utf8')).decay || {};
44
- } catch (_err) { /* use defaults if config missing or malformed */ }
45
- const stale = listStaleDocuments(db, undefined, decayConfig);
46
- console.log(JSON.stringify(stale, null, 2));
47
- db.close();
48
- " "$DECAY_MOD"
49
- ```
50
-
51
- 2. Rapor sun:
52
- ```
53
- -- Decay Report --
54
- | # | File | Score | Last Access | Recalls | Action |
55
- |---|------|-------|-------------|---------|--------|
56
- | 1 | sources/old-api.md | 0.12 | 2025-11-01 | 0 | Archive? |
57
- ```
58
-
59
- 3. Kullanıcı onaylarsa:
60
- a. Git snapshot: `createPreEvictionTag`
61
- b. Arşivle: `archiveDocument(db, path)`
62
- c. Rapor: "Archived N docs. Git tag: pre-eviction-2026-04-18. Restore: `/mindlore-maintain restore <path>`"
63
-
64
- **Kurallar:**
65
- - Onay almadan ARŞİVLEME
66
- - Arşiv öncesi HER ZAMAN git snapshot
67
- - Score + last access + recall count göster
68
-
69
- ## Consolidation Mode
70
-
71
- 1. Raw episode sayısını kontrol et
72
- 2. Gruplama önerisi sun:
73
- ```
74
- -- Consolidation Önerisi --
75
- 3 learning episode → learnings/typescript-strict-patterns.md
76
- 2 discovery episode → insights/sqlite-vec-windows-gotchas.md
77
- ```
78
-
79
- 3. Kind→dizin mapping (deterministik):
80
- - learning → `learnings/`
81
- - discovery → `insights/`
82
- - friction → `analyses/`
83
- - decision → `decisions/`
84
- - preference → CC memory'de var mı kontrol et, varsa skip, yoksa `learnings/`
85
-
86
- 4. Kullanıcı onaylarsa:
87
- a. Hedef dosya yaz (frontmatter zorunlu: consolidated_from, consolidated_at, kind_source)
88
- b. Episode'ları işaretle: `markConsolidated(db, ids, targetFile)`
89
- c. Rapor: "N episode → M dosya promote edildi"
90
-
91
- **Kurallar:**
92
- - session/event episode'ları CONSOLİDATE EDİLMEZ
93
- - Onay almadan dosya YAZMA
94
- - `consolidated_from` frontmatter ZORUNLU (provenance)
95
-
96
- ## Contradiction Mode
97
-
98
- 1. Deterministic wiki-lint:
99
- ```bash
100
- node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js" ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
101
- ```
102
-
103
- 2. Semantic analiz (opsiyonel, token harcar)
104
-
105
- **Kurallar:**
106
- - Deterministic check HER ZAMAN çalışır
107
- - Çelişkileri OTOMATİK düzeltme — kullanıcıya sor
108
-
109
- ## Full Report Mode (flagsız)
110
-
111
- ```
112
- -- Maintain Report --
113
- Decay: 3 stale document (score < 0.3)
114
- Consolidation: 52 raw episode (learning: 15, discovery: 8, friction: 4)
115
- Contradictions: 1 found
116
-
117
- Aksiyon için:
118
- /mindlore-maintain decay
119
- /mindlore-maintain consolidate
120
- /mindlore-maintain contradictions
121
- ```
122
-
123
- ## Restore Mode
124
-
125
- `/mindlore-maintain restore <path>` — arşivlenmiş dokümanı geri yükler.
1
+ ---
2
+ name: mindlore-maintain
3
+ description: KB maintenance — decay/archive, episode consolidation, contradiction detection
4
+ effort: medium
5
+ context: fork
6
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
7
+ ---
8
+
9
+ ## Script Resolution
10
+
11
+ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
12
+ 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-maintain" → `MINDLORE_PKG = {base_directory}/../..`
13
+ 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
14
+
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
+
17
+ # /mindlore-maintain
18
+
19
+ KB bakım skill'i. Reflect düşünür, maintain temizler.
20
+
21
+ ## Trigger
22
+
23
+ - `/mindlore-maintain` — full rapor (decay + consolidation + contradiction)
24
+ - `/mindlore-maintain decay` — stale doc listesi + archive flow
25
+ - `/mindlore-maintain consolidate` — episode gruplama + dosyaya promote
26
+ - `/mindlore-maintain contradictions` — çelişki analizi
27
+ - `/mindlore-maintain triage` — unpromoted raw dosyaları listele + metadata göster
28
+
29
+ ## Decay Mode
30
+
31
+ 1. Stale documents listele:
32
+ ```bash
33
+ DECAY_MOD="$MINDLORE_PKG/dist/scripts/lib/decay.js"
34
+ node -e "
35
+ const { listStaleDocuments } = require(process.argv[1]);
36
+ const Database = require('better-sqlite3');
37
+ const path = require('path'), os = require('os');
38
+ const dbPath = path.join(os.homedir(), '.mindlore', 'mindlore.db');
39
+ const db = new Database(dbPath, {readonly: true});
40
+ let decayConfig = {};
41
+ try {
42
+ const configPath = path.join(os.homedir(), '.mindlore', 'config.json');
43
+ decayConfig = JSON.parse(require('fs').readFileSync(configPath, 'utf8')).decay || {};
44
+ } catch (_err) { /* use defaults if config missing or malformed */ }
45
+ const stale = listStaleDocuments(db, undefined, decayConfig);
46
+ console.log(JSON.stringify(stale, null, 2));
47
+ db.close();
48
+ " "$DECAY_MOD"
49
+ ```
50
+
51
+ 2. Rapor sun:
52
+ ```
53
+ -- Decay Report --
54
+ | # | File | Score | Last Access | Recalls | Action |
55
+ |---|------|-------|-------------|---------|--------|
56
+ | 1 | sources/old-api.md | 0.12 | 2025-11-01 | 0 | Archive? |
57
+ ```
58
+
59
+ 3. Kullanıcı onaylarsa:
60
+ a. Git snapshot: `createPreEvictionTag`
61
+ b. Arşivle: `archiveDocument(db, path)`
62
+ c. Rapor: "Archived N docs. Git tag: pre-eviction-2026-04-18. Restore: `/mindlore-maintain restore <path>`"
63
+
64
+ **Kurallar:**
65
+ - Onay almadan ARŞİVLEME
66
+ - Arşiv öncesi HER ZAMAN git snapshot
67
+ - Score + last access + recall count göster
68
+
69
+ ## Consolidation Mode
70
+
71
+ 1. Raw episode sayısını kontrol et
72
+ 2. Gruplama önerisi sun:
73
+ ```
74
+ -- Consolidation Önerisi --
75
+ 3 learning episode → learnings/typescript-strict-patterns.md
76
+ 2 discovery episode → insights/sqlite-vec-windows-gotchas.md
77
+ ```
78
+
79
+ 3. Kind→dizin mapping (deterministik):
80
+ - learning → `learnings/`
81
+ - discovery → `insights/`
82
+ - friction → `analyses/`
83
+ - decision → `decisions/`
84
+ - preference → CC memory'de var mı kontrol et, varsa skip, yoksa `learnings/`
85
+
86
+ 4. Kullanıcı onaylarsa:
87
+ a. Hedef dosya yaz (frontmatter zorunlu: consolidated_from, consolidated_at, kind_source)
88
+ b. Episode'ları işaretle: `markConsolidated(db, ids, targetFile)`
89
+ c. Rapor: "N episode → M dosya promote edildi"
90
+
91
+ **Kurallar:**
92
+ - session/event episode'ları CONSOLİDATE EDİLMEZ
93
+ - Onay almadan dosya YAZMA
94
+ - `consolidated_from` frontmatter ZORUNLU (provenance)
95
+
96
+ ## Contradiction Mode
97
+
98
+ 1. Deterministic wiki-lint:
99
+ ```bash
100
+ node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js" ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
101
+ ```
102
+
103
+ 2. Semantic analiz (opsiyonel, token harcar)
104
+
105
+ **Kurallar:**
106
+ - Deterministic check HER ZAMAN çalışır
107
+ - Çelişkileri OTOMATİK düzeltme — kullanıcıya sor
108
+
109
+ ## Full Report Mode (flagsız)
110
+
111
+ ```
112
+ -- Maintain Report --
113
+ Decay: 3 stale document (score < 0.3)
114
+ Consolidation: 52 raw episode (learning: 15, discovery: 8, friction: 4)
115
+ Contradictions: 1 found
116
+
117
+ Aksiyon için:
118
+ /mindlore-maintain decay
119
+ /mindlore-maintain consolidate
120
+ /mindlore-maintain contradictions
121
+ ```
122
+
123
+ ## Restore Mode
124
+
125
+ `/mindlore-maintain restore <path>` — arşivlenmiş dokümanı geri yükler.
@@ -1,151 +1,151 @@
1
- ---
2
- name: mindlore-query
3
- description: Search, ask, stats, brief — compounding pipeline
4
- context: fork
5
- allowed-tools: [Bash, Read, Grep, Glob]
6
- ---
7
-
8
- # Skill: Mindlore Query
9
-
10
- Search, ask, analyze, and retrieve knowledge from `.mindlore/`.
11
-
12
- ## Script Resolution
13
-
14
- Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
15
- 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-query" → `MINDLORE_PKG = {base_directory}/../..`
16
- 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
17
-
18
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
19
-
20
- ## Scope
21
-
22
- Determine search scope using `getActiveMindloreDir()` / `getAllDbs()` logic:
23
- - Default (no flag): search project `.mindlore/` DB, fall back to global
24
- - `--global`: search only `~/.mindlore/` DB
25
- - `--all`: search both project + global DBs, project results first
26
- - Never hardcode `.mindlore/` path — always resolve dynamically
27
-
28
- ## Trigger
29
-
30
- `/mindlore-query <mode> [query]` where mode is `search`, `ask`, `stats`, or `brief`.
31
-
32
- ## Modes
33
-
34
- ### search
35
-
36
- FTS5 keyword search + episodes recall with unified results.
37
-
38
- **Flow:**
39
- 1. Parse user query into keywords (strip stop words)
40
- 2. Run FTS5 MATCH on `mindlore_fts` table (knowledge: "ne biliyorum")
41
- 3. Run LIKE search on `episodes` table (memory: "ne oldu, ne karar aldım")
42
- 4. Merge results: FTS5 results first, then matching episodes
43
- 5. Return top 5 knowledge results + top 3 episode results
44
- 6. Display knowledge as table with snippet preview, episodes as timeline
45
- 7. If `--tags <tag>` flag provided: `WHERE tags MATCH '<tag>'` filter (FTS5 only)
46
- 8. If `--episodes-only` flag: skip FTS5, show only episode matches
47
-
48
- **Output format:**
49
- ```
50
- | # | Category | Title | Description | Score |
51
- |---|----------|-------|-------------|-------|
52
- | 1 | sources | React Hooks | useEffect cleanup patterns | -2.34 |
53
- ```
54
-
55
- ### ask
56
-
57
- Compounding query pipeline — knowledge grows with each answer.
58
-
59
- **Flow:**
60
- 1. Parse user question
61
- 2. FTS5 search → find relevant files (sources + domains + analyses + insights — previous answers INCLUDED)
62
- 3. Read top 3-5 relevant files
63
- 4. Synthesize answer from found knowledge
64
- 5. Cite sources: `[kaynak: sources/x.md]` format
65
- 6. Ask user: "Bu cevabı kaydetmemi ister misin?"
66
- 7. If yes → determine target:
67
- - Short answer (<200 lines, 1-2 sources) → `insights/{slug}.md`
68
- - Large synthesis (200+ lines, 3+ sources) → `analyses/{slug}.md`
69
- 8. Write with frontmatter:
70
-
71
- ```yaml
72
- ---
73
- slug: react-hooks-cleanup-comparison
74
- type: insight
75
- title: React Hooks Cleanup Comparison
76
- tags: [react, hooks, useEffect]
77
- confidence: high
78
- sources_used: [react-hooks, typescript-generics]
79
- description: Comparison of cleanup patterns in useEffect vs useLayoutEffect
80
- ---
81
- ```
82
-
83
- 9. FTS5 auto-indexes via FileChanged hook → next query finds this answer
84
- 10. Update relevant domain page (max 1) with backlink if applicable
85
- 11. Append to `log.md`: `| {date} | query-ask | {slug}.md |`
86
-
87
- **Compounding effect:** Step 2 searches ALL of `.mindlore/` including previous `insights/` and `analyses/`. Each saved answer enriches the next query.
88
-
89
- **Error compounding prevention:**
90
- - `confidence` field is REQUIRED on writebacks (high/medium/low)
91
- - `sources_used` lists exact slugs — traceability
92
- - Health check flags conflicting analyses on same topic (different confidence)
93
- - User approval is the quality gate — low-quality answers are not saved
94
-
95
- ### stats
96
-
97
- Knowledge base statistics.
98
-
99
- **Flow:**
100
- 1. Count files per directory (9 directories)
101
- 2. Count FTS5 entries and file_hashes entries
102
- 3. Find most recent ingest (latest file by modified date per directory)
103
- 4. Count tags frequency (parse all frontmatter, aggregate tags)
104
- 5. Display summary:
105
-
106
- ```
107
- Mindlore Stats
108
- ─────────────
109
- Total files: 47 (FTS5: 47 indexed)
110
- - sources: 18
111
- - domains: 5
112
- - analyses: 6
113
- - insights: 3
114
- - connections: 2
115
- - learnings: 4
116
- - diary: 8
117
- - decisions: 1
118
- - raw: 0
119
-
120
- Top tags: security (12), hooks (8), fts5 (6), testing (5)
121
- Last ingest: 2026-04-11 (sources/react-hooks.md)
122
- DB size: 1.2 MB
123
- ```
124
-
125
- ### brief
126
-
127
- Quick context on a topic — token-efficient (~50 tokens output).
128
-
129
- **Flow:**
130
- 1. FTS5 search for topic
131
- 2. If domain page exists → read first 3 lines of body (after frontmatter)
132
- 3. If no domain → read description field from top FTS5 match
133
- 4. Return: title + description + "Read full: {path}" pointer
134
- 5. Do NOT read full file — this mode is for quick "do I need to open this?" decisions
135
-
136
- **Output format:**
137
- ```
138
- [Mindlore Brief: Security]
139
- SSH hardening, firewall rules, audit checks. 5 sources, 2 analyses linked.
140
- → Read full: .mindlore/domains/security.md
141
- ```
142
-
143
- ## Rules
144
-
145
- - All modes respect the SCHEMA.md writeback rules (Section 6: Wiki vs Diary)
146
- - search and brief are read-only — no writes
147
- - ask writes only with user approval
148
- - stats is read-only
149
- - Token strategy: Read relevant files directly
150
- - Tags filter: `--tags security` works in search and ask modes
151
- - Max results: search=5, ask=3-5 (for synthesis), brief=1
1
+ ---
2
+ name: mindlore-query
3
+ description: Search, ask, stats, brief — compounding pipeline
4
+ context: fork
5
+ allowed-tools: [Bash, Read, Grep, Glob]
6
+ ---
7
+
8
+ # Skill: Mindlore Query
9
+
10
+ Search, ask, analyze, and retrieve knowledge from `.mindlore/`.
11
+
12
+ ## Script Resolution
13
+
14
+ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
15
+ 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-query" → `MINDLORE_PKG = {base_directory}/../..`
16
+ 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
17
+
18
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
19
+
20
+ ## Scope
21
+
22
+ Determine search scope using `getActiveMindloreDir()` / `getAllDbs()` logic:
23
+ - Default (no flag): search project `.mindlore/` DB, fall back to global
24
+ - `--global`: search only `~/.mindlore/` DB
25
+ - `--all`: search both project + global DBs, project results first
26
+ - Never hardcode `.mindlore/` path — always resolve dynamically
27
+
28
+ ## Trigger
29
+
30
+ `/mindlore-query <mode> [query]` where mode is `search`, `ask`, `stats`, or `brief`.
31
+
32
+ ## Modes
33
+
34
+ ### search
35
+
36
+ FTS5 keyword search + episodes recall with unified results.
37
+
38
+ **Flow:**
39
+ 1. Parse user query into keywords (strip stop words)
40
+ 2. Run FTS5 MATCH on `mindlore_fts` table (knowledge: "ne biliyorum")
41
+ 3. Run LIKE search on `episodes` table (memory: "ne oldu, ne karar aldım")
42
+ 4. Merge results: FTS5 results first, then matching episodes
43
+ 5. Return top 5 knowledge results + top 3 episode results
44
+ 6. Display knowledge as table with snippet preview, episodes as timeline
45
+ 7. If `--tags <tag>` flag provided: `WHERE tags MATCH '<tag>'` filter (FTS5 only)
46
+ 8. If `--episodes-only` flag: skip FTS5, show only episode matches
47
+
48
+ **Output format:**
49
+ ```
50
+ | # | Category | Title | Description | Score |
51
+ |---|----------|-------|-------------|-------|
52
+ | 1 | sources | React Hooks | useEffect cleanup patterns | -2.34 |
53
+ ```
54
+
55
+ ### ask
56
+
57
+ Compounding query pipeline — knowledge grows with each answer.
58
+
59
+ **Flow:**
60
+ 1. Parse user question
61
+ 2. FTS5 search → find relevant files (sources + domains + analyses + insights — previous answers INCLUDED)
62
+ 3. Read top 3-5 relevant files
63
+ 4. Synthesize answer from found knowledge
64
+ 5. Cite sources: `[kaynak: sources/x.md]` format
65
+ 6. Ask user: "Bu cevabı kaydetmemi ister misin?"
66
+ 7. If yes → determine target:
67
+ - Short answer (<200 lines, 1-2 sources) → `insights/{slug}.md`
68
+ - Large synthesis (200+ lines, 3+ sources) → `analyses/{slug}.md`
69
+ 8. Write with frontmatter:
70
+
71
+ ```yaml
72
+ ---
73
+ slug: react-hooks-cleanup-comparison
74
+ type: insight
75
+ title: React Hooks Cleanup Comparison
76
+ tags: [react, hooks, useEffect]
77
+ confidence: high
78
+ sources_used: [react-hooks, typescript-generics]
79
+ description: Comparison of cleanup patterns in useEffect vs useLayoutEffect
80
+ ---
81
+ ```
82
+
83
+ 9. FTS5 auto-indexes via FileChanged hook → next query finds this answer
84
+ 10. Update relevant domain page (max 1) with backlink if applicable
85
+ 11. Append to `log.md`: `| {date} | query-ask | {slug}.md |`
86
+
87
+ **Compounding effect:** Step 2 searches ALL of `.mindlore/` including previous `insights/` and `analyses/`. Each saved answer enriches the next query.
88
+
89
+ **Error compounding prevention:**
90
+ - `confidence` field is REQUIRED on writebacks (high/medium/low)
91
+ - `sources_used` lists exact slugs — traceability
92
+ - Health check flags conflicting analyses on same topic (different confidence)
93
+ - User approval is the quality gate — low-quality answers are not saved
94
+
95
+ ### stats
96
+
97
+ Knowledge base statistics.
98
+
99
+ **Flow:**
100
+ 1. Count files per directory (9 directories)
101
+ 2. Count FTS5 entries and file_hashes entries
102
+ 3. Find most recent ingest (latest file by modified date per directory)
103
+ 4. Count tags frequency (parse all frontmatter, aggregate tags)
104
+ 5. Display summary:
105
+
106
+ ```
107
+ Mindlore Stats
108
+ ─────────────
109
+ Total files: 47 (FTS5: 47 indexed)
110
+ - sources: 18
111
+ - domains: 5
112
+ - analyses: 6
113
+ - insights: 3
114
+ - connections: 2
115
+ - learnings: 4
116
+ - diary: 8
117
+ - decisions: 1
118
+ - raw: 0
119
+
120
+ Top tags: security (12), hooks (8), fts5 (6), testing (5)
121
+ Last ingest: 2026-04-11 (sources/react-hooks.md)
122
+ DB size: 1.2 MB
123
+ ```
124
+
125
+ ### brief
126
+
127
+ Quick context on a topic — token-efficient (~50 tokens output).
128
+
129
+ **Flow:**
130
+ 1. FTS5 search for topic
131
+ 2. If domain page exists → read first 3 lines of body (after frontmatter)
132
+ 3. If no domain → read description field from top FTS5 match
133
+ 4. Return: title + description + "Read full: {path}" pointer
134
+ 5. Do NOT read full file — this mode is for quick "do I need to open this?" decisions
135
+
136
+ **Output format:**
137
+ ```
138
+ [Mindlore Brief: Security]
139
+ SSH hardening, firewall rules, audit checks. 5 sources, 2 analyses linked.
140
+ → Read full: .mindlore/domains/security.md
141
+ ```
142
+
143
+ ## Rules
144
+
145
+ - All modes respect the SCHEMA.md writeback rules (Section 6: Wiki vs Diary)
146
+ - search and brief are read-only — no writes
147
+ - ask writes only with user approval
148
+ - stats is read-only
149
+ - Token strategy: Read relevant files directly
150
+ - Tags filter: `--tags security` works in search and ask modes
151
+ - Max results: search=5, ask=3-5 (for synthesis), brief=1