mindlore 0.5.0 → 0.5.2

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 (149) hide show
  1. package/README.md +15 -2
  2. package/dist/scripts/fetch-raw.d.ts +2 -0
  3. package/dist/scripts/fetch-raw.d.ts.map +1 -0
  4. package/dist/scripts/fetch-raw.js +124 -0
  5. package/dist/scripts/fetch-raw.js.map +1 -0
  6. package/dist/scripts/init.js +45 -3
  7. package/dist/scripts/init.js.map +1 -1
  8. package/dist/scripts/lib/constants.d.ts +13 -0
  9. package/dist/scripts/lib/constants.d.ts.map +1 -1
  10. package/dist/scripts/lib/constants.js +24 -4
  11. package/dist/scripts/lib/constants.js.map +1 -1
  12. package/dist/scripts/lib/db-helpers.d.ts +12 -2
  13. package/dist/scripts/lib/db-helpers.d.ts.map +1 -1
  14. package/dist/scripts/lib/db-helpers.js +36 -0
  15. package/dist/scripts/lib/db-helpers.js.map +1 -1
  16. package/dist/scripts/lib/hybrid-search.d.ts +0 -2
  17. package/dist/scripts/lib/hybrid-search.d.ts.map +1 -1
  18. package/dist/scripts/lib/hybrid-search.js +7 -1
  19. package/dist/scripts/lib/hybrid-search.js.map +1 -1
  20. package/dist/scripts/lib/migrations-v051.d.ts +3 -0
  21. package/dist/scripts/lib/migrations-v051.d.ts.map +1 -0
  22. package/dist/scripts/lib/migrations-v051.js +24 -0
  23. package/dist/scripts/lib/migrations-v051.js.map +1 -0
  24. package/dist/scripts/lib/migrations-v052.d.ts +3 -0
  25. package/dist/scripts/lib/migrations-v052.d.ts.map +1 -0
  26. package/dist/scripts/lib/migrations-v052.js +23 -0
  27. package/dist/scripts/lib/migrations-v052.js.map +1 -0
  28. package/dist/scripts/lib/migrations.d.ts +1 -0
  29. package/dist/scripts/lib/migrations.d.ts.map +1 -1
  30. package/dist/scripts/lib/migrations.js +3 -1
  31. package/dist/scripts/lib/migrations.js.map +1 -1
  32. package/dist/scripts/lib/privacy-filter.d.ts +3 -0
  33. package/dist/scripts/lib/privacy-filter.d.ts.map +1 -0
  34. package/dist/scripts/lib/privacy-filter.js +28 -0
  35. package/dist/scripts/lib/privacy-filter.js.map +1 -0
  36. package/dist/scripts/lib/similarity.d.ts +12 -0
  37. package/dist/scripts/lib/similarity.d.ts.map +1 -0
  38. package/dist/scripts/lib/similarity.js +64 -0
  39. package/dist/scripts/lib/similarity.js.map +1 -0
  40. package/dist/scripts/lib/skeleton.d.ts +2 -0
  41. package/dist/scripts/lib/skeleton.d.ts.map +1 -0
  42. package/dist/scripts/lib/skeleton.js +99 -0
  43. package/dist/scripts/lib/skeleton.js.map +1 -0
  44. package/dist/scripts/lib/skill-memory.d.ts +13 -0
  45. package/dist/scripts/lib/skill-memory.d.ts.map +1 -0
  46. package/dist/scripts/lib/skill-memory.js +94 -0
  47. package/dist/scripts/lib/skill-memory.js.map +1 -0
  48. package/dist/scripts/mindlore-fts5-index.js +18 -3
  49. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  50. package/dist/scripts/mindlore-health-check.d.ts +1 -1
  51. package/dist/scripts/mindlore-health-check.d.ts.map +1 -1
  52. package/dist/scripts/mindlore-health-check.js +117 -96
  53. package/dist/scripts/mindlore-health-check.js.map +1 -1
  54. package/dist/scripts/quality-populate.js +8 -4
  55. package/dist/scripts/quality-populate.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-sync.test.d.ts +2 -0
  61. package/dist/tests/cc-memory-sync.test.d.ts.map +1 -0
  62. package/dist/tests/cc-memory-sync.test.js +121 -0
  63. package/dist/tests/cc-memory-sync.test.js.map +1 -0
  64. package/dist/tests/episode-file.test.d.ts +2 -0
  65. package/dist/tests/episode-file.test.d.ts.map +1 -0
  66. package/dist/tests/episode-file.test.js +82 -0
  67. package/dist/tests/episode-file.test.js.map +1 -0
  68. package/dist/tests/fetch-raw.test.d.ts +2 -0
  69. package/dist/tests/fetch-raw.test.d.ts.map +1 -0
  70. package/dist/tests/fetch-raw.test.js +43 -0
  71. package/dist/tests/fetch-raw.test.js.map +1 -0
  72. package/dist/tests/helpers/db.d.ts +1 -0
  73. package/dist/tests/helpers/db.d.ts.map +1 -1
  74. package/dist/tests/helpers/db.js +10 -0
  75. package/dist/tests/helpers/db.js.map +1 -1
  76. package/dist/tests/hook-logging.test.d.ts +2 -0
  77. package/dist/tests/hook-logging.test.d.ts.map +1 -0
  78. package/dist/tests/hook-logging.test.js +108 -0
  79. package/dist/tests/hook-logging.test.js.map +1 -0
  80. package/dist/tests/index-cli-embed.test.d.ts +7 -0
  81. package/dist/tests/index-cli-embed.test.d.ts.map +1 -0
  82. package/dist/tests/index-cli-embed.test.js +128 -0
  83. package/dist/tests/index-cli-embed.test.js.map +1 -0
  84. package/dist/tests/privacy-filter.test.d.ts +2 -0
  85. package/dist/tests/privacy-filter.test.d.ts.map +1 -0
  86. package/dist/tests/privacy-filter.test.js +56 -0
  87. package/dist/tests/privacy-filter.test.js.map +1 -0
  88. package/dist/tests/resolve-hook-common.test.d.ts +2 -0
  89. package/dist/tests/resolve-hook-common.test.d.ts.map +1 -0
  90. package/dist/tests/resolve-hook-common.test.js +30 -0
  91. package/dist/tests/resolve-hook-common.test.js.map +1 -0
  92. package/dist/tests/schema-version.test.js +28 -0
  93. package/dist/tests/schema-version.test.js.map +1 -1
  94. package/dist/tests/search-cli-hybrid.test.d.ts +6 -0
  95. package/dist/tests/search-cli-hybrid.test.d.ts.map +1 -0
  96. package/dist/tests/search-cli-hybrid.test.js +103 -0
  97. package/dist/tests/search-cli-hybrid.test.js.map +1 -0
  98. package/dist/tests/search-hook.test.js +33 -0
  99. package/dist/tests/search-hook.test.js.map +1 -1
  100. package/dist/tests/search-offload.test.d.ts +2 -0
  101. package/dist/tests/search-offload.test.d.ts.map +1 -0
  102. package/dist/tests/search-offload.test.js +34 -0
  103. package/dist/tests/search-offload.test.js.map +1 -0
  104. package/dist/tests/similarity.test.d.ts +2 -0
  105. package/dist/tests/similarity.test.d.ts.map +1 -0
  106. package/dist/tests/similarity.test.js +61 -0
  107. package/dist/tests/similarity.test.js.map +1 -0
  108. package/dist/tests/skeleton.test.d.ts +2 -0
  109. package/dist/tests/skeleton.test.d.ts.map +1 -0
  110. package/dist/tests/skeleton.test.js +116 -0
  111. package/dist/tests/skeleton.test.js.map +1 -0
  112. package/dist/tests/skill-memory-api.test.d.ts +2 -0
  113. package/dist/tests/skill-memory-api.test.d.ts.map +1 -0
  114. package/dist/tests/skill-memory-api.test.js +62 -0
  115. package/dist/tests/skill-memory-api.test.js.map +1 -0
  116. package/dist/tests/skill-memory.test.d.ts +2 -0
  117. package/dist/tests/skill-memory.test.d.ts.map +1 -0
  118. package/dist/tests/skill-memory.test.js +67 -0
  119. package/dist/tests/skill-memory.test.js.map +1 -0
  120. package/dist/tests/token-budget.test.d.ts +2 -0
  121. package/dist/tests/token-budget.test.d.ts.map +1 -0
  122. package/dist/tests/token-budget.test.js +32 -0
  123. package/dist/tests/token-budget.test.js.map +1 -0
  124. package/dist/tests/wiki-lint.test.d.ts +2 -0
  125. package/dist/tests/wiki-lint.test.d.ts.map +1 -0
  126. package/dist/tests/wiki-lint.test.js +47 -0
  127. package/dist/tests/wiki-lint.test.js.map +1 -0
  128. package/hooks/lib/mindlore-common.cjs +109 -2
  129. package/hooks/mindlore-cwd-changed.cjs +2 -2
  130. package/hooks/mindlore-decision-detector.cjs +2 -2
  131. package/hooks/mindlore-dont-repeat.cjs +2 -2
  132. package/hooks/mindlore-fts5-sync.cjs +2 -2
  133. package/hooks/mindlore-index.cjs +141 -3
  134. package/hooks/mindlore-model-router.cjs +2 -2
  135. package/hooks/mindlore-post-compact.cjs +2 -2
  136. package/hooks/mindlore-post-read.cjs +2 -2
  137. package/hooks/mindlore-pre-compact.cjs +2 -2
  138. package/hooks/mindlore-read-guard.cjs +15 -3
  139. package/hooks/mindlore-research-guard.cjs +2 -2
  140. package/hooks/mindlore-search.cjs +69 -41
  141. package/hooks/mindlore-session-end.cjs +129 -39
  142. package/hooks/mindlore-session-focus.cjs +24 -3
  143. package/package.json +6 -5
  144. package/plugin.json +29 -2
  145. package/skills/mindlore-diary/SKILL.md +76 -0
  146. package/skills/mindlore-ingest/SKILL.md +48 -50
  147. package/skills/mindlore-log/SKILL.md +3 -143
  148. package/skills/mindlore-reflect/SKILL.md +104 -0
  149. package/templates/config.json +6 -1
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: mindlore-diary
3
+ description: LLM-powered session analysis — decisions, discoveries, frictions, learnings. Promotes episodes to semantic knowledge.
4
+ ---
5
+
6
+ # /mindlore-diary
7
+
8
+ ## Scope
9
+
10
+ Determine target using `getActiveMindloreDir()` logic:
11
+ - If CWD has `.mindlore/` -> project scope
12
+ - Otherwise -> global `~/.mindlore/`
13
+
14
+ ## Trigger
15
+
16
+ `/mindlore-diary` or `/mindlore-log diary`
17
+
18
+ ## On Start — Read skill_memory
19
+
20
+ ```bash
21
+ node dist/scripts/lib/skill-memory.js get mindlore-diary last_diary_date
22
+ ```
23
+ If last_diary_date is today, warn: "Diary already ran today. Continue anyway?"
24
+
25
+ ## Flow
26
+
27
+ 1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
28
+ 2. Filter by time: default last 24h, or `--days N` flag
29
+ 3. Present summary: "Found N episodes spanning DATE1 to DATE2"
30
+ 4. LLM analyzes episodes for semantic patterns:
31
+ - **Decisions:** choices made, alternatives considered
32
+ - **Discoveries:** new insights, broken assumptions
33
+ - **Frictions:** recurring blockers, errors, slowdowns
34
+ - **Learnings:** techniques that worked, patterns validated
35
+ - **Preferences:** user workflow preferences detected
36
+ - **Events:** notable milestones, completions
37
+
38
+ 5. For each detected item, create enriched episode:
39
+ ```sql
40
+ INSERT INTO episodes (summary, body, kind, source, status, project, created_at)
41
+ VALUES (?, ?, ?, 'diary', 'active', ?, ?)
42
+ ```
43
+ Where kind = 'decision' | 'discovery' | 'friction' | 'learning' | 'preference' | 'event'
44
+
45
+ 6. Output structured report:
46
+ ```
47
+ -- Diary Raporu ({date}, {N} episode analiz edildi) --
48
+
49
+ Decisions ({count}):
50
+ - {summary}
51
+
52
+ Discoveries ({count}):
53
+ - {summary}
54
+
55
+ Frictions ({count}):
56
+ - {summary}
57
+
58
+ Learnings ({count}):
59
+ - {summary}
60
+
61
+ {M} yeni episode olusturuldu.
62
+ ```
63
+
64
+ ## On End — Write skill_memory
65
+
66
+ ```bash
67
+ node dist/scripts/lib/skill-memory.js set mindlore-diary last_diary_date "$(date -I)"
68
+ node dist/scripts/lib/skill-memory.js set mindlore-diary last_episode_count "{N}"
69
+ ```
70
+
71
+ ## Rules
72
+
73
+ - NEVER create episodes without user seeing the analysis first
74
+ - Each episode must have proper `kind` field — don't default everything to 'event'
75
+ - Group related items — don't create 5 episodes for the same friction
76
+ - Append to `log.md`: `| {date} | diary | {N} episodes created |`
@@ -3,6 +3,8 @@ 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
 
