ckgraphify 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 (48) hide show
  1. ckgraphify-0.1.0/LICENSE +21 -0
  2. ckgraphify-0.1.0/MANIFEST.in +10 -0
  3. ckgraphify-0.1.0/PKG-INFO +608 -0
  4. ckgraphify-0.1.0/README.md +515 -0
  5. ckgraphify-0.1.0/ckgraphify.egg-info/PKG-INFO +608 -0
  6. ckgraphify-0.1.0/ckgraphify.egg-info/SOURCES.txt +46 -0
  7. ckgraphify-0.1.0/ckgraphify.egg-info/dependency_links.txt +1 -0
  8. ckgraphify-0.1.0/ckgraphify.egg-info/entry_points.txt +2 -0
  9. ckgraphify-0.1.0/ckgraphify.egg-info/requires.txt +99 -0
  10. ckgraphify-0.1.0/ckgraphify.egg-info/top_level.txt +2 -0
  11. ckgraphify-0.1.0/graphify/__init__.py +28 -0
  12. ckgraphify-0.1.0/graphify/__main__.py +2885 -0
  13. ckgraphify-0.1.0/graphify/analyze.py +575 -0
  14. ckgraphify-0.1.0/graphify/benchmark.py +152 -0
  15. ckgraphify-0.1.0/graphify/bridge_mtop.py +517 -0
  16. ckgraphify-0.1.0/graphify/build.py +353 -0
  17. ckgraphify-0.1.0/graphify/business_map.py +1420 -0
  18. ckgraphify-0.1.0/graphify/cache.py +244 -0
  19. ckgraphify-0.1.0/graphify/callflow_html.py +2014 -0
  20. ckgraphify-0.1.0/graphify/cluster.py +221 -0
  21. ckgraphify-0.1.0/graphify/dedup.py +355 -0
  22. ckgraphify-0.1.0/graphify/detect.py +877 -0
  23. ckgraphify-0.1.0/graphify/export.py +1264 -0
  24. ckgraphify-0.1.0/graphify/extract.py +6094 -0
  25. ckgraphify-0.1.0/graphify/global_graph.py +155 -0
  26. ckgraphify-0.1.0/graphify/google_workspace.py +223 -0
  27. ckgraphify-0.1.0/graphify/graph_main_backend.py +1443 -0
  28. ckgraphify-0.1.0/graphify/graph_main_frontend.py +1227 -0
  29. ckgraphify-0.1.0/graphify/graph_main_html.py +597 -0
  30. ckgraphify-0.1.0/graphify/graph_main_merge.py +493 -0
  31. ckgraphify-0.1.0/graphify/graph_main_trace.py +322 -0
  32. ckgraphify-0.1.0/graphify/hooks.py +282 -0
  33. ckgraphify-0.1.0/graphify/ingest.py +331 -0
  34. ckgraphify-0.1.0/graphify/llm.py +1076 -0
  35. ckgraphify-0.1.0/graphify/manifest.py +4 -0
  36. ckgraphify-0.1.0/graphify/report.py +196 -0
  37. ckgraphify-0.1.0/graphify/security.py +242 -0
  38. ckgraphify-0.1.0/graphify/serve.py +670 -0
  39. ckgraphify-0.1.0/graphify/transcribe.py +184 -0
  40. ckgraphify-0.1.0/graphify/tree_html.py +580 -0
  41. ckgraphify-0.1.0/graphify/validate.py +72 -0
  42. ckgraphify-0.1.0/graphify/watch.py +705 -0
  43. ckgraphify-0.1.0/graphify/wiki.py +255 -0
  44. ckgraphify-0.1.0/pyproject.toml +83 -0
  45. ckgraphify-0.1.0/setup.cfg +4 -0
  46. ckgraphify-0.1.0/skill/__init__.py +1 -0
  47. ckgraphify-0.1.0/skill/skill-codex.md +147 -0
  48. ckgraphify-0.1.0/skill/skill.md +151 -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,10 @@
1
+ exclude .DS_Store
2
+ global-exclude __pycache__/*
3
+ global-exclude *.py[cod]
4
+ prune .pytest_cache
5
+ prune .venv-release
6
+ prune build
7
+ prune cgraph.egg-info
8
+ prune dist
9
+ prune graphify-out
10
+ prune tests
@@ -0,0 +1,608 @@
1
+ Metadata-Version: 2.4
2
+ Name: ckgraphify
3
+ Version: 0.1.0
4
+ Summary: AI coding assistant skill for Claude Code and Codex - graph-main boundary graphs, multi-repo call chains, business-map concepts, and business search
5
+ License-Expression: 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,codex,knowledge-graph,graph-main,business-map,multi-repo,hsf,mtop,rag,graphrag,tree-sitter,llm
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: networkx
14
+ Requires-Dist: datasketch
15
+ Requires-Dist: rapidfuzz
16
+ Requires-Dist: tree-sitter>=0.23.0
17
+ Requires-Dist: tree-sitter-python
18
+ Requires-Dist: tree-sitter-javascript
19
+ Requires-Dist: tree-sitter-typescript
20
+ Requires-Dist: tree-sitter-go
21
+ Requires-Dist: tree-sitter-rust
22
+ Requires-Dist: tree-sitter-java
23
+ Requires-Dist: tree-sitter-groovy
24
+ Requires-Dist: tree-sitter-c
25
+ Requires-Dist: tree-sitter-cpp
26
+ Requires-Dist: tree-sitter-ruby
27
+ Requires-Dist: tree-sitter-c-sharp
28
+ Requires-Dist: tree-sitter-kotlin
29
+ Requires-Dist: tree-sitter-scala
30
+ Requires-Dist: tree-sitter-php
31
+ Requires-Dist: tree-sitter-swift
32
+ Requires-Dist: tree-sitter-lua
33
+ Requires-Dist: tree-sitter-zig
34
+ Requires-Dist: tree-sitter-powershell
35
+ Requires-Dist: tree-sitter-elixir
36
+ Requires-Dist: tree-sitter-objc
37
+ Requires-Dist: tree-sitter-julia
38
+ Requires-Dist: tree-sitter-verilog
39
+ Requires-Dist: tree-sitter-fortran
40
+ Provides-Extra: mcp
41
+ Requires-Dist: mcp; extra == "mcp"
42
+ Provides-Extra: neo4j
43
+ Requires-Dist: neo4j; extra == "neo4j"
44
+ Provides-Extra: pdf
45
+ Requires-Dist: pypdf; extra == "pdf"
46
+ Requires-Dist: markdownify; extra == "pdf"
47
+ Provides-Extra: watch
48
+ Requires-Dist: watchdog; extra == "watch"
49
+ Provides-Extra: svg
50
+ Requires-Dist: matplotlib; extra == "svg"
51
+ Provides-Extra: leiden
52
+ Requires-Dist: graspologic; python_version < "3.13" and extra == "leiden"
53
+ Provides-Extra: office
54
+ Requires-Dist: python-docx; extra == "office"
55
+ Requires-Dist: openpyxl; extra == "office"
56
+ Provides-Extra: google
57
+ Requires-Dist: openpyxl; extra == "google"
58
+ Provides-Extra: video
59
+ Requires-Dist: faster-whisper; extra == "video"
60
+ Requires-Dist: yt-dlp; extra == "video"
61
+ Provides-Extra: kimi
62
+ Requires-Dist: openai; extra == "kimi"
63
+ Requires-Dist: tiktoken; extra == "kimi"
64
+ Provides-Extra: ollama
65
+ Requires-Dist: openai; extra == "ollama"
66
+ Provides-Extra: bedrock
67
+ Requires-Dist: boto3; extra == "bedrock"
68
+ Provides-Extra: gemini
69
+ Requires-Dist: openai; extra == "gemini"
70
+ Requires-Dist: tiktoken; extra == "gemini"
71
+ Provides-Extra: openai
72
+ Requires-Dist: openai; extra == "openai"
73
+ Requires-Dist: tiktoken; extra == "openai"
74
+ Provides-Extra: sql
75
+ Requires-Dist: tree-sitter-sql; extra == "sql"
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: markdownify; 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
+ Requires-Dist: openai; extra == "all"
89
+ Requires-Dist: tiktoken; extra == "all"
90
+ Requires-Dist: boto3; extra == "all"
91
+ Requires-Dist: tree-sitter-sql; extra == "all"
92
+ Dynamic: license-file
93
+
94
+ <p align="center">
95
+ <a href="https://graphifylabs.ai"><img src="https://raw.githubusercontent.com/safishamsi/graphify/v4/docs/logo-text.svg" width="260" height="64" alt="Graphify"/></a>
96
+ </p>
97
+
98
+ <p align="center">
99
+ 🇺🇸 <a href="README.md">English</a> | 🇨🇳 <a href="docs/translations/README.zh-CN.md">简体中文</a> | 🇯🇵 <a href="docs/translations/README.ja-JP.md">日本語</a> | 🇰🇷 <a href="docs/translations/README.ko-KR.md">한국어</a> | 🇩🇪 <a href="docs/translations/README.de-DE.md">Deutsch</a> | 🇫🇷 <a href="docs/translations/README.fr-FR.md">Français</a> | 🇪🇸 <a href="docs/translations/README.es-ES.md">Español</a> | 🇮🇳 <a href="docs/translations/README.hi-IN.md">हिन्दी</a> | 🇧🇷 <a href="docs/translations/README.pt-BR.md">Português</a> | 🇷🇺 <a href="docs/translations/README.ru-RU.md">Русский</a> | 🇸🇦 <a href="docs/translations/README.ar-SA.md">العربية</a> | 🇮🇹 <a href="docs/translations/README.it-IT.md">Italiano</a> | 🇵🇱 <a href="docs/translations/README.pl-PL.md">Polski</a> | 🇳🇱 <a href="docs/translations/README.nl-NL.md">Nederlands</a> | 🇹🇷 <a href="docs/translations/README.tr-TR.md">Türkçe</a> | 🇺🇦 <a href="docs/translations/README.uk-UA.md">Українська</a> | 🇻🇳 <a href="docs/translations/README.vi-VN.md">Tiếng Việt</a> | 🇮🇩 <a href="docs/translations/README.id-ID.md">Bahasa Indonesia</a> | 🇸🇪 <a href="docs/translations/README.sv-SE.md">Svenska</a> | 🇬🇷 <a href="docs/translations/README.el-GR.md">Ελληνικά</a> | 🇷🇴 <a href="docs/translations/README.ro-RO.md">Română</a> | 🇨🇿 <a href="docs/translations/README.cs-CZ.md">Čeština</a> | 🇫🇮 <a href="docs/translations/README.fi-FI.md">Suomi</a> | 🇩🇰 <a href="docs/translations/README.da-DK.md">Dansk</a> | 🇳🇴 <a href="docs/translations/README.no-NO.md">Norsk</a> | 🇭🇺 <a href="docs/translations/README.hu-HU.md">Magyar</a> | 🇹🇭 <a href="docs/translations/README.th-TH.md">ภาษาไทย</a> | 🇹🇼 <a href="docs/translations/README.zh-TW.md">繁體中文</a>
100
+ </p>
101
+
102
+ <p align="center">
103
+ <a href="https://safishamsi.gumroad.com/l/qetvlo"><img src="https://img.shields.io/badge/Book-The%20Memory%20Layer-2ea44f?style=flat&logo=gitbook&logoColor=white" alt="The Memory Layer"/></a>
104
+ <a href="https://github.com/safishamsi/graphify/actions/workflows/ci.yml"><img src="https://github.com/safishamsi/graphify/actions/workflows/ci.yml/badge.svg?branch=v7" alt="CI"/></a>
105
+ <a href="https://pypi.org/project/ckgraphify/"><img src="https://img.shields.io/pypi/v/ckgraphify" alt="PyPI"/></a>
106
+ <a href="https://clickpy.clickhouse.com/dashboard/ckgraphify"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsql-clickhouse.clickhouse.com%2F%3Fquery%3DSELECT%2520concat%2528toString%2528round%2528sum%2528count%2529%2F1000%2529%2529%2C%2520%2527k%2527%2529%2520AS%2520c%2520FROM%2520pypi.pypi_downloads%2520WHERE%2520project%253D%2527ckgraphify%2527%2520FORMAT%2520JSON%26user%3Ddemo&query=%24.data%5B0%5D.c&label=downloads&color=blue" alt="Downloads"/></a>
107
+ <a href="https://github.com/sponsors/safishamsi"><img src="https://img.shields.io/badge/sponsor-safishamsi-ea4aaa?logo=github-sponsors" alt="Sponsor"/></a>
108
+ <a href="https://www.linkedin.com/in/safi-shamsi"><img src="https://img.shields.io/badge/LinkedIn-Safi%20Shamsi-0077B5?logo=linkedin" alt="LinkedIn"/></a>
109
+ <a href="https://x.com/cgraph"><img src="https://img.shields.io/badge/X-cgraph-000000?logo=x&logoColor=white" alt="X"/></a>
110
+ </p>
111
+
112
+ <p align="center">
113
+ <a href="https://star-history.com/#safishamsi/graphify&Date">
114
+ <img src="https://api.star-history.com/svg?repos=safishamsi/graphify&type=Date" alt="Star History Chart" width="370"/>
115
+ </a>
116
+ </p>
117
+
118
+ Type `/cgraph` in Claude Code or use the installed Codex skill to work with graph-main boundary graphs, multi-repo call chains, business-map concepts, and business search.
119
+
120
+ Supported assistant channels are Claude Code and Codex.
121
+
122
+ ```
123
+ /cgraph .
124
+ ```
125
+
126
+ That's it. You get three files:
127
+
128
+ ```
129
+ graphify-out/
130
+ ├── graph.html open in any browser — click nodes, filter, search
131
+ ├── GRAPH_REPORT.md the highlights: key concepts, surprising connections, suggested questions
132
+ └── graph.json the full graph — query it anytime without re-reading your files
133
+ ```
134
+
135
+ For a readable architecture page with Mermaid call-flow diagrams, run:
136
+
137
+ ```bash
138
+ graphify export callflow-html
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Prerequisites
144
+
145
+ | Requirement | Minimum | Check | Install |
146
+ |---|---|---|---|
147
+ | Python | 3.10+ | `python --version` | [python.org](https://www.python.org/downloads/) |
148
+ | uv *(recommended)* | any | `uv --version` | `curl -LsSf https://astral.sh/uv/install.sh \| sh` |
149
+ | pipx *(alternative)* | any | `pipx --version` | `pip install pipx` |
150
+
151
+ **macOS quick install (Homebrew):**
152
+ ```bash
153
+ brew install python@3.12 uv
154
+ ```
155
+
156
+ **Windows quick install:**
157
+ ```powershell
158
+ winget install astral-sh.uv
159
+ ```
160
+
161
+ **Ubuntu/Debian:**
162
+ ```bash
163
+ sudo apt install python3.12 python3-pip pipx
164
+ # or install uv:
165
+ curl -LsSf https://astral.sh/uv/install.sh | sh
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Install
171
+
172
+ > **Official package:** The PyPI package is `ckgraphify`. The CLI command is still `graphify`.
173
+
174
+ **Step 1 — install the package:**
175
+
176
+ ```bash
177
+ # Recommended (uv puts graphify on PATH automatically):
178
+ uv tool install ckgraphify
179
+
180
+ # Alternatives:
181
+ pipx install ckgraphify
182
+ pip install ckgraphify
183
+ ```
184
+
185
+ **Step 2 — register the skill with your AI assistant:**
186
+
187
+ ```bash
188
+ graphify install
189
+ ```
190
+
191
+ That's it. Open your AI assistant and type `/cgraph .`
192
+
193
+ > **PowerShell note:** Use `graphify .` not `/cgraph .` — the leading slash is a path separator in PowerShell.
194
+
195
+ > **`graphify: command not found`?** Use `uv tool install ckgraphify` or `pipx install ckgraphify` — both put the CLI on PATH automatically. With plain `pip`, add `~/.local/bin` (Linux) or `~/Library/Python/3.x/bin` (Mac) to your PATH, or run `python -m graphify`.
196
+
197
+ ### Pick your platform
198
+
199
+ | Platform | Install command |
200
+ |----------|----------------|
201
+ | Claude Code | `graphify install` |
202
+ | Codex | `graphify install --platform codex` |
203
+
204
+ > Codex users: also add `multi_agent = true` under `[features]` in `~/.codex/config.toml`.
205
+ > Codex uses `$cgraph` instead of `/cgraph`.
206
+
207
+ ### Optional extras
208
+
209
+ Install only what you need:
210
+
211
+ | Extra | What it adds | Install |
212
+ |---|---|---|
213
+ | `pdf` | PDF extraction | `pip install "ckgraphify[pdf]"` |
214
+ | `office` | `.docx` and `.xlsx` support | `pip install "ckgraphify[office]"` |
215
+ | `google` | Google Sheets rendering | `pip install "ckgraphify[google]"` |
216
+ | `video` | Video/audio transcription (faster-whisper + yt-dlp) | `pip install "ckgraphify[video]"` |
217
+ | `mcp` | MCP stdio server | `pip install "ckgraphify[mcp]"` |
218
+ | `neo4j` | Neo4j push support | `pip install "ckgraphify[neo4j]"` |
219
+ | `svg` | SVG graph export | `pip install "ckgraphify[svg]"` |
220
+ | `leiden` | Leiden community detection (Python < 3.13 only) | `pip install "ckgraphify[leiden]"` |
221
+ | `ollama` | Ollama local inference | `pip install "ckgraphify[ollama]"` |
222
+ | `openai` | OpenAI / OpenAI-compatible APIs | `pip install "ckgraphify[openai]"` |
223
+ | `gemini` | Google Gemini API | `pip install "ckgraphify[gemini]"` |
224
+ | `bedrock` | AWS Bedrock (uses IAM, no API key) | `pip install "ckgraphify[bedrock]"` |
225
+ | `sql` | SQL schema extraction | `pip install "ckgraphify[sql]"` |
226
+ | `all` | Everything above | `pip install "ckgraphify[all]"` |
227
+
228
+ ---
229
+
230
+ ## Make your assistant always use the graph
231
+
232
+ Run this once in your project after building a graph:
233
+
234
+ | Platform | Command |
235
+ |----------|---------|
236
+ | Claude Code | `graphify claude install` |
237
+ | Codex | `graphify codex install` |
238
+
239
+ This writes a small config file that tells your assistant to read `GRAPH_REPORT.md` before answering questions about your codebase. Claude Code and Codex can also register hooks so the assistant checks the graph before file reads.
240
+
241
+ To remove cgraph from supported assistant configs: `graphify uninstall` (add `--purge` to also delete `graphify-out/`). Or use `graphify claude uninstall` / `graphify codex uninstall`.
242
+
243
+ ---
244
+
245
+ ## What's in the report
246
+
247
+ - **God nodes** — the most-connected concepts in your project. Everything flows through these.
248
+ - **Surprising connections** — links between things that live in different files or modules. Ranked by how unexpected they are.
249
+ - **The "why"** — inline comments (`# NOTE:`, `# WHY:`, `# HACK:`), docstrings, and design rationale from docs are extracted as separate nodes linked to the code they explain.
250
+ - **Suggested questions** — 4–5 questions the graph is uniquely positioned to answer.
251
+ - **Confidence tags** — every inferred relationship is marked `EXTRACTED`, `INFERRED`, or `AMBIGUOUS`. You always know what was found vs guessed.
252
+
253
+ ---
254
+
255
+ ## What files it handles
256
+
257
+ | Type | Extensions |
258
+ |------|-----------|
259
+ | Code (29 languages) | `.py .ts .js .jsx .tsx .mjs .go .rs .java .c .cpp .h .hpp .rb .cs .kt .scala .php .swift .lua .luau .zig .ps1 .ex .exs .m .mm .jl .vue .svelte .groovy .gradle .dart .v .sv .sql .f .f90 .f95 .f03 .f08 .pas .pp .dpr .dpk .lpr .inc .dfm .lfm .lpk` |
260
+ | Docs | `.md .mdx .qmd .html .txt .rst .yaml .yml` |
261
+ | Office | `.docx .xlsx` (requires `pip install ckgraphify[office]`) |
262
+ | Google Workspace | `.gdoc .gsheet .gslides` (opt-in; requires `gws` auth and `--google-workspace`; Sheets need `pip install ckgraphify[google]`) |
263
+ | PDFs | `.pdf` |
264
+ | Images | `.png .jpg .webp .gif` |
265
+ | Video / Audio | `.mp4 .mov .mp3 .wav` and more (requires `pip install ckgraphify[video]`) |
266
+ | YouTube / URLs | any video URL (requires `pip install ckgraphify[video]`) |
267
+
268
+ Code is extracted locally with no API calls (AST via tree-sitter). Everything else goes through your AI assistant's model API.
269
+
270
+ Google Drive for desktop `.gdoc`, `.gsheet`, and `.gslides` files are shortcut
271
+ pointers, not document content. To include native Google Docs, Sheets, and Slides
272
+ in a headless extraction, install and authenticate the
273
+ [`gws` CLI](https://github.com/googleworkspace/cli), then run:
274
+
275
+ ```bash
276
+ pip install "ckgraphify[google]" # needed for Google Sheets table rendering
277
+ gws auth login -s drive
278
+ graphify extract ./docs --google-workspace
279
+ ```
280
+
281
+ You can also set `GRAPHIFY_GOOGLE_WORKSPACE=1`. Graphify exports shortcuts into
282
+ `graphify-out/converted/` as Markdown sidecars, then extracts those files.
283
+
284
+ ---
285
+
286
+ ## Common commands
287
+
288
+ ```bash
289
+ /cgraph . # build graph for current folder
290
+ /cgraph ./docs --update # re-extract only changed files
291
+ /cgraph . --cluster-only # rerun clustering without re-extracting
292
+ /cgraph . --no-viz # skip the HTML, just the report + JSON
293
+ /cgraph . --wiki # build a markdown wiki from the graph
294
+ graphify export callflow-html # architecture/call-flow HTML from graphify-out/
295
+
296
+ /cgraph query "what connects auth to the database?"
297
+ /cgraph path "UserService" "DatabasePool"
298
+ /cgraph explain "RateLimiter"
299
+
300
+ /cgraph add https://arxiv.org/abs/1706.03762 # fetch a paper and add it
301
+ /cgraph add <youtube-url> # transcribe and add a video
302
+
303
+ graphify hook install # auto-rebuild on git commit
304
+ graphify merge-graphs a.json b.json # combine two graphs
305
+ ```
306
+
307
+ See the [full command reference](#full-command-reference) below.
308
+
309
+ ---
310
+
311
+ ## Ignoring files
312
+
313
+ Create a `.graphifyignore` in your project root — same syntax as `.gitignore`, including `!` negation:
314
+
315
+ ```
316
+ # .graphifyignore
317
+ node_modules/
318
+ dist/
319
+ *.generated.py
320
+
321
+ # only index src/, ignore everything else
322
+ *
323
+ !src/
324
+ !src/**
325
+ ```
326
+
327
+ ---
328
+
329
+ ## Team setup
330
+
331
+ `graphify-out/` is meant to be committed to git so everyone on the team starts with a map.
332
+
333
+ **Recommended `.gitignore` additions:**
334
+ ```
335
+ graphify-out/manifest.json # mtime-based, breaks after git clone
336
+ graphify-out/cost.json # local only
337
+ # graphify-out/cache/ # optional: commit for speed, skip to keep repo small
338
+ ```
339
+
340
+ **Workflow:**
341
+ 1. One person runs `/cgraph .` and commits `graphify-out/`.
342
+ 2. Everyone pulls — their assistant reads the graph immediately.
343
+ 3. Run `graphify hook install` to auto-rebuild after each commit (AST only, no API cost). This also sets up a git merge driver so `graph.json` is never left with conflict markers — two devs committing in parallel get their graphs union-merged automatically.
344
+ 4. When docs or papers change, run `/cgraph --update` to refresh those nodes.
345
+
346
+ ---
347
+
348
+ ## Using the graph directly
349
+
350
+ ```bash
351
+ # query the graph from the terminal
352
+ graphify query "show the auth flow"
353
+ graphify query "what connects DigestAuth to Response?" --graph graphify-out/graph.json
354
+
355
+ # expose the graph as an MCP server (for repeated tool-call access)
356
+ python -m graphify.serve graphify-out/graph.json
357
+
358
+ # register with Kimi Code:
359
+ kimi mcp add --transport stdio graphify -- python -m graphify.serve graphify-out/graph.json
360
+ ```
361
+
362
+ The MCP server gives your assistant structured access: `query_graph`, `get_node`, `get_neighbors`, `shortest_path`.
363
+
364
+ > **WSL / Linux note:** Ubuntu ships `python3`, not `python`. Use a venv to avoid conflicts:
365
+ > ```bash
366
+ > python3 -m venv .venv && .venv/bin/pip install "ckgraphify[mcp]"
367
+ > ```
368
+
369
+ ---
370
+
371
+ ## Environment variables
372
+
373
+ These are only needed for **headless / CI extraction** (`graphify extract`). When running via the `/cgraph` skill inside your IDE, the model API is provided by your IDE session — no extra keys needed.
374
+
375
+ | Variable | Used for | When required |
376
+ |---|---|---|
377
+ | `ANTHROPIC_API_KEY` | Claude (Anthropic) backend | `--backend claude` |
378
+ | `GEMINI_API_KEY` or `GOOGLE_API_KEY` | Google Gemini backend | `--backend gemini` |
379
+ | `OPENAI_API_KEY` | OpenAI or OpenAI-compatible APIs | `--backend openai` |
380
+ | `MOONSHOT_API_KEY` | Kimi Code backend | `--backend kimi` |
381
+ | `OLLAMA_BASE_URL` | Ollama local inference URL | `--backend ollama` (default: `http://localhost:11434`) |
382
+ | `OLLAMA_MODEL` | Ollama model name | `--backend ollama` (default: auto-detect) |
383
+ | `GRAPHIFY_OLLAMA_NUM_CTX` | Override Ollama KV-cache window size | optional — auto-sized by default |
384
+ | `GRAPHIFY_OLLAMA_KEEP_ALIVE` | Minutes to keep Ollama model loaded | optional — set `0` to unload after each chunk |
385
+ | `AWS_*` / `~/.aws/credentials` | AWS Bedrock — standard credential chain | `--backend bedrock` (no API key, uses IAM) |
386
+ | `GRAPHIFY_MAX_WORKERS` | AST parallelism thread count | optional — also `--max-workers` flag |
387
+ | `GRAPHIFY_MAX_OUTPUT_TOKENS` | Raise output cap for dense corpora | optional — e.g. `32768` for large files |
388
+ | `GRAPHIFY_API_TIMEOUT` | HTTP timeout in seconds (default: 600) | optional — also `--api-timeout` flag |
389
+ | `GRAPHIFY_FORCE` | Force graph rebuild even with fewer nodes | optional — also `--force` flag |
390
+ | `GRAPHIFY_GOOGLE_WORKSPACE` | Auto-enable Google Workspace export | optional — set to `1` |
391
+
392
+ ---
393
+
394
+ ## Privacy
395
+
396
+ - **Code files** — processed locally via tree-sitter. Nothing leaves your machine.
397
+ - **Video / audio** — transcribed locally with faster-whisper. Nothing leaves your machine.
398
+ - **Docs, PDFs, images** — sent to your AI assistant for semantic extraction (via the `/cgraph` skill, using whatever model your IDE session runs). Headless `graphify extract` requires `GEMINI_API_KEY` / `GOOGLE_API_KEY` (Gemini), `MOONSHOT_API_KEY` (Kimi), `ANTHROPIC_API_KEY` (Claude), `OPENAI_API_KEY` (OpenAI), a running Ollama instance (`OLLAMA_BASE_URL`), AWS credentials via the standard provider chain (Bedrock - no API key needed, uses IAM), or the `claude` CLI binary (Claude Code - no API key needed, uses your Claude subscription). The `--dedup-llm` flag uses the same key.
399
+ - No telemetry, no usage tracking, no analytics.
400
+
401
+ ---
402
+
403
+ ## Troubleshooting
404
+
405
+ **`graphify: command not found` after `pip install ckgraphify`**
406
+ pip installs scripts to a user bin directory that may not be on your PATH. Fix:
407
+ - macOS: add `~/Library/Python/3.x/bin` to your PATH in `~/.zshrc`
408
+ - Linux: add `~/.local/bin` to your PATH in `~/.bashrc`
409
+ - Or use `uv tool install ckgraphify` / `pipx install ckgraphify` — both manage PATH automatically.
410
+
411
+ **`python -m graphify` works but `graphify` command doesn't**
412
+ Your shell's PATH doesn't include the Python scripts directory. Use `uv` or `pipx` instead of plain `pip`.
413
+
414
+ **`/cgraph .` causes "path not recognized" in PowerShell**
415
+ PowerShell treats a leading `/` as a path separator. Use `graphify .` (no slash) on Windows.
416
+
417
+ **Graph has fewer nodes after `--update` or rebuild**
418
+ If a refactor deleted files, the old nodes linger. Pass `--force` (or set `GRAPHIFY_FORCE=1`) to overwrite even when the rebuild has fewer nodes.
419
+
420
+ **Graph has duplicate nodes for the same entity (ghost duplicates)**
421
+ This happens when semantic and AST extraction disagreed on the node ID format. Run a full re-extract to clean up:
422
+ ```bash
423
+ graphify extract . --force
424
+ ```
425
+
426
+ **Ollama runs out of VRAM / context window exceeded**
427
+ The KV-cache window is auto-sized but may be too large for your GPU. Reduce it:
428
+ ```bash
429
+ GRAPHIFY_OLLAMA_NUM_CTX=8192 graphify extract ./docs --backend ollama --token-budget 4000
430
+ ```
431
+
432
+ **Graph HTML is too large to open in a browser (>5000 nodes)**
433
+ Skip HTML generation and use the JSON directly:
434
+ ```bash
435
+ graphify cluster-only ./my-project --no-viz
436
+ graphify query "..."
437
+ ```
438
+
439
+ **`graph.json` has conflict markers after two devs commit at once**
440
+ Run `graphify hook install` — it sets up a git merge driver that union-merges `graph.json` automatically so conflicts never happen.
441
+
442
+ **Extraction returns empty nodes/edges for docs or PDFs**
443
+ Docs and PDFs require an LLM call. Check that your API key is set and the backend is correct:
444
+ ```bash
445
+ ANTHROPIC_API_KEY=sk-... graphify extract ./docs --backend claude
446
+ ```
447
+
448
+ **Skill version mismatch warning in your IDE**
449
+ Your installed cgraph version is different from the skill file. Update:
450
+ ```bash
451
+ uv tool upgrade ckgraphify
452
+ graphify install # overwrites the skill file
453
+ ```
454
+
455
+ ---
456
+
457
+ ## Full command reference
458
+
459
+ ```
460
+ /cgraph # run on current directory
461
+ /cgraph ./raw # run on a specific folder
462
+ /cgraph ./raw --mode deep # more aggressive relationship extraction
463
+ /cgraph ./raw --update # re-extract only changed files
464
+ /cgraph ./raw --directed # preserve edge direction
465
+ /cgraph ./raw --cluster-only # rerun clustering on existing graph
466
+ /cgraph ./raw --no-viz # skip HTML visualization
467
+ /cgraph ./raw --obsidian # generate Obsidian vault
468
+ /cgraph ./raw --wiki # build agent-crawlable markdown wiki
469
+ /cgraph ./raw --svg # export graph.svg
470
+ /cgraph ./raw --graphml # export for Gephi / yEd
471
+ /cgraph ./raw --neo4j # generate cypher.txt for Neo4j
472
+ /cgraph ./raw --neo4j-push bolt://localhost:7687
473
+ /cgraph ./raw --watch # auto-sync as files change
474
+ /cgraph ./raw --mcp # start MCP stdio server
475
+
476
+ /cgraph add https://arxiv.org/abs/1706.03762
477
+ /cgraph add <video-url>
478
+ /cgraph add https://... --author "Name" --contributor "Name"
479
+
480
+ /cgraph query "what connects attention to the optimizer?"
481
+ /cgraph query "..." --dfs --budget 1500
482
+ /cgraph path "DigestAuth" "Response"
483
+ /cgraph explain "SwinTransformer"
484
+
485
+ graphify uninstall # remove from Claude Code and Codex configs
486
+ graphify uninstall --purge # also delete graphify-out/
487
+
488
+ graphify hook install # post-commit + post-checkout hooks
489
+ graphify hook uninstall
490
+ graphify hook status
491
+
492
+ graphify claude install / uninstall
493
+ graphify codex install / uninstall
494
+
495
+ graphify extract ./docs # headless LLM extraction for CI (no IDE needed)
496
+ graphify extract ./docs --backend gemini # explicit backend: gemini, kimi, claude, openai, ollama, bedrock, or claude-cli
497
+ graphify extract ./docs --backend gemini --model gemini-3.1-pro-preview
498
+ graphify extract ./docs --backend ollama # local Ollama (set OLLAMA_BASE_URL / OLLAMA_MODEL) - no API key needed for loopback
499
+ GRAPHIFY_OLLAMA_NUM_CTX=32768 graphify extract ./docs --backend ollama # override KV-cache window (auto-sized by default)
500
+ GRAPHIFY_OLLAMA_KEEP_ALIVE=0 graphify extract ./docs --backend ollama # unload model after each chunk (saves VRAM on small GPUs)
501
+ graphify extract ./docs --backend bedrock # AWS Bedrock via IAM - no API key, uses AWS credential chain
502
+ graphify extract ./docs --backend claude-cli # route through Claude Code CLI - no API key, uses your Claude subscription
503
+ graphify extract ./docs --max-workers 16 # AST parallelism (also GRAPHIFY_MAX_WORKERS)
504
+ graphify extract ./docs --token-budget 30000 # smaller semantic chunks for local/small models
505
+ graphify extract ./docs --max-concurrency 2 # fewer parallel LLM calls (useful for local inference)
506
+ graphify extract ./docs --api-timeout 900 # longer HTTP timeout for slow local models (default 600s)
507
+ graphify extract ./docs --google-workspace # export .gdoc/.gsheet/.gslides via gws before extraction
508
+ graphify extract ./docs --no-cluster # raw extraction only, skip clustering
509
+ graphify extract ./docs --force # overwrite graph.json even if new graph has fewer nodes (use after refactors or to clear ghost duplicates)
510
+ graphify extract ./docs --dedup-llm # LLM tiebreaker for ambiguous entity pairs (uses same API key)
511
+ graphify extract ./docs --global --as myrepo # extract and register into the cross-project global graph
512
+ GRAPHIFY_MAX_OUTPUT_TOKENS=32768 graphify extract ./docs --backend claude # raise output cap for dense corpora
513
+
514
+ graphify export callflow-html # graphify-out/<project>-callflow.html
515
+ graphify export callflow-html --max-sections 8 # cap generated architecture sections
516
+ graphify export callflow-html --output docs/arch.html
517
+ graphify export callflow-html ./some-repo/graphify-out
518
+
519
+ graphify global add graphify-out/graph.json myrepo # register a project graph into ~/.graphify/global.json
520
+ graphify global remove myrepo # remove a project from the global graph
521
+ graphify global list # show all registered repos + node/edge counts
522
+ graphify global path # print path to the global graph file
523
+
524
+ graphify clone https://github.com/karpathy/nanoGPT
525
+ graphify merge-graphs a.json b.json --out merged.json
526
+ graphify --version # print installed version
527
+ graphify watch ./src
528
+ graphify check-update ./src
529
+ graphify update ./src
530
+ graphify update ./src --no-cluster # skip reclustering, write raw AST graph only
531
+ graphify update ./src --force # overwrite even if new graph has fewer nodes
532
+ graphify cluster-only ./my-project
533
+ graphify cluster-only ./my-project --graph path/to/graph.json # custom graph location
534
+ ```
535
+
536
+ ---
537
+
538
+ ## Learn more
539
+
540
+ - [How it works](docs/how-it-works.md) — the extraction pipeline, community detection, confidence scoring, benchmarks
541
+ - [ARCHITECTURE.md](ARCHITECTURE.md) — module breakdown, how to add a language
542
+ - [Optional integrations](docs/docker-mcp-sqlite.md) — Docker MCP Toolkit + SQLite
543
+
544
+ ---
545
+
546
+ ## Built on graphify — Penpax
547
+
548
+ [**Penpax**](https://graphifylabs.ai) is the always-on layer built on top of graphify — it applies the same graph approach to your entire working life: meetings, browser history, emails, files, and code, updating continuously in the background.
549
+
550
+ Built for people whose work lives across hundreds of conversations and documents they can never fully reconstruct. No cloud, fully on-device.
551
+
552
+ **Free trial launching soon.** [Join the waitlist →](https://graphifylabs.ai)
553
+
554
+ ---
555
+
556
+ <details>
557
+ <summary>Contributing</summary>
558
+
559
+ ### Development setup
560
+
561
+ Clone the repo and install in editable mode:
562
+
563
+ ```bash
564
+ git clone https://github.com/safishamsi/graphify.git
565
+ cd graphify
566
+ git checkout v7 # active development branch
567
+
568
+ # Create a virtual environment (Python 3.10+ required):
569
+ python3 -m venv .venv
570
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
571
+
572
+ # Install in editable mode with all optional extras:
573
+ pip install -e ".[all]"
574
+ ```
575
+
576
+ Verify the editable install:
577
+ ```bash
578
+ graphify --version
579
+ python -c "import graphify; print(graphify.__file__)"
580
+ ```
581
+
582
+ ### Running tests
583
+
584
+ ```bash
585
+ pip install pytest
586
+ pytest tests/ -q # run the full suite
587
+ pytest tests/test_extract.py -q # one module
588
+ pytest tests/ -q -k "python" # filter by name
589
+ ```
590
+
591
+ > macOS note: the test suite includes both `sample.f90` and `sample.F90` fixtures. These collide on case-insensitive HFS+ / APFS file systems. Run on Linux or in a Docker container if you need to test both Fortran variants simultaneously.
592
+
593
+ ### Git workflow
594
+
595
+ - Active development happens on the `v7` branch.
596
+ - Commit style: `fix: <description>` / `feat: <description>` / `docs: <description>`
597
+ - Before opening a PR, run `pytest tests/ -q` and confirm it passes.
598
+ - Add a fixture file to `tests/fixtures/` and tests to `tests/test_languages.py` for any new language extractor.
599
+
600
+ ### What to contribute
601
+
602
+ **Worked examples** are the most useful contribution. Run `/cgraph` on a real corpus, save the output to `worked/{slug}/`, write an honest `review.md` covering what the graph got right and wrong, and open a PR.
603
+
604
+ **Extraction bugs** — open an issue with the input file, the cache entry (`graphify-out/cache/`), and what was missed or wrong.
605
+
606
+ See [ARCHITECTURE.md](ARCHITECTURE.md) for module responsibilities and how to add a language.
607
+
608
+ </details>