mindlore 0.2.0 → 0.3.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 (153) hide show
  1. package/README.md +15 -9
  2. package/SCHEMA.md +15 -2
  3. package/dist/scripts/init.d.ts +10 -0
  4. package/dist/scripts/init.d.ts.map +1 -0
  5. package/dist/scripts/init.js +406 -0
  6. package/dist/scripts/init.js.map +1 -0
  7. package/dist/scripts/lib/constants.d.ts +56 -0
  8. package/dist/scripts/lib/constants.d.ts.map +1 -0
  9. package/dist/scripts/lib/constants.js +131 -0
  10. package/dist/scripts/lib/constants.js.map +1 -0
  11. package/dist/scripts/lib/schemas.d.ts +93 -0
  12. package/dist/scripts/lib/schemas.d.ts.map +1 -0
  13. package/dist/scripts/lib/schemas.js +108 -0
  14. package/dist/scripts/lib/schemas.js.map +1 -0
  15. package/dist/scripts/mindlore-fts5-index.d.ts +9 -0
  16. package/dist/scripts/mindlore-fts5-index.d.ts.map +1 -0
  17. package/dist/scripts/mindlore-fts5-index.js +88 -0
  18. package/dist/scripts/mindlore-fts5-index.js.map +1 -0
  19. package/dist/scripts/mindlore-fts5-search.d.ts +10 -0
  20. package/dist/scripts/mindlore-fts5-search.d.ts.map +1 -0
  21. package/dist/scripts/mindlore-fts5-search.js +121 -0
  22. package/dist/scripts/mindlore-fts5-search.js.map +1 -0
  23. package/dist/scripts/mindlore-health-check.d.ts +10 -0
  24. package/dist/scripts/mindlore-health-check.d.ts.map +1 -0
  25. package/dist/scripts/mindlore-health-check.js +337 -0
  26. package/dist/scripts/mindlore-health-check.js.map +1 -0
  27. package/dist/scripts/uninstall.d.ts +10 -0
  28. package/dist/scripts/uninstall.d.ts.map +1 -0
  29. package/dist/scripts/uninstall.js +153 -0
  30. package/dist/scripts/uninstall.js.map +1 -0
  31. package/dist/tests/compounding.test.d.ts +8 -0
  32. package/dist/tests/compounding.test.d.ts.map +1 -0
  33. package/dist/tests/compounding.test.js +51 -0
  34. package/dist/tests/compounding.test.js.map +1 -0
  35. package/dist/tests/cwd-changed.test.d.ts +2 -0
  36. package/dist/tests/cwd-changed.test.d.ts.map +1 -0
  37. package/dist/tests/cwd-changed.test.js +62 -0
  38. package/dist/tests/cwd-changed.test.js.map +1 -0
  39. package/dist/tests/decision.test.d.ts +2 -0
  40. package/dist/tests/decision.test.d.ts.map +1 -0
  41. package/dist/tests/decision.test.js +61 -0
  42. package/dist/tests/decision.test.js.map +1 -0
  43. package/dist/tests/dedup.test.d.ts +2 -0
  44. package/dist/tests/dedup.test.d.ts.map +1 -0
  45. package/dist/tests/dedup.test.js +74 -0
  46. package/dist/tests/dedup.test.js.map +1 -0
  47. package/dist/tests/dont-repeat.test.d.ts +2 -0
  48. package/dist/tests/dont-repeat.test.d.ts.map +1 -0
  49. package/dist/tests/dont-repeat.test.js +100 -0
  50. package/dist/tests/dont-repeat.test.js.map +1 -0
  51. package/dist/tests/e2e-pipeline.test.d.ts +2 -0
  52. package/dist/tests/e2e-pipeline.test.d.ts.map +1 -0
  53. package/dist/tests/e2e-pipeline.test.js +220 -0
  54. package/dist/tests/e2e-pipeline.test.js.map +1 -0
  55. package/dist/tests/evolve.test.d.ts +2 -0
  56. package/dist/tests/evolve.test.d.ts.map +1 -0
  57. package/dist/tests/evolve.test.js +105 -0
  58. package/dist/tests/evolve.test.js.map +1 -0
  59. package/dist/tests/explore.test.d.ts +2 -0
  60. package/dist/tests/explore.test.d.ts.map +1 -0
  61. package/dist/tests/explore.test.js +146 -0
  62. package/dist/tests/explore.test.js.map +1 -0
  63. package/dist/tests/frontmatter.test.d.ts +2 -0
  64. package/dist/tests/frontmatter.test.d.ts.map +1 -0
  65. package/dist/tests/frontmatter.test.js +90 -0
  66. package/dist/tests/frontmatter.test.js.map +1 -0
  67. package/dist/tests/fts5.test.d.ts +2 -0
  68. package/dist/tests/fts5.test.d.ts.map +1 -0
  69. package/dist/tests/fts5.test.js +95 -0
  70. package/dist/tests/fts5.test.js.map +1 -0
  71. package/dist/tests/global-layer.test.d.ts +2 -0
  72. package/dist/tests/global-layer.test.d.ts.map +1 -0
  73. package/dist/tests/global-layer.test.js +152 -0
  74. package/dist/tests/global-layer.test.js.map +1 -0
  75. package/dist/tests/helpers/db.d.ts +20 -0
  76. package/dist/tests/helpers/db.d.ts.map +1 -0
  77. package/dist/tests/helpers/db.js +46 -0
  78. package/dist/tests/helpers/db.js.map +1 -0
  79. package/dist/tests/hook-smoke.test.d.ts +2 -0
  80. package/dist/tests/hook-smoke.test.d.ts.map +1 -0
  81. package/dist/tests/hook-smoke.test.js +58 -0
  82. package/dist/tests/hook-smoke.test.js.map +1 -0
  83. package/dist/tests/init.test.d.ts +2 -0
  84. package/dist/tests/init.test.d.ts.map +1 -0
  85. package/dist/tests/init.test.js +109 -0
  86. package/dist/tests/init.test.js.map +1 -0
  87. package/dist/tests/log.test.d.ts +2 -0
  88. package/dist/tests/log.test.d.ts.map +1 -0
  89. package/dist/tests/log.test.js +68 -0
  90. package/dist/tests/log.test.js.map +1 -0
  91. package/dist/tests/post-read.test.d.ts +2 -0
  92. package/dist/tests/post-read.test.d.ts.map +1 -0
  93. package/dist/tests/post-read.test.js +69 -0
  94. package/dist/tests/post-read.test.js.map +1 -0
  95. package/dist/tests/quality-populate.test.d.ts +2 -0
  96. package/dist/tests/quality-populate.test.d.ts.map +1 -0
  97. package/dist/tests/quality-populate.test.js +85 -0
  98. package/dist/tests/quality-populate.test.js.map +1 -0
  99. package/dist/tests/read-guard.test.d.ts +2 -0
  100. package/dist/tests/read-guard.test.d.ts.map +1 -0
  101. package/dist/tests/read-guard.test.js +69 -0
  102. package/dist/tests/read-guard.test.js.map +1 -0
  103. package/dist/tests/reflect.test.d.ts +2 -0
  104. package/dist/tests/reflect.test.d.ts.map +1 -0
  105. package/dist/tests/reflect.test.js +122 -0
  106. package/dist/tests/reflect.test.js.map +1 -0
  107. package/dist/tests/schemas.test.d.ts +2 -0
  108. package/dist/tests/schemas.test.d.ts.map +1 -0
  109. package/dist/tests/schemas.test.js +87 -0
  110. package/dist/tests/schemas.test.js.map +1 -0
  111. package/dist/tests/search-hook.test.d.ts +2 -0
  112. package/dist/tests/search-hook.test.d.ts.map +1 -0
  113. package/dist/tests/search-hook.test.js +108 -0
  114. package/dist/tests/search-hook.test.js.map +1 -0
  115. package/dist/tests/session-focus.test.d.ts +2 -0
  116. package/dist/tests/session-focus.test.d.ts.map +1 -0
  117. package/dist/tests/session-focus.test.js +71 -0
  118. package/dist/tests/session-focus.test.js.map +1 -0
  119. package/dist/tests/uninstall.test.d.ts +2 -0
  120. package/dist/tests/uninstall.test.d.ts.map +1 -0
  121. package/dist/tests/uninstall.test.js +98 -0
  122. package/dist/tests/uninstall.test.js.map +1 -0
  123. package/dist/tests/upgrade.test.d.ts +2 -0
  124. package/dist/tests/upgrade.test.d.ts.map +1 -0
  125. package/dist/tests/upgrade.test.js +91 -0
  126. package/dist/tests/upgrade.test.js.map +1 -0
  127. package/hooks/lib/mindlore-common.cjs +66 -5
  128. package/hooks/lib/types.d.ts +56 -0
  129. package/hooks/mindlore-cwd-changed.cjs +57 -0
  130. package/hooks/mindlore-dont-repeat.cjs +222 -0
  131. package/hooks/mindlore-fts5-sync.cjs +6 -9
  132. package/hooks/mindlore-index.cjs +3 -3
  133. package/hooks/mindlore-post-read.cjs +97 -0
  134. package/hooks/mindlore-read-guard.cjs +27 -4
  135. package/hooks/mindlore-search.cjs +73 -52
  136. package/hooks/mindlore-session-end.cjs +43 -1
  137. package/hooks/mindlore-session-focus.cjs +14 -0
  138. package/package.json +21 -8
  139. package/plugin.json +24 -1
  140. package/skills/mindlore-decide/SKILL.md +8 -0
  141. package/skills/mindlore-evolve/SKILL.md +81 -0
  142. package/skills/mindlore-explore/SKILL.md +84 -0
  143. package/skills/mindlore-health/SKILL.md +8 -0
  144. package/skills/mindlore-ingest/SKILL.md +19 -4
  145. package/skills/mindlore-log/SKILL.md +30 -13
  146. package/skills/mindlore-query/SKILL.md +8 -0
  147. package/templates/SCHEMA.md +15 -2
  148. package/scripts/init.cjs +0 -448
  149. package/scripts/lib/constants.cjs +0 -49
  150. package/scripts/mindlore-fts5-index.cjs +0 -112
  151. package/scripts/mindlore-fts5-search.cjs +0 -119
  152. package/scripts/mindlore-health-check.cjs +0 -389
  153. package/scripts/uninstall.cjs +0 -186