8
10
  # /mindlore-ingest
@@ -23,60 +25,50 @@ User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki
23
25
 
24
26
  ## Modes
25
27
 
26
- ### URL Mode
28
+ ### URL Mode (v0.5.2 — Zero-Token Pipeline)
27
29
 
28
- **Agent Delegation:** URL fetch + raw/sources yazımını subagent'a delege et (maliyet optimizasyonu).
30
+ **Trigger:** Input starts with `http://` or `https://`
29
31
 
30
- 1. Spawn an Agent with the following pattern:
32
+ **Pre-check (before fetch):**
33
+ ```bash
34
+ node dist/scripts/lib/skill-memory.js get mindlore-ingest last_ingest_urls
35
+ ```
36
+ If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
37
+
38
+ **Flow:**
39
+
40
+ 1. **Fetch raw content (zero token):**
41
+ ```bash
42
+ node dist/scripts/fetch-raw.js "$URL" --out-dir "$MINDLORE_DIR/raw"
43
+ ```
44
+ Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
45
+
46
+ 2. **Read first 3000 chars (heading-aware truncation):**
47
+ - Read the saved raw file
48
+ - Find the last `##` heading before char 3000
49
+ - Truncate at that heading boundary (not mid-paragraph)
50
+ - If no heading found before 3000, truncate at last paragraph break
51
+
52
+ 3. **Write sources/ summary from truncated content:**
53
+ - Extract: title, description (first paragraph), key topics
54
+ - Generate frontmatter: slug, type: source, source_url, date_captured, tags, quality
55
+ - Write to `$MINDLORE_DIR/sources/{slug}.md`
56
+
57
+ 4. **Update INDEX.md** with new source entry
58
+
59
+ 5. **Update skill_memory:**
60
+ ```bash
61
+ node dist/scripts/lib/skill-memory.js set mindlore-ingest last_ingest_urls "$URL"
31
62
  ```
