mindlore 0.5.1 → 0.5.3

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 (144) hide show
  1. package/README.md +16 -2
  2. package/dist/scripts/cc-memory-bulk-sync.d.ts +26 -0
  3. package/dist/scripts/cc-memory-bulk-sync.d.ts.map +1 -0
  4. package/dist/scripts/cc-memory-bulk-sync.js +177 -0
  5. package/dist/scripts/cc-memory-bulk-sync.js.map +1 -0
  6. package/dist/scripts/fetch-raw.d.ts +2 -0
  7. package/dist/scripts/fetch-raw.d.ts.map +1 -0
  8. package/dist/scripts/fetch-raw.js +124 -0
  9. package/dist/scripts/fetch-raw.js.map +1 -0
  10. package/dist/scripts/lib/consolidation.d.ts +17 -0
  11. package/dist/scripts/lib/consolidation.d.ts.map +1 -0
  12. package/dist/scripts/lib/consolidation.js +55 -0
  13. package/dist/scripts/lib/consolidation.js.map +1 -0
  14. package/dist/scripts/lib/constants.d.ts +5 -0
  15. package/dist/scripts/lib/constants.d.ts.map +1 -1
  16. package/dist/scripts/lib/constants.js +16 -4
  17. package/dist/scripts/lib/constants.js.map +1 -1
  18. package/dist/scripts/lib/db-helpers.d.ts +12 -2
  19. package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
  20. package/dist/scripts/lib/db-helpers.js +36 -0
  21. package/dist/scripts/lib/db-helpers.js.map +1 -1
  22. package/dist/scripts/lib/decay.d.ts +21 -0
  23. package/dist/scripts/lib/decay.d.ts.map +1 -0
  24. package/dist/scripts/lib/decay.js +50 -0
  25. package/dist/scripts/lib/decay.js.map +1 -0
  26. package/dist/scripts/lib/hybrid-search.d.ts +0 -2
  27. package/dist/scripts/lib/hybrid-search.d.ts.map +1 -1
  28. package/dist/scripts/lib/hybrid-search.js +7 -1
  29. package/dist/scripts/lib/hybrid-search.js.map +1 -1
  30. package/dist/scripts/lib/migrations-v052.d.ts +3 -0
  31. package/dist/scripts/lib/migrations-v052.d.ts.map +1 -0
  32. package/dist/scripts/lib/migrations-v052.js +23 -0
  33. package/dist/scripts/lib/migrations-v052.js.map +1 -0
  34. package/dist/scripts/lib/migrations-v053.d.ts +3 -0
  35. package/dist/scripts/lib/migrations-v053.d.ts.map +1 -0
  36. package/dist/scripts/lib/migrations-v053.js +52 -0
  37. package/dist/scripts/lib/migrations-v053.js.map +1 -0
  38. package/dist/scripts/lib/skeleton.d.ts +2 -0
  39. package/dist/scripts/lib/skeleton.d.ts.map +1 -0
  40. package/dist/scripts/lib/skeleton.js +99 -0
  41. package/dist/scripts/lib/skeleton.js.map +1 -0
  42. package/dist/scripts/lib/skill-memory.d.ts +13 -0
  43. package/dist/scripts/lib/skill-memory.d.ts.map +1 -0
  44. package/dist/scripts/lib/skill-memory.js +94 -0
  45. package/dist/scripts/lib/skill-memory.js.map +1 -0
  46. package/dist/scripts/mindlore-backup.d.ts +1 -1
  47. package/dist/scripts/mindlore-backup.d.ts.map +1 -1
  48. package/dist/scripts/mindlore-backup.js +23 -0
  49. package/dist/scripts/mindlore-backup.js.map +1 -1
  50. package/dist/scripts/mindlore-fts5-index.js +3 -1
  51. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  52. package/dist/scripts/mindlore-health-check.d.ts +1 -1
  53. package/dist/scripts/mindlore-health-check.d.ts.map +1 -1
  54. package/dist/scripts/mindlore-health-check.js +138 -136
  55. package/dist/scripts/mindlore-health-check.js.map +1 -1
  56. package/dist/tests/catch-up.test.d.ts +2 -0
  57. package/dist/tests/catch-up.test.d.ts.map +1 -0
  58. package/dist/tests/catch-up.test.js +88 -0
  59. package/dist/tests/catch-up.test.js.map +1 -0
  60. package/dist/tests/cc-memory-bulk-sync.test.d.ts +2 -0
  61. package/dist/tests/cc-memory-bulk-sync.test.d.ts.map +1 -0
  62. package/dist/tests/cc-memory-bulk-sync.test.js +116 -0
  63. package/dist/tests/cc-memory-bulk-sync.test.js.map +1 -0
  64. package/dist/tests/consolidation.test.d.ts +2 -0
  65. package/dist/tests/consolidation.test.d.ts.map +1 -0
  66. package/dist/tests/consolidation.test.js +77 -0
  67. package/dist/tests/consolidation.test.js.map +1 -0
  68. package/dist/tests/decay.test.d.ts +2 -0
  69. package/dist/tests/decay.test.d.ts.map +1 -0
  70. package/dist/tests/decay.test.js +92 -0
  71. package/dist/tests/decay.test.js.map +1 -0
  72. package/dist/tests/episode-file.test.js +9 -6
  73. package/dist/tests/episode-file.test.js.map +1 -1
  74. package/dist/tests/fetch-raw.test.d.ts +2 -0
  75. package/dist/tests/fetch-raw.test.d.ts.map +1 -0
  76. package/dist/tests/fetch-raw.test.js +43 -0
  77. package/dist/tests/fetch-raw.test.js.map +1 -0
  78. package/dist/tests/git-snapshot.test.d.ts +2 -0
  79. package/dist/tests/git-snapshot.test.d.ts.map +1 -0
  80. package/dist/tests/git-snapshot.test.js +36 -0
  81. package/dist/tests/git-snapshot.test.js.map +1 -0
  82. package/dist/tests/migrations-v053.test.d.ts +2 -0
  83. package/dist/tests/migrations-v053.test.d.ts.map +1 -0
  84. package/dist/tests/migrations-v053.test.js +113 -0
  85. package/dist/tests/migrations-v053.test.js.map +1 -0
  86. package/dist/tests/recall-telemetry.test.d.ts +2 -0
  87. package/dist/tests/recall-telemetry.test.d.ts.map +1 -0
  88. package/dist/tests/recall-telemetry.test.js +56 -0
  89. package/dist/tests/recall-telemetry.test.js.map +1 -0
  90. package/dist/tests/resolve-hook-common.test.d.ts +2 -0
  91. package/dist/tests/resolve-hook-common.test.d.ts.map +1 -0
  92. package/dist/tests/resolve-hook-common.test.js +30 -0
  93. package/dist/tests/resolve-hook-common.test.js.map +1 -0
  94. package/dist/tests/search-offload.test.d.ts +2 -0
  95. package/dist/tests/search-offload.test.d.ts.map +1 -0
  96. package/dist/tests/search-offload.test.js +34 -0
  97. package/dist/tests/search-offload.test.js.map +1 -0
  98. package/dist/tests/skeleton.test.d.ts +2 -0
  99. package/dist/tests/skeleton.test.d.ts.map +1 -0
  100. package/dist/tests/skeleton.test.js +116 -0
  101. package/dist/tests/skeleton.test.js.map +1 -0
  102. package/dist/tests/skill-memory-api.test.d.ts +2 -0
  103. package/dist/tests/skill-memory-api.test.d.ts.map +1 -0
  104. package/dist/tests/skill-memory-api.test.js +62 -0
  105. package/dist/tests/skill-memory-api.test.js.map +1 -0
  106. package/dist/tests/skill-memory.test.d.ts +2 -0
  107. package/dist/tests/skill-memory.test.d.ts.map +1 -0
  108. package/dist/tests/skill-memory.test.js +67 -0
  109. package/dist/tests/skill-memory.test.js.map +1 -0
  110. package/dist/tests/skill-path-resolution.test.d.ts +2 -0
  111. package/dist/tests/skill-path-resolution.test.d.ts.map +1 -0
  112. package/dist/tests/skill-path-resolution.test.js +42 -0
  113. package/dist/tests/skill-path-resolution.test.js.map +1 -0
  114. package/dist/tests/wiki-lint.test.d.ts +2 -0
  115. package/dist/tests/wiki-lint.test.d.ts.map +1 -0
  116. package/dist/tests/wiki-lint.test.js +47 -0
  117. package/dist/tests/wiki-lint.test.js.map +1 -0
  118. package/hooks/lib/mindlore-common.cjs +53 -6
  119. package/hooks/mindlore-cwd-changed.cjs +2 -2
  120. package/hooks/mindlore-decision-detector.cjs +2 -2
  121. package/hooks/mindlore-dont-repeat.cjs +2 -2
  122. package/hooks/mindlore-fts5-sync.cjs +2 -2
  123. package/hooks/mindlore-index.cjs +60 -2
  124. package/hooks/mindlore-model-router.cjs +2 -2
  125. package/hooks/mindlore-post-compact.cjs +2 -2
  126. package/hooks/mindlore-post-read.cjs +2 -2
  127. package/hooks/mindlore-pre-compact.cjs +2 -2
  128. package/hooks/mindlore-read-guard.cjs +15 -3
  129. package/hooks/mindlore-research-guard.cjs +2 -2
  130. package/hooks/mindlore-search.cjs +30 -3
  131. package/hooks/mindlore-session-end.cjs +1 -1
  132. package/hooks/mindlore-session-focus.cjs +12 -0
  133. package/package.json +4 -2
  134. package/plugin.json +34 -2
  135. package/skills/mindlore-decide/SKILL.md +9 -0
  136. package/skills/mindlore-diary/SKILL.md +85 -0
  137. package/skills/mindlore-evolve/SKILL.md +24 -1
  138. package/skills/mindlore-health/SKILL.md +10 -1
  139. package/skills/mindlore-ingest/SKILL.md +64 -52
  140. package/skills/mindlore-log/SKILL.md +12 -143
  141. package/skills/mindlore-maintain/SKILL.md +119 -0
  142. package/skills/mindlore-query/SKILL.md +9 -0
  143. package/skills/mindlore-reflect/SKILL.md +131 -0
  144. package/templates/config.json +8 -1
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: mindlore-diary
3
+ description: LLM-powered session analysis — decisions, discoveries, frictions, learnings. Promotes episodes to semantic knowledge.
4
+ ---
5
+
6
+ ## Script Resolution
7
+
8
+ All script paths are relative to this skill's package root.
9
+ Package root = 2 directories up from this skill's base directory.
10
+
11
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-diary".
12
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
13
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
14
+
15
+ # /mindlore-diary
16
+
17
+ ## Scope
18
+
19
+ Determine target using `getActiveMindloreDir()` logic:
20
+ - If CWD has `.mindlore/` -> project scope
21
+ - Otherwise -> global `~/.mindlore/`
22
+
23
+ ## Trigger
24
+
25
+ `/mindlore-diary` or `/mindlore-log diary`
26
+
27
+ ## On Start — Read skill_memory
28
+
29
+ ```bash
30
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-diary last_diary_date
31
+ ```
32
+ If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
33
+
34
+ ## Flow
35
+
36
+ 1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
37
+ 2. Filter by time: default last 24h, or `--days N` flag
38
+ 3. Present summary: "Found N episodes spanning DATE1 to DATE2"
39
+ 4. LLM analyzes episodes for semantic patterns:
40
+ - **Decisions:** choices made, alternatives considered
41
+ - **Discoveries:** new insights, broken assumptions
42
+ - **Frictions:** recurring blockers, errors, slowdowns
43
+ - **Learnings:** techniques that worked, patterns validated
44
+ - **Preferences:** user workflow preferences detected
45
+ - **Events:** notable milestones, completions
46
+
47
+ 5. For each detected item, create enriched episode:
48
+ ```sql
49
+ INSERT INTO episodes (summary, body, kind, source, status, project, created_at)
50
+ VALUES (?, ?, ?, 'diary', 'active', ?, ?)
51
+ ```
52
+ Where kind = 'decision' | 'discovery' | 'friction' | 'learning' | 'preference' | 'event'
53
+
54
+ 6. Output structured report:
55
+ ```
56
+ -- Diary Raporu ({date}, {N} episode analiz edildi) --
57
+
58
+ Decisions ({count}):
59
+ - {summary}
60
+
61
+ Discoveries ({count}):
62
+ - {summary}
63
+
64
+ Frictions ({count}):
65
+ - {summary}
66
+
67
+ Learnings ({count}):
68
+ - {summary}
69
+
70
+ {M} yeni episode olusturuldu.
71
+ ```
72
+
73
+ ## On End — Write skill_memory
74
+
75
+ ```bash
76
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-diary last_diary_date "$(date -I)"
77
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-diary last_episode_count "{N}"
78
+ ```
79
+
80
+ ## Rules
81
+
82
+ - NEVER create episodes without user seeing the analysis first
83
+ - Each episode must have proper `kind` field — don't default everything to 'event'
84
+ - Group related items — don't create 5 episodes for the same friction
85
+ - Append to `log.md`: `| {date} | diary | {N} episodes created |`
@@ -5,6 +5,15 @@ effort: medium
5
5
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
6
6
  ---