@@ -34,6 +34,20 @@ function main() {
34
34
  output.push(`[Mindlore Delta: ${deltaName}]\n${deltaContent}`);
35
35
  }
36
36
 
37
+ // Version check: compare .version (installed) vs .pkg-version (package)
38
+ // Both are flat strings written by init — no JSON parse needed on session start
39
+ const versionPath = path.join(baseDir, '.version');
40
+ const pkgVersionPath = path.join(baseDir, '.pkg-version');
41
+ try {
42
+ if (fs.existsSync(versionPath) && fs.existsSync(pkgVersionPath)) {
43
+ const installed = fs.readFileSync(versionPath, 'utf8').trim();
44
+ const pkgVersion = fs.readFileSync(pkgVersionPath, 'utf8').trim();
45
+ if (pkgVersion && pkgVersion !== installed) {
46
+ output.push(`[Mindlore: Guncelleme mevcut (${installed} → ${pkgVersion}). \`npx mindlore init\` calistirin.]`);
47
+ }
48
+ }
49
+ } catch (_err) { /* skip */ }
50
+
37
51
  if (output.length > 0) {
38
52
  process.stdout.write(output.join('\n\n') + '\n');
39
53
  }
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "mindlore",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "AI-native knowledge system for Claude Code",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
- "mindlore": "scripts/init.cjs"
7
+ "mindlore": "dist/scripts/init.js"
8
8
  },