32
- Agent({
33
- description: "mindlore ingest: <slug>",
34
- subagent_type: "researcher",
35
- prompt: "[mindlore:ingest] <aşağıdaki talimatları buraya koy>"
36
- })
63
+
64
+ 6. **Return to caller (this is all the ana session sees):**
65
+ ```json
66
+ { "source_id": "abc123", "title": "Extracted Title" }
37
67
  ```
38
68
 
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).
69
+ **Token budget:** ~2-3k tokens in fork context (vs ~40-50k before). Ana session: ~50 tokens.
70
+
71
+ **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
72
 
81
73
  ### Text Mode
82
74
  1. User pastes text directly
@@ -129,8 +121,14 @@ N source, N analysis, N total
129
121
 
130
122
  ## Post-Ingest Quality Gate
131
123
 
132
- After every ingest, verify all 6 checkpoints before reporting success:
124
+ After every ingest, verify all 7 checkpoints before reporting success:
133
125
 
126
+ 0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
127
+ ```bash
128
+ node dist/scripts/lib/similarity.js "<title or first 100 chars>"
129
+ ```
130
+ Eğer score > 0.7 olan sonuç varsa KULLANICIYA SOR: "Bu içerik '${slug}' ile benzer görünüyor. Yine de eklensin mi?"
131
+ Kullanıcı onaylarsa devam et, yoksa atla.
134
132
  1. **raw/ file exists** — immutable capture written with frontmatter (slug, type, source_url)