7
7
 
8
+ ## Script Resolution
9
+
10
+ All script paths are relative to this skill's package root.
11
+ Package root = 2 directories up from this skill's base directory.
12
+
13
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-evolve".
14
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
+
8
17
  # /mindlore-evolve
9
18
 
10
19
  Knowledge schema co-evolution. Karpathy's 4th operation (ingest/query/health/**evolve**).
@@ -30,6 +39,20 @@ User says `/mindlore-evolve`, "knowledge evolve", "bilgi sistemi evrimle", "sema
30
39
 
31
40
  Scan all domains and sources for inconsistencies.
32
41
 
42
+ **Pre-check (before scan):**
43
+
44
+ Before spawning the agent, check KB maturity:
45
+ ```bash
46
+ # Count domains and sources
47
+ DOMAIN_COUNT=$(ls ~/.mindlore/domains/ 2>/dev/null | grep -c '.md$' || echo 0)
48
+ SOURCE_COUNT=$(ls ~/.mindlore/sources/ 2>/dev/null | grep -c '.md$' || echo 0)
49
+ ```
50
+
51
+ If `DOMAIN_COUNT == 0`:
52
+ - Show: "Fresh KB detected (0 domains, N sources). Evolve works best with at least 1 domain. Run `/mindlore-ingest` to add sources, then manually create domain files to organize them."
53
+ - If `SOURCE_COUNT < 3`: Show "Too few sources for meaningful evolution scan. Add more knowledge first." and STOP.
54
+ - If `SOURCE_COUNT >= 3` but 0 domains: Show warning but continue scan — findings will be limited to orphan/tag checks.
55
+
33
56
  **Agent Delegation:** Tarama işini subagent'a delege et (context koruma).
