mindlore 0.6.8 → 0.6.9

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 (124) hide show
  1. package/README.md +259 -259
  2. package/SCHEMA.md +292 -292
  3. package/dist/scripts/cc-memory-bulk-sync.d.ts.map +1 -1
  4. package/dist/scripts/cc-memory-bulk-sync.js +2 -1
  5. package/dist/scripts/cc-memory-bulk-sync.js.map +1 -1
  6. package/dist/scripts/cc-session-sync.d.ts.map +1 -1
  7. package/dist/scripts/cc-session-sync.js +6 -5
  8. package/dist/scripts/cc-session-sync.js.map +1 -1
  9. package/dist/scripts/fetch-raw.js +5 -4
  10. package/dist/scripts/fetch-raw.js.map +1 -1
  11. package/dist/scripts/init.js +12 -11
  12. package/dist/scripts/init.js.map +1 -1
  13. package/dist/scripts/lib/consolidation.js +10 -10
  14. package/dist/scripts/lib/constants.d.ts +2 -0
  15. package/dist/scripts/lib/constants.d.ts.map +1 -1
  16. package/dist/scripts/lib/constants.js +10 -1
  17. package/dist/scripts/lib/constants.js.map +1 -1
  18. package/dist/scripts/lib/decay.js +9 -9
  19. package/dist/scripts/lib/episodes.js +23 -23
  20. package/dist/scripts/lib/migrations-v061.js +21 -21
  21. package/dist/scripts/lib/migrations-v062.js +11 -11
  22. package/dist/scripts/lib/migrations-v063.js +14 -14
  23. package/dist/scripts/lib/migrations-v067.js +11 -11
  24. package/dist/scripts/lib/schema-version.js +6 -6
  25. package/dist/scripts/lib/search-cache.js +11 -11
  26. package/dist/scripts/lib/secure-io.d.ts +11 -0
  27. package/dist/scripts/lib/secure-io.d.ts.map +1 -0
  28. package/dist/scripts/lib/secure-io.js +26 -0
  29. package/dist/scripts/lib/secure-io.js.map +1 -0
  30. package/dist/scripts/lib/session-payload.js +7 -7
  31. package/dist/scripts/lib/triage.js +3 -3
  32. package/dist/scripts/lib/validate-manifest.d.ts +8 -0
  33. package/dist/scripts/lib/validate-manifest.d.ts.map +1 -0
  34. package/dist/scripts/lib/validate-manifest.js +80 -0
  35. package/dist/scripts/lib/validate-manifest.js.map +1 -0
  36. package/dist/scripts/mindlore-backup.js +9 -9
  37. package/dist/scripts/mindlore-fts5-index.js +10 -10
  38. package/dist/scripts/validate-manifest-cli.d.ts +2 -0
  39. package/dist/scripts/validate-manifest-cli.d.ts.map +1 -0
  40. package/dist/scripts/validate-manifest-cli.js +38 -0
  41. package/dist/scripts/validate-manifest-cli.js.map +1 -0
  42. package/dist/tests/cc-memory-sync.test.js +3 -3
  43. package/dist/tests/chunks-migration.test.js +1 -1
  44. package/dist/tests/compaction-snapshot.test.js +2 -2
  45. package/dist/tests/consolidation.test.js +3 -3
  46. package/dist/tests/decay.test.js +9 -9
  47. package/dist/tests/diary.test.js +4 -4
  48. package/dist/tests/episode-file.test.js +2 -1
  49. package/dist/tests/episode-file.test.js.map +1 -1
  50. package/dist/tests/episodes-inject.test.js +9 -9
  51. package/dist/tests/fetch-raw.test.js +1 -2
  52. package/dist/tests/fetch-raw.test.js.map +1 -1
  53. package/dist/tests/fts5.test.js +75 -75
  54. package/dist/tests/fuzzy.test.js +1 -1
  55. package/dist/tests/git-snapshot.test.js +3 -5
  56. package/dist/tests/git-snapshot.test.js.map +1 -1
  57. package/dist/tests/helpers/db.d.ts +1 -2
  58. package/dist/tests/helpers/db.d.ts.map +1 -1
  59. package/dist/tests/helpers/db.js +18 -26
  60. package/dist/tests/helpers/db.js.map +1 -1
  61. package/dist/tests/manifest-v2.test.d.ts +2 -0
  62. package/dist/tests/manifest-v2.test.d.ts.map +1 -0
  63. package/dist/tests/manifest-v2.test.js +74 -0
  64. package/dist/tests/manifest-v2.test.js.map +1 -0
  65. package/dist/tests/migrations-v053.test.js +16 -16
  66. package/dist/tests/migrations-v061.test.js +10 -10
  67. package/dist/tests/migrations-v063.test.js +4 -4
  68. package/dist/tests/migrations-v068.test.js +6 -3
  69. package/dist/tests/migrations-v068.test.js.map +1 -1
  70. package/dist/tests/nomination-counts.test.js +6 -6
  71. package/dist/tests/nomination-counts.test.js.map +1 -1
  72. package/dist/tests/pre-compact.test.js +2 -1
  73. package/dist/tests/pre-compact.test.js.map +1 -1
  74. package/dist/tests/recall-telemetry.test.js +12 -11
  75. package/dist/tests/recall-telemetry.test.js.map +1 -1
  76. package/dist/tests/rrf.test.js +3 -3
  77. package/dist/tests/search-engine.test.js +1 -1
  78. package/dist/tests/search-hook.test.js +2 -2
  79. package/dist/tests/search-offload.test.js +1 -1
  80. package/dist/tests/search-offload.test.js.map +1 -1
  81. package/dist/tests/secure-io.test.d.ts +2 -0
  82. package/dist/tests/secure-io.test.d.ts.map +1 -0
  83. package/dist/tests/secure-io.test.js +65 -0
  84. package/dist/tests/secure-io.test.js.map +1 -0
  85. package/dist/tests/session-payload.test.js +1 -1
  86. package/dist/tests/session-summary.test.js +1 -1
  87. package/dist/tests/similarity.test.js +1 -1
  88. package/dist/tests/skill-path-resolution.test.js +22 -3
  89. package/dist/tests/skill-path-resolution.test.js.map +1 -1
  90. package/dist/tests/triage.test.js +1 -1
  91. package/hooks/lib/constants.cjs +15 -15
  92. package/hooks/lib/mindlore-common.cjs +975 -974
  93. package/hooks/mindlore-cwd-changed.cjs +57 -57
  94. package/hooks/mindlore-decision-detector.cjs +54 -54
  95. package/hooks/mindlore-dont-repeat.cjs +222 -222
  96. package/hooks/mindlore-fts5-sync.cjs +98 -97
  97. package/hooks/mindlore-index.cjs +230 -229
  98. package/hooks/mindlore-model-router.cjs +54 -54
  99. package/hooks/mindlore-post-compact.cjs +69 -69
  100. package/hooks/mindlore-post-read.cjs +106 -106
  101. package/hooks/mindlore-pre-compact.cjs +154 -154
  102. package/hooks/mindlore-read-guard.cjs +105 -105
  103. package/hooks/mindlore-research-guard.cjs +176 -176
  104. package/hooks/mindlore-search.cjs +200 -200
  105. package/hooks/mindlore-session-end.cjs +510 -509
  106. package/hooks/mindlore-session-focus.cjs +256 -256
  107. package/package.json +76 -75
  108. package/plugin.json +2 -1
  109. package/skills/mindlore-diary/SKILL.md +85 -85
  110. package/skills/mindlore-evolve/SKILL.md +126 -126
  111. package/skills/mindlore-explore/SKILL.md +109 -109
  112. package/skills/mindlore-ingest/SKILL.md +195 -195
  113. package/skills/mindlore-maintain/SKILL.md +125 -125
  114. package/skills/mindlore-query/SKILL.md +151 -151
  115. package/skills/mindlore-reflect/SKILL.md +141 -141
  116. package/skills/mindlore-stats/SKILL.md +106 -106
  117. package/templates/INDEX.md +14 -14
  118. package/templates/SCHEMA.md +292 -292
  119. package/templates/config.json +1 -1
  120. package/templates/extraction/article.md +15 -15
  121. package/templates/extraction/changelog.md +15 -15
  122. package/templates/extraction/default.md +15 -15
  123. package/templates/extraction/docs.md +15 -15
  124. package/templates/extraction/github-repo.md +17 -17
