mindlore 0.5.2 → 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 (72) hide show
  1. package/README.md +2 -1
  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/lib/consolidation.d.ts +17 -0
  7. package/dist/scripts/lib/consolidation.d.ts.map +1 -0
  8. package/dist/scripts/lib/consolidation.js +55 -0
  9. package/dist/scripts/lib/consolidation.js.map +1 -0
  10. package/dist/scripts/lib/constants.d.ts +3 -0
  11. package/dist/scripts/lib/constants.d.ts.map +1 -1
  12. package/dist/scripts/lib/constants.js +4 -1
  13. package/dist/scripts/lib/constants.js.map +1 -1
  14. package/dist/scripts/lib/decay.d.ts +21 -0
  15. package/dist/scripts/lib/decay.d.ts.map +1 -0
  16. package/dist/scripts/lib/decay.js +50 -0
  17. package/dist/scripts/lib/decay.js.map +1 -0
  18. package/dist/scripts/lib/migrations-v053.d.ts +3 -0
  19. package/dist/scripts/lib/migrations-v053.d.ts.map +1 -0
  20. package/dist/scripts/lib/migrations-v053.js +52 -0
  21. package/dist/scripts/lib/migrations-v053.js.map +1 -0
  22. package/dist/scripts/mindlore-backup.d.ts +1 -1
  23. package/dist/scripts/mindlore-backup.d.ts.map +1 -1
  24. package/dist/scripts/mindlore-backup.js +23 -0
  25. package/dist/scripts/mindlore-backup.js.map +1 -1
  26. package/dist/scripts/mindlore-fts5-index.js +2 -1
  27. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  28. package/dist/scripts/mindlore-health-check.js +35 -1
  29. package/dist/scripts/mindlore-health-check.js.map +1 -1
  30. package/dist/tests/cc-memory-bulk-sync.test.d.ts +2 -0
  31. package/dist/tests/cc-memory-bulk-sync.test.d.ts.map +1 -0
  32. package/dist/tests/cc-memory-bulk-sync.test.js +116 -0
  33. package/dist/tests/cc-memory-bulk-sync.test.js.map +1 -0
  34. package/dist/tests/consolidation.test.d.ts +2 -0
  35. package/dist/tests/consolidation.test.d.ts.map +1 -0
  36. package/dist/tests/consolidation.test.js +77 -0
  37. package/dist/tests/consolidation.test.js.map +1 -0
  38. package/dist/tests/decay.test.d.ts +2 -0
  39. package/dist/tests/decay.test.d.ts.map +1 -0
  40. package/dist/tests/decay.test.js +92 -0
  41. package/dist/tests/decay.test.js.map +1 -0
  42. package/dist/tests/git-snapshot.test.d.ts +2 -0
  43. package/dist/tests/git-snapshot.test.d.ts.map +1 -0
  44. package/dist/tests/git-snapshot.test.js +36 -0
  45. package/dist/tests/git-snapshot.test.js.map +1 -0
  46. package/dist/tests/migrations-v053.test.d.ts +2 -0
  47. package/dist/tests/migrations-v053.test.d.ts.map +1 -0
  48. package/dist/tests/migrations-v053.test.js +113 -0
  49. package/dist/tests/migrations-v053.test.js.map +1 -0
  50. package/dist/tests/recall-telemetry.test.d.ts +2 -0
  51. package/dist/tests/recall-telemetry.test.d.ts.map +1 -0
  52. package/dist/tests/recall-telemetry.test.js +56 -0
  53. package/dist/tests/recall-telemetry.test.js.map +1 -0
  54. package/dist/tests/skill-path-resolution.test.d.ts +2 -0
  55. package/dist/tests/skill-path-resolution.test.d.ts.map +1 -0
  56. package/dist/tests/skill-path-resolution.test.js +42 -0
  57. package/dist/tests/skill-path-resolution.test.js.map +1 -0
  58. package/hooks/lib/mindlore-common.cjs +29 -1
  59. package/hooks/mindlore-search.cjs +10 -1
  60. package/hooks/mindlore-session-focus.cjs +12 -0
  61. package/package.json +3 -2
  62. package/plugin.json +6 -1
  63. package/skills/mindlore-decide/SKILL.md +9 -0
  64. package/skills/mindlore-diary/SKILL.md +12 -3
  65. package/skills/mindlore-evolve/SKILL.md +24 -1
  66. package/skills/mindlore-health/SKILL.md +10 -1
  67. package/skills/mindlore-ingest/SKILL.md +26 -6
  68. package/skills/mindlore-log/SKILL.md +9 -0
  69. package/skills/mindlore-maintain/SKILL.md +119 -0
  70. package/skills/mindlore-query/SKILL.md +9 -0
  71. package/skills/mindlore-reflect/SKILL.md +31 -4
  72. package/templates/config.json +8 -1
@@ -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:
@@ -3,6 +3,15 @@ name: mindlore-reflect
3
3
  description: Pattern extraction from episodes — 3-tier confidence, nomination pipeline, CLAUDE.md update proposals.
4
4
  ---
5
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-reflect".
12
+ Compute: `MINDLORE_PKG = {base_directory}/../..`
13
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
14
+
6
15
  # /mindlore-reflect
7
16
 
8
17
  ## Scope
@@ -16,8 +25,8 @@ Scans both project + global `~/.mindlore/` diary/ for patterns.
16
25
  ## On Start — Check pending nominations + skill_memory
17
26
 
18
27
  ```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
28
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-reflect last_reflect_date
29
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-reflect nomination_count
21
30
  ```
22
31
 
23
32
  Check pending nominations:
@@ -91,8 +100,26 @@ Onaylamak istediklerini sec, veya 'skip':
91
100
  ## On End — Write skill_memory
92
101
 
93
102
  ```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}"
103
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-reflect last_reflect_date "$(date -I)"
104
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-reflect nomination_count "{staged_count}"
105
+ ```
106
+
107
+ ## Quick Health Summary (v0.5.3)
108
+
109
+ After pattern extraction, run quick SQL checks (0 token, <1ms):
110
+ ```bash
111
+ node -e "
112
+ const db = require('better-sqlite3')(require('path').join(require('os').homedir(), '.mindlore', 'mindlore.db'), {readonly:true});
113
+ const stale = db.prepare(\"SELECT COUNT(*) as c FROM file_hashes WHERE recall_count = 0 AND archived_at IS NULL AND last_indexed < datetime('now','-60 days')\").get()?.c ?? 0;
114
+ const raw = db.prepare(\"SELECT COUNT(*) as c FROM episodes WHERE (consolidation_status = 'raw' OR consolidation_status IS NULL) AND kind IN ('learning','discovery','friction','decision')\").get()?.c ?? 0;
115
+ console.log(JSON.stringify({stale, raw}));
116
+ db.close();
117
+ "
118
+ ```
119
+
120
+ Rapor sonuna ekle:
121
+ ```
122
+ Stale: {stale} doc | Raw episodes: {raw} | → Detay: /mindlore-maintain
96
123
  ```
97
124
 
98
125
  ## Rules
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.2",
2
+ "version": "0.5.3",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",
@@ -31,5 +31,12 @@
31
31
  "sessionInject": 2000,
32
32
  "searchResults": 1500,
33
33
  "perResult": 500
34
+ },
35
+ "decay": {
36
+ "halfLifeDays": 30,
37
+ "staleThreshold": 0.3
38
+ },
39
+ "consolidation": {
40
+ "threshold": 50
34
41
  }
35
42
  }