34
57
 
35
58
  **Flow:**
@@ -84,7 +107,7 @@ Apply suggested changes with user approval.
84
107
  **Rules:**
85
108
  - NEVER make automatic changes — always require user approval
86
109
  - Show diff preview before applying
87
- - After changes, run `node dist/scripts/mindlore-fts5-index.js` for FTS5 sync
110
+ - After changes, run `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-index.js"` for FTS5 sync
88
111
  - Log every change to log.md with timestamp
89
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)
90
113
 
@@ -5,6 +5,15 @@ effort: low
5
5
  allowed-tools: [Bash, Read]
6
6
  ---
7
7
 
8
+ ## Script Resolution
9
+
10
+ All script paths are relative to this skill's package root.
11
+ Package root = 2 directories up from this skill's base directory.
12
+
13
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-health".
14
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
+
8
17
  # /mindlore-health
9
18
 
10
19
  Run the 16-point structural health check on the `.mindlore/` knowledge base.
@@ -25,7 +34,7 @@ User says "health check", "mindlore health", "bilgi sistemi kontrol", "saglik ko
25
34
 
26
35
  1. Run the health check script:
27
36
  ```bash
28
- node scripts/mindlore-health-check.cjs
37
+ node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
29
38
  ```
30
39
 
31
40
  2. Read the output and provide LLM interpretation:
