mindlore 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +18 -0
- package/dist/scripts/bundle-hooks.js +3 -4
- package/dist/scripts/bundle-hooks.js.map +1 -1
- package/dist/scripts/init.js +69 -3
- package/dist/scripts/init.js.map +1 -1
- package/dist/scripts/lib/constants.d.ts +20 -0
- package/dist/scripts/lib/constants.d.ts.map +1 -1
- package/dist/scripts/lib/constants.js +32 -1
- package/dist/scripts/lib/constants.js.map +1 -1
- package/dist/scripts/lib/db-helpers.d.ts +1 -0
- package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
- package/dist/scripts/lib/db-helpers.js +37 -0
- package/dist/scripts/lib/db-helpers.js.map +1 -1
- package/dist/scripts/lib/detect-plugin.js +1 -1
- package/dist/scripts/lib/detect-plugin.js.map +1 -1
- package/dist/scripts/lib/episodes.d.ts +1 -1
- package/dist/scripts/lib/episodes.d.ts.map +1 -1
- package/dist/scripts/lib/episodes.js +1 -1
- package/dist/scripts/lib/episodes.js.map +1 -1
- package/dist/scripts/lib/session-payload.d.ts.map +1 -1
- package/dist/scripts/lib/session-payload.js +3 -5
- package/dist/scripts/lib/session-payload.js.map +1 -1
- package/dist/scripts/lib/skill-runner.d.ts +3 -0
- package/dist/scripts/lib/skill-runner.d.ts.map +1 -0
- package/dist/scripts/lib/skill-runner.js +78 -0
- package/dist/scripts/lib/skill-runner.js.map +1 -0
- package/dist/scripts/lib/telemetry-scan.d.ts +19 -0
- package/dist/scripts/lib/telemetry-scan.d.ts.map +1 -0
- package/dist/scripts/lib/telemetry-scan.js +42 -0
- package/dist/scripts/lib/telemetry-scan.js.map +1 -0
- package/dist/scripts/mindlore-clean-cache.d.ts +3 -0
- package/dist/scripts/mindlore-clean-cache.d.ts.map +1 -0
- package/dist/scripts/mindlore-clean-cache.js +65 -0
- package/dist/scripts/mindlore-clean-cache.js.map +1 -0
- package/dist/scripts/mindlore-doctor.d.ts.map +1 -1
- package/dist/scripts/mindlore-doctor.js +10 -13
- package/dist/scripts/mindlore-doctor.js.map +1 -1
- package/dist/scripts/reflect-failure-scan.d.ts +3 -0
- package/dist/scripts/reflect-failure-scan.d.ts.map +1 -0
- package/dist/scripts/reflect-failure-scan.js +41 -0
- package/dist/scripts/reflect-failure-scan.js.map +1 -0
- package/dist/tests/clean-cache.test.d.ts +2 -0
- package/dist/tests/clean-cache.test.d.ts.map +1 -0
- package/dist/tests/clean-cache.test.js +59 -0
- package/dist/tests/clean-cache.test.js.map +1 -0
- package/dist/tests/db-helpers-vec.test.d.ts +2 -0
- package/dist/tests/db-helpers-vec.test.d.ts.map +1 -0
- package/dist/tests/db-helpers-vec.test.js +32 -0
- package/dist/tests/db-helpers-vec.test.js.map +1 -0
- package/dist/tests/db-helpers.test.d.ts +2 -0
- package/dist/tests/db-helpers.test.d.ts.map +1 -0
- package/dist/tests/db-helpers.test.js +30 -0
- package/dist/tests/db-helpers.test.js.map +1 -0
- package/dist/tests/diary.test.js +3 -3
- package/dist/tests/diary.test.js.map +1 -1
- package/dist/tests/episodes-inject.test.js +5 -5
- package/dist/tests/episodes-inject.test.js.map +1 -1
- package/dist/tests/init-spawn-cleanup.test.d.ts +2 -0
- package/dist/tests/init-spawn-cleanup.test.d.ts.map +1 -0
- package/dist/tests/init-spawn-cleanup.test.js +21 -0
- package/dist/tests/init-spawn-cleanup.test.js.map +1 -0
- package/dist/tests/install-matrix.test.js +39 -0
- package/dist/tests/install-matrix.test.js.map +1 -1
- package/dist/tests/learnings-loader.test.d.ts +2 -0
- package/dist/tests/learnings-loader.test.d.ts.map +1 -0
- package/dist/tests/learnings-loader.test.js +64 -0
- package/dist/tests/learnings-loader.test.js.map +1 -0
- package/dist/tests/mindlore-home-env.test.d.ts +2 -0
- package/dist/tests/mindlore-home-env.test.d.ts.map +1 -0
- package/dist/tests/mindlore-home-env.test.js +33 -0
- package/dist/tests/mindlore-home-env.test.js.map +1 -0
- package/dist/tests/no-hardcoded-cache.test.d.ts +2 -0
- package/dist/tests/no-hardcoded-cache.test.d.ts.map +1 -0
- package/dist/tests/no-hardcoded-cache.test.js +40 -0
- package/dist/tests/no-hardcoded-cache.test.js.map +1 -0
- package/dist/tests/nomination.test.js +1 -1
- package/dist/tests/nomination.test.js.map +1 -1
- package/dist/tests/reflect-failure-scan.test.d.ts +2 -0
- package/dist/tests/reflect-failure-scan.test.d.ts.map +1 -0
- package/dist/tests/reflect-failure-scan.test.js +49 -0
- package/dist/tests/reflect-failure-scan.test.js.map +1 -0
- package/dist/tests/reflect-trigger.test.d.ts +2 -0
- package/dist/tests/reflect-trigger.test.d.ts.map +1 -0
- package/dist/tests/reflect-trigger.test.js +31 -0
- package/dist/tests/reflect-trigger.test.js.map +1 -0
- package/dist/tests/session-focus-episode-counter.test.d.ts +2 -0
- package/dist/tests/session-focus-episode-counter.test.d.ts.map +1 -0
- package/dist/tests/session-focus-episode-counter.test.js +41 -0
- package/dist/tests/session-focus-episode-counter.test.js.map +1 -0
- package/dist/tests/session-focus-learnings-inject.test.d.ts +2 -0
- package/dist/tests/session-focus-learnings-inject.test.d.ts.map +1 -0
- package/dist/tests/session-focus-learnings-inject.test.js +29 -0
- package/dist/tests/session-focus-learnings-inject.test.js.map +1 -0
- package/dist/tests/session-focus-nomination-inject.test.d.ts +2 -0
- package/dist/tests/session-focus-nomination-inject.test.d.ts.map +1 -0
- package/dist/tests/session-focus-nomination-inject.test.js +50 -0
- package/dist/tests/session-focus-nomination-inject.test.js.map +1 -0
- package/dist/tests/session-focus-reflect-nudge.test.d.ts +2 -0
- package/dist/tests/session-focus-reflect-nudge.test.d.ts.map +1 -0
- package/dist/tests/session-focus-reflect-nudge.test.js +62 -0
- package/dist/tests/session-focus-reflect-nudge.test.js.map +1 -0
- package/dist/tests/session-payload.test.js +6 -12
- package/dist/tests/session-payload.test.js.map +1 -1
- package/dist/tests/skill-md-uses-runner.test.d.ts +2 -0
- package/dist/tests/skill-md-uses-runner.test.d.ts.map +1 -0
- package/dist/tests/skill-md-uses-runner.test.js +31 -0
- package/dist/tests/skill-md-uses-runner.test.js.map +1 -0
- package/dist/tests/skill-runner-failure-e2e.test.d.ts +10 -0
- package/dist/tests/skill-runner-failure-e2e.test.d.ts.map +1 -0
- package/dist/tests/skill-runner-failure-e2e.test.js +64 -0
- package/dist/tests/skill-runner-failure-e2e.test.js.map +1 -0
- package/dist/tests/skill-runner.test.d.ts +2 -0
- package/dist/tests/skill-runner.test.d.ts.map +1 -0
- package/dist/tests/skill-runner.test.js +55 -0
- package/dist/tests/skill-runner.test.js.map +1 -0
- package/dist/tests/sync-scripts.test.d.ts +2 -0
- package/dist/tests/sync-scripts.test.d.ts.map +1 -0
- package/dist/tests/sync-scripts.test.js +26 -0
- package/dist/tests/sync-scripts.test.js.map +1 -0
- package/dist/tests/telemetry-scan.test.d.ts +2 -0
- package/dist/tests/telemetry-scan.test.d.ts.map +1 -0
- package/dist/tests/telemetry-scan.test.js +32 -0
- package/dist/tests/telemetry-scan.test.js.map +1 -0
- package/hooks/cc-memory-bulk-sync.cjs +19 -1
- package/hooks/cc-session-sync.cjs +19 -1
- package/hooks/lib/constants.cjs +1 -1
- package/hooks/lib/learnings-loader.cjs +70 -0
- package/hooks/lib/mindlore-common.cjs +5 -0
- package/hooks/lib/reflect-trigger.cjs +29 -0
- package/hooks/lib/sync-scripts.cjs +12 -0
- package/hooks/mindlore-search.cjs +97 -1
- package/hooks/mindlore-session-focus.cjs +76 -10
- package/hooks/src/lib/mindlore-common.cjs +5 -0
- package/hooks/src/mindlore-session-focus.cjs +47 -5
- package/mcp-server.cjs +37928 -0
- package/package.json +7 -3
- package/plugin.json +1 -1
- package/skills/mindlore-decide/SKILL.md +1 -1
- package/skills/mindlore-diary/SKILL.md +4 -4
- package/skills/mindlore-evolve/SKILL.md +2 -2
- package/skills/mindlore-health/SKILL.md +2 -2
- package/skills/mindlore-ingest/SKILL.md +7 -7
- package/skills/mindlore-log/SKILL.md +1 -1
- package/skills/mindlore-maintain/SKILL.md +2 -2
- package/skills/mindlore-query/SKILL.md +1 -1
- package/skills/mindlore-reflect/SKILL.md +30 -16
- package/start.cjs +141 -0
- package/templates/config.json +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindlore",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "AI-native knowledge system for Claude Code",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mindlore": "dist/scripts/init.js"
|
|
7
|
+
"mindlore": "dist/scripts/init.js",
|
|
8
|
+
"mindlore-clean-cache": "dist/scripts/mindlore-clean-cache.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "tsc",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"dependencies": {
|
|
56
57
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
57
58
|
"better-sqlite3": "^12.9.0",
|
|
59
|
+
"sqlite-vec": "^0.1.9",
|
|
58
60
|
"zod": "^4.3.6"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
@@ -78,6 +80,8 @@
|
|
|
78
80
|
"skills/",
|
|
79
81
|
"templates/",
|
|
80
82
|
"SCHEMA.md",
|
|
81
|
-
"plugin.json"
|
|
83
|
+
"plugin.json",
|
|
84
|
+
"mcp-server.cjs",
|
|
85
|
+
"start.cjs"
|
|
82
86
|
]
|
|
83
87
|
}
|
package/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifestVersion": 2,
|
|
3
3
|
"name": "mindlore",
|
|
4
4
|
"description": "AI-native knowledge system for Claude Code. Persistent, searchable, evolving knowledge base with FTS5 and Knowledge Graph.",
|
|
5
|
-
"version": "0.7.
|
|
5
|
+
"version": "0.7.6",
|
|
6
6
|
"skills": [
|
|
7
7
|
{
|
|
8
8
|
"name": "mindlore-ingest",
|
|
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
15
15
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-decide" → `MINDLORE_PKG = {base_directory}/../..`
|
|
16
16
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
17
17
|
|
|
18
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
18
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-decide <script> [args...]` for all script commands.
|
|
19
19
|
|
|
20
20
|
## Scope
|
|
21
21
|
|
|
@@ -10,7 +10,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
10
10
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-diary" → `MINDLORE_PKG = {base_directory}/../..`
|
|
11
11
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
12
12
|
|
|
13
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
13
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary <script> [args...]` for all script commands.
|
|
14
14
|
|
|
15
15
|
# /mindlore-diary
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ Determine target using `getActiveMindloreDir()` logic:
|
|
|
27
27
|
## On Start — Read skill_memory
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
30
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js get mindlore-diary last_diary_date
|
|
31
31
|
```
|
|
32
32
|
If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
|
|
33
33
|
|
|
@@ -73,8 +73,8 @@ If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
|
|
|
73
73
|
## On End — Write skill_memory
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
77
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
76
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js set mindlore-diary last_diary_date "$(date -I)"
|
|
77
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-diary lib/skill-memory.js set mindlore-diary last_episode_count "{N}"
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## Rules
|
|
@@ -12,7 +12,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
12
12
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-evolve" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
13
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
14
14
|
|
|
15
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
15
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-evolve <script> [args...]` for all script commands.
|
|
16
16
|
|
|
17
17
|
# /mindlore-evolve
|
|
18
18
|
|
|
@@ -107,7 +107,7 @@ Apply suggested changes with user approval.
|
|
|
107
107
|
**Rules:**
|
|
108
108
|
- NEVER make automatic changes — always require user approval
|
|
109
109
|
- Show diff preview before applying
|
|
110
|
-
- After changes, run `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-index.js
|
|
110
|
+
- After changes, run `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-evolve mindlore-fts5-index.js` for FTS5 sync
|
|
111
111
|
- Log every change to log.md with timestamp
|
|
112
112
|
- The `[mindlore:evolve]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (sonnet by default)
|
|
113
113
|
|
|
@@ -11,7 +11,7 @@ allowed-tools: [Bash, Read]
|
|
|
11
11
|
Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
12
12
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-health" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
13
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
14
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
14
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-health <script> [args...]` for all script commands.
|
|
15
15
|
|
|
16
16
|
# /mindlore-health
|
|
17
17
|
|
|
@@ -33,7 +33,7 @@ User says "health check", "mindlore health", "bilgi sistemi kontrol", "saglik ko
|
|
|
33
33
|
|
|
34
34
|
1. Run the health check script:
|
|
35
35
|
```bash
|
|
36
|
-
node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js
|
|
36
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-health mindlore-health-check.js
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
2. Read the output and provide LLM interpretation:
|
|
@@ -13,7 +13,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
13
13
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-ingest" → `MINDLORE_PKG = {base_directory}/../..`
|
|
14
14
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
15
15
|
|
|
16
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
16
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest <script> [args...]` for all script commands.
|
|
17
17
|
|
|
18
18
|
# /mindlore-ingest
|
|
19
19
|
|
|
@@ -59,7 +59,7 @@ Birden fazla URL verildiğinde (boşluk veya virgülle ayrılmış):
|
|
|
59
59
|
|
|
60
60
|
**Pre-check (before fetch):**
|
|
61
61
|
```bash
|
|
62
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
62
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/skill-memory.js get mindlore-ingest last_ingest_urls
|
|
63
63
|
```
|
|
64
64
|
If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ If URL already in the list, warn user: "This URL was ingested recently. Re-inges
|
|
|
67
67
|
|
|
68
68
|
1. **Fetch raw content (zero token):**
|
|
69
69
|
```bash
|
|
70
|
-
node "$MINDLORE_PKG/dist/scripts/fetch-raw.js
|
|
70
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest fetch-raw.js "$URL" --out-dir "$MINDLORE_DIR/raw"
|
|
71
71
|
```
|
|
72
72
|
Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
|
|
73
73
|
|
|
@@ -88,7 +88,7 @@ If URL already in the list, warn user: "This URL was ingested recently. Re-inges
|
|
|
88
88
|
|
|
89
89
|
5. **Update skill_memory:**
|
|
90
90
|
```bash
|
|
91
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
91
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/skill-memory.js set mindlore-ingest last_ingest_urls "$URL"
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
6. **Return to caller (this is all the ana session sees):**
|
|
@@ -176,7 +176,7 @@ After every ingest, verify all 7 checkpoints before reporting success:
|
|
|
176
176
|
|
|
177
177
|
0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
|
|
178
178
|
```bash
|
|
179
|
-
node "$MINDLORE_PKG/dist/scripts/lib/
|
|
179
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest lib/similarity.js "<title or first 100 chars>"
|
|
180
180
|
```
|
|
181
181
|
Eğer score > 0.7 olan sonuç varsa KULLANICIYA SOR: "Bu içerik '${slug}' ile benzer görünüyor. Yine de eklensin mi?"
|
|
182
182
|
Kullanıcı onaylarsa devam et, yoksa atla.
|
|
@@ -185,11 +185,11 @@ After every ingest, verify all 7 checkpoints before reporting success:
|
|
|
185
185
|
3. **INDEX.md updated** — stats line incremented, Recent section has new entry
|
|
186
186
|
4. **Domain updated** — if relevant domain exists, new finding added (max 1 domain per ingest)
|
|
187
187
|
5. **log.md entry** — append `| {date} | ingest | {slug}.md |`
|
|
188
|
-
6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-search.js
|
|
188
|
+
6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest mindlore-fts5-search.js "{keyword}"` returns the new file
|
|
189
189
|
|
|
190
190
|
If any checkpoint fails, fix it before reporting "ingest complete". Do NOT skip steps.
|
|
191
191
|
|
|
192
192
|
Optional: run full health check for structural integrity:
|
|
193
193
|
```bash
|
|
194
|
-
node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js
|
|
194
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-ingest mindlore-health-check.js
|
|
195
195
|
```
|
|
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
15
15
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-log" → `MINDLORE_PKG = {base_directory}/../..`
|
|
16
16
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
17
17
|
|
|
18
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
18
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-log <script> [args...]` for all script commands.
|
|
19
19
|
|
|
20
20
|
## Scope
|
|
21
21
|
|
|
@@ -12,7 +12,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
12
12
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-maintain" → `MINDLORE_PKG = {base_directory}/../..`
|
|
13
13
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
14
14
|
|
|
15
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
15
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-maintain <script> [args...]` for all script commands.
|
|
16
16
|
|
|
17
17
|
# /mindlore-maintain
|
|
18
18
|
|
|
@@ -97,7 +97,7 @@ KB bakım skill'i. Reflect düşünür, maintain temizler.
|
|
|
97
97
|
|
|
98
98
|
1. Deterministic wiki-lint:
|
|
99
99
|
```bash
|
|
100
|
-
node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js
|
|
100
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-maintain mindlore-health-check.js ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
2. Semantic analiz (opsiyonel, token harcar)
|
|
@@ -15,7 +15,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
15
15
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-query" → `MINDLORE_PKG = {base_directory}/../..`
|
|
16
16
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
17
17
|
|
|
18
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
18
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-query <script> [args...]` for all script commands.
|
|
19
19
|
|
|
20
20
|
## Scope
|
|
21
21
|
|
|
@@ -10,7 +10,7 @@ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
|
|
|
10
10
|
1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-reflect" → `MINDLORE_PKG = {base_directory}/../..`
|
|
11
11
|
2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
|
|
12
12
|
|
|
13
|
-
Use: `node "$MINDLORE_PKG/dist/scripts
|
|
13
|
+
Use: `node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect <script> [args...]` for all script commands.
|
|
14
14
|
|
|
15
15
|
# /mindlore-reflect
|
|
16
16
|
|
|
@@ -25,8 +25,8 @@ Scans both project + global `~/.mindlore/` diary/ for patterns.
|
|
|
25
25
|
## On Start — Check pending nominations + skill_memory
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
29
|
-
node "$MINDLORE_PKG/dist/scripts/lib/skill-
|
|
28
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect lib/skill-memory.js get mindlore-reflect last_reflect_date
|
|
29
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect lib/skill-memory.js get mindlore-reflect nomination_count
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Check pending nominations:
|
|
@@ -48,15 +48,22 @@ Onaylamak istediklerini sec, veya 'skip':
|
|
|
48
48
|
## Flow
|
|
49
49
|
|
|
50
50
|
1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
|
|
51
|
-
2.
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
2. **Run skill failure scan (NEW v0.7.5):**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect reflect-failure-scan
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This populates `episodes` table with `kind: 'skill_failure'` rows from `telemetry.jsonl`. Subsequent pattern analysis treats these like any other episode — 3+ repetitions of the same `(skill, script, error)` triple → nomination via existing 3-tier confidence logic.
|
|
58
|
+
3. Filter by time: `--days 7` (default), `--days 30`
|
|
59
|
+
4. Present summary: "Found N episodes spanning DATE1 to DATE2"
|
|
60
|
+
5. LLM analyzes episodes for recurring patterns:
|
|
54
61
|
- Repeated decisions (same choice 2+ times)
|
|
55
62
|
- Recurring frictions (same blocker/error)
|
|
56
63
|
- Discovery patterns (assumptions that keep breaking)
|
|
57
64
|
- Workflow patterns that worked well
|
|
58
65
|
|
|
59
|
-
|
|
66
|
+
6. **3-Tier Confidence Assessment:**
|
|
60
67
|
|
|
61
68
|
| Tekrar | Tier | Aksiyon |
|
|
62
69
|
|--------|------|---------|
|
|
@@ -64,7 +71,7 @@ Onaylamak istediklerini sec, veya 'skip':
|
|
|
64
71
|
| 2x | Learning | `kind: learning` episode olustur, learnings/ dosyasina yaz |
|
|
65
72
|
| 3x+ | Nomination | `kind: nomination, status: staged, source: reflect` episode olustur |
|
|
66
73
|
|
|
67
|
-
|
|
74
|
+
7. **Structured report:**
|
|
68
75
|
```
|
|
69
76
|
-- Reflect Raporu (son {days} gun, {N} episode) --
|
|
70
77
|
|
|
@@ -83,23 +90,25 @@ Onaylamak istediklerini sec, veya 'skip':
|
|
|
83
90
|
[ ] {rule} ({repeat_count}x, {confidence} confidence)
|
|
84
91
|
```
|
|
85
92
|
|
|
86
|
-
|
|
93
|
+
8. **Nomination creation (3x+ tekrar):**
|
|
87
94
|
```sql
|
|
88
95
|
INSERT INTO episodes (summary, body, kind, status, source, project, created_at)
|
|
89
96
|
VALUES (?, ?, 'nomination', 'staged', 'reflect', ?, ?)
|
|
90
97
|
```
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
9. **Nomination approval flow:**
|
|
93
100
|
User approves -> `status: staged -> approved` -> write to target:
|
|
94
|
-
-
|
|
95
|
-
- `claude.md` -> project CLAUDE.md'ye kural ekle
|
|
96
|
-
- `domain:{slug}` -> ilgili domain sayfasina ekle
|
|
101
|
+
- **`learnings/{topic}.md`** (DEFAULT — selected if user presses Enter / leaves blank)
|
|
102
|
+
- `claude.md` -> project CLAUDE.md'ye kural ekle (opt-in)
|
|
103
|
+
- `domain:{slug}` -> ilgili domain sayfasina ekle (opt-in)
|
|
97
104
|
|
|
98
105
|
Approval SQL:
|
|
99
106
|
```sql
|
|
100
107
|
UPDATE episodes SET status = 'approved', graduated_at = datetime('now') WHERE id = ?
|
|
101
108
|
```
|
|
102
109
|
|
|
110
|
+
When writing to `learnings/`, also write `project: <currentProject|global>` to the lesson frontmatter (A4 dependency).
|
|
111
|
+
|
|
103
112
|
User rejects -> `status: staged -> rejected` + rejection reason
|
|
104
113
|
|
|
105
114
|
Rejection SQL:
|
|
@@ -107,11 +116,16 @@ Onaylamak istediklerini sec, veya 'skip':
|
|
|
107
116
|
UPDATE episodes SET status = 'rejected', rejected_at = datetime('now'), rejection_reason = ? WHERE id = ?
|
|
108
117
|
```
|
|
109
118
|
|
|
110
|
-
## On End — Write skill_memory
|
|
119
|
+
## On End — Write skill_memory (success-only)
|
|
111
120
|
|
|
112
121
|
```bash
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
# ONLY update last_reflect_date if reflect completed successfully (no parse errors,
|
|
123
|
+
# no DB errors). If any failure occurred during pattern extraction, leave the date
|
|
124
|
+
# unchanged so the next session retries.
|
|
125
|
+
if [ "$REFLECT_EXIT_CODE" = "0" ]; then
|
|
126
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect skill-memory set mindlore-reflect last_reflect_date "$(date -I)"
|
|
127
|
+
fi
|
|
128
|
+
node "$MINDLORE_PKG/dist/scripts/lib/skill-runner.js" mindlore-reflect skill-memory set mindlore-reflect nomination_count "{staged_count}"
|
|
115
129
|
```
|
|
116
130
|
|
|
117
131
|
## Quick Health Summary (v0.5.3)
|
package/start.cjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Mindlore MCP Server bootstrap (context-mode pattern).
|
|
4
|
+
*
|
|
5
|
+
* CC plugin marketplace install pipeline does NOT run `npm install` —
|
|
6
|
+
* it just extracts the tarball. Native deps (better-sqlite3, sqlite-vec)
|
|
7
|
+
* need install-time platform binaries that bundledDependencies cannot
|
|
8
|
+
* ship cross-platform (sqlite-vec uses optionalDependencies pattern with
|
|
9
|
+
* per-platform packages, better-sqlite3 v12 ships no prebuilds/ dir).
|
|
10
|
+
*
|
|
11
|
+
* Strategy: this wrapper runs BEFORE mcp-server.cjs. It detects missing
|
|
12
|
+
* or wrong-platform native binaries and self-heals via `npm install` in
|
|
13
|
+
* the plugin cache dir. First boot is 5-30s (one-time), subsequent boots
|
|
14
|
+
* are <100ms (existsSync fast path).
|
|
15
|
+
*
|
|
16
|
+
* Why a separate wrapper instead of inlining in mcp-server.cjs:
|
|
17
|
+
* 1. mcp-server.cjs is an esbuild bundle — adding logic before the
|
|
18
|
+
* require('better-sqlite3') happens at the top of the bundle is hard
|
|
19
|
+
* 2. Single source of truth — hooks can also import ensure-deps later
|
|
20
|
+
* 3. Easier to swap out if CC plugin spec adds postinstall hooks
|
|
21
|
+
*
|
|
22
|
+
* See: feedback_cc_plugin_self_contained.md, feedback_multi_platform_binary.md
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
'use strict';
|
|
26
|
+
|
|
27
|
+
const fs = require('node:fs');
|
|
28
|
+
const path = require('node:path');
|
|
29
|
+
const { execSync, spawn } = require('node:child_process');
|
|
30
|
+
|
|
31
|
+
const __dirname_ = __dirname;
|
|
32
|
+
const NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
33
|
+
|
|
34
|
+
// Native dep manifest — package + expected binary location after install
|
|
35
|
+
const NATIVE_DEPS = [
|
|
36
|
+
{
|
|
37
|
+
pkg: 'better-sqlite3',
|
|
38
|
+
binary: ['build', 'Release', 'better_sqlite3.node'],
|
|
39
|
+
},
|
|
40
|
+
// sqlite-vec uses optionalDependencies for per-platform packages
|
|
41
|
+
// (sqlite-vec-{linux,darwin,win32}-{x64,arm64}). npm picks the right one
|
|
42
|
+
// at install time. We just check the wrapper package presence — the
|
|
43
|
+
// platform-specific binary is auto-selected by sqlite-vec loader.
|
|
44
|
+
{
|
|
45
|
+
pkg: 'sqlite-vec',
|
|
46
|
+
binary: null, // loader handles platform selection
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const RUNTIME_DEPS = [
|
|
51
|
+
'@modelcontextprotocol/sdk',
|
|
52
|
+
'zod',
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
function log(msg) {
|
|
56
|
+
// stderr — stdout is reserved for MCP JSON-RPC
|
|
57
|
+
process.stderr.write(`[mindlore-bootstrap] ${msg}\n`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function depPresent({ pkg, binary }) {
|
|
61
|
+
const pkgDir = path.join(__dirname_, 'node_modules', pkg);
|
|
62
|
+
if (!fs.existsSync(pkgDir)) return false;
|
|
63
|
+
if (binary && !fs.existsSync(path.join(pkgDir, ...binary))) return false;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function probeBetterSqlite3() {
|
|
68
|
+
// Child process probe — in-process require() caches dlopen, can't detect
|
|
69
|
+
// on-disk binary swaps (ABI mismatch or wrong-platform binary).
|
|
70
|
+
try {
|
|
71
|
+
execSync(
|
|
72
|
+
`node -e "new (require('better-sqlite3'))(':memory:').close()"`,
|
|
73
|
+
{ cwd: __dirname_, stdio: 'pipe', timeout: 10000 }
|
|
74
|
+
);
|
|
75
|
+
return true;
|
|
76
|
+
} catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function installMissing(packages) {
|
|
82
|
+
if (packages.length === 0) return true;
|
|
83
|
+
log(`installing missing packages: ${packages.join(', ')}`);
|
|
84
|
+
log('(first boot only — subsequent boots <100ms)');
|
|
85
|
+
try {
|
|
86
|
+
execSync(
|
|
87
|
+
`${NPM} install ${packages.join(' ')} --no-package-lock --no-save --silent`,
|
|
88
|
+
{ cwd: __dirname_, stdio: 'pipe', timeout: 180000, shell: true }
|
|
89
|
+
);
|
|
90
|
+
log('install complete');
|
|
91
|
+
return true;
|
|
92
|
+
} catch (err) {
|
|
93
|
+
log(`install failed: ${err && err.message ? err.message : String(err)}`);
|
|
94
|
+
log('MCP server may not function — check network + write permissions in plugin cache dir');
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function rebuildBetterSqlite3() {
|
|
100
|
+
log('rebuilding better-sqlite3 for current platform/ABI');
|
|
101
|
+
try {
|
|
102
|
+
execSync(`${NPM} rebuild better-sqlite3 --silent`, {
|
|
103
|
+
cwd: __dirname_, stdio: 'pipe', timeout: 120000, shell: true,
|
|
104
|
+
});
|
|
105
|
+
return true;
|
|
106
|
+
} catch (err) {
|
|
107
|
+
log(`rebuild failed: ${err && err.message ? err.message : String(err)}`);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function ensureDeps() {
|
|
113
|
+
// Fast path: everything present
|
|
114
|
+
const allDeps = [...NATIVE_DEPS, ...RUNTIME_DEPS.map((pkg) => ({ pkg, binary: null }))];
|
|
115
|
+
const missing = allDeps.filter((d) => !depPresent(d));
|
|
116
|
+
|
|
117
|
+
if (missing.length > 0) {
|
|
118
|
+
const installed = installMissing(missing.map((d) => d.pkg));
|
|
119
|
+
if (!installed) return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ABI probe — even if binary file exists, it may be wrong platform
|
|
123
|
+
// (someone copied tarball cross-platform, or `prebuild-install` cached wrong arch).
|
|
124
|
+
if (!probeBetterSqlite3()) {
|
|
125
|
+
log('better-sqlite3 binary present but fails probe (likely ABI mismatch or wrong platform)');
|
|
126
|
+
rebuildBetterSqlite3();
|
|
127
|
+
// Re-probe after rebuild
|
|
128
|
+
if (!probeBetterSqlite3()) {
|
|
129
|
+
log('rebuild did not fix the probe — MCP boot may fail');
|
|
130
|
+
// Don't exit — let downstream require() surface the actual error
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Run ensure layer
|
|
138
|
+
ensureDeps();
|
|
139
|
+
|
|
140
|
+
// Boot the actual MCP server
|
|
141
|
+
require('./mcp-server.cjs');
|
package/templates/config.json
CHANGED