graphify-vault 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.
Files changed (73) hide show
  1. graphify_vault-0.1.0/LICENSE +21 -0
  2. graphify_vault-0.1.0/PKG-INFO +508 -0
  3. graphify_vault-0.1.0/README.md +419 -0
  4. graphify_vault-0.1.0/graphify/__init__.py +28 -0
  5. graphify_vault-0.1.0/graphify/__main__.py +1527 -0
  6. graphify_vault-0.1.0/graphify/analyze.py +540 -0
  7. graphify_vault-0.1.0/graphify/benchmark.py +129 -0
  8. graphify_vault-0.1.0/graphify/build.py +107 -0
  9. graphify_vault-0.1.0/graphify/cache.py +205 -0
  10. graphify_vault-0.1.0/graphify/cluster.py +137 -0
  11. graphify_vault-0.1.0/graphify/detect.py +520 -0
  12. graphify_vault-0.1.0/graphify/doctor.py +242 -0
  13. graphify_vault-0.1.0/graphify/export.py +1027 -0
  14. graphify_vault-0.1.0/graphify/extract.py +3955 -0
  15. graphify_vault-0.1.0/graphify/hooks.py +220 -0
  16. graphify_vault-0.1.0/graphify/ingest.py +297 -0
  17. graphify_vault-0.1.0/graphify/manifest.py +4 -0
  18. graphify_vault-0.1.0/graphify/report.py +175 -0
  19. graphify_vault-0.1.0/graphify/security.py +203 -0
  20. graphify_vault-0.1.0/graphify/serve.py +2212 -0
  21. graphify_vault-0.1.0/graphify/skill-aider.md +1203 -0
  22. graphify_vault-0.1.0/graphify/skill-claw.md +1203 -0
  23. graphify_vault-0.1.0/graphify/skill-codex.md +1261 -0
  24. graphify_vault-0.1.0/graphify/skill-copilot.md +1279 -0
  25. graphify_vault-0.1.0/graphify/skill-droid.md +1258 -0
  26. graphify_vault-0.1.0/graphify/skill-kiro.md +1202 -0
  27. graphify_vault-0.1.0/graphify/skill-opencode.md +1257 -0
  28. graphify_vault-0.1.0/graphify/skill-trae.md +1227 -0
  29. graphify_vault-0.1.0/graphify/skill-vscode.md +253 -0
  30. graphify_vault-0.1.0/graphify/skill-windows.md +1264 -0
  31. graphify_vault-0.1.0/graphify/skill.md +1359 -0
  32. graphify_vault-0.1.0/graphify/transcribe.py +182 -0
  33. graphify_vault-0.1.0/graphify/validate.py +214 -0
  34. graphify_vault-0.1.0/graphify/watch.py +227 -0
  35. graphify_vault-0.1.0/graphify/wiki.py +214 -0
  36. graphify_vault-0.1.0/graphify_vault.egg-info/PKG-INFO +508 -0
  37. graphify_vault-0.1.0/graphify_vault.egg-info/SOURCES.txt +71 -0
  38. graphify_vault-0.1.0/graphify_vault.egg-info/dependency_links.txt +1 -0
  39. graphify_vault-0.1.0/graphify_vault.egg-info/entry_points.txt +2 -0
  40. graphify_vault-0.1.0/graphify_vault.egg-info/requires.txt +67 -0
  41. graphify_vault-0.1.0/graphify_vault.egg-info/top_level.txt +1 -0
  42. graphify_vault-0.1.0/pyproject.toml +63 -0
  43. graphify_vault-0.1.0/setup.cfg +4 -0
  44. graphify_vault-0.1.0/tests/test_analyze.py +232 -0
  45. graphify_vault-0.1.0/tests/test_benchmark.py +119 -0
  46. graphify_vault-0.1.0/tests/test_build.py +41 -0
  47. graphify_vault-0.1.0/tests/test_cache.py +126 -0
  48. graphify_vault-0.1.0/tests/test_claude_md.py +136 -0
  49. graphify_vault-0.1.0/tests/test_cluster.py +76 -0
  50. graphify_vault-0.1.0/tests/test_confidence.py +192 -0
  51. graphify_vault-0.1.0/tests/test_detect.py +238 -0
  52. graphify_vault-0.1.0/tests/test_export.py +127 -0
  53. graphify_vault-0.1.0/tests/test_extract.py +475 -0
  54. graphify_vault-0.1.0/tests/test_graph_build_perf.py +250 -0
  55. graphify_vault-0.1.0/tests/test_hooks.py +119 -0
  56. graphify_vault-0.1.0/tests/test_hypergraph.py +205 -0
  57. graphify_vault-0.1.0/tests/test_ingest.py +68 -0
  58. graphify_vault-0.1.0/tests/test_install.py +531 -0
  59. graphify_vault-0.1.0/tests/test_languages.py +562 -0
  60. graphify_vault-0.1.0/tests/test_multilang.py +173 -0
  61. graphify_vault-0.1.0/tests/test_pipeline.py +158 -0
  62. graphify_vault-0.1.0/tests/test_rationale.py +89 -0
  63. graphify_vault-0.1.0/tests/test_report.py +63 -0
  64. graphify_vault-0.1.0/tests/test_security.py +189 -0
  65. graphify_vault-0.1.0/tests/test_semantic_similarity.py +194 -0
  66. graphify_vault-0.1.0/tests/test_serve.py +400 -0
  67. graphify_vault-0.1.0/tests/test_sort_by.py +349 -0
  68. graphify_vault-0.1.0/tests/test_spatial_craft_build.py +172 -0
  69. graphify_vault-0.1.0/tests/test_spatialsdk_query_regression.py +221 -0
  70. graphify_vault-0.1.0/tests/test_transcribe.py +147 -0
  71. graphify_vault-0.1.0/tests/test_validate.py +202 -0
  72. graphify_vault-0.1.0/tests/test_watch.py +68 -0
  73. graphify_vault-0.1.0/tests/test_wiki.py +139 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Safi Shamsi
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,508 @@
1
+ Metadata-Version: 2.4
2
+ Name: graphify_vault
3
+ Version: 0.1.0
4
+ Summary: Graphify fork with PICO_HOME path resolution, same-label node merging, incremental build fixes, and future local knowledge vault capabilities
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Safi Shamsi
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Homepage, https://github.com/gengwb/graphify
28
+ Project-URL: Repository, https://github.com/gengwb/graphify
29
+ Project-URL: Issues, https://github.com/gengwb/graphify/issues
30
+ Keywords: claude,claude-code,codex,opencode,cursor,gemini,aider,kiro,knowledge-graph,rag,graphrag,obsidian,community-detection,tree-sitter,leiden,llm,pico,spatial-sdk
31
+ Requires-Python: >=3.10
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: networkx
35
+ Requires-Dist: tree-sitter>=0.23.0
36
+ Requires-Dist: tree-sitter-python
37
+ Requires-Dist: tree-sitter-javascript
38
+ Requires-Dist: tree-sitter-typescript
39
+ Requires-Dist: tree-sitter-go
40
+ Requires-Dist: tree-sitter-rust
41
+ Requires-Dist: tree-sitter-java
42
+ Requires-Dist: tree-sitter-c
43
+ Requires-Dist: tree-sitter-cpp
44
+ Requires-Dist: tree-sitter-ruby
45
+ Requires-Dist: tree-sitter-c-sharp
46
+ Requires-Dist: tree-sitter-kotlin
47
+ Requires-Dist: tree-sitter-scala
48
+ Requires-Dist: tree-sitter-php
49
+ Requires-Dist: tree-sitter-swift
50
+ Requires-Dist: tree-sitter-lua
51
+ Requires-Dist: tree-sitter-zig
52
+ Requires-Dist: tree-sitter-powershell
53
+ Requires-Dist: tree-sitter-elixir
54
+ Requires-Dist: tree-sitter-objc
55
+ Requires-Dist: tree-sitter-julia
56
+ Requires-Dist: tree-sitter-verilog
57
+ Provides-Extra: mcp
58
+ Requires-Dist: mcp; extra == "mcp"
59
+ Provides-Extra: neo4j
60
+ Requires-Dist: neo4j; extra == "neo4j"
61
+ Provides-Extra: pdf
62
+ Requires-Dist: pypdf; extra == "pdf"
63
+ Requires-Dist: html2text; extra == "pdf"
64
+ Provides-Extra: watch
65
+ Requires-Dist: watchdog; extra == "watch"
66
+ Provides-Extra: svg
67
+ Requires-Dist: matplotlib; extra == "svg"
68
+ Provides-Extra: leiden
69
+ Requires-Dist: graspologic; python_version < "3.13" and extra == "leiden"
70
+ Provides-Extra: office
71
+ Requires-Dist: python-docx; extra == "office"
72
+ Requires-Dist: openpyxl; extra == "office"
73
+ Provides-Extra: video
74
+ Requires-Dist: faster-whisper; extra == "video"
75
+ Requires-Dist: yt-dlp; extra == "video"
76
+ Provides-Extra: all
77
+ Requires-Dist: mcp; extra == "all"
78
+ Requires-Dist: neo4j; extra == "all"
79
+ Requires-Dist: pypdf; extra == "all"
80
+ Requires-Dist: html2text; extra == "all"
81
+ Requires-Dist: watchdog; extra == "all"
82
+ Requires-Dist: graspologic; python_version < "3.13" and extra == "all"
83
+ Requires-Dist: python-docx; extra == "all"
84
+ Requires-Dist: openpyxl; extra == "all"
85
+ Requires-Dist: faster-whisper; extra == "all"
86
+ Requires-Dist: yt-dlp; extra == "all"
87
+ Requires-Dist: matplotlib; extra == "all"
88
+ Dynamic: license-file
89
+
90
+ # graphify-vault
91
+
92
+ Fork of [graphifyy](https://pypi.org/project/graphifyy/) with enhancements for PICO Spatial SDK projects and future local knowledge vault capabilities.
93
+
94
+ [English](README.md) | [简体中文](README.zh-CN.md) | [日本語](README.ja-JP.md) | [한국어](README.ko-KR.md)
95
+
96
+ [![PyPI](https://img.shields.io/pypi/v/graphify-vault)](https://pypi.org/project/graphify-vault/)
97
+
98
+ **An AI coding assistant skill.** Type `/graphify` in Claude Code, Codex, OpenCode, Cursor, Gemini CLI, GitHub Copilot CLI, VS Code Copilot Chat, Aider, OpenClaw, Factory Droid, Trae, Hermes, Kiro, or Google Antigravity - it reads your files, builds a knowledge graph, and gives you back structure you didn't know was there. Understand a codebase faster. Find the "why" behind architectural decisions.
99
+
100
+ Fully multimodal. Drop in code, PDFs, markdown, screenshots, diagrams, whiteboard photos, images in other languages, or video and audio files - graphify extracts concepts and relationships from all of it and connects them into one graph. Videos are transcribed with Whisper using a domain-aware prompt derived from your corpus. 25 languages supported via tree-sitter AST (Python, JS, TS, Go, Rust, Java, C, C++, Ruby, C#, Kotlin, Scala, PHP, Swift, Lua, Zig, PowerShell, Elixir, Objective-C, Julia, Verilog, SystemVerilog, Vue, Svelte, Dart).
101
+
102
+ > Andrej Karpathy keeps a `/raw` folder where he drops papers, tweets, screenshots, and notes. graphify is the answer to that problem - 71.5x fewer tokens per query vs reading the raw files, persistent across sessions, honest about what it found vs guessed.
103
+
104
+ ```
105
+ /graphify . # works on any folder - your codebase, notes, papers, anything
106
+ ```
107
+
108
+ ```
109
+ graphify-out/
110
+ ├── graph.html interactive graph - open in any browser, click nodes, search, filter by community
111
+ ├── GRAPH_REPORT.md god nodes, surprising connections, suggested questions
112
+ ├── graph.json persistent graph - query weeks later without re-reading
113
+ └── cache/ SHA256 cache - re-runs only process changed files
114
+ ```
115
+
116
+ Add a `.graphifyignore` file to exclude folders you don't want in the graph:
117
+
118
+ ```
119
+ # .graphifyignore
120
+ vendor/
121
+ node_modules/
122
+ dist/
123
+ *.generated.py
124
+ ```
125
+
126
+ Same syntax as `.gitignore`. You can keep a single `.graphifyignore` at your repo root — patterns work correctly even when graphify is run on a subfolder.
127
+
128
+ ## How it works
129
+
130
+ graphify runs in three passes. First, a deterministic AST pass extracts structure from code files (classes, functions, imports, call graphs, docstrings, rationale comments) with no LLM needed. Second, video and audio files are transcribed locally with faster-whisper using a domain-aware prompt derived from corpus god nodes — transcripts are cached so re-runs are instant. Third, Claude subagents run in parallel over docs, papers, images, and transcripts to extract concepts, relationships, and design rationale. The results are merged into a NetworkX graph, clustered with Leiden community detection, and exported as interactive HTML, queryable JSON, and a plain-language audit report.
131
+
132
+ **Clustering is graph-topology-based — no embeddings.** Leiden finds communities by edge density. The semantic similarity edges that Claude extracts (`semantically_similar_to`, marked INFERRED) are already in the graph, so they influence community detection directly. The graph structure is the similarity signal — no separate embedding step or vector database needed.
133
+
134
+ Every relationship is tagged `EXTRACTED` (found directly in source), `INFERRED` (reasonable inference, with a confidence score), or `AMBIGUOUS` (flagged for review). You always know what was found vs guessed.
135
+
136
+ ## Install
137
+
138
+ **Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [Codex](https://openai.com/codex), [OpenCode](https://opencode.ai), [Cursor](https://cursor.com), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli), [VS Code Copilot Chat](https://code.visualstudio.com/docs/copilot/overview), [Aider](https://aider.chat), [OpenClaw](https://openclaw.ai), [Factory Droid](https://factory.ai), [Trae](https://trae.ai), [Kiro](https://kiro.dev), Hermes, or [Google Antigravity](https://antigravity.google)
139
+
140
+ ```bash
141
+ pip install graphifyy && graphify install
142
+ # or with pipx (keeps the CLI isolated from your project environments)
143
+ pipx install graphifyy && graphify install
144
+ ```
145
+
146
+ > **Official package:** The PyPI package is named `graphifyy` (install with `pip install graphifyy`). Other packages named `graphify*` on PyPI are not affiliated with this project. The only official repository is [safishamsi/graphify](https://github.com/safishamsi/graphify). The CLI and skill command are still `graphify`.
147
+
148
+ > **`graphify: command not found`?** On Windows, pip user scripts land in `%APPDATA%\Python\PythonXY\Scripts` — add that to your PATH or use `python -m graphify` instead. On macOS with pipx, run `pipx ensurepath` then restart your terminal.
149
+
150
+ ### Platform support
151
+
152
+ | Platform | Install command |
153
+ |----------|----------------|
154
+ | Claude Code (Linux/Mac) | `graphify install` |
155
+ | Claude Code (Windows) | `graphify install` (auto-detected) or `graphify install --platform windows` |
156
+ | Codex | `graphify install --platform codex` |
157
+ | OpenCode | `graphify install --platform opencode` |
158
+ | GitHub Copilot CLI | `graphify install --platform copilot` |
159
+ | VS Code Copilot Chat | `graphify vscode install` |
160
+ | Aider | `graphify install --platform aider` |
161
+ | OpenClaw | `graphify install --platform claw` |
162
+ | Factory Droid | `graphify install --platform droid` |
163
+ | Trae | `graphify install --platform trae` |
164
+ | Trae CN | `graphify install --platform trae-cn` |
165
+ | Gemini CLI | `graphify install --platform gemini` |
166
+ | Hermes | `graphify install --platform hermes` |
167
+ | Kiro IDE/CLI | `graphify kiro install` |
168
+ | Cursor | `graphify cursor install` |
169
+ | Google Antigravity | `graphify antigravity install` |
170
+
171
+ Codex users also need `multi_agent = true` under `[features]` in `~/.codex/config.toml` for parallel extraction. Factory Droid uses the `Task` tool for parallel subagent dispatch. OpenClaw and Aider use sequential extraction (parallel agent support is still early on those platforms). Trae uses the Agent tool for parallel subagent dispatch and does **not** support PreToolUse hooks — AGENTS.md is the always-on mechanism. Codex supports PreToolUse hooks — `graphify codex install` installs one in `.codex/hooks.json` in addition to writing AGENTS.md.
172
+
173
+ Then open your AI coding assistant and type:
174
+
175
+ ```
176
+ /graphify .
177
+ ```
178
+
179
+ Note: Codex uses `$` instead of `/` for skill calling, so type `$graphify .` instead.
180
+
181
+ ### Make your assistant always use the graph (recommended)
182
+
183
+ After building a graph, run this once in your project:
184
+
185
+ | Platform | Command |
186
+ |----------|---------|
187
+ | Claude Code | `graphify claude install` |
188
+ | Codex | `graphify codex install` |
189
+ | OpenCode | `graphify opencode install` |
190
+ | GitHub Copilot CLI | `graphify copilot install` |
191
+ | VS Code Copilot Chat | `graphify vscode install` |
192
+ | Aider | `graphify aider install` |
193
+ | OpenClaw | `graphify claw install` |
194
+ | Factory Droid | `graphify droid install` |
195
+ | Trae | `graphify trae install` |
196
+ | Trae CN | `graphify trae-cn install` |
197
+ | Cursor | `graphify cursor install` |
198
+ | Gemini CLI | `graphify gemini install` |
199
+ | Hermes | `graphify hermes install` |
200
+ | Kiro IDE/CLI | `graphify kiro install` |
201
+ | Google Antigravity | `graphify antigravity install` |
202
+
203
+ **Claude Code** does two things: writes a `CLAUDE.md` section telling Claude to read `graphify-out/GRAPH_REPORT.md` before answering architecture questions, and installs a **PreToolUse hook** (`settings.json`) that fires before every Glob and Grep call. If a knowledge graph exists, Claude sees: _"graphify: Knowledge graph exists. Read GRAPH_REPORT.md for god nodes and community structure before searching raw files."_ — so Claude navigates via the graph instead of grepping through every file.
204
+
205
+ **Codex** writes to `AGENTS.md` and also installs a **PreToolUse hook** in `.codex/hooks.json` that fires before every Bash tool call — same always-on mechanism as Claude Code.
206
+
207
+ **OpenCode** writes to `AGENTS.md` and also installs a **`tool.execute.before` plugin** (`.opencode/plugins/graphify.js` + `opencode.json` registration) that fires before bash tool calls and injects the graph reminder into tool output when the graph exists.
208
+
209
+ **Cursor** writes `.cursor/rules/graphify.mdc` with `alwaysApply: true` — Cursor includes it in every conversation automatically, no hook needed.
210
+
211
+ **Gemini CLI** copies the skill to `~/.gemini/skills/graphify/SKILL.md`, writes a `GEMINI.md` section, and installs a `BeforeTool` hook in `.gemini/settings.json` that fires before file-read tool calls — same always-on mechanism as Claude Code.
212
+
213
+ **Aider, OpenClaw, Factory Droid, Trae, and Hermes** write the same rules to `AGENTS.md` in your project root and copy the skill to the platform's global skill directory. These platforms don't support tool hooks, so AGENTS.md is the always-on mechanism.
214
+
215
+ **Kiro IDE/CLI** writes the skill to `.kiro/skills/graphify/SKILL.md` (invoked via `/graphify`) and a steering file to `.kiro/steering/graphify.md` with `inclusion: always` — Kiro injects this into every conversation automatically, no hook needed.
216
+
217
+ **Google Antigravity** writes `.agent/rules/graphify.md` (always-on rules) and `.agent/workflows/graphify.md` (registers `/graphify` as a slash command). No hook equivalent exists in Antigravity — rules are the always-on mechanism.
218
+
219
+ **GitHub Copilot CLI** copies the skill to `~/.copilot/skills/graphify/SKILL.md`. Run `graphify copilot install` to set it up.
220
+
221
+ **VS Code Copilot Chat** installs a Python-only skill (works on Windows PowerShell and macOS/Linux alike) and writes `.github/copilot-instructions.md` in your project root — VS Code reads this automatically every session, making graph context always-on without any hook mechanism. Run `graphify vscode install`. Note: this configures the chat panel in VS Code, not the Copilot CLI terminal tool.
222
+
223
+ Uninstall with the matching uninstall command (e.g. `graphify claude uninstall`).
224
+
225
+ **Always-on vs explicit trigger — what's the difference?**
226
+
227
+ The always-on hook surfaces `GRAPH_REPORT.md` — a one-page summary of god nodes, communities, and surprising connections. Your assistant reads this before searching files, so it navigates by structure instead of keyword matching. That covers most everyday questions.
228
+
229
+ `/graphify query`, `/graphify path`, and `/graphify explain` go deeper: they traverse the raw `graph.json` hop by hop, trace exact paths between nodes, and surface edge-level detail (relation type, confidence score, source location). Use them when you want a specific question answered from the graph rather than a general orientation.
230
+
231
+ Think of it this way: the always-on hook gives your assistant a map. The `/graphify` commands let it navigate the map precisely.
232
+
233
+ ### Team workflows
234
+
235
+ `graphify-out/` is designed to be committed to git so every teammate starts with a fresh map.
236
+
237
+ **Recommended `.gitignore` additions:**
238
+ ```
239
+ # commit graph outputs, ignore the extraction cache
240
+ graphify-out/cache/
241
+ ```
242
+
243
+ **Shared setup:**
244
+ 1. One person runs `/graphify .` to build the initial graph and commits `graphify-out/`.
245
+ 2. Everyone else pulls — their assistant reads `GRAPH_REPORT.md` immediately with no extra steps.
246
+ 3. Install the post-commit hook (`graphify hook install`) so the graph rebuilds automatically after code changes — no LLM calls needed for code-only updates.
247
+ 4. For doc/paper changes, whoever edits the files runs `/graphify --update` to refresh semantic nodes.
248
+
249
+ **Excluding paths** — create `.graphifyignore` in your project root (same syntax as `.gitignore`). Files matching those patterns are skipped during detection and extraction.
250
+
251
+ ## Using `graph.json` with an LLM
252
+
253
+ `graph.json` is not meant to be pasted into a prompt all at once. The useful
254
+ workflow is:
255
+
256
+ 1. Start with `graphify-out/GRAPH_REPORT.md` for the high-level overview.
257
+ 2. Use `graphify query` to pull a smaller subgraph for the specific question
258
+ you want to answer.
259
+ 3. Give that focused output to your assistant instead of dumping the full raw
260
+ corpus.
261
+
262
+ For example, after running graphify on a project:
263
+
264
+ ```bash
265
+ graphify query "show the auth flow" --graph graphify-out/graph.json
266
+ graphify query "what connects DigestAuth to Response?" --graph graphify-out/graph.json
267
+ ```
268
+
269
+ The output includes node labels, edge types, confidence tags, source files, and
270
+ source locations. That makes it a good intermediate context block for an LLM:
271
+
272
+ ```text
273
+ Use this graph query output to answer the question. Prefer the graph structure
274
+ over guessing, and cite the source files when possible.
275
+ ```
276
+
277
+ If your assistant supports tool calling or MCP, use the graph directly instead
278
+ of pasting text. graphify can expose `graph.json` as an MCP server:
279
+
280
+ ```bash
281
+ python -m graphify.serve graphify-out/graph.json
282
+ ```
283
+
284
+ That gives the assistant structured graph access for repeated queries such as
285
+ `query_graph`, `get_node`, `get_neighbors`, and `shortest_path`.
286
+
287
+ > **WSL / Linux note:** Ubuntu ships `python3`, not `python`. Install into a project venv to avoid PEP 668 conflicts, and use the full venv path in your `.mcp.json`:
288
+ > ```bash
289
+ > python3 -m venv .venv && .venv/bin/pip install "graphifyy[mcp]"
290
+ > ```
291
+ > ```json
292
+ > { "mcpServers": { "graphify": { "type": "stdio", "command": ".venv/bin/python3", "args": ["-m", "graphify.serve", "graphify-out/graph.json"] } } }
293
+ > ```
294
+ > Also note: the PyPI package is `graphifyy` (double-y) — `pip install graphify` installs an unrelated package.
295
+
296
+ <details>
297
+ <summary>Manual install (curl)</summary>
298
+
299
+ ```bash
300
+ mkdir -p ~/.claude/skills/graphify
301
+ curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v4/graphify/skill.md \
302
+ > ~/.claude/skills/graphify/SKILL.md
303
+ ```
304
+
305
+ Add to `~/.claude/CLAUDE.md`:
306
+
307
+ ```
308
+ - **graphify** (`~/.claude/skills/graphify/SKILL.md`) - any input to knowledge graph. Trigger: `/graphify`
309
+ When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"` before doing anything else.
310
+ ```
311
+
312
+ </details>
313
+
314
+ ## Usage
315
+
316
+ ```
317
+ /graphify # run on current directory
318
+ /graphify ./raw # run on a specific folder
319
+ /graphify ./raw --mode deep # more aggressive INFERRED edge extraction
320
+ /graphify ./raw --update # re-extract only changed files, merge into existing graph
321
+ /graphify ./raw --directed # build directed graph (preserves edge direction: source→target)
322
+ /graphify ./raw --cluster-only # rerun clustering on existing graph, no re-extraction
323
+ /graphify ./raw --no-viz # skip HTML, just produce report + JSON
324
+ /graphify ./raw --obsidian # also generate Obsidian vault (opt-in)
325
+ /graphify ./raw --obsidian --obsidian-dir ~/vaults/myproject # write vault to a specific directory
326
+
327
+ /graphify add https://arxiv.org/abs/1706.03762 # fetch a paper, save, update graph
328
+ /graphify add https://x.com/karpathy/status/... # fetch a tweet
329
+ /graphify add <video-url> # download audio, transcribe, add to graph
330
+ /graphify add https://... --author "Name" # tag the original author
331
+ /graphify add https://... --contributor "Name" # tag who added it to the corpus
332
+
333
+ /graphify query "what connects attention to the optimizer?"
334
+ /graphify query "what connects attention to the optimizer?" --dfs # trace a specific path
335
+ /graphify query "what connects attention to the optimizer?" --budget 1500 # cap at N tokens
336
+ /graphify path "DigestAuth" "Response"
337
+ /graphify explain "SwinTransformer"
338
+
339
+ /graphify ./raw --watch # auto-sync graph as files change (code: instant, docs: notifies you)
340
+ /graphify ./raw --wiki # build agent-crawlable wiki (index.md + article per community)
341
+ /graphify ./raw --svg # export graph.svg
342
+ /graphify ./raw --graphml # export graph.graphml (Gephi, yEd)
343
+ /graphify ./raw --neo4j # generate cypher.txt for Neo4j
344
+ /graphify ./raw --neo4j-push bolt://localhost:7687 # push directly to a running Neo4j instance
345
+ /graphify ./raw --mcp # start MCP stdio server
346
+
347
+ # git hooks - platform-agnostic, rebuild graph on commit and branch switch
348
+ graphify hook install
349
+ graphify hook uninstall
350
+ graphify hook status
351
+
352
+ # always-on assistant instructions - platform-specific
353
+ graphify claude install # CLAUDE.md + PreToolUse hook (Claude Code)
354
+ graphify claude uninstall
355
+ graphify codex install # AGENTS.md + PreToolUse hook in .codex/hooks.json (Codex)
356
+ graphify opencode install # AGENTS.md + tool.execute.before plugin (OpenCode)
357
+ graphify cursor install # .cursor/rules/graphify.mdc (Cursor)
358
+ graphify cursor uninstall
359
+ graphify gemini install # GEMINI.md + BeforeTool hook (Gemini CLI)
360
+ graphify gemini uninstall
361
+ graphify copilot install # skill file (GitHub Copilot CLI)
362
+ graphify copilot uninstall
363
+ graphify aider install # AGENTS.md (Aider)
364
+ graphify aider uninstall
365
+ graphify claw install # AGENTS.md (OpenClaw)
366
+ graphify droid install # AGENTS.md (Factory Droid)
367
+ graphify trae install # AGENTS.md (Trae)
368
+ graphify trae uninstall
369
+ graphify trae-cn install # AGENTS.md (Trae CN)
370
+ graphify trae-cn uninstall
371
+ graphify hermes install # AGENTS.md + ~/.hermes/skills/ (Hermes)
372
+ graphify hermes uninstall
373
+ graphify kiro install # .kiro/skills/ + .kiro/steering/graphify.md (Kiro IDE/CLI)
374
+ graphify kiro uninstall
375
+ graphify antigravity install # .agent/rules + .agent/workflows (Google Antigravity)
376
+ graphify antigravity uninstall
377
+
378
+ # query and navigate the graph directly from the terminal (no AI assistant needed)
379
+ graphify query "what connects attention to the optimizer?"
380
+ graphify query "show the auth flow" --dfs
381
+ graphify query "what is CfgNode?" --budget 500
382
+ graphify query "..." --graph path/to/graph.json
383
+ graphify path "DigestAuth" "Response" # shortest path between two nodes
384
+ graphify explain "SwinTransformer" # plain-language explanation of a node
385
+
386
+ # add content and update the graph from the terminal
387
+ graphify add https://arxiv.org/abs/1706.03762 # fetch paper, save to ./raw, update graph
388
+ graphify add https://... --author "Name" --contributor "Name"
389
+
390
+ # incremental update and maintenance
391
+ graphify watch ./src # auto-rebuild on code changes
392
+ graphify update ./src # re-extract code files, no LLM needed
393
+ graphify cluster-only ./my-project # rerun clustering on existing graph.json
394
+ ```
395
+
396
+ Works with any mix of file types:
397
+
398
+ | Type | Extensions | Extraction |
399
+ |------|-----------|------------|
400
+ | Code | `.py .ts .js .jsx .tsx .mjs .go .rs .java .c .cpp .rb .cs .kt .scala .php .swift .lua .zig .ps1 .ex .exs .m .mm .jl .vue .svelte` | AST via tree-sitter + call-graph (cross-file for all languages) + docstring/comment rationale |
401
+ | Docs | `.md .mdx .html .txt .rst` | Concepts + relationships + design rationale via Claude |
402
+ | Office | `.docx .xlsx` | Converted to markdown then extracted via Claude (requires `pip install graphifyy[office]`) |
403
+ | Papers | `.pdf` | Citation mining + concept extraction |
404
+ | Images | `.png .jpg .webp .gif` | Claude vision - screenshots, diagrams, any language |
405
+ | Video / Audio | `.mp4 .mov .mkv .webm .avi .m4v .mp3 .wav .m4a .ogg` | Transcribed locally with faster-whisper, transcript fed into Claude extraction (requires `pip install graphifyy[video]`) |
406
+ | YouTube / URLs | any video URL | Audio downloaded via yt-dlp, then same Whisper pipeline (requires `pip install graphifyy[video]`) |
407
+
408
+ ## Video and audio corpus
409
+
410
+ Drop video or audio files into your corpus folder alongside your code and docs — graphify picks them up automatically:
411
+
412
+ ```bash
413
+ pip install 'graphifyy[video]' # one-time setup
414
+ /graphify ./my-corpus # transcribes any video/audio files it finds
415
+ ```
416
+
417
+ Add a YouTube video (or any public video URL) directly:
418
+
419
+ ```bash
420
+ /graphify add <video-url>
421
+ ```
422
+
423
+ yt-dlp downloads audio-only (fast, small), Whisper transcribes it locally, and the transcript is fed into the same extraction pipeline as your other docs. Transcripts are cached in `graphify-out/transcripts/` so re-runs skip already-transcribed files.
424
+
425
+ For better accuracy on technical content, use a larger model:
426
+
427
+ ```bash
428
+ /graphify ./my-corpus --whisper-model medium
429
+ ```
430
+
431
+ Audio never leaves your machine. All transcription runs locally.
432
+
433
+ ## What you get
434
+
435
+ **God nodes** - highest-degree concepts (what everything connects through)
436
+
437
+ **Surprising connections** - ranked by composite score. Code-paper edges rank higher than code-code. Each result includes a plain-English why.
438
+
439
+ **Suggested questions** - 4-5 questions the graph is uniquely positioned to answer
440
+
441
+ **The "why"** - docstrings, inline comments (`# NOTE:`, `# IMPORTANT:`, `# HACK:`, `# WHY:`), and design rationale from docs are extracted as `rationale_for` nodes. Not just what the code does - why it was written that way.
442
+
443
+ **Confidence scores** - every INFERRED edge has a `confidence_score` (0.0-1.0). You know not just what was guessed but how confident the model was. EXTRACTED edges are always 1.0.
444
+
445
+ **Semantic similarity edges** - cross-file conceptual links with no structural connection. Two functions solving the same problem without calling each other, a class in code and a concept in a paper describing the same algorithm.
446
+
447
+ **Hyperedges** - group relationships connecting 3+ nodes that pairwise edges can't express. All classes implementing a shared protocol, all functions in an auth flow, all concepts from a paper section forming one idea.
448
+
449
+ **Token benchmark** - printed automatically after every run. On a mixed corpus (Karpathy repos + papers + images): **71.5x** fewer tokens per query vs reading raw files. The first run extracts and builds the graph (this costs tokens). Every subsequent query reads the compact graph instead of raw files — that's where the savings compound. The SHA256 cache means re-runs only re-process changed files.
450
+
451
+ **Auto-sync** (`--watch`) - run in a background terminal and the graph updates itself as your codebase changes. Code file saves trigger an instant rebuild (AST only, no LLM). Doc/image changes notify you to run `--update` for the LLM re-pass.
452
+
453
+ **Git hooks** (`graphify hook install`) - installs post-commit and post-checkout hooks. Graph rebuilds automatically after every commit and every branch switch. If a rebuild fails, the hook exits with a non-zero code so git surfaces the error instead of silently continuing. No background process needed.
454
+
455
+ **Wiki** (`--wiki`) - Wikipedia-style markdown articles per community and god node, with an `index.md` entry point. Point any agent at `index.md` and it can navigate the knowledge base by reading files instead of parsing JSON.
456
+
457
+ ## Worked examples
458
+
459
+ | Corpus | Files | Reduction | Output |
460
+ |--------|-------|-----------|--------|
461
+ | Karpathy repos + 5 papers + 4 images | 52 | **71.5x** | [`worked/karpathy-repos/`](worked/karpathy-repos/) |
462
+ | graphify source + Transformer paper | 4 | **5.4x** | [`worked/mixed-corpus/`](worked/mixed-corpus/) |
463
+ | httpx (synthetic Python library) | 6 | ~1x | [`worked/httpx/`](worked/httpx/) |
464
+
465
+ Token reduction scales with corpus size. 6 files fits in a context window anyway, so graph value there is structural clarity, not compression. At 52 files (code + papers + images) you get 71x+. Each `worked/` folder has the raw input files and the actual output (`GRAPH_REPORT.md`, `graph.json`) so you can run it yourself and verify the numbers.
466
+
467
+ ## Privacy
468
+
469
+ graphify sends file contents to your AI coding assistant's underlying model API for semantic extraction of docs, papers, and images — Anthropic (Claude Code), OpenAI (Codex), or whichever provider your platform uses. Code files are processed locally via tree-sitter AST — no file contents leave your machine for code. Video and audio files are transcribed locally with faster-whisper — audio never leaves your machine. No telemetry, usage tracking, or analytics of any kind. The only network calls are to your platform's model API during extraction, using your own API key.
470
+
471
+ ## Tech stack
472
+
473
+ NetworkX + Leiden (graspologic) + tree-sitter + vis.js. Semantic extraction via Claude (Claude Code), GPT-4 (Codex), or whichever model your platform runs. Video transcription via faster-whisper + yt-dlp (optional, `pip install graphifyy[video]`). No Neo4j required, no server, runs entirely locally.
474
+
475
+ ## Built on graphify — Penpax
476
+
477
+ [**Penpax**](https://safishamsi.github.io/penpax.ai) is the enterprise layer on top of graphify. Where graphify turns a folder of files into a knowledge graph, Penpax applies the same graph to your entire working life — continuously.
478
+
479
+ | | graphify | Penpax |
480
+ |---|---|---|
481
+ | Input | A folder of files | Browser history, meetings, emails, files, code — everything |
482
+ | Runs | On demand | Continuously in the background |
483
+ | Scope | A project | Your entire working life |
484
+ | Query | CLI / MCP / AI skill | Natural language, always on |
485
+ | Privacy | Local by default | Fully on-device, no cloud |
486
+
487
+ Built for lawyers, consultants, executives, doctors, researchers — anyone whose work lives across hundreds of conversations and documents they can never fully reconstruct.
488
+
489
+ **Free trial launching soon.** [Join the waitlist →](https://safishamsi.github.io/penpax.ai)
490
+
491
+ ## What we are building next
492
+
493
+ graphify is the graph layer. Penpax is the always-on layer on top of it — an on-device digital twin that connects your meetings, browser history, files, emails, and code into one continuously updating knowledge graph. No cloud, no training on your data. [Join the waitlist.](https://safishamsi.github.io/penpax.ai)
494
+
495
+ ## Star history
496
+
497
+ [![Star History Chart](https://api.star-history.com/svg?repos=safishamsi/graphify&type=Date)](https://star-history.com/#safishamsi/graphify&Date)
498
+
499
+ <details>
500
+ <summary>Contributing</summary>
501
+
502
+ **Worked examples** are the most trust-building contribution. Run `/graphify` on a real corpus, save output to `worked/{slug}/`, write an honest `review.md` evaluating what the graph got right and wrong, submit a PR.
503
+
504
+ **Extraction bugs** - open an issue with the input file, the cache entry (`graphify-out/cache/`), and what was missed or invented.
505
+
506
+ See [ARCHITECTURE.md](ARCHITECTURE.md) for module responsibilities and how to add a language.
507
+
508
+ </details>