135
133
  2. **sources/ summary exists** — processed summary with full frontmatter (slug, type, title, tags, quality, description)
136
134
  3. **INDEX.md updated** — stats line incremented, Recent section has new entry
@@ -12,7 +12,9 @@ Determine target using `getActiveMindloreDir()` logic:
12
12
 
13
13
  ## Trigger
14
14
 
15
- `/mindlore-log <mode>` where mode is `log`, `diary`, `reflect`, `status`, or `save`.
15
+ `/mindlore-log <mode>` where mode is `log`, `status`, or `save`.
16
+
17
+ For diary analysis, use `/mindlore-diary`. For pattern extraction, use `/mindlore-reflect`.
16
18
 
17
19
  ## Modes
18
20
 
@@ -36,148 +38,6 @@ date: 2026-04-11
36
38
  4. Body: user's note as-is
37
39
  5. Append to `log.md`: `| {date} | log | {slug}.md |`
38
40
 
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
41
  ### status
182
42
 
183
43
  Show recent session summary.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: mindlore-reflect
3
+ description: Pattern extraction from episodes — 3-tier confidence, nomination pipeline, CLAUDE.md update proposals.
4
+ ---
5
+
6
+ # /mindlore-reflect
7
+
8
+ ## Scope
9
+
10
+ Scans both project + global `~/.mindlore/` diary/ for patterns.
11
+
12
+ ## Trigger
13
+
14
+ `/mindlore-reflect` or `/mindlore-log reflect`
15
+
16
+ ## On Start — Check pending nominations + skill_memory
17
+
18
+ ```bash
19
+ node dist/scripts/lib/skill-memory.js get mindlore-reflect last_reflect_date
20
+ node dist/scripts/lib/skill-memory.js get mindlore-reflect nomination_count
21
+ ```
22
+
23
+ Check pending nominations:
24
+ ```sql
25
+ SELECT id, summary, body, created_at FROM episodes
26
+ WHERE kind = 'nomination' AND status = 'staged' AND project = ?
27
+ ORDER BY created_at ASC
28
+ ```
29
+
30
+ If pending nominations exist, present them first:
31
+ ```
32
+ -- Bekleyen Nomination'lar ({N} adet) --
33
+ 1. "{summary}" (staged {days} gun once)
34
+ Target: learnings | Confidence: 3x
35
+
36
+ Onaylamak istediklerini sec, veya 'skip':
37
+ ```
38
+
39
+ ## Flow
40
+
41
+ 1. Read active episodes: `WHERE status = 'active' AND source IN ('hook', 'diary')`
42
+ 2. Filter by time: `--days 7` (default), `--days 30`
43
+ 3. Present summary: "Found N episodes spanning DATE1 to DATE2"
44
+ 4. LLM analyzes episodes for recurring patterns:
45
+ - Repeated decisions (same choice 2+ times)
46
+ - Recurring frictions (same blocker/error)
47
+ - Discovery patterns (assumptions that keep breaking)
48
+ - Workflow patterns that worked well
49
+
50
+ 5. **3-Tier Confidence Assessment:**
51
+
52
+ | Tekrar | Tier | Aksiyon |
53
+ |--------|------|---------|
54
+ | 1x | Note | Sessiz — episode olarak kalir, raporda goster |
55
+ | 2x | Learning | `kind: learning` episode olustur, learnings/ dosyasina yaz |
56
+ | 3x+ | Nomination | `kind: nomination, status: staged, source: reflect` episode olustur |
57
+
58
+ 6. **Structured report:**
59
+ ```
60
+ -- Reflect Raporu (son {days} gun, {N} episode) --
61
+
62
+ Friction ({count}):
63
+ - {summary} — {repeat_count}x tekrar
64
+
65
+ Discoveries ({count}):
66
+ - {summary}
67
+
68
+ Patterns:
69
+ - "{pattern}" -> 3x tekrar -> NOMINATION (staged)
70
+ - "{pattern}" -> 2x tekrar -> LEARNING
71
+ - "{pattern}" -> 1x -> NOTE
72
+
73
+ Onerilen:
74
+ [ ] {rule} ({repeat_count}x, {confidence} confidence)
75
+ ```
76
+
77
+ 7. **Nomination creation (3x+ tekrar):**
78
+ ```sql
79
+ INSERT INTO episodes (summary, body, kind, status, source, project, created_at)
80
+ VALUES (?, ?, 'nomination', 'staged', 'reflect', ?, ?)
81
+ ```
82
+
83
+ 8. **Nomination approval flow:**
84
+ User approves -> `status: staged -> approved` -> write to target:
85
+ - `learnings` -> `learnings/{topic}.md`
86
+ - `claude.md` -> project CLAUDE.md'ye kural ekle
87
+ - `domain:{slug}` -> ilgili domain sayfasina ekle
88
+
89
+ User rejects -> `status: staged -> rejected` + rejection reason
90
+
91
+ ## On End — Write skill_memory
92
+
93
+ ```bash
94
+ node dist/scripts/lib/skill-memory.js set mindlore-reflect last_reflect_date "$(date -I)"
95
+ node dist/scripts/lib/skill-memory.js set mindlore-reflect nomination_count "{staged_count}"
96
+ ```
97
+
98
+ ## Rules
99
+
100
+ - NEVER write learnings or nominations without user approval
101
+ - Group related patterns into existing topic files
102
+ - Reflect READS episodes, diary WRITES episodes — clear separation
103
+ - Mark processed episodes so future reflect skips them
104
+ - Append to `log.md`: `| {date} | reflect | {N} episodes processed, {M} learnings written |`
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.0",
2
+ "version": "0.5.2",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",
@@ -26,5 +26,10 @@
26
26
  "ftsWeight": 0.4,
27
27
  "vecWeight": 0.6,
28
28
  "k": 60
29
+ },
30
+ "tokenBudget": {
31
+ "sessionInject": 2000,
32
+ "searchResults": 1500,
33
+ "perResult": 500
29
34
  }
30
35
  }