@oriro/orirocli 0.1.7 → 0.1.9

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 (351) hide show
  1. package/ATTRIBUTION.md +8 -0
  2. package/LICENSE +21 -0
  3. package/dist/cli.js +35 -5
  4. package/package.json +1 -1
  5. package/skills/21stdev/SKILL.md +64 -0
  6. package/skills/graphify/SKILL.md +619 -0
  7. package/skills/graphify/__init__.py +28 -0
  8. package/skills/graphify/__main__.py +4582 -0
  9. package/skills/graphify/affected.py +154 -0
  10. package/skills/graphify/always_on/agents-md.md +12 -0
  11. package/skills/graphify/always_on/antigravity-rules.md +14 -0
  12. package/skills/graphify/always_on/claude-md.md +9 -0
  13. package/skills/graphify/always_on/gemini-md.md +9 -0
  14. package/skills/graphify/always_on/kiro-steering.md +5 -0
  15. package/skills/graphify/always_on/vscode-instructions.md +17 -0
  16. package/skills/graphify/analyze.py +724 -0
  17. package/skills/graphify/benchmark.py +155 -0
  18. package/skills/graphify/build.py +487 -0
  19. package/skills/graphify/cache.py +417 -0
  20. package/skills/graphify/callflow_html.py +2020 -0
  21. package/skills/graphify/cluster.py +272 -0
  22. package/skills/graphify/command-kilo.md +15 -0
  23. package/skills/graphify/dedup.py +429 -0
  24. package/skills/graphify/detect.py +1379 -0
  25. package/skills/graphify/diagnostics.py +390 -0
  26. package/skills/graphify/export.py +1408 -0
  27. package/skills/graphify/extract.py +11570 -0
  28. package/skills/graphify/global_graph.py +159 -0
  29. package/skills/graphify/google_workspace.py +223 -0
  30. package/skills/graphify/hooks.py +457 -0
  31. package/skills/graphify/ingest.py +331 -0
  32. package/skills/graphify/llm.py +1896 -0
  33. package/skills/graphify/manifest.py +4 -0
  34. package/skills/graphify/mcp_ingest.py +392 -0
  35. package/skills/graphify/multigraph_compat.py +212 -0
  36. package/skills/graphify/pg_introspect.py +142 -0
  37. package/skills/graphify/prs.py +748 -0
  38. package/skills/graphify/querylog.py +70 -0
  39. package/skills/graphify/report.py +218 -0
  40. package/skills/graphify/scip_ingest.py +363 -0
  41. package/skills/graphify/security.py +336 -0
  42. package/skills/graphify/semantic_cleanup.py +319 -0
  43. package/skills/graphify/serve.py +1309 -0
  44. package/skills/graphify/skill-aider.md +1246 -0
  45. package/skills/graphify/skill-amp.md +613 -0
  46. package/skills/graphify/skill-claw.md +616 -0
  47. package/skills/graphify/skill-codex.md +613 -0
  48. package/skills/graphify/skill-copilot.md +616 -0
  49. package/skills/graphify/skill-devin.md +1372 -0
  50. package/skills/graphify/skill-droid.md +613 -0
  51. package/skills/graphify/skill-kilo.md +625 -0
  52. package/skills/graphify/skill-kiro.md +615 -0
  53. package/skills/graphify/skill-opencode.md +608 -0
  54. package/skills/graphify/skill-pi.md +615 -0
  55. package/skills/graphify/skill-trae.md +614 -0
  56. package/skills/graphify/skill-vscode.md +612 -0
  57. package/skills/graphify/skill-windows.md +651 -0
  58. package/skills/graphify/skills/amp/references/add-watch.md +56 -0
  59. package/skills/graphify/skills/amp/references/exports.md +71 -0
  60. package/skills/graphify/skills/amp/references/extraction-spec.md +68 -0
  61. package/skills/graphify/skills/amp/references/github-and-merge.md +46 -0
  62. package/skills/graphify/skills/amp/references/hooks.md +33 -0
  63. package/skills/graphify/skills/amp/references/query.md +249 -0
  64. package/skills/graphify/skills/amp/references/transcribe.md +48 -0
  65. package/skills/graphify/skills/amp/references/update.md +179 -0
  66. package/skills/graphify/skills/claude/references/add-watch.md +56 -0
  67. package/skills/graphify/skills/claude/references/exports.md +71 -0
  68. package/skills/graphify/skills/claude/references/extraction-spec.md +68 -0
  69. package/skills/graphify/skills/claude/references/github-and-merge.md +46 -0
  70. package/skills/graphify/skills/claude/references/hooks.md +33 -0
  71. package/skills/graphify/skills/claude/references/query.md +103 -0
  72. package/skills/graphify/skills/claude/references/transcribe.md +48 -0
  73. package/skills/graphify/skills/claude/references/update.md +179 -0
  74. package/skills/graphify/skills/claw/references/add-watch.md +56 -0
  75. package/skills/graphify/skills/claw/references/exports.md +71 -0
  76. package/skills/graphify/skills/claw/references/extraction-spec.md +29 -0
  77. package/skills/graphify/skills/claw/references/github-and-merge.md +46 -0
  78. package/skills/graphify/skills/claw/references/hooks.md +33 -0
  79. package/skills/graphify/skills/claw/references/query.md +249 -0
  80. package/skills/graphify/skills/claw/references/transcribe.md +48 -0
  81. package/skills/graphify/skills/claw/references/update.md +179 -0
  82. package/skills/graphify/skills/codex/references/add-watch.md +56 -0
  83. package/skills/graphify/skills/codex/references/exports.md +71 -0
  84. package/skills/graphify/skills/codex/references/extraction-spec.md +29 -0
  85. package/skills/graphify/skills/codex/references/github-and-merge.md +46 -0
  86. package/skills/graphify/skills/codex/references/hooks.md +33 -0
  87. package/skills/graphify/skills/codex/references/query.md +249 -0
  88. package/skills/graphify/skills/codex/references/transcribe.md +48 -0
  89. package/skills/graphify/skills/codex/references/update.md +179 -0
  90. package/skills/graphify/skills/copilot/references/add-watch.md +56 -0
  91. package/skills/graphify/skills/copilot/references/exports.md +71 -0
  92. package/skills/graphify/skills/copilot/references/extraction-spec.md +68 -0
  93. package/skills/graphify/skills/copilot/references/github-and-merge.md +46 -0
  94. package/skills/graphify/skills/copilot/references/hooks.md +33 -0
  95. package/skills/graphify/skills/copilot/references/query.md +249 -0
  96. package/skills/graphify/skills/copilot/references/transcribe.md +48 -0
  97. package/skills/graphify/skills/copilot/references/update.md +179 -0
  98. package/skills/graphify/skills/droid/references/add-watch.md +56 -0
  99. package/skills/graphify/skills/droid/references/exports.md +71 -0
  100. package/skills/graphify/skills/droid/references/extraction-spec.md +68 -0
  101. package/skills/graphify/skills/droid/references/github-and-merge.md +46 -0
  102. package/skills/graphify/skills/droid/references/hooks.md +33 -0
  103. package/skills/graphify/skills/droid/references/query.md +249 -0
  104. package/skills/graphify/skills/droid/references/transcribe.md +48 -0
  105. package/skills/graphify/skills/droid/references/update.md +179 -0
  106. package/skills/graphify/skills/kilo/references/add-watch.md +56 -0
  107. package/skills/graphify/skills/kilo/references/exports.md +71 -0
  108. package/skills/graphify/skills/kilo/references/extraction-spec.md +68 -0
  109. package/skills/graphify/skills/kilo/references/github-and-merge.md +46 -0
  110. package/skills/graphify/skills/kilo/references/hooks.md +33 -0
  111. package/skills/graphify/skills/kilo/references/query.md +249 -0
  112. package/skills/graphify/skills/kilo/references/transcribe.md +48 -0
  113. package/skills/graphify/skills/kilo/references/update.md +179 -0
  114. package/skills/graphify/skills/kiro/references/add-watch.md +56 -0
  115. package/skills/graphify/skills/kiro/references/exports.md +71 -0
  116. package/skills/graphify/skills/kiro/references/extraction-spec.md +29 -0
  117. package/skills/graphify/skills/kiro/references/github-and-merge.md +46 -0
  118. package/skills/graphify/skills/kiro/references/hooks.md +33 -0
  119. package/skills/graphify/skills/kiro/references/query.md +249 -0
  120. package/skills/graphify/skills/kiro/references/transcribe.md +48 -0
  121. package/skills/graphify/skills/kiro/references/update.md +179 -0
  122. package/skills/graphify/skills/opencode/references/add-watch.md +56 -0
  123. package/skills/graphify/skills/opencode/references/exports.md +71 -0
  124. package/skills/graphify/skills/opencode/references/extraction-spec.md +68 -0
  125. package/skills/graphify/skills/opencode/references/github-and-merge.md +46 -0
  126. package/skills/graphify/skills/opencode/references/hooks.md +33 -0
  127. package/skills/graphify/skills/opencode/references/query.md +249 -0
  128. package/skills/graphify/skills/opencode/references/transcribe.md +48 -0
  129. package/skills/graphify/skills/opencode/references/update.md +179 -0
  130. package/skills/graphify/skills/pi/references/add-watch.md +56 -0
  131. package/skills/graphify/skills/pi/references/exports.md +71 -0
  132. package/skills/graphify/skills/pi/references/extraction-spec.md +29 -0
  133. package/skills/graphify/skills/pi/references/github-and-merge.md +46 -0
  134. package/skills/graphify/skills/pi/references/hooks.md +33 -0
  135. package/skills/graphify/skills/pi/references/query.md +249 -0
  136. package/skills/graphify/skills/pi/references/transcribe.md +48 -0
  137. package/skills/graphify/skills/pi/references/update.md +179 -0
  138. package/skills/graphify/skills/trae/references/add-watch.md +56 -0
  139. package/skills/graphify/skills/trae/references/exports.md +71 -0
  140. package/skills/graphify/skills/trae/references/extraction-spec.md +68 -0
  141. package/skills/graphify/skills/trae/references/github-and-merge.md +46 -0
  142. package/skills/graphify/skills/trae/references/hooks.md +35 -0
  143. package/skills/graphify/skills/trae/references/query.md +249 -0
  144. package/skills/graphify/skills/trae/references/transcribe.md +48 -0
  145. package/skills/graphify/skills/trae/references/update.md +179 -0
  146. package/skills/graphify/skills/vscode/references/add-watch.md +56 -0
  147. package/skills/graphify/skills/vscode/references/exports.md +71 -0
  148. package/skills/graphify/skills/vscode/references/extraction-spec.md +68 -0
  149. package/skills/graphify/skills/vscode/references/github-and-merge.md +46 -0
  150. package/skills/graphify/skills/vscode/references/hooks.md +33 -0
  151. package/skills/graphify/skills/vscode/references/query.md +249 -0
  152. package/skills/graphify/skills/vscode/references/transcribe.md +48 -0
  153. package/skills/graphify/skills/vscode/references/update.md +179 -0
  154. package/skills/graphify/skills/windows/references/add-watch.md +56 -0
  155. package/skills/graphify/skills/windows/references/exports.md +71 -0
  156. package/skills/graphify/skills/windows/references/extraction-spec.md +68 -0
  157. package/skills/graphify/skills/windows/references/github-and-merge.md +46 -0
  158. package/skills/graphify/skills/windows/references/hooks.md +33 -0
  159. package/skills/graphify/skills/windows/references/query.md +249 -0
  160. package/skills/graphify/skills/windows/references/transcribe.md +48 -0
  161. package/skills/graphify/skills/windows/references/update.md +179 -0
  162. package/skills/graphify/symbol_resolution.py +538 -0
  163. package/skills/graphify/transcribe.py +184 -0
  164. package/skills/graphify/tree_html.py +582 -0
  165. package/skills/graphify/validate.py +72 -0
  166. package/skills/graphify/watch.py +898 -0
  167. package/skills/graphify/wiki.py +282 -0
  168. package/skills/impeccable/SKILL.md +186 -0
  169. package/skills/impeccable/agents/impeccable_asset_producer.toml +92 -0
  170. package/skills/impeccable/agents/impeccable_manual_edit_applier.toml +95 -0
  171. package/skills/impeccable/agents/openai.yaml +4 -0
  172. package/skills/impeccable/reference/adapt.md +311 -0
  173. package/skills/impeccable/reference/animate.md +201 -0
  174. package/skills/impeccable/reference/audit.md +133 -0
  175. package/skills/impeccable/reference/bolder.md +113 -0
  176. package/skills/impeccable/reference/brand.md +108 -0
  177. package/skills/impeccable/reference/clarify.md +288 -0
  178. package/skills/impeccable/reference/codex.md +105 -0
  179. package/skills/impeccable/reference/colorize.md +257 -0
  180. package/skills/impeccable/reference/craft.md +123 -0
  181. package/skills/impeccable/reference/critique.md +790 -0
  182. package/skills/impeccable/reference/delight.md +302 -0
  183. package/skills/impeccable/reference/distill.md +111 -0
  184. package/skills/impeccable/reference/document.md +429 -0
  185. package/skills/impeccable/reference/extract.md +69 -0
  186. package/skills/impeccable/reference/harden.md +347 -0
  187. package/skills/impeccable/reference/init.md +172 -0
  188. package/skills/impeccable/reference/interaction-design.md +189 -0
  189. package/skills/impeccable/reference/layout.md +161 -0
  190. package/skills/impeccable/reference/live.md +720 -0
  191. package/skills/impeccable/reference/onboard.md +234 -0
  192. package/skills/impeccable/reference/optimize.md +258 -0
  193. package/skills/impeccable/reference/overdrive.md +130 -0
  194. package/skills/impeccable/reference/polish.md +241 -0
  195. package/skills/impeccable/reference/product.md +60 -0
  196. package/skills/impeccable/reference/quieter.md +99 -0
  197. package/skills/impeccable/reference/shape.md +165 -0
  198. package/skills/impeccable/reference/typeset.md +279 -0
  199. package/skills/impeccable/scripts/cleanup-deprecated.mjs +284 -0
  200. package/skills/impeccable/scripts/command-metadata.json +94 -0
  201. package/skills/impeccable/scripts/context-signals.mjs +225 -0
  202. package/skills/impeccable/scripts/context.mjs +266 -0
  203. package/skills/impeccable/scripts/critique-storage.mjs +242 -0
  204. package/skills/impeccable/scripts/design-parser.mjs +835 -0
  205. package/skills/impeccable/scripts/detect-csp.mjs +198 -0
  206. package/skills/impeccable/scripts/detect.mjs +21 -0
  207. package/skills/impeccable/scripts/detector/browser/injected/index.mjs +1733 -0
  208. package/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
  209. package/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4618 -0
  210. package/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
  211. package/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
  212. package/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
  213. package/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
  214. package/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
  215. package/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  216. package/skills/impeccable/scripts/detector/findings.mjs +12 -0
  217. package/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
  218. package/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
  219. package/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
  220. package/skills/impeccable/scripts/detector/rules/checks.mjs +2384 -0
  221. package/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
  222. package/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
  223. package/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
  224. package/skills/impeccable/scripts/impeccable-paths.mjs +126 -0
  225. package/skills/impeccable/scripts/is-generated.mjs +69 -0
  226. package/skills/impeccable/scripts/live-accept.mjs +812 -0
  227. package/skills/impeccable/scripts/live-browser-session.js +123 -0
  228. package/skills/impeccable/scripts/live-browser.js +10295 -0
  229. package/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
  230. package/skills/impeccable/scripts/live-complete.mjs +75 -0
  231. package/skills/impeccable/scripts/live-completion.mjs +19 -0
  232. package/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
  233. package/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  234. package/skills/impeccable/scripts/live-event-validation.mjs +137 -0
  235. package/skills/impeccable/scripts/live-inject.mjs +557 -0
  236. package/skills/impeccable/scripts/live-insert-ui.mjs +458 -0
  237. package/skills/impeccable/scripts/live-insert.mjs +272 -0
  238. package/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
  239. package/skills/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
  240. package/skills/impeccable/scripts/live-poll.mjs +379 -0
  241. package/skills/impeccable/scripts/live-resume.mjs +94 -0
  242. package/skills/impeccable/scripts/live-server.mjs +2326 -0
  243. package/skills/impeccable/scripts/live-session-store.mjs +289 -0
  244. package/skills/impeccable/scripts/live-status.mjs +61 -0
  245. package/skills/impeccable/scripts/live-svelte-component.mjs +826 -0
  246. package/skills/impeccable/scripts/live-sveltekit-adapter.mjs +274 -0
  247. package/skills/impeccable/scripts/live-ui-core.mjs +179 -0
  248. package/skills/impeccable/scripts/live-vocabulary.mjs +36 -0
  249. package/skills/impeccable/scripts/live-wrap.mjs +894 -0
  250. package/skills/impeccable/scripts/live.mjs +246 -0
  251. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
  252. package/skills/impeccable/scripts/palette.mjs +633 -0
  253. package/skills/impeccable/scripts/pin.mjs +214 -0
  254. package/skills/uipm-ui-styling/LICENSE.txt +202 -0
  255. package/skills/uipm-ui-styling/SKILL.md +328 -0
  256. package/skills/uipm-ui-styling/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  257. package/skills/uipm-ui-styling/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  258. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  259. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-OFL.txt +93 -0
  260. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  261. package/skills/uipm-ui-styling/canvas-fonts/Boldonse-OFL.txt +93 -0
  262. package/skills/uipm-ui-styling/canvas-fonts/Boldonse-Regular.ttf +0 -0
  263. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  264. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  265. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  266. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  267. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  268. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  269. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  270. package/skills/uipm-ui-styling/canvas-fonts/DMMono-OFL.txt +93 -0
  271. package/skills/uipm-ui-styling/canvas-fonts/DMMono-Regular.ttf +0 -0
  272. package/skills/uipm-ui-styling/canvas-fonts/EricaOne-OFL.txt +94 -0
  273. package/skills/uipm-ui-styling/canvas-fonts/EricaOne-Regular.ttf +0 -0
  274. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-Bold.ttf +0 -0
  275. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-OFL.txt +93 -0
  276. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-Regular.ttf +0 -0
  277. package/skills/uipm-ui-styling/canvas-fonts/Gloock-OFL.txt +93 -0
  278. package/skills/uipm-ui-styling/canvas-fonts/Gloock-Regular.ttf +0 -0
  279. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  280. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  281. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  282. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  283. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  284. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  285. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  286. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  287. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  288. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  289. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  290. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  291. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  292. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  293. package/skills/uipm-ui-styling/canvas-fonts/Italiana-OFL.txt +93 -0
  294. package/skills/uipm-ui-styling/canvas-fonts/Italiana-Regular.ttf +0 -0
  295. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  296. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  297. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  298. package/skills/uipm-ui-styling/canvas-fonts/Jura-Light.ttf +0 -0
  299. package/skills/uipm-ui-styling/canvas-fonts/Jura-Medium.ttf +0 -0
  300. package/skills/uipm-ui-styling/canvas-fonts/Jura-OFL.txt +93 -0
  301. package/skills/uipm-ui-styling/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  302. package/skills/uipm-ui-styling/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  303. package/skills/uipm-ui-styling/canvas-fonts/Lora-Bold.ttf +0 -0
  304. package/skills/uipm-ui-styling/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  305. package/skills/uipm-ui-styling/canvas-fonts/Lora-Italic.ttf +0 -0
  306. package/skills/uipm-ui-styling/canvas-fonts/Lora-OFL.txt +93 -0
  307. package/skills/uipm-ui-styling/canvas-fonts/Lora-Regular.ttf +0 -0
  308. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-Bold.ttf +0 -0
  309. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-OFL.txt +93 -0
  310. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-Regular.ttf +0 -0
  311. package/skills/uipm-ui-styling/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  312. package/skills/uipm-ui-styling/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  313. package/skills/uipm-ui-styling/canvas-fonts/Outfit-Bold.ttf +0 -0
  314. package/skills/uipm-ui-styling/canvas-fonts/Outfit-OFL.txt +93 -0
  315. package/skills/uipm-ui-styling/canvas-fonts/Outfit-Regular.ttf +0 -0
  316. package/skills/uipm-ui-styling/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  317. package/skills/uipm-ui-styling/canvas-fonts/PixelifySans-OFL.txt +93 -0
  318. package/skills/uipm-ui-styling/canvas-fonts/PoiretOne-OFL.txt +93 -0
  319. package/skills/uipm-ui-styling/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  320. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  321. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-OFL.txt +93 -0
  322. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  323. package/skills/uipm-ui-styling/canvas-fonts/Silkscreen-OFL.txt +93 -0
  324. package/skills/uipm-ui-styling/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  325. package/skills/uipm-ui-styling/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  326. package/skills/uipm-ui-styling/canvas-fonts/SmoochSans-OFL.txt +93 -0
  327. package/skills/uipm-ui-styling/canvas-fonts/Tektur-Medium.ttf +0 -0
  328. package/skills/uipm-ui-styling/canvas-fonts/Tektur-OFL.txt +93 -0
  329. package/skills/uipm-ui-styling/canvas-fonts/Tektur-Regular.ttf +0 -0
  330. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Bold.ttf +0 -0
  331. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  332. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Italic.ttf +0 -0
  333. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-OFL.txt +93 -0
  334. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Regular.ttf +0 -0
  335. package/skills/uipm-ui-styling/canvas-fonts/YoungSerif-OFL.txt +93 -0
  336. package/skills/uipm-ui-styling/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  337. package/skills/uipm-ui-styling/references/canvas-design-system.md +320 -0
  338. package/skills/uipm-ui-styling/references/shadcn-accessibility.md +471 -0
  339. package/skills/uipm-ui-styling/references/shadcn-components.md +424 -0
  340. package/skills/uipm-ui-styling/references/shadcn-theming.md +373 -0
  341. package/skills/uipm-ui-styling/references/tailwind-customization.md +483 -0
  342. package/skills/uipm-ui-styling/references/tailwind-responsive.md +382 -0
  343. package/skills/uipm-ui-styling/references/tailwind-utilities.md +455 -0
  344. package/skills/uipm-ui-styling/scripts/.coverage +0 -0
  345. package/skills/uipm-ui-styling/scripts/requirements.txt +17 -0
  346. package/skills/uipm-ui-styling/scripts/shadcn_add.py +292 -0
  347. package/skills/uipm-ui-styling/scripts/tailwind_config_gen.py +456 -0
  348. package/skills/uipm-ui-styling/scripts/tests/coverage-ui.json +1 -0
  349. package/skills/uipm-ui-styling/scripts/tests/requirements.txt +3 -0
  350. package/skills/uipm-ui-styling/scripts/tests/test_shadcn_add.py +266 -0
  351. package/skills/uipm-ui-styling/scripts/tests/test_tailwind_config_gen.py +336 -0
@@ -0,0 +1,1372 @@
1
+ ---
2
+ name: graphify
3
+ description: "Use for any question about a codebase, its architecture, file relationships, or project content — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns any input (code, docs, papers, images, videos) into a persistent knowledge graph with god nodes, community detection, and query/path/explain tools."
4
+ argument-hint: "[path|query|subcommand]"
5
+ model: sonnet
6
+ allowed-tools:
7
+ - read
8
+ - grep
9
+ - glob
10
+ - exec
11
+ triggers:
12
+ - user
13
+ - model
14
+ ---
15
+
16
+ # /graphify
17
+
18
+ Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPH_REPORT.md.
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ /graphify # full pipeline on current directory
24
+ /graphify <path> # full pipeline on specific path
25
+ /graphify <path> --mode deep # thorough extraction, richer INFERRED edges
26
+ /graphify <path> --update # incremental - re-extract only new/changed files
27
+ /graphify <path> --cluster-only # rerun clustering on existing graph
28
+ /graphify <path> --no-viz # skip visualization, just report + JSON
29
+ /graphify <path> --html # (HTML is generated by default - this flag is a no-op)
30
+ /graphify <path> --svg # also export graph.svg (embeds in Notion, GitHub)
31
+ /graphify <path> --graphml # export graph.graphml (Gephi, yEd)
32
+ /graphify <path> --neo4j # generate graphify-out/cypher.txt for Neo4j
33
+ /graphify <path> --neo4j-push bolt://localhost:7687 # push directly to Neo4j
34
+ /graphify <path> --mcp # start MCP stdio server for agent access
35
+ /graphify <path> --watch # watch folder, auto-rebuild on code changes (no LLM needed)
36
+ /graphify <path> --wiki # build agent-crawlable wiki (index.md + one article per community)
37
+ /graphify add <url> # fetch URL, save to ./raw, update graph
38
+ /graphify add <url> --author "Name" # tag who wrote it
39
+ /graphify add <url> --contributor "Name" # tag who added it to the corpus
40
+ /graphify query "<question>" # BFS traversal - broad context
41
+ /graphify query "<question>" --dfs # DFS - trace a specific path
42
+ /graphify query "<question>" --budget 1500 # cap answer at N tokens
43
+ /graphify path "AuthModule" "Database" # shortest path between two concepts
44
+ /graphify explain "SwinTransformer" # plain-language explanation of a node
45
+ ```
46
+
47
+ ## What graphify is for
48
+
49
+ graphify is built around Andrej Karpathy's /raw folder workflow: drop anything into a folder - papers, tweets, screenshots, code, notes - and get a structured knowledge graph that shows you what you didn't know was connected.
50
+
51
+ Three things it does that your AI assistant alone cannot:
52
+ 1. **Persistent graph** - relationships are stored in `graphify-out/graph.json` and survive across sessions. Ask questions weeks later without re-reading everything.
53
+ 2. **Honest audit trail** - every edge is tagged EXTRACTED, INFERRED, or AMBIGUOUS. You know what was found vs invented.
54
+ 3. **Cross-document surprise** - community detection finds connections between concepts in different files that you would never think to ask about directly.
55
+
56
+ Use it for:
57
+ - A codebase you're new to (understand architecture before touching anything)
58
+ - A reading list (papers + tweets + notes -> one navigable graph)
59
+ - A research corpus (citation graph + concept graph in one)
60
+ - Your personal /raw folder (drop everything in, let it grow, query it)
61
+
62
+ ## What You Must Do When Invoked
63
+
64
+ If the user invoked `/graphify --help` or `/graphify -h` (with no other arguments), print the contents of the `## Usage` section above verbatim and stop. Do not run any commands, do not detect files, do not default the path to `.`. Just print the Usage block and return.
65
+
66
+ If no path was given, use `.` (current directory). Do not ask the user for a path.
67
+
68
+ Follow these steps in order. Do not skip steps.
69
+
70
+ ### Step 1 - Ensure graphify is installed
71
+
72
+ ```bash
73
+ # Detect the correct Python interpreter (handles uv tool, pipx, venv, system installs)
74
+ PYTHON=""
75
+ GRAPHIFY_BIN=$(which graphify 2>/dev/null)
76
+ # 1. uv tool installs — most reliable on modern Mac/Linux
77
+ if [ -z "$PYTHON" ] && command -v uv >/dev/null 2>&1; then
78
+ _UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
79
+ if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
80
+ fi
81
+ # 2. Read shebang from graphify binary (pipx and direct pip installs)
82
+ if [ -z "$PYTHON" ] && [ -n "$GRAPHIFY_BIN" ]; then
83
+ _SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
84
+ case "$_SHEBANG" in
85
+ *[!a-zA-Z0-9/_.-]*) ;;
86
+ *) "$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG" ;;
87
+ esac
88
+ fi
89
+ # 3. Fall back to python3
90
+ if [ -z "$PYTHON" ]; then PYTHON="python3"; fi
91
+ if ! "$PYTHON" -c "import graphify" 2>/dev/null; then
92
+ if command -v uv >/dev/null 2>&1; then
93
+ uv tool install --upgrade graphifyy -q 2>&1 | tail -3
94
+ _UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
95
+ if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
96
+ else
97
+ "$PYTHON" -m pip install graphifyy -q 2>/dev/null \
98
+ || "$PYTHON" -m pip install graphifyy -q --break-system-packages 2>&1 | tail -3
99
+ fi
100
+ fi
101
+ # Write interpreter path for all subsequent steps (persists across invocations)
102
+ mkdir -p graphify-out
103
+ "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
104
+ # Force UTF-8 I/O on Windows (prevents garbled CJK/non-ASCII output)
105
+ export PYTHONUTF8=1
106
+ ```
107
+
108
+ If the import succeeds, print nothing and move straight to Step 2.
109
+
110
+ **In every subsequent bash block, replace `python3` with `$(cat graphify-out/.graphify_python)` to use the correct interpreter.**
111
+
112
+ ### Step 2 - Detect files
113
+
114
+ ```bash
115
+ $(cat graphify-out/.graphify_python) -c "
116
+ import json
117
+ from graphify.detect import detect
118
+ from pathlib import Path
119
+ result = detect(Path('INPUT_PATH'))
120
+ print(json.dumps(result))
121
+ " > graphify-out/.graphify_detect.json
122
+ ```
123
+
124
+ Replace INPUT_PATH with the actual path the user provided. Do NOT cat or print the JSON - read it silently and present a clean summary instead:
125
+
126
+ ```
127
+ Corpus: X files · ~Y words
128
+ code: N files (.py .ts .go ...)
129
+ docs: N files (.md .txt ...)
130
+ papers: N files (.pdf ...)
131
+ images: N files
132
+ video: N files (.mp4 .mp3 ...)
133
+ ```
134
+
135
+ Omit any category with 0 files from the summary.
136
+
137
+ Then act on it:
138
+ - If `total_files` is 0: stop with "No supported files found in [path]."
139
+ - If `skipped_sensitive` is non-empty: mention file count skipped, not the file names.
140
+ - If `total_words` > 2,000,000 OR `total_files` > 200: show the warning and the top 5 subdirectories by file count, then ask which subfolder to run on. Wait for the user's answer before proceeding.
141
+ - Otherwise: proceed directly to Step 2.5 if video files were detected, or Step 3 if not.
142
+
143
+ ### Step 2.5 - Transcribe video / audio files (only if video files detected)
144
+
145
+ Skip this step entirely if `detect` returned zero `video` files.
146
+
147
+ Video and audio files cannot be read directly. Transcribe them to text first, then treat the transcripts as doc files in Step 3.
148
+
149
+ **Strategy:** Read the god nodes from the detect output or analysis file. You are already a language model - write a one-sentence domain hint yourself from those labels. Then pass it to Whisper as the initial prompt. No separate API call needed.
150
+
151
+ **However**, if the corpus has *only* video files and no other docs/code, use the generic fallback prompt: `"Use proper punctuation and paragraph breaks."`
152
+
153
+ **Step 1 - Write the Whisper prompt yourself.**
154
+
155
+ Read the top god node labels from detect output or analysis, then compose a short domain hint sentence, for example:
156
+
157
+ - Labels: `transformer, attention, encoder, decoder` -> `"Machine learning research on transformer architectures and attention mechanisms. Use proper punctuation and paragraph breaks."`
158
+ - Labels: `kubernetes, deployment, pod, helm` -> `"DevOps discussion about Kubernetes deployments and Helm charts. Use proper punctuation and paragraph breaks."`
159
+
160
+ Set it as `GRAPHIFY_WHISPER_PROMPT` in the environment before running the transcription command.
161
+
162
+ **Step 2 - Transcribe:**
163
+
164
+ ```bash
165
+ $(cat graphify-out/.graphify_python) -c "
166
+ import json, os
167
+ from pathlib import Path
168
+ from graphify.transcribe import transcribe_all
169
+
170
+ detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
171
+ video_files = detect.get('files', {}).get('video', [])
172
+ prompt = os.environ.get('GRAPHIFY_WHISPER_PROMPT', 'Use proper punctuation and paragraph breaks.')
173
+
174
+ transcript_paths = transcribe_all(video_files, initial_prompt=prompt)
175
+ print(json.dumps(transcript_paths))
176
+ " > graphify-out/.graphify_transcripts.json
177
+ ```
178
+
179
+ After transcription:
180
+ - Read the transcript paths from `graphify-out/.graphify_transcripts.json`
181
+ - Add them to the docs list before dispatching semantic subagents in Step 3B
182
+ - Print how many transcripts were created: `Transcribed N video file(s) -> treating as docs`
183
+ - If transcription fails for a file, print a warning and continue with the rest
184
+
185
+ **Whisper model:** Default is `base`. If the user passed `--whisper-model <name>`, set `GRAPHIFY_WHISPER_MODEL=<name>` in the environment before running the command above.
186
+
187
+ ### Step 3 - Extract entities and relationships
188
+
189
+ **Before starting:** note whether `--mode deep` was given. You must pass `DEEP_MODE=true` to every subagent in Step B2 if it was. Track this from the original invocation - do not lose it.
190
+
191
+ This step has two parts: **structural extraction** (deterministic, free) and **semantic extraction** (your AI model, costs tokens).
192
+
193
+ **Run Part A (AST) and Part B (semantic) in parallel. Dispatch all semantic subagents AND start AST extraction in the same message. Both can run simultaneously since they operate on different file types. Merge results in Part C as before.**
194
+
195
+ Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is deterministic and fast; start it while subagents are processing docs/papers.
196
+
197
+ #### Part A - Structural extraction for code files
198
+
199
+ For any code files detected, run AST extraction in parallel with Part B subagents:
200
+
201
+ ```bash
202
+ $(cat graphify-out/.graphify_python) -c "
203
+ import sys, json
204
+ from graphify.extract import collect_files, extract
205
+ from pathlib import Path
206
+ import json
207
+
208
+ code_files = []
209
+ detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
210
+ for f in detect.get('files', {}).get('code', []):
211
+ code_files.extend(collect_files(Path(f)) if Path(f).is_dir() else [Path(f)])
212
+
213
+ if code_files:
214
+ result = extract(code_files)
215
+ Path('graphify-out/.graphify_ast.json').write_text(json.dumps(result, indent=2))
216
+ print(f'AST: {len(result[\"nodes\"])} nodes, {len(result[\"edges\"])} edges')
217
+ else:
218
+ Path('graphify-out/.graphify_ast.json').write_text(json.dumps({'nodes':[],'edges':[],'input_tokens':0,'output_tokens':0}))
219
+ print('No code files - skipping AST extraction')
220
+ "
221
+ ```
222
+
223
+ #### Part B - Semantic extraction (parallel subagents)
224
+
225
+ **Fast path:** If detection found zero docs, papers, and images (code-only corpus), skip Part B entirely and go straight to Part C. AST handles code - there is nothing for semantic subagents to do.
226
+
227
+ Before dispatching subagents, print a timing estimate:
228
+ - Load `total_words` and file counts from `graphify-out/.graphify_detect.json`
229
+ - Estimate agents needed: `ceil(uncached_non_code_files / 22)` (chunk size is 20-25)
230
+ - Estimate time: ~45s per agent batch (they run in parallel, so total ≈ 45s × ceil(agents/parallel_limit))
231
+ - Print: "Semantic extraction: ~N files → X agents, estimated ~Ys"
232
+
233
+ **MANDATORY: You MUST use the subagent system here. Reading files yourself one-by-one is forbidden - it is 5-10x slower. If you do not use parallel subagents you are doing this wrong.**
234
+
235
+ **Step B0 - Check extraction cache first**
236
+
237
+ Before dispatching any subagents, check which files already have cached extraction results:
238
+
239
+ ```bash
240
+ $(cat graphify-out/.graphify_python) -c "
241
+ import json
242
+ from graphify.cache import check_semantic_cache
243
+ from pathlib import Path
244
+
245
+ detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
246
+ all_files = [f for files in detect['files'].values() for f in files]
247
+
248
+ cached_nodes, cached_edges, cached_hyperedges, uncached = check_semantic_cache(all_files)
249
+
250
+ if cached_nodes or cached_edges or cached_hyperedges:
251
+ Path('graphify-out/.graphify_cached.json').write_text(json.dumps({'nodes': cached_nodes, 'edges': cached_edges, 'hyperedges': cached_hyperedges}))
252
+ Path('graphify-out/.graphify_uncached.txt').write_text('\n'.join(uncached))
253
+ print(f'Cache: {len(all_files)-len(uncached)} files hit, {len(uncached)} files need extraction')
254
+ "
255
+ ```
256
+
257
+ Only dispatch subagents for files listed in `graphify-out/.graphify_uncached.txt`. If all files are cached, skip to Part C directly.
258
+
259
+ **Step B1 - Split into chunks**
260
+
261
+ Load files from `graphify-out/.graphify_uncached.txt`. Split into chunks of 20-25 files each. Each image gets its own chunk (vision needs separate context). When splitting, group files from the same directory together so related artifacts land in the same chunk and cross-file relationships are more likely to be extracted.
262
+
263
+ **Step B2 - Dispatch subagents**
264
+
265
+ Dispatch ALL subagents in the same response so they run in parallel.
266
+
267
+ Concrete example for 3 chunks:
268
+ ```
269
+ [Subagent 1: files 1-15]
270
+ [Subagent 2: files 16-30]
271
+ [Subagent 3: files 31-45]
272
+ ```
273
+ All three in one message. Not three separate messages.
274
+
275
+ For each chunk, dispatch a subagent with this exact prompt (fill in FILE_LIST):
276
+
277
+ ```
278
+ You are a graphify extraction subagent. Read the files listed and extract a knowledge graph fragment.
279
+ Output ONLY valid JSON with no commentary: {"nodes": [...], "edges": [...], "hyperedges": [...], "input_tokens": 0, "output_tokens": 0}
280
+
281
+ Extraction rules:
282
+ - EXTRACTED: relationship explicit in source (import, call, citation)
283
+ - INFERRED: reasonable inference (shared structure, implied dependency)
284
+ - AMBIGUOUS: uncertain — flag it, do not omit
285
+ - Code files: extract semantic edges AST cannot find (design patterns, protocol conformance). Do not re-extract imports.
286
+ - Doc/paper files: named concepts, entities, citations. Store rationale (WHY decisions were made) as a `rationale` attribute on the relevant node. Use `file_type:"rationale"` for concept-like nodes (ideas, principles, mechanisms) and `file_type:"concept"` for named concepts. `file_type` MUST be one of exactly these six values: `code`, `document`, `paper`, `image`, `rationale`, `concept`. When adding `calls` edges: source is caller, target is callee.
287
+ - Image files: use vision to understand what the image IS - do not just OCR.
288
+ UI screenshot: layout patterns, design decisions, key elements, purpose.
289
+ Chart: metric, trend/insight, data source.
290
+ Tweet/post: claim as node, author, concepts mentioned.
291
+ Diagram: components and connections.
292
+ Research figure: what it demonstrates, method, result.
293
+ Handwritten/whiteboard: ideas and arrows, mark uncertain readings AMBIGUOUS.
294
+ - DEEP_MODE (if set): be aggressive with INFERRED edges
295
+ - Semantic similarity: if two concepts solve the same problem without a structural link, add `semantically_similar_to` INFERRED edge (confidence 0.6-0.95). Non-obvious cross-file links only.
296
+ - Hyperedges: if 3+ nodes share a concept/flow not captured by pairwise edges, add a hyperedge. Max 3 per file.
297
+ - If a file has YAML frontmatter (--- ... ---), copy source_url, captured_at, author,
298
+ contributor onto every node from that file.
299
+ - confidence_score is REQUIRED on every edge - never omit it, never use 0.5 as a default:
300
+ - EXTRACTED edges: confidence_score = 1.0 always
301
+ - INFERRED edges: pick exactly ONE value from this set — never 0.5:
302
+ 0.95 direct structural evidence (shared data structure, named cross-file reference).
303
+ 0.85 strong inference (clear functional alignment, no direct symbol link).
304
+ 0.75 reasonable inference (shared problem domain + similar shape, requires interpretation).
305
+ 0.65 weak inference (thematically related, no shape evidence).
306
+ 0.55 speculative but plausible (surface-level co-occurrence only).
307
+ Models follow discrete rubrics better than continuous ranges; the bimodal
308
+ distribution observed in production (>50% at 0.5, >40% at 0.85+) shows the
309
+ range guidance is being collapsed to a binary. If no value above fits, mark
310
+ the edge AMBIGUOUS rather than picking 0.4 or below.
311
+ - AMBIGUOUS edges: 0.1-0.3
312
+
313
+ Schema:
314
+ {"nodes":[{"id":"filestem_entityname","label":"Human Readable Name","file_type":"code|document|paper|image|rationale|concept","source_file":"relative/path","source_location":null,"source_url":null,"captured_at":null,"author":null,"contributor":null}],"edges":[{"source":"node_id","target":"node_id","relation":"calls|implements|references|cites|conceptually_related_to|shares_data_with|semantically_similar_to|rationale_for","confidence":"EXTRACTED|INFERRED|AMBIGUOUS","confidence_score":1.0,"source_file":"relative/path","source_location":null,"weight":1.0}],"hyperedges":[{"id":"snake_case_id","label":"Human Readable Label","nodes":["node_id1","node_id2","node_id3"],"relation":"participate_in|implement|form","confidence":"EXTRACTED|INFERRED","confidence_score":0.75,"source_file":"relative/path"}],"input_tokens":0,"output_tokens":0}
315
+
316
+ Files:
317
+ FILE_LIST
318
+ ```
319
+
320
+ **Step B3 - Cache and merge**
321
+
322
+ Wait for all subagents. For each result:
323
+ - Check that `graphify-out/.graphify_chunk_N.json` exists on disk — this is the success signal
324
+ - If the file exists and contains valid JSON with `nodes` and `edges`, include it and save to cache
325
+ - If the file is missing, the subagent was likely dispatched as read-only — print a warning: "chunk N missing from disk — subagent may have been read-only. Re-run with general-purpose agent." Do not silently skip.
326
+ - If a subagent failed or returned invalid JSON, print a warning and skip that chunk - do not abort
327
+
328
+ If more than half the chunks failed or are missing, stop and tell the user to re-run and ensure `subagent_type="general-purpose"` is used.
329
+
330
+ After each subagent call completes, write its result to `graphify-out/.graphify_chunk_N.json`. **After each subagent call completes, read the real token counts from the subagent tool result's `usage` field and write them back into the chunk JSON before merging** — the chunk JSON itself always has placeholder zeros. Then merge:
331
+
332
+ ```bash
333
+ $(cat graphify-out/.graphify_python) -c "
334
+ import json, glob
335
+ from pathlib import Path
336
+ from graphify.semantic_cleanup import load_validated_semantic_fragment, sanitize_semantic_fragment
337
+
338
+ chunks = sorted(glob.glob('graphify-out/.graphify_chunk_*.json'))
339
+ all_nodes, all_edges, all_hyperedges = [], [], []
340
+ total_in, total_out = 0, 0
341
+ for c in chunks:
342
+ d, errors = load_validated_semantic_fragment(Path(c))
343
+ if errors:
344
+ print(f'Skipping invalid chunk {c}: ' + '; '.join(errors[:3]))
345
+ continue
346
+ d = sanitize_semantic_fragment(d)
347
+ all_nodes += d.get('nodes', [])
348
+ all_edges += d.get('edges', [])
349
+ all_hyperedges += d.get('hyperedges', [])
350
+ total_in += d.get('input_tokens', 0)
351
+ total_out += d.get('output_tokens', 0)
352
+ Path('graphify-out/.graphify_semantic_new.json').write_text(json.dumps({
353
+ 'nodes': all_nodes, 'edges': all_edges, 'hyperedges': all_hyperedges,
354
+ 'input_tokens': total_in, 'output_tokens': total_out,
355
+ }, indent=2))
356
+ print(f'Merged {len(chunks)} chunks: {total_in:,} in / {total_out:,} out tokens')
357
+ "
358
+ ```
359
+
360
+ Save new results to cache:
361
+ ```bash
362
+ $(cat graphify-out/.graphify_python) -c "
363
+ import json
364
+ from graphify.cache import save_semantic_cache
365
+ from pathlib import Path
366
+
367
+ new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text()) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
368
+ saved = save_semantic_cache(new.get('nodes', []), new.get('edges', []), new.get('hyperedges', []))
369
+ print(f'Cached {saved} files')
370
+ "
371
+ ```
372
+
373
+ Merge cached + new results into `graphify-out/.graphify_semantic.json`:
374
+ ```bash
375
+ $(cat graphify-out/.graphify_python) -c "
376
+ import json
377
+ from pathlib import Path
378
+ from graphify.semantic_cleanup import sanitize_semantic_fragment
379
+
380
+ cached = json.loads(Path('graphify-out/.graphify_cached.json').read_text()) if Path('graphify-out/.graphify_cached.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
381
+ new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text()) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
382
+
383
+ all_nodes = cached['nodes'] + new.get('nodes', [])
384
+ all_edges = cached['edges'] + new.get('edges', [])
385
+ all_hyperedges = cached.get('hyperedges', []) + new.get('hyperedges', [])
386
+ seen = set()
387
+ deduped = []
388
+ for n in all_nodes:
389
+ if n['id'] not in seen:
390
+ seen.add(n['id'])
391
+ deduped.append(n)
392
+
393
+ merged = {
394
+ 'nodes': deduped,
395
+ 'edges': all_edges,
396
+ 'hyperedges': all_hyperedges,
397
+ 'input_tokens': new.get('input_tokens', 0),
398
+ 'output_tokens': new.get('output_tokens', 0),
399
+ }
400
+ merged = sanitize_semantic_fragment(merged)
401
+ Path('graphify-out/.graphify_semantic.json').write_text(json.dumps(merged, indent=2))
402
+ print(f'Extraction complete - {len(deduped)} nodes, {len(all_edges)} edges ({len(cached[\"nodes\"])} from cache, {len(new.get(\"nodes\",[]))} new)')
403
+ "
404
+ ```
405
+ Clean up temp files: `rm -f graphify-out/.graphify_cached.json graphify-out/.graphify_uncached.txt graphify-out/.graphify_semantic_new.json`
406
+
407
+ #### Part C - Merge AST + semantic into final extraction
408
+
409
+ ```bash
410
+ $(cat graphify-out/.graphify_python) -c "
411
+ import sys, json
412
+ from pathlib import Path
413
+ from graphify.semantic_cleanup import sanitize_semantic_fragment
414
+
415
+ ast = json.loads(Path('graphify-out/.graphify_ast.json').read_text())
416
+ sem = json.loads(Path('graphify-out/.graphify_semantic.json').read_text())
417
+
418
+ # Merge: AST nodes first, semantic nodes deduplicated by id
419
+ seen = {n['id'] for n in ast['nodes']}
420
+ merged_nodes = list(ast['nodes'])
421
+ for n in sem['nodes']:
422
+ if n['id'] not in seen:
423
+ merged_nodes.append(n)
424
+ seen.add(n['id'])
425
+
426
+ merged_edges = ast['edges'] + sem['edges']
427
+ merged_hyperedges = sem.get('hyperedges', [])
428
+ merged = {
429
+ 'nodes': merged_nodes,
430
+ 'edges': merged_edges,
431
+ 'hyperedges': merged_hyperedges,
432
+ 'input_tokens': sem.get('input_tokens', 0),
433
+ 'output_tokens': sem.get('output_tokens', 0),
434
+ }
435
+ merged = sanitize_semantic_fragment(merged)
436
+ Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged, indent=2))
437
+ total = len(merged_nodes)
438
+ edges = len(merged_edges)
439
+ print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(sem[\"nodes\"])} semantic)')
440
+ "
441
+ ```
442
+
443
+ ### Step 4 - Build graph, cluster, analyze, generate outputs
444
+
445
+ ```bash
446
+ mkdir -p graphify-out
447
+ $(cat graphify-out/.graphify_python) -c "
448
+ import sys, json
449
+ from graphify.build import build_from_json
450
+ from graphify.cluster import cluster, score_all
451
+ from graphify.analyze import god_nodes, surprising_connections, suggest_questions
452
+ from graphify.report import generate
453
+ from graphify.export import to_json
454
+ from pathlib import Path
455
+
456
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
457
+ detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
458
+
459
+ G = build_from_json(extraction)
460
+ communities = cluster(G)
461
+ cohesion = score_all(G, communities)
462
+ tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
463
+ gods = god_nodes(G)
464
+ surprises = surprising_connections(G, communities)
465
+ labels = {cid: 'Community ' + str(cid) for cid in communities}
466
+ # Placeholder questions - regenerated with real labels in Step 5
467
+ questions = suggest_questions(G, communities, labels)
468
+
469
+ report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)
470
+ Path('graphify-out/GRAPH_REPORT.md').write_text(report)
471
+ to_json(G, communities, 'graphify-out/graph.json')
472
+
473
+ analysis = {
474
+ 'communities': {str(k): v for k, v in communities.items()},
475
+ 'cohesion': {str(k): v for k, v in cohesion.items()},
476
+ 'gods': gods,
477
+ 'surprises': surprises,
478
+ 'questions': questions,
479
+ }
480
+ Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2))
481
+ if G.number_of_nodes() == 0:
482
+ print('ERROR: Graph is empty - extraction produced no nodes.')
483
+ print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')
484
+ raise SystemExit(1)
485
+ print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities')
486
+ "
487
+ ```
488
+
489
+ If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization.
490
+
491
+ Replace INPUT_PATH with the actual path.
492
+
493
+ ### Step 5 - Label communities
494
+
495
+ Read `graphify-out/.graphify_analysis.json`. For each community key, look at its node labels and write a 2-5 word plain-language name (e.g. "Attention Mechanism", "Training Pipeline", "Data Loading").
496
+
497
+ Then regenerate the report and save the labels for the visualizer:
498
+
499
+ ```bash
500
+ $(cat graphify-out/.graphify_python) -c "
501
+ import sys, json
502
+ from graphify.build import build_from_json
503
+ from graphify.cluster import score_all
504
+ from graphify.analyze import god_nodes, surprising_connections, suggest_questions
505
+ from graphify.report import generate
506
+ from pathlib import Path
507
+
508
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
509
+ detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
510
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
511
+
512
+ G = build_from_json(extraction)
513
+ communities = {int(k): v for k, v in analysis['communities'].items()}
514
+ cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
515
+ tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
516
+
517
+ # LABELS - replace these with the names you chose above
518
+ labels = LABELS_DICT
519
+
520
+ # Regenerate questions with real community labels (labels affect question phrasing)
521
+ questions = suggest_questions(G, communities, labels)
522
+
523
+ report = generate(G, communities, cohesion, labels, analysis['gods'], analysis['surprises'], detection, tokens, 'INPUT_PATH', suggested_questions=questions)
524
+ Path('graphify-out/GRAPH_REPORT.md').write_text(report)
525
+ Path('graphify-out/.graphify_labels.json').write_text(json.dumps({str(k): v for k, v in labels.items()}))
526
+ print('Report updated with community labels')
527
+ "
528
+ ```
529
+
530
+ Replace `LABELS_DICT` with the actual dict you constructed (e.g. `{0: "Attention Mechanism", 1: "Training Pipeline"}`).
531
+ Replace INPUT_PATH with the actual path.
532
+
533
+ ### Step 6 - Generate Obsidian vault (opt-in) + HTML
534
+
535
+ **Generate HTML always** (unless `--no-viz`). **Obsidian vault only if `--obsidian` was explicitly given** — skip it otherwise, it generates one file per node.
536
+
537
+ If `--obsidian` was given:
538
+
539
+ ```bash
540
+ $(cat graphify-out/.graphify_python) -c "
541
+ import sys, json
542
+ from graphify.build import build_from_json
543
+ from graphify.export import to_obsidian, to_canvas
544
+ from pathlib import Path
545
+
546
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
547
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
548
+ labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}
549
+
550
+ G = build_from_json(extraction)
551
+ communities = {int(k): v for k, v in analysis['communities'].items()}
552
+ cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
553
+ labels = {int(k): v for k, v in labels_raw.items()}
554
+
555
+ n = to_obsidian(G, communities, 'graphify-out/obsidian', community_labels=labels or None, cohesion=cohesion)
556
+ print(f'Obsidian vault: {n} notes in graphify-out/obsidian/')
557
+
558
+ to_canvas(G, communities, 'graphify-out/obsidian/graph.canvas', community_labels=labels or None)
559
+ print('Canvas: graphify-out/obsidian/graph.canvas - open in Obsidian for structured community layout')
560
+ print()
561
+ print('Open graphify-out/obsidian/ as a vault in Obsidian.')
562
+ print(' Graph view - nodes colored by community (set automatically)')
563
+ print(' graph.canvas - structured layout with communities as groups')
564
+ print(' _COMMUNITY_* - overview notes with cohesion scores and dataview queries')
565
+ "
566
+ ```
567
+
568
+ Generate the HTML graph (always, unless `--no-viz`):
569
+
570
+ ```bash
571
+ $(cat graphify-out/.graphify_python) -c "
572
+ import sys, json
573
+ from graphify.build import build_from_json
574
+ from graphify.export import to_html
575
+ from pathlib import Path
576
+
577
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
578
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
579
+ labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}
580
+
581
+ G = build_from_json(extraction)
582
+ communities = {int(k): v for k, v in analysis['communities'].items()}
583
+ labels = {int(k): v for k, v in labels_raw.items()}
584
+
585
+ NODE_LIMIT = 5000
586
+ if G.number_of_nodes() > NODE_LIMIT:
587
+ from collections import Counter
588
+ print(f'Graph has {G.number_of_nodes()} nodes (above {NODE_LIMIT} limit). Building aggregated community view...')
589
+ node_to_community = {nid: cid for cid, members in communities.items() for nid in members}
590
+ import networkx as nx_meta
591
+ meta = nx_meta.Graph()
592
+ for cid, members in communities.items():
593
+ meta.add_node(str(cid), label=labels.get(cid, f'Community {cid}'))
594
+ edge_counts = Counter()
595
+ for u, v in G.edges():
596
+ cu, cv = node_to_community.get(u), node_to_community.get(v)
597
+ if cu is not None and cv is not None and cu != cv:
598
+ edge_counts[(min(cu, cv), max(cu, cv))] += 1
599
+ for (cu, cv), w in edge_counts.items():
600
+ meta.add_edge(str(cu), str(cv), weight=w, relation=f'{w} cross-community edges', confidence='AGGREGATED')
601
+ if meta.number_of_nodes() > 1:
602
+ meta_communities = {cid: [str(cid)] for cid in communities}
603
+ member_counts = {cid: len(members) for cid, members in communities.items()}
604
+ to_html(meta, meta_communities, 'graphify-out/graph.html', community_labels=labels or None, member_counts=member_counts)
605
+ print(f'graph.html written (aggregated: {meta.number_of_nodes()} community nodes, {meta.number_of_edges()} cross-community edges)')
606
+ print('Tip: run with --obsidian for full node-level detail, or --wiki for an agent-crawlable wiki.')
607
+ else:
608
+ print('Single community — aggregated view not useful. Skipping graph.html.')
609
+ else:
610
+ to_html(G, communities, 'graphify-out/graph.html', community_labels=labels or None)
611
+ print('graph.html written - open in any browser, no server needed')
612
+ "
613
+ ```
614
+
615
+ ### Step 6b - Wiki (only if --wiki flag)
616
+
617
+ **Only run this step if `--wiki` was explicitly given in the original command.**
618
+
619
+ The wiki is an agent-crawlable export — `index.md` plus one article per community plus god-node articles. It is the recommended fallback for graphs too large to render as HTML, and it's the most useful output for an autonomous agent navigating the graph between sessions.
620
+
621
+ Run this before Step 9 (cleanup) so `graphify-out/.graphify_labels.json` is still available.
622
+
623
+ ```bash
624
+ $(cat graphify-out/.graphify_python) -c "
625
+ import json
626
+ from graphify.build import build_from_json
627
+ from graphify.wiki import to_wiki
628
+ from graphify.analyze import god_nodes
629
+ from pathlib import Path
630
+
631
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
632
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
633
+ labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}
634
+
635
+ G = build_from_json(extraction)
636
+ communities = {int(k): v for k, v in analysis['communities'].items()}
637
+ cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
638
+ labels = {int(k): v for k, v in labels_raw.items()}
639
+ gods = god_nodes(G)
640
+
641
+ n = to_wiki(G, communities, 'graphify-out/wiki', community_labels=labels or None, cohesion=cohesion, god_nodes_data=gods)
642
+ print(f'Wiki: {n} articles written to graphify-out/wiki/')
643
+ print(' graphify-out/wiki/index.md -> agent entry point')
644
+ "
645
+ ```
646
+
647
+ ### Step 7 - Neo4j export (only if --neo4j or --neo4j-push flag)
648
+
649
+ **If `--neo4j`** - generate a Cypher file for manual import:
650
+
651
+ ```bash
652
+ $(cat graphify-out/.graphify_python) -c "
653
+ import sys, json
654
+ from graphify.build import build_from_json
655
+ from graphify.export import to_cypher
656
+ from pathlib import Path
657
+
658
+ G = build_from_json(json.loads(Path('graphify-out/.graphify_extract.json').read_text()))
659
+ to_cypher(G, 'graphify-out/cypher.txt')
660
+ print('cypher.txt written - import with: cypher-shell < graphify-out/cypher.txt')
661
+ "
662
+ ```
663
+
664
+ **If `--neo4j-push <uri>`** - push directly to a running Neo4j instance. Ask the user for credentials if not provided:
665
+
666
+ ```bash
667
+ $(cat graphify-out/.graphify_python) -c "
668
+ import sys, json
669
+ from graphify.build import build_from_json
670
+ from graphify.export import push_to_neo4j
671
+ from pathlib import Path
672
+
673
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
674
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
675
+ G = build_from_json(extraction)
676
+ communities = {int(k): v for k, v in analysis['communities'].items()}
677
+
678
+ result = push_to_neo4j(G, uri='NEO4J_URI', user='NEO4J_USER', password='NEO4J_PASSWORD', communities=communities)
679
+ print(f'Pushed to Neo4j: {result[\"nodes\"]} nodes, {result[\"edges\"]} edges')
680
+ "
681
+ ```
682
+
683
+ Replace `NEO4J_URI`, `NEO4J_USER`, `NEO4J_PASSWORD` with actual values. Default URI is `bolt://localhost:7687`, default user is `neo4j`. Uses MERGE - safe to re-run without creating duplicates.
684
+
685
+ ### Step 7b - SVG export (only if --svg flag)
686
+
687
+ ```bash
688
+ $(cat graphify-out/.graphify_python) -c "
689
+ import sys, json
690
+ from graphify.build import build_from_json
691
+ from graphify.export import to_svg
692
+ from pathlib import Path
693
+
694
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
695
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
696
+ labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}
697
+
698
+ G = build_from_json(extraction)
699
+ communities = {int(k): v for k, v in analysis['communities'].items()}
700
+ labels = {int(k): v for k, v in labels_raw.items()}
701
+
702
+ to_svg(G, communities, 'graphify-out/graph.svg', community_labels=labels or None)
703
+ print('graph.svg written - embeds in Obsidian, Notion, GitHub READMEs')
704
+ "
705
+ ```
706
+
707
+ ### Step 7c - GraphML export (only if --graphml flag)
708
+
709
+ ```bash
710
+ $(cat graphify-out/.graphify_python) -c "
711
+ import json
712
+ from graphify.build import build_from_json
713
+ from graphify.export import to_graphml
714
+ from pathlib import Path
715
+
716
+ extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
717
+ analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
718
+
719
+ G = build_from_json(extraction)
720
+ communities = {int(k): v for k, v in analysis['communities'].items()}
721
+
722
+ to_graphml(G, communities, 'graphify-out/graph.graphml')
723
+ print('graph.graphml written - open in Gephi, yEd, or any GraphML tool')
724
+ "
725
+ ```
726
+
727
+ ### Step 7d - MCP server (only if --mcp flag)
728
+
729
+ ```bash
730
+ python3 -m graphify.serve graphify-out/graph.json
731
+ ```
732
+
733
+ This starts a stdio MCP server that exposes tools: `query_graph`, `get_node`, `get_neighbors`, `get_community`, `god_nodes`, `graph_stats`, `shortest_path`. Add to Claude Desktop or any MCP-compatible agent orchestrator so other agents can query the graph live.
734
+
735
+ To configure in Claude Desktop, add to `claude_desktop_config.json`:
736
+ ```json
737
+ {
738
+ "mcpServers": {
739
+ "graphify": {
740
+ "command": "python3",
741
+ "args": ["-m", "graphify.serve", "/absolute/path/to/graphify-out/graph.json"]
742
+ }
743
+ }
744
+ }
745
+ ```
746
+
747
+ ### Step 8 - Token reduction benchmark (only if total_words > 5000)
748
+
749
+ If `total_words` from `graphify-out/.graphify_detect.json` is greater than 5,000, run:
750
+
751
+ ```bash
752
+ $(cat graphify-out/.graphify_python) -c "
753
+ import json
754
+ from graphify.benchmark import run_benchmark, print_benchmark
755
+ from pathlib import Path
756
+
757
+ detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
758
+ result = run_benchmark('graphify-out/graph.json', corpus_words=detection['total_words'])
759
+ print_benchmark(result)
760
+ "
761
+ ```
762
+
763
+ Print the output directly in chat. If `total_words <= 5000`, skip silently - the graph value is structural clarity, not token compression, for small corpora.
764
+
765
+ ---
766
+
767
+ ### Step 9 - Save manifest, update cost tracker, clean up, and report
768
+
769
+ ```bash
770
+ $(cat graphify-out/.graphify_python) -c "
771
+ import json
772
+ from pathlib import Path
773
+ from datetime import datetime, timezone
774
+ from graphify.detect import save_manifest
775
+
776
+ # Save manifest for --update
777
+ detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text())
778
+ save_manifest(detect['files'])
779
+
780
+ # Update cumulative cost tracker
781
+ extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
782
+ input_tok = extract.get('input_tokens', 0)
783
+ output_tok = extract.get('output_tokens', 0)
784
+
785
+ cost_path = Path('graphify-out/cost.json')
786
+ if cost_path.exists():
787
+ cost = json.loads(cost_path.read_text())
788
+ else:
789
+ cost = {'runs': [], 'total_input_tokens': 0, 'total_output_tokens': 0}
790
+
791
+ cost['runs'].append({
792
+ 'date': datetime.now(timezone.utc).isoformat(),
793
+ 'input_tokens': input_tok,
794
+ 'output_tokens': output_tok,
795
+ 'files': detect.get('total_files', 0),
796
+ })
797
+ cost['total_input_tokens'] += input_tok
798
+ cost['total_output_tokens'] += output_tok
799
+ cost_path.write_text(json.dumps(cost, indent=2))
800
+
801
+ print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
802
+ print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
803
+ "
804
+ rm -f graphify-out/.graphify_detect.json graphify-out/.graphify_extract.json graphify-out/.graphify_ast.json graphify-out/.graphify_semantic.json graphify-out/.graphify_analysis.json graphify-out/.graphify_labels.json graphify-out/.graphify_incremental.json graphify-out/.graphify_transcripts.json graphify-out/.graphify_old.json; find graphify-out -maxdepth 1 -name '.graphify_chunk_*.json' -delete 2>/dev/null
805
+ rm -f graphify-out/.needs_update 2>/dev/null || true
806
+ ```
807
+
808
+ Tell the user (omit the obsidian line unless --obsidian was given; omit the wiki line unless --wiki was given):
809
+ ```
810
+ Graph complete. Outputs in PATH_TO_DIR/graphify-out/
811
+
812
+ graph.html - interactive graph, open in browser
813
+ GRAPH_REPORT.md - audit report
814
+ graph.json - raw graph data
815
+ obsidian/ - Obsidian vault (only if --obsidian was given)
816
+ wiki/ - agent-crawlable wiki, start at wiki/index.md (only if --wiki was given)
817
+ ```
818
+
819
+ If graphify saved you time, consider supporting it: https://github.com/sponsors/safishamsi
820
+
821
+ Replace PATH_TO_DIR with the actual absolute path of the directory that was processed.
822
+
823
+ Then paste these sections from GRAPH_REPORT.md directly into the chat:
824
+ - God Nodes
825
+ - Surprising Connections
826
+ - Suggested Questions
827
+
828
+ Do NOT paste the full report - just those three sections. Keep it concise.
829
+
830
+ Then immediately offer to explore. Pick the single most interesting suggested question from the report - the one that crosses the most community boundaries or has the most surprising bridge node - and ask:
831
+
832
+ > "The most interesting question this graph can answer: **[question]**. Want me to trace it?"
833
+
834
+ If the user says yes, run `/graphify query "[question]"` on the graph and walk them through the answer using the graph structure - which nodes connect, which community boundaries get crossed, what the path reveals. Keep going as long as they want to explore. Each answer should end with a natural follow-up ("this connects to X - want to go deeper?") so the session feels like navigation, not a one-shot report.
835
+
836
+ The graph is the map. Your job after the pipeline is to be the guide.
837
+
838
+ ---
839
+
840
+ ## Interpreter guard for subcommands
841
+
842
+ Before running any subcommand below (`--update`, `--cluster-only`, `query`, `path`, `explain`, `add`), check that `.graphify_python` exists. If it's missing (e.g. user deleted `graphify-out/`), re-resolve the interpreter first:
843
+
844
+ ```bash
845
+ if [ ! -f graphify-out/.graphify_python ]; then
846
+ GRAPHIFY_BIN=$(which graphify 2>/dev/null)
847
+ if [ -n "$GRAPHIFY_BIN" ]; then
848
+ PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
849
+ case "$PYTHON" in *[!a-zA-Z0-9/_.-]*) PYTHON="python3" ;; esac
850
+ else
851
+ PYTHON="python3"
852
+ fi
853
+ mkdir -p graphify-out
854
+ "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w').write(sys.executable)"
855
+ fi
856
+ ```
857
+
858
+ ---
859
+
860
+ ## For --update (incremental re-extraction)
861
+
862
+ Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
863
+
864
+ ```bash
865
+ $(cat graphify-out/.graphify_python) -c "
866
+ import sys, json
867
+ from graphify.detect import detect_incremental, save_manifest
868
+ from pathlib import Path
869
+
870
+ result = detect_incremental(Path('INPUT_PATH'))
871
+ new_total = result.get('new_total', 0)
872
+ print(json.dumps(result, indent=2))
873
+ Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result))
874
+ deleted = list(result.get('deleted_files', []))
875
+ if new_total == 0 and not deleted:
876
+ print('No files changed since last run. Nothing to update.')
877
+ raise SystemExit(0)
878
+ if deleted:
879
+ print(f'{len(deleted)} deleted file(s) to prune.')
880
+ if new_total > 0:
881
+ print(f'{new_total} new/changed file(s) to re-extract.')
882
+ "
883
+ ```
884
+
885
+ If new files exist, first check whether all changed files are code files:
886
+
887
+ ```bash
888
+ $(cat graphify-out/.graphify_python) -c "
889
+ import json
890
+ from pathlib import Path
891
+
892
+ result = json.loads(open('graphify-out/.graphify_incremental.json').read()) if Path('graphify-out/.graphify_incremental.json').exists() else {}
893
+ code_exts = {'.py','.ts','.js','.go','.rs','.java','.cpp','.c','.rb','.swift','.kt','.cs','.scala','.php','.cc','.cxx','.hpp','.h','.kts','.lua','.toc'}
894
+ new_files = result.get('new_files', {})
895
+ all_changed = [f for files in new_files.values() for f in files]
896
+ code_only = all(Path(f).suffix.lower() in code_exts for f in all_changed)
897
+ print('code_only:', code_only)
898
+ "
899
+ ```
900
+
901
+ If `code_only` is True: print `[graphify update] Code-only changes detected - skipping semantic extraction (no LLM needed)`, run only Step 3A (AST) on the changed files, skip Step 3B entirely (no subagents), then go straight to merge and Steps 4-8.
902
+
903
+ If `code_only` is False (any changed file is a doc/paper/image): run the full Steps 3A-3C pipeline as normal.
904
+
905
+ If no new files exist (only deletions), create an empty extraction so the merge step can prune:
906
+
907
+ ```bash
908
+ if [ ! -f graphify-out/.graphify_extract.json ]; then
909
+ echo '[graphify update] Only deletions -- creating empty extraction for merge.'
910
+ $(cat graphify-out/.graphify_python) -c "
911
+ import json
912
+ from pathlib import Path
913
+ Path('graphify-out/.graphify_extract.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
914
+ "
915
+ fi
916
+ ```
917
+
918
+ Then:
919
+
920
+ ```bash
921
+ $(cat graphify-out/.graphify_python) -c "
922
+ import sys, json
923
+ from graphify.build import build_from_json
924
+ from graphify.export import to_json
925
+ from networkx.readwrite import json_graph
926
+ import networkx as nx
927
+ from pathlib import Path
928
+
929
+ # Load existing graph
930
+ existing_data = json.loads(Path('graphify-out/graph.json').read_text())
931
+ G_existing = json_graph.node_link_graph(existing_data, edges='links')
932
+
933
+ # Load new extraction
934
+ new_extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
935
+ G_new = build_from_json(new_extraction)
936
+
937
+ # Merge: new nodes/edges into existing graph
938
+ G_existing.update(G_new)
939
+ print(f'Merged: {G_existing.number_of_nodes()} nodes, {G_existing.number_of_edges()} edges')
940
+ "
941
+ ```
942
+
943
+ Then run Steps 4-8 on the merged graph as normal.
944
+
945
+ After Step 4, show the graph diff:
946
+
947
+ ```bash
948
+ $(cat graphify-out/.graphify_python) -c "
949
+ import json
950
+ from graphify.analyze import graph_diff
951
+ from graphify.build import build_from_json
952
+ from networkx.readwrite import json_graph
953
+ import networkx as nx
954
+ from pathlib import Path
955
+
956
+ old_data = json.loads(Path('graphify-out/.graphify_old.json').read_text()) if Path('graphify-out/.graphify_old.json').exists() else None
957
+ new_extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
958
+ G_new = build_from_json(new_extract)
959
+
960
+ if old_data:
961
+ G_old = json_graph.node_link_graph(old_data, edges='links')
962
+ diff = graph_diff(G_old, G_new)
963
+ print(diff['summary'])
964
+ if diff['new_nodes']:
965
+ print('New nodes:', ', '.join(n['label'] for n in diff['new_nodes'][:5]))
966
+ if diff['new_edges']:
967
+ print('New edges:', len(diff['new_edges']))
968
+ "
969
+ ```
970
+
971
+ Before the merge step, save the old graph: `cp graphify-out/graph.json graphify-out/.graphify_old.json`
972
+ Clean up after: `rm -f graphify-out/.graphify_old.json`
973
+
974
+ ---
975
+
976
+ ## For --cluster-only
977
+
978
+ Skip Steps 1-3. Load the existing graph from `graphify-out/graph.json` and re-run clustering:
979
+
980
+ ```bash
981
+ $(cat graphify-out/.graphify_python) -c "
982
+ import sys, json
983
+ from graphify.cluster import cluster, score_all
984
+ from graphify.analyze import god_nodes, surprising_connections
985
+ from graphify.report import generate
986
+ from graphify.export import to_json
987
+ from networkx.readwrite import json_graph
988
+ import networkx as nx
989
+ from pathlib import Path
990
+
991
+ data = json.loads(Path('graphify-out/graph.json').read_text())
992
+ G = json_graph.node_link_graph(data, edges='links')
993
+
994
+ detection = {'total_files': 0, 'total_words': 99999, 'needs_graph': True, 'warning': None,
995
+ 'files': {'code': [], 'document': [], 'paper': []}}
996
+ tokens = {'input': 0, 'output': 0}
997
+
998
+ communities = cluster(G)
999
+ cohesion = score_all(G, communities)
1000
+ gods = god_nodes(G)
1001
+ surprises = surprising_connections(G, communities)
1002
+ labels = {cid: 'Community ' + str(cid) for cid in communities}
1003
+
1004
+ report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, '.')
1005
+ Path('graphify-out/GRAPH_REPORT.md').write_text(report)
1006
+ to_json(G, communities, 'graphify-out/graph.json')
1007
+
1008
+ analysis = {
1009
+ 'communities': {str(k): v for k, v in communities.items()},
1010
+ 'cohesion': {str(k): v for k, v in cohesion.items()},
1011
+ 'gods': gods,
1012
+ 'surprises': surprises,
1013
+ }
1014
+ Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2))
1015
+ print(f'Re-clustered: {len(communities)} communities')
1016
+ "
1017
+ ```
1018
+
1019
+ Then run Steps 5-9 as normal (label communities, generate viz, benchmark, clean up, report).
1020
+
1021
+ ---
1022
+
1023
+ ## For /graphify query
1024
+
1025
+ Two traversal modes - choose based on the question:
1026
+
1027
+ | Mode | Flag | Best for |
1028
+ |------|------|----------|
1029
+ | BFS (default) | _(none)_ | "What is X connected to?" - broad context, nearest neighbors first |
1030
+ | DFS | `--dfs` | "How does X reach Y?" - trace a specific chain or dependency path |
1031
+
1032
+ First check the graph exists:
1033
+ ```bash
1034
+ $(cat graphify-out/.graphify_python) -c "
1035
+ from pathlib import Path
1036
+ if not Path('graphify-out/graph.json').exists():
1037
+ print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
1038
+ raise SystemExit(1)
1039
+ "
1040
+ ```
1041
+ If it fails, stop and tell the user to run `/graphify <path>` first.
1042
+
1043
+ Load `graphify-out/graph.json`, then:
1044
+
1045
+ 1. Find the 1-3 nodes whose label best matches key terms in the question.
1046
+ 2. Run the appropriate traversal from each starting node.
1047
+ 3. Read the subgraph - node labels, edge relations, confidence tags, source locations.
1048
+ 4. Answer using **only** what the graph contains. Quote `source_location` when citing a specific fact.
1049
+ 5. If the graph lacks enough information, say so - do not hallucinate edges.
1050
+
1051
+ ```bash
1052
+ $(cat graphify-out/.graphify_python) -c "
1053
+ import sys, json
1054
+ from networkx.readwrite import json_graph
1055
+ import networkx as nx
1056
+ from pathlib import Path
1057
+
1058
+ data = json.loads(Path('graphify-out/graph.json').read_text())
1059
+ G = json_graph.node_link_graph(data, edges='links')
1060
+
1061
+ question = 'QUESTION'
1062
+ mode = 'MODE' # 'bfs' or 'dfs'
1063
+ terms = [t.lower() for t in question.split() if len(t) > 3]
1064
+
1065
+ # Find best-matching start nodes
1066
+ scored = []
1067
+ for nid, ndata in G.nodes(data=True):
1068
+ label = ndata.get('label', '').lower()
1069
+ score = sum(1 for t in terms if t in label)
1070
+ if score > 0:
1071
+ scored.append((score, nid))
1072
+ scored.sort(reverse=True)
1073
+ start_nodes = [nid for _, nid in scored[:3]]
1074
+
1075
+ if not start_nodes:
1076
+ print('No matching nodes found for query terms:', terms)
1077
+ sys.exit(0)
1078
+
1079
+ subgraph_nodes = set()
1080
+ subgraph_edges = []
1081
+
1082
+ if mode == 'dfs':
1083
+ # DFS: follow one path as deep as possible before backtracking.
1084
+ # Depth-limited to 6 to avoid traversing the whole graph.
1085
+ visited = set()
1086
+ stack = [(n, 0) for n in reversed(start_nodes)]
1087
+ while stack:
1088
+ node, depth = stack.pop()
1089
+ if node in visited or depth > 6:
1090
+ continue
1091
+ visited.add(node)
1092
+ subgraph_nodes.add(node)
1093
+ for neighbor in G.neighbors(node):
1094
+ if neighbor not in visited:
1095
+ stack.append((neighbor, depth + 1))
1096
+ subgraph_edges.append((node, neighbor))
1097
+ else:
1098
+ # BFS: explore all neighbors layer by layer up to depth 3.
1099
+ frontier = set(start_nodes)
1100
+ subgraph_nodes = set(start_nodes)
1101
+ for _ in range(3):
1102
+ next_frontier = set()
1103
+ for n in frontier:
1104
+ for neighbor in G.neighbors(n):
1105
+ if neighbor not in subgraph_nodes:
1106
+ next_frontier.add(neighbor)
1107
+ subgraph_edges.append((n, neighbor))
1108
+ subgraph_nodes.update(next_frontier)
1109
+ frontier = next_frontier
1110
+
1111
+ # Token-budget aware output: rank by relevance, cut at budget (~4 chars/token)
1112
+ token_budget = BUDGET # default 2000
1113
+ char_budget = token_budget * 4
1114
+
1115
+ # Score each node by term overlap for ranked output
1116
+ def relevance(nid):
1117
+ label = G.nodes[nid].get('label', '').lower()
1118
+ return sum(1 for t in terms if t in label)
1119
+
1120
+ ranked_nodes = sorted(subgraph_nodes, key=relevance, reverse=True)
1121
+
1122
+ lines = [f'Traversal: {mode.upper()} | Start: {[G.nodes[n].get(\"label\",n) for n in start_nodes]} | {len(subgraph_nodes)} nodes']
1123
+ for nid in ranked_nodes:
1124
+ d = G.nodes[nid]
1125
+ lines.append(f' NODE {d.get(\"label\", nid)} [src={d.get(\"source_file\",\"\")} loc={d.get(\"source_location\",\"\")}]')
1126
+ for u, v in subgraph_edges:
1127
+ if u in subgraph_nodes and v in subgraph_nodes:
1128
+ _raw = G[u][v]; d = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
1129
+ lines.append(f' EDGE {G.nodes[u].get(\"label\",u)} --{d.get(\"relation\",\"\")} [{d.get(\"confidence\",\"\")}]--> {G.nodes[v].get(\"label\",v)}')
1130
+
1131
+ output = '\n'.join(lines)
1132
+ if len(output) > char_budget:
1133
+ output = output[:char_budget] + f'\n... (truncated at ~{token_budget} token budget - use --budget N for more)'
1134
+ print(output)
1135
+ "
1136
+ ```
1137
+
1138
+ Replace `QUESTION` with the user's actual question, `MODE` with `bfs` or `dfs`, and `BUDGET` with the token budget (default `2000`, or whatever `--budget N` specifies). Then answer based on the subgraph output above.
1139
+
1140
+ After writing the answer, save it back into the graph so it improves future queries:
1141
+
1142
+ ```bash
1143
+ $(cat graphify-out/.graphify_python) -m graphify save-result --question "QUESTION" --answer "ANSWER" --type query --nodes NODE1 NODE2
1144
+ ```
1145
+
1146
+ ---
1147
+
1148
+ ## For /graphify path
1149
+
1150
+ Find the shortest path between two named concepts in the graph.
1151
+
1152
+ First check the graph exists:
1153
+ ```bash
1154
+ $(cat graphify-out/.graphify_python) -c "
1155
+ from pathlib import Path
1156
+ if not Path('graphify-out/graph.json').exists():
1157
+ print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
1158
+ raise SystemExit(1)
1159
+ "
1160
+ ```
1161
+
1162
+ ```bash
1163
+ $(cat graphify-out/.graphify_python) -c "
1164
+ import json, sys
1165
+ import networkx as nx
1166
+ from networkx.readwrite import json_graph
1167
+ from pathlib import Path
1168
+
1169
+ data = json.loads(Path('graphify-out/graph.json').read_text())
1170
+ G = json_graph.node_link_graph(data, edges='links')
1171
+
1172
+ a_term = 'NODE_A'
1173
+ b_term = 'NODE_B'
1174
+
1175
+ def find_node(term):
1176
+ term = term.lower()
1177
+ scored = sorted(
1178
+ [(sum(1 for w in term.split() if w in G.nodes[n].get('label','').lower()), n)
1179
+ for n in G.nodes()],
1180
+ reverse=True
1181
+ )
1182
+ return scored[0][1] if scored and scored[0][0] > 0 else None
1183
+
1184
+ src = find_node(a_term)
1185
+ tgt = find_node(b_term)
1186
+
1187
+ if not src or not tgt:
1188
+ print(f'Could not find nodes matching: {a_term!r} or {b_term!r}')
1189
+ sys.exit(0)
1190
+
1191
+ try:
1192
+ path = nx.shortest_path(G, src, tgt)
1193
+ print(f'Shortest path ({len(path)-1} hops):')
1194
+ for i, nid in enumerate(path):
1195
+ label = G.nodes[nid].get('label', nid)
1196
+ if i < len(path) - 1:
1197
+ _raw = G[nid][path[i+1]]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
1198
+ rel = edge.get('relation', '')
1199
+ conf = edge.get('confidence', '')
1200
+ print(f' {label} --{rel}--> [{conf}]')
1201
+ else:
1202
+ print(f' {label}')
1203
+ except nx.NetworkXNoPath:
1204
+ print(f'No path found between {a_term!r} and {b_term!r}')
1205
+ except nx.NodeNotFound as e:
1206
+ print(f'Node not found: {e}')
1207
+ "
1208
+ ```
1209
+
1210
+ Replace `NODE_A` and `NODE_B` with the actual concept names. Then explain the path in plain language - what each hop means, why it's significant.
1211
+
1212
+ After writing the explanation, save it back:
1213
+
1214
+ ```bash
1215
+ $(cat graphify-out/.graphify_python) -m graphify save-result --question "Path from NODE_A to NODE_B" --answer "ANSWER" --type path_query --nodes NODE_A NODE_B
1216
+ ```
1217
+
1218
+ ---
1219
+
1220
+ ## For /graphify explain
1221
+
1222
+ Give a plain-language explanation of a single node - everything connected to it.
1223
+
1224
+ First check the graph exists:
1225
+ ```bash
1226
+ $(cat graphify-out/.graphify_python) -c "
1227
+ from pathlib import Path
1228
+ if not Path('graphify-out/graph.json').exists():
1229
+ print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
1230
+ raise SystemExit(1)
1231
+ "
1232
+ ```
1233
+
1234
+ ```bash
1235
+ $(cat graphify-out/.graphify_python) -c "
1236
+ import json, sys
1237
+ import networkx as nx
1238
+ from networkx.readwrite import json_graph
1239
+ from pathlib import Path
1240
+
1241
+ data = json.loads(Path('graphify-out/graph.json').read_text())
1242
+ G = json_graph.node_link_graph(data, edges='links')
1243
+
1244
+ term = 'NODE_NAME'
1245
+ term_lower = term.lower()
1246
+
1247
+ # Find best matching node
1248
+ scored = sorted(
1249
+ [(sum(1 for w in term_lower.split() if w in G.nodes[n].get('label','').lower()), n)
1250
+ for n in G.nodes()],
1251
+ reverse=True
1252
+ )
1253
+ if not scored or scored[0][0] == 0:
1254
+ print(f'No node matching {term!r}')
1255
+ sys.exit(0)
1256
+
1257
+ nid = scored[0][1]
1258
+ data_n = G.nodes[nid]
1259
+ print(f'NODE: {data_n.get(\"label\", nid)}')
1260
+ print(f' source: {data_n.get(\"source_file\",\"unknown\")}')
1261
+ print(f' type: {data_n.get(\"file_type\",\"unknown\")}')
1262
+ print(f' degree: {G.degree(nid)}')
1263
+ print()
1264
+ print('CONNECTIONS:')
1265
+ for neighbor in G.neighbors(nid):
1266
+ _raw = G[nid][neighbor]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
1267
+ nlabel = G.nodes[neighbor].get('label', neighbor)
1268
+ rel = edge.get('relation', '')
1269
+ conf = edge.get('confidence', '')
1270
+ src_file = G.nodes[neighbor].get('source_file', '')
1271
+ print(f' --{rel}--> {nlabel} [{conf}] ({src_file})')
1272
+ "
1273
+ ```
1274
+
1275
+ Replace `NODE_NAME` with the concept. Then write a 3-5 sentence explanation using source locations as citations.
1276
+
1277
+ After writing the explanation, save it back:
1278
+
1279
+ ```bash
1280
+ $(cat graphify-out/.graphify_python) -m graphify save-result --question "Explain NODE_NAME" --answer "ANSWER" --type explain --nodes NODE_NAME
1281
+ ```
1282
+
1283
+ ---
1284
+
1285
+ ## For /graphify add
1286
+
1287
+ Fetch a URL and add it to the corpus, then update the graph.
1288
+
1289
+ ```bash
1290
+ $(cat graphify-out/.graphify_python) -c "
1291
+ import sys
1292
+ from graphify.ingest import ingest
1293
+ from pathlib import Path
1294
+
1295
+ try:
1296
+ out = ingest('URL', Path('./raw'), author='AUTHOR', contributor='CONTRIBUTOR')
1297
+ print(f'Saved to {out}')
1298
+ except ValueError as e:
1299
+ print(f'error: {e}', file=sys.stderr)
1300
+ sys.exit(1)
1301
+ except RuntimeError as e:
1302
+ print(f'error: {e}', file=sys.stderr)
1303
+ sys.exit(1)
1304
+ "
1305
+ ```
1306
+
1307
+ Replace `URL` with the actual URL, `AUTHOR` with the user's name if provided, `CONTRIBUTOR` likewise. After a successful save, automatically run the `--update` pipeline on `./raw` to merge the new file into the existing graph.
1308
+
1309
+ Supported URL types (auto-detected):
1310
+ - Twitter/X -> fetched via oEmbed, saved as `.md` with tweet text and author
1311
+ - arXiv -> abstract + metadata saved as `.md`
1312
+ - PDF -> downloaded as `.pdf`
1313
+ - Images (.png/.jpg/.webp) -> downloaded, vision extraction runs on next build
1314
+ - Any webpage -> converted to markdown via html2text
1315
+
1316
+ ---
1317
+
1318
+ ## For --watch
1319
+
1320
+ Start a background watcher that monitors a folder and auto-updates the graph when files change.
1321
+
1322
+ ```bash
1323
+ python3 -m graphify.watch INPUT_PATH --debounce 3
1324
+ ```
1325
+
1326
+ Replace INPUT_PATH with the folder to watch. Behavior depends on what changed:
1327
+
1328
+ - **Code files only (.py, .ts, .go, etc.):** re-runs AST extraction + rebuild + cluster immediately, no LLM needed. `graph.json` and `GRAPH_REPORT.md` are updated automatically.
1329
+ - **Docs, papers, or images:** writes a `graphify-out/needs_update` flag and prints a notification to run `/graphify --update` (LLM semantic re-extraction required).
1330
+
1331
+ Debounce (default 3s): waits until file activity stops before triggering, so a wave of parallel agent writes doesn't trigger a rebuild per file.
1332
+
1333
+ Press Ctrl+C to stop.
1334
+
1335
+ ---
1336
+
1337
+ ## For git commit hook
1338
+
1339
+ Install a post-commit hook that auto-rebuilds the graph after every commit. No background process needed - triggers once per commit, works with any editor.
1340
+
1341
+ ```bash
1342
+ graphify hook install # install
1343
+ graphify hook uninstall # remove
1344
+ graphify hook status # check
1345
+ ```
1346
+
1347
+ After every `git commit`, the hook detects which code files changed, re-runs AST extraction on those files, and rebuilds `graph.json` and `GRAPH_REPORT.md`. Doc/image changes are ignored by the hook - run `/graphify --update` manually for those.
1348
+
1349
+ ---
1350
+
1351
+ ## For always-on context in Devin sessions
1352
+
1353
+ Run once per project to make graphify always-on in Devin sessions:
1354
+
1355
+ ```bash
1356
+ graphify devin install --project
1357
+ ```
1358
+
1359
+ This writes a `## graphify` section to `.windsurf/rules/graphify.md` that instructs Devin to check the graph before answering codebase questions and rebuild it after code changes.
1360
+
1361
+ ```bash
1362
+ graphify devin uninstall --project # remove
1363
+ ```
1364
+
1365
+ ---
1366
+
1367
+ ## Honesty Rules
1368
+
1369
+ - Never invent an edge. If unsure, use AMBIGUOUS.
1370
+ - Never skip the corpus check warning.
1371
+ - Always show token cost in the report.
1372
+ - Never hide cohesion scores behind symbols - show the raw number.