@@ -1,109 +1,109 @@
1
- ---
2
- name: mindlore-explore
3
- description: Discover unexpected connections between sources — undirected knowledge exploration
4
- effort: medium
5
- context: fork
6
- allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
7
- ---
8
-
9
- # /mindlore-explore
10
-
11
- Discover unexpected connections between knowledge sources. Undirected exploration — unlike query (directed search).
12
-
13
- ## Scope
14
-
15
- Default: `--scope all` (project + global birlikte taranır — en değerli mod).
16
- Options: `--scope project` | `--scope global` | `--scope all`
17
-
18
- 1. Determine scope from argument (default: all)
19
- 2. If `all`: explore both project `.mindlore/` and global `~/.mindlore/` + cross-reference
20
- 3. If `project`: explore only project-scoped content (current CWD's `.mindlore/`)
21
- 4. If `global`: explore only global `~/.mindlore/` content
22
- - Never hardcode `.mindlore/` path — always resolve dynamically via `getActiveMindloreDir()`
23
-
24
- ## Trigger
25
-
26
- User says `/mindlore-explore`, "knowledge explore", "baglanti kesfet", "cross-reference bul".
27
-
28
- ## Flow
29
-
30
- **Agent Delegation:** Cross-reference analizini subagent'a delege et (context koruma).
31
-
32
- 1. Spawn an Agent for analysis:
33
- ```
34
- Agent({
35
- description: "mindlore explore: connections",
36
- subagent_type: "Explore",
37
- prompt: "[mindlore:explore] Analyze .mindlore/ for unexpected connections. <aşağıdaki talimatları buraya koy>"
38
- })
39
- ```
40
-
41
- Agent talimatları:
42
- a. Read all source and domain files from active scope
43
- b. Cross-match by tag + content (see criteria below)
44
- c. Rank connections by strength
45
- d. Return findings as structured table
46
-
47
- 2. After agent returns — review and show findings to user
48
- 3. On approval, write connection files (main session handles writes)
49
-
50
- **Cross-match criteria:**
51
- - Files sharing tags but not referencing each other
52
- - Sources covering similar topics from different angles
53
- - Sources that could bridge between domains
54
- 3. Rank connections by strength:
55
- - **high**: 3+ shared tags + content overlap
56
- - **medium**: 2 shared tags or significant content similarity
57
- - **low**: 1 shared tag + weak content match
58
- 4. Show findings to user
59
- 5. On approval, write to `connections/` directory
60
-
61
- ## Connection File Format
62
-
63
- Written to `connections/` with frontmatter:
64
-
65
- ```markdown
66
- ---
67
- type: connection
68
- slug: connection-source-a-source-b
69
- date_created: 2026-04-12
70
- sources: [source-a.md, source-b.md]
71
- domains: [domain-x.md]
72
- strength: high
73
- tags: [shared-tag-1, shared-tag-2]
74
- ---
75
-
76
- ## Connection
77
-
78
- [Why these sources are related — LLM explanation]
79
-
80
- ## Action Suggestion
81
-
82
- [What could be done — domain update, new analysis, etc.]
83
- ```
84
-
85
- ## Rules
86
-
87
- - Check for duplicate connections before writing (same source pair)
88
- - Show findings before writing — user approval required
89
- - Update INDEX.md with new connections entry
90
- - Append EXPLORE entry to log.md
91
- - Strength is LLM-assessed based on tag overlap + content similarity
92
- - The `[mindlore:explore]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (sonnet by default)
93
-
94
- ## Output Format
95
-
96
- ```
97
- Mindlore Explore — Discovered Connections
98
-
99
- Scope: project (.mindlore/)
100
- Sources scanned: 12
101
- Connections found: 3 (2 new, 1 existing)
102
-
103
- | # | Sources | Strength | Why |
104
- |---|---------|----------|-----|
105
- | 1 | react-hooks.md + agent-orchestration.md | medium | Both discuss state management patterns |
106
- | 2 | karpathy-kb.md + search-retrieval.md | high | FTS5 + knowledge architecture overlap |
107
-
108
- Write connections? (y/n)
109
- ```
1
+ ---
2
+ name: mindlore-explore
3
+ description: Discover unexpected connections between sources — undirected knowledge exploration
4
+ effort: medium
5
+ context: fork
6
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
7
+ ---
8
+
9
+ # /mindlore-explore
10
+
11
+ Discover unexpected connections between knowledge sources. Undirected exploration — unlike query (directed search).
12
+
13
+ ## Scope
14
+
15
+ Default: `--scope all` (project + global birlikte taranır — en değerli mod).
16
+ Options: `--scope project` | `--scope global` | `--scope all`
17
+
18
+ 1. Determine scope from argument (default: all)
19
+ 2. If `all`: explore both project `.mindlore/` and global `~/.mindlore/` + cross-reference
20
+ 3. If `project`: explore only project-scoped content (current CWD's `.mindlore/`)
21
+ 4. If `global`: explore only global `~/.mindlore/` content
22
+ - Never hardcode `.mindlore/` path — always resolve dynamically via `getActiveMindloreDir()`
23
+
24
+ ## Trigger
25
+
26
+ User says `/mindlore-explore`, "knowledge explore", "baglanti kesfet", "cross-reference bul".
27
+
28
+ ## Flow
29
+
30
+ **Agent Delegation:** Cross-reference analizini subagent'a delege et (context koruma).
31
+
32
+ 1. Spawn an Agent for analysis:
33
+ ```
34
+ Agent({
35
+ description: "mindlore explore: connections",
36
+ subagent_type: "Explore",
37
+ prompt: "[mindlore:explore] Analyze .mindlore/ for unexpected connections. <aşağıdaki talimatları buraya koy>"
38
+ })
39
+ ```
40
+
41
+ Agent talimatları:
42
+ a. Read all source and domain files from active scope
43
+ b. Cross-match by tag + content (see criteria below)
44
+ c. Rank connections by strength
45
+ d. Return findings as structured table
46
+
47
+ 2. After agent returns — review and show findings to user
48
+ 3. On approval, write connection files (main session handles writes)
49
+
50
+ **Cross-match criteria:**
51
+ - Files sharing tags but not referencing each other
52
+ - Sources covering similar topics from different angles
53
+ - Sources that could bridge between domains
54
+ 3. Rank connections by strength:
55
+ - **high**: 3+ shared tags + content overlap
56
+ - **medium**: 2 shared tags or significant content similarity
57
+ - **low**: 1 shared tag + weak content match
58
+ 4. Show findings to user
59
+ 5. On approval, write to `connections/` directory
60
+
61
+ ## Connection File Format
62
+
63
+ Written to `connections/` with frontmatter:
64
+
65
+ ```markdown
66
+ ---
67
+ type: connection
68
+ slug: connection-source-a-source-b
69
+ date_created: 2026-04-12
70
+ sources: [source-a.md, source-b.md]
71
+ domains: [domain-x.md]
72
+ strength: high
73
+ tags: [shared-tag-1, shared-tag-2]
74
+ ---
75
+
76
+ ## Connection
77
+
78
+ [Why these sources are related — LLM explanation]
79
+
80
+ ## Action Suggestion
81
+
82
+ [What could be done — domain update, new analysis, etc.]
83
+ ```
84
+
85
+ ## Rules
86
+
87
+ - Check for duplicate connections before writing (same source pair)
88
+ - Show findings before writing — user approval required
89
+ - Update INDEX.md with new connections entry
90
+ - Append EXPLORE entry to log.md
91
+ - Strength is LLM-assessed based on tag overlap + content similarity
92
+ - The `[mindlore:explore]` marker in the Agent prompt is required — it triggers the model-router hook to use the cost-optimized model (sonnet by default)
93
+
94
+ ## Output Format
95
+
96
+ ```
97
+ Mindlore Explore — Discovered Connections
98
+
99
+ Scope: project (.mindlore/)
100
+ Sources scanned: 12
101
+ Connections found: 3 (2 new, 1 existing)
102
+
103
+ | # | Sources | Strength | Why |
104
+ |---|---------|----------|-----|
105
+ | 1 | react-hooks.md + agent-orchestration.md | medium | Both discuss state management patterns |
106
+ | 2 | karpathy-kb.md + search-retrieval.md | high | FTS5 + knowledge architecture overlap |
107
+
108
+ Write connections? (y/n)
109
+ ```
@@ -1,195 +1,195 @@
1
- ---
2
- name: mindlore-ingest
3
- description: Add new knowledge sources to .mindlore/ (URL, text, file, PDF, GitHub repo)
4
- effort: medium
5
- allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch]
6
- context: fork
7
- agent: coder
8
- ---
9
-
10
- ## Script Resolution
11
-
12
- Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
13
- 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-ingest" → `MINDLORE_PKG = {base_directory}/../..`
14
- 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
15
-
16
- Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
17
-
18
- # /mindlore-ingest
19
-
20
- Add a new knowledge source to the `.mindlore/` knowledge base.
21
-
22
- ## Scope
23
-
24
- Tüm ingest işlemleri global `~/.mindlore/` dizinine yazılır.
25
- Proje ayrımı frontmatter'daki `project` alanı ile yapılır.
26
- `raw/` altına proje bazlı klasörleme yapılmaz (session sync hariç).
27
- Frontmatter'a `project: {CWD project adı}` otomatik eklenir.
28
-
29
- ## Trigger
30
-
31
- User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki kaydet", "knowledge ingest".
32
-
33
- ## Multi-URL Support
34
-
35
- Birden fazla URL verildiğinde (boşluk veya virgülle ayrılmış):
36
-
37
- 1. URL'leri parse et — boşluk veya virgülle split
38
- 2. Her URL için sırayla mevcut URL Mode pipeline'ını çalıştır:
39
- - Fetch → raw/ yazımı → sources/ dönüşümü → INDEX.md güncelle → log → FTS5 sync
40
- 3. Her URL için ayrı `skill-memory` dedup kontrolü yap
41
- 4. Her URL sonrası 7-point quality gate uygula
42
- 5. Hata olan URL'yi raporla ama sonrakine devam et (fail-forward)
43
- 6. Tüm URL'ler bittikten sonra toplu rapor döndür:
44
-
45
- ```json
46
- { "processed": 3, "failed": 0, "skipped": 1, "sources": ["slug1", "slug2", "slug3"] }
47
- ```
48
-
49
- Örnek kullanım:
50
- ```
51
- /mindlore-ingest https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html https://docs.aws.amazon.com/dynamodb/latest/developerguide/best-practices.html
52
- ```
53
-
54
- ## Modes
55
-
56
- ### URL Mode (v0.5.2 — Zero-Token Pipeline)
57
-
58
- **Trigger:** Input starts with `http://` or `https://`
59
-
60
- **Pre-check (before fetch):**
61
- ```bash
62
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-ingest last_ingest_urls
63
- ```
64
- If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
65
-
66
- **Flow:**
67
-
68
- 1. **Fetch raw content (zero token):**
69
- ```bash
70
- node "$MINDLORE_PKG/dist/scripts/fetch-raw.js" "$URL" --out-dir "$MINDLORE_DIR/raw"
71
- ```
72
- Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
73
-
74
- 2. **Read first 3000 chars (heading-aware truncation):**
75
- - Read the saved raw file
76
- - Find the last `##` heading before char 3000
77
- - Truncate at that heading boundary (not mid-paragraph)
78
- - If no heading found before 3000, truncate at last paragraph break
79
-
80
- 3. **Write sources/ summary from truncated content:**
81
- - Extract: title, description (first paragraph), key topics
82
- - Generate frontmatter: slug, type: source, source_url, date_captured, tags, quality
83
- - `project: {path.basename(process.cwd()) ile CWD'den alınan proje adı}`
84
- - `source_type` is auto-detected from URL pattern (see Source Summary Format)
85
- - Write to `$MINDLORE_DIR/sources/{slug}.md`
86
-
87
- 4. **Update INDEX.md** with new source entry
88
-
89
- 5. **Update skill_memory:**
90
- ```bash
91
- node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-ingest last_ingest_urls "$URL"
92
- ```
93
-
94
- 6. **Return to caller (this is all the ana session sees):**
95
- ```json
96
- { "source_id": "abc123", "title": "Extracted Title" }
97
- ```
98
-
99
- **Token budget:** ~2-3k tokens in fork context (vs ~40-50k before). Ana session: ~50 tokens.
100
-
101
- **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)."
102
-
103
- ### Text Mode
104
- 1. User pastes text directly
105
- 2. Save to `.mindlore/raw/` with `source_type: text-paste`
106
- 3. Follow steps 3-7 from URL mode
107
-
108
- ### PDF Mode
109
- 1. Read PDF with CC Read tool: `Read(file_path, pages: "1-5")` (max 20 pages/request)
110
- 2. **Do NOT use markitdown for PDF** — quality is poor
111
- 3. Save extracted text to `.mindlore/raw/`
112
- 4. Follow steps 3-7 from URL mode
113
- 5. For v0.3+: Marker CLI or Chandra as optional alternatives
114
-
115
- ### File Mode
116
- 1. Read the file with `Read` tool
117
- 2. Save to `.mindlore/raw/`
118
- 3. Follow steps 3-7 from URL mode
119
-
120
- ## Source Summary Format
121
-
122
- The sources/ file should contain:
123
- - **1-paragraph summary** of what the source is about
124
- - **Key takeaways** (3-7 bullet points)
125
- - **Relevance to project** (why this matters)
126
- - **Related** links to other sources/domains in .mindlore/
127
-
128
- Required frontmatter fields include `source_type` — auto-detected:
129
- - `github-repo` if URL contains `github.com/{owner}/{repo}` (not a file/blob URL)
130
- - `docs` if URL contains `/docs/`, `/documentation/`, or `/api/`
131
- - `blog` if URL contains `/blog/`, `/post/`, or `/article/`
132
- - `video` if URL contains `youtube.com`, `youtu.be`, or `vimeo.com`
133
- - `url-fetch` as default fallback for all other URLs
134
- - `text-paste` for Text Mode
135
- - `pdf` for PDF Mode
136
- - `file` for File Mode
137
-
138
- ### Extraction Template
139
-
140
- After detecting `source_type`, check if a matching extraction template exists:
141
-
142
- 1. Read `~/.mindlore/templates/extraction/{source_type}.md`
143
- 2. If found, follow the "Extraction Instructions" section for source analysis
144
- 3. If not found, Read `~/.mindlore/templates/extraction/default.md` and follow that
145
- 4. User can override with `--type <type>` argument (e.g., `/mindlore-ingest https://example.com --type changelog`)
146
-
147
- The template guides WHAT to extract from the source. Apply its instructions when writing the source summary in `sources/{slug}.md`.
148
-
149
- ## Quality Assessment
150
-
151
- Assign quality automatically during ingest using this heuristic:
152
- - `high`: Official docs (anthropic, github docs, MDN), primary research, authoritative references
153
- - `medium`: Blog posts, tutorials, conference talks, X threads with substance
154
- - `low`: Raw notes, text pastes, quick captures, low signal-to-noise
155
-
156
- LLM may override the heuristic based on content analysis. Always set quality — never leave it null.
157
-
158
- ## Domain Update Rules
159
-
160
- - Read the relevant domain page first
161
- - Add new information under the appropriate section
162
- - Add backlink to the source in the domain's references
163
- - Update max 2 domain pages per ingest (prevent scope creep)
164
- - If no relevant domain exists, note it — don't create one during ingest
165
-
166
- ## INDEX.md Update
167
-
168
- Only update the stats line: increment source count and total count.
169
- ```
170
- N source, N analysis, N total
171
- ```
172
-
173
- ## Post-Ingest Quality Gate
174
-
175
- After every ingest, verify all 7 checkpoints before reporting success:
176
-
177
- 0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
178
- ```bash
179
- node "$MINDLORE_PKG/dist/scripts/lib/similarity.js" "<title or first 100 chars>"
180
- ```
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
- Kullanıcı onaylarsa devam et, yoksa atla.
183
- 1. **raw/ file exists** — immutable capture written with frontmatter (slug, type, source_url, project)
184
- 2. **sources/ summary exists** — processed summary with full frontmatter (slug, type, title, tags, quality, description)
185
- 3. **INDEX.md updated** — stats line incremented, Recent section has new entry
186
- 4. **Domain updated** — if relevant domain exists, new finding added (max 1 domain per ingest)
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" "{keyword}"` returns the new file
189
-
190
- If any checkpoint fails, fix it before reporting "ingest complete". Do NOT skip steps.
191
-
192
- Optional: run full health check for structural integrity:
193
- ```bash
194
- node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
195
- ```
1
+ ---
2
+ name: mindlore-ingest
3
+ description: Add new knowledge sources to .mindlore/ (URL, text, file, PDF, GitHub repo)
4
+ effort: medium
5
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch]
6
+ context: fork
7
+ agent: coder
8
+ ---
9
+
10
+ ## Script Resolution
11
+
12
+ Resolve `MINDLORE_PKG` (package root) using one of these methods, in order:
13
+ 1. If CC injected "Base directory for this skill: /path/to/skills/mindlore-ingest" → `MINDLORE_PKG = {base_directory}/../..`
14
+ 2. Fallback: run `node -e "console.log(require('path').join(require('child_process').execSync('npm root -g',{encoding:'utf8'}).trim(),'mindlore')))"`
15
+
16
+ Use: `node "$MINDLORE_PKG/dist/scripts/..."` for all script commands.
17
+
18
+ # /mindlore-ingest
19
+
20
+ Add a new knowledge source to the `.mindlore/` knowledge base.
21
+
22
+ ## Scope
23
+
24
+ Tüm ingest işlemleri global `~/.mindlore/` dizinine yazılır.
25
+ Proje ayrımı frontmatter'daki `project` alanı ile yapılır.
26
+ `raw/` altına proje bazlı klasörleme yapılmaz (session sync hariç).
27
+ Frontmatter'a `project: {CWD project adı}` otomatik eklenir.
28
+
29
+ ## Trigger
30
+
31
+ User shares a URL, text, file, or says "kaynak ekle", "source ingest", "bu linki kaydet", "knowledge ingest".
32
+
33
+ ## Multi-URL Support
34
+
35
+ Birden fazla URL verildiğinde (boşluk veya virgülle ayrılmış):
36
+
37
+ 1. URL'leri parse et — boşluk veya virgülle split
38
+ 2. Her URL için sırayla mevcut URL Mode pipeline'ını çalıştır:
39
+ - Fetch → raw/ yazımı → sources/ dönüşümü → INDEX.md güncelle → log → FTS5 sync
40
+ 3. Her URL için ayrı `skill-memory` dedup kontrolü yap
41
+ 4. Her URL sonrası 7-point quality gate uygula
42
+ 5. Hata olan URL'yi raporla ama sonrakine devam et (fail-forward)
43
+ 6. Tüm URL'ler bittikten sonra toplu rapor döndür:
44
+
45
+ ```json
46
+ { "processed": 3, "failed": 0, "skipped": 1, "sources": ["slug1", "slug2", "slug3"] }
47
+ ```
48
+
49
+ Örnek kullanım:
50
+ ```
51
+ /mindlore-ingest https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html https://docs.aws.amazon.com/dynamodb/latest/developerguide/best-practices.html
52
+ ```
53
+
54
+ ## Modes
55
+
56
+ ### URL Mode (v0.5.2 — Zero-Token Pipeline)
57
+
58
+ **Trigger:** Input starts with `http://` or `https://`
59
+
60
+ **Pre-check (before fetch):**
61
+ ```bash
62
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" get mindlore-ingest last_ingest_urls
63
+ ```
64
+ If URL already in the list, warn user: "This URL was ingested recently. Re-ingest?"
65
+
66
+ **Flow:**
67
+
68
+ 1. **Fetch raw content (zero token):**
69
+ ```bash
70
+ node "$MINDLORE_PKG/dist/scripts/fetch-raw.js" "$URL" --out-dir "$MINDLORE_DIR/raw"
71
+ ```
72
+ Script output: `{ "saved": "/path/to/raw/2026-04-18-abc123.md", "chars": 14823, "method": "curl" }`
73
+
74
+ 2. **Read first 3000 chars (heading-aware truncation):**
75
+ - Read the saved raw file
76
+ - Find the last `##` heading before char 3000
77
+ - Truncate at that heading boundary (not mid-paragraph)
78
+ - If no heading found before 3000, truncate at last paragraph break
79
+
80
+ 3. **Write sources/ summary from truncated content:**
81
+ - Extract: title, description (first paragraph), key topics
82
+ - Generate frontmatter: slug, type: source, source_url, date_captured, tags, quality
83
+ - `project: {path.basename(process.cwd()) ile CWD'den alınan proje adı}`
84
+ - `source_type` is auto-detected from URL pattern (see Source Summary Format)
85
+ - Write to `$MINDLORE_DIR/sources/{slug}.md`
86
+
87
+ 4. **Update INDEX.md** with new source entry
88
+
89
+ 5. **Update skill_memory:**
90
+ ```bash
91
+ node "$MINDLORE_PKG/dist/scripts/lib/skill-memory.js" set mindlore-ingest last_ingest_urls "$URL"
92
+ ```
93
+
94
+ 6. **Return to caller (this is all the ana session sees):**
95
+ ```json
96
+ { "source_id": "abc123", "title": "Extracted Title" }
97
+ ```
98
+
99
+ **Token budget:** ~2-3k tokens in fork context (vs ~40-50k before). Ana session: ~50 tokens.
100
+
101
+ **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)."
102
+
103
+ ### Text Mode
104
+ 1. User pastes text directly
105
+ 2. Save to `.mindlore/raw/` with `source_type: text-paste`
106
+ 3. Follow steps 3-7 from URL mode
107
+
108
+ ### PDF Mode
109
+ 1. Read PDF with CC Read tool: `Read(file_path, pages: "1-5")` (max 20 pages/request)
110
+ 2. **Do NOT use markitdown for PDF** — quality is poor
111
+ 3. Save extracted text to `.mindlore/raw/`
112
+ 4. Follow steps 3-7 from URL mode
113
+ 5. For v0.3+: Marker CLI or Chandra as optional alternatives
114
+
115
+ ### File Mode
116
+ 1. Read the file with `Read` tool
117
+ 2. Save to `.mindlore/raw/`
118
+ 3. Follow steps 3-7 from URL mode
119
+
120
+ ## Source Summary Format
121
+
122
+ The sources/ file should contain:
123
+ - **1-paragraph summary** of what the source is about
124
+ - **Key takeaways** (3-7 bullet points)
125
+ - **Relevance to project** (why this matters)
126
+ - **Related** links to other sources/domains in .mindlore/
127
+
128
+ Required frontmatter fields include `source_type` — auto-detected:
129
+ - `github-repo` if URL contains `github.com/{owner}/{repo}` (not a file/blob URL)
130
+ - `docs` if URL contains `/docs/`, `/documentation/`, or `/api/`
131
+ - `blog` if URL contains `/blog/`, `/post/`, or `/article/`
132
+ - `video` if URL contains `youtube.com`, `youtu.be`, or `vimeo.com`
133
+ - `url-fetch` as default fallback for all other URLs
134
+ - `text-paste` for Text Mode
135
+ - `pdf` for PDF Mode
136
+ - `file` for File Mode
137
+
138
+ ### Extraction Template
139
+
140
+ After detecting `source_type`, check if a matching extraction template exists:
141
+
142
+ 1. Read `~/.mindlore/templates/extraction/{source_type}.md`
143
+ 2. If found, follow the "Extraction Instructions" section for source analysis
144
+ 3. If not found, Read `~/.mindlore/templates/extraction/default.md` and follow that
145
+ 4. User can override with `--type <type>` argument (e.g., `/mindlore-ingest https://example.com --type changelog`)
146
+
147
+ The template guides WHAT to extract from the source. Apply its instructions when writing the source summary in `sources/{slug}.md`.
148
+
149
+ ## Quality Assessment
150
+
151
+ Assign quality automatically during ingest using this heuristic:
152
+ - `high`: Official docs (anthropic, github docs, MDN), primary research, authoritative references
153
+ - `medium`: Blog posts, tutorials, conference talks, X threads with substance
154
+ - `low`: Raw notes, text pastes, quick captures, low signal-to-noise
155
+
156
+ LLM may override the heuristic based on content analysis. Always set quality — never leave it null.
157
+
158
+ ## Domain Update Rules
159
+
160
+ - Read the relevant domain page first
161
+ - Add new information under the appropriate section
162
+ - Add backlink to the source in the domain's references
163
+ - Update max 2 domain pages per ingest (prevent scope creep)
164
+ - If no relevant domain exists, note it — don't create one during ingest
165
+
166
+ ## INDEX.md Update
167
+
168
+ Only update the stats line: increment source count and total count.
169
+ ```
170
+ N source, N analysis, N total
171
+ ```
172
+
173
+ ## Post-Ingest Quality Gate
174
+
175
+ After every ingest, verify all 7 checkpoints before reporting success:
176
+
177
+ 0. **Duplicate check** — Ingest öncesi mevcut DB'de benzer içerik ara:
178
+ ```bash
179
+ node "$MINDLORE_PKG/dist/scripts/lib/similarity.js" "<title or first 100 chars>"
180
+ ```
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
+ Kullanıcı onaylarsa devam et, yoksa atla.
183
+ 1. **raw/ file exists** — immutable capture written with frontmatter (slug, type, source_url, project)
184
+ 2. **sources/ summary exists** — processed summary with full frontmatter (slug, type, title, tags, quality, description)
185
+ 3. **INDEX.md updated** — stats line incremented, Recent section has new entry
186
+ 4. **Domain updated** — if relevant domain exists, new finding added (max 1 domain per ingest)
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" "{keyword}"` returns the new file
189
+
190
+ If any checkpoint fails, fix it before reporting "ingest complete". Do NOT skip steps.
191
+
192
+ Optional: run full health check for structural integrity:
193
+ ```bash
194
+ node "$MINDLORE_PKG/dist/scripts/mindlore-health-check.js"
195
+ ```