@@ -3,8 +3,19 @@ name: mindlore-ingest
3
3
  description: Add new knowledge sources to .mindlore/ (URL, text, file, PDF, GitHub repo)
4
4
  effort: medium
5
5
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch]
6
+ context: fork
7
+ agent: coder
6
8
  ---
7
9
 
10
+ ## Script Resolution
11
+
12
+ All script paths are relative to this skill's package root.
13
+ Package root = 2 directories up from this skill's base directory.
14
+
15
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-ingest".
16
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
17
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
18
+
8
19
  # /mindlore-ingest
9
20
 
10
21
  Add a new knowledge source to the `.mindlore/` knowledge base.
@@ -23,60 +34,51 @@ User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki
23
34
 
24
35
  ## Modes
25
36
 
26
- ### URL Mode
37
+ ### URL Mode (v0.5.2 — Zero-Token Pipeline)
27
38
 
28
- **Agent Delegation:** URL fetch + raw/sources yazımını subagent'a delege et (maliyet optimizasyonu).
39
+ **Trigger:** Input starts with `http://` or `https://`
29
40
 
30
- 1. Spawn an Agent with the following pattern:
41
+ **Pre-check (before fetch):**
42
+ ```bash
43
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-ingest last_ingest_urls
44
+ ```
45
+ If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
46
+
47
+ **Flow:**
48
+
49
+ 1. **Fetch raw content (zero token):**
50
+ ```bash
51
+ node "$MINDLORE_PKG/dist/scripts/fetch-raw.js" "$URL" --out-dir "$MINDLORE_DIR/raw"
31
52
  ```
