mindlore 0.6.5 → 0.6.7

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 (79) hide show
  1. package/README.md +1 -1
  2. package/dist/scripts/init.js +34 -16
  3. package/dist/scripts/init.js.map +1 -1
  4. package/dist/scripts/lib/all-migrations.d.ts +6 -0
  5. package/dist/scripts/lib/all-migrations.d.ts.map +1 -0
  6. package/dist/scripts/lib/all-migrations.js +35 -0
  7. package/dist/scripts/lib/all-migrations.js.map +1 -0
  8. package/dist/scripts/lib/migrations-v066.d.ts +4 -0
  9. package/dist/scripts/lib/migrations-v066.d.ts.map +1 -0
  10. package/dist/scripts/lib/migrations-v066.js +14 -0
  11. package/dist/scripts/lib/migrations-v066.js.map +1 -0
  12. package/dist/scripts/lib/migrations-v067.d.ts +7 -0
  13. package/dist/scripts/lib/migrations-v067.d.ts.map +1 -0
  14. package/dist/scripts/lib/migrations-v067.js +50 -0
  15. package/dist/scripts/lib/migrations-v067.js.map +1 -0
  16. package/dist/scripts/lib/session-payload.d.ts +9 -1
  17. package/dist/scripts/lib/session-payload.d.ts.map +1 -1
  18. package/dist/scripts/lib/session-payload.js +25 -6
  19. package/dist/scripts/lib/session-payload.js.map +1 -1
  20. package/dist/scripts/mindlore-fts5-index.js +2 -5
  21. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  22. package/dist/tests/episodes-inject.test.js +71 -0
  23. package/dist/tests/episodes-inject.test.js.map +1 -1
  24. package/dist/tests/fts5.test.js +23 -0
  25. package/dist/tests/fts5.test.js.map +1 -1
  26. package/dist/tests/helpers/db.d.ts +1 -0
  27. package/dist/tests/helpers/db.d.ts.map +1 -1
  28. package/dist/tests/helpers/db.js +10 -1
  29. package/dist/tests/helpers/db.js.map +1 -1
  30. package/dist/tests/init.test.js +26 -0
  31. package/dist/tests/init.test.js.map +1 -1
  32. package/dist/tests/lesson-graduation.test.d.ts +2 -0
  33. package/dist/tests/lesson-graduation.test.d.ts.map +1 -0
  34. package/dist/tests/lesson-graduation.test.js +83 -0
  35. package/dist/tests/lesson-graduation.test.js.map +1 -0
  36. package/dist/tests/migrations-v063.test.js +1 -1
  37. package/dist/tests/migrations-v066.test.d.ts +2 -0
  38. package/dist/tests/migrations-v066.test.d.ts.map +1 -0
  39. package/dist/tests/migrations-v066.test.js +54 -0
  40. package/dist/tests/migrations-v066.test.js.map +1 -0
  41. package/dist/tests/migrations-v067.test.d.ts +2 -0
  42. package/dist/tests/migrations-v067.test.d.ts.map +1 -0
  43. package/dist/tests/migrations-v067.test.js +115 -0
  44. package/dist/tests/migrations-v067.test.js.map +1 -0
  45. package/dist/tests/obsidian.test.js +2 -1
  46. package/dist/tests/obsidian.test.js.map +1 -1
  47. package/dist/tests/session-end-cleanup.test.d.ts +2 -0
  48. package/dist/tests/session-end-cleanup.test.d.ts.map +1 -0
  49. package/dist/tests/session-end-cleanup.test.js +76 -0
  50. package/dist/tests/session-end-cleanup.test.js.map +1 -0
  51. package/dist/tests/session-focus-helpers.test.d.ts +2 -0
  52. package/dist/tests/session-focus-helpers.test.d.ts.map +1 -0
  53. package/dist/tests/session-focus-helpers.test.js +80 -0
  54. package/dist/tests/session-focus-helpers.test.js.map +1 -0
  55. package/dist/tests/session-focus.test.js +111 -10
  56. package/dist/tests/session-focus.test.js.map +1 -1
  57. package/dist/tests/session-payload.test.js +10 -10
  58. package/dist/tests/session-payload.test.js.map +1 -1
  59. package/dist/tests/session-summary.test.js +1 -1
  60. package/dist/tests/session-summary.test.js.map +1 -1
  61. package/dist/tests/stats-skill.test.d.ts +2 -0
  62. package/dist/tests/stats-skill.test.d.ts.map +1 -0
  63. package/dist/tests/stats-skill.test.js +55 -0
  64. package/dist/tests/stats-skill.test.js.map +1 -0
  65. package/hooks/lib/mindlore-common.cjs +38 -0
  66. package/hooks/mindlore-search.cjs +2 -1
  67. package/hooks/mindlore-session-end.cjs +4 -1
  68. package/hooks/mindlore-session-focus.cjs +93 -36
  69. package/package.json +1 -1
  70. package/plugin.json +6 -1
  71. package/skills/mindlore-ingest/SKILL.md +11 -0
  72. package/skills/mindlore-reflect/SKILL.md +10 -0
  73. package/skills/mindlore-stats/SKILL.md +106 -0
  74. package/templates/config.json +1 -1
  75. package/templates/extraction/article.md +15 -0
  76. package/templates/extraction/changelog.md +15 -0
  77. package/templates/extraction/default.md +15 -0
  78. package/templates/extraction/docs.md +15 -0
  79. package/templates/extraction/github-repo.md +17 -0
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: mindlore-stats
3
+ description: Show context contribution and cost per session — hook calls, durations, DB stats.
4
+ effort: low
5
+ context: fork
6
+ allowed-tools: [Bash, Read]
7
+ ---
8
+
9
+ ## Script Resolution
10
+
11
+ Resolve `MINDLORE_DIR` (active knowledge base directory) using:
12
+ 1. If project `.mindlore/` exists → use it
13
+ 2. Else → use `~/.mindlore/`
14
+
15
+ # /mindlore-stats
16
+
17
+ Show context contribution and cost per session — hook calls, durations, DB stats.
18
+
19
+ ## Trigger
20
+
21
+ User says "mindlore stats", "stats", "context cost", "hook performance", "ne kadar yer kaplıyor".
22
+
23
+ ## Execution
24
+
25
+ ### 1. Telemetry Analysis
26
+
27
+ Read `$MINDLORE_DIR/telemetry.jsonl` (each line is a JSON object):
28
+
29
+ ```bash
30
+ # Count lines and read last 500 for session estimate
31
+ wc -l "$MINDLORE_DIR/telemetry.jsonl"
32
+ tail -500 "$MINDLORE_DIR/telemetry.jsonl"
33
+ ```
34
+
35
+ Parse each line as JSON with fields: `hook` (string), `duration` (number, ms), `ts` (ISO timestamp), optionally `injectSize` (number, chars).
36
+
37
+ Calculate:
38
+ - **Total hook calls (all time)**: total line count
39
+ - **Hook calls (session)**: lines where `ts` is within last 8 hours
40
+ - **Avg duration per hook**: group by `hook`, compute mean `duration`
41
+ - **Session inject avg**: from events where `hook === "mindlore-session-focus"`, average `injectSize` (chars ÷ 4 ≈ tokens)
42
+ - **Search inject avg**: from events where `hook === "mindlore-search"`, average `injectSize` (chars ÷ 4 ≈ tokens)
43
+
44
+ ### 2. DB Stats
45
+
46
+ Query `$MINDLORE_DIR/mindlore.db`:
47
+
48
+ ```bash
49
+ # Indexed docs
50
+ node -e "
51
+ const DB = require('better-sqlite3');
52
+ const db = new DB('$MINDLORE_DIR/mindlore.db', {readonly:true});
53
+ const total = db.prepare('SELECT COUNT(*) as n FROM file_hashes').get().n;
54
+ const stale = db.prepare(\"SELECT COUNT(*) as n FROM file_hashes WHERE last_indexed < datetime('now','-30 days')\").get().n;
55
+ const epRows = db.prepare('SELECT kind, COUNT(*) as n FROM episodes GROUP BY kind').all();
56
+ const sessions = db.prepare('SELECT COUNT(*) as n FROM mindlore_fts_sessions').get()?.n ?? 'N/A';
57
+ console.log(JSON.stringify({total, stale, epRows, sessions}));
58
+ db.close();
59
+ "
60
+ ```
61
+
62
+ Get DB file size:
63
+
64
+ ```bash
65
+ node -e "const fs=require('fs'); const s=fs.statSync('$MINDLORE_DIR/mindlore.db'); console.log((s.size/1024/1024).toFixed(2)+' MB');"
66
+ ```
67
+
68
+ ### 3. Format Output
69
+
70
+ Print a compact stats table:
71
+
72
+ ```
73
+ ## Mindlore Stats
74
+
75
+ | Metric | Value |
76
+ |--------|-------|
77
+ | DB Size | X MB |
78
+ | Indexed Docs | N |
79
+ | Stale Docs (30d+) | N |
80
+ | Episodes (active) | N |
81
+ | Hook Calls (session) | N |
82
+ | Hook Calls (all time) | N |
83
+ | Avg Hook Duration | Xms |
84
+ | Session Inject Avg | ~N tokens |
85
+ | Search Inject Avg | ~N tokens |
86
+ ```
87
+
88
+ Then add a per-hook breakdown if hook calls > 0:
89
+
90
+ ```
91
+ ### Hook Breakdown (session)
92
+
93
+ | Hook | Calls | Avg Duration |
94
+ |------|-------|-------------|
95
+ | mindlore-session-focus | N | Xms |
96
+ | mindlore-search | N | Xms |
97
+ | ... | | |
98
+ ```
99
+
100
+ ## Notes
101
+
102
+ - If `telemetry.jsonl` does not exist: report "No telemetry data yet"
103
+ - If `mindlore.db` does not exist: report "DB not found — run `npx mindlore init`"
104
+ - If `episodes` table missing: skip episode count, show "—"
105
+ - Inject size in tokens is approximate (chars ÷ 4)
106
+ - "Session" = last 8 hours from current time
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.5",
2
+ "version": "0.6.7",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",
@@ -0,0 +1,15 @@
1
+ ---
2
+ source_type: article
3
+ description: Article/blog post analysis template
4
+ ---
5
+
6
+ ## Extraction Instructions
7
+
8
+ Bu source bir makale veya blog yazisidir. Su bilgileri cikar:
9
+
10
+ 1. **Tez:** Yazarin ana argumani veya iddiasi (1-2 cumle)
11
+ 2. **Destekleyici Argumanlar:** Tezi destekleyen kanit ve ornekler
12
+ 3. **Sonuc:** Yazarin vardigi sonuc veya onerisi
13
+ 4. **Elestiri:** Zayif noktalar veya eksik perspektifler (varsa)
14
+
15
+ Yazarin uslubunu veya hikaye anlatimini tekrarlama — sadece bilgi ozu.
@@ -0,0 +1,15 @@
1
+ ---
2
+ source_type: changelog
3
+ description: Changelog/release notes analysis template
4
+ ---
5
+
6
+ ## Extraction Instructions
7
+
8
+ Bu source bir changelog veya release notes dosyasidir. Su bilgileri cikar:
9
+
10
+ 1. **Breaking Changes:** Geriye uyumsuz degisiklikler ve migration adimlari
11
+ 2. **Yeni Ozellikler:** Eklenen ozellikler ve kullanim sekli
12
+ 3. **Bug Fix'ler:** Duzeltilen hatalar (sadece onemli olanlar)
13
+ 4. **Deprecation:** Kaldirilacak/kaldirilan ozellikler
14
+
15
+ Her maddeyi versiyon numarasiyla iliskilendir. Minor fix'leri atla, sadece etkili degisiklikleri al.
@@ -0,0 +1,15 @@
1
+ ---
2
+ source_type: default
3
+ description: Generic extraction template (fallback)
4
+ ---
5
+
6
+ ## Extraction Instructions
7
+
8
+ Bu source icin ozel bir extraction template bulunamadi. Genel ozet cikar:
9
+
10
+ 1. **Ozet:** Kaynagin ne hakkinda oldugu (2-3 cumle)
11
+ 2. **Temel Bilgiler:** En onemli noktalar ve kavramlar
12
+ 3. **Iliskiler:** Diger bilinen konularla baglantilari
13
+ 4. **Eyleme Donuk:** Pratikte nasil kullanilabilir
14
+
15
+ Kisa ve oz tut — max 500 kelime.
@@ -0,0 +1,15 @@
1
+ ---
2
+ source_type: docs
3
+ description: Technical documentation analysis template
4
+ ---
5
+
6
+ ## Extraction Instructions
7
+
8
+ Bu source teknik dokumantasyondur. Su bilgileri cikar:
9
+
10
+ 1. **API Referans:** Fonksiyonlar, parametreler, donus tipleri
11
+ 2. **Ornekler:** Kod ornekleri ve kullanim pattern'leri
12
+ 3. **Kisitlamalar:** Bilinen limitasyonlar, uyumsuzluklar, uyarilar
13
+ 4. **Versiyon:** Hangi versiyona ait oldugu (belirtilmisse)
14
+
15
+ Tam API imzalarini koru — kisaltma yapma. Ornekleri oldugu gibi al.
@@ -0,0 +1,17 @@
1
+ ---
2
+ source_type: github-repo
3
+ description: GitHub repository analysis template
4
+ ---
5
+
6
+ ## Extraction Instructions
7
+
8
+ Bu source bir GitHub reposudur. Su bilgileri cikar:
9
+
10
+ 1. **Mimari:** Temel tasarim kararlari, kullanilan pattern'ler, katman yapisi
11
+ 2. **Kurulum:** Gereksinimler, adimlar, environment degiskenleri
12
+ 3. **API Surface:** Public fonksiyonlar, CLI komutlari, tool'lar, hook'lar
13
+ 4. **Dependencies:** Kritik bagimliliklar ve versiyonlari
14
+ 5. **Farklilastirici:** Rakiplerden/alternatiflerden ne farki var
15
+
16
+ Gereksiz README boilerplate'i (badge'ler, sponsor listesi, lisans metni) atla.
17
+ Sadece teknik ozeti yaz.