kirograph 0.16.1 → 0.19.0

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 (365) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +103 -1605
  3. package/dist/architecture/layers/dart.js +112 -0
  4. package/dist/architecture/layers/dart.js.map +7 -0
  5. package/dist/architecture/layers/index.js +3 -1
  6. package/dist/architecture/layers/index.js.map +2 -2
  7. package/dist/bin/banner.js +74 -6
  8. package/dist/bin/banner.js.map +2 -2
  9. package/dist/bin/commands/affected.js +40 -5
  10. package/dist/bin/commands/affected.js.map +2 -2
  11. package/dist/bin/commands/attack-surface.js +157 -0
  12. package/dist/bin/commands/attack-surface.js.map +7 -0
  13. package/dist/bin/commands/benchmark.js +206 -0
  14. package/dist/bin/commands/benchmark.js.map +7 -0
  15. package/dist/bin/commands/budget.js +70 -0
  16. package/dist/bin/commands/budget.js.map +7 -0
  17. package/dist/bin/commands/communities.js +77 -0
  18. package/dist/bin/commands/communities.js.map +7 -0
  19. package/dist/bin/commands/data.js +665 -0
  20. package/dist/bin/commands/data.js.map +7 -0
  21. package/dist/bin/commands/dep-confusion.js +119 -0
  22. package/dist/bin/commands/dep-confusion.js.map +7 -0
  23. package/dist/bin/commands/export.js +304 -10
  24. package/dist/bin/commands/export.js.map +2 -2
  25. package/dist/bin/commands/flows.js +97 -0
  26. package/dist/bin/commands/flows.js.map +7 -0
  27. package/dist/bin/commands/help.js +386 -100
  28. package/dist/bin/commands/help.js.map +2 -2
  29. package/dist/bin/commands/install.js +90 -8
  30. package/dist/bin/commands/install.js.map +2 -2
  31. package/dist/bin/commands/licenses.js +201 -0
  32. package/dist/bin/commands/licenses.js.map +7 -0
  33. package/dist/bin/commands/reachability.js +160 -0
  34. package/dist/bin/commands/reachability.js.map +7 -0
  35. package/dist/bin/commands/read.js +100 -0
  36. package/dist/bin/commands/read.js.map +7 -0
  37. package/dist/bin/commands/refactor.js +116 -0
  38. package/dist/bin/commands/refactor.js.map +7 -0
  39. package/dist/bin/commands/remediation.js +133 -0
  40. package/dist/bin/commands/remediation.js.map +7 -0
  41. package/dist/bin/commands/sbom.js +76 -0
  42. package/dist/bin/commands/sbom.js.map +7 -0
  43. package/dist/bin/commands/security-ci-report.js +267 -0
  44. package/dist/bin/commands/security-ci-report.js.map +7 -0
  45. package/dist/bin/commands/security-export.js +1349 -0
  46. package/dist/bin/commands/security-export.js.map +7 -0
  47. package/dist/bin/commands/security-flows.js +126 -0
  48. package/dist/bin/commands/security-flows.js.map +7 -0
  49. package/dist/bin/commands/security-secrets.js +170 -0
  50. package/dist/bin/commands/security-secrets.js.map +7 -0
  51. package/dist/bin/commands/security.js +193 -0
  52. package/dist/bin/commands/security.js.map +7 -0
  53. package/dist/bin/commands/staleness.js +144 -0
  54. package/dist/bin/commands/staleness.js.map +7 -0
  55. package/dist/bin/commands/status.js +102 -2
  56. package/dist/bin/commands/status.js.map +2 -2
  57. package/dist/bin/commands/supply-chain.js +138 -0
  58. package/dist/bin/commands/supply-chain.js.map +7 -0
  59. package/dist/bin/commands/uninit.js +109 -60
  60. package/dist/bin/commands/uninit.js.map +2 -2
  61. package/dist/bin/commands/vex.js +76 -0
  62. package/dist/bin/commands/vex.js.map +7 -0
  63. package/dist/bin/commands/vuln-suppress.js +95 -0
  64. package/dist/bin/commands/vuln-suppress.js.map +7 -0
  65. package/dist/bin/commands/vulns.js +382 -0
  66. package/dist/bin/commands/vulns.js.map +7 -0
  67. package/dist/bin/installer/auto-detect.js +125 -0
  68. package/dist/bin/installer/auto-detect.js.map +7 -0
  69. package/dist/bin/installer/cli-agent.js +28 -5
  70. package/dist/bin/installer/cli-agent.js.map +2 -2
  71. package/dist/bin/installer/common.js +47 -0
  72. package/dist/bin/installer/common.js.map +2 -2
  73. package/dist/bin/installer/config-prompt.js +39 -1
  74. package/dist/bin/installer/config-prompt.js.map +2 -2
  75. package/dist/bin/installer/detect.js +309 -0
  76. package/dist/bin/installer/detect.js.map +7 -0
  77. package/dist/bin/installer/index.js +36 -1
  78. package/dist/bin/installer/index.js.map +2 -2
  79. package/dist/bin/installer/instructions.js +195 -3
  80. package/dist/bin/installer/instructions.js.map +2 -2
  81. package/dist/bin/installer/steering.js +440 -0
  82. package/dist/bin/installer/steering.js.map +2 -2
  83. package/dist/bin/installer/targets/aider.js +3 -3
  84. package/dist/bin/installer/targets/aider.js.map +2 -2
  85. package/dist/bin/installer/targets/amp.js +3 -3
  86. package/dist/bin/installer/targets/amp.js.map +2 -2
  87. package/dist/bin/installer/targets/antigravity.js +35 -6
  88. package/dist/bin/installer/targets/antigravity.js.map +2 -2
  89. package/dist/bin/installer/targets/augment.js +3 -3
  90. package/dist/bin/installer/targets/augment.js.map +2 -2
  91. package/dist/bin/installer/targets/claude.js +49 -5
  92. package/dist/bin/installer/targets/claude.js.map +2 -2
  93. package/dist/bin/installer/targets/cline.js +32 -6
  94. package/dist/bin/installer/targets/cline.js.map +2 -2
  95. package/dist/bin/installer/targets/codex.js +64 -12
  96. package/dist/bin/installer/targets/codex.js.map +2 -2
  97. package/dist/bin/installer/targets/continue.js +2 -2
  98. package/dist/bin/installer/targets/continue.js.map +2 -2
  99. package/dist/bin/installer/targets/copilot-cli.js +101 -0
  100. package/dist/bin/installer/targets/copilot-cli.js.map +7 -0
  101. package/dist/bin/installer/targets/copilot.js +31 -5
  102. package/dist/bin/installer/targets/copilot.js.map +2 -2
  103. package/dist/bin/installer/targets/cursor.js +4 -4
  104. package/dist/bin/installer/targets/cursor.js.map +2 -2
  105. package/dist/bin/installer/targets/devin.js +2 -2
  106. package/dist/bin/installer/targets/devin.js.map +2 -2
  107. package/dist/bin/installer/targets/gemini-cli.js +2 -2
  108. package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
  109. package/dist/bin/installer/targets/generic.js +2 -14
  110. package/dist/bin/installer/targets/generic.js.map +2 -2
  111. package/dist/bin/installer/targets/goose.js +3 -3
  112. package/dist/bin/installer/targets/goose.js.map +2 -2
  113. package/dist/bin/installer/targets/index.js +250 -0
  114. package/dist/bin/installer/targets/index.js.map +2 -2
  115. package/dist/bin/installer/targets/junie.js +2 -2
  116. package/dist/bin/installer/targets/junie.js.map +2 -2
  117. package/dist/bin/installer/targets/kilo.js +2 -2
  118. package/dist/bin/installer/targets/kilo.js.map +2 -2
  119. package/dist/bin/installer/targets/kiro.js +3 -3
  120. package/dist/bin/installer/targets/kiro.js.map +2 -2
  121. package/dist/bin/installer/targets/opencode.js +2 -2
  122. package/dist/bin/installer/targets/opencode.js.map +2 -2
  123. package/dist/bin/installer/targets/openhands.js +3 -3
  124. package/dist/bin/installer/targets/openhands.js.map +2 -2
  125. package/dist/bin/installer/targets/qoder.js +91 -0
  126. package/dist/bin/installer/targets/qoder.js.map +7 -0
  127. package/dist/bin/installer/targets/qwen.js +96 -0
  128. package/dist/bin/installer/targets/qwen.js.map +7 -0
  129. package/dist/bin/installer/targets/replit.js +3 -3
  130. package/dist/bin/installer/targets/replit.js.map +2 -2
  131. package/dist/bin/installer/targets/roo.js +2 -2
  132. package/dist/bin/installer/targets/roo.js.map +2 -2
  133. package/dist/bin/installer/targets/tabnine.js +3 -3
  134. package/dist/bin/installer/targets/tabnine.js.map +2 -2
  135. package/dist/bin/installer/targets/trae.js +5 -5
  136. package/dist/bin/installer/targets/trae.js.map +2 -2
  137. package/dist/bin/installer/targets/warp.js +2 -2
  138. package/dist/bin/installer/targets/warp.js.map +2 -2
  139. package/dist/bin/installer/targets/windsurf.js +35 -6
  140. package/dist/bin/installer/targets/windsurf.js.map +2 -2
  141. package/dist/bin/kirograph.js +74 -6
  142. package/dist/bin/kirograph.js.map +3 -3
  143. package/dist/bin/progress.js +30 -0
  144. package/dist/bin/progress.js.map +2 -2
  145. package/dist/compression/naive-cost.js +25 -0
  146. package/dist/compression/naive-cost.js.map +2 -2
  147. package/dist/compression/tracker.js +91 -2
  148. package/dist/compression/tracker.js.map +2 -2
  149. package/dist/compression/types.js.map +1 -1
  150. package/dist/config.js +126 -3
  151. package/dist/config.js.map +2 -2
  152. package/dist/core/pipeline.js +92 -4
  153. package/dist/core/pipeline.js.map +2 -2
  154. package/dist/data/filters.js +105 -0
  155. package/dist/data/filters.js.map +7 -0
  156. package/dist/data/indexer.js +225 -0
  157. package/dist/data/indexer.js.map +7 -0
  158. package/dist/data/linker.js +150 -0
  159. package/dist/data/linker.js.map +7 -0
  160. package/dist/data/lint.js +109 -0
  161. package/dist/data/lint.js.map +7 -0
  162. package/dist/data/parsers/csv.js +132 -0
  163. package/dist/data/parsers/csv.js.map +7 -0
  164. package/dist/data/parsers/excel.js +88 -0
  165. package/dist/data/parsers/excel.js.map +7 -0
  166. package/dist/data/parsers/index.js +79 -0
  167. package/dist/data/parsers/index.js.map +7 -0
  168. package/dist/data/parsers/json-array.js +89 -0
  169. package/dist/data/parsers/json-array.js.map +7 -0
  170. package/dist/data/parsers/jsonl.js +84 -0
  171. package/dist/data/parsers/jsonl.js.map +7 -0
  172. package/dist/data/parsers/parquet.js +95 -0
  173. package/dist/data/parsers/parquet.js.map +7 -0
  174. package/dist/data/profiler.js +182 -0
  175. package/dist/data/profiler.js.map +7 -0
  176. package/dist/data/queries.js +512 -0
  177. package/dist/data/queries.js.map +7 -0
  178. package/dist/data/types.js +17 -0
  179. package/dist/data/types.js.map +7 -0
  180. package/dist/db/data-schema.sql +61 -0
  181. package/dist/db/database.js +67 -5
  182. package/dist/db/database.js.map +2 -2
  183. package/dist/db/memory-schema.sql +5 -1
  184. package/dist/db/schema.sql +3 -1
  185. package/dist/db/security-schema.sql +72 -0
  186. package/dist/extraction/extractor.js +81 -0
  187. package/dist/extraction/extractor.js.map +2 -2
  188. package/dist/extraction/grammars.js +32 -8
  189. package/dist/extraction/grammars.js.map +2 -2
  190. package/dist/extraction/languages.js +43 -1
  191. package/dist/extraction/languages.js.map +2 -2
  192. package/dist/extraction/notebook.js +300 -0
  193. package/dist/extraction/notebook.js.map +7 -0
  194. package/dist/extraction/wasm/tree-sitter-astro.wasm +0 -0
  195. package/dist/extraction/wasm/tree-sitter-gdscript.wasm +0 -0
  196. package/dist/extraction/wasm/tree-sitter-julia.wasm +0 -0
  197. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  198. package/dist/extraction/wasm/tree-sitter-perl.wasm +0 -0
  199. package/dist/extraction/wasm/tree-sitter-powershell.wasm +0 -0
  200. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  201. package/dist/extraction/wasm/tree-sitter-sql.wasm +0 -0
  202. package/dist/extraction/wasm/tree-sitter-verilog.wasm +0 -0
  203. package/dist/frameworks/flutter.js +130 -0
  204. package/dist/frameworks/flutter.js.map +7 -0
  205. package/dist/frameworks/index.js +7 -1
  206. package/dist/frameworks/index.js.map +3 -3
  207. package/dist/graph/communities.js +317 -0
  208. package/dist/graph/communities.js.map +7 -0
  209. package/dist/graph/flows.js +138 -0
  210. package/dist/graph/flows.js.map +7 -0
  211. package/dist/graph/refactor.js +155 -0
  212. package/dist/graph/refactor.js.map +7 -0
  213. package/dist/index.js +1 -1
  214. package/dist/index.js.map +2 -2
  215. package/dist/mcp/cache.js +172 -0
  216. package/dist/mcp/cache.js.map +7 -0
  217. package/dist/mcp/read-modes.js +295 -0
  218. package/dist/mcp/read-modes.js.map +7 -0
  219. package/dist/mcp/server.js +2 -1
  220. package/dist/mcp/server.js.map +2 -2
  221. package/dist/mcp/tool-names.js +29 -1
  222. package/dist/mcp/tool-names.js.map +2 -2
  223. package/dist/mcp/tools.js +1588 -6
  224. package/dist/mcp/tools.js.map +3 -3
  225. package/dist/memory/database.js +32 -2
  226. package/dist/memory/database.js.map +2 -2
  227. package/dist/memory/types.js.map +1 -1
  228. package/dist/resolution/bridges/android-rn.js +298 -0
  229. package/dist/resolution/bridges/android-rn.js.map +7 -0
  230. package/dist/resolution/bridges/expo-modules.js +155 -0
  231. package/dist/resolution/bridges/expo-modules.js.map +7 -0
  232. package/dist/resolution/bridges/flutter-channel.js +385 -0
  233. package/dist/resolution/bridges/flutter-channel.js.map +7 -0
  234. package/dist/resolution/bridges/index.js +80 -0
  235. package/dist/resolution/bridges/index.js.map +7 -0
  236. package/dist/resolution/bridges/native-events.js +188 -0
  237. package/dist/resolution/bridges/native-events.js.map +7 -0
  238. package/dist/resolution/bridges/native-views.js +244 -0
  239. package/dist/resolution/bridges/native-views.js.map +7 -0
  240. package/dist/resolution/bridges/react-native.js +161 -0
  241. package/dist/resolution/bridges/react-native.js.map +7 -0
  242. package/dist/resolution/bridges/swift-objc.js +227 -0
  243. package/dist/resolution/bridges/swift-objc.js.map +7 -0
  244. package/dist/resolution/bridges/turbomodules.js +216 -0
  245. package/dist/resolution/bridges/turbomodules.js.map +7 -0
  246. package/dist/resolution/index.js +61 -2
  247. package/dist/resolution/index.js.map +2 -2
  248. package/dist/security/attack-surface.js +164 -0
  249. package/dist/security/attack-surface.js.map +7 -0
  250. package/dist/security/context-warnings.js +123 -0
  251. package/dist/security/context-warnings.js.map +7 -0
  252. package/dist/security/context-warnings.test.js +300 -0
  253. package/dist/security/context-warnings.test.js.map +7 -0
  254. package/dist/security/data-flows.js +228 -0
  255. package/dist/security/data-flows.js.map +7 -0
  256. package/dist/security/dep-confusion.js +255 -0
  257. package/dist/security/dep-confusion.js.map +7 -0
  258. package/dist/security/errors.js +51 -0
  259. package/dist/security/errors.js.map +7 -0
  260. package/dist/security/export/fix-suggestions.js +58 -0
  261. package/dist/security/export/fix-suggestions.js.map +7 -0
  262. package/dist/security/export/fix-suggestions.test.js +74 -0
  263. package/dist/security/export/fix-suggestions.test.js.map +7 -0
  264. package/dist/security/export/sbom.js +230 -0
  265. package/dist/security/export/sbom.js.map +7 -0
  266. package/dist/security/export/sbom.test.js +288 -0
  267. package/dist/security/export/sbom.test.js.map +7 -0
  268. package/dist/security/export/serialization.js +142 -0
  269. package/dist/security/export/serialization.js.map +7 -0
  270. package/dist/security/export/serialization.test.js +310 -0
  271. package/dist/security/export/serialization.test.js.map +7 -0
  272. package/dist/security/export/vex.js +220 -0
  273. package/dist/security/export/vex.js.map +7 -0
  274. package/dist/security/export/vex.test.js +278 -0
  275. package/dist/security/export/vex.test.js.map +7 -0
  276. package/dist/security/index.js +67 -0
  277. package/dist/security/index.js.map +7 -0
  278. package/dist/security/integrator-transitives.test.js +359 -0
  279. package/dist/security/integrator-transitives.test.js.map +7 -0
  280. package/dist/security/integrator.js +491 -0
  281. package/dist/security/integrator.js.map +7 -0
  282. package/dist/security/integrator.test.js +237 -0
  283. package/dist/security/integrator.test.js.map +7 -0
  284. package/dist/security/license.js +70 -0
  285. package/dist/security/license.js.map +7 -0
  286. package/dist/security/manifest/adapter.js +243 -0
  287. package/dist/security/manifest/adapter.js.map +7 -0
  288. package/dist/security/manifest/adapter.test.js +272 -0
  289. package/dist/security/manifest/adapter.test.js.map +7 -0
  290. package/dist/security/manifest/parser.js +376 -0
  291. package/dist/security/manifest/parser.js.map +7 -0
  292. package/dist/security/manifest/parser.test.js +110 -0
  293. package/dist/security/manifest/parser.test.js.map +7 -0
  294. package/dist/security/manifest/plugins/cargo.js +233 -0
  295. package/dist/security/manifest/plugins/cargo.js.map +7 -0
  296. package/dist/security/manifest/plugins/cargo.test.js +304 -0
  297. package/dist/security/manifest/plugins/cargo.test.js.map +7 -0
  298. package/dist/security/manifest/plugins/composer.js +152 -0
  299. package/dist/security/manifest/plugins/composer.js.map +7 -0
  300. package/dist/security/manifest/plugins/go.js +146 -0
  301. package/dist/security/manifest/plugins/go.js.map +7 -0
  302. package/dist/security/manifest/plugins/go.test.js +341 -0
  303. package/dist/security/manifest/plugins/go.test.js.map +7 -0
  304. package/dist/security/manifest/plugins/gradle.js +159 -0
  305. package/dist/security/manifest/plugins/gradle.js.map +7 -0
  306. package/dist/security/manifest/plugins/hex.js +159 -0
  307. package/dist/security/manifest/plugins/hex.js.map +7 -0
  308. package/dist/security/manifest/plugins/maven.js +128 -0
  309. package/dist/security/manifest/plugins/maven.js.map +7 -0
  310. package/dist/security/manifest/plugins/maven.test.js +389 -0
  311. package/dist/security/manifest/plugins/maven.test.js.map +7 -0
  312. package/dist/security/manifest/plugins/npm.js +284 -0
  313. package/dist/security/manifest/plugins/npm.js.map +7 -0
  314. package/dist/security/manifest/plugins/npm.test.js +298 -0
  315. package/dist/security/manifest/plugins/npm.test.js.map +7 -0
  316. package/dist/security/manifest/plugins/nuget.js +186 -0
  317. package/dist/security/manifest/plugins/nuget.js.map +7 -0
  318. package/dist/security/manifest/plugins/pip.js +123 -0
  319. package/dist/security/manifest/plugins/pip.js.map +7 -0
  320. package/dist/security/manifest/plugins/pip.test.js +208 -0
  321. package/dist/security/manifest/plugins/pip.test.js.map +7 -0
  322. package/dist/security/manifest/plugins/pubspec.js +212 -0
  323. package/dist/security/manifest/plugins/pubspec.js.map +7 -0
  324. package/dist/security/manifest/plugins/pyproject.js +261 -0
  325. package/dist/security/manifest/plugins/pyproject.js.map +7 -0
  326. package/dist/security/manifest/plugins/rubygems.js +185 -0
  327. package/dist/security/manifest/plugins/rubygems.js.map +7 -0
  328. package/dist/security/manifest/plugins/swift.js +200 -0
  329. package/dist/security/manifest/plugins/swift.js.map +7 -0
  330. package/dist/security/owasp.js +104 -0
  331. package/dist/security/owasp.js.map +7 -0
  332. package/dist/security/pipeline.js +125 -0
  333. package/dist/security/pipeline.js.map +7 -0
  334. package/dist/security/reachability.js +276 -0
  335. package/dist/security/reachability.js.map +7 -0
  336. package/dist/security/reachability.test.js +394 -0
  337. package/dist/security/reachability.test.js.map +7 -0
  338. package/dist/security/remediation.js +126 -0
  339. package/dist/security/remediation.js.map +7 -0
  340. package/dist/security/secrets.js +176 -0
  341. package/dist/security/secrets.js.map +7 -0
  342. package/dist/security/staleness.js +231 -0
  343. package/dist/security/staleness.js.map +7 -0
  344. package/dist/security/supply-chain.js +301 -0
  345. package/dist/security/supply-chain.js.map +7 -0
  346. package/dist/security/suppressions.js +106 -0
  347. package/dist/security/suppressions.js.map +7 -0
  348. package/dist/security/types.js +17 -0
  349. package/dist/security/types.js.map +7 -0
  350. package/dist/security/vuln/client.js +355 -0
  351. package/dist/security/vuln/client.js.map +7 -0
  352. package/dist/security/vuln/client.test.js +288 -0
  353. package/dist/security/vuln/client.test.js.map +7 -0
  354. package/dist/security/vuln/epss-client.js +95 -0
  355. package/dist/security/vuln/epss-client.js.map +7 -0
  356. package/dist/security/vuln/index.js +29 -0
  357. package/dist/security/vuln/index.js.map +7 -0
  358. package/dist/security/vuln/osv-adapter.js +321 -0
  359. package/dist/security/vuln/osv-adapter.js.map +7 -0
  360. package/dist/security/vuln/osv-adapter.test.js +391 -0
  361. package/dist/security/vuln/osv-adapter.test.js.map +7 -0
  362. package/dist/security/vuln/types.js +17 -0
  363. package/dist/security/vuln/types.js.map +7 -0
  364. package/dist/types.js.map +2 -2
  365. package/package.json +5 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@ Semantic code knowledge graph for [Kiro](https://kiro.dev): fewer tool calls, in
8
8
 
9
9
  Inspired by [CodeGraph](https://github.com/colbymchenry/codegraph) by [colbymchenry](https://github.com/colbymchenry) for Claude Code, rebuilt natively for Kiro's MCP and hooks system.
10
10
 
11
- > **Full support is for Kiro only.** Experimental integrations for other MCP-capable tools (Claude Code, Codex) are available but not fully tested. See [Other Tools (Experimental)](#other-tools-experimental) for details.
11
+ > **Full support is for Kiro only.** Experimental integrations for 34 other MCP-capable tools (Cursor, Copilot, Claude Code, Windsurf, Cline, and more) are available with auto-detection. See [Integrations](docs/guide/integrations.md) for the full list.
12
12
 
13
13
  ## Why KiroGraph?
14
14
 
@@ -18,186 +18,82 @@ KiroGraph gives Kiro a semantic knowledge graph that's pre-indexed and always up
18
18
 
19
19
  The result is fewer tool calls, less context used, and faster responses on complex tasks.
20
20
 
21
- ## What Gets Indexed?
22
-
23
- KiroGraph uses [tree-sitter](https://tree-sitter.github.io/tree-sitter/) to parse your source files into an AST and extract:
24
-
25
- - **Nodes**: functions, methods, classes, interfaces, types, enums, variables, constants, routes, components, and more (24 node kinds total)
26
- - **Edges**: calls, imports, exports, extends, implements, contains, references, instantiates, overrides, decorates, type_of, returns
27
-
28
- Everything is stored in a local SQLite database (`.kirograph/kirograph.db`). **Nothing leaves your machine.** No API keys. No external services.
29
-
30
- The index is kept fresh automatically via Kiro hooks when using the Kiro integration; no background watcher process needed.
31
-
32
- ## How Indexing Works
33
-
34
- Indexing has three layers: **structural** (always on), **semantic** (opt-in), and **architecture** (opt-in).
35
-
36
- ### Structural indexing
37
-
38
- tree-sitter parses every source file into an AST. Nodes and edges are extracted and written to `kirograph.db`. This is what powers all graph traversal tools (`kirograph_callers`, `kirograph_impact`, `kirograph_path`, etc.) and exact/FTS symbol search.
39
-
40
- This layer has no extra dependencies and runs on every `kirograph index` or `kirograph sync`.
41
-
42
- ### Semantic indexing (opt-in)
43
-
44
- When `enableEmbeddings: true` is set, KiroGraph additionally generates 768-dimensional vector embeddings for every embeddable symbol (`function`, `method`, `class`, `interface`, `type_alias`, `component`, `module`) using the `nomic-ai/nomic-embed-text-v1.5` model (~130MB, downloaded once to `~/.kirograph/models/`).
45
-
46
- These embeddings power natural-language search in `kirograph_context` and act as a fallback in `kirograph_search`. The embeddings are stored in the **semantic engine** of your choice:
47
-
48
- | Engine | Store | Search type | Extra deps |
49
- |--------|-------|-------------|------------|
50
- | `cosine` *(default)* | `kirograph.db` (`vectors` table) | Exact cosine, linear scan | none |
51
- | `sqlite-vec` | `.kirograph/vec.db` | ANN (approximate), sub-linear | `better-sqlite3`, `sqlite-vec` (native) |
52
- | `orama` | `.kirograph/orama.json` | Hybrid (full-text + vector) | `@orama/orama`, `@orama/plugin-data-persistence` |
53
- | `pglite` | `.kirograph/pglite/` | Hybrid (full-text + vector), exact | `@electric-sql/pglite` (WASM) |
54
- | `lancedb` | `.kirograph/lancedb/` | ANN (approximate), sub-linear | `@lancedb/lancedb` (pure JS) |
55
- | `qdrant` | `.kirograph/qdrant/` | ANN (HNSW), sub-linear | `qdrant-local` (embedded binary) |
56
- | `typesense` | `.kirograph/typesense/` | ANN (HNSW), sub-linear | `typesense` (auto-downloaded binary) |
57
-
58
- Each engine owns its embedding store exclusively; nothing is written to the SQLite `vectors` table when a non-cosine engine is active. If an engine's optional dependency is not installed, KiroGraph silently falls back to `cosine`.
59
-
60
- Enable and configure via `kirograph install` (interactive arrow-key menu) or directly in `.kirograph/config.json`:
61
-
62
- ```json
63
- {
64
- "enableEmbeddings": true,
65
- "semanticEngine": "pglite"
66
- }
67
- ```
68
-
69
- ### Architecture analysis (opt-in)
70
-
71
- When `enableArchitecture: true` is set, KiroGraph detects the high-level structure of your project (packages and architectural layers) and computes coupling metrics between them. Results are stored in `arch_*` tables inside `kirograph.db` and exposed via dedicated MCP tools and CLI commands.
72
-
73
- Enable via `kirograph install` or directly in `.kirograph/config.json`:
74
-
75
- ```json
76
- {
77
- "enableArchitecture": true
78
- }
79
- ```
80
-
81
- See the [Architecture Analysis](#architecture-analysis-opt-in-1) section below for full details.
82
-
83
- ### Memory (opt-in)
84
-
85
- When `enableMemory: true` is set, KiroGraph stores persistent observations across sessions — decisions, errors, patterns, and architecture notes. Inspired by [cavemem](https://github.com/JuliusBrussee/cavemem) by [Julius Brussee](https://www.linkedin.com/in/julius-brussee/). Observations are:
86
-
87
- - **Compressed** with the caveman grammar (if caveman mode is enabled) — deterministic, no LLM tokens spent
88
- - **Linked to code symbols** — identifiers in observation text are matched against the graph and stored as stable `qualified_name` references
89
- - **Embedded** with the configured semantic engine — enabling natural-language search over past observations
90
- - **Deduplicated** — SHA-256 content hash prevents storing the same observation twice
91
-
92
- Memory surfaces automatically in `kirograph_context` and `kirograph_impact` results when relevant observations are linked to the symbols being queried. The agent can also search memory directly via `kirograph_mem_search` or store new observations via `kirograph_mem_store`.
93
-
94
- Zero LLM tokens on write. ~150-350 tokens per search (vs ~2000-5000 tokens to re-discover context by reading files).
21
+ ## Features
22
+
23
+ | Feature | Description |
24
+ |---------|-------------|
25
+ | <h4>Graph & Analysis (Kirograph-Core)</h4> | |
26
+ | 🕸️ **Semantic Graph** | tree-sitter AST parsing across 33+ languages — functions, classes, call edges, type hierarchies, all in SQLite |
27
+ | 🎯 **Context Building** | One tool call returns entry points, related symbols, and code snippets for any task description |
28
+ | 💥 **Impact Analysis** | Blast-radius traversal before making changes — know what breaks at any depth |
29
+ | 🧬 **Type Hierarchy** | Traverse inheritance chains — base types, derived types, implementations |
30
+ | 🔄 **Circular Dependency Detection** | Find import cycles using Tarjan's SCC algorithm |
31
+ | 💀 **Dead Code Detection** | Find unexported symbols with zero incoming references |
32
+ | 🔥 **Hotspots & Surprises** | Identify most-connected symbols and unexpected cross-module coupling |
33
+ | 🧪 **Affected Tests** | Find test files impacted by source changes — useful in CI and pre-commit hooks |
34
+ | 🌐 **Graph Export** | Interactive browser dashboard with search, clustering, path finding, and analytics |
35
+ | <h4>Semantic Search</h4> | |
36
+ | ⚡ **7 Semantic Engines** | Cosine, sqlite-vec, Orama, PGlite, LanceDB, Qdrant, Typesense — pick the best fit for your project |
37
+ | 🤖 **Custom Embedding Models** | Use any HuggingFace `feature-extraction` model — nomic, Gemma, MiniLM, BGE, or bring your own |
38
+ | <h4>Architecture (Kirograph-Arch opt-in module)</h4> | |
39
+ | 🏛️ **Architecture Analysis** | Package graph, layer detection, coupling metrics (Ca/Ce/instability) |
40
+ | 📸 **Snapshots & Diff** | Save graph state before refactors, diff after to verify structural changes |
41
+ | <h4>Security</h4> | |
42
+ | 🔒 **Security (KiroGraph-Sec opt-in module)** | Goes beyond "this dependency has a CVE" — uses the call graph to determine if vulnerable code is **actually reachable** from your entry points. Maps your **attack surface** (which HTTP routes reach vulnerable deps). Detects **hardcoded secrets** and shows how many entry points expose them. **SAST-lite** finds SQL injection, path traversal, and dangerous eval in your code. **Supply chain health** checks OpenSSF Scorecard scores and detects dependency confusion attacks. Covers 14 ecosystems, outputs CycloneDX SBOM/VEX and CI-ready SARIF reports. |
43
+ | <h4>Knowledge & Data</h4> | |
44
+ | 🧠 **Persistent Memor (KiroGraph-Mem opt-in module)** | Cross-session observations — decisions, errors, patterns — auto-linked to code symbols |
45
+ | 📖 **Documentation Indexing (KiroGraph-Doc opt-in module)** | Section-level retrieval from Markdown, MDX, RST, AsciiDoc, OpenAPI — 92-97% token savings |
46
+ | 📊 **Data Navigation (KiroGraph-Data opt-in module)** | Query CSV/JSON/Excel/Parquet with filters, aggregations, joins — all server-side in SQLite |
47
+ | <h4>Token Optimization</h4> | |
48
+ | 🗜️ **Shell Compression (Kirograph-RTK opt-in module)** | Token-optimized command output (git, tests, linters, docker, AWS) — 60-90% savings |
49
+ | 🪨 **Caveman Mode (Kirograph-Caveman opt-in module)** 🪨 | Agent prose compression (lite → ultra) — fewer tokens on explanations without touching code |
50
+ | 📈 **Token Analytics (Kirograph-Gain core module)** | Track cumulative savings from graph tools and shell compression over time |
51
+ | <h4>Integration (Kirograph-Integration core module)</h4> | |
52
+ | 🔌 **Multi-tool Support** | Native Kiro + 32 experimental targets (Cursor, Copilot, Claude Code, Codex, Windsurf, Cline, and more) |
95
53
 
96
- Enable via `kirograph install` or directly in `.kirograph/config.json`:
97
54
 
98
- ```json
99
- {
100
- "enableMemory": true
101
- }
102
- ```
103
-
104
- See the [Memory](#memory-requires-enablememory-true) section below for full details.
105
-
106
- ### Documentation indexing (opt-in)
107
-
108
- When `enableDocs: true` is set, KiroGraph indexes project documentation by heading hierarchy and section structure. Instead of reading entire doc files, agents retrieve exactly the section they need via stable section IDs. Inspired by [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/).
109
-
110
- - **9 format parsers**: Markdown, MDX, reStructuredText, AsciiDoc, RDoc, Org-mode, HTML, plain text, OpenAPI/Swagger
111
- - **Code ↔ docs cross-references**: Backtick references, CamelCase identifiers, and snake_case patterns in docs are resolved against the code graph
112
- - **Section-level FTS search**: Independent from code search (`kirograph_docs_search`)
113
- - **Stable section IDs**: `{file_path}::{ancestor-chain/slug}#{level}` — stable across re-indexing
114
- - **Token savings**: 92–97% reduction vs reading full doc files (tracked in `kirograph_gain`)
115
-
116
- Enable via `kirograph install` or directly in `.kirograph/config.json`:
117
-
118
- ```json
119
- {
120
- "enableDocs": true
121
- }
122
- ```
123
-
124
- See the [Documentation](#documentation-requires-enabledocs-true) section below for full details.
125
-
126
- ## Installation
127
-
128
- ### From npm (not yet available on npm registry)
129
-
130
- ```bash
131
- npm install -g kirograph
132
- ```
133
-
134
- ### From source
135
-
136
- ```bash
137
- git clone https://github.com/davide-desio-eleva/kirograph.git
138
- cd kirograph
139
- npm install
140
- npm run build
141
- sudo npm install -g .
142
- ```
143
-
144
- After building, the `kirograph` and `kg` commands are available globally.
145
-
146
- ### Verify
147
-
148
- ```bash
149
- kirograph --version
150
- ```
151
-
152
- ## Uninstallation
153
-
154
- ### Remove from a project
55
+ ## Quick Start
155
56
 
156
57
  ```bash
157
- kirograph uninit [path] # Prompts to remove Kiro integration files and .kirograph/ data separately
158
- kirograph uninit --force # Remove Kiro integration files + .kirograph/ data without confirmation
159
- kirograph uninit --target all --force # Remove all integration files (Kiro + Claude + Codex) + .kirograph/ data
58
+ kirograph install # auto-detects your AI tools and configures them all
160
59
  ```
161
60
 
162
- `kirograph uninstall` is an alias for `kirograph uninit`.
163
-
164
- Without `--force`, KiroGraph asks separately whether to remove the selected tool integration files and whether to remove the shared `.kirograph/` data. With `--force`, both are removed unconditionally.
165
-
166
- This can remove:
167
- - `.kirograph/`: index database, snapshots, and export directory
168
- - Kiro target: `.kiro/hooks/kirograph-*.json`, `.kiro/steering/kirograph.md`, `.kiro/agents/kirograph.json`
169
- - Claude target (experimental): `kirograph` from `.mcp.json`, plus the KiroGraph import from `CLAUDE.md`
170
- - Codex target (experimental): the generated KiroGraph block from `AGENTS.md`
171
-
172
- ### Remove the CLI globally
173
-
174
- If installed from npm:
61
+ Or target a specific platform:
175
62
 
176
63
  ```bash
177
- npm uninstall -g kirograph
64
+ kirograph install --target kiro # Kiro only
65
+ kirograph install --target cursor # Cursor only
66
+ kirograph install --target claude # Claude Code only
67
+ kirograph install --all # all detected platforms (no prompt)
178
68
  ```
179
69
 
180
- If installed from source:
70
+ Or using the short alias:
181
71
 
182
72
  ```bash
183
- cd kirograph
184
- npm uninstall -g .
73
+ kg install
185
74
  ```
186
75
 
187
- ## Quick Start
188
-
189
- ```bash
190
- # In your project:
191
- kirograph install # wire up Kiro MCP + hooks + steering + CLI agent
192
- ```
76
+ All Kiro integration files are written to `.kiro/`. Restart Kiro IDE, or switch to the `kirograph` agent in Kiro CLI.
193
77
 
194
- All Kiro integration files are written to `.kiro/`. Restart Kiro IDE, or switch to the `kirograph` agent in Kiro CLI. It will now use KiroGraph tools automatically.
78
+ ## Documentation
195
79
 
196
- Or using the short alias:
80
+ 📖 **[Full documentation on GitHub Pages](https://davide-desio-eleva.github.io/kirograph/)**
197
81
 
198
- ```bash
199
- kg install
200
- ```
82
+ | Page | Description |
83
+ |------|-------------|
84
+ | [Installation](docs/guide/installation.md) | Install from npm or source, uninstall, verify |
85
+ | [How It Works](docs/guide/how-it-works.md) | Indexing layers (structural, semantic, architecture, memory, docs, data) |
86
+ | [Integrations](docs/guide/integrations.md) | Kiro setup, 34 other tools, auto-detection |
87
+ | [Comparison](docs/guide/comparison.md) | Feature comparison vs CodeGraph, code-review-graph, and others |
88
+ | [MCP Tools](docs/guide/mcp-tools.md) | Full reference for all MCP tools |
89
+ | [CLI Reference](docs/guide/cli.md) | All CLI commands with examples |
90
+ | [Configuration](docs/guide/configuration.md) | Config fields, semantic engines, architecture analysis |
91
+ | [Security](docs/guide/security.md) | Full SCA+: 14 ecosystems, EPSS, reachability, attack surface, secrets, SAST-lite, supply chain, SBOM/VEX/SARIF |
92
+ | [Languages & Frameworks](docs/guide/languages.md) | Supported languages, frameworks, and detection |
93
+ | [Changelog](CHANGELOG.md) | Release history |
94
+ | [Contributing](CONTRIBUTING.md) | How to contribute |
95
+ | [Code of Conduct](CODE_OF_CONDUCT.md) | Community guidelines |
96
+ | [Security](SECURITY.md) | Security policy |
201
97
 
202
98
  ## How It Works
203
99
 
@@ -222,1464 +118,66 @@ kg install
222
118
  └───────────────────────────────────────────┘
223
119
  ```
224
120
 
225
- A single Kiro hook triggers on `agentStop` and asks the agent to sync the index if any source files were changed during the session. No per-file hooks, no background watcher — zero overhead during active editing.
226
-
227
- ## Using with Kiro
228
-
229
- `kirograph install` or `kirograph install --target kiro` sets up four things in your Kiro workspace (all coexist, so you can switch between IDE and CLI freely):
230
-
231
- ### MCP Server (`.kiro/settings/mcp.json`)
232
-
233
- Registers the KiroGraph MCP server. Used by both the IDE and the CLI agent:
234
-
235
- ```json
236
- {
237
- "mcpServers": {
238
- "kirograph": {
239
- "command": "kirograph",
240
- "args": ["serve", "--mcp"],
241
- "autoApprove": [
242
- "kirograph_search", "kirograph_context", "kirograph_callers",
243
- "kirograph_callees", "kirograph_impact", "kirograph_node",
244
- "kirograph_status", "kirograph_files", "kirograph_dead_code",
245
- "kirograph_circular_deps", "kirograph_path", "kirograph_type_hierarchy",
246
- "kirograph_architecture", "kirograph_coupling", "kirograph_package",
247
- "kirograph_hotspots", "kirograph_surprising", "kirograph_diff",
248
- "kirograph_exec", "kirograph_gain"
249
- "kirograph_mem_search", "kirograph_mem_store",
250
- "kirograph_mem_timeline", "kirograph_mem_status"
251
- ]
252
- }
253
- }
254
- }
255
- ```
256
-
257
- ### IDE Hooks (`.kiro/hooks/`)
258
-
259
- Up to two hooks are installed (`.kiro.hook` extension):
260
-
261
- | Hook file | Event | Type | Behavior |
262
- |-----------|-------|------|----------|
263
- | `kirograph-sync-if-dirty.kiro.hook` | `agentStop` | `runCommand` | Runs `kirograph sync --quiet` when the agent stops, syncing any file changes from the session. The sync command skips unchanged files via content hashing, so it's fast even when nothing changed. |
264
- | `kirograph-compress-hint.kiro.hook` | `preToolUse` (shell) | `askAgent` | Reminds the agent to use `kirograph_exec` for commands that benefit from token compression (git, gh, test, lint, build, docker, aws, grep). Only installed when shell compression is enabled. |
265
-
266
- The sync hook replaces the previous per-file approach (mark-dirty-on-save, mark-dirty-on-create, sync-on-delete). A single `agentStop` hook handles all file changes in one pass with zero overhead during active editing.
267
-
268
- ### CLI Agent Config (`.kiro/agents/kirograph.json`)
269
-
270
- A custom agent for Kiro CLI that wires up the MCP server, references the steering file as a resource, and handles sync in the CLI's own hook format. The CLI has no file-watch events, so syncing is handled at session boundaries:
271
-
272
- | Event | Action |
273
- |-------|--------|
274
- | `agentSpawn` | `kirograph sync-if-dirty --quiet` (catches edits made between sessions) |
275
- | `userPromptSubmit` | `kirograph sync-if-dirty --quiet` (keeps graph fresh within a session) |
276
- | `stop` | `kirograph sync-if-dirty --quiet` (deferred flush, mirrors IDE `agentStop`) |
277
-
278
- Use it with:
279
-
280
- ```bash
281
- kiro-cli --agent kirograph
282
- ```
283
-
284
- Or swap to it inside an active session:
285
-
286
- ```
287
- /agent swap kirograph
288
- ```
289
-
290
- > Note: restart `kiro-cli` after running `kirograph install` for the agent to be picked up.
291
-
292
- ### Steering File (`.kiro/steering/kirograph.md`)
293
-
294
- Teaches the Kiro IDE to prefer graph tools over file scanning when `.kirograph/` exists. The CLI agent has the same instructions inlined directly in its `prompt` field.
295
-
296
- ## Other Tools (Experimental)
297
-
298
- > **⚠️ Not fully tested, community-contributed.** The integrations below are outside the original scope of KiroGraph. They are provided as-is. Issues and PRs related to these targets are welcome, but there is no guarantee they will be supported or merged without active help from the contributor.
299
-
300
- KiroGraph can also be installed for other MCP-capable coding agents. All targets share the same `.kirograph/` data; if the project is already initialized, installing another target only writes that tool's integration files and reuses the existing graph.
301
-
302
- ```bash
303
- kirograph install --target claude # wire up Claude Code MCP + project memory
304
- kirograph install --target codex # write Codex instructions and print MCP config
305
- ```
306
-
307
- ### Using with Claude Code
308
-
309
- ```bash
310
- kirograph install --target claude
311
- ```
312
-
313
- This writes:
314
-
315
- - `.mcp.json`: project-scoped MCP server config for Claude Code
316
- - `.kirograph/claude.md`: KiroGraph tool guidance
317
- - `CLAUDE.md`: an import of `.kirograph/claude.md`
318
-
319
- Claude Code prompts for project MCP approval the first time it sees `.mcp.json`.
320
-
321
- ### Using with Codex
322
-
323
- ```bash
324
- kirograph install --target codex
325
- ```
326
-
327
- This writes:
328
-
329
- - `.kirograph/codex.md`: KiroGraph tool guidance
330
- - `AGENTS.md`: a generated KiroGraph instruction block
331
-
332
- Codex MCP configuration is user-scoped, so the installer prints the exact `codex mcp add ...` command and equivalent `~/.codex/config.toml` snippet instead of editing files outside the project.
333
-
334
- ## MCP Tools
335
-
336
- All tools are auto-approved in Kiro once installed. Other MCP clients can use the same tools after configuring their respective targets.
337
-
338
- ### `kirograph_context`
339
-
340
- Comprehensive context for a task or feature, often sufficient alone without additional tool calls.
341
-
342
- | Parameter | Type | Default | Description |
343
- |-----------|------|---------|-------------|
344
- | `task` | string | required | Task, bug, or feature description |
345
- | `maxNodes` | number | 20 | Max symbols to include |
346
- | `includeCode` | boolean | true | Include code snippets |
347
- | `projectPath` | string | cwd | Project root path |
348
-
349
- **How it works:** Extracts symbol tokens from the task description (CamelCase, snake_case, SCREAMING_SNAKE, dot.notation) → runs exact name lookup + FTS + **vector search** against the active semantic engine → resolves imports to their definitions → expands through the graph to related symbols → returns entry points, related nodes, edges, and code snippets. This is the only tool that uses the vector engine on every call.
350
-
351
- ### `kirograph_search`
352
-
353
- Quick symbol search by name. Returns locations only, no code.
354
-
355
- | Parameter | Type | Default | Description |
356
- |-----------|------|---------|-------------|
357
- | `query` | string | required | Symbol name or partial name |
358
- | `kind` | string | - | Filter: `function`, `method`, `class`, `interface`, `type_alias`, `variable`, `route`, `component` |
359
- | `limit` | number | 10 | Max results (1–100) |
360
- | `projectPath` | string | cwd | Project root path |
361
-
362
- **How it works:** Exact name match → SQLite FTS → LIKE fallback → **vector search** only if all three return nothing. Pure graph database lookup in the common case; vector engine only as a last resort.
363
-
364
- ### `kirograph_callers`
365
-
366
- Find all functions/methods that call a specific symbol.
367
-
368
- | Parameter | Type | Default | Description |
369
- |-----------|------|---------|-------------|
370
- | `symbol` | string | required | Symbol name |
371
- | `limit` | number | 20 | Max results (1–100) |
372
- | `projectPath` | string | cwd | Project root path |
373
-
374
- **How it works:** BFS traversal of incoming `call` edges in the graph database; no vector engine involved.
375
-
376
- ### `kirograph_callees`
377
-
378
- Find all functions/methods that a specific symbol calls.
379
-
380
- | Parameter | Type | Default | Description |
381
- |-----------|------|---------|-------------|
382
- | `symbol` | string | required | Symbol name |
383
- | `limit` | number | 20 | Max results (1–100) |
384
- | `projectPath` | string | cwd | Project root path |
385
-
386
- **How it works:** BFS traversal of outgoing `call` edges in the graph database; no vector engine involved.
387
-
388
- ### `kirograph_impact`
389
-
390
- Analyze what code would be affected by changing a symbol. Use before making changes.
391
-
392
- | Parameter | Type | Default | Description |
393
- |-----------|------|---------|-------------|
394
- | `symbol` | string | required | Symbol name |
395
- | `depth` | number | 2 | Traversal depth |
396
- | `projectPath` | string | cwd | Project root path |
397
-
398
- **How it works:** BFS traversal of all incoming edges (`call`, `import`, `reference`, etc.) up to the specified depth; no vector engine involved.
399
-
400
- ### `kirograph_node`
401
-
402
- Get details about a specific symbol, optionally including source code.
403
-
404
- | Parameter | Type | Default | Description |
405
- |-----------|------|---------|-------------|
406
- | `symbol` | string | required | Symbol name |
407
- | `includeCode` | boolean | false | Include source code |
408
- | `projectPath` | string | cwd | Project root path |
409
-
410
- Returns: kind, name, qualified name, file location, signature, docstring, and optionally source code.
411
-
412
- **How it works:** Single row lookup by symbol name in the graph database. If `includeCode` is true, reads the relevant lines directly from the source file on disk; no vector engine involved.
413
-
414
- ### `kirograph_type_hierarchy`
415
-
416
- Traverse the type hierarchy of a class or interface.
417
-
418
- | Parameter | Type | Default | Description |
419
- |-----------|------|---------|-------------|
420
- | `symbol` | string | required | Class or interface name |
421
- | `direction` | string | `both` | `up` (base types), `down` (derived types), `both` |
422
- | `projectPath` | string | cwd | Project root path |
423
-
424
- **How it works:** Recursive traversal of `extends` and `implements` edges in the graph database; no vector engine involved.
425
-
426
- ### `kirograph_path`
427
-
428
- Find the shortest path between two symbols in the dependency graph.
429
-
430
- | Parameter | Type | Default | Description |
431
- |-----------|------|---------|-------------|
432
- | `from` | string | required | Source symbol name |
433
- | `to` | string | required | Target symbol name |
434
- | `projectPath` | string | cwd | Project root path |
435
-
436
- **How it works:** BFS shortest-path search across all edge types in the graph database; no vector engine involved.
437
-
438
- ### `kirograph_dead_code`
439
-
440
- Find symbols with no incoming references (potential dead code). Only unexported symbols are considered.
441
-
442
- | Parameter | Type | Default | Description |
443
- |-----------|------|---------|-------------|
444
- | `limit` | number | 50 | Max results (1–100) |
445
- | `projectPath` | string | cwd | Project root path |
446
-
447
- **How it works:** Queries the graph database for nodes with zero incoming edges, filtered to non-exported symbols; no vector engine involved.
448
-
449
- ### `kirograph_circular_deps`
450
-
451
- Find circular import dependencies in the codebase.
452
-
453
- | Parameter | Type | Default | Description |
454
- |-----------|------|---------|-------------|
455
- | `projectPath` | string | cwd | Project root path |
456
-
457
- **How it works:** Tarjan's strongly connected components algorithm over `import` edges in the graph database; no vector engine involved.
458
-
459
- ### `kirograph_files`
460
-
461
- List the indexed file structure with filtering and format options.
462
-
463
- | Parameter | Type | Default | Description |
464
- |-----------|------|---------|-------------|
465
- | `filterPath` | string | - | Filter by directory prefix (e.g., `src/`) |
466
- | `pattern` | string | - | Filter by glob pattern (e.g., `**/*.ts`) |
467
- | `maxDepth` | number | - | Limit tree depth |
468
- | `format` | string | `tree` | `tree`, `flat`, or `grouped` |
469
- | `includeMetadata` | boolean | true | Include language and symbol counts |
470
- | `projectPath` | string | cwd | Project root path |
471
-
472
- **How it works:** Reads file records from the graph database and builds a tree structure in memory. Filtering is applied before tree construction; no vector engine involved.
473
-
474
- ### `kirograph_status`
475
-
476
- Check index health and statistics: files indexed, symbol count, edge count, breakdown by kind and language, frameworks detected, database size, and semantic search status.
477
-
478
- | Parameter | Type | Default | Description |
479
- |-----------|------|---------|-------------|
480
- | `projectPath` | string | cwd | Project root path |
481
-
482
- **How it works:** Reads aggregate counts from the graph database + calls `count()` on the active vector engine to report embedding coverage. No graph traversal, no vector search.
483
-
484
- ### `kirograph_architecture` *(requires `enableArchitecture: true`)*
485
-
486
- Get the full architecture overview: detected packages, layers, and the dependency graph between them.
487
-
488
- | Parameter | Type | Default | Description |
489
- |-----------|------|---------|-------------|
490
- | `projectPath` | string | cwd | Project root path |
491
-
492
- Returns: packages (with source, language, version, external deps, file membership), layers (with file counts and detection patterns), package dependency edges, layer dependency edges, and per-file package/layer assignments.
493
-
494
- **How it works:** Reads the `arch_*` tables populated during the last `kirograph index` run. Returns nothing useful if architecture analysis was not enabled at index time.
495
-
496
- ### `kirograph_coupling` *(requires `enableArchitecture: true`)*
497
-
498
- Get coupling metrics for all packages or a specific one.
499
-
500
- | Parameter | Type | Default | Description |
501
- |-----------|------|---------|-------------|
502
- | `packageId` | string | - | Package ID (e.g. `pkg:npm:src/auth`). Omit for all packages. |
503
- | `projectPath` | string | cwd | Project root path |
504
-
505
- Returns per-package: **Ca** (afferent: how many other packages depend on this one), **Ce** (efferent: how many packages this one depends on), and **instability** (`Ce / (Ca + Ce)`, 0 = maximally stable, 1 = maximally unstable). When `packageId` is given, also returns the full list of incoming and outgoing package dependencies.
506
-
507
- ### `kirograph_package` *(requires `enableArchitecture: true`)*
508
-
509
- Inspect the files and dependencies of a specific package.
510
-
511
- | Parameter | Type | Default | Description |
512
- |-----------|------|---------|-------------|
513
- | `packageId` | string | required | Package ID (e.g. `pkg:npm:src/auth`) |
514
- | `projectPath` | string | cwd | Project root path |
515
-
516
- Returns: package metadata, all files assigned to the package, packages it depends on (with import counts), and packages that depend on it.
517
-
518
- ### `kirograph_hotspots`
519
-
520
- Find the most-connected symbols by total edge degree (incoming + outgoing). Excludes structural `contains` edges.
521
-
522
- | Parameter | Type | Default | Description |
523
- |-----------|------|---------|-------------|
524
- | `limit` | number | 20 | Max results (1–100) |
525
- | `projectPath` | string | cwd | Project root path |
526
-
527
- Returns each symbol with total degree, in-degree, and out-degree. Useful for identifying core abstractions and high blast-radius code before making changes.
528
-
529
- ### `kirograph_surprising`
530
-
531
- Find non-obvious cross-file connections: direct edges between symbols in structurally distant files.
532
-
533
- | Parameter | Type | Default | Description |
534
- |-----------|------|---------|-------------|
535
- | `limit` | number | 20 | Max results (1–100) |
536
- | `projectPath` | string | cwd | Project root path |
537
-
538
- **How it works:** Queries all cross-file edges (excluding `contains` and `import`). Scores each by path distance between source and target files × edge-kind weight (`calls=1.0`, `references=0.8`, `type_of=0.7`, etc.). Returns the highest-scoring unique pairs. the ones that represent the most unexpected coupling in the codebase.
539
-
540
- ### `kirograph_diff`
541
-
542
- Compare the current graph state against a saved snapshot. Shows added/removed symbols and edges.
543
-
544
- | Parameter | Type | Default | Description |
545
- |-----------|------|---------|-------------|
546
- | `snapshot` | string | latest | Snapshot label. Omit to use the most recent saved snapshot. |
547
- | `projectPath` | string | cwd | Project root path |
548
-
549
- Use `kirograph snapshot save` (CLI) to save a snapshot before a refactor or PR. Run `kirograph_diff` after to see what changed structurally.
550
-
551
- ### `kirograph_exec`
552
-
553
- Run a shell command and return token-optimized output. Automatically filters noise from git, test runners, linters, build tools, docker, and package managers.
554
-
555
- | Parameter | Type | Default | Description |
556
- |-----------|------|---------|-------------|
557
- | `command` | string | required | Shell command to execute |
558
- | `cwd` | string | project root | Working directory |
559
- | `level` | string | `normal` | Compression level: `normal`, `aggressive`, `ultra` |
560
- | `timeout` | number | 60 | Timeout in seconds |
561
- | `projectPath` | string | cwd | Project root path |
562
-
563
- **How it works:** Executes the command, detects the command family (git, test, lint, etc.), applies the appropriate filter strategy, and returns compressed output with a savings footer. Error output is always preserved. Does not require KiroGraph to be initialized, works standalone.
564
-
565
- ### `kirograph_gain`
566
-
567
- Show token savings statistics from compressed command outputs.
568
-
569
- | Parameter | Type | Default | Description |
570
- |-----------|------|---------|-------------|
571
- | `period` | string | `session` | Time period: `session`, `today`, `week`, `all` |
572
- | `projectPath` | string | cwd | Project root path |
573
-
574
- Returns total commands, original/compressed token counts, savings percentage, breakdown by command family, and recent command history.
575
-
576
- ### `kirograph_mem_search` *(requires `enableMemory: true`)*
577
-
578
- Search project memory for past decisions, errors, patterns, and context.
579
-
580
- | Parameter | Type | Default | Description |
581
- |-----------|------|---------|-------------|
582
- | `query` | string | required | Natural language search query |
583
- | `kind` | string | - | Filter: `decision`, `error`, `pattern`, `architecture`, `summary`, `note` |
584
- | `limit` | number | 10 | Max results |
585
- | `sessionId` | string | - | Filter to specific session |
586
- | `projectPath` | string | cwd | Project root path |
587
-
588
- **How it works:** Hybrid search combining FTS5 keyword matching and vector cosine similarity (using the configured semantic engine). Results are ranked by a blended score (configurable via `memorySearchAlpha`). Falls back to FTS-only if embeddings are disabled or model mismatch is detected.
589
-
590
- ### `kirograph_mem_store` *(requires `enableMemory: true`)*
591
-
592
- Store an observation in project memory. Content is automatically compressed (if caveman mode is on) and linked to relevant code symbols.
593
-
594
- | Parameter | Type | Default | Description |
595
- |-----------|------|---------|-------------|
596
- | `content` | string | required | Observation text |
597
- | `kind` | string | `note` | `decision`, `error`, `pattern`, `architecture`, `summary`, `note` |
598
- | `projectPath` | string | cwd | Project root path |
599
-
600
- **How it works:** Strips `<private>` blocks → applies caveman compression (if enabled) → computes SHA-256 hash for deduplication → stores in `mem_observations` → detects symbol identifiers and creates `mem_links` → embeds with the configured model. Zero LLM tokens consumed.
601
-
602
- ### `kirograph_mem_timeline` *(requires `enableMemory: true`)*
603
-
604
- List recent sessions and their observations chronologically.
605
-
606
- | Parameter | Type | Default | Description |
607
- |-----------|------|---------|-------------|
608
- | `limit` | number | 5 | Number of sessions to show |
609
- | `sessionId` | string | - | Show observations for a specific session |
610
- | `projectPath` | string | cwd | Project root path |
611
-
612
- ### `kirograph_mem_status` *(requires `enableMemory: true`)*
613
-
614
- Memory subsystem health: session count, observations, embedding coverage, model mismatch detection.
615
-
616
- | Parameter | Type | Default | Description |
617
- |-----------|------|---------|-------------|
618
- | `projectPath` | string | cwd | Project root path |
619
-
620
- ### `kirograph_docs_toc` *(requires `enableDocs: true`)*
621
-
622
- Get table of contents for a documentation file or the whole project. Returns section IDs, titles, levels, and summaries.
623
-
624
- | Parameter | Type | Default | Description |
625
- |-----------|------|---------|-------------|
626
- | `file` | string | - | Filter to a specific doc file (relative path). Omit for project-wide TOC. |
627
- | `tree` | boolean | false | Return nested tree structure |
628
- | `projectPath` | string | cwd | Project root path |
629
-
630
- ### `kirograph_docs_search` *(requires `enableDocs: true`)*
631
-
632
- Search documentation sections by query. Returns matching sections ranked by relevance. Independent from `kirograph_search` (code-only).
633
-
634
- | Parameter | Type | Default | Description |
635
- |-----------|------|---------|-------------|
636
- | `query` | string | required | Search query (natural language or keywords) |
637
- | `file` | string | - | Narrow search to a specific doc file |
638
- | `limit` | number | 10 | Max results |
639
- | `projectPath` | string | cwd | Project root path |
640
-
641
- ### `kirograph_docs_section` *(requires `enableDocs: true`)*
642
-
643
- Retrieve full content of a documentation section by its stable ID. Use `context=true` to also get ancestor headings and child summaries.
644
-
645
- | Parameter | Type | Default | Description |
646
- |-----------|------|---------|-------------|
647
- | `id` | string | required | Section ID (from `kirograph_docs_toc` or `kirograph_docs_search` results) |
648
- | `context` | boolean | false | Include ancestor heading chain and child summaries |
649
- | `projectPath` | string | cwd | Project root path |
650
-
651
- ### `kirograph_docs_outline` *(requires `enableDocs: true`)*
652
-
653
- Get the heading hierarchy for a single documentation file. Lighter than full TOC when you know which file is relevant.
654
-
655
- | Parameter | Type | Default | Description |
656
- |-----------|------|---------|-------------|
657
- | `file` | string | required | Relative path to the doc file |
658
- | `projectPath` | string | cwd | Project root path |
659
-
660
- ### `kirograph_docs_refs` *(requires `enableDocs: true`)*
661
-
662
- Find code symbols referenced by a doc section, or doc sections that reference a code symbol. Bidirectional lookup.
663
-
664
- | Parameter | Type | Default | Description |
665
- |-----------|------|---------|-------------|
666
- | `sectionId` | string | - | Doc section ID (find code symbols it references) |
667
- | `nodeId` | string | - | Code symbol qualified name (find doc sections that reference it) |
668
- | `projectPath` | string | cwd | Project root path |
121
+ ## What Gets Indexed?
669
122
 
670
- ## CLI Reference
123
+ KiroGraph uses [tree-sitter](https://tree-sitter.github.io/tree-sitter/) to parse your source files into an AST and extract:
671
124
 
672
- ### Setup
125
+ - **Nodes**: functions, methods, classes, interfaces, types, enums, variables, constants, routes, components, dependencies, vulnerabilities, and more (26 node kinds total)
126
+ - **Edges**: calls, imports, exports, extends, implements, contains, references, instantiates, overrides, decorates, type_of, returns
673
127
 
674
- ```bash
675
- kirograph install # Wire up MCP + hooks + steering in .kiro/
676
- kirograph init [path] # Initialize .kirograph/ in a project
677
- kirograph init --index # Initialize and index immediately
678
- kirograph uninit [path] # Prompts to remove integration files and .kirograph/ data
679
- kirograph uninit --force # Remove everything without confirmation
680
- ```
128
+ Everything is stored in a local SQLite database (`.kirograph/kirograph.db`). **Nothing leaves your machine.** No API keys. No external services.
681
129
 
682
- ### Indexing
130
+ ## Requirements
683
131
 
684
- ```bash
685
- kirograph index [path] # Full re-index of the project
686
- kirograph index --force # Force re-index all files (ignore hash cache)
687
- kirograph sync [path] # Incremental sync of changed files
688
- kirograph sync --files a.ts b.ts # Sync specific files only
689
- kirograph sync-if-dirty [path] # Sync only if a dirty marker is present
690
- kirograph mark-dirty [path] # Write a dirty marker for deferred sync
691
- ```
132
+ - Node.js >= 18
133
+ - Kiro IDE (fully supported)
134
+ - Other MCP-capable tools (experimental — see [Integrations](docs/guide/integrations.md))
692
135
 
693
- ### Status & Maintenance
136
+ ## Credits
694
137
 
695
- ```bash
696
- kirograph status [path] # Show index stats (files, symbols, edges, frameworks)
697
- kirograph unlock [path] # Force-release a stale lock file
698
- ```
138
+ KiroGraph is inspired by [CodeGraph](https://github.com/colbymchenry/codegraph) by [Colby McHenry](https://www.linkedin.com/in/colby-mchenry/). The original concept of building a semantic code graph for AI coding agents comes from his work.
699
139
 
700
- ### Search & Exploration
140
+ ### Inspirations
701
141
 
702
- ```bash
703
- kirograph query <term> # Search symbols by name
704
- kirograph query <term> --kind class # Filter by kind
705
- kirograph query <term> --limit 20 # Limit results (default: 10)
706
- ```
142
+ - [cavemem](https://github.com/JuliusBrussee/cavemem) by [Julius Brussee](https://www.linkedin.com/in/julius-brussee/): the memory module's hook-based observation capture, deterministic compression, and SQLite storage pattern.
143
+ - [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/): the documentation module's section-first retrieval approach, stable section IDs, and byte-offset addressing.
144
+ - [jDataMunch-MCP](https://github.com/jgravelle/jdatamunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/): the data module's column profiling, streaming parsers, and server-side aggregation approach.
145
+ - [code-review-graph](https://github.com/tirth8205/code-review-graph) by [Tirth Kanani](https://github.com/tirth8205): community detection, execution flow tracing, refactoring tools, and multi-platform auto-detection patterns.
146
+ - [lean-ctx](https://github.com/yvgude/lean-ctx) by [Yves Gugger](https://github.com/yvgude): file read caching, multiple read modes, and context budget governance concepts.
707
147
 
708
- Supported kinds: `function`, `method`, `class`, `struct`, `interface`, `trait`, `protocol`, `enum`, `type_alias`, `property`, `field`, `variable`, `constant`, `enum_member`, `parameter`, `import`, `export`, `route`, `component`, `file`, `module`, `namespace`
148
+ ### Contributors
709
149
 
710
- ### File Structure
150
+ - [Alessandro Franceschi](https://www.linkedin.com/in/alessandrofranceschi/) — Claude Code and Codex integration, Elixir/Phoenix language and framework support.
151
+ - [Mauro Argo](https://www.linkedin.com/in/argomauro/) — original idea for the architecture layer analysis feature.
711
152
 
712
- ```bash
713
- kirograph files [path] # Show indexed file tree
714
- kirograph files --format flat # Flat list of all files
715
- kirograph files --format grouped # Files grouped by language
716
- kirograph files --filter src/components # Filter by directory prefix
717
- kirograph files --pattern "**/*.test.ts" # Filter by glob pattern
718
- kirograph files --max-depth 2 # Limit tree depth
719
- kirograph files --no-metadata # Hide language/symbol counts
720
- kirograph files --json # Output as JSON
721
- ```
153
+ ## How It Compares
722
154
 
723
- ### Context Building
155
+ KiroGraph combines capabilities from 7 separate tools into one integrated MCP server:
724
156
 
725
- ```bash
726
- kirograph context "fix checkout bug"
727
- kirograph context "add user authentication" --format json
728
- kirograph context "refactor payment service" --max-nodes 30
729
- kirograph context "validate token" --no-code
730
- ```
157
+ | Capability | Inspired by | What KiroGraph adds |
158
+ |-----------|-------------|---------------------|
159
+ | Code graph | [CodeGraph](https://github.com/colbymchenry/codegraph) | Architecture metrics, community detection, execution flows |
160
+ | Memory | [cavemem](https://github.com/JuliusBrussee/cavemem) | Symbol-linked observations, 7 semantic engines |
161
+ | Docs | [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) | Code ↔ docs cross-references |
162
+ | Data | [jDataMunch-MCP](https://github.com/jgravelle/jdatamunch-mcp) | Unified with code graph in one server |
163
+ | Shell compression | [rtk](https://github.com/rtk-ai/rtk) | Integrated as MCP tool, no separate binary |
164
+ | Prose compression | [caveman](https://github.com/JuliusBrussee/caveman) | Multi-level (lite/full/ultra) via steering |
165
+ | Context layer | [lean-ctx](https://github.com/yvgude/lean-ctx) | File caching, read modes, budget governance |
731
166
 
732
- Extracts symbol tokens from the task description (CamelCase, snake_case, SCREAMING_SNAKE, dot.notation), finds relevant entry points, expands through the graph, and outputs structured markdown or JSON.
167
+ See the [full comparison](docs/guide/comparison.md) for a detailed feature matrix against CodeGraph, code-review-graph, jCodeMunch, and others.
733
168
 
734
- ### Affected Tests
169
+ ## Star History
735
170
 
736
- Find test files that depend on changed source files, useful in CI or pre-commit hooks.
171
+ <a href="https://www.star-history.com/?repos=davide-desio-eleva%2Fkirograph&type=date&legend=top-left"><picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=davide-desio-eleva/kirograph&type=date&theme=dark&legend=top-left" /><source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=davide-desio-eleva/kirograph&type=date&legend=top-left" /><img alt="Star History Chart" src="https://api.star-history.com/chart?repos=davide-desio-eleva/kirograph&type=date&legend=top-left" /></picture></a>
737
172
 
738
- ```bash
739
- kirograph affected src/utils.ts src/api.ts # Pass files as arguments
740
- git diff --name-only | kirograph affected --stdin # Pipe from git diff
741
- kirograph affected --stdin --json < changed.txt # JSON output
742
- kirograph affected src/auth.ts --filter "e2e/**" # Custom test file glob
743
- kirograph affected src/lib.ts --depth 3 --quiet # Paths only, shallow traversal
744
- ```
173
+ ## License
745
174
 
746
- | Option | Description | Default |
747
- |--------|-------------|---------|
748
- | `--stdin` | Read file list from stdin, one per line | false |
749
- | `-d, --depth <n>` | Max dependency traversal depth | 5 |
750
- | `-f, --filter <glob>` | Custom glob to identify test files | auto-detect |
751
- | `-j, --json` | Output as JSON | false |
752
- | `-q, --quiet` | Output file paths only | false |
753
- | `-p, --path <path>` | Project path | cwd |
754
-
755
- Example CI integration:
756
-
757
- ```bash
758
- #!/usr/bin/env bash
759
- AFFECTED=$(git diff --name-only HEAD | kirograph affected --stdin --quiet)
760
- if [ -n "$AFFECTED" ]; then
761
- npx vitest run $AFFECTED
762
- fi
763
- ```
764
-
765
- ### 🪨 Caveman Mode 🪨
766
-
767
- ![KiroGraph caveman](https://raw.githubusercontent.com/davide-desio-eleva/kirograph/main/assets/caveman.png)
768
-
769
- Caveman mode compresses the agent's communication style, cutting token usage on responses without affecting tool calls or code output. Inspired by [caveman](https://github.com/JuliusBrussee/caveman) 🪨 by [JuliusBrussee](https://github.com/JuliusBrussee).
770
-
771
- **Why it's useful:** KiroGraph's graph tools return compact, structured data. The bottleneck in long coding sessions isn't the tool calls; it is the verbose prose the agent wraps around them. Caveman mode strips that overhead so you get the signal without the filler. The rules are injected at session start via the steering file (IDE) and the inline agent prompt (kiro-cli), so they're always in context with no extra tool calls.
772
-
773
- Four levels:
774
-
775
- | Mode | Style |
776
- |------|-------|
777
- | `off` | Normal responses *(default)* |
778
- | `lite` | Compact, no filler, full sentences |
779
- | `full` | Fragments, no articles, short synonyms |
780
- | `ultra` | Maximum compression, abbreviations, `→` for causality |
781
-
782
- ```bash
783
- kirograph caveman lite # compact, still readable
784
- kirograph caveman full # fragments, no articles
785
- kirograph caveman ultra # maximum compression
786
- kirograph caveman off # back to normal
787
- kirograph caveman # show current mode
788
- ```
789
-
790
- Set during `kirograph install` (interactive arrow-key menu) or any time after. Takes effect on the next agent session.
791
-
792
- Caveman mode never touches code blocks, file paths, URLs, or technical terms, only prose.
793
-
794
- **Auto-clarity exceptions:** the agent temporarily reverts to normal prose for security warnings, confirmations of irreversible actions (delete, overwrite, force-push), and multi-step sequences where fragment order could cause misunderstanding. Compressed style resumes immediately after.
795
-
796
- ### Shell Compression (`kirograph_exec`)
797
-
798
- ![KiroGraph caveman](https://raw.githubusercontent.com/davide-desio-eleva/kirograph/main/assets/rtk.png)
799
-
800
- KiroGraph includes a built-in shell compression engine inspired by [rtk](https://github.com/rtk-ai/rtk). The `kirograph_exec` MCP tool runs shell commands and returns token-optimized output, saving 60-90% of tokens on verbose commands like git, test runners, linters, and build tools.
801
-
802
- **Why it's useful:** LLM context is expensive. A raw `git status` might be 2,000 tokens; compressed it's 200. A passing test suite might be 25,000 tokens of noise; compressed it's a single "PASSED: 42/42 tests" line. The compression engine knows how to extract the signal from each command family.
803
-
804
- Supported command families:
805
-
806
- | Family | Commands | Typical savings |
807
- |--------|----------|----------------|
808
- | Git | status, log, diff, push, pull, commit, add, fetch, branch, stash | 75-96% |
809
- | GitHub CLI | gh pr list/view, gh issue list, gh run list/view | 60-80% |
810
- | Test runners | jest, vitest, pytest, cargo test, go test, rspec, minitest, playwright | 80-90% |
811
- | Linters/build | eslint, tsc, ruff, clippy, cargo build, prettier, biome, golangci-lint, rubocop, next build | 70-85% |
812
- | File listings | ls, find, tree | 60-80% |
813
- | Search | grep, rg/ripgrep (grouped by file) | 60-80% |
814
- | Diff | diff file1 file2 (condensed context) | 50-70% |
815
- | Docker/k8s | docker ps, images, logs, compose ps, kubectl pods, logs, services | 70-80% |
816
- | Package managers | npm/pnpm install/list, pip list/install/outdated, bundle install/list, prisma generate | 75-92% |
817
- | AWS | sts, ec2, lambda, logs, cloudformation, dynamodb, iam, s3, ecs, sqs, sns | 60-88% |
818
- | Network | curl (strip progress/headers), wget (strip progress bars) | 50-70% |
819
-
820
- **Supported commands (full list):**
821
-
822
- ```
823
- # Git
824
- kirograph exec git status # Compact status
825
- kirograph exec git log -n 10 # One-line commits
826
- kirograph exec git diff # Condensed diff
827
- kirograph exec git add . # → "ok"
828
- kirograph exec git commit -m "msg" # → "ok abc1234"
829
- kirograph exec git push # → "ok main → origin/main"
830
- kirograph exec git pull # → "ok 3 files +10 -2"
831
-
832
- # GitHub CLI
833
- kirograph exec gh pr list # Compact PR listing
834
- kirograph exec gh pr view 42 # PR details + checks
835
- kirograph exec gh issue list # Compact issue listing
836
- kirograph exec gh run list # Workflow run status
837
-
838
- # Test Runners
839
- kirograph exec jest # Failures only
840
- kirograph exec vitest run # Failures only
841
- kirograph exec playwright test # E2E results (failures only)
842
- kirograph exec pytest # Python tests (-90%)
843
- kirograph exec go test ./... # Go tests (-90%)
844
- kirograph exec cargo test # Cargo tests (-90%)
845
- kirograph exec rake test # Ruby minitest (-90%)
846
- kirograph exec rspec # RSpec tests (-60%+)
847
-
848
- # Build & Lint
849
- kirograph exec eslint . # Grouped by rule/file
850
- kirograph exec tsc --noEmit # TypeScript errors grouped by file
851
- kirograph exec next build # Next.js build compact
852
- kirograph exec prettier --check . # Files needing formatting
853
- kirograph exec cargo build # Cargo build (-80%)
854
- kirograph exec cargo clippy # Cargo clippy (-80%)
855
- kirograph exec ruff check # Python linting (-80%)
856
- kirograph exec golangci-lint run # Go linting (-85%)
857
- kirograph exec rubocop # Ruby linting (-60%+)
858
- kirograph exec biome check . # Biome linting
859
-
860
- # Files & Search
861
- kirograph exec ls -la src/ # Structured directory listing
862
- kirograph exec find . -name "*.ts" # Grouped by directory
863
- kirograph exec tree # Truncated with summary
864
- kirograph exec grep -r "pattern" . # Grouped search results
865
- kirograph exec rg "pattern" # Grouped search results
866
- kirograph exec diff file1 file2 # Condensed diff
867
-
868
- # Package Managers
869
- kirograph exec npm install # → "ok +5 packages"
870
- kirograph exec npm list # Compact dependency tree
871
- kirograph exec pip list # Python packages
872
- kirograph exec pip install -r req.txt # Strip progress bars
873
- kirograph exec bundle install # Strip "Using" lines
874
- kirograph exec prisma generate # Strip ASCII art
875
-
876
- # AWS
877
- kirograph exec aws sts get-caller-identity # One-line identity
878
- kirograph exec aws ec2 describe-instances # Compact instance list
879
- kirograph exec aws lambda list-functions # Name/runtime/memory
880
- kirograph exec aws logs get-log-events ... # Timestamped messages only
881
- kirograph exec aws cloudformation describe-stack-events ... # Failures first
882
- kirograph exec aws dynamodb scan ... # Unwraps type annotations
883
- kirograph exec aws iam list-roles # Strips policy documents
884
- kirograph exec aws s3 ls s3://bucket # Truncated listing
885
-
886
- # Containers
887
- kirograph exec docker ps # Compact container list
888
- kirograph exec docker images # Compact image list
889
- kirograph exec docker logs container # Deduplicated logs
890
- kirograph exec docker compose ps # Compose services
891
- kirograph exec kubectl get pods # Compact pod list
892
- kirograph exec kubectl logs pod # Deduplicated logs
893
- kirograph exec kubectl get svc # Compact service list
894
-
895
- # Network
896
- kirograph exec curl https://api.example.com/data # Strip progress/headers
897
- kirograph exec wget https://example.com/file.zip # Strip progress bars
898
- ```
899
-
900
- Three compression levels:
901
-
902
- | Level | Style |
903
- |-------|-------|
904
- | `normal` | Balanced: removes noise, keeps structure *(default)* |
905
- | `aggressive` | More compact: groups by category, limits output |
906
- | `ultra` | Maximum compression: counts and summaries only |
907
-
908
- ```bash
909
- kirograph compression normal # balanced (default)
910
- kirograph compression aggressive # more compact
911
- kirograph compression ultra # maximum compression
912
- kirograph compression off # disable hook (tool still available)
913
- kirograph compression # show current level
914
- ```
915
-
916
- Set during `kirograph install` (interactive arrow-key menu) or any time after. When set to anything other than `off`, a `preToolUse` hook reminds the agent to use `kirograph_exec` for supported commands. The configured level is used as the default when the agent doesn't specify one explicitly.
917
-
918
- **Error preservation:** Failed commands always show full diagnostic output regardless of compression level. The engine detects error patterns and preserves detail when it matters.
919
-
920
- **Token analytics:**
921
-
922
- ```bash
923
- kirograph gain # summary stats
924
- kirograph gain --graph # ASCII graph (last 30 days)
925
- kirograph gain --history # recent command history
926
- kirograph gain --daily # day-by-day breakdown
927
- kirograph gain --json # JSON export
928
- ```
929
-
930
- The `kirograph_gain` MCP tool exposes the same stats to the agent.
931
-
932
- ### Savings Heuristics
933
-
934
- `kirograph gain` tracks two types of savings: compression (measured exactly) and graph tools (estimated via heuristics). For graph tools, the system estimates what the agent *would have spent* doing the same work without KiroGraph, based on typical agent behavior:
935
-
936
- | Tool | What the agent would do manually | Estimated naive cost |
937
- |------|----------------------------------|---------------------|
938
- | `kirograph_context` | Read 5-10 files to orient on a task | ~7,500-15,000 tokens |
939
- | `kirograph_search` | Run grep + read top matches | ~3,300 tokens |
940
- | `kirograph_callers` | Grep for symbol + read each calling file | ~8,300 tokens |
941
- | `kirograph_callees` | Read function body + grep for each call | ~3,900 tokens |
942
- | `kirograph_impact` | Recursive grep + read per depth level | ~6,900 × depth |
943
- | `kirograph_node` | Read the full file containing the symbol | ~1,500 tokens |
944
- | `kirograph_files` | Run `find` or `ls -R` | ~2,000 tokens |
945
- | `kirograph_path` | Trace connections manually (multiple grep + read) | ~7,700 tokens |
946
- | `kirograph_type_hierarchy` | Grep for extends/implements + read each file | ~5,400 tokens |
947
- | `kirograph_dead_code` | Not feasible manually (read every file) | 5× output, min 15,000 |
948
- | `kirograph_hotspots` | Not feasible manually (count edges for every symbol) | 5× output, min 15,000 |
949
- | `kirograph_architecture` | Not feasible manually | 4× output, min 7,500 |
950
- | `kirograph_mem_search` | Re-read 3-5 files to recall past decisions + grep | ~5,800 tokens |
951
- | `kirograph_mem_timeline` | Ask user or re-read session history | ~2,300 tokens |
952
-
953
- Constants used: 1,500 tokens per average source file (~200 lines), 800 tokens per grep result set, 2,000 tokens per directory listing. These are conservative estimates; in practice agents often read more files, retry failed searches, and explore dead ends.
954
-
955
- **Coexistence with Caveman Mode:** Compression and caveman mode are complementary, they compress different things. Caveman mode compresses the agent's *prose responses* (the text it writes around tool results); it never touches code or tool output. Shell compression compresses *shell command output* (the raw data coming back from shell commands); it never touches how the agent communicates. They stack: with both enabled, shell commands return 60-90% fewer tokens *and* the agent's explanations around those results are also shorter. Pick both independently during `kirograph install`. The "ultra + ultra" combo gives maximum token savings on both fronts.
956
-
957
- ### Architecture Analysis *(requires `enableArchitecture: true`)*
958
-
959
- Visualize the detected package graph, architectural layers, and package dependencies.
960
-
961
- ```bash
962
- kirograph architecture [path] # Show packages + layers + all deps
963
- kirograph architecture --packages # Show packages section only
964
- kirograph architecture --layers # Show layers section only
965
- kirograph architecture --format json # JSON output
966
- ```
967
-
968
- **Output includes:**
969
- - Each detected package with its source (`manifest` or `directory`), language, version, and declared external deps
970
- - Package-to-package dependency edges with import counts
971
- - Detected layers (`api`, `service`, `data`, `ui`, `shared`) with file counts
972
- - Layer-to-layer dependency edges
973
-
974
- ### Package Inspection *(requires `enableArchitecture: true`)*
975
-
976
- Drill into a single package: metadata, coupling metrics, dependencies, and files.
977
-
978
- ```bash
979
- kirograph package <name> # Inspect a package by name or path fragment
980
- kirograph package auth # Partial match accepted (e.g. matches "pkg:npm:src/auth")
981
- kirograph package src/auth --no-files # Omit file list
982
- kirograph package auth --format json # JSON output
983
- ```
984
-
985
- Shows package source (manifest or directory), language, version, manifest path, coupling metrics (Ca/Ce/instability), outgoing dependencies, incoming dependents, declared external deps, and the full list of files belonging to the package.
986
-
987
- ### Coupling Metrics *(requires `enableArchitecture: true`)*
988
-
989
- Inspect coupling health across your package graph.
990
-
991
- ```bash
992
- kirograph coupling [path] # All packages, sorted by instability
993
- kirograph coupling --sort ca # Sort by afferent coupling (most depended-on first)
994
- kirograph coupling --sort ce # Sort by efferent coupling (most dependent first)
995
- kirograph coupling --sort name # Sort alphabetically
996
- kirograph coupling --package auth # Detail view for a single package
997
- kirograph coupling --format json # JSON output
998
- ```
999
-
1000
- The table shows each package with:
1001
- - **Ca**: afferent coupling: how many packages depend on this one (higher = more stable)
1002
- - **Ce**: efferent coupling: how many packages this one depends on (higher = more unstable)
1003
- - **Instability** (`Ce / (Ca + Ce)`), rendered as a color-coded bar: green (stable) → yellow (neutral) → red (unstable)
1004
-
1005
- The `--package` detail view shows who depends on this package and what it depends on, with import counts for each relationship.
1006
-
1007
- ### Hotspots
1008
-
1009
- Find the most-connected symbols in the codebase by total edge degree (incoming + outgoing, excluding structural `contains` edges). Useful for identifying core abstractions, load-bearing code, or high blast-radius change points.
1010
-
1011
- ```bash
1012
- kirograph hotspots [path] # Top 20 most-connected symbols
1013
- kirograph hotspots --limit 10 # Limit results
1014
- kirograph hotspots --format json # JSON output
1015
- ```
1016
-
1017
- Output shows each symbol with an inline bar chart, total degree, and in/out breakdown.
1018
-
1019
- ### Surprising Connections
1020
-
1021
- Find non-obvious cross-file connections: direct edges (`calls`, `references`, etc.) between symbols in structurally distant parts of the codebase. High-score pairs indicate unexpected coupling worth investigating.
1022
-
1023
- ```bash
1024
- kirograph surprising [path] # Top 20 surprising connections
1025
- kirograph surprising --limit 10 # Limit results
1026
- kirograph surprising --format json # JSON output
1027
- ```
1028
-
1029
- Score = path distance between files × edge-kind weight (`calls=1.0`, `references=0.8`, `type_of=0.7`, etc.).
1030
-
1031
- ### Snapshots & Diff
1032
-
1033
- Save lightweight graph snapshots and compare them to track structural changes over time, useful before/after refactors, or in CI to audit what a PR added or removed.
1034
-
1035
- ```bash
1036
- kirograph snapshot save [label] # Save current graph state with optional label
1037
- kirograph snapshot save pre-refactor # Named snapshot
1038
- kirograph snapshot list # List all saved snapshots
1039
- kirograph snapshot diff # Diff current graph vs latest snapshot
1040
- kirograph snapshot diff pre-refactor # Diff current graph vs named snapshot
1041
- kirograph snapshot diff --format full # Show full added/removed symbol lists
1042
- kirograph snapshot diff --format json # JSON output
1043
- ```
1044
-
1045
- Snapshots are stored in `.kirograph/snapshots/` as JSON and include all node IDs and edge tuples. The diff is computed as a set operation, O(n) regardless of codebase size.
1046
-
1047
- The `kirograph_diff` MCP tool exposes the same capability to the agent: compare the current graph against the latest (or a named) snapshot without leaving the conversation.
1048
-
1049
- ### Dead Code
1050
-
1051
- Find unexported symbols with zero incoming references, candidates for removal.
1052
-
1053
- ```bash
1054
- kirograph dead-code [path] # List dead code grouped by file
1055
- kirograph dead-code --limit 20 # Limit results
1056
- kirograph dead-code --format json # JSON output
1057
- ```
1058
-
1059
- Only unexported symbols are considered, since exported symbols may be used by consumers outside the indexed project.
1060
-
1061
- ### Path
1062
-
1063
- Find the shortest connection between any two symbols, traversing all edge types in both directions.
1064
-
1065
- ```bash
1066
- kirograph path <from> <to> # Find path between two symbols
1067
- kirograph path LoginController Pool # Example: how are these connected?
1068
- kirograph path --format json # JSON output
1069
- ```
1070
-
1071
- The command resolves symbol names using the same fuzzy search as `kirograph query`, preferring real symbol kinds (class, function, method…) over import/file nodes. The result shows each hop with file and line.
1072
-
1073
- ### Memory *(requires `enableMemory: true`)*
1074
-
1075
- Persistent cross-session observations — search, store, and manage project memory from the CLI.
1076
-
1077
- ```bash
1078
- # Search (mirrors kirograph_mem_search)
1079
- kirograph mem search "payment retry" # hybrid FTS + vector search
1080
- kirograph mem search "auth bug" --kind error # filter by kind
1081
- kirograph mem search "refactor" --limit 5 # limit results
1082
- kirograph mem search "token" --format json # JSON output
1083
-
1084
- # Store (mirrors kirograph_mem_store)
1085
- kirograph mem store "decided to use idempotency keys for payments"
1086
- kirograph mem store "auth bug: token refresh missing" --kind error
1087
- kirograph mem store --kind decision < decision.txt # pipe from stdin
1088
-
1089
- # Timeline (mirrors kirograph_mem_timeline)
1090
- kirograph mem timeline # last 5 sessions
1091
- kirograph mem timeline --limit 10 # more sessions
1092
- kirograph mem timeline --session <id> # specific session
1093
- kirograph mem timeline --format json
1094
-
1095
- # Status (mirrors kirograph_mem_status)
1096
- kirograph mem status # health dashboard
1097
-
1098
- # Maintenance
1099
- kirograph mem prune --older-than 90d # cleanup old observations
1100
- kirograph mem export --format jsonl # machine-readable export (importable)
1101
- kirograph mem export --format md # human-readable export
1102
- kirograph mem import backup.jsonl # restore from backup (deduplicates)
1103
- kirograph mem reembed # re-embed after model change
1104
- kirograph mem reembed --batch 50 # control batch size
1105
- kirograph mem lint # find stale links, model mismatch
1106
- kirograph mem lint --fix # auto-repair issues
1107
- ```
1108
-
1109
- **How observations are stored:** Text → strip `<private>` blocks → caveman compress (if enabled) → SHA-256 dedup check → store → detect symbol identifiers → link to graph → embed. Zero LLM tokens.
1110
-
1111
- **How observations surface:** `kirograph_context` and `kirograph_impact` automatically include relevant memory observations (max 3, above relevance threshold 0.3) when memory is enabled. No extra tool call needed.
1112
-
1113
- ### Documentation *(requires `enableDocs: true`)*
1114
-
1115
- Section-level documentation navigation — search, browse, and retrieve doc sections from the CLI.
1116
-
1117
- ```bash
1118
- # Table of contents
1119
- kirograph docs toc # whole project
1120
- kirograph docs toc README.md # single file
1121
- kirograph docs toc README.md --tree # nested tree structure
1122
- kirograph docs toc --json # JSON output
1123
-
1124
- # Search (mirrors kirograph_docs_search)
1125
- kirograph docs search "authentication"
1126
- kirograph docs search "config" --file docs/guide.md
1127
- kirograph docs search "install" --limit 5
1128
-
1129
- # Retrieve a section (mirrors kirograph_docs_section)
1130
- kirograph docs section "README.md::installation#1"
1131
- kirograph docs section "README.md::installation#1" --context
1132
-
1133
- # Outline (mirrors kirograph_docs_outline)
1134
- kirograph docs outline docs/api.md
1135
-
1136
- # Cross-references (mirrors kirograph_docs_refs)
1137
- kirograph docs refs "docs/auth.md::oauth/token-refresh#2"
1138
-
1139
- # Maintenance
1140
- kirograph docs reindex # force full re-index
1141
- kirograph docs lint # health checks (broken refs, stale sections)
1142
- kirograph docs reembed # re-embed with current model
1143
- ```
1144
-
1145
- **How sections are identified:** Each section gets a stable ID in the format `{file_path}::{ancestor-chain/slug}#{level}`. IDs remain stable across re-indexing as long as the file path, heading text, heading level, and parent chain don't change.
1146
-
1147
- **How code linking works:** When `docsLinkCode: true` (default), the indexer scans section content for backtick references (`` `functionName` ``), CamelCase identifiers, and snake_case patterns, then resolves them against the code graph. Matches are stored as `doc_code_refs` using `qualified_name` (stable across reindex).
1148
-
1149
- ### Graph Export
1150
-
1151
- Export the full graph as an interactive dashboard. three files served from a local directory, no server required, works offline.
1152
-
1153
- ```bash
1154
- kirograph export build [path] # Generate .kirograph/export/{index.html,app.css,app.js}
1155
- kirograph export start [path] # Generate and open in browser
1156
- kirograph export build -o /tmp/myexport # Custom output directory
1157
- kirograph export build --include-contains # Include structural contains edges (adds noise, off by default)
1158
- ```
1159
-
1160
- Output lands in `.kirograph/export/` by default. Open `index.html` in any browser.
1161
-
1162
- ![KiroGraph export](https://raw.githubusercontent.com/davide-desio-eleva/kirograph/main/assets/export.gif)
1163
-
1164
- #### Graph & navigation
1165
-
1166
- - **Color-coded nodes** by kind (class, function, method, component…) with size proportional to degree
1167
- - **Directed edges** with kind labels; dashed lines for imports and references
1168
- - **Click a node** to zoom in and inspect it. kind, file, line, degree, signature, and a copy button for the file reference
1169
- - **Click two nodes** to instantly find and highlight the shortest path between them, with detail cards for both endpoints
1170
- - **History**: ‹ › navigation through previously inspected nodes
1171
- - **Keyboard shortcuts**: `f` to fit the graph, `Esc` to exit focus or path mode
1172
-
1173
- #### Controls
1174
-
1175
- | Button | What it does |
1176
- |--------|-------------|
1177
- | **⊞ Fit** | Fit the entire graph to the viewport |
1178
- | **⚡ Physics** | Toggle the force-directed layout |
1179
- | **⛶ Fullscreen** | Collapse the side panel for maximum graph space |
1180
- | **📷 PNG** | Save the current view as an image |
1181
- | **◎ Focus** | Show only the selected node and its direct neighbors |
1182
- | **⟶ Path** | Find the shortest path between two nodes |
1183
- | **⬡ Cluster** | Group nodes by directory; click a cluster to expand it |
1184
- | **🌡 Heat** | Color nodes by how recently their file was modified |
1185
- | **📊 Charts** | Open the analytics panel |
1186
-
1187
- #### Search
1188
-
1189
- Type to search by name, qualified name, or file path. Matching nodes are highlighted and the viewport fits to them.
1190
-
1191
- #### Legend & filters
1192
-
1193
- - **Node kind filter**: Legend tab; click any kind to hide or show all nodes of that type
1194
- - **Edge kind filter**: Legend tab; click any edge kind to hide or show edges of that type
1195
- - **Degree slider**: Filters tab; hide nodes below N connections to surface the most-connected symbols
1196
-
1197
- #### Minimap
1198
-
1199
- An overview of the full graph is always visible in the bottom-left corner. Click anywhere on it to pan the main graph.
1200
-
1201
- #### Right-click menu
1202
-
1203
- Right-click any node to focus its neighbors, start a path from it, copy its ID or file path, or highlight all nodes of the same kind.
1204
-
1205
- #### Analytics charts
1206
-
1207
- The 📊 Charts button opens a panel with three charts:
1208
-
1209
- | Chart | What it shows |
1210
- |-------|--------------|
1211
- | **Bar** | The 15 most-connected symbols |
1212
- | **Donut** | How node kinds are distributed across the codebase |
1213
- | **Line** | How many symbols have each connection count. reveals the overall connectivity shape of the graph |
1214
-
1215
-
1216
- ### Dashboard
1217
-
1218
- When `semanticEngine` is set to `qdrant` or `typesense`, use these commands to manage the background server and its dashboard UI.
1219
-
1220
- ```bash
1221
- kirograph dashboard start [path] # Start server (if not running) and open dashboard
1222
- kirograph dashboard stop [path] # Stop the running engine server
1223
- ```
1224
-
1225
- **`dashboard start`**
1226
-
1227
- Reads `semanticEngine` from `.kirograph/config.json` and dispatches accordingly:
1228
-
1229
- - **qdrant**: Downloads the [Qdrant Web UI](https://github.com/qdrant/qdrant-web-ui) on first use (cached at `.kirograph/qdrant/dashboard/`), spawns the Qdrant server with `QDRANT__SERVICE__STATIC_CONTENT_DIR` set so the dashboard is served natively, and opens `http://127.0.0.1:<port>/dashboard` in your browser. If the server is already running with the dashboard, reconnects instead of restarting.
1230
- - **typesense**: Downloads the [Typesense Dashboard](https://github.com/bfritscher/typesense-dashboard) static UI on first use (cached at `.kirograph/typesense/dashboard/`), starts the Typesense server if not already running, serves the dashboard locally via a Node HTTP server, and opens it in your browser. Press Ctrl+C to stop the dashboard server. the Typesense server keeps running as a background daemon.
1231
-
1232
- Both servers run as persistent daemons. The state file (`.kirograph/qdrant-server.json` or `.kirograph/typesense-server.json`) tracks the PID and port for reconnection across `kg` commands.
1233
-
1234
- **`dashboard stop`**
1235
-
1236
- Reads `semanticEngine` from config and sends SIGTERM to the running background process, then removes the state file. Does nothing if no server is running.
1237
-
1238
- ### MCP Server
1239
-
1240
- ```bash
1241
- kirograph serve --mcp # Start MCP server (used by Kiro)
1242
- kirograph serve --mcp --path /my/project # Specify project path
1243
- ```
1244
-
1245
- ## Configuration
1246
-
1247
- KiroGraph stores its config in `.kirograph/config.json`. You can edit it directly.
1248
-
1249
- | Field | Type | Default | Description |
1250
- |-------|------|---------|-------------|
1251
- | `languages` | string[] | `[]` | Limit indexing to specific languages (empty = all) |
1252
- | `include` | string[] | `[]` | Glob patterns to include (empty = include everything not excluded) |
1253
- | `exclude` | string[] | see below | Glob patterns to exclude |
1254
- | `maxFileSize` | number | `1048576` | Skip files larger than this (bytes) |
1255
- | `extractDocstrings` | boolean | `true` | Extract JSDoc, docstrings, and comments |
1256
- | `trackCallSites` | boolean | `true` | Record line/column for call edges |
1257
- | `enableEmbeddings` | boolean | `false` | Generate semantic embeddings (opt-in) |
1258
- | `embeddingModel` | string | `nomic-ai/nomic-embed-text-v1.5` | HuggingFace `feature-extraction` model ID |
1259
- | `embeddingDim` | number | `768` | Output dimension of the chosen embedding model |
1260
- | `semanticEngine` | string | `cosine` | Search engine: `cosine`, `sqlite-vec`, `orama`, `pglite`, `lancedb`, `qdrant`, or `typesense` |
1261
- | `useVecIndex` | boolean | `false` | Deprecated alias for `semanticEngine: "sqlite-vec"` |
1262
- | `enableArchitecture` | boolean | `false` | Enable architecture analysis (package graph + layer detection, opt-in) |
1263
- | `architectureLayers` | object | - | Custom layer definitions: `{ "layerName": ["glob/**"] }` |
1264
- | `minLogLevel` | string | `warn` | Log level: `debug`, `info`, `warn`, `error` |
1265
- | `fuzzyResolutionThreshold` | number | `0.5` | Name matching threshold for cross-file resolution (0.0–1.0) |
1266
- | `cavemanMode` | string | `off` | Agent communication style: `off`, `lite`, `full`, `ultra` |
1267
- | `shellCompressionLevel` | string | `normal` | Shell command compression level: `off`, `normal`, `aggressive`, `ultra` |
1268
-
1269
- Default exclude patterns: `node_modules/**`, `dist/**`, `build/**`, `.git/**`, `*.min.js`, `.kirograph/**`
1270
-
1271
- ### Semantic Search (Optional)
1272
-
1273
- By default, KiroGraph uses exact name lookup and full-text search. Enable semantic search for natural-language queries:
1274
-
1275
- ```json
1276
- {
1277
- "enableEmbeddings": true
1278
- }
1279
- ```
1280
-
1281
- This generates vector embeddings for all functions, methods, classes, interfaces, type aliases, components, and modules using a local embedding model (downloaded automatically to `~/.kirograph/models/` on first use). Embeddings are kept in sync automatically via the Kiro `agentStop` hook, which syncs the index (including embeddings) whenever files change during a session.
1282
-
1283
- Run `kirograph install` to be guided through model and engine selection interactively with arrow-key menus, or set the fields manually in `.kirograph/config.json`.
1284
-
1285
- #### Embedding models
1286
-
1287
- `kirograph install` offers a curated selection of models compatible with `@huggingface/transformers`:
1288
-
1289
- | Model | Dim | Size | Notes |
1290
- |-------|-----|------|-------|
1291
- | `nomic-ai/nomic-embed-text-v1.5` | 768 | ~130MB | **Default.** Best quality for code search. |
1292
- | `onnx-community/embeddinggemma-300m-ONNX` | 768 | ~300MB | Google Gemma-based. Multilingual, 2048-token context window. |
1293
- | `Xenova/all-MiniLM-L6-v2` | 384 | ~23MB | Lightweight, fast. Lower accuracy. |
1294
- | `BAAI/bge-base-en-v1.5` | 768 | ~110MB | Strong general-purpose alternative to nomic. |
1295
- | Custom | any | - | Any HuggingFace `feature-extraction` model. Provide ID + output dimension. |
1296
-
1297
- The embedding dimension is stored in `embeddingDim` in `.kirograph/config.json` and used to initialise all vector engines correctly. Switching models requires a full re-index (`kirograph index --force`).
1298
-
1299
- Configure manually:
1300
-
1301
- ```json
1302
- {
1303
- "enableEmbeddings": true,
1304
- "embeddingModel": "onnx-community/embeddinggemma-300m-ONNX",
1305
- "embeddingDim": 768
1306
- }
1307
- ```
1308
-
1309
- #### Storage architecture
1310
-
1311
- Each engine owns its embedding store exclusively. there is no redundant write to the main graph database:
1312
-
1313
- | Engine | Graph store | Vector store |
1314
- |--------|-------------|--------------|
1315
- | `cosine` | `kirograph.db` (SQLite) | `kirograph.db` (`vectors` table) |
1316
- | `sqlite-vec` | `kirograph.db` (SQLite) | `.kirograph/vec.db` (sqlite-vec) |
1317
- | `orama` | `kirograph.db` (SQLite) | `.kirograph/orama.json` (Orama) |
1318
- | `pglite` | `kirograph.db` (SQLite) | `.kirograph/pglite/` (PGlite+pgvector) |
1319
- | `lancedb` | `kirograph.db` (SQLite) | `.kirograph/lancedb/` (Apache Lance) |
1320
- | `qdrant` | `kirograph.db` (SQLite) | `.kirograph/qdrant/` (Qdrant embedded) |
1321
- | `typesense` | `kirograph.db` (SQLite) | `.kirograph/typesense/` (Typesense embedded) |
1322
-
1323
- The graph store (`kirograph.db`) always holds nodes, edges, files, and all structural data regardless of which engine is active.
1324
-
1325
- #### Engine comparison
1326
-
1327
- | Engine | Search type | Extra deps | Native? | Best for |
1328
- |--------|-------------|------------|---------|----------|
1329
- | `cosine` *(default)* | Exact cosine, linear scan | none | - | Small / medium projects, zero setup |
1330
- | `sqlite-vec` | ANN (approximate), sub-linear | `better-sqlite3`, `sqlite-vec` | yes | Large codebases, fast ANN search |
1331
- | `orama` | Hybrid (full-text + vector) | `@orama/orama`, `@orama/plugin-data-persistence` | no (pure JS) | Best result quality, no native deps |
1332
- | `pglite` | Hybrid (full-text + vector), exact | `@electric-sql/pglite` | no (pure WASM) | Exact results, no native deps, PostgreSQL semantics |
1333
- | `lancedb` | ANN (approximate), sub-linear | `@lancedb/lancedb` | no (pure JS) | Fast ANN search, no native compilation required |
1334
- | `qdrant` | ANN (HNSW), sub-linear | `qdrant-local` | yes (binary) | Full Qdrant feature set, HNSW index, embedded binary |
1335
- | `typesense` | ANN (HNSW), sub-linear | `typesense` | yes (binary) | Fast ANN search, auto-downloaded binary, no manual install |
1336
-
1337
- All non-cosine engines fall back silently to `cosine` if their optional dependencies are not installed.
1338
-
1339
- #### cosine (default)
1340
-
1341
- In-process cosine similarity over all stored embeddings. No extra dependencies. Embeddings are stored in the `vectors` table inside `kirograph.db`.
1342
-
1343
- ```json
1344
- {
1345
- "enableEmbeddings": true,
1346
- "semanticEngine": "cosine"
1347
- }
1348
- ```
1349
-
1350
- #### sqlite-vec
1351
-
1352
- Approximate nearest-neighbour (ANN) index stored in `.kirograph/vec.db`. Sub-linear search time. ideal for large codebases with thousands of indexed symbols. The SQLite `vectors` table is not written to; `vec.db` is the sole embedding store.
1353
-
1354
- ```json
1355
- {
1356
- "enableEmbeddings": true,
1357
- "semanticEngine": "sqlite-vec"
1358
- }
1359
- ```
1360
-
1361
- ```bash
1362
- npm install better-sqlite3 sqlite-vec
1363
- ```
1364
-
1365
- Requires two native dependencies (compiled C extensions). If not installed, falls back to `cosine`.
1366
-
1367
- #### orama
1368
-
1369
- Hybrid search powered by [Orama](https://github.com/oramasearch/orama). combines full-text relevance and vector similarity in a **single query**, producing higher-quality results than running the two searches separately. The index is persisted to `.kirograph/orama.json` and is the sole embedding store. Pure JS, no native compilation required.
1370
-
1371
- ```json
1372
- {
1373
- "enableEmbeddings": true,
1374
- "semanticEngine": "orama"
1375
- }
1376
- ```
1377
-
1378
- ```bash
1379
- npm install @orama/orama @orama/plugin-data-persistence
1380
- ```
1381
-
1382
- If not installed, falls back to `cosine`.
1383
-
1384
- #### pglite
1385
-
1386
- Hybrid search powered by [PGlite](https://github.com/electric-sql/pglite), a WASM-compiled PostgreSQL with the [pgvector](https://github.com/pgvector/pgvector) extension. Combines **exact** nearest-neighbour vector search with full-text ranking (`ts_rank`) in a single SQL query. The database is persisted to `.kirograph/pglite/` using PostgreSQL's WAL-based storage and is the sole embedding store. Pure WASM, no native compilation required.
1387
-
1388
- ```json
1389
- {
1390
- "enableEmbeddings": true,
1391
- "semanticEngine": "pglite"
1392
- }
1393
- ```
1394
-
1395
- ```bash
1396
- npm install @electric-sql/pglite
1397
- ```
1398
-
1399
- Key advantages:
1400
- - **Exact** vector results (not approximate). deterministic and reproducible
1401
- - Native SQL `ON CONFLICT` upsert, no remove+insert workaround
1402
- - HNSW index (`vector_cosine_ops`) keeps search fast as the index grows
1403
- - Single dependency, zero native binaries
1404
-
1405
- If not installed, falls back to `cosine`.
1406
-
1407
- #### LanceDB
1408
-
1409
- ANN vector search powered by [LanceDB](https://github.com/lancedb/lancedb). stores embeddings in Apache Lance columnar format at `.kirograph/lancedb/`. Sub-linear search time using cosine distance. Pure JS, no native compilation required.
1410
-
1411
- ```json
1412
- {
1413
- "enableEmbeddings": true,
1414
- "semanticEngine": "lancedb"
1415
- }
1416
- ```
1417
-
1418
- ```bash
1419
- npm install @lancedb/lancedb
1420
- ```
1421
-
1422
- Key characteristics:
1423
- - **Columnar storage** (Apache Lance format). efficient for batch reads and writes
1424
- - **ANN cosine search**: fast, sub-linear query time
1425
- - Pure JS, no native binaries or WASM required
1426
-
1427
- If not installed, falls back to `cosine`.
1428
-
1429
- #### qdrant
1430
-
1431
- ANN vector search powered by [Qdrant](https://github.com/qdrant/qdrant) running in embedded mode. The engine spawns the Qdrant binary as a managed child process, persisting data to `.kirograph/qdrant/`. Uses [`@qdrant/qdrant-js`](https://github.com/qdrant/qdrant-js) as the REST client.
1432
-
1433
- ```json
1434
- {
1435
- "enableEmbeddings": true,
1436
- "semanticEngine": "qdrant"
1437
- }
1438
- ```
1439
-
1440
- ```bash
1441
- npm install qdrant-local
1442
- ```
1443
-
1444
- Key characteristics:
1445
- - **HNSW index**: high-quality ANN search with Qdrant's native indexing
1446
- - **Embedded binary**: no separate server setup; the process is spawned and managed automatically
1447
- - **Persistent daemon**: the server stays running between `kg` commands; state tracked in `.kirograph/qdrant-server.json`
1448
- - **Built-in dashboard**: run `kg dashboard start` to download the [Qdrant Web UI](https://github.com/qdrant/qdrant-web-ui) and open it (cached at `.kirograph/qdrant/dashboard/`, served via Qdrant's built-in static content feature)
1449
- - **Async startup**: polls `/readyz` instead of blocking with a fixed sleep
1450
- - **Cosine distance** metric
1451
- - Data persists across restarts in `.kirograph/qdrant/`
1452
-
1453
- Manage the server:
1454
-
1455
- ```bash
1456
- kirograph dashboard start # start server + open dashboard
1457
- kirograph dashboard stop # stop server
1458
- ```
1459
-
1460
- If not installed, falls back to `cosine`.
1461
-
1462
- #### typesense
1463
-
1464
- ANN vector search powered by [Typesense](https://github.com/typesense/typesense) running in embedded mode. The engine automatically downloads the Typesense server binary (~37 MB, cached at `~/.kirograph/bin/`) on first use and spawns it as a managed child process. Uses the official [`typesense`](https://www.npmjs.com/package/typesense) Node.js client.
1465
-
1466
- ```json
1467
- {
1468
- "enableEmbeddings": true,
1469
- "semanticEngine": "typesense"
1470
- }
1471
- ```
1472
-
1473
- ```bash
1474
- npm install typesense
1475
- ```
1476
-
1477
- Key characteristics:
1478
- - **HNSW index**: high-quality ANN search with Typesense's native indexing
1479
- - **Auto-downloaded binary**: no manual server setup; the binary is fetched and cached at `~/.kirograph/bin/` on first run
1480
- - **Persistent daemon**: the server stays running between `kg` commands; state tracked in `.kirograph/typesense-server.json`
1481
- - **Local dashboard**: run `kg dashboard start` to open the built-in Typesense Dashboard UI (served locally, cached at `.kirograph/typesense/dashboard/`)
1482
- - **Async startup**: polls `/health` instead of blocking with a fixed sleep
1483
- - **Cosine distance** metric
1484
- - Data persists across restarts in `.kirograph/typesense/`
1485
-
1486
- Manage the server:
1487
-
1488
- ```bash
1489
- kirograph dashboard start # start server + open dashboard
1490
- kirograph dashboard stop # stop server
1491
- ```
1492
-
1493
- If not installed (or binary download fails), falls back to `cosine`.
1494
-
1495
- ### Architecture Analysis (opt-in)
1496
-
1497
- When `enableArchitecture: true` is set, KiroGraph analyses the high-level structure of your project during indexing and populates `arch_*` tables in `kirograph.db`. Zero behavioral change when disabled.
1498
-
1499
- #### What it detects
1500
-
1501
- **Packages**: logical groupings of files. Detected two ways:
1502
-
1503
- 1. **Manifest-based**: parsed from `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`/`setup.py`/`setup.cfg`, `pom.xml`, `build.gradle`/`build.gradle.kts`, and `.csproj` files. Produces IDs like `pkg:npm:src/auth`.
1504
- 2. **Directory fallback**: for files not covered by any manifest, groups them by their nearest ancestor directory. Produces IDs like `pkg:dir:src/utils`.
1505
-
1506
- **Layers**: architectural tiers detected from file paths using per-language glob patterns:
1507
-
1508
- | Layer | Examples |
1509
- |-------|---------|
1510
- | `api` | `**/controllers/**`, `**/routes/**`, `**/handlers/**`, `**/api/**` |
1511
- | `service` | `**/services/**`, `**/usecases/**`, `**/domain/**` |
1512
- | `data` | `**/repositories/**`, `**/models/**`, `**/db/**`, `**/migrations/**` |
1513
- | `ui` | `**/components/**`, `**/views/**`, `**/pages/**`, `**/screens/**` |
1514
- | `shared` | `**/utils/**`, `**/helpers/**`, `**/lib/**`, `**/common/**` |
1515
-
1516
- Layer detection is per-language (TypeScript/JS, Python, Go, Java, Ruby, Rust, C#) with framework-specific patterns where applicable (Django, Rails, Spring MVC, ASP.NET, etc.). Custom layer overrides are supported via `architectureLayers` in config.
1517
-
1518
- **Package dependencies**: rolled up from existing `imports` edges in the graph. No re-parsing required.
1519
-
1520
- **Coupling metrics**: computed per package:
1521
- - **Ca** (afferent). how many other packages depend on this one
1522
- - **Ce** (efferent). how many packages this one depends on
1523
- - **Instability** (`Ce / (Ca + Ce)`): 0 = maximally stable (everyone depends on it, it depends on nothing), 1 = maximally unstable (depends on everything, nobody depends on it)
1524
-
1525
- #### Custom layer definitions
1526
-
1527
- Override or extend the auto-detected layer patterns in `.kirograph/config.json`:
1528
-
1529
- ```json
1530
- {
1531
- "enableArchitecture": true,
1532
- "architectureLayers": {
1533
- "api": ["src/routes/**", "src/controllers/**"],
1534
- "service": ["src/domain/**", "src/application/**"],
1535
- "data": ["src/infrastructure/**", "src/persistence/**"]
1536
- }
1537
- }
1538
- ```
1539
-
1540
- When `architectureLayers` is set, those patterns take precedence over the auto-detected ones for the specified layer names.
1541
-
1542
- #### Storage
1543
-
1544
- All architecture data is stored in `kirograph.db` alongside the symbol graph:
1545
-
1546
- | Table | Contents |
1547
- |-------|---------|
1548
- | `arch_packages` | Package definitions (id, name, path, source, language, version, deps) |
1549
- | `arch_layers` | Layer definitions (id, name, patterns) |
1550
- | `arch_file_packages` | File → package assignments |
1551
- | `arch_file_layers` | File → layer assignments (with confidence score) |
1552
- | `arch_package_deps` | Package → package dependency edges (with import count) |
1553
- | `arch_layer_deps` | Layer → layer dependency edges |
1554
- | `arch_coupling` | Per-package Ca, Ce, instability metrics |
1555
-
1556
- #### IndexProgress phase
1557
-
1558
- Architecture analysis runs as a dedicated phase during `kirograph index`. Progress is reported with `phase: 'architecture'`.
1559
-
1560
- ## Supported Languages
1561
-
1562
- ### General-purpose
1563
-
1564
- | Language | Extensions |
1565
- |----------|-----------|
1566
- | TypeScript | `.ts` |
1567
- | JavaScript | `.js` |
1568
- | TSX | `.tsx` |
1569
- | JSX | `.jsx` |
1570
- | Python | `.py` |
1571
- | Go | `.go` |
1572
- | Rust | `.rs` |
1573
- | Java | `.java` |
1574
- | C | `.c`, `.h` |
1575
- | C++ | `.cpp`, `.cc`, `.cxx`, `.hpp` |
1576
- | C# | `.cs` |
1577
- | PHP | `.php` |
1578
- | Ruby | `.rb` |
1579
- | Swift | `.swift` |
1580
- | Kotlin | `.kt` |
1581
- | Dart | `.dart` |
1582
- | Scala | `.scala`, `.sc`, `.sbt` |
1583
- | Lua | `.lua` |
1584
- | Zig | `.zig`, `.zon` |
1585
- | Bash | `.sh`, `.bash`, `.zsh` |
1586
- | OCaml | `.ml`, `.mli` |
1587
- | Elm | `.elm` |
1588
- | Objective-C | `.m` |
1589
-
1590
- ### Frontend & UI
1591
-
1592
- | Language | Extensions |
1593
- |----------|-----------|
1594
- | React / React Native | `.tsx`, `.jsx` (via TypeScript/JSX grammars) |
1595
- | Next.js | `.tsx`, `.jsx` (via TypeScript/JSX grammars) |
1596
- | Angular | `.ts`, `.html` (via TypeScript/HTML grammars) |
1597
- | Svelte | `.svelte` |
1598
- | Vue | `.vue` |
1599
- | HTML | `.html`, `.htm` |
1600
- | CSS | `.css` |
1601
- | SCSS / Sass | `.scss`, `.sass` |
1602
-
1603
- ### Domain-specific
1604
-
1605
- | Language | Domain | Extensions |
1606
- |----------|--------|-----------|
1607
- | Solidity | Blockchain / Web3 | `.sol` |
1608
- | Elixir | Distributed systems / Real-time | `.ex`, `.exs` |
1609
-
1610
- ### Configuration & Infrastructure
1611
-
1612
- | Language | Extensions |
1613
- |----------|-----------|
1614
- | YAML | `.yaml`, `.yml` |
1615
- | HCL (Terraform) | `.tf`, `.tfvars` |
1616
-
1617
- ## Framework Detection
1618
-
1619
- KiroGraph automatically detects frameworks and enriches the graph with framework-specific semantics (routes, components, lifecycle methods):
1620
-
1621
- ### Web Frameworks
1622
-
1623
- **JavaScript / TypeScript:** React, Next.js, React Native, Angular, Svelte, SvelteKit, Express, Fastify, Koa
1624
-
1625
- **Vue:** Vue, Nuxt
1626
-
1627
- **Python:** Django, Flask, FastAPI
1628
-
1629
- **Ruby:** Rails
1630
-
1631
- **Java:** Spring, Spring Boot, Spring MVC
1632
-
1633
- **Scala:** Play, Akka HTTP, http4s
1634
-
1635
- **Go:** generic Go resolver
1636
-
1637
- **Rust:** generic Rust resolver
1638
-
1639
- **C#:** ASP.NET Core
1640
-
1641
- **Swift:** SwiftUI, UIKit, Vapor
1642
-
1643
- **PHP:** Laravel
1644
-
1645
- **Elixir:** Phoenix
1646
-
1647
- **Solidity:** Hardhat, Foundry, Truffle (OpenZeppelin patterns)
1648
-
1649
- ### Infrastructure as Code
1650
-
1651
- AWS CDK, SST, Serverless Framework, AWS SAM, Terraform / OpenTofu, Pulumi, CloudFormation, AWS Amplify Gen 2
1652
-
1653
- ### Containers & Orchestration
1654
-
1655
- Kubernetes, Helm, Docker Compose
1656
-
1657
- ### Configuration Management
1658
-
1659
- Ansible
1660
-
1661
- Detected frameworks are stored in config and used to improve symbol extraction and resolution.
1662
-
1663
- ## Credits
1664
-
1665
- KiroGraph is inspired by [CodeGraph](https://github.com/colbymchenry/codegraph) by [Colby McHenry](https://www.linkedin.com/in/colby-mchenry/). the original concept of building a semantic code graph for AI coding agents comes from his work.
1666
-
1667
- ### Inspirations
1668
-
1669
- - [cavemem](https://github.com/JuliusBrussee/cavemem) by [Julius Brussee](https://www.linkedin.com/in/julius-brussee/): the memory module's hook-based observation capture, deterministic compression, and SQLite storage pattern.
1670
- - [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/): the documentation module's section-first retrieval approach, stable section IDs, and byte-offset addressing.
1671
-
1672
- ### Contributors
1673
-
1674
- - [Alessandro Franceschi](https://www.linkedin.com/in/alessandrofranceschi/). Claude Code and Codex integration, Elixir/Phoenix language and framework support.
1675
- - [Mauro Argo](https://www.linkedin.com/in/argomauro/). original idea for the architecture layer analysis feature.
1676
-
1677
- ## Requirements
1678
-
1679
- - Node.js >= 18
1680
- - Kiro IDE (fully supported)
1681
- - Other MCP-capable tools (experimental. see [Other Tools](#other-tools-experimental))
1682
-
1683
- ## License
175
+ [MIT](LICENSE)
1684
176
 
1685
- MIT
177
+ | Document | Description |
178
+ |----------|-------------|
179
+ | [License](LICENSE) | MIT License — permissions, conditions, copyright |
180
+ | [Disclaimer](DISCLAIMER.md) | Limitations of use, no professional advice, data handling |
181
+ | [Warranty Disclaimer](WARRANTY.md) | Software provided "as is", no warranties of any kind |
182
+ | [Limitation of Liability](LIABILITY.md) | Exclusion of liability for damages arising from use |
183
+ | [Terms of Use](TERMS.md) | Permitted and prohibited use, user obligations, privacy |