9
9
  "scripts": {
10
+ "build": "tsc",
11
+ "prebuild": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
12
+ "pretest": "npm run build",
10
13
  "test": "jest --config jest.config.cjs",
11
14
  "lint": "eslint -c eslint.config.cjs scripts/ hooks/ tests/",
12
- "health": "node scripts/mindlore-health-check.cjs",
13
- "index": "node scripts/mindlore-fts5-index.cjs",
14
- "search": "node scripts/mindlore-fts5-search.cjs"
15
+ "typecheck": "tsc --noEmit",
16
+ "prepublishOnly": "npm run build",
17
+ "health": "node dist/scripts/mindlore-health-check.js",
18
+ "index": "node dist/scripts/mindlore-fts5-index.js",
19
+ "search": "node dist/scripts/mindlore-fts5-search.js"
15
20
  },
16
21
  "keywords": [
17
22
  "claude-code",
@@ -37,15 +42,23 @@
37
42
  "node": ">=20.0.0"
38
43
  },
39
44
  "dependencies": {
40
- "better-sqlite3": "^11.0.0"
45
+ "better-sqlite3": "^11.0.0",
46
+ "zod": "^4.3.6"
41
47
  },
42
48
  "devDependencies": {
49
+ "@types/better-sqlite3": "^7.6.13",
50
+ "@types/jest": "^30.0.0",
51
+ "@types/node": "^25.6.0",
52
+ "@typescript-eslint/eslint-plugin": "^8.58.1",
53
+ "@typescript-eslint/parser": "^8.58.1",
43
54
  "eslint": "^9.0.0",
55
+ "globals": "^15.0.0",
44
56
  "jest": "^29.7.0",
45
- "globals": "^15.0.0"
57
+ "ts-jest": "^29.4.9",
58
+ "typescript": "^6.0.2"
46
59
  },