32
- Agent({
33
- description: "mindlore ingest: <slug>",
34
- subagent_type: "researcher",
35
- prompt: "[mindlore:ingest] <aşağıdaki talimatları buraya koy>"
36
- })
53
+ Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
54
+
55
+ 2. **Read first 3000 chars (heading-aware truncation):**
56
+ - Read the saved raw file
57
+ - Find the last `##` heading before char 3000
58
+ - Truncate at that heading boundary (not mid-paragraph)
59
+ - If no heading found before 3000, truncate at last paragraph break
60
+
61
+ 3. **Write sources/ summary from truncated content:**
62
+ - Extract: title, description (first paragraph), key topics
63
+ - Generate frontmatter: slug, type: source, source_url, date_captured, tags, quality
64
+ - `source_type` is auto-detected from URL pattern (see Source Summary Format)
65
+ - Write to `$MINDLORE_DIR/sources/{slug}.md`
66
+
67
+ 4. **Update INDEX.md** with new source entry
68
+
69
+ 5. **Update skill_memory:**
70
+ ```bash
71
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-ingest last_ingest_urls "$URL"
37
72
  ```
38
73
 
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).
74
+ 6. **Return to caller (this is all the ana session sees):**
75
+ ```json
76
+ { "source_id": "abc123", "title": "Extracted Title" }
77
+ ```
78
+
79
+ **Token budget:** ~2-3k tokens in fork context (vs ~40-50k before). Ana session: ~50 tokens.
80
+
81
+ **Fallback:** If fetch-raw.js fails (network error, unsupported format), fall back to existing WebFetch-based flow with warning: "Zero-token fetch failed, using legacy flow (higher token cost)."
80
82
 
81
83
  ### Text Mode
82
84
  1. User pastes text directly
@@ -103,6 +105,16 @@ The sources/ file should contain:
103
105
  - **Relevance to project** (why this matters)
104
106
  - **Related** links to other sources/domains in .mindlore/
105
107
 
108
+ Required frontmatter fields include `source_type` — auto-detected:
109
+ - `github-repo` if URL contains `github.com/{owner}/{repo}` (not a file/blob URL)
110
+ - `docs` if URL contains `/docs/`, `/documentation/`, or `/api/`
111
+ - `blog` if URL contains `/blog/`, `/post/`, or `/article/`
112
+ - `video` if URL contains `youtube.com`, `youtu.be`, or `vimeo.com`
113
+ - `url-fetch` as default fallback for all other URLs
114
+ - `text-paste` for Text Mode
115
+ - `pdf` for PDF Mode
116
+ - `file` for File Mode
117
+
106
118
  ## Quality Assessment
107
119
 
108
120
  Assign quality automatically during ingest using this heuristic:
@@ -133,7 +145,7 @@ After every ingest, verify all 7 checkpoints before reporting success:
133
145
 
134
146
  0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
135
147
  ```bash
136
- node dist/scripts/lib/similarity.js "<title or first 100 chars>"
148
+ node "$MINDLORE_PKG/dist/scripts/lib/similarity.js" "<title or first 100 chars>"
137
149
  ```
138
150
  Eğer score > 0.7 olan sonuç varsa KULLANICIYA SOR: "Bu içerik '${slug}' ile benzer görünüyor. Yine de eklensin mi?"
139
151
  Kullanıcı onaylarsa devam et, yoksa atla.
@@ -142,11 +154,11 @@ After every ingest, verify all 7 checkpoints before reporting success:
142
154
  3. **INDEX.md updated** — stats line incremented, Recent section has new entry
143
155
  4. **Domain updated** — if relevant domain exists, new finding added (max 1 domain per ingest)
144
156
  5. **log.md entry** — append `| {date} | ingest | {slug}.md |`
145
- 6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node scripts/mindlore-fts5-search.cjs "{keyword}"` returns the new file
157
+ 6. **FTS5 indexed** — FileChanged hook auto-triggers, but verify: `node "$MINDLORE_PKG/dist/scripts/mindlore-fts5-search.js" "{keyword}"` returns the new file
146
158
 
147
159
  If any checkpoint fails, fix it before reporting "ingest complete". Do NOT skip steps.
148
160
 
149
161
  Optional: run full health check for structural integrity:
150
162
  ```bash
151
- node scripts/mindlore-health-check.cjs
163
+ node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
152
164
  ```
@@ -2,6 +2,15 @@
2
2
 
3
3
  Session logging, pattern extraction, and wiki updates.
4
4
 
5
+ ## Script Resolution
6
+
7
+ All script paths are relative to this skill's package root.
8
+ Package root = 2 directories up from this skill's base directory.
9
+
10
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-log".
11
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
12
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
13
+
5
14
  ## Scope
6
15
 
7
16
  Determine target using `getActiveMindloreDir()` logic:
@@ -12,7 +21,9 @@ Determine target using `getActiveMindloreDir()` logic:
12
21
 
13
22
  ## Trigger
14
23
 
15
- `/mindlore-log <mode>` where mode is `log`, `diary`, `reflect`, `status`, or `save`.
24
+ `/mindlore-log <mode>` where mode is `log`, `status`, or `save`.
25
+
26
+ For diary analysis, use `/mindlore-diary`. For pattern extraction, use `/mindlore-reflect`.
16
27
 
17
28
  ## Modes
18
29
 
@@ -36,148 +47,6 @@ date: 2026-04-11
36
47
  4. Body: user's note as-is
37
48
  5. Append to `log.md`: `| {date} | log | {slug}.md |`
38
49
 
39
- ### diary
40
-
41
- LLM-driven session analysis → enriched episodes in the episodes table.
42
-
43
- **Trigger:** User runs `/mindlore-log diary` or Stop hook asks "Diary analizi yapayım mı?"
44
-
45
- **Model:** `[mindlore:diary]` marker → sonnet (analysis needed)
46
-
47
- **Flow:**
48
- 1. Open `~/.mindlore/mindlore.db`, ensure episodes table exists
49
- 2. Find the latest bare session episode for current project: `WHERE kind = 'session' AND project = ? AND source = 'hook' ORDER BY created_at DESC LIMIT 1`
50
- 3. Gather context:
51
- - The bare episode's body (commits, files, read stats)
52
- - Git log last 10 commits
53
- - Decision-detector captures (if any in session)
54
- 4. LLM analyzes and extracts structured episodes:
55
- - **Decisions** → `kind: 'decision'` — architectural/tool/format choices
56
- - **Discoveries** → `kind: 'discovery'` — assumption vs reality findings
57
- - **Frictions** → `kind: 'friction'` — tool errors, blockers, recurring issues
58
- - **Learnings** → `kind: 'learning'` — reusable knowledge
59
- - **Preferences** → `kind: 'preference'` — user behavioral preferences
60
- - **Events** → `kind: 'event'` — releases, incidents, milestones
61
- 5. **Deduplication rule:** Each finding belongs to exactly ONE kind. Priority: `decision > discovery > friction > learning > preference > event`. Never write the same finding to multiple kinds.
62
- 6. Present to user, get approval
63
- 7. Write approved episodes to DB:
64
- - `source: 'diary'`
65
- - `parent_id: {bare_session_episode_id}` — links enriched episodes to source session
66
- - `scope: 'project'` (default) or `'global'` if cross-project
67
- 8. Optionally mirror to FTS5 for text search
68
- 9. Append to `log.md`: `| {date} | diary | {N} episodes extracted from session |`
69
-
70
- **Rules:**
71
- - NEVER write episodes without user approval
72
- - parent_id always points to the source session episode
73
- - Each episode gets its own summary (max 100 chars) and body (markdown, unbounded)
74
- - entities field: JSON array of relevant file paths (max 10)
75
-
76
- ### reflect
77
-
78
- LLM-driven pattern extraction from episodes → persistent learnings.
79
-
80
- **Flow (v0.4 — episodes-powered):**
81
- 1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
82
- 2. Optionally filter by time: `--days 7` (default 7), `--days 30`
83
- 3. Present summary: "Found N episodes spanning DATE1 to DATE2"
84
- 4. LLM analyzes episodes (not deltas) for patterns:
85
- - Repeated decisions (same choice 2+ times)
86
- - Recurring frictions (same blocker/error)
87
- - Discovery patterns (assumptions that keep breaking)
88
- - Workflow patterns that worked well
89
- 5. **3-Tier Confidence Assessment:**
90
- For each detected pattern, count occurrences across episodes:
91
-
92
- | Tekrar | Tier | Aksiyon |
93
- |--------|------|---------|
94
- | 1x | Note | Sessiz — episode olarak kalır, raporda göster |
95
- | 2x | Learning | `kind: learning` episode oluştur, learnings/ dosyasına yaz |
96
- | 3x+ | Nomination | `kind: nomination, status: staged, source: reflect` episode oluştur |
97
-
98
- 6. **Structured report output:**
99
-
100
- ```
101
- ── Reflect Raporu (son {days} gün, {N} episode) ──
102
-
103
- Friction ({count}):
104
- - {summary} — {repeat_count}x tekrar
105
-
106
- Discoveries ({count}):
107
- - {summary}
108
-
109
- Decisions ({count}):
110
- - {summary}
111
-
112
- Patterns:
113
- - "CO-EVOLUTION sync hatası" → 3x tekrar → NOMINATION (staged)
114
- - "ESM import sorunu" → 2x tekrar → LEARNING
115
- - "Test mock karmaşıklığı" → 1x → NOTE
116
-
117
- Önerilen:
118
- [ ] {rule} ({repeat_count}x, {confidence} confidence)
119
- ```
120
-
121
- 7. **Nomination oluşturma (3x+ tekrar):**
122
- - `kind: nomination`, `status: staged`, `source: reflect`
123
- - Body formatı:
124
- ```markdown
125
- ## Target: learnings
126
- ## Rule
127
- YAPMA: Schema değişikliğinde tek dosyayı güncelleme — CO-EVOLUTION sync zorunlu
128
- ## Evidence
129
- - ep-xxx: episodes.ts güncellendi ama common.cjs unutuldu (2026-04-10)
130
- - ep-yyy: Aynı hata tekrar (2026-04-12)
131
- - ep-zzz: Test'te yakalandı (2026-04-13)
132
- ## Confidence
133
- 3x tekrar, 3 gün içinde
134
- ```
135
- - Target options: `learnings` | `claude.md` | `domain:{slug}`
136
-
137
- 8. **Pending nominations check:**
138
- Reflect başlarken staged nomination'ları kontrol et:
139
- ```sql
140
- SELECT id, summary, body, created_at FROM episodes
141
- WHERE kind = 'nomination' AND status = 'staged' AND project = ?
142
- ORDER BY created_at ASC
143
- ```
144
- Varsa kullanıcıya sun:
145
- ```
146
- ── Bekleyen Nomination'lar ({N} adet) ──
147
- 1. "CO-EVOLUTION sync zorunlu" (staged 2 gün önce)
148
- Target: learnings | Confidence: 3x
149
- 2. "Test before commit" (staged 5 gün önce)
150
- Target: claude.md | Confidence: 4x
151
-
152
- Onaylamak istediğin numara(lar)ı seç, veya 'skip' de:
153
- ```
154
-
155
- 9. **Nomination approval flow:**
156
- Kullanıcı onaylarsa:
157
- - `status: staged → approved`
158
- - Target'a göre yaz:
159
- - `learnings` → ilgili `learnings/{topic}.md` dosyasına YAPMA/BEST PRACTICE ekle
160
- - `claude.md` → ilgili projenin CLAUDE.md'sine kural ekle (kullanıcıya göster, onay al)
161
- - `domain:{slug}` → ilgili domain sayfasına ekle
162
- Kullanıcı reddederse:
163
- - `status: staged → rejected`
164
- - Body'ye `## Rejection Reason\n{kullanıcı açıklaması}` ekle
165
-
166
- 10. User approves new learnings → write to `learnings/{topic}.md`
167
- 11. Format: `YAPMA:` / `BEST PRACTICE:` / `KRITIK:` prefixed rules
168
- 12. Update relevant domain page if pattern relates to an existing domain
169
- 13. Mark processed episodes: future reflect skips already-processed timeranges
170
- 14. Append to `log.md`: `| {date} | reflect | {N} episodes processed, {M} learnings written |`
171
-
172
- **Fallback:** Also reads non-archived delta files if episodes table is empty (backward compat with v0.3 deltas).
173
-
174
- **Rules:**
175
- - NEVER write learnings or nominations without user approval
176
- - Group related patterns into existing topic files (don't create one file per pattern)
177
- - Reflect scans both project + global diary/ in `--all` mode
178
- - Deduplication: same pattern found in both episodes and deltas → episodes win
179
- - Nominations with `status: staged` are hidden from default queries — only reflect sees them
180
-
181
50
  ### status
182
51
 
183
52
  Show recent session summary.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: mindlore-maintain
3
+ description: KB maintenance — decay/archive, episode consolidation, contradiction detection
4
+ effort: medium
5
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
6
+ ---
7
+
8
+ ## Script Resolution
9
+
10
+ All script paths are relative to this skill's package root.
11
+ Package root = 2 directories up from this skill's base directory.
12
+
13
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-maintain".
14
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
15
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
16
+
17
+ # /mindlore-maintain
18
+
19
+ KB bakım skill'i. Reflect düşünür, maintain temizler.
20
+
21
+ ## Trigger
22
+
23
+ - `/mindlore-maintain` — full rapor (decay + consolidation + contradiction)
24
+ - `/mindlore-maintain decay` — stale doc listesi + archive flow
25
+ - `/mindlore-maintain consolidate` — episode gruplama + dosyaya promote
26
+ - `/mindlore-maintain contradictions` — çelişki analizi
27
+
28
+ ## Decay Mode
29
+
30
+ 1. Stale documents listele:
31
+ ```bash
32
+ DECAY_MOD="$MINDLORE_PKG/dist/scripts/lib/decay.js"
33
+ node -e "
34
+ const { listStaleDocuments } = require(process.argv[1]);
35
+ const Database = require('better-sqlite3');
36
+ const path = require('path'), os = require('os');
37
+ const dbPath = path.join(os.homedir(), '.mindlore', 'mindlore.db');
38
+ const db = new Database(dbPath, {readonly: true});
39
+ const stale = listStaleDocuments(db);
40
+ console.log(JSON.stringify(stale, null, 2));
41
+ db.close();
42
+ " "$DECAY_MOD"
43
+ ```
44
+
45
+ 2. Rapor sun:
46
+ ```
47
+ -- Decay Report --
48
+ | # | File | Score | Last Access | Recalls | Action |
49
+ |---|------|-------|-------------|---------|--------|
50
+ | 1 | sources/old-api.md | 0.12 | 2025-11-01 | 0 | Archive? |
51
+ ```
52
+
53
+ 3. Kullanıcı onaylarsa:
54
+ a. Git snapshot: `createPreEvictionTag`
55
+ b. Arşivle: `archiveDocument(db, path)`
56
+ c. Rapor: "Archived N docs. Git tag: pre-eviction-2026-04-18. Restore: `/mindlore-maintain restore <path>`"
57
+
58
+ **Kurallar:**
59
+ - Onay almadan ARŞİVLEME
60
+ - Arşiv öncesi HER ZAMAN git snapshot
61
+ - Score + last access + recall count göster
62
+
63
+ ## Consolidation Mode
64
+
65
+ 1. Raw episode sayısını kontrol et
66
+ 2. Gruplama önerisi sun:
67
+ ```
68
+ -- Consolidation Önerisi --
69
+ 3 learning episode → learnings/typescript-strict-patterns.md
70
+ 2 discovery episode → insights/sqlite-vec-windows-gotchas.md
71
+ ```
72
+
73
+ 3. Kind→dizin mapping (deterministik):
74
+ - learning → `learnings/`
75
+ - discovery → `insights/`
76
+ - friction → `analyses/`
77
+ - decision → `decisions/`
78
+ - preference → CC memory'de var mı kontrol et, varsa skip, yoksa `learnings/`
79
+
80
+ 4. Kullanıcı onaylarsa:
81
+ a. Hedef dosya yaz (frontmatter zorunlu: consolidated_from, consolidated_at, kind_source)
82
+ b. Episode'ları işaretle: `markConsolidated(db, ids, targetFile)`
83
+ c. Rapor: "N episode → M dosya promote edildi"
84
+
85
+ **Kurallar:**
86
+ - session/event episode'ları CONSOLİDATE EDİLMEZ
87
+ - Onay almadan dosya YAZMA
88
+ - `consolidated_from` frontmatter ZORUNLU (provenance)
89
+
90
+ ## Contradiction Mode
91
+
92
+ 1. Deterministic wiki-lint:
93
+ ```bash
94
+ node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js" ~/.mindlore 2>/dev/null | grep -A 5 'contradiction'
95
+ ```
96
+
97
+ 2. Semantic analiz (opsiyonel, token harcar)
98
+
99
+ **Kurallar:**
100
+ - Deterministic check HER ZAMAN çalışır
101
+ - Çelişkileri OTOMATİK düzeltme — kullanıcıya sor
102
+
103
+ ## Full Report Mode (flagsız)
104
+
105
+ ```
106
+ -- Maintain Report --
107
+ Decay: 3 stale document (score < 0.3)
108
+ Consolidation: 52 raw episode (learning: 15, discovery: 8, friction: 4)
109
+ Contradictions: 1 found
110
+
111
+ Aksiyon için:
112
+ /mindlore-maintain decay
113
+ /mindlore-maintain consolidate
114
+ /mindlore-maintain contradictions
115
+ ```
116
+
117
+ ## Restore Mode
118
+
119
+ `/mindlore-maintain restore <path>` — arşivlenmiş dokümanı geri yükler.
@@ -2,6 +2,15 @@
2
2
 
3
3
  Search, ask, analyze, and retrieve knowledge from `.mindlore/`.
4
4
 
5
+ ## Script Resolution
6
+
7
+ All script paths are relative to this skill's package root.
8
+ Package root = 2 directories up from this skill's base directory.
9
+
10
+ When CC loads this skill, it shows "Base directory for this skill: /path/to/skills/mindlore-query".
11
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
12
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
13
+
5
14
  ## Scope
6
15
 
7
16
  Determine search scope using `getActiveMindloreDir()` / `getAllDbs()` logic: