graphifyy 0.2.2__tar.gz → 0.3.1__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 (61) hide show
  1. graphifyy-0.3.1/LICENSE +21 -0
  2. {graphifyy-0.2.2/graphifyy.egg-info → graphifyy-0.3.1}/PKG-INFO +88 -25
  3. graphifyy-0.2.2/PKG-INFO → graphifyy-0.3.1/README.md +59 -66
  4. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/__main__.py +147 -28
  5. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/analyze.py +9 -5
  6. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/build.py +30 -2
  7. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/cache.py +15 -3
  8. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/detect.py +6 -1
  9. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/export.py +22 -13
  10. graphifyy-0.3.1/graphify/extract.py +1733 -0
  11. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/hooks.py +25 -16
  12. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/ingest.py +1 -3
  13. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/security.py +34 -2
  14. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/serve.py +2 -2
  15. graphifyy-0.3.1/graphify/skill-claw.md +1164 -0
  16. graphifyy-0.3.1/graphify/skill-codex.md +1221 -0
  17. graphifyy-0.3.1/graphify/skill-opencode.md +1216 -0
  18. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/skill.md +45 -34
  19. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/watch.py +3 -4
  20. graphifyy-0.3.1/graphifyy.egg-info/PKG-INFO +277 -0
  21. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphifyy.egg-info/SOURCES.txt +5 -0
  22. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphifyy.egg-info/requires.txt +2 -0
  23. {graphifyy-0.2.2 → graphifyy-0.3.1}/pyproject.toml +7 -5
  24. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_extract.py +2 -1
  25. graphifyy-0.3.1/tests/test_install.py +159 -0
  26. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_languages.py +121 -1
  27. graphifyy-0.2.2/README.md +0 -169
  28. graphifyy-0.2.2/graphify/extract.py +0 -2526
  29. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/__init__.py +0 -0
  30. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/benchmark.py +0 -0
  31. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/cluster.py +0 -0
  32. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/manifest.py +0 -0
  33. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/report.py +0 -0
  34. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/validate.py +0 -0
  35. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphify/wiki.py +0 -0
  36. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphifyy.egg-info/dependency_links.txt +0 -0
  37. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphifyy.egg-info/entry_points.txt +0 -0
  38. {graphifyy-0.2.2 → graphifyy-0.3.1}/graphifyy.egg-info/top_level.txt +0 -0
  39. {graphifyy-0.2.2 → graphifyy-0.3.1}/setup.cfg +0 -0
  40. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_analyze.py +0 -0
  41. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_benchmark.py +0 -0
  42. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_build.py +0 -0
  43. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_cache.py +0 -0
  44. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_claude_md.py +0 -0
  45. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_cluster.py +0 -0
  46. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_confidence.py +0 -0
  47. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_detect.py +0 -0
  48. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_export.py +0 -0
  49. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_hooks.py +0 -0
  50. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_hypergraph.py +0 -0
  51. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_ingest.py +0 -0
  52. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_multilang.py +0 -0
  53. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_pipeline.py +0 -0
  54. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_rationale.py +0 -0
  55. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_report.py +0 -0
  56. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_security.py +0 -0
  57. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_semantic_similarity.py +0 -0
  58. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_serve.py +0 -0
  59. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_validate.py +0 -0
  60. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_watch.py +0 -0
  61. {graphifyy-0.2.2 → graphifyy-0.3.1}/tests/test_wiki.py +0 -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.
@@ -1,14 +1,36 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphifyy
3
- Version: 0.2.2
4
- Summary: Claude Code skill - turn any folder of code, docs, papers, images, or tweets into a queryable knowledge graph
5
- License: MIT
3
+ Version: 0.3.1
4
+ Summary: AI coding assistant skill (Claude Code, Codex, OpenCode, OpenClaw) - turn any folder of code, docs, papers, or images into a queryable knowledge graph
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
+
6
27
  Project-URL: Homepage, https://github.com/safishamsi/graphify
7
28
  Project-URL: Repository, https://github.com/safishamsi/graphify
8
29
  Project-URL: Issues, https://github.com/safishamsi/graphify/issues
9
- Keywords: claude,claude-code,knowledge-graph,rag,graphrag,obsidian,community-detection,tree-sitter,leiden,llm
30
+ Keywords: claude,claude-code,codex,opencode,knowledge-graph,rag,graphrag,obsidian,community-detection,tree-sitter,leiden,llm
10
31
  Requires-Python: >=3.10
11
32
  Description-Content-Type: text/markdown
33
+ License-File: LICENSE
12
34
  Requires-Dist: networkx
13
35
  Requires-Dist: tree-sitter
14
36
  Requires-Dist: tree-sitter-python
@@ -24,6 +46,8 @@ Requires-Dist: tree-sitter-c-sharp
24
46
  Requires-Dist: tree-sitter-kotlin
25
47
  Requires-Dist: tree-sitter-scala
26
48
  Requires-Dist: tree-sitter-php
49
+ Requires-Dist: tree-sitter-swift
50
+ Requires-Dist: tree-sitter-lua
27
51
  Provides-Extra: mcp
28
52
  Requires-Dist: mcp; extra == "mcp"
29
53
  Provides-Extra: neo4j
@@ -42,13 +66,16 @@ Requires-Dist: pypdf; extra == "all"
42
66
  Requires-Dist: html2text; extra == "all"
43
67
  Requires-Dist: watchdog; extra == "all"
44
68
  Requires-Dist: graspologic; extra == "all"
69
+ Dynamic: license-file
45
70
 
46
71
  # graphify
47
72
 
48
- [![CI](https://github.com/safishamsi/graphify/actions/workflows/ci.yml/badge.svg?branch=v2)](https://github.com/safishamsi/graphify/actions/workflows/ci.yml)
73
+ [English](README.md) | [简体中文](README.zh-CN.md)
74
+
75
+ [![CI](https://github.com/safishamsi/graphify/actions/workflows/ci.yml/badge.svg?branch=v3)](https://github.com/safishamsi/graphify/actions/workflows/ci.yml)
49
76
  [![PyPI](https://img.shields.io/pypi/v/graphifyy)](https://pypi.org/project/graphifyy/)
50
77
 
51
- **A Claude Code skill.** Type `/graphify` in Claude Code - 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.
78
+ **An AI coding assistant skill.** Type `/graphify` in Claude Code, Codex, OpenCode, or OpenClaw - 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.
52
79
 
53
80
  Fully multimodal. Drop in code, PDFs, markdown, screenshots, diagrams, whiteboard photos, even images in other languages - graphify uses Claude vision to extract concepts and relationships from all of it and connects them into one graph.
54
81
 
@@ -70,11 +97,13 @@ graphify-out/
70
97
 
71
98
  graphify runs in two passes. First, a deterministic AST pass extracts structure from code files (classes, functions, imports, call graphs, docstrings, rationale comments) with no LLM needed. Second, Claude subagents run in parallel over docs, papers, and images 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.
72
99
 
100
+ **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.
101
+
73
102
  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.
74
103
 
75
104
  ## Install
76
105
 
77
- **Requires:** [Claude Code](https://claude.ai/code) and Python 3.10+
106
+ **Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [Codex](https://openai.com/codex), [OpenCode](https://opencode.ai), or [OpenClaw](https://openclaw.ai)
78
107
 
79
108
  ```bash
80
109
  pip install graphifyy && graphify install
@@ -82,36 +111,54 @@ pip install graphifyy && graphify install
82
111
 
83
112
  > The PyPI package is temporarily named `graphifyy` while the `graphify` name is being reclaimed. The CLI and skill command are still `graphify`.
84
113
 
85
- Then open Claude Code in any directory and type:
114
+ ### Platform support
115
+
116
+ | Platform | Install command |
117
+ |----------|----------------|
118
+ | Claude Code | `graphify install` |
119
+ | Codex | `graphify install --platform codex` |
120
+ | OpenCode | `graphify install --platform opencode` |
121
+ | OpenClaw | `graphify install --platform claw` |
122
+
123
+ Codex users also need `multi_agent = true` under `[features]` in `~/.codex/config.toml` for parallel extraction. OpenClaw uses sequential extraction (parallel agent support is still early on that platform).
124
+
125
+ Then open your AI coding assistant and type:
86
126
 
87
127
  ```
88
128
  /graphify .
89
129
  ```
90
130
 
91
- ### Make Claude always use the graph (recommended)
131
+ ### Make your assistant always use the graph (recommended)
92
132
 
93
133
  After building a graph, run this once in your project:
94
134
 
95
- ```bash
96
- graphify claude install
97
- ```
135
+ | Platform | Command |
136
+ |----------|---------|
137
+ | Claude Code | `graphify claude install` |
138
+ | Codex | `graphify codex install` |
139
+ | OpenCode | `graphify opencode install` |
140
+ | OpenClaw | `graphify claw install` |
141
+
142
+ **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.
143
+
144
+ **Codex, OpenCode, OpenClaw** write the same rules to `AGENTS.md` in your project root. These platforms don't support PreToolUse hooks, so AGENTS.md is the always-on mechanism.
98
145
 
99
- This does two things:
146
+ Uninstall with the matching uninstall command (e.g. `graphify claude uninstall`).
100
147
 
101
- 1. **CLAUDE.md rules** - tells Claude to read `graphify-out/GRAPH_REPORT.md` before answering architecture questions, and to rebuild the graph after editing code files.
148
+ **Always-on vs explicit trigger what's the difference?**
102
149
 
103
- 2. **PreToolUse hook** (`settings.json`) - fires automatically 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."_ This means Claude navigates via the graph instead of grepping through every file - faster answers, fewer wasted tool calls, and responses grounded in the actual structure of your codebase rather than keyword matches.
150
+ 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.
104
151
 
105
- Without this, Claude will grep raw files by default even when a graph exists. With it, the graph becomes the first thing Claude reaches for.
152
+ `/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.
106
153
 
107
- Uninstall with `graphify claude uninstall`.
154
+ Think of it this way: the always-on hook gives your assistant a map. The `/graphify` commands let it navigate the map precisely.
108
155
 
109
156
  <details>
110
157
  <summary>Manual install (curl)</summary>
111
158
 
112
159
  ```bash
113
160
  mkdir -p ~/.claude/skills/graphify
114
- curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v2/graphify/skill.md \
161
+ curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v3/graphify/skill.md \
115
162
  > ~/.claude/skills/graphify/SKILL.md
116
163
  ```
117
164
 
@@ -131,12 +178,18 @@ When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"`
131
178
  /graphify ./raw # run on a specific folder
132
179
  /graphify ./raw --mode deep # more aggressive INFERRED edge extraction
133
180
  /graphify ./raw --update # re-extract only changed files, merge into existing graph
181
+ /graphify ./raw --cluster-only # rerun clustering on existing graph, no re-extraction
182
+ /graphify ./raw --no-viz # skip HTML, just produce report + JSON
134
183
  /graphify ./raw --obsidian # also generate Obsidian vault (opt-in)
135
184
 
136
185
  /graphify add https://arxiv.org/abs/1706.03762 # fetch a paper, save, update graph
137
186
  /graphify add https://x.com/karpathy/status/... # fetch a tweet
187
+ /graphify add https://... --author "Name" # tag the original author
188
+ /graphify add https://... --contributor "Name" # tag who added it to the corpus
138
189
 
139
190
  /graphify query "what connects attention to the optimizer?"
191
+ /graphify query "what connects attention to the optimizer?" --dfs # trace a specific path
192
+ /graphify query "what connects attention to the optimizer?" --budget 1500 # cap at N tokens
140
193
  /graphify path "DigestAuth" "Response"
141
194
  /graphify explain "SwinTransformer"
142
195
 
@@ -145,17 +198,27 @@ When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"`
145
198
  /graphify ./raw --svg # export graph.svg
146
199
  /graphify ./raw --graphml # export graph.graphml (Gephi, yEd)
147
200
  /graphify ./raw --neo4j # generate cypher.txt for Neo4j
201
+ /graphify ./raw --neo4j-push bolt://localhost:7687 # push directly to a running Neo4j instance
148
202
  /graphify ./raw --mcp # start MCP stdio server
149
203
 
150
- graphify hook install # git hooks - rebuilds graph on commit and branch switch
151
- graphify claude install # always-on: CLAUDE.md + PreToolUse hook for this project
204
+ # git hooks - platform-agnostic, rebuild graph on commit and branch switch
205
+ graphify hook install
206
+ graphify hook uninstall
207
+ graphify hook status
208
+
209
+ # always-on assistant instructions - platform-specific
210
+ graphify claude install # CLAUDE.md + PreToolUse hook (Claude Code)
211
+ graphify claude uninstall
212
+ graphify codex install # AGENTS.md (Codex)
213
+ graphify opencode install # AGENTS.md (OpenCode)
214
+ graphify claw install # AGENTS.md (OpenClaw)
152
215
  ```
153
216
 
154
217
  Works with any mix of file types:
155
218
 
156
219
  | Type | Extensions | Extraction |
157
220
  |------|-----------|------------|
158
- | Code | `.py .ts .js .go .rs .java .c .cpp .rb .cs .kt .scala .php` | AST via tree-sitter + call-graph + docstring/comment rationale |
221
+ | Code | `.py .ts .js .go .rs .java .c .cpp .rb .cs .kt .scala .php .swift .lua` | AST via tree-sitter + call-graph + docstring/comment rationale |
159
222
  | Docs | `.md .txt .rst` | Concepts + relationships + design rationale via Claude |
160
223
  | Papers | `.pdf` | Citation mining + concept extraction |
161
224
  | Images | `.png .jpg .webp .gif` | Claude vision - screenshots, diagrams, any language |
@@ -176,11 +239,11 @@ Works with any mix of file types:
176
239
 
177
240
  **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.
178
241
 
179
- **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.
242
+ **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.
180
243
 
181
244
  **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.
182
245
 
183
- **Git hooks** (`graphify hook install`) - installs post-commit and post-checkout hooks. Graph rebuilds automatically after every commit and every branch switch. No background process needed.
246
+ **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.
184
247
 
185
248
  **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.
186
249
 
@@ -196,11 +259,11 @@ Token reduction scales with corpus size. 6 files fits in a context window anyway
196
259
 
197
260
  ## Privacy
198
261
 
199
- graphify sends file contents to the Claude API (Anthropic) for semantic extraction of docs, papers, and images. Code files are processed locally via tree-sitter AST — no file contents leave your machine for code. No telemetry, usage tracking, or analytics of any kind. The only network calls are to Anthropic's API during extraction, using your own API key via Claude Code.
262
+ 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. 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.
200
263
 
201
264
  ## Tech stack
202
265
 
203
- NetworkX + Leiden (graspologic) + tree-sitter + Claude + vis.js. No Neo4j required, no server, runs entirely locally.
266
+ NetworkX + Leiden (graspologic) + tree-sitter + vis.js. Semantic extraction via Claude (Claude Code), GPT-4 (Codex), or whichever model your platform runs. No Neo4j required, no server, runs entirely locally.
204
267
 
205
268
  <details>
206
269
  <summary>Contributing</summary>
@@ -1,54 +1,11 @@
1
- Metadata-Version: 2.4
2
- Name: graphifyy
3
- Version: 0.2.2
4
- Summary: Claude Code skill - turn any folder of code, docs, papers, images, or tweets into a queryable knowledge graph
5
- License: MIT
6
- Project-URL: Homepage, https://github.com/safishamsi/graphify
7
- Project-URL: Repository, https://github.com/safishamsi/graphify
8
- Project-URL: Issues, https://github.com/safishamsi/graphify/issues
9
- Keywords: claude,claude-code,knowledge-graph,rag,graphrag,obsidian,community-detection,tree-sitter,leiden,llm
10
- Requires-Python: >=3.10
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: networkx
13
- Requires-Dist: tree-sitter
14
- Requires-Dist: tree-sitter-python
15
- Requires-Dist: tree-sitter-javascript
16
- Requires-Dist: tree-sitter-typescript
17
- Requires-Dist: tree-sitter-go
18
- Requires-Dist: tree-sitter-rust
19
- Requires-Dist: tree-sitter-java
20
- Requires-Dist: tree-sitter-c
21
- Requires-Dist: tree-sitter-cpp
22
- Requires-Dist: tree-sitter-ruby
23
- Requires-Dist: tree-sitter-c-sharp
24
- Requires-Dist: tree-sitter-kotlin
25
- Requires-Dist: tree-sitter-scala
26
- Requires-Dist: tree-sitter-php
27
- Provides-Extra: mcp
28
- Requires-Dist: mcp; extra == "mcp"
29
- Provides-Extra: neo4j
30
- Requires-Dist: neo4j; extra == "neo4j"
31
- Provides-Extra: pdf
32
- Requires-Dist: pypdf; extra == "pdf"
33
- Requires-Dist: html2text; extra == "pdf"
34
- Provides-Extra: watch
35
- Requires-Dist: watchdog; extra == "watch"
36
- Provides-Extra: leiden
37
- Requires-Dist: graspologic; extra == "leiden"
38
- Provides-Extra: all
39
- Requires-Dist: mcp; extra == "all"
40
- Requires-Dist: neo4j; extra == "all"
41
- Requires-Dist: pypdf; extra == "all"
42
- Requires-Dist: html2text; extra == "all"
43
- Requires-Dist: watchdog; extra == "all"
44
- Requires-Dist: graspologic; extra == "all"
45
-
46
1
  # graphify
47
2
 
48
- [![CI](https://github.com/safishamsi/graphify/actions/workflows/ci.yml/badge.svg?branch=v2)](https://github.com/safishamsi/graphify/actions/workflows/ci.yml)
3
+ [English](README.md) | [简体中文](README.zh-CN.md)
4
+
5
+ [![CI](https://github.com/safishamsi/graphify/actions/workflows/ci.yml/badge.svg?branch=v3)](https://github.com/safishamsi/graphify/actions/workflows/ci.yml)
49
6
  [![PyPI](https://img.shields.io/pypi/v/graphifyy)](https://pypi.org/project/graphifyy/)
50
7
 
51
- **A Claude Code skill.** Type `/graphify` in Claude Code - 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.
8
+ **An AI coding assistant skill.** Type `/graphify` in Claude Code, Codex, OpenCode, or OpenClaw - 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.
52
9
 
53
10
  Fully multimodal. Drop in code, PDFs, markdown, screenshots, diagrams, whiteboard photos, even images in other languages - graphify uses Claude vision to extract concepts and relationships from all of it and connects them into one graph.
54
11
 
@@ -70,11 +27,13 @@ graphify-out/
70
27
 
71
28
  graphify runs in two passes. First, a deterministic AST pass extracts structure from code files (classes, functions, imports, call graphs, docstrings, rationale comments) with no LLM needed. Second, Claude subagents run in parallel over docs, papers, and images 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.
72
29
 
30
+ **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.
31
+
73
32
  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.
74
33
 
75
34
  ## Install
76
35
 
77
- **Requires:** [Claude Code](https://claude.ai/code) and Python 3.10+
36
+ **Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [Codex](https://openai.com/codex), [OpenCode](https://opencode.ai), or [OpenClaw](https://openclaw.ai)
78
37
 
79
38
  ```bash
80
39
  pip install graphifyy && graphify install
@@ -82,36 +41,54 @@ pip install graphifyy && graphify install
82
41
 
83
42
  > The PyPI package is temporarily named `graphifyy` while the `graphify` name is being reclaimed. The CLI and skill command are still `graphify`.
84
43
 
85
- Then open Claude Code in any directory and type:
44
+ ### Platform support
45
+
46
+ | Platform | Install command |
47
+ |----------|----------------|
48
+ | Claude Code | `graphify install` |
49
+ | Codex | `graphify install --platform codex` |
50
+ | OpenCode | `graphify install --platform opencode` |
51
+ | OpenClaw | `graphify install --platform claw` |
52
+
53
+ Codex users also need `multi_agent = true` under `[features]` in `~/.codex/config.toml` for parallel extraction. OpenClaw uses sequential extraction (parallel agent support is still early on that platform).
54
+
55
+ Then open your AI coding assistant and type:
86
56
 
87
57
  ```
88
58
  /graphify .
89
59
  ```
90
60
 
91
- ### Make Claude always use the graph (recommended)
61
+ ### Make your assistant always use the graph (recommended)
92
62
 
93
63
  After building a graph, run this once in your project:
94
64
 
95
- ```bash
96
- graphify claude install
97
- ```
65
+ | Platform | Command |
66
+ |----------|---------|
67
+ | Claude Code | `graphify claude install` |
68
+ | Codex | `graphify codex install` |
69
+ | OpenCode | `graphify opencode install` |
70
+ | OpenClaw | `graphify claw install` |
71
+
72
+ **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.
73
+
74
+ **Codex, OpenCode, OpenClaw** write the same rules to `AGENTS.md` in your project root. These platforms don't support PreToolUse hooks, so AGENTS.md is the always-on mechanism.
98
75
 
99
- This does two things:
76
+ Uninstall with the matching uninstall command (e.g. `graphify claude uninstall`).
100
77
 
101
- 1. **CLAUDE.md rules** - tells Claude to read `graphify-out/GRAPH_REPORT.md` before answering architecture questions, and to rebuild the graph after editing code files.
78
+ **Always-on vs explicit trigger what's the difference?**
102
79
 
103
- 2. **PreToolUse hook** (`settings.json`) - fires automatically 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."_ This means Claude navigates via the graph instead of grepping through every file - faster answers, fewer wasted tool calls, and responses grounded in the actual structure of your codebase rather than keyword matches.
80
+ 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.
104
81
 
105
- Without this, Claude will grep raw files by default even when a graph exists. With it, the graph becomes the first thing Claude reaches for.
82
+ `/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.
106
83
 
107
- Uninstall with `graphify claude uninstall`.
84
+ Think of it this way: the always-on hook gives your assistant a map. The `/graphify` commands let it navigate the map precisely.
108
85
 
109
86
  <details>
110
87
  <summary>Manual install (curl)</summary>
111
88
 
112
89
  ```bash
113
90
  mkdir -p ~/.claude/skills/graphify
114
- curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v2/graphify/skill.md \
91
+ curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v3/graphify/skill.md \
115
92
  > ~/.claude/skills/graphify/SKILL.md
116
93
  ```
117
94
 
@@ -131,12 +108,18 @@ When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"`
131
108
  /graphify ./raw # run on a specific folder
132
109
  /graphify ./raw --mode deep # more aggressive INFERRED edge extraction
133
110
  /graphify ./raw --update # re-extract only changed files, merge into existing graph
111
+ /graphify ./raw --cluster-only # rerun clustering on existing graph, no re-extraction
112
+ /graphify ./raw --no-viz # skip HTML, just produce report + JSON
134
113
  /graphify ./raw --obsidian # also generate Obsidian vault (opt-in)
135
114
 
136
115
  /graphify add https://arxiv.org/abs/1706.03762 # fetch a paper, save, update graph
137
116
  /graphify add https://x.com/karpathy/status/... # fetch a tweet
117
+ /graphify add https://... --author "Name" # tag the original author
118
+ /graphify add https://... --contributor "Name" # tag who added it to the corpus
138
119
 
139
120
  /graphify query "what connects attention to the optimizer?"
121
+ /graphify query "what connects attention to the optimizer?" --dfs # trace a specific path
122
+ /graphify query "what connects attention to the optimizer?" --budget 1500 # cap at N tokens
140
123
  /graphify path "DigestAuth" "Response"
141
124
  /graphify explain "SwinTransformer"
142
125
 
@@ -145,17 +128,27 @@ When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"`
145
128
  /graphify ./raw --svg # export graph.svg
146
129
  /graphify ./raw --graphml # export graph.graphml (Gephi, yEd)
147
130
  /graphify ./raw --neo4j # generate cypher.txt for Neo4j
131
+ /graphify ./raw --neo4j-push bolt://localhost:7687 # push directly to a running Neo4j instance
148
132
  /graphify ./raw --mcp # start MCP stdio server
149
133
 
150
- graphify hook install # git hooks - rebuilds graph on commit and branch switch
151
- graphify claude install # always-on: CLAUDE.md + PreToolUse hook for this project
134
+ # git hooks - platform-agnostic, rebuild graph on commit and branch switch
135
+ graphify hook install
136
+ graphify hook uninstall
137
+ graphify hook status
138
+
139
+ # always-on assistant instructions - platform-specific
140
+ graphify claude install # CLAUDE.md + PreToolUse hook (Claude Code)
141
+ graphify claude uninstall
142
+ graphify codex install # AGENTS.md (Codex)
143
+ graphify opencode install # AGENTS.md (OpenCode)
144
+ graphify claw install # AGENTS.md (OpenClaw)
152
145
  ```
153
146
 
154
147
  Works with any mix of file types:
155
148
 
156
149
  | Type | Extensions | Extraction |
157
150
  |------|-----------|------------|
158
- | Code | `.py .ts .js .go .rs .java .c .cpp .rb .cs .kt .scala .php` | AST via tree-sitter + call-graph + docstring/comment rationale |
151
+ | Code | `.py .ts .js .go .rs .java .c .cpp .rb .cs .kt .scala .php .swift .lua` | AST via tree-sitter + call-graph + docstring/comment rationale |
159
152
  | Docs | `.md .txt .rst` | Concepts + relationships + design rationale via Claude |
160
153
  | Papers | `.pdf` | Citation mining + concept extraction |
161
154
  | Images | `.png .jpg .webp .gif` | Claude vision - screenshots, diagrams, any language |
@@ -176,11 +169,11 @@ Works with any mix of file types:
176
169
 
177
170
  **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.
178
171
 
179
- **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.
172
+ **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.
180
173
 
181
174
  **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.
182
175
 
183
- **Git hooks** (`graphify hook install`) - installs post-commit and post-checkout hooks. Graph rebuilds automatically after every commit and every branch switch. No background process needed.
176
+ **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.
184
177
 
185
178
  **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.
186
179
 
@@ -196,11 +189,11 @@ Token reduction scales with corpus size. 6 files fits in a context window anyway
196
189
 
197
190
  ## Privacy
198
191
 
199
- graphify sends file contents to the Claude API (Anthropic) for semantic extraction of docs, papers, and images. Code files are processed locally via tree-sitter AST — no file contents leave your machine for code. No telemetry, usage tracking, or analytics of any kind. The only network calls are to Anthropic's API during extraction, using your own API key via Claude Code.
192
+ 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. 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.
200
193
 
201
194
  ## Tech stack
202
195
 
203
- NetworkX + Leiden (graspologic) + tree-sitter + Claude + vis.js. No Neo4j required, no server, runs entirely locally.
196
+ NetworkX + Leiden (graspologic) + tree-sitter + vis.js. Semantic extraction via Claude (Claude Code), GPT-4 (Codex), or whichever model your platform runs. No Neo4j required, no server, runs entirely locally.
204
197
 
205
198
  <details>
206
199
  <summary>Contributing</summary>