mindlore 0.2.1 → 0.3.1

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 (112) hide show
  1. package/README.md +14 -11
  2. package/SCHEMA.md +15 -2
  3. package/dist/scripts/init.d.ts +1 -1
  4. package/dist/scripts/init.js +133 -68
  5. package/dist/scripts/init.js.map +1 -1
  6. package/dist/scripts/lib/constants.d.ts +34 -0
  7. package/dist/scripts/lib/constants.d.ts.map +1 -1
  8. package/dist/scripts/lib/constants.js +95 -1
  9. package/dist/scripts/lib/constants.js.map +1 -1
  10. package/dist/scripts/lib/schemas.d.ts +93 -0
  11. package/dist/scripts/lib/schemas.d.ts.map +1 -0
  12. package/dist/scripts/lib/schemas.js +108 -0
  13. package/dist/scripts/lib/schemas.js.map +1 -0
  14. package/dist/scripts/mindlore-fts5-index.js +3 -4
  15. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  16. package/dist/scripts/mindlore-fts5-search.d.ts +1 -1
  17. package/dist/scripts/mindlore-fts5-search.js +87 -74
  18. package/dist/scripts/mindlore-fts5-search.js.map +1 -1
  19. package/dist/scripts/quality-populate.d.ts +11 -0
  20. package/dist/scripts/quality-populate.d.ts.map +1 -0
  21. package/dist/scripts/quality-populate.js +86 -0
  22. package/dist/scripts/quality-populate.js.map +1 -0
  23. package/dist/scripts/uninstall.d.ts +1 -1
  24. package/dist/scripts/uninstall.js +27 -17
  25. package/dist/scripts/uninstall.js.map +1 -1
  26. package/dist/tests/compounding.test.js +2 -2
  27. package/dist/tests/compounding.test.js.map +1 -1
  28. package/dist/tests/cwd-changed.test.d.ts +2 -0
  29. package/dist/tests/cwd-changed.test.d.ts.map +1 -0
  30. package/dist/tests/cwd-changed.test.js +62 -0
  31. package/dist/tests/cwd-changed.test.js.map +1 -0
  32. package/dist/tests/dedup.test.js +4 -4
  33. package/dist/tests/dedup.test.js.map +1 -1
  34. package/dist/tests/dont-repeat.test.d.ts +2 -0
  35. package/dist/tests/dont-repeat.test.d.ts.map +1 -0
  36. package/dist/tests/dont-repeat.test.js +100 -0
  37. package/dist/tests/dont-repeat.test.js.map +1 -0
  38. package/dist/tests/e2e-pipeline.test.d.ts +2 -0
  39. package/dist/tests/e2e-pipeline.test.d.ts.map +1 -0
  40. package/dist/tests/e2e-pipeline.test.js +220 -0
  41. package/dist/tests/e2e-pipeline.test.js.map +1 -0
  42. package/dist/tests/evolve.test.d.ts +2 -0
  43. package/dist/tests/evolve.test.d.ts.map +1 -0
  44. package/dist/tests/evolve.test.js +105 -0
  45. package/dist/tests/evolve.test.js.map +1 -0
  46. package/dist/tests/explore.test.d.ts +2 -0
  47. package/dist/tests/explore.test.d.ts.map +1 -0
  48. package/dist/tests/explore.test.js +146 -0
  49. package/dist/tests/explore.test.js.map +1 -0
  50. package/dist/tests/fts5.test.js +7 -7
  51. package/dist/tests/fts5.test.js.map +1 -1
  52. package/dist/tests/global-layer.test.d.ts +2 -0
  53. package/dist/tests/global-layer.test.d.ts.map +1 -0
  54. package/dist/tests/global-layer.test.js +152 -0
  55. package/dist/tests/global-layer.test.js.map +1 -0
  56. package/dist/tests/helpers/db.d.ts +14 -1
  57. package/dist/tests/helpers/db.d.ts.map +1 -1
  58. package/dist/tests/helpers/db.js +3 -3
  59. package/dist/tests/helpers/db.js.map +1 -1
  60. package/dist/tests/hook-smoke.test.js +2 -2
  61. package/dist/tests/hook-smoke.test.js.map +1 -1
  62. package/dist/tests/init.test.js +83 -0
  63. package/dist/tests/init.test.js.map +1 -1
  64. package/dist/tests/model-router.test.d.ts +2 -0
  65. package/dist/tests/model-router.test.d.ts.map +1 -0
  66. package/dist/tests/model-router.test.js +146 -0
  67. package/dist/tests/model-router.test.js.map +1 -0
  68. package/dist/tests/post-read.test.d.ts +2 -0
  69. package/dist/tests/post-read.test.d.ts.map +1 -0
  70. package/dist/tests/post-read.test.js +69 -0
  71. package/dist/tests/post-read.test.js.map +1 -0
  72. package/dist/tests/quality-populate.test.d.ts +2 -0
  73. package/dist/tests/quality-populate.test.d.ts.map +1 -0
  74. package/dist/tests/quality-populate.test.js +158 -0
  75. package/dist/tests/quality-populate.test.js.map +1 -0
  76. package/dist/tests/reflect.test.d.ts +2 -0
  77. package/dist/tests/reflect.test.d.ts.map +1 -0
  78. package/dist/tests/reflect.test.js +122 -0
  79. package/dist/tests/reflect.test.js.map +1 -0
  80. package/dist/tests/schemas.test.d.ts +2 -0
  81. package/dist/tests/schemas.test.d.ts.map +1 -0
  82. package/dist/tests/schemas.test.js +87 -0
  83. package/dist/tests/schemas.test.js.map +1 -0
  84. package/dist/tests/search-hook.test.js +3 -3
  85. package/dist/tests/search-hook.test.js.map +1 -1
  86. package/dist/tests/upgrade.test.d.ts +2 -0
  87. package/dist/tests/upgrade.test.d.ts.map +1 -0
  88. package/dist/tests/upgrade.test.js +91 -0
  89. package/dist/tests/upgrade.test.js.map +1 -0
  90. package/hooks/lib/mindlore-common.cjs +89 -5
  91. package/hooks/lib/types.d.ts +56 -0
  92. package/hooks/mindlore-cwd-changed.cjs +57 -0
  93. package/hooks/mindlore-dont-repeat.cjs +222 -0
  94. package/hooks/mindlore-fts5-sync.cjs +6 -9
  95. package/hooks/mindlore-index.cjs +3 -3
  96. package/hooks/mindlore-model-router.cjs +54 -0
  97. package/hooks/mindlore-post-read.cjs +97 -0
  98. package/hooks/mindlore-read-guard.cjs +27 -4
  99. package/hooks/mindlore-search.cjs +73 -52
  100. package/hooks/mindlore-session-end.cjs +43 -1
  101. package/hooks/mindlore-session-focus.cjs +14 -0
  102. package/package.json +5 -3
  103. package/plugin.json +29 -1
  104. package/skills/mindlore-decide/SKILL.md +8 -0
  105. package/skills/mindlore-evolve/SKILL.md +99 -0
  106. package/skills/mindlore-explore/SKILL.md +104 -0
  107. package/skills/mindlore-health/SKILL.md +8 -0
  108. package/skills/mindlore-ingest/SKILL.md +65 -32
  109. package/skills/mindlore-log/SKILL.md +30 -13
  110. package/skills/mindlore-query/SKILL.md +8 -0
  111. package/templates/SCHEMA.md +15 -2
  112. package/templates/config.json +9 -0
@@ -0,0 +1,104 @@
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, Agent]
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
+ **Agent Delegation:** Cross-reference analizini subagent'a delege et (context koruma).
26
+
27
+ 1. Spawn an Agent for analysis:
28
+ ```
29
+ Agent({
30
+ description: "mindlore explore: connections",
31
+ subagent_type: "Explore",
32
+ prompt: "[mindlore:explore] Analyze .mindlore/ for unexpected connections. <aşağıdaki talimatları buraya koy>"
33
+ })
34
+ ```
35
+
36
+ Agent talimatları:
37
+ a. Read all source and domain files from active scope
38
+ b. Cross-match by tag + content (see criteria below)
39
+ c. Rank connections by strength
40
+ d. Return findings as structured table
41
+
42
+ 2. After agent returns — review and show findings to user
43
+ 3. On approval, write connection files (main session handles writes)
44
+
45
+ **Cross-match criteria:**
46
+ - Files sharing tags but not referencing each other
47
+ - Sources covering similar topics from different angles
48
+ - Sources that could bridge between domains
49
+ 3. Rank connections by strength:
50
+ - **high**: 3+ shared tags + content overlap
51
+ - **medium**: 2 shared tags or significant content similarity
52
+ - **low**: 1 shared tag + weak content match
53
+ 4. Show findings to user
54
+ 5. On approval, write to `connections/` directory
55
+
56
+ ## Connection File Format
57
+
58
+ Written to `connections/` with frontmatter:
59
+
60
+ ```markdown
61
+ ---
62
+ type: connection
63
+ slug: connection-source-a-source-b
64
+ date_created: 2026-04-12
65
+ sources: [source-a.md, source-b.md]
66
+ domains: [domain-x.md]
67
+ strength: high
68
+ tags: [shared-tag-1, shared-tag-2]
69
+ ---
70
+
71
+ ## Connection
72
+
73
+ [Why these sources are related — LLM explanation]
74
+
75
+ ## Action Suggestion
76
+
77
+ [What could be done — domain update, new analysis, etc.]
78
+ ```
79
+
80
+ ## Rules
81
+
82
+ - Check for duplicate connections before writing (same source pair)
83
+ - Show findings before writing — user approval required
84
+ - Update INDEX.md with new connections entry
85
+ - Append EXPLORE entry to log.md
86
+ - Strength is LLM-assessed based on tag overlap + content similarity
87
+ - The `[mindlore:explore]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (sonnet by default)
88
+
89
+ ## Output Format
90
+
91
+ ```
92
+ Mindlore Explore — Discovered Connections
93
+
94
+ Scope: project (.mindlore/)
95
+ Sources scanned: 12
96
+ Connections found: 3 (2 new, 1 existing)
97
+
98
+ | # | Sources | Strength | Why |
99
+ |---|---------|----------|-----|
100
+ | 1 | react-hooks.md + agent-orchestration.md | medium | Both discuss state management patterns |
101
+ | 2 | karpathy-kb.md + search-retrieval.md | high | FTS5 + knowledge architecture overlap |
102
+
103
+ Write connections? (y/n)
104
+ ```
@@ -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".
@@ -16,37 +24,59 @@ User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki
16
24
  ## Modes
17
25
 
18
26
  ### URL Mode
19
- 1. Extract content from URL:
20
- - If `markitdown` is available: `markitdown <url>` (best quality, zero tokens)
21
- - Else: use `WebFetch` or `ctx_fetch_and_index`
22
- 2. Save raw capture to `.mindlore/raw/` with frontmatter:
23
- ```yaml
24
- ---
25
- slug: source-name-kebab
26
- type: raw
27
- source_url: https://...
28
- date_captured: YYYY-MM-DD
29
- tags: [tag1, tag2]
30
- ---
27
+
28
+ **Agent Delegation:** URL fetch + raw/sources yazımını subagent'a delege et (maliyet optimizasyonu).
29
+
30
+ 1. Spawn an Agent with the following pattern:
31
31
  ```
32
- 3. Summarize into `.mindlore/sources/` with full frontmatter:
33
- ```yaml
34
- ---
35
- slug: source-name-kebab
36
- type: source
37
- title: Human Readable Title
38
- source_url: https://...
39
- source_type: github-repo|blog|docs|video|x-thread
40
- date_captured: YYYY-MM-DD
41
- tags: [tag1, tag2]
42
- quality: high|medium|low
43
- ingested: true
44
- ---
32
+ Agent({
33
+ description: "mindlore ingest: <slug>",
34
+ subagent_type: "researcher",
35
+ prompt: "[mindlore:ingest] <aşağıdaki talimatları buraya koy>"
36
+ })
45
37
  ```
46
- 4. Update relevant domain page(s) in `.mindlore/domains/` (max 2)
47
- 5. Update `.mindlore/INDEX.md` stats line
48
- 6. Append entry to `.mindlore/log.md`
49
- 7. Run FTS5 re-index: `npm run index`
38
+
39
+ Agent talimatları:
40
+ - Extract content from URL:
41
+ - If `markitdown` is available: `markitdown <url>` (best quality, zero tokens)
42
+ - Else: use `WebFetch` or `ctx_fetch_and_index`
43
+ - **YouTube URL** detected (`youtube.com` or `youtu.be`):
44
+ 1. markitdown installed → `markitdown <url>` (includes transcript)
45
+ 2. Else youtube-transcript npm → `hasYoutubeTranscript()` check
46
+ 3. Else → return error, ask user to paste transcript
47
+ - Save raw capture to `.mindlore/raw/` with frontmatter:
48
+ ```yaml
49
+ ---
50
+ slug: source-name-kebab
51
+ type: raw
52
+ source_url: https://...
53
+ date_captured: YYYY-MM-DD
54
+ tags: [tag1, tag2]
55
+ ---
56
+ ```
57
+ - Summarize into `.mindlore/sources/` with full frontmatter:
58
+ ```yaml
59
+ ---
60
+ slug: source-name-kebab
61
+ type: source
62
+ title: Human Readable Title
63
+ source_url: https://...
64
+ source_type: github-repo|blog|docs|video|x-thread
65
+ date_captured: YYYY-MM-DD
66
+ tags: [tag1, tag2]
67
+ quality: high|medium|low
68
+ ingested: true
69
+ ---
70
+ ```
71
+ - Agent must report: created file paths, slug, quality assigned
72
+
73
+ 2. After agent returns — verify raw/ and sources/ files exist and have valid frontmatter
74
+ 3. Update relevant domain page(s) in `.mindlore/domains/` (max 2)
75
+ 4. Update `.mindlore/INDEX.md` stats line
76
+ 5. Append entry to `.mindlore/log.md`
77
+ 6. Run FTS5 re-index: `npm run index`
78
+
79
+ **IMPORTANT:** The `[mindlore:ingest]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (haiku by default).
50
80
 
51
81
  ### Text Mode
52
82
  1. User pastes text directly
@@ -75,9 +105,12 @@ The sources/ file should contain:
75
105
 
76
106
  ## Quality Assessment
77
107
 
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
108
+ Assign quality automatically during ingest using this heuristic:
109
+ - `high`: Official docs (anthropic, github docs, MDN), primary research, authoritative references
110
+ - `medium`: Blog posts, tutorials, conference talks, X threads with substance
111
+ - `low`: Raw notes, text pastes, quick captures, low signal-to-noise
112
+
113
+ LLM may override the heuristic based on content analysis. Always set quality — never leave it null.
81
114
 
82
115
  ## Domain Update Rules
83
116
 
@@ -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
 
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.3.1",
3
+ "models": {
4
+ "ingest": "haiku",
5
+ "evolve": "sonnet",
6
+ "explore": "sonnet",
7
+ "default": "haiku"
8
+ }
9
+ }