vault-kg 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.
- vault_kg-0.1.0/LICENSE +93 -0
- vault_kg-0.1.0/PKG-INFO +413 -0
- vault_kg-0.1.0/README.md +375 -0
- vault_kg-0.1.0/pyproject.toml +193 -0
- vault_kg-0.1.0/src/vaultkg/__init__.py +17 -0
- vault_kg-0.1.0/src/vaultkg/analysis.py +306 -0
- vault_kg-0.1.0/src/vaultkg/cli.py +484 -0
- vault_kg-0.1.0/src/vaultkg/extractor.py +453 -0
- vault_kg-0.1.0/src/vaultkg/mcp_server.py +282 -0
- vault_kg-0.1.0/src/vaultkg/module.py +244 -0
- vault_kg-0.1.0/src/vaultkg/parse.py +399 -0
- vault_kg-0.1.0/src/vaultkg/scene.py +456 -0
- vault_kg-0.1.0/src/vaultkg/snapshots.py +41 -0
- vault_kg-0.1.0/src/vaultkg/theme.py +99 -0
- vault_kg-0.1.0/src/vaultkg/viz.py +200 -0
- vault_kg-0.1.0/src/vaultkg/viz3d.py +119 -0
vault_kg-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set
|
|
20
|
+
of the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
27
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
28
|
+
is subject to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
39
|
+
for the software granted under these terms ends immediately. If your company
|
|
40
|
+
makes such a claim, your patent license ends immediately for work on behalf
|
|
41
|
+
of your company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
46
|
+
you also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license
|
|
61
|
+
no later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your
|
|
64
|
+
licenses to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
76
|
+
the software the licensor makes available under these terms, including any
|
|
77
|
+
portion of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
85
|
+
the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
vault_kg-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vault-kg
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Obsidian-style Markdown vaults as KGModule knowledge graphs: wikilinks, typed links, tags and headings, no LLM extraction
|
|
5
|
+
License-Expression: Elastic-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: knowledge-graph,kgmodule,obsidian,markdown,wikilinks,sqlite-vec,semantic-search
|
|
8
|
+
Author: Eric G. Suchanek, PhD
|
|
9
|
+
Author-email: suchanek@flux-frontiers.com
|
|
10
|
+
Requires-Python: >=3.12,<3.14
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Provides-Extra: semantic
|
|
20
|
+
Provides-Extra: viz
|
|
21
|
+
Provides-Extra: viz3d
|
|
22
|
+
Requires-Dist: click (>=8.1.0,<9)
|
|
23
|
+
Requires-Dist: kgmodule-utils (>=0.23.0)
|
|
24
|
+
Requires-Dist: kgmodule-utils[semantic] (>=0.23.0) ; extra == "semantic"
|
|
25
|
+
Requires-Dist: kgmodule-utils[viz3d-qt,viz3d-render] (>=0.23.0) ; extra == "viz3d"
|
|
26
|
+
Requires-Dist: kgmodule-utils[viz] (>=0.23.0) ; extra == "viz"
|
|
27
|
+
Requires-Dist: mcp (>=1.3.0,<2)
|
|
28
|
+
Requires-Dist: pyvistaqt (>=0.11.0) ; extra == "viz3d"
|
|
29
|
+
Requires-Dist: pyyaml (>=6.0)
|
|
30
|
+
Requires-Dist: quiltwright (>=0.15.0) ; extra == "viz3d"
|
|
31
|
+
Project-URL: Changelog, https://github.com/Flux-Frontiers/vault_kg/blob/main/CHANGELOG.md
|
|
32
|
+
Project-URL: Documentation, https://flux-frontiers.github.io/vault_kg/
|
|
33
|
+
Project-URL: Homepage, https://github.com/Flux-Frontiers/vault_kg
|
|
34
|
+
Project-URL: Issues, https://github.com/Flux-Frontiers/vault_kg/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/Flux-Frontiers/vault_kg
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
[](https://www.python.org/)
|
|
39
|
+
[](https://www.elastic.co/licensing/elastic-license)
|
|
40
|
+
[](https://github.com/Flux-Frontiers/vault_kg/releases)
|
|
41
|
+
[](https://github.com/Flux-Frontiers/vault_kg/actions/workflows/ci.yml)
|
|
42
|
+
[](https://python-poetry.org/)
|
|
43
|
+
[](https://flux-frontiers.github.io/vault_kg/)
|
|
44
|
+
|
|
45
|
+
# VaultKG -- Obsidian Vaults as Knowledge Graphs
|
|
46
|
+
|
|
47
|
+
**VaultKG turns an Obsidian-style Markdown vault into a queryable knowledge graph. Every edge is a link the author wrote.**
|
|
48
|
+
|
|
49
|
+
A vault already is a graph: pages are nodes, `[[wikilinks]]` are edges, and
|
|
50
|
+
people who keep typed links (`supports:: [[X]]`) have written down what kind of
|
|
51
|
+
edge. VaultKG reads that structure directly. It doesn't use a language model to
|
|
52
|
+
extract entities or guess relations, so the same vault always builds the same
|
|
53
|
+
graph.
|
|
54
|
+
|
|
55
|
+
Embeddings are used only to find entry points for a search. Everything after
|
|
56
|
+
that follows the stored links, as in the rest of the
|
|
57
|
+
[KGRAG](https://github.com/Flux-Frontiers/KGRAG) fleet. VaultKG is a `KGModule`
|
|
58
|
+
built on [kgmodule-utils](https://github.com/Flux-Frontiers/KG_utils), so a
|
|
59
|
+
vault federates with code, documents and every other KG kind through KGRAG.
|
|
60
|
+
|
|
61
|
+
*Author: Eric G. Suchanek, PhD -- Flux-Frontiers, Liberty TWP, OH*
|
|
62
|
+
|
|
63
|
+
**Documentation:** [flux-frontiers.github.io/vault_kg](https://flux-frontiers.github.io/vault_kg/)
|
|
64
|
+
covers installation, the graph, graph health, every command, the views, the
|
|
65
|
+
MCP server and the API.
|
|
66
|
+
|
|
67
|
+
> **Status: alpha (0.1.0).** Build, link resolution, graph-health analysis,
|
|
68
|
+
> query and pack, snapshots, the 2-D link graph, the 3-D tree with Looking
|
|
69
|
+
> Glass quilts, the `vaultkg` CLI and the `vaultkg-mcp` server work end to end,
|
|
70
|
+
> and have been run against a 250-note vault. The KGRAG adapter
|
|
71
|
+
> (kind `vault`) is merged into KGRAG and ships in its next release.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Sister projects
|
|
76
|
+
|
|
77
|
+
VaultKG is part of the **KGRAG** family: knowledge-graph systems that share one
|
|
78
|
+
hybrid semantic-plus-structural design, each for a different kind of corpus.
|
|
79
|
+
|
|
80
|
+
- **[DocKG](https://github.com/Flux-Frontiers/doc_kg)** -- document corpora (`.md`, `.txt`, `.rst`, `.pdf`). Use DocKG for prose without links; use VaultKG when the links are the point.
|
|
81
|
+
- **[PyCodeKG](https://github.com/Flux-Frontiers/pycode_kg)** -- Python source code: modules, classes, functions and their typed relationships.
|
|
82
|
+
- **[DiaryKG](https://github.com/Flux-Frontiers/diary_kg)** -- personal journals and diary corpora.
|
|
83
|
+
- **[GenealogyKG](https://github.com/Flux-Frontiers/genealogy_kg)** -- GEDCOM family-history files.
|
|
84
|
+
- **[ConnectomeKG](https://github.com/Flux-Frontiers/connectome_kg)** -- electron-microscopy connectomes.
|
|
85
|
+
- **[AgentKG](https://github.com/Flux-Frontiers/agent_kg)** -- conversational memory as a knowledge graph.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Get started
|
|
90
|
+
|
|
91
|
+
**Requirements:** Python >= 3.12, < 3.14
|
|
92
|
+
|
|
93
|
+
To use the `vaultkg` and `vaultkg-mcp` commands from any directory, install
|
|
94
|
+
them as a tool:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
uv tool install "vault-kg[semantic]" # or: pipx install "vault-kg[semantic]"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To use VaultKG as a library in your own project:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install "vault-kg[semantic]"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The `semantic` extra adds the embedding stack (PyTorch and
|
|
107
|
+
sentence-transformers) for `query`, `pack` and the matching MCP tools. The
|
|
108
|
+
first full build downloads the embedding model, `BAAI/bge-small-en-v1.5`, about
|
|
109
|
+
130 MB. Without the extra, `build --no-index`, `analyze`, `stats`, `links`,
|
|
110
|
+
`snapshot` and the rest of the MCP server work, and `query` says which package
|
|
111
|
+
is missing.
|
|
112
|
+
|
|
113
|
+
Two more extras add the views; install them together with `semantic` or on
|
|
114
|
+
their own:
|
|
115
|
+
|
|
116
|
+
| Extra | Adds |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `viz` | `vaultkg viz`, the interactive 2-D link graph (pyvis) |
|
|
119
|
+
| `viz3d` | `vaultkg quilt` and `vaultkg viz3d`, the vault grown as a 3-D tree (PyVista, PyQt5, quiltwright) |
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
uv tool install "vault-kg[semantic,viz,viz3d]"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
To work on VaultKG itself, install from a clone:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
git clone https://github.com/Flux-Frontiers/vault_kg.git
|
|
129
|
+
cd vault_kg
|
|
130
|
+
poetry install --with dev --all-extras
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Build and query a vault
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
vaultkg build --vault ~/brain # writes ~/brain/.vaultkg/
|
|
137
|
+
vaultkg analyze --vault ~/brain # graph-health report
|
|
138
|
+
vaultkg query --vault ~/brain "why long contexts fail"
|
|
139
|
+
vaultkg pack --vault ~/brain "why long contexts fail"
|
|
140
|
+
vaultkg links --vault ~/brain --in wiki/Retrieval # backlinks
|
|
141
|
+
vaultkg snapshot save --vault ~/brain
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
A note can be named by its node id (`note:wiki/Retrieval.md`) or by its vault
|
|
145
|
+
path, with or without `.md`. `--vault` defaults to the current directory.
|
|
146
|
+
|
|
147
|
+
### Keep the graph current
|
|
148
|
+
|
|
149
|
+
`build` rebuilds the whole graph from the notes on disk; there's no incremental
|
|
150
|
+
update. Run it again after you edit the vault.
|
|
151
|
+
|
|
152
|
+
- **Excluded folders aren't remembered.** Pass the same `--exclude` options on
|
|
153
|
+
every build, or the next build indexes those folders again.
|
|
154
|
+
- **Keep the default `--wipe`.** `--no-wipe` adds and updates nodes but never
|
|
155
|
+
removes them, so deleted and renamed notes stay in the graph.
|
|
156
|
+
- **`--no-index` removes an existing vector index**, because an index from an
|
|
157
|
+
earlier build no longer matches the graph. Run a full `build` before you use
|
|
158
|
+
`query` or `pack` again.
|
|
159
|
+
|
|
160
|
+
### Where the graph is stored
|
|
161
|
+
|
|
162
|
+
`build` writes to `<vault>/.vaultkg/`:
|
|
163
|
+
|
|
164
|
+
| Path | Contents |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `graph.sqlite` | Nodes and edges |
|
|
167
|
+
| `vectors.sqlite` | The vector index (full builds only) |
|
|
168
|
+
| `snapshots/` | Metric snapshots from `vaultkg snapshot save` |
|
|
169
|
+
|
|
170
|
+
Obsidian ignores dot-folders, so the store never shows up as a note. If the
|
|
171
|
+
vault is a git repository, ignore the databases and keep the snapshots:
|
|
172
|
+
|
|
173
|
+
```gitignore
|
|
174
|
+
.vaultkg/*.sqlite
|
|
175
|
+
.vaultkg/*.sqlite-*
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If a sync service copies the vault between devices, exclude `.vaultkg/` there
|
|
179
|
+
and rebuild on each device.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## CLI reference
|
|
184
|
+
|
|
185
|
+
Every command takes `--vault DIR` (default: the current directory) and `--help`.
|
|
186
|
+
|
|
187
|
+
| Command | What it does | Options |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| `vaultkg build` | Parse the vault into a graph and a vector index | `--exclude PATTERN` (repeatable; a folder name or a glob on vault-relative paths), `--no-index`, `--wipe/--no-wipe` (default `--wipe`) |
|
|
190
|
+
| `vaultkg analyze` | Print the graph-health report | `--json` for the metrics as JSON |
|
|
191
|
+
| `vaultkg stats` | Print node and edge counts as JSON | |
|
|
192
|
+
| `vaultkg query Q` | Semantic search, then expansion along links | `-k` seed hits (1-100, default 8), `--hop` link hops (0-5, default 1), `--json` for the full result |
|
|
193
|
+
| `vaultkg pack Q` | The same search, printed as Markdown with each note's text | `-k`, `--hop` |
|
|
194
|
+
| `vaultkg links NODE` | A node's outgoing links | `--in` for backlinks, `--rel REL` for one relation, `--limit` (1-500, default 50) |
|
|
195
|
+
| `vaultkg snapshot save [KEY]` | Record the current metrics (key defaults to a UTC timestamp) | `--force` to save when nothing changed |
|
|
196
|
+
| `vaultkg snapshot list` | List snapshots, newest first | |
|
|
197
|
+
| `vaultkg snapshot diff A B` | Compare two snapshots | |
|
|
198
|
+
| `vaultkg viz [ROOT]` | Write the link graph as an interactive HTML page | `-o FILE` (default `<vault name>_links.html`), `--hops` (0-5, default 1), `--max-nodes` (2-5000, default 200), `--headings` |
|
|
199
|
+
| `vaultkg quilt` | Grow the vault as a 3-D tree and render a Looking Glass quilt | `--preset` (default `16-landscape`), `-o DIR` (default `renders`), `--group-by`, `--color-by`, `--tip-radius`, `--leaf-size`, `--zoom`, `--fov`, `--cast`, `--schematic` |
|
|
200
|
+
| `vaultkg viz3d` | Open the 3-D tree in an interactive viewer | `--group-by`, `--color-by`, `--preset`, `--width`, `--height`, `--schematic` |
|
|
201
|
+
| `vaultkg --version` | Print the installed version | |
|
|
202
|
+
|
|
203
|
+
`query` and `pack` need the `semantic` extra and a build without `--no-index`.
|
|
204
|
+
`viz` needs the `viz` extra; `quilt` and `viz3d` need `viz3d`. The other
|
|
205
|
+
commands need only a built graph.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## What becomes the graph
|
|
210
|
+
|
|
211
|
+
| Node | From |
|
|
212
|
+
|---|---|
|
|
213
|
+
| `note` | every `.md` file |
|
|
214
|
+
| `heading` | every ATX heading, as a section with its line span |
|
|
215
|
+
| `tag` | `#tag` and frontmatter `tags:`; nested tags chain (`#ml` -> `#ml/retrieval`) |
|
|
216
|
+
| `attachment` | an embedded or linked non-Markdown file |
|
|
217
|
+
| unresolved | a link target no file answers to (Obsidian's "unresolved links") |
|
|
218
|
+
|
|
219
|
+
| Edge | From |
|
|
220
|
+
|---|---|
|
|
221
|
+
| `LINKS_TO` | `[[Page]]`, `[[Page\|alias]]`, `[text](page.md)`, `[text](folder/)` |
|
|
222
|
+
| `EMBEDS` | `![[Page]]`, `![[image.png]]` |
|
|
223
|
+
| `CONTAINS` | note -> heading -> subheading, tag -> nested tag |
|
|
224
|
+
| `TAGGED` | note -> tag |
|
|
225
|
+
| typed | Dataview inline fields (`(supports:: [[X]])`, `- up:: [[Home]]`) and frontmatter keys holding wikilinks (`contradicts: ["[[Y]]"]`). These become `SUPPORTS`, `UP`, `CONTRADICTS` and so on. |
|
|
226
|
+
|
|
227
|
+
Links resolve the way Obsidian resolves them, in this order:
|
|
228
|
+
|
|
229
|
+
1. The exact vault path.
|
|
230
|
+
2. A path relative to the linking note.
|
|
231
|
+
3. The file name, in the same folder first, then the shortest path.
|
|
232
|
+
4. A frontmatter `aliases` entry.
|
|
233
|
+
|
|
234
|
+
`[[Page#Heading]]` points at the heading. A Markdown link is a path and never
|
|
235
|
+
resolves by name. Wikilinks inside code blocks, inline code and `%% comments %%`
|
|
236
|
+
are ignored. A link that matched several same-named notes is marked `ambiguous`.
|
|
237
|
+
|
|
238
|
+
Frontmatter `date` becomes the fleet's `occurred_start` and `created` becomes
|
|
239
|
+
`recorded_at`, so KGRAG time-scoped queries can filter notes by date. File
|
|
240
|
+
modification times aren't used, because they change on every clone.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Graph health
|
|
245
|
+
|
|
246
|
+
`vaultkg analyze` reports these figures, computed from the graph alone:
|
|
247
|
+
|
|
248
|
+
- **Hubs**: the notes that the most other notes link to.
|
|
249
|
+
- **Bridges**: notes whose removal would split the graph (articulation points).
|
|
250
|
+
- **Wanted pages**: link targets with no note, ranked by how many notes want them.
|
|
251
|
+
- **Orphans**: notes with no links in or out.
|
|
252
|
+
- **Islands**: linked groups cut off from the main graph.
|
|
253
|
+
- **Typed links**: counts per relation, with every `contradicts` pair listed.
|
|
254
|
+
- **Tags**, **ambiguous links**, and **frontmatter that failed to parse**.
|
|
255
|
+
|
|
256
|
+
`vaultkg analyze --json` prints the same figures as JSON. `vaultkg snapshot
|
|
257
|
+
save` records them, so `snapshot diff` shows how a vault's structure changed
|
|
258
|
+
between two dates.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## See the vault
|
|
263
|
+
|
|
264
|
+
### The link graph
|
|
265
|
+
|
|
266
|
+
`vaultkg viz` writes one self-contained HTML page that opens from disk in any
|
|
267
|
+
browser, with no server:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
vaultkg viz --vault ~/brain # the most connected part of the vault
|
|
271
|
+
vaultkg viz --vault ~/brain wiki/Retrieval --hops 2 # one note's neighbourhood
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
- Notes are sized by backlinks, so hubs stand out, and coloured by top-level
|
|
275
|
+
folder. Tags are diamonds, attachments squares, and missing notes grey
|
|
276
|
+
triangles.
|
|
277
|
+
- With a root note, the page shows everything within `--hops` links of it,
|
|
278
|
+
in either direction, and rings the root in gold. Without one, it shows the
|
|
279
|
+
most connected `--max-nodes` nodes.
|
|
280
|
+
- Headings are left out unless you pass `--headings`; a vault has several per
|
|
281
|
+
note, and they hide the links between notes.
|
|
282
|
+
- Drag to pan, scroll to zoom, and click a node for its details.
|
|
283
|
+
|
|
284
|
+
### The vault as a tree
|
|
285
|
+
|
|
286
|
+
`vaultkg quilt` and `vaultkg viz3d` grow the vault as a 3-D tree: the vault is
|
|
287
|
+
the trunk, each folder is a limb, subfolders branch off their parent, and
|
|
288
|
+
every note is a leaf at the tip of its folder. Notes at the vault root ring
|
|
289
|
+
the base of the trunk. A bigger folder grows a longer limb. The growth is
|
|
290
|
+
seeded from the vault's name, so the same vault always grows the same tree.
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
vaultkg quilt --vault ~/brain # writes renders/brain_qs8x6a1.77778.png
|
|
294
|
+
vaultkg quilt --vault ~/brain --color-by links --cast
|
|
295
|
+
vaultkg viz3d --vault ~/brain # interactive; orbit, zoom, pan
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
| Option | Values |
|
|
299
|
+
|---|---|
|
|
300
|
+
| `--group-by` | `auto` (default): folders, or nested tags for a vault with no folders. `folder`. `tag`: limbs from nested tags (`#ml/retrieval`), untagged notes at the base. |
|
|
301
|
+
| `--color-by` | `group` (default): top-level folder or tag. `tag`: first tag. `links`: backlink count, pale to dark. |
|
|
302
|
+
| `--schematic` | Draw the layout with straight lines instead of growing wood. Fast at any size. |
|
|
303
|
+
|
|
304
|
+
`quilt` prints the colour legend and the depth budget for the chosen preset,
|
|
305
|
+
then writes the quilt with its view-count suffix. `--cast` sends it to a
|
|
306
|
+
running [Looking Glass Bridge](https://lookingglassfactory.com/software/looking-glass-bridge);
|
|
307
|
+
if Bridge isn't running, the quilt is still written. In `viz3d`, the **Cast to
|
|
308
|
+
Looking Glass** toolbar button sends the current view.
|
|
309
|
+
|
|
310
|
+
The tree is built on the fleet's shared growth engine
|
|
311
|
+
(`kg_utils.viz3d`) and light-field output
|
|
312
|
+
([quiltwright](https://github.com/Flux-Frontiers/quiltwright)), as in the other
|
|
313
|
+
KGRAG modules.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## MCP server
|
|
318
|
+
|
|
319
|
+
`vaultkg-mcp` serves one vault to any MCP client (Claude Code, Cursor, GitHub
|
|
320
|
+
Copilot, Claude Desktop). To serve a vault, add it to the client's `.mcp.json`:
|
|
321
|
+
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"mcpServers": {
|
|
325
|
+
"vaultkg": {
|
|
326
|
+
"command": "vaultkg-mcp",
|
|
327
|
+
"args": ["--vault", "/path/to/vault"]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
| Tool | What it returns |
|
|
334
|
+
|---|---|
|
|
335
|
+
| `graph_stats` | Note, heading, tag and unresolved-link counts |
|
|
336
|
+
| `query_vault(q, k, hop)` | Semantic hits, expanded along their links, as JSON |
|
|
337
|
+
| `pack_vault(q, k, hop, max_nodes)` | The same search with note and section text, as Markdown |
|
|
338
|
+
| `get_node(node_id)` | One node and its metadata (title, tags, aliases, dates) |
|
|
339
|
+
| `note_links(node_id, direction, rel, limit)` | Outgoing links, or backlinks with `direction="in"` |
|
|
340
|
+
| `analyze_vault` | The graph-health report |
|
|
341
|
+
| `snapshot_list`, `snapshot_show`, `snapshot_diff` | Saved metric snapshots |
|
|
342
|
+
|
|
343
|
+
Out-of-range arguments are rejected with a message naming the range, never
|
|
344
|
+
clamped: `k` 1-100, `hop` 0-5, `max_nodes` and `limit` 1-500. The server
|
|
345
|
+
closes the graph when it stops.
|
|
346
|
+
|
|
347
|
+
| Option | Meaning |
|
|
348
|
+
|---|---|
|
|
349
|
+
| `--vault DIR` | Vault root (default: the current directory). `--repo` is accepted as an alias. |
|
|
350
|
+
| `--db PATH` | Graph database (default: `<vault>/.vaultkg/graph.sqlite`) |
|
|
351
|
+
| `--transport {stdio,sse}` | MCP transport (default: `stdio`) |
|
|
352
|
+
|
|
353
|
+
Build the vault before you start the server. The server doesn't build it, and
|
|
354
|
+
exits with an error if `<vault>/.vaultkg/graph.sqlite` doesn't exist.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Use VaultKG from KGRAG
|
|
359
|
+
|
|
360
|
+
KGRAG registers a vault as kind `vault`:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
kgrag register my-brain vault ~/brain
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
`kgrag scan --auto-register` finds and registers any vault holding a
|
|
367
|
+
`.vaultkg/` store. KGRAG needs `vault-kg` installed in the same environment;
|
|
368
|
+
until it is, the adapter reports the KG as unavailable.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Development
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
env -u VIRTUAL_ENV -u POETRY_ACTIVE poetry install --with dev --all-extras
|
|
376
|
+
env -u VIRTUAL_ENV -u POETRY_ACTIVE poetry run pytest --cov
|
|
377
|
+
env -u VIRTUAL_ENV -u POETRY_ACTIVE .venv/bin/pre-commit run --all-files
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
The tests embed with a hashing stub, so they need no model download. The
|
|
381
|
+
coverage floor is set in `pyproject.toml`.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## License
|
|
386
|
+
|
|
387
|
+
[Elastic License 2.0](https://www.elastic.co/licensing/elastic-license) -- see
|
|
388
|
+
[LICENSE](https://github.com/Flux-Frontiers/vault_kg/blob/main/LICENSE).
|
|
389
|
+
|
|
390
|
+
Free to use, modify, and distribute. You may not offer the software as a hosted
|
|
391
|
+
or managed service to third parties. Commercial internal use is permitted.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Citation
|
|
396
|
+
|
|
397
|
+
If you use VaultKG in your research or project, please cite it:
|
|
398
|
+
|
|
399
|
+
> Suchanek, E. G. (2026). *VaultKG: Obsidian Vaults as Knowledge Graphs* (Version 0.1.0) [Software]. Flux-Frontiers. https://github.com/Flux-Frontiers/vault_kg
|
|
400
|
+
|
|
401
|
+
```bibtex
|
|
402
|
+
@software{suchanek_vaultkg,
|
|
403
|
+
author = {Suchanek, Eric G.},
|
|
404
|
+
title = {{VaultKG}: Obsidian Vaults as Knowledge Graphs},
|
|
405
|
+
version = {0.1.0},
|
|
406
|
+
year = {2026},
|
|
407
|
+
publisher = {Flux-Frontiers},
|
|
408
|
+
url = {https://github.com/Flux-Frontiers/vault_kg},
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
See the [changelog](https://github.com/Flux-Frontiers/vault_kg/blob/main/CHANGELOG.md) for release history.
|
|
413
|
+
|