47
60
  "files": [
48
- "scripts/",
61
+ "dist/",
49
62
  "hooks/",
50
63
  "skills/",
51
64
  "templates/",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mindlore",
3
3
  "description": "AI-native knowledge system for Claude Code. Persistent, searchable, evolving knowledge base with FTS5.",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "skills": [
6
6
  {
7
7
  "name": "mindlore-ingest",
@@ -27,6 +27,16 @@
27
27
  "name": "mindlore-decide",
28
28
  "path": "skills/mindlore-decide/SKILL.md",
29
29
  "description": "Record and list decisions with context, alternatives, rationale"
30
+ },
31
+ {
32
+ "name": "mindlore-evolve",
33
+ "path": "skills/mindlore-evolve/SKILL.md",
34
+ "description": "Knowledge schema co-evolution — scan domains+sources, suggest updates"
35
+ },
36
+ {
37
+ "name": "mindlore-explore",
38
+ "path": "skills/mindlore-explore/SKILL.md",
39
+ "description": "Discover unexpected connections between knowledge sources"
30
40
  }
31
41
  ],
32
42
  "hooks": [
@@ -66,6 +76,19 @@
66
76
  "event": "PreToolUse",
67
77
  "script": "hooks/mindlore-read-guard.cjs",
68
78
  "if": "Read"
79
+ },
80
+ {
81
+ "event": "CwdChanged",
82
+ "script": "hooks/mindlore-cwd-changed.cjs"
83
+ },
84
+ {
85
+ "event": "PostToolUse",
86
+ "script": "hooks/mindlore-post-read.cjs"
87
+ },
88
+ {
89
+ "event": "PreToolUse",
90
+ "script": "hooks/mindlore-dont-repeat.cjs",
91
+ "if": "Write|Edit"
69
92
  }
70
93
  ]
71
94
  }
@@ -2,6 +2,14 @@
2
2
 
3
3
  Record and list decisions in the `.mindlore/decisions/` directory.
4
4
 
