mindlore 0.6.7 → 0.6.8

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 (169) 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 +47 -42
  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 +58 -48
  8. package/dist/scripts/cc-session-sync.js.map +1 -1
  9. package/dist/scripts/init.js +8 -8
  10. package/dist/scripts/init.js.map +1 -1
  11. package/dist/scripts/lib/all-migrations.d.ts.map +1 -1
  12. package/dist/scripts/lib/all-migrations.js +4 -1
  13. package/dist/scripts/lib/all-migrations.js.map +1 -1
  14. package/dist/scripts/lib/consolidation.d.ts +4 -3
  15. package/dist/scripts/lib/consolidation.d.ts.map +1 -1
  16. package/dist/scripts/lib/consolidation.js +10 -10
  17. package/dist/scripts/lib/consolidation.js.map +1 -1
  18. package/dist/scripts/lib/constants.d.ts +1 -7
  19. package/dist/scripts/lib/constants.d.ts.map +1 -1
  20. package/dist/scripts/lib/constants.js +2 -9
  21. package/dist/scripts/lib/constants.js.map +1 -1
  22. package/dist/scripts/lib/db-helpers.d.ts +0 -15
  23. package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
  24. package/dist/scripts/lib/db-helpers.js +1 -51
  25. package/dist/scripts/lib/db-helpers.js.map +1 -1
  26. package/dist/scripts/lib/decay.d.ts.map +1 -1
  27. package/dist/scripts/lib/decay.js +9 -9
  28. package/dist/scripts/lib/decay.js.map +1 -1
  29. package/dist/scripts/lib/episodes.js +23 -23
  30. package/dist/scripts/lib/migrations-v061.js +21 -21
  31. package/dist/scripts/lib/migrations-v062.js +11 -11
  32. package/dist/scripts/lib/migrations-v063.js +14 -14
  33. package/dist/scripts/lib/migrations-v067.js +11 -11
  34. package/dist/scripts/lib/migrations-v068.d.ts +3 -0
  35. package/dist/scripts/lib/migrations-v068.d.ts.map +1 -0
  36. package/dist/scripts/lib/migrations-v068.js +37 -0
  37. package/dist/scripts/lib/migrations-v068.js.map +1 -0
  38. package/dist/scripts/lib/migrations.d.ts.map +1 -1
  39. package/dist/scripts/lib/migrations.js +0 -15
  40. package/dist/scripts/lib/migrations.js.map +1 -1
  41. package/dist/scripts/lib/schema-version.js +6 -6
  42. package/dist/scripts/lib/search-cache.js +11 -11
  43. package/dist/scripts/lib/session-payload.d.ts.map +1 -1
  44. package/dist/scripts/lib/session-payload.js +7 -7
  45. package/dist/scripts/lib/session-payload.js.map +1 -1
  46. package/dist/scripts/lib/triage.js +3 -3
  47. package/dist/scripts/mindlore-backup.js +9 -9
  48. package/dist/scripts/mindlore-fts5-index.d.ts +1 -2
  49. package/dist/scripts/mindlore-fts5-index.d.ts.map +1 -1
  50. package/dist/scripts/mindlore-fts5-index.js +12 -64
  51. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  52. package/dist/scripts/mindlore-health-check.d.ts.map +1 -1
  53. package/dist/scripts/mindlore-health-check.js +0 -11
  54. package/dist/scripts/mindlore-health-check.js.map +1 -1
  55. package/dist/tests/cc-memory-bulk-sync.test.js +23 -0
  56. package/dist/tests/cc-memory-bulk-sync.test.js.map +1 -1
  57. package/dist/tests/cc-session-sync.test.js +25 -0
  58. package/dist/tests/cc-session-sync.test.js.map +1 -1
  59. package/dist/tests/compaction-snapshot.test.js +2 -2
  60. package/dist/tests/consolidation.test.js +5 -5
  61. package/dist/tests/consolidation.test.js.map +1 -1
  62. package/dist/tests/decay.test.js +9 -9
  63. package/dist/tests/diary.test.js +4 -4
  64. package/dist/tests/episode-kind-constant.test.d.ts +2 -0
  65. package/dist/tests/episode-kind-constant.test.d.ts.map +1 -0
  66. package/dist/tests/episode-kind-constant.test.js +28 -0
  67. package/dist/tests/episode-kind-constant.test.js.map +1 -0
  68. package/dist/tests/episodes-inject.test.js +9 -9
  69. package/dist/tests/fts5.test.js +66 -125
  70. package/dist/tests/fts5.test.js.map +1 -1
  71. package/dist/tests/globalSetup.d.ts +2 -0
  72. package/dist/tests/globalSetup.d.ts.map +1 -0
  73. package/dist/tests/globalSetup.js +36 -0
  74. package/dist/tests/globalSetup.js.map +1 -0
  75. package/dist/tests/helpers/db.d.ts +13 -5
  76. package/dist/tests/helpers/db.d.ts.map +1 -1
  77. package/dist/tests/helpers/db.js +60 -33
  78. package/dist/tests/helpers/db.js.map +1 -1
  79. package/dist/tests/lesson-graduation.test.js +11 -11
  80. package/dist/tests/lesson-graduation.test.js.map +1 -1
  81. package/dist/tests/migrations-v053.test.js +16 -16
  82. package/dist/tests/migrations-v061.test.js +10 -10
  83. package/dist/tests/migrations-v063.test.js +2 -2
  84. package/dist/tests/migrations-v068.test.d.ts +2 -0
  85. package/dist/tests/migrations-v068.test.d.ts.map +1 -0
  86. package/dist/tests/migrations-v068.test.js +53 -0
  87. package/dist/tests/migrations-v068.test.js.map +1 -0
  88. package/dist/tests/nomination-counts.test.d.ts +2 -0
  89. package/dist/tests/nomination-counts.test.d.ts.map +1 -0
  90. package/dist/tests/nomination-counts.test.js +51 -0
  91. package/dist/tests/nomination-counts.test.js.map +1 -0
  92. package/dist/tests/recall-telemetry.test.js +8 -8
  93. package/dist/tests/schema-version.test.js +3 -7
  94. package/dist/tests/schema-version.test.js.map +1 -1
  95. package/dist/tests/search-hook.test.js +2 -2
  96. package/dist/tests/sec-regression.test.js +0 -50
  97. package/dist/tests/sec-regression.test.js.map +1 -1
  98. package/dist/tests/session-end-cleanup.test.js +3 -20
  99. package/dist/tests/session-end-cleanup.test.js.map +1 -1
  100. package/dist/tests/session-focus.test.js +7 -30
  101. package/dist/tests/session-focus.test.js.map +1 -1
  102. package/dist/tests/session-payload.test.js +1 -1
  103. package/dist/tests/session-summary.test.js +1 -1
  104. package/hooks/lib/constants.cjs +15 -0
  105. package/hooks/lib/mindlore-common.cjs +974 -1042
  106. package/hooks/mindlore-cwd-changed.cjs +57 -57
  107. package/hooks/mindlore-decision-detector.cjs +54 -54
  108. package/hooks/mindlore-dont-repeat.cjs +222 -222
  109. package/hooks/mindlore-fts5-sync.cjs +97 -88
  110. package/hooks/mindlore-index.cjs +229 -229
  111. package/hooks/mindlore-model-router.cjs +54 -54
  112. package/hooks/mindlore-post-compact.cjs +69 -69
  113. package/hooks/mindlore-post-read.cjs +106 -106
  114. package/hooks/mindlore-pre-compact.cjs +154 -154
  115. package/hooks/mindlore-read-guard.cjs +105 -105
  116. package/hooks/mindlore-research-guard.cjs +176 -176
  117. package/hooks/mindlore-search.cjs +200 -200
  118. package/hooks/mindlore-session-end.cjs +509 -526
  119. package/hooks/mindlore-session-focus.cjs +256 -259
  120. package/package.json +75 -78
  121. package/plugin.json +1 -1
  122. package/skills/mindlore-diary/SKILL.md +85 -85
  123. package/skills/mindlore-evolve/SKILL.md +126 -126
  124. package/skills/mindlore-explore/SKILL.md +109 -109
  125. package/skills/mindlore-ingest/SKILL.md +195 -195
  126. package/skills/mindlore-maintain/SKILL.md +125 -125
  127. package/skills/mindlore-query/SKILL.md +151 -151
  128. package/skills/mindlore-reflect/SKILL.md +141 -141
  129. package/skills/mindlore-stats/SKILL.md +106 -106
  130. package/templates/INDEX.md +14 -14
  131. package/templates/SCHEMA.md +292 -292
  132. package/templates/config.json +1 -1
  133. package/templates/extraction/article.md +15 -15
  134. package/templates/extraction/changelog.md +15 -15
  135. package/templates/extraction/default.md +15 -15
  136. package/templates/extraction/docs.md +15 -15
  137. package/templates/extraction/github-repo.md +17 -17
  138. package/dist/scripts/lib/daemon.d.ts +0 -16
  139. package/dist/scripts/lib/daemon.d.ts.map +0 -1
  140. package/dist/scripts/lib/daemon.js +0 -133
  141. package/dist/scripts/lib/daemon.js.map +0 -1
  142. package/dist/scripts/lib/embedding.d.ts +0 -5
  143. package/dist/scripts/lib/embedding.d.ts.map +0 -1
  144. package/dist/scripts/lib/embedding.js +0 -44
  145. package/dist/scripts/lib/embedding.js.map +0 -1
  146. package/dist/scripts/mindlore-daemon.d.ts +0 -2
  147. package/dist/scripts/mindlore-daemon.d.ts.map +0 -1
  148. package/dist/scripts/mindlore-daemon.js +0 -117
  149. package/dist/scripts/mindlore-daemon.js.map +0 -1
  150. package/dist/tests/daemon-integration.test.d.ts +0 -2
  151. package/dist/tests/daemon-integration.test.d.ts.map +0 -1
  152. package/dist/tests/daemon-integration.test.js +0 -37
  153. package/dist/tests/daemon-integration.test.js.map +0 -1
  154. package/dist/tests/daemon.test.d.ts +0 -2
  155. package/dist/tests/daemon.test.d.ts.map +0 -1
  156. package/dist/tests/daemon.test.js +0 -187
  157. package/dist/tests/daemon.test.js.map +0 -1
  158. package/dist/tests/embedding-hf-integration.test.d.ts +0 -2
  159. package/dist/tests/embedding-hf-integration.test.d.ts.map +0 -1
  160. package/dist/tests/embedding-hf-integration.test.js +0 -52
  161. package/dist/tests/embedding-hf-integration.test.js.map +0 -1
  162. package/dist/tests/embedding.test.d.ts +0 -6
  163. package/dist/tests/embedding.test.d.ts.map +0 -1
  164. package/dist/tests/embedding.test.js +0 -71
  165. package/dist/tests/embedding.test.js.map +0 -1
  166. package/dist/tests/sqlite-vec-v12.test.d.ts +0 -2
  167. package/dist/tests/sqlite-vec-v12.test.d.ts.map +0 -1
  168. package/dist/tests/sqlite-vec-v12.test.js +0 -72
  169. package/dist/tests/sqlite-vec-v12.test.js.map +0 -1
package/SCHEMA.md CHANGED
@@ -1,292 +1,292 @@
1
- # Mindlore Schema
2
-
3
- This file is the single source of truth for how the `.mindlore/` knowledge base works.
4
- It is written for LLM agents — not humans. Every rule here must be followed exactly.
5
-
6
- ## 1. Identity
7
-
8
- Mindlore is an AI-native knowledge system. It stores, indexes, and evolves knowledge
9
- across Claude Code sessions. Knowledge lives in `.mindlore/` as plain Markdown files
10
- with YAML frontmatter. Search is powered by FTS5 (SQLite full-text search).
11
-
12
- ## 2. Directory Structure
13
-
14
- ```
15
- .mindlore/
16
- ├── raw/ # Immutable source captures (URL dumps, pasted text)
17
- ├── sources/ # Processed source summaries (one per ingested source)
18
- ├── domains/ # Topic wiki pages (entities + concepts)
19
- ├── analyses/ # Large syntheses (200+ lines, 3+ sources)
20
- ├── insights/ # Short Q&A writebacks (<200 lines, 1-2 sources)
21
- ├── connections/ # Cross-cutting links between 2+ sources
22
- ├── learnings/ # Persistent rules extracted from reflect (topic-based)
23
- ├── diary/ # Session logs, delta files (delta-YYYY-MM-DD-HHmm.md)
24
- ├── decisions/ # Decision records with context and rationale
25
- ├── INDEX.md # Minimal navigation map (~15-20 lines, fixed size)
26
- ├── SCHEMA.md # This file (copied from repo template)
27
- ├── log.md # Operation log (append-only)
28
- └── mindlore.db # FTS5 search database (SQLite)
29
- ```
30
-
31
- ### Global Scope (v0.3.3)
32
-
33
- Mindlore uses a single global directory:
34
- - **Global:** `~/.mindlore/` (or `$MINDLORE_HOME` if set)
35
- - All projects share one DB; project namespace is stored in the `project` FTS5 column
36
- - `project` = `path.basename(cwd)` at index/search time
37
- - `npx mindlore init` always initializes `~/.mindlore/` with git repo for auto-sync
38
- - Search defaults to current project; use `--all` flag to search all projects
39
-
40
- ### Directory Rules
41
-
42
- - Each directory corresponds to exactly one frontmatter `type` value
43
- - `type: raw` → `raw/`, `type: source` → `sources/`, etc.
44
- - Files MUST live in the directory matching their `type`
45
- - The health check script validates this cross-reference
46
-
47
- ## 3. Frontmatter
48
-
49
- Every `.md` file in `.mindlore/` MUST have YAML frontmatter. Format:
50
-
51
- ```yaml
52
- ---
53
- slug: kebab-case-unique-identifier
54
- type: raw|source|domain|analysis|insight|connection|learning|decision|diary
55
- title: Human-readable title
56
- tags: [tag1, tag2]
57
- ---
58
- ```
59
-
60
- ### Required Fields (all types)
61
-
62
- | Field | Format | Rule |
63
- |-------|--------|------|
64
- | `slug` | kebab-case | Unique within directory. Used as filename: `{slug}.md` |
65
- | `type` | enum | Must match the parent directory (see Section 2) |
66
-
67
- ### Type-Specific Fields
68
-
69
- | Type | Required Fields | Optional |
70
- |------|----------------|----------|
71
- | `raw` | slug, type, source_url | tags, description |
72
- | `source` | slug, type, title, tags, quality, source_url, ingested | date_captured, description, raw_slug |
73
- | `domain` | slug, type, title, tags | description, status |
74
- | `analysis` | slug, type, title, tags, confidence, sources_used | description |
75
- | `insight` | slug, type, title, tags | sources_used, description |
76
- | `connection` | slug, type, title, tags | sources_used, description |
77
- | `learning` | slug, type, title, tags | description |
78
- | `decision` | slug, type, title, tags | supersedes, status, description |
79
- | `diary` | slug, type, date | — (hook adds automatically) |
80
-
81
- ### Field Value Rules
82
-
83
- - `quality`: `high` | `medium` | `low`
84
- - `confidence`: `high` | `medium` | `low` (how certain is this analysis)
85
- - `ingested`: `true` | `false` (has this source been processed into domains)
86
- - `sources_used`: list of slugs referenced in the analysis
87
- - `supersedes`: slug of the decision this one replaces
88
- - `date`: ISO 8601 date (YYYY-MM-DD)
89
- - `description`: one-line summary (15-30 words). Used in FTS5 search and inject output. Optional but strongly recommended for search quality
90
- - `raw_slug`: slug of the raw/ file this source was processed from (source→raw traceability)
91
- - `status`: `stub` | `active` | `archived` (domain maturity indicator)
92
-
93
- ## 4. Seven Operations
94
-
95
- ### 4.1 Ingest (skill: /mindlore-ingest)
96
-
97
- Add new knowledge. Flow: capture → raw/ → process → sources/ → update domains/ → FTS5.
98
-
99
- - URL mode: markitdown CLI (if available) or WebFetch → raw/ → Sonnet summarizes → sources/
100
- - Text mode: user paste → raw/ → summarize → sources/
101
- - PDF mode: CC Read tool (max 20 pages/request) → raw/ → summarize → sources/
102
- - **markitdown is NOT used for PDF** — quality is poor. Use CC Read tool or Marker/Chandra (v0.3+)
103
-
104
- ### 4.2 Query (skill: /mindlore-query, v0.2 — PLANNED, not yet implemented)
105
-
106
- Search and retrieve knowledge. Four modes:
107
- - `search`: FTS5 keyword search, return top 3 matches with snippets
108
- - `ask`: Natural language question → FTS5 → read relevant files → synthesize answer
109
- - `stats`: Knowledge base statistics (counts by type, recent activity)
110
- - `brief`: Quick context on a topic (read domain page if exists)
111
-
112
- ### 4.3 Health (skill: /mindlore-health)
113
-
114
- Run 16-point structural check:
115
- - 9 directory existence checks
116
- - SCHEMA.md parse validation
117
- - INDEX.md format check (~15-20 lines)
118
- - mindlore.db FTS5 integrity
119
- - Orphan file detection (files not in FTS5)
120
- - Frontmatter validation (type-directory cross-reference)
121
-
122
- ### 4.4 Log (skill: /mindlore-log, v0.2 — PLANNED, not yet implemented)
123
-
124
- Session logging with four modes:
125
- - `log`: Write session/task record to diary/
126
- - `reflect`: Scan old deltas, extract patterns, move to learnings/
127
- - `status`: Recent N sessions summary, trends, open items
128
- - `save`: Structured delta + log.md append + wiki update
129
-
130
- ### 4.5 Decide (skill: /mindlore-decide, v0.2 — PLANNED, not yet implemented)
131
-
132
- Record decisions with context, options considered, rationale, and outcome.
133
- Supports `supersedes` chain for decision evolution.
134
-
135
- ### 4.6 Evolve (skill: /mindlore-evolve, v0.3 — PLANNED, not yet implemented)
136
-
137
- Schema co-evolution. Scan domains + sources, suggest structural updates.
138
- Run monthly or after major changes.
139
-
140
- ### 4.7 Explore (skill: /mindlore-explore, v0.3 — PLANNED, not yet implemented)
141
-
142
- Discover unexpected connections between sources. Cross-reference analysis.
143
-
144
- ## 5. Search Behavior
145
-
146
- ### FTS5 Search (hooks + scripts)
147
-
148
- - Database: `.mindlore/mindlore.db`
149
- - Table: `mindlore_fts` — knowledge content (sources, domains, analyses, decisions, diary)
150
- - Table: `mindlore_fts_sessions` — session content (cc-subagent, cc-session) — v0.6.1
151
- - Dedup: `file_hashes` table with SHA256 content-hash + `table_target` column (v0.6.1)
152
- - Tokenizer: `unicode61`
153
- - Max results: 3 per query (BM25 ranking)
154
- - Hook injects: file path + first 2 headings
155
-
156
- ### FTS5 Columns (11-col schema, v0.3.3)
157
-
158
- | Column | Indexed | Source |
159
- |--------|---------|--------|
160
- | `path` | UNINDEXED | File system path |
161
- | `slug` | Yes | Frontmatter slug |
162
- | `description` | Yes | Frontmatter description |
163
- | `type` | UNINDEXED | Frontmatter type |
164
- | `category` | Yes | Parent directory name |
165
- | `title` | Yes | Frontmatter title or first heading |
166
- | `content` | Yes | Markdown body (sans frontmatter) |
167
- | `tags` | Yes | Frontmatter tags (comma-separated) |
168
- | `quality` | UNINDEXED | Frontmatter quality (high/medium/low) |
169
- | `date_captured` | UNINDEXED | Frontmatter date_captured or date |
170
- | `project` | UNINDEXED | path.basename(cwd) at index time |
171
-
172
- ### Search Flow (UserPromptSubmit hook)
173
-
174
- 1. Extract keywords from user prompt
175
- 2. Query FTS5 with BM25 ranking
176
- 3. Return max 3 results as stdout additionalContext
177
- 4. Agent reads full file only if needed (progressive disclosure)
178
-
179
- ## 6. Wiki vs Diary (Writeback Target Rules)
180
-
181
- Knowledge goes to one of two layers. The agent MUST pick the correct one.
182
-
183
- ### Wiki Layer (permanent knowledge)
184
-
185
- Directories: `sources/`, `domains/`, `analyses/`, `insights/`, `connections/`, `learnings/`
186
-
187
- - Persists across sessions — reference value
188
- - Indexed by FTS5, discoverable via search hook
189
- - Updated by ingest, query writeback, reflect, evolve
190
- - Content should be factual, sourced, and reusable
191
-
192
- ### Diary Layer (session-scoped logs)
193
-
194
- Directories: `diary/`, `decisions/`
195
-
196
- - Session-specific: deltas, logs, decision snapshots
197
- - diary/ entries get `archived: true` after reflect processes them
198
- - decisions/ are permanent but session-originated (context + rationale)
199
- - Patterns extracted from diary → moved to `learnings/` (wiki layer)
200
-
201
- ### Selection Rule
202
-
203
- | Content Type | Target | Example |
204
- |-------------|--------|---------|
205
- | Ingested source summary | `sources/` | URL or text summary |
206
- | Topic wiki page | `domains/` | Consolidated knowledge on a subject |
207
- | Multi-source synthesis | `analyses/` | Comparison table, architecture decision |
208
- | Short Q&A answer | `insights/` | Query writeback (<200 lines) |
209
- | Cross-reference finding | `connections/` | Link between 2+ unrelated sources |
210
- | Persistent rule/lesson | `learnings/` | YAPMA/BEST PRACTICE from reflect |
211
- | Session log/delta | `diary/` | What happened this session |
212
- | Decision record | `decisions/` | Why X was chosen over Y |
213
- | Raw capture | `raw/` | Immutable original (URL dump, paste) |
214
-
215
- ### Anti-patterns
216
-
217
- - Do NOT write session-specific notes to `insights/` — use `diary/`
218
- - Do NOT write permanent rules to `diary/` — use `learnings/`
219
- - Do NOT write decision rationale to `analyses/` — use `decisions/`
220
-
221
- ## 7. Compounding
222
-
223
- Knowledge compounds when outputs become inputs:
224
-
225
- ```
226
- Query answer → writeback to insights/ → FTS5 indexes → next query finds it
227
- Reflect → patterns to learnings/ → session-focus injects → agent applies
228
- ```
229
-
230
- ### Writeback Triggers
231
-
232
- Offer to save when:
233
- - Comparison table generated (X vs Y)
234
- - Architectural decision or evaluation made
235
- - 3+ sources synthesized
236
- - User says "save this" or "remember this"
237
-
238
- ### Writeback Rules
239
-
240
- - Short answer (<200 lines) → insights/
241
- - Large synthesis (200+ lines, 3+ sources) → analyses/
242
- - Cross-cutting link → connections/
243
-
244
- ## 8. Learnings
245
-
246
- Persistent rules extracted from reflect operations.
247
- Organized by topic: `git.md`, `testing.md`, `security.md`, etc.
248
-
249
- ### Format
250
-
251
- ```markdown
252
- ---
253
- slug: testing
254
- type: learning
255
- title: Testing Learnings
256
- tags: [testing, jest, mock]
257
- ---
258
-
259
- # Testing Learnings
260
-
261
- - YAPMA: Error handling testinde mock'u dolayli tetikleme
262
- - BEST PRACTICE: Side-effect'li moduller eklerken TUM test'lerde mock ekle
263
- ```
264
-
265
- ### Rules
266
-
267
- - One file per topic (not per lesson)
268
- - Append new learnings to existing topic file
269
- - Use `YAPMA:` / `BEST PRACTICE:` / `KRITIK:` prefixes
270
- - Reflect skill proposes, user approves before writing
271
-
272
- ## 9. Naming Conventions
273
-
274
- ### Files
275
-
276
- - Filename = `{slug}.md` (kebab-case)
277
- - Diary: `delta-YYYY-MM-DD-HHmm.md`
278
- - No spaces, no uppercase in filenames
279
-
280
- ### Slugs
281
-
282
- - kebab-case only: `my-analysis-topic`
283
- - Unique within directory
284
- - Descriptive but concise (3-5 words max)
285
-
286
- ### INDEX.md
287
-
288
- - Fixed size: ~15-20 lines
289
- - Domain list (entities/concepts headings)
290
- - Stats line: "N source, N analysis, N total"
291
- - Last 5 added (initially empty)
292
- - NO full file listing — discovery via FTS5
1
+ # Mindlore Schema
2
+
3
+ This file is the single source of truth for how the `.mindlore/` knowledge base works.
4
+ It is written for LLM agents — not humans. Every rule here must be followed exactly.
5
+
6
+ ## 1. Identity
7
+
8
+ Mindlore is an AI-native knowledge system. It stores, indexes, and evolves knowledge
9
+ across Claude Code sessions. Knowledge lives in `.mindlore/` as plain Markdown files
10
+ with YAML frontmatter. Search is powered by FTS5 (SQLite full-text search).
11
+
12
+ ## 2. Directory Structure
13
+
14
+ ```
15
+ .mindlore/
16
+ ├── raw/ # Immutable source captures (URL dumps, pasted text)
17
+ ├── sources/ # Processed source summaries (one per ingested source)
18
+ ├── domains/ # Topic wiki pages (entities + concepts)
19
+ ├── analyses/ # Large syntheses (200+ lines, 3+ sources)
20
+ ├── insights/ # Short Q&A writebacks (<200 lines, 1-2 sources)
21
+ ├── connections/ # Cross-cutting links between 2+ sources
22
+ ├── learnings/ # Persistent rules extracted from reflect (topic-based)
23
+ ├── diary/ # Session logs, delta files (delta-YYYY-MM-DD-HHmm.md)
24
+ ├── decisions/ # Decision records with context and rationale
25
+ ├── INDEX.md # Minimal navigation map (~15-20 lines, fixed size)
26
+ ├── SCHEMA.md # This file (copied from repo template)
27
+ ├── log.md # Operation log (append-only)
28
+ └── mindlore.db # FTS5 search database (SQLite)
29
+ ```
30
+
31
+ ### Global Scope (v0.3.3)
32
+
33
+ Mindlore uses a single global directory:
34
+ - **Global:** `~/.mindlore/` (or `$MINDLORE_HOME` if set)
35
+ - All projects share one DB; project namespace is stored in the `project` FTS5 column
36
+ - `project` = `path.basename(cwd)` at index/search time
37
+ - `npx mindlore init` always initializes `~/.mindlore/` with git repo for auto-sync
38
+ - Search defaults to current project; use `--all` flag to search all projects
39
+
40
+ ### Directory Rules
41
+
42
+ - Each directory corresponds to exactly one frontmatter `type` value
43
+ - `type: raw` → `raw/`, `type: source` → `sources/`, etc.
44
+ - Files MUST live in the directory matching their `type`
45
+ - The health check script validates this cross-reference
46
+
47
+ ## 3. Frontmatter
48
+
49
+ Every `.md` file in `.mindlore/` MUST have YAML frontmatter. Format:
50
+
51
+ ```yaml
52
+ ---
53
+ slug: kebab-case-unique-identifier
54
+ type: raw|source|domain|analysis|insight|connection|learning|decision|diary
55
+ title: Human-readable title
56
+ tags: [tag1, tag2]
57
+ ---
58
+ ```
59
+
60
+ ### Required Fields (all types)
61
+
62
+ | Field | Format | Rule |
63
+ |-------|--------|------|
64
+ | `slug` | kebab-case | Unique within directory. Used as filename: `{slug}.md` |
65
+ | `type` | enum | Must match the parent directory (see Section 2) |
66
+
67
+ ### Type-Specific Fields
68
+
69
+ | Type | Required Fields | Optional |
70
+ |------|----------------|----------|
71
+ | `raw` | slug, type, source_url | tags, description |
72
+ | `source` | slug, type, title, tags, quality, source_url, ingested | date_captured, description, raw_slug |
73
+ | `domain` | slug, type, title, tags | description, status |
74
+ | `analysis` | slug, type, title, tags, confidence, sources_used | description |
75
+ | `insight` | slug, type, title, tags | sources_used, description |
76
+ | `connection` | slug, type, title, tags | sources_used, description |
77
+ | `learning` | slug, type, title, tags | description |
78
+ | `decision` | slug, type, title, tags | supersedes, status, description |
79
+ | `diary` | slug, type, date | — (hook adds automatically) |
80
+
81
+ ### Field Value Rules
82
+
83
+ - `quality`: `high` | `medium` | `low`
84
+ - `confidence`: `high` | `medium` | `low` (how certain is this analysis)
85
+ - `ingested`: `true` | `false` (has this source been processed into domains)
86
+ - `sources_used`: list of slugs referenced in the analysis
87
+ - `supersedes`: slug of the decision this one replaces
88
+ - `date`: ISO 8601 date (YYYY-MM-DD)
89
+ - `description`: one-line summary (15-30 words). Used in FTS5 search and inject output. Optional but strongly recommended for search quality
90
+ - `raw_slug`: slug of the raw/ file this source was processed from (source→raw traceability)
91
+ - `status`: `stub` | `active` | `archived` (domain maturity indicator)
92
+
93
+ ## 4. Seven Operations
94
+
95
+ ### 4.1 Ingest (skill: /mindlore-ingest)
96
+
97
+ Add new knowledge. Flow: capture → raw/ → process → sources/ → update domains/ → FTS5.
98
+
99
+ - URL mode: markitdown CLI (if available) or WebFetch → raw/ → Sonnet summarizes → sources/
100
+ - Text mode: user paste → raw/ → summarize → sources/
101
+ - PDF mode: CC Read tool (max 20 pages/request) → raw/ → summarize → sources/
102
+ - **markitdown is NOT used for PDF** — quality is poor. Use CC Read tool or Marker/Chandra (v0.3+)
103
+
104
+ ### 4.2 Query (skill: /mindlore-query, v0.2 — PLANNED, not yet implemented)
105
+
106
+ Search and retrieve knowledge. Four modes:
107
+ - `search`: FTS5 keyword search, return top 3 matches with snippets
108
+ - `ask`: Natural language question → FTS5 → read relevant files → synthesize answer
109
+ - `stats`: Knowledge base statistics (counts by type, recent activity)
110
+ - `brief`: Quick context on a topic (read domain page if exists)
111
+
112
+ ### 4.3 Health (skill: /mindlore-health)
113
+
114
+ Run 16-point structural check:
115
+ - 9 directory existence checks
116
+ - SCHEMA.md parse validation
117
+ - INDEX.md format check (~15-20 lines)
118
+ - mindlore.db FTS5 integrity
119
+ - Orphan file detection (files not in FTS5)
120
+ - Frontmatter validation (type-directory cross-reference)
121
+
122
+ ### 4.4 Log (skill: /mindlore-log, v0.2 — PLANNED, not yet implemented)
123
+
124
+ Session logging with four modes:
125
+ - `log`: Write session/task record to diary/
126
+ - `reflect`: Scan old deltas, extract patterns, move to learnings/
127
+ - `status`: Recent N sessions summary, trends, open items
128
+ - `save`: Structured delta + log.md append + wiki update
129
+
130
+ ### 4.5 Decide (skill: /mindlore-decide, v0.2 — PLANNED, not yet implemented)
131
+
132
+ Record decisions with context, options considered, rationale, and outcome.
133
+ Supports `supersedes` chain for decision evolution.
134
+
135
+ ### 4.6 Evolve (skill: /mindlore-evolve, v0.3 — PLANNED, not yet implemented)
136
+
137
+ Schema co-evolution. Scan domains + sources, suggest structural updates.
138
+ Run monthly or after major changes.
139
+
140
+ ### 4.7 Explore (skill: /mindlore-explore, v0.3 — PLANNED, not yet implemented)
141
+
142
+ Discover unexpected connections between sources. Cross-reference analysis.
143
+
144
+ ## 5. Search Behavior
145
+
146
+ ### FTS5 Search (hooks + scripts)
147
+
148
+ - Database: `.mindlore/mindlore.db`
149
+ - Table: `mindlore_fts` — knowledge content (sources, domains, analyses, decisions, diary)
150
+ - Table: `mindlore_fts_sessions` — session content (cc-subagent, cc-session) — v0.6.1
151
+ - Dedup: `file_hashes` table with SHA256 content-hash + `table_target` column (v0.6.1)
152
+ - Tokenizer: `unicode61`
153
+ - Max results: 3 per query (BM25 ranking)
154
+ - Hook injects: file path + first 2 headings
155
+
156
+ ### FTS5 Columns (11-col schema, v0.3.3)
157
+
158
+ | Column | Indexed | Source |
159
+ |--------|---------|--------|
160
+ | `path` | UNINDEXED | File system path |
161
+ | `slug` | Yes | Frontmatter slug |
162
+ | `description` | Yes | Frontmatter description |
163
+ | `type` | UNINDEXED | Frontmatter type |
164
+ | `category` | Yes | Parent directory name |
165
+ | `title` | Yes | Frontmatter title or first heading |
166
+ | `content` | Yes | Markdown body (sans frontmatter) |
167
+ | `tags` | Yes | Frontmatter tags (comma-separated) |
168
+ | `quality` | UNINDEXED | Frontmatter quality (high/medium/low) |
169
+ | `date_captured` | UNINDEXED | Frontmatter date_captured or date |
170
+ | `project` | UNINDEXED | path.basename(cwd) at index time |
171
+
172
+ ### Search Flow (UserPromptSubmit hook)
173
+
174
+ 1. Extract keywords from user prompt
175
+ 2. Query FTS5 with BM25 ranking
176
+ 3. Return max 3 results as stdout additionalContext
177
+ 4. Agent reads full file only if needed (progressive disclosure)
178
+
179
+ ## 6. Wiki vs Diary (Writeback Target Rules)
180
+
181
+ Knowledge goes to one of two layers. The agent MUST pick the correct one.
182
+
183
+ ### Wiki Layer (permanent knowledge)
184
+
185
+ Directories: `sources/`, `domains/`, `analyses/`, `insights/`, `connections/`, `learnings/`
186
+
187
+ - Persists across sessions — reference value
188
+ - Indexed by FTS5, discoverable via search hook
189
+ - Updated by ingest, query writeback, reflect, evolve
190
+ - Content should be factual, sourced, and reusable
191
+
192
+ ### Diary Layer (session-scoped logs)
193
+
194
+ Directories: `diary/`, `decisions/`
195
+
196
+ - Session-specific: deltas, logs, decision snapshots
197
+ - diary/ entries get `archived: true` after reflect processes them
198
+ - decisions/ are permanent but session-originated (context + rationale)
199
+ - Patterns extracted from diary → moved to `learnings/` (wiki layer)
200
+
201
+ ### Selection Rule
202
+
203
+ | Content Type | Target | Example |
204
+ |-------------|--------|---------|
205
+ | Ingested source summary | `sources/` | URL or text summary |
206
+ | Topic wiki page | `domains/` | Consolidated knowledge on a subject |
207
+ | Multi-source synthesis | `analyses/` | Comparison table, architecture decision |
208
+ | Short Q&A answer | `insights/` | Query writeback (<200 lines) |
209
+ | Cross-reference finding | `connections/` | Link between 2+ unrelated sources |
210
+ | Persistent rule/lesson | `learnings/` | YAPMA/BEST PRACTICE from reflect |
211
+ | Session log/delta | `diary/` | What happened this session |
212
+ | Decision record | `decisions/` | Why X was chosen over Y |
213
+ | Raw capture | `raw/` | Immutable original (URL dump, paste) |
214
+
215
+ ### Anti-patterns
216
+
217
+ - Do NOT write session-specific notes to `insights/` — use `diary/`
218
+ - Do NOT write permanent rules to `diary/` — use `learnings/`
219
+ - Do NOT write decision rationale to `analyses/` — use `decisions/`
220
+
221
+ ## 7. Compounding
222
+
223
+ Knowledge compounds when outputs become inputs:
224
+
225
+ ```
226
+ Query answer → writeback to insights/ → FTS5 indexes → next query finds it
227
+ Reflect → patterns to learnings/ → session-focus injects → agent applies
228
+ ```
229
+
230
+ ### Writeback Triggers
231
+
232
+ Offer to save when:
233
+ - Comparison table generated (X vs Y)
234
+ - Architectural decision or evaluation made
235
+ - 3+ sources synthesized
236
+ - User says "save this" or "remember this"
237
+
238
+ ### Writeback Rules
239
+
240
+ - Short answer (<200 lines) → insights/
241
+ - Large synthesis (200+ lines, 3+ sources) → analyses/
242
+ - Cross-cutting link → connections/
243
+
244
+ ## 8. Learnings
245
+
246
+ Persistent rules extracted from reflect operations.
247
+ Organized by topic: `git.md`, `testing.md`, `security.md`, etc.
248
+
249
+ ### Format
250
+
251
+ ```markdown
252
+ ---
253
+ slug: testing
254
+ type: learning
255
+ title: Testing Learnings
256
+ tags: [testing, jest, mock]
257
+ ---
258
+
259
+ # Testing Learnings
260
+
261
+ - YAPMA: Error handling testinde mock'u dolayli tetikleme
262
+ - BEST PRACTICE: Side-effect'li moduller eklerken TUM test'lerde mock ekle
263
+ ```
264
+
265
+ ### Rules
266
+
267
+ - One file per topic (not per lesson)
268
+ - Append new learnings to existing topic file
269
+ - Use `YAPMA:` / `BEST PRACTICE:` / `KRITIK:` prefixes
270
+ - Reflect skill proposes, user approves before writing
271
+
272
+ ## 9. Naming Conventions
273
+
274
+ ### Files
275
+
276
+ - Filename = `{slug}.md` (kebab-case)
277
+ - Diary: `delta-YYYY-MM-DD-HHmm.md`
278
+ - No spaces, no uppercase in filenames
279
+
280
+ ### Slugs
281
+
282
+ - kebab-case only: `my-analysis-topic`
283
+ - Unique within directory
284
+ - Descriptive but concise (3-5 words max)
285
+
286
+ ### INDEX.md
287
+
288
+ - Fixed size: ~15-20 lines
289
+ - Domain list (entities/concepts headings)
290
+ - Stats line: "N source, N analysis, N total"
291
+ - Last 5 added (initially empty)
292
+ - NO full file listing — discovery via FTS5
@@ -1 +1 @@
1
- {"version":3,"file":"cc-memory-bulk-sync.d.ts","sourceRoot":"","sources":["../../scripts/cc-memory-bulk-sync.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAaH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAkCjE;AAkBD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,MAAM,GAClB,UAAU,CAmFZ"}
1
+ {"version":3,"file":"cc-memory-bulk-sync.d.ts","sourceRoot":"","sources":["../../scripts/cc-memory-bulk-sync.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAaH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAkCjE;AAkBD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,MAAM,GAClB,UAAU,CAoGZ"}