mindloom 0.1.0__tar.gz

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.
@@ -0,0 +1,31 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(python:*)",
5
+ "Bash(python3:*)",
6
+ "WebFetch(domain:github.com)",
7
+ "WebFetch(domain:api.github.com)",
8
+ "WebFetch(domain:raw.githubusercontent.com)",
9
+ "Bash(pip index:*)",
10
+ "Bash(pip show:*)",
11
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/pip show:*)",
12
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/pip install:*)",
13
+ "WebFetch(domain:pypi.org)",
14
+ "Bash(git:*)",
15
+ "Bash(.venv/bin/uv add:*)",
16
+ "Bash(uv add:*)",
17
+ "Bash(uv run:*)",
18
+ "WebSearch",
19
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/python -c \"import pytest\")",
20
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/python -c \"import trafilatura; print\\(trafilatura.__version__\\)\")",
21
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/python -c \"import playwright; print\\(playwright.__version__\\)\")",
22
+ "Bash(/Users/williambrach/Developer/mindloom/.venv/bin/python -c \"import markdownify\")",
23
+ "Bash(grep -r \"^import\\\\|^from\" /Users/williambrach/Developer/mindloom/mindloom/*.py)",
24
+ "Bash(grep -E \"\\\\.\\(md|json|txt\\)$\")",
25
+ "Bash(grep:*)",
26
+ "Bash(wc:*)",
27
+ "Bash(uv build:*)",
28
+ "Bash(unzip -l dist/mindloom-0.1.0-py3-none-any.whl)"
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.12
mindloom-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 William Brach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: mindloom
3
+ Version: 0.1.0
4
+ Summary: Weave raw knowledge into structured Obsidian wikis, powered by Claude Code
5
+ Project-URL: Homepage, https://github.com/williambrach/mindloom
6
+ Author: William Brach
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: claude,knowledge-base,obsidian,wiki
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.12
15
+ Requires-Dist: bb25>=0.4.0
16
+ Requires-Dist: httpx>=0.28.1
17
+ Requires-Dist: markdownify>=1.2.2
18
+ Requires-Dist: pymupdf4llm>=1.27.2.2
19
+ Requires-Dist: tiktoken>=0.12.0
20
+ Requires-Dist: trafilatura>=2.0.0
21
+ Requires-Dist: typer>=0.24.1
22
+ Provides-Extra: browser
23
+ Requires-Dist: playwright>=1.40; extra == 'browser'
24
+ Provides-Extra: dev
25
+ Requires-Dist: black>=26.3.1; extra == 'dev'
26
+ Requires-Dist: ruff>=0.15.9; extra == 'dev'
27
+ Requires-Dist: ty>=0.0.28; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # mindloom
31
+
32
+ Weave raw knowledge into structured Obsidian wikis, powered by Claude Code.
33
+
34
+ Inspired by [Andrej Karpathy's LLM Knowledge Bases](https://x.com/karpathy/status/2039805659525644595) workflow.
35
+ You curate (paste a link). Claude Code thinks (compile, cross-link, answer, lint).
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ # Recommended: global install via uv (works from anywhere)
41
+ uv tool install mindloom
42
+
43
+ # Optional: browser extra for JS-heavy sites
44
+ uv tool install "mindloom[browser]"
45
+ ```
46
+
47
+ **Requires:** Python 3.12+, [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed for compile / ask / lint.
48
+
49
+ ## How it works
50
+
51
+ ```
52
+ loom add <url> -v ~/my-wiki
53
+ ├─ 1. fetch: trafilatura / playwright / pymupdf (PDF) (Python)
54
+ ├─ 2. images downloaded, paths rewritten (Python)
55
+ ├─ 3. saved to raw/ with YAML frontmatter (Python)
56
+ └─ 4. claude -p "compile this into the wiki" (Claude Code)
57
+ ├─ reads CLAUDE.md (the rules)
58
+ ├─ reads _index.md (what exists)
59
+ ├─ uses loom search + Grep to find related articles
60
+ ├─ writes/updates wiki/ articles with [[wikilinks]]
61
+ └─ updates _index.md
62
+ ```
63
+
64
+ ## Usage
65
+
66
+ Every command (except `init`) requires `--vault` / `-v` pointing to your vault.
67
+
68
+ ```bash
69
+ # Create a vault (open it in Obsidian)
70
+ loom init ~/my-wiki
71
+
72
+ # Add articles — fetches + auto-compiles
73
+ loom add "https://arxiv.org/abs/..." -t "transformers, attention" -v ~/my-wiki
74
+ loom add "https://blog.example.com" -t "rl, rlhf" -v ~/my-wiki
75
+ loom add "https://..." --no-compile -v ~/my-wiki # just fetch, compile later
76
+
77
+ # Compile pending raw articles
78
+ loom compile -v ~/my-wiki
79
+ loom compile --full -v ~/my-wiki # recompile everything
80
+
81
+ # Ask questions (Claude Code researches your wiki)
82
+ loom ask "How does flash attention work?" -v ~/my-wiki
83
+ loom ask "Compare RLHF vs DPO" -o markdown -v ~/my-wiki # save as .md
84
+ loom ask "Overview of transformers" -o marp -v ~/my-wiki # save as slideshow
85
+
86
+ # Search (BM25-ranked via bb25)
87
+ loom search "attention mechanism" -v ~/my-wiki
88
+ loom search "attention mechanism" -n 5 -v ~/my-wiki # limit results
89
+
90
+ # Rebuild search index from scratch
91
+ loom reindex -v ~/my-wiki
92
+
93
+ # Health check
94
+ loom lint -v ~/my-wiki
95
+
96
+ # Vault info
97
+ loom status -v ~/my-wiki
98
+
99
+ # Open in Obsidian
100
+ loom open -v ~/my-wiki # opens index
101
+ loom open wiki/attention.md -v ~/my-wiki # opens specific note
102
+ ```
103
+
104
+ ## Python API
105
+
106
+ All functions are importable and return dicts/values (no printing, no `sys.exit`).
107
+
108
+ ```python
109
+ from mindloom import (
110
+ init_vault, add, compile_vault, ask,
111
+ search, reindex, lint, status,
112
+ )
113
+
114
+ # Create a vault
115
+ vault = init_vault("~/my-wiki") # returns Path
116
+
117
+ # Ingest a URL (fetch + save to raw/)
118
+ result = add(
119
+ "https://arxiv.org/abs/2405.04434",
120
+ vault="~/my-wiki",
121
+ tags=["transformers", "attention"],
122
+ compile_after=True, # auto-compile via Claude Code
123
+ )
124
+ print(result["title"], result["rel_path"]) # "Article Title" "raw/slug.md"
125
+
126
+ # Compile pending raw articles
127
+ compile_vault("~/my-wiki") # only uncompiled
128
+ compile_vault("~/my-wiki", full=True) # recompile everything
129
+
130
+ # Ask questions (Claude Code researches the wiki)
131
+ answer = ask("How does flash attention work?", vault="~/my-wiki")
132
+ print(answer["answer"])
133
+
134
+ # Save as markdown or Marp slideshow
135
+ ask("Compare RLHF vs DPO", vault="~/my-wiki", output_format="markdown")
136
+ ask("Overview of transformers", vault="~/my-wiki", output_format="marp")
137
+
138
+ # BM25 search
139
+ hits = search("attention mechanism", vault="~/my-wiki", limit=5)
140
+ for h in hits:
141
+ print(h["title"], h["score"], h["snippet"])
142
+
143
+ # Rebuild search index
144
+ doc_count = reindex("~/my-wiki")
145
+
146
+ # Health check (writes report to _meta/lint-report.md)
147
+ lint("~/my-wiki")
148
+
149
+ # Vault stats
150
+ info = status("~/my-wiki")
151
+ print(info)
152
+ # {'vault_path': '...', 'raw_count': 12, 'pending_count': 2,
153
+ # 'wiki_count': 8, 'output_count': 3, 'has_claude': True}
154
+ ```
155
+
@@ -0,0 +1,126 @@
1
+ # mindloom
2
+
3
+ Weave raw knowledge into structured Obsidian wikis, powered by Claude Code.
4
+
5
+ Inspired by [Andrej Karpathy's LLM Knowledge Bases](https://x.com/karpathy/status/2039805659525644595) workflow.
6
+ You curate (paste a link). Claude Code thinks (compile, cross-link, answer, lint).
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ # Recommended: global install via uv (works from anywhere)
12
+ uv tool install mindloom
13
+
14
+ # Optional: browser extra for JS-heavy sites
15
+ uv tool install "mindloom[browser]"
16
+ ```
17
+
18
+ **Requires:** Python 3.12+, [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed for compile / ask / lint.
19
+
20
+ ## How it works
21
+
22
+ ```
23
+ loom add <url> -v ~/my-wiki
24
+ ├─ 1. fetch: trafilatura / playwright / pymupdf (PDF) (Python)
25
+ ├─ 2. images downloaded, paths rewritten (Python)
26
+ ├─ 3. saved to raw/ with YAML frontmatter (Python)
27
+ └─ 4. claude -p "compile this into the wiki" (Claude Code)
28
+ ├─ reads CLAUDE.md (the rules)
29
+ ├─ reads _index.md (what exists)
30
+ ├─ uses loom search + Grep to find related articles
31
+ ├─ writes/updates wiki/ articles with [[wikilinks]]
32
+ └─ updates _index.md
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Every command (except `init`) requires `--vault` / `-v` pointing to your vault.
38
+
39
+ ```bash
40
+ # Create a vault (open it in Obsidian)
41
+ loom init ~/my-wiki
42
+
43
+ # Add articles — fetches + auto-compiles
44
+ loom add "https://arxiv.org/abs/..." -t "transformers, attention" -v ~/my-wiki
45
+ loom add "https://blog.example.com" -t "rl, rlhf" -v ~/my-wiki
46
+ loom add "https://..." --no-compile -v ~/my-wiki # just fetch, compile later
47
+
48
+ # Compile pending raw articles
49
+ loom compile -v ~/my-wiki
50
+ loom compile --full -v ~/my-wiki # recompile everything
51
+
52
+ # Ask questions (Claude Code researches your wiki)
53
+ loom ask "How does flash attention work?" -v ~/my-wiki
54
+ loom ask "Compare RLHF vs DPO" -o markdown -v ~/my-wiki # save as .md
55
+ loom ask "Overview of transformers" -o marp -v ~/my-wiki # save as slideshow
56
+
57
+ # Search (BM25-ranked via bb25)
58
+ loom search "attention mechanism" -v ~/my-wiki
59
+ loom search "attention mechanism" -n 5 -v ~/my-wiki # limit results
60
+
61
+ # Rebuild search index from scratch
62
+ loom reindex -v ~/my-wiki
63
+
64
+ # Health check
65
+ loom lint -v ~/my-wiki
66
+
67
+ # Vault info
68
+ loom status -v ~/my-wiki
69
+
70
+ # Open in Obsidian
71
+ loom open -v ~/my-wiki # opens index
72
+ loom open wiki/attention.md -v ~/my-wiki # opens specific note
73
+ ```
74
+
75
+ ## Python API
76
+
77
+ All functions are importable and return dicts/values (no printing, no `sys.exit`).
78
+
79
+ ```python
80
+ from mindloom import (
81
+ init_vault, add, compile_vault, ask,
82
+ search, reindex, lint, status,
83
+ )
84
+
85
+ # Create a vault
86
+ vault = init_vault("~/my-wiki") # returns Path
87
+
88
+ # Ingest a URL (fetch + save to raw/)
89
+ result = add(
90
+ "https://arxiv.org/abs/2405.04434",
91
+ vault="~/my-wiki",
92
+ tags=["transformers", "attention"],
93
+ compile_after=True, # auto-compile via Claude Code
94
+ )
95
+ print(result["title"], result["rel_path"]) # "Article Title" "raw/slug.md"
96
+
97
+ # Compile pending raw articles
98
+ compile_vault("~/my-wiki") # only uncompiled
99
+ compile_vault("~/my-wiki", full=True) # recompile everything
100
+
101
+ # Ask questions (Claude Code researches the wiki)
102
+ answer = ask("How does flash attention work?", vault="~/my-wiki")
103
+ print(answer["answer"])
104
+
105
+ # Save as markdown or Marp slideshow
106
+ ask("Compare RLHF vs DPO", vault="~/my-wiki", output_format="markdown")
107
+ ask("Overview of transformers", vault="~/my-wiki", output_format="marp")
108
+
109
+ # BM25 search
110
+ hits = search("attention mechanism", vault="~/my-wiki", limit=5)
111
+ for h in hits:
112
+ print(h["title"], h["score"], h["snippet"])
113
+
114
+ # Rebuild search index
115
+ doc_count = reindex("~/my-wiki")
116
+
117
+ # Health check (writes report to _meta/lint-report.md)
118
+ lint("~/my-wiki")
119
+
120
+ # Vault stats
121
+ info = status("~/my-wiki")
122
+ print(info)
123
+ # {'vault_path': '...', 'raw_count': 12, 'pending_count': 2,
124
+ # 'wiki_count': 8, 'output_count': 3, 'has_claude': True}
125
+ ```
126
+
@@ -0,0 +1,139 @@
1
+ # Knowledge Base — Claude Code Instructions
2
+
3
+ You are maintaining an Obsidian-compatible knowledge base powered by mindloom.
4
+ Your job is to compile raw web content into a structured, interlinked wiki.
5
+ The wiki is YOUR domain — the user rarely edits it directly.
6
+
7
+ ## Vault structure
8
+
9
+ ```
10
+ .
11
+ ├── raw/ ← Ingested web content (don't modify these)
12
+ ├── wiki/ ← YOUR compiled articles (you own this)
13
+ ├── mocs/ ← Maps of Content (auto-generated indexes)
14
+ ├── outputs/ ← Q&A answers, slideshows, charts
15
+ ├── attachments/ ← Images organized by article slug
16
+ ├── _meta/ ← System files (db, lint reports)
17
+ ├── _index.md ← Master index (you maintain this)
18
+ └── CLAUDE.md ← This file
19
+ ```
20
+
21
+ ## Frontmatter schema
22
+
23
+ Every wiki article MUST have this YAML frontmatter:
24
+
25
+ ```yaml
26
+ ---
27
+ title: "Article Title"
28
+ aliases: ["Short Name", "Abbreviation"]
29
+ tags: [topic/machine-learning, status/published]
30
+ summary: "One-sentence summary for the index."
31
+ sources: ["raw-slug-1", "raw-slug-2"]
32
+ created: "2026-04-03T14:00:00Z"
33
+ updated: "2026-04-03T14:00:00Z"
34
+ ---
35
+ ```
36
+
37
+ Tags use nested namespaces: `topic/`, `status/` (raw|draft|published), `source/` (article|paper|video|repo).
38
+
39
+ ## Compilation rules
40
+
41
+ When you receive a new raw article to compile:
42
+
43
+ 1. **Read the raw article** completely.
44
+ 2. **Read `_index.md`** to understand what wiki articles already exist.
45
+ 3. **Search for related content**: run `loom search "<key terms>"` first. If the results are relevant, read those files. If not, fall back to Grep on `wiki/`, `raw/`, and `outputs/`.
46
+ 4. **Decide**: CREATE a new wiki article, or UPDATE an existing one.
47
+ - If >70% of the content overlaps an existing article → UPDATE
48
+ - If the topic is genuinely new → CREATE
49
+ - If two existing articles should merge → MERGE (update one, redirect the other)
50
+ 5. **Write the article** following the format below.
51
+ 6. **Add wikilinks**: scan your article for mentions of other wiki article titles and wrap them in `[[wikilinks]]`. Also add wikilinks FROM related existing articles back to your new one.
52
+ 7. **Update `_index.md`**: add the new article between the `<!-- BEGIN:ARTICLES -->` and `<!-- END:ARTICLES -->` markers.
53
+ 8. **Mark as compiled**: change the raw article's frontmatter `status: raw` → `status: compiled`.
54
+
55
+ ## Article format
56
+
57
+ ```markdown
58
+ ---
59
+ (frontmatter as above)
60
+ ---
61
+
62
+ ## Summary
63
+
64
+ (2-3 sentence overview. This is what appears in the index.)
65
+
66
+ ## Key concepts
67
+
68
+ (Main content organized with ## headings. Link to [[other articles]].)
69
+
70
+ ## Details
71
+
72
+ (Deeper explanation, examples, formulas, code, etc.)
73
+
74
+ ## Sources
75
+
76
+ - Raw: [[raw/slug-name]]
77
+ - External: [Original URL](https://...)
78
+ ```
79
+
80
+ ## Wikilink conventions
81
+
82
+ - Use `[[article-title]]` for internal links (Obsidian resolves by filename).
83
+ - For display text: `[[filename|Display Text]]`.
84
+ - For section links: `[[filename#Section Name]]`.
85
+ - Images: `![alt](attachments/slug/hash.png)` (standard markdown, not wikilink).
86
+
87
+ ## Index maintenance
88
+
89
+ The `_index.md` file has marker comments. Only edit between them:
90
+
91
+ ```markdown
92
+ <!-- BEGIN:ARTICLES -->
93
+ - [[wiki/article-name|Article Title]] — One-sentence summary
94
+ <!-- END:ARTICLES -->
95
+ ```
96
+
97
+ Keep entries sorted alphabetically. The RECENT section lists the 10 most recently updated.
98
+
99
+ ## Linting rules
100
+
101
+ When asked to lint, check:
102
+
103
+ 1. **Broken links**: every `[[target]]` must have a corresponding .md file
104
+ 2. **Orphans**: wiki articles with zero inbound wikilinks
105
+ 3. **Stale sources**: raw/ files still with `status: raw` in frontmatter
106
+ 4. **Missing metadata**: articles without summary, tags, or sources
107
+ 5. **Duplicates**: articles with >70% content overlap (suggest merge)
108
+ 6. **Missing concepts**: terms in 3+ articles that lack their own page
109
+ 7. **Consistency**: same fact stated differently across articles
110
+
111
+ Write results to `_meta/lint-report.md`.
112
+
113
+ ## Q&A rules
114
+
115
+ When answering questions:
116
+
117
+ 1. Always start by reading `_index.md`.
118
+ 2. Run `loom search "<relevant terms>"` first. If the results look useful, read those files. If not, fall back to Grep on `wiki/`, `raw/`, and `outputs/`.
119
+ 3. Read the full text of the top 3-5 relevant articles.
120
+ 4. Cite sources with `[[wikilinks]]`.
121
+ 5. If the wiki doesn't have enough info, say so clearly.
122
+ 6. When asked for Marp slides, use `marp: true` frontmatter and `---` between slides.
123
+ 7. When saving output, write to `outputs/` with proper frontmatter.
124
+
125
+ ## Tools available to you
126
+
127
+ - **`loom search "<query>" -n <limit>`** — BM25 keyword search across all vault files (wiki/, raw/, outputs/). Run via Bash. **Use this first** when looking for content in the knowledge base. It returns ranked results with titles, scores, and highlighted snippets. If the results are relevant, read the matched files directly. If they are not useful (low scores, off-topic), fall back to Grep/Glob.
128
+ - Grep — search content across all .md files (use glob `*.md` and search in `wiki/`, `raw/`, `outputs/`). Use as fallback when loom search misses exact patterns or regex is needed.
129
+ - Glob — find files by name pattern (e.g., `wiki/*.md`)
130
+ - Direct file read/write — read any .md file, write to wiki/, mocs/, outputs/
131
+ - To mark a raw article as compiled, change its frontmatter `status: raw` → `status: compiled`
132
+
133
+ ## Style guide
134
+
135
+ - Clear, encyclopedic prose. Not marketing, not academic jargon.
136
+ - Active voice. Define technical terms on first use.
137
+ - Summaries under 3 sentences.
138
+ - One concept per article — split if too broad.
139
+ - Concrete examples over abstract explanations.
@@ -0,0 +1,10 @@
1
+ from mindloom.api import (
2
+ add,
3
+ ask,
4
+ compile_vault,
5
+ init_vault,
6
+ lint,
7
+ reindex,
8
+ search,
9
+ status,
10
+ )