5
+ ## Scope
6
+
7
+ Determine target using `getActiveMindloreDir()` logic:
8
+ - If CWD has `.mindlore/` → write to project scope
9
+ - Otherwise → write to global `~/.mindlore/`
10
+ - List mode: shows decisions from active scope (use `--all` for both)
11
+ - Never hardcode `.mindlore/` path — always resolve dynamically
12
+
5
13
  ## Trigger
6
14
 
7
15
  User says `/mindlore-decide record` or `/mindlore-decide list`.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: mindlore-evolve
3
+ description: Knowledge schema co-evolution — scan domains+sources, detect inconsistencies, suggest updates
4
+ effort: medium
5
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
6
+ ---
7
+
8
+ # /mindlore-evolve
9
+
10
+ Knowledge schema co-evolution. Karpathy's 4th operation (ingest/query/health/**evolve**).
11
+
12
+ ## Scope
13
+
14
+ Determine target using `getActiveMindloreDir()` logic:
15
+ - Default (no flag): scan project `.mindlore/`
16
+ - `--global`: scan `~/.mindlore/`
17
+ - Never hardcode `.mindlore/` path — always resolve dynamically
18
+
19
+ ## Trigger
20
+
21
+ User says `/mindlore-evolve`, "knowledge evolve", "bilgi sistemi evrimle", "sema guncelle".
22
+
23
+ ## Modes
24
+
25
+ ### scan (default)
26
+
27
+ Scan all domains and sources for inconsistencies.
28
+
29
+ **Flow:**
30
+ 1. Read INDEX.md to get domain and source file lists
31
+ 2. Read all domain files (from `domains/`)
32
+ 3. Read all source files (from `sources/`)
33
+ 4. Detect issues:
34
+ - **Orphan files:** .md files in content directories not listed in INDEX.md
35
+ - **Missing references:** Source exists but no domain mentions it
36
+ - **Stale domains:** Source updated more recently than referencing domain
37
+ - **Tag inconsistencies:** Tags in frontmatter don't match content
38
+ - **Missing cross-references:** Related sources not linked
39
+ 5. Report findings as a table:
40
+
41
+ ```
42
+ | # | Type | File | Issue | Suggested Fix |
43
+ |---|------|------|-------|---------------|
44
+ | 1 | orphan | sources/old.md | Not in INDEX.md | Add to INDEX or delete |
45
+ | 2 | missing-ref | sources/react-hooks.md | No domain reference | Add to domains/frontend.md |
46
+ ```
47
+
48
+ 6. If `--dry-run`: stop here, no change suggestions
49
+
50
+ ### apply
51
+
52
+ Apply suggested changes with user approval.
53
+
54
+ **Flow:**
55
+ 1. Run scan first (reuse findings)
56
+ 2. For each finding, show proposed change (diff format)
57
+ 3. Wait for user approval before each change
58
+ 4. Apply approved changes
59
+ 5. Update INDEX.md with new entries
60
+ 6. Append EVOLVE entry to log.md
61
+ 7. Max 2 domain updates per run (prevent scope creep)
62
+
63
+ **Rules:**
64
+ - NEVER make automatic changes — always require user approval
65
+ - Show diff preview before applying
66
+ - After changes, run `node dist/scripts/mindlore-fts5-index.js` for FTS5 sync
67
+ - Log every change to log.md with timestamp
68
+
69
+ ## Output Format
70
+
71
+ ```
72
+ Mindlore Evolve — Scan Results
73
+
74
+ Scope: project (.mindlore/)
75
+ Files scanned: 12 sources, 5 domains
76
+ Issues found: 3
77
+
78
+ [table of findings]
79
+
80
+ Run `/mindlore-evolve apply` to fix with approval.
81
+ ```
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: mindlore-explore
3
+ description: Discover unexpected connections between sources — undirected knowledge exploration
4
+ effort: medium
5
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
6
+ ---
7
+
8
+ # /mindlore-explore
9
+
10
+ Discover unexpected connections between knowledge sources. Undirected exploration — unlike query (directed search).
11
+
12
+ ## Scope
13
+
14
+ Determine target using `getActiveMindloreDir()` logic:
15
+ - Default (no flag): explore project `.mindlore/`
16
+ - `--global`: explore `~/.mindlore/` + project cross-reference (most valuable mode)
17
+ - Never hardcode `.mindlore/` path — always resolve dynamically
18
+
19
+ ## Trigger
20
+
21
+ User says `/mindlore-explore`, "knowledge explore", "baglanti kesfet", "cross-reference bul".
22
+
23
+ ## Flow
24
+
25
+ 1. Read all source and domain files from active scope
26
+ 2. Cross-match by tag + content:
27
+ - Files sharing tags but not referencing each other
28
+ - Sources covering similar topics from different angles
29
+ - Sources that could bridge between domains
30
+ 3. Rank connections by strength:
31
+ - **high**: 3+ shared tags + content overlap
32
+ - **medium**: 2 shared tags or significant content similarity
33
+ - **low**: 1 shared tag + weak content match
34
+ 4. Show findings to user
35
+ 5. On approval, write to `connections/` directory
36
+
37
+ ## Connection File Format
38
+
39
+ Written to `connections/` with frontmatter:
40
+
41
+ ```markdown
42
+ ---
43
+ type: connection
44
+ slug: connection-source-a-source-b
45
+ date_created: 2026-04-12
46
+ sources: [source-a.md, source-b.md]
47
+ domains: [domain-x.md]
48
+ strength: high
49
+ tags: [shared-tag-1, shared-tag-2]
50
+ ---
51
+
52
+ ## Connection
53
+
54
+ [Why these sources are related — LLM explanation]
55
+
56
+ ## Action Suggestion
57
+
58
+ [What could be done — domain update, new analysis, etc.]
59
+ ```
60
+
61
+ ## Rules
62
+
63
+ - Check for duplicate connections before writing (same source pair)
64
+ - Show findings before writing — user approval required
65
+ - Update INDEX.md with new connections entry
66
+ - Append EXPLORE entry to log.md
67
+ - Strength is LLM-assessed based on tag overlap + content similarity
68
+
69
+ ## Output Format
70
+
71
+ ```
72
+ Mindlore Explore — Discovered Connections
73
+
74
+ Scope: project (.mindlore/)
75
+ Sources scanned: 12
76
+ Connections found: 3 (2 new, 1 existing)
77
+
78
+ | # | Sources | Strength | Why |
79
+ |---|---------|----------|-----|
80
+ | 1 | react-hooks.md + agent-orchestration.md | medium | Both discuss state management patterns |
81
+ | 2 | karpathy-kb.md + search-retrieval.md | high | FTS5 + knowledge architecture overlap |
82
+
83
+ Write connections? (y/n)
84
+ ```
@@ -9,6 +9,14 @@ allowed-tools: [Bash, Read]
9
9
 
10
10
  Run the 16-point structural health check on the `.mindlore/` knowledge base.
11
11
 
12
+ ## Scope
13
+
14
+ Determine target using `getActiveMindloreDir()` logic:
15
+ - Default (no flag): check project `.mindlore/`, fall back to global
16
+ - `--global`: check only `~/.mindlore/`
17
+ - `--all`: check both project + global scopes, report each separately
18
+ - Never hardcode `.mindlore/` path — always resolve dynamically
19
+
12
20
  ## Trigger
13
21
 
14
22
  User says "health check", "mindlore health", "bilgi sistemi kontrol", "saglik kontrolu".
@@ -9,6 +9,14 @@ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch]
9
9
 
10
10
  Add a new knowledge source to the `.mindlore/` knowledge base.
11
11
 
12
+ ## Scope
13
+
14
+ Determine target directory using `getActiveMindloreDir()` logic:
15
+ - If CWD has `.mindlore/` → write to project scope
16
+ - Otherwise → write to global `~/.mindlore/`
17
+ - `--global` flag: force write to `~/.mindlore/` even if project scope exists
18
+ - Never hardcode `.mindlore/` path — always resolve dynamically
19
+
12
20
  ## Trigger
13
21
 
14
22
  User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki kaydet", "knowledge ingest".
@@ -17,8 +25,12 @@ User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki
17
25
 
18
26
  ### URL Mode
19
27
  1. Extract content from URL:
20
- - If `markitdown` is available: `markitdown <url>` (best quality, zero tokens)
28
+ - If `markitdown` is available (`hasMarkitdown()`): `markitdown <url>` (best quality, zero tokens)
21
29
  - Else: use `WebFetch` or `ctx_fetch_and_index`
30
+ - **YouTube URL** detected (`youtube.com` or `youtu.be`):
31
+ 1. markitdown installed → `markitdown <url>` (includes transcript)
32
+ 2. Else youtube-transcript npm → `hasYoutubeTranscript()` check
33
+ 3. Else → ask user to paste transcript manually
22
34
  2. Save raw capture to `.mindlore/raw/` with frontmatter:
23
35
  ```yaml
24
36
  ---
@@ -75,9 +87,12 @@ The sources/ file should contain:
75
87
 
76
88
  ## Quality Assessment
77
89
 
78
- - `high`: Primary source, authoritative, detailed, directly relevant
79
- - `medium`: Useful but secondary, partial coverage, or tangentially relevant
80
- - `low`: Reference only, outdated, or low signal-to-noise
90
+ Assign quality automatically during ingest using this heuristic:
91
+ - `high`: Official docs (anthropic, github docs, MDN), primary research, authoritative references
92
+ - `medium`: Blog posts, tutorials, conference talks, X threads with substance
93
+ - `low`: Raw notes, text pastes, quick captures, low signal-to-noise
94
+
95
+ LLM may override the heuristic based on content analysis. Always set quality — never leave it null.
81
96
 
82
97
  ## Domain Update Rules
83
98
 
@@ -2,6 +2,14 @@
2
2
 
3
3
  Session logging, pattern extraction, and wiki updates.
4
4
 
5
+ ## Scope
6
+
7
+ Determine target using `getActiveMindloreDir()` logic:
8
+ - If CWD has `.mindlore/` → write to project scope
9
+ - Otherwise → write to global `~/.mindlore/`
10
+ - Reflect mode: scans both project + global diary/ for patterns
11
+ - Never hardcode `.mindlore/` path — always resolve dynamically
12
+
5
13
  ## Trigger
6
14
 
7
15
  `/mindlore-log <mode>` where mode is `log`, `reflect`, `status`, or `save`.
@@ -30,19 +38,28 @@ date: 2026-04-11
30
38
 
31
39
  ### reflect
32
40
 
33
- Scan old deltas, extract patterns, write to learnings/.
34
-
35
- **Flow (v0.2basic):**
36
- 1. Read all non-archived delta files in `diary/` (no `archived: true` frontmatter)
37
- 2. Present summary to user: "Found N unprocessed deltas spanning DATE1 to DATE2"
38
- 3. For each delta, extract: repeated topics, recurring decisions, common file changes
39
- 4. Propose learnings to user: "I found these patterns: ..."
40
- 5. User approves → write to `learnings/{topic}.md` (append if exists, create if not)
41
- 6. Format: `YAPMA:` / `BEST PRACTICE:` / `KRITIK:` prefixed rules
42
- 7. Mark processed deltas: add `archived: true` to their frontmatter
43
- 8. Append to `log.md`: `| {date} | reflect | {N} deltas processed, {M} learnings written |`
44
-
45
- **Important:** Do NOT auto-extract patterns. Present findings, user approves. This is v0.2 basic mode automated pattern extraction deferred to v0.2.1.
41
+ LLM-driven pattern extraction from diary deltas persistent learnings.
42
+
43
+ **Flow (v0.3LLM-driven):**
44
+ 1. Read last N non-archived delta files in `diary/` (no `archived: true` frontmatter)
45
+ 2. Present summary: "Found N unprocessed deltas spanning DATE1 to DATE2"
46
+ 3. LLM analyzes deltas for repeating patterns:
47
+ - Recurring topics/themes across sessions
48
+ - Repeated decisions (same choice made multiple times)
49
+ - Common mistakes or friction points
50
+ - Workflow patterns that worked well
51
+ 4. Categorize found patterns by topic (git, testing, architecture, etc.)
52
+ 5. Present findings to user with proposed learnings
53
+ 6. User approves write to `learnings/{topic}.md` (append if exists, create if not)
54
+ 7. Format: `YAPMA:` / `BEST PRACTICE:` / `KRITIK:` prefixed rules
55
+ 8. Update relevant domain page if pattern relates to an existing domain
56
+ 9. Mark processed deltas: add `archived: true` to their frontmatter
57
+ 10. Append to `log.md`: `| {date} | reflect | {N} deltas processed, {M} learnings written |`
58
+
59
+ **Rules:**
60
+ - NEVER write learnings without user approval
61
+ - Group related patterns into existing topic files (don't create one file per pattern)
62
+ - Reflect scans both project + global diary/ in `--all` mode
46
63
 
47
64
  ### status
48
65
 
@@ -2,6 +2,14 @@
2
2
 
3
3
  Search, ask, analyze, and retrieve knowledge from `.mindlore/`.
4
4
 
5
+ ## Scope
6
+
7
+ Determine search scope using `getActiveMindloreDir()` / `getAllDbs()` logic:
8
+ - Default (no flag): search project `.mindlore/` DB, fall back to global
9
+ - `--global`: search only `~/.mindlore/` DB
10
+ - `--all`: search both project + global DBs, project results first
11
+ - Never hardcode `.mindlore/` path — always resolve dynamically
12
+
5
13
  ## Trigger
6
14
 
7
15
  `/mindlore-query <mode> [query]` where mode is `search`, `ask`, `stats`, or `brief`.
@@ -28,6 +28,18 @@ with YAML frontmatter. Search is powered by FTS5 (SQLite full-text search).
28
28
  └── mindlore.db # FTS5 search database (SQLite)
29
29
  ```
30
30
 
31
+ ### Global Scope (v0.3)
32
+
33
+ Mindlore supports two scopes:
34
+ - **Project scope:** `.mindlore/` in the current working directory (project-specific knowledge)
35
+ - **Global scope:** `~/.mindlore/` in the user's home directory (cross-project knowledge)
36
+
37
+ Rules:
38
+ - `getActiveMindloreDir()` resolves scope: project if exists, otherwise global
39
+ - Search is layered: project results first, global results second
40
+ - Skills accept `--global` (force global) and `--all` (both scopes) flags
41
+ - `npx mindlore init --global` creates `~/.mindlore/` with git repo for auto-sync
42
+
31
43
  ### Directory Rules
32
44
 
33
45
  - Each directory corresponds to exactly one frontmatter `type` value
@@ -143,7 +155,7 @@ Discover unexpected connections between sources. Cross-reference analysis.
143
155
  - Max results: 3 per query (BM25 ranking)
144
156
  - Hook injects: file path + first 2 headings
145
157
 
146
- ### FTS5 Columns (9-col schema, v0.2)
158
+ ### FTS5 Columns (10-col schema, v0.3)
147
159
 
148
160
  | Column | Indexed | Source |
149
161
  |--------|---------|--------|
@@ -155,7 +167,8 @@ Discover unexpected connections between sources. Cross-reference analysis.
155
167
  | `title` | Yes | Frontmatter title or first heading |
156
168
  | `content` | Yes | Markdown body (sans frontmatter) |
157
169
  | `tags` | Yes | Frontmatter tags (comma-separated) |
158
- | `quality` | UNINDEXED | Frontmatter quality (NULL until 50+ sources) |
170
+ | `quality` | UNINDEXED | Frontmatter quality (high/medium/low) |
171
+ | `date_captured` | UNINDEXED | Frontmatter date_captured or date |
159
172
 
160
173
  ### Search Flow (UserPromptSubmit hook)
161
174