roam-code 9.0.0__tar.gz → 11.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. roam_code-11.0.0/PKG-INFO +1588 -0
  2. roam_code-11.0.0/README.md +1542 -0
  3. {roam_code-9.0.0 → roam_code-11.0.0}/pyproject.toml +24 -4
  4. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/__init__.py +1 -1
  5. roam_code-11.0.0/src/roam/analysis/__init__.py +1 -0
  6. roam_code-11.0.0/src/roam/analysis/effects.py +639 -0
  7. roam_code-11.0.0/src/roam/api.py +238 -0
  8. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/bridges/__init__.py +1 -0
  9. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/bridges/base.py +2 -2
  10. roam_code-11.0.0/src/roam/bridges/bridge_config.py +218 -0
  11. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/bridges/bridge_protobuf.py +79 -64
  12. roam_code-11.0.0/src/roam/bridges/bridge_rest_api.py +242 -0
  13. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/bridges/bridge_salesforce.py +21 -18
  14. roam_code-11.0.0/src/roam/bridges/bridge_template.py +247 -0
  15. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/bridges/registry.py +13 -1
  16. roam_code-11.0.0/src/roam/catalog/detectors.py +2242 -0
  17. roam_code-11.0.0/src/roam/catalog/fixes.py +86 -0
  18. roam_code-11.0.0/src/roam/catalog/smells.py +599 -0
  19. roam_code-11.0.0/src/roam/catalog/tasks.py +1260 -0
  20. roam_code-11.0.0/src/roam/cli.py +548 -0
  21. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/changed_files.py +33 -20
  22. roam_code-11.0.0/src/roam/commands/cmd_adversarial.py +699 -0
  23. roam_code-11.0.0/src/roam/commands/cmd_affected.py +432 -0
  24. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_affected_tests.py +45 -47
  25. roam_code-11.0.0/src/roam/commands/cmd_agent_context.py +168 -0
  26. roam_code-11.0.0/src/roam/commands/cmd_agent_export.py +890 -0
  27. roam_code-11.0.0/src/roam/commands/cmd_agent_plan.py +315 -0
  28. roam_code-11.0.0/src/roam/commands/cmd_ai_ratio.py +765 -0
  29. roam_code-11.0.0/src/roam/commands/cmd_ai_readiness.py +775 -0
  30. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_alerts.py +84 -60
  31. roam_code-11.0.0/src/roam/commands/cmd_annotate.py +210 -0
  32. roam_code-11.0.0/src/roam/commands/cmd_api_changes.py +796 -0
  33. roam_code-11.0.0/src/roam/commands/cmd_api_drift.py +781 -0
  34. roam_code-11.0.0/src/roam/commands/cmd_attest.py +913 -0
  35. roam_code-11.0.0/src/roam/commands/cmd_auth_gaps.py +799 -0
  36. roam_code-11.0.0/src/roam/commands/cmd_bisect.py +216 -0
  37. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_breaking.py +73 -58
  38. roam_code-11.0.0/src/roam/commands/cmd_budget.py +413 -0
  39. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_bus_factor.py +60 -69
  40. roam_code-11.0.0/src/roam/commands/cmd_capsule.py +275 -0
  41. roam_code-11.0.0/src/roam/commands/cmd_check_rules.py +574 -0
  42. roam_code-11.0.0/src/roam/commands/cmd_clean.py +147 -0
  43. roam_code-11.0.0/src/roam/commands/cmd_closure.py +294 -0
  44. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_clusters.py +208 -66
  45. roam_code-11.0.0/src/roam/commands/cmd_codeowners.py +600 -0
  46. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_complexity.py +131 -92
  47. roam_code-11.0.0/src/roam/commands/cmd_config.py +292 -0
  48. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_context.py +392 -264
  49. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_conventions.py +170 -138
  50. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_coupling.py +126 -74
  51. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_coverage_gaps.py +307 -121
  52. roam_code-11.0.0/src/roam/commands/cmd_cut.py +235 -0
  53. roam_code-11.0.0/src/roam/commands/cmd_dark_matter.py +127 -0
  54. roam_code-11.0.0/src/roam/commands/cmd_dashboard.py +365 -0
  55. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_dead.py +433 -186
  56. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_debt.py +306 -94
  57. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_deps.py +36 -13
  58. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_describe.py +313 -104
  59. roam_code-11.0.0/src/roam/commands/cmd_dev_profile.py +580 -0
  60. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_diagnose.py +101 -66
  61. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_diff.py +134 -157
  62. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_digest.py +65 -42
  63. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_doc_staleness.py +78 -55
  64. roam_code-11.0.0/src/roam/commands/cmd_docs_coverage.py +193 -0
  65. roam_code-11.0.0/src/roam/commands/cmd_doctor.py +319 -0
  66. roam_code-11.0.0/src/roam/commands/cmd_drift.py +377 -0
  67. roam_code-11.0.0/src/roam/commands/cmd_duplicates.py +559 -0
  68. roam_code-11.0.0/src/roam/commands/cmd_effects.py +362 -0
  69. roam_code-11.0.0/src/roam/commands/cmd_endpoints.py +768 -0
  70. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_entry_points.py +142 -106
  71. roam_code-11.0.0/src/roam/commands/cmd_fan.py +311 -0
  72. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_file.py +57 -41
  73. roam_code-11.0.0/src/roam/commands/cmd_fingerprint.py +172 -0
  74. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_fitness.py +185 -123
  75. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_fn_coupling.py +75 -52
  76. roam_code-11.0.0/src/roam/commands/cmd_forecast.py +366 -0
  77. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_grep.py +90 -47
  78. roam_code-11.0.0/src/roam/commands/cmd_guard.py +434 -0
  79. roam_code-11.0.0/src/roam/commands/cmd_health.py +922 -0
  80. roam_code-11.0.0/src/roam/commands/cmd_hooks.py +458 -0
  81. roam_code-11.0.0/src/roam/commands/cmd_hotspots.py +606 -0
  82. roam_code-11.0.0/src/roam/commands/cmd_impact.py +228 -0
  83. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_index.py +44 -25
  84. roam_code-11.0.0/src/roam/commands/cmd_ingest_trace.py +143 -0
  85. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_init.py +35 -22
  86. roam_code-11.0.0/src/roam/commands/cmd_intent.py +459 -0
  87. roam_code-11.0.0/src/roam/commands/cmd_invariants.py +301 -0
  88. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_layers.py +175 -36
  89. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_map.py +72 -63
  90. roam_code-11.0.0/src/roam/commands/cmd_math.py +213 -0
  91. roam_code-11.0.0/src/roam/commands/cmd_mcp_setup.py +135 -0
  92. roam_code-11.0.0/src/roam/commands/cmd_metrics.py +663 -0
  93. roam_code-11.0.0/src/roam/commands/cmd_migration_safety.py +712 -0
  94. roam_code-11.0.0/src/roam/commands/cmd_minimap.py +519 -0
  95. roam_code-11.0.0/src/roam/commands/cmd_missing_index.py +885 -0
  96. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_module.py +47 -39
  97. roam_code-11.0.0/src/roam/commands/cmd_mutate.py +400 -0
  98. roam_code-11.0.0/src/roam/commands/cmd_n1.py +967 -0
  99. roam_code-11.0.0/src/roam/commands/cmd_onboard.py +740 -0
  100. roam_code-11.0.0/src/roam/commands/cmd_orchestrate.py +180 -0
  101. roam_code-11.0.0/src/roam/commands/cmd_orphan_routes.py +754 -0
  102. roam_code-11.0.0/src/roam/commands/cmd_over_fetch.py +633 -0
  103. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_owner.py +82 -57
  104. roam_code-11.0.0/src/roam/commands/cmd_partition.py +714 -0
  105. roam_code-11.0.0/src/roam/commands/cmd_path_coverage.py +564 -0
  106. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_patterns.py +171 -129
  107. roam_code-11.0.0/src/roam/commands/cmd_plan.py +616 -0
  108. roam_code-11.0.0/src/roam/commands/cmd_plan_refactor.py +432 -0
  109. roam_code-11.0.0/src/roam/commands/cmd_pr_diff.py +292 -0
  110. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_pr_risk.py +163 -135
  111. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_preflight.py +126 -118
  112. roam_code-11.0.0/src/roam/commands/cmd_relate.py +405 -0
  113. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_report.py +71 -36
  114. roam_code-11.0.0/src/roam/commands/cmd_reset.py +117 -0
  115. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_risk.py +173 -95
  116. roam_code-11.0.0/src/roam/commands/cmd_rules.py +319 -0
  117. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_safe_delete.py +86 -58
  118. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_safe_zones.py +82 -63
  119. roam_code-11.0.0/src/roam/commands/cmd_schema.py +166 -0
  120. roam_code-11.0.0/src/roam/commands/cmd_search.py +295 -0
  121. roam_code-11.0.0/src/roam/commands/cmd_search_semantic.py +101 -0
  122. roam_code-11.0.0/src/roam/commands/cmd_secrets.py +636 -0
  123. roam_code-11.0.0/src/roam/commands/cmd_semantic_diff.py +538 -0
  124. roam_code-11.0.0/src/roam/commands/cmd_simulate.py +296 -0
  125. roam_code-11.0.0/src/roam/commands/cmd_simulate_departure.py +632 -0
  126. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_sketch.py +30 -16
  127. roam_code-11.0.0/src/roam/commands/cmd_smells.py +179 -0
  128. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_snapshot.py +21 -14
  129. roam_code-11.0.0/src/roam/commands/cmd_spectral.py +183 -0
  130. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_split.py +160 -118
  131. roam_code-11.0.0/src/roam/commands/cmd_suggest_refactoring.py +486 -0
  132. roam_code-11.0.0/src/roam/commands/cmd_suggest_reviewers.py +491 -0
  133. roam_code-11.0.0/src/roam/commands/cmd_supply_chain.py +831 -0
  134. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_symbol.py +46 -21
  135. roam_code-11.0.0/src/roam/commands/cmd_syntax_check.py +301 -0
  136. roam_code-11.0.0/src/roam/commands/cmd_test_gaps.py +574 -0
  137. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_testmap.py +70 -69
  138. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_tour.py +157 -56
  139. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_trace.py +62 -48
  140. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_trend.py +143 -108
  141. roam_code-11.0.0/src/roam/commands/cmd_trends.py +929 -0
  142. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_understand.py +191 -154
  143. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_uses.py +49 -29
  144. roam_code-11.0.0/src/roam/commands/cmd_verify.py +812 -0
  145. roam_code-11.0.0/src/roam/commands/cmd_verify_imports.py +435 -0
  146. roam_code-11.0.0/src/roam/commands/cmd_vibe_check.py +932 -0
  147. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_visualize.py +61 -38
  148. roam_code-11.0.0/src/roam/commands/cmd_vuln_map.py +139 -0
  149. roam_code-11.0.0/src/roam/commands/cmd_vuln_reach.py +289 -0
  150. roam_code-11.0.0/src/roam/commands/cmd_vulns.py +414 -0
  151. roam_code-11.0.0/src/roam/commands/cmd_watch.py +759 -0
  152. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_weather.py +49 -26
  153. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_why.py +79 -73
  154. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_ws.py +187 -160
  155. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/cmd_xlang.py +63 -47
  156. roam_code-11.0.0/src/roam/commands/context_helpers.py +1137 -0
  157. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/gate_presets.py +30 -13
  158. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/graph_helpers.py +1 -0
  159. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/metrics_history.py +65 -42
  160. roam_code-11.0.0/src/roam/commands/next_steps.py +107 -0
  161. roam_code-11.0.0/src/roam/commands/resolve.py +302 -0
  162. roam_code-11.0.0/src/roam/competitor_site_data.py +2229 -0
  163. roam_code-11.0.0/src/roam/coverage_reports.py +462 -0
  164. roam_code-11.0.0/src/roam/db/connection.py +359 -0
  165. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/db/schema.py +127 -5
  166. roam_code-11.0.0/src/roam/exit_codes.py +100 -0
  167. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/__init__.py +6 -0
  168. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/anomaly.py +128 -96
  169. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/builder.py +19 -14
  170. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/clusters.py +18 -26
  171. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/cycles.py +39 -20
  172. roam_code-11.0.0/src/roam/graph/dark_matter.py +207 -0
  173. roam_code-11.0.0/src/roam/graph/diff.py +467 -0
  174. roam_code-11.0.0/src/roam/graph/fingerprint.py +297 -0
  175. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/layers.py +19 -17
  176. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/pagerank.py +76 -16
  177. roam_code-11.0.0/src/roam/graph/partition.py +437 -0
  178. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/graph/pathfinding.py +10 -17
  179. roam_code-11.0.0/src/roam/graph/propagation.py +208 -0
  180. roam_code-11.0.0/src/roam/graph/simulate.py +286 -0
  181. roam_code-11.0.0/src/roam/graph/spectral.py +260 -0
  182. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/complexity.py +413 -152
  183. roam_code-11.0.0/src/roam/index/discovery.py +338 -0
  184. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/file_roles.py +141 -63
  185. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/git_stats.py +37 -52
  186. roam_code-11.0.0/src/roam/index/indexer.py +1169 -0
  187. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/parser.py +83 -38
  188. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/relations.py +55 -29
  189. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/symbols.py +24 -20
  190. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/test_conventions.py +37 -22
  191. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/apex_lang.py +93 -54
  192. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/aura_lang.py +74 -55
  193. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/base.py +4 -6
  194. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/c_lang.py +169 -139
  195. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/csharp_lang.py +397 -308
  196. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/foxpro_lang.py +746 -327
  197. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/generic_lang.py +213 -114
  198. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/go_lang.py +132 -108
  199. roam_code-11.0.0/src/roam/languages/hcl_lang.py +398 -0
  200. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/java_lang.py +134 -110
  201. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/javascript_lang.py +340 -221
  202. roam_code-11.0.0/src/roam/languages/kotlin_lang.py +147 -0
  203. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/php_lang.py +220 -164
  204. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/python_lang.py +297 -190
  205. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/registry.py +138 -70
  206. roam_code-11.0.0/src/roam/languages/ruby_lang.py +429 -0
  207. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/rust_lang.py +192 -156
  208. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/sfxml_lang.py +91 -52
  209. roam_code-11.0.0/src/roam/languages/swift_lang.py +173 -0
  210. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/typescript_lang.py +117 -94
  211. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/visualforce_lang.py +70 -42
  212. roam_code-11.0.0/src/roam/languages/yaml_lang.py +566 -0
  213. roam_code-11.0.0/src/roam/mcp_server.py +4794 -0
  214. roam_code-11.0.0/src/roam/output/formatter.py +557 -0
  215. roam_code-11.0.0/src/roam/output/mermaid.py +62 -0
  216. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/output/sarif.py +444 -155
  217. roam_code-11.0.0/src/roam/output/schema_registry.py +57 -0
  218. roam_code-11.0.0/src/roam/plugins.py +208 -0
  219. roam_code-11.0.0/src/roam/refactor/__init__.py +0 -0
  220. roam_code-11.0.0/src/roam/refactor/codegen.py +106 -0
  221. roam_code-11.0.0/src/roam/refactor/transforms.py +711 -0
  222. roam_code-11.0.0/src/roam/rules/__init__.py +0 -0
  223. roam_code-11.0.0/src/roam/rules/ast_match.py +238 -0
  224. roam_code-11.0.0/src/roam/rules/builtin.py +617 -0
  225. roam_code-11.0.0/src/roam/rules/dataflow.py +515 -0
  226. roam_code-11.0.0/src/roam/rules/engine.py +916 -0
  227. roam_code-11.0.0/src/roam/runtime/__init__.py +3 -0
  228. roam_code-11.0.0/src/roam/runtime/hotspots.py +138 -0
  229. roam_code-11.0.0/src/roam/runtime/trace_ingest.py +535 -0
  230. roam_code-11.0.0/src/roam/search/__init__.py +1 -0
  231. roam_code-11.0.0/src/roam/search/framework_packs.py +673 -0
  232. roam_code-11.0.0/src/roam/search/index_embeddings.py +732 -0
  233. roam_code-11.0.0/src/roam/search/onnx_embeddings.py +233 -0
  234. roam_code-11.0.0/src/roam/search/tfidf.py +355 -0
  235. roam_code-11.0.0/src/roam/security/__init__.py +1 -0
  236. roam_code-11.0.0/src/roam/security/vuln_reach.py +246 -0
  237. roam_code-11.0.0/src/roam/security/vuln_store.py +334 -0
  238. roam_code-11.0.0/src/roam/surface_counts.py +158 -0
  239. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/workspace/aggregator.py +107 -98
  240. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/workspace/api_scanner.py +116 -87
  241. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/workspace/config.py +12 -9
  242. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/workspace/db.py +9 -3
  243. roam_code-11.0.0/src/roam_code.egg-info/PKG-INFO +1588 -0
  244. roam_code-11.0.0/src/roam_code.egg-info/SOURCES.txt +407 -0
  245. roam_code-11.0.0/src/roam_code.egg-info/requires.txt +19 -0
  246. roam_code-11.0.0/tests/test_adversarial.py +640 -0
  247. roam_code-11.0.0/tests/test_affected.py +328 -0
  248. roam_code-11.0.0/tests/test_agent_export.py +503 -0
  249. roam_code-11.0.0/tests/test_agent_mode.py +43 -0
  250. roam_code-11.0.0/tests/test_agent_plan_context.py +103 -0
  251. roam_code-11.0.0/tests/test_ai_ratio.py +722 -0
  252. roam_code-11.0.0/tests/test_ai_readiness.py +604 -0
  253. roam_code-11.0.0/tests/test_annotations.py +787 -0
  254. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_anomaly.py +35 -37
  255. roam_code-11.0.0/tests/test_api_changes.py +974 -0
  256. roam_code-11.0.0/tests/test_attest.py +404 -0
  257. roam_code-11.0.0/tests/test_backend_fixes_round2.py +250 -0
  258. roam_code-11.0.0/tests/test_backend_fixes_round3.py +288 -0
  259. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_basic.py +0 -1
  260. roam_code-11.0.0/tests/test_batch_mcp.py +812 -0
  261. roam_code-11.0.0/tests/test_bisect.py +382 -0
  262. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_bridges.py +36 -13
  263. roam_code-11.0.0/tests/test_bridges_extended.py +357 -0
  264. roam_code-11.0.0/tests/test_budget.py +250 -0
  265. roam_code-11.0.0/tests/test_budget_flag.py +480 -0
  266. roam_code-11.0.0/tests/test_budget_phase2.py +802 -0
  267. roam_code-11.0.0/tests/test_capsule.py +319 -0
  268. roam_code-11.0.0/tests/test_check_rules.py +984 -0
  269. roam_code-11.0.0/tests/test_ci_gate_eval.py +89 -0
  270. roam_code-11.0.0/tests/test_ci_sarif_guard.py +135 -0
  271. roam_code-11.0.0/tests/test_closure.py +213 -0
  272. roam_code-11.0.0/tests/test_codeowners.py +667 -0
  273. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_commands_architecture.py +83 -135
  274. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_commands_exploration.py +20 -7
  275. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_commands_health.py +61 -62
  276. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_commands_refactoring.py +44 -17
  277. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_commands_workflow.py +156 -82
  278. roam_code-11.0.0/tests/test_competitor_site_data.py +177 -0
  279. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_comprehensive.py +681 -670
  280. roam_code-11.0.0/tests/test_context_propagation.py +581 -0
  281. roam_code-11.0.0/tests/test_coverage_ingestion.py +123 -0
  282. roam_code-11.0.0/tests/test_cut.py +361 -0
  283. roam_code-11.0.0/tests/test_dark_matter.py +262 -0
  284. roam_code-11.0.0/tests/test_dashboard.py +182 -0
  285. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_dead_aging.py +132 -55
  286. roam_code-11.0.0/tests/test_defer_loading.py +200 -0
  287. roam_code-11.0.0/tests/test_demo_gif_asset.py +15 -0
  288. roam_code-11.0.0/tests/test_deterministic_output.py +314 -0
  289. roam_code-11.0.0/tests/test_dev_profile.py +854 -0
  290. roam_code-11.0.0/tests/test_difficulty_scoring.py +272 -0
  291. roam_code-11.0.0/tests/test_docker_assets.py +32 -0
  292. roam_code-11.0.0/tests/test_docs_coverage.py +58 -0
  293. roam_code-11.0.0/tests/test_docs_site_quality.py +81 -0
  294. roam_code-11.0.0/tests/test_doctor.py +585 -0
  295. roam_code-11.0.0/tests/test_drift.py +498 -0
  296. roam_code-11.0.0/tests/test_duplicates.py +632 -0
  297. roam_code-11.0.0/tests/test_effects.py +338 -0
  298. roam_code-11.0.0/tests/test_effects_propagation.py +323 -0
  299. roam_code-11.0.0/tests/test_endpoints.py +879 -0
  300. roam_code-11.0.0/tests/test_exclude_patterns.py +408 -0
  301. roam_code-11.0.0/tests/test_exit_codes.py +470 -0
  302. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_file_roles.py +11 -5
  303. roam_code-11.0.0/tests/test_fingerprint.py +242 -0
  304. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_fixes.py +54 -81
  305. roam_code-11.0.0/tests/test_forecast.py +320 -0
  306. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_formatters.py +9 -10
  307. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_foxpro.py +214 -107
  308. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_framework_detection.py +43 -29
  309. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_gate_presets.py +4 -9
  310. roam_code-11.0.0/tests/test_guard.py +59 -0
  311. roam_code-11.0.0/tests/test_health_gate.py +135 -0
  312. roam_code-11.0.0/tests/test_hooks.py +634 -0
  313. roam_code-11.0.0/tests/test_index.py +365 -0
  314. roam_code-11.0.0/tests/test_install_check.py +259 -0
  315. roam_code-11.0.0/tests/test_intent.py +340 -0
  316. roam_code-11.0.0/tests/test_invariants.py +244 -0
  317. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_json_contracts.py +130 -88
  318. roam_code-11.0.0/tests/test_kotlin_swift_extractors.py +127 -0
  319. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_languages.py +376 -603
  320. roam_code-11.0.0/tests/test_library_api.py +67 -0
  321. roam_code-11.0.0/tests/test_math.py +1427 -0
  322. roam_code-11.0.0/tests/test_math_tips.py +257 -0
  323. roam_code-11.0.0/tests/test_mcp_server.py +1550 -0
  324. roam_code-11.0.0/tests/test_mcp_setup.py +132 -0
  325. roam_code-11.0.0/tests/test_mermaid.py +328 -0
  326. roam_code-11.0.0/tests/test_metrics_cmd.py +513 -0
  327. roam_code-11.0.0/tests/test_minimap.py +399 -0
  328. roam_code-11.0.0/tests/test_mutate.py +337 -0
  329. roam_code-11.0.0/tests/test_next_steps.py +484 -0
  330. roam_code-11.0.0/tests/test_onboard.py +533 -0
  331. roam_code-11.0.0/tests/test_orchestrate.py +261 -0
  332. roam_code-11.0.0/tests/test_oss_bench_harness.py +70 -0
  333. roam_code-11.0.0/tests/test_pagerank_truncation.py +402 -0
  334. roam_code-11.0.0/tests/test_partition.py +558 -0
  335. roam_code-11.0.0/tests/test_path_coverage.py +356 -0
  336. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_performance.py +98 -102
  337. roam_code-11.0.0/tests/test_plan.py +396 -0
  338. roam_code-11.0.0/tests/test_plugin_discovery.py +131 -0
  339. roam_code-11.0.0/tests/test_pr_comment_script.py +168 -0
  340. roam_code-11.0.0/tests/test_pr_diff.py +334 -0
  341. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_pr_risk_author.py +35 -33
  342. roam_code-11.0.0/tests/test_progress.py +266 -0
  343. roam_code-11.0.0/tests/test_progressive_disclosure.py +531 -0
  344. roam_code-11.0.0/tests/test_properties.py +648 -0
  345. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_python_extractor_v2.py +34 -113
  346. roam_code-11.0.0/tests/test_readme_surface_consistency.py +67 -0
  347. roam_code-11.0.0/tests/test_refactoring_intelligence.py +81 -0
  348. roam_code-11.0.0/tests/test_relate.py +188 -0
  349. roam_code-11.0.0/tests/test_reset_clean.py +490 -0
  350. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_resolve.py +172 -205
  351. roam_code-11.0.0/tests/test_ruby.py +225 -0
  352. roam_code-11.0.0/tests/test_rule_profiles.py +339 -0
  353. roam_code-11.0.0/tests/test_rules.py +603 -0
  354. roam_code-11.0.0/tests/test_rules_ast_match.py +146 -0
  355. roam_code-11.0.0/tests/test_rules_community_pack.py +64 -0
  356. roam_code-11.0.0/tests/test_rules_dataflow.py +156 -0
  357. roam_code-11.0.0/tests/test_rules_symbol_requirements.py +147 -0
  358. roam_code-11.0.0/tests/test_runtime.py +521 -0
  359. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_salesforce.py +53 -54
  360. roam_code-11.0.0/tests/test_sarif_flag.py +242 -0
  361. roam_code-11.0.0/tests/test_schema_versioning.py +186 -0
  362. roam_code-11.0.0/tests/test_search_explain.py +598 -0
  363. roam_code-11.0.0/tests/test_secrets.py +660 -0
  364. roam_code-11.0.0/tests/test_secrets_v2.py +518 -0
  365. roam_code-11.0.0/tests/test_semantic_diff.py +673 -0
  366. roam_code-11.0.0/tests/test_semantic_onnx.py +182 -0
  367. roam_code-11.0.0/tests/test_semantic_search.py +458 -0
  368. roam_code-11.0.0/tests/test_simulate.py +482 -0
  369. roam_code-11.0.0/tests/test_simulate_departure.py +628 -0
  370. roam_code-11.0.0/tests/test_smells.py +809 -0
  371. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_smoke.py +34 -18
  372. roam_code-11.0.0/tests/test_sna_metrics.py +72 -0
  373. roam_code-11.0.0/tests/test_spectral.py +639 -0
  374. roam_code-11.0.0/tests/test_suggest_reviewers.py +627 -0
  375. roam_code-11.0.0/tests/test_supply_chain.py +783 -0
  376. roam_code-11.0.0/tests/test_surface_counts.py +42 -0
  377. roam_code-11.0.0/tests/test_syntax_check.py +450 -0
  378. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_test_conventions.py +15 -7
  379. roam_code-11.0.0/tests/test_test_gaps.py +569 -0
  380. roam_code-11.0.0/tests/test_trends.py +523 -0
  381. roam_code-11.0.0/tests/test_trends_cohort.py +158 -0
  382. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_v6_features.py +76 -76
  383. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_v71_features.py +45 -63
  384. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_v7_features.py +170 -81
  385. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_v82_features.py +35 -10
  386. roam_code-11.0.0/tests/test_verify.py +601 -0
  387. roam_code-11.0.0/tests/test_verify_imports.py +640 -0
  388. roam_code-11.0.0/tests/test_vibe_check.py +621 -0
  389. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_visualize.py +29 -27
  390. roam_code-11.0.0/tests/test_vuln.py +333 -0
  391. roam_code-11.0.0/tests/test_vulns_cmd.py +641 -0
  392. roam_code-11.0.0/tests/test_watch.py +591 -0
  393. {roam_code-9.0.0 → roam_code-11.0.0}/tests/test_workspace.py +238 -169
  394. roam_code-11.0.0/tests/test_yaml_hcl.py +519 -0
  395. roam_code-9.0.0/PKG-INFO +0 -1149
  396. roam_code-9.0.0/README.md +0 -1114
  397. roam_code-9.0.0/src/roam/catalog/detectors.py +0 -959
  398. roam_code-9.0.0/src/roam/catalog/tasks.py +0 -246
  399. roam_code-9.0.0/src/roam/cli.py +0 -169
  400. roam_code-9.0.0/src/roam/commands/cmd_fan.py +0 -193
  401. roam_code-9.0.0/src/roam/commands/cmd_health.py +0 -512
  402. roam_code-9.0.0/src/roam/commands/cmd_impact.py +0 -170
  403. roam_code-9.0.0/src/roam/commands/cmd_math.py +0 -130
  404. roam_code-9.0.0/src/roam/commands/cmd_search.py +0 -106
  405. roam_code-9.0.0/src/roam/commands/context_helpers.py +0 -624
  406. roam_code-9.0.0/src/roam/commands/resolve.py +0 -116
  407. roam_code-9.0.0/src/roam/db/connection.py +0 -203
  408. roam_code-9.0.0/src/roam/index/discovery.py +0 -132
  409. roam_code-9.0.0/src/roam/index/indexer.py +0 -780
  410. roam_code-9.0.0/src/roam/mcp_server.py +0 -597
  411. roam_code-9.0.0/src/roam/output/formatter.py +0 -229
  412. roam_code-9.0.0/src/roam_code.egg-info/PKG-INFO +0 -1149
  413. roam_code-9.0.0/src/roam_code.egg-info/SOURCES.txt +0 -165
  414. roam_code-9.0.0/src/roam_code.egg-info/requires.txt +0 -8
  415. roam_code-9.0.0/tests/test_math.py +0 -853
  416. {roam_code-9.0.0 → roam_code-11.0.0}/LICENSE +0 -0
  417. {roam_code-9.0.0 → roam_code-11.0.0}/setup.cfg +0 -0
  418. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/__main__.py +0 -0
  419. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/catalog/__init__.py +0 -0
  420. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/commands/__init__.py +0 -0
  421. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/db/__init__.py +0 -0
  422. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/db/queries.py +0 -0
  423. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/__init__.py +0 -0
  424. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/index/incremental.py +0 -0
  425. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/languages/__init__.py +0 -0
  426. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/output/__init__.py +0 -0
  427. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam/workspace/__init__.py +0 -0
  428. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam_code.egg-info/dependency_links.txt +0 -0
  429. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam_code.egg-info/entry_points.txt +0 -0
  430. {roam_code-9.0.0 → roam_code-11.0.0}/src/roam_code.egg-info/top_level.txt +0 -0
@@ -0,0 +1,1588 @@
1
+ Metadata-Version: 2.4
2
+ Name: roam-code
3
+ Version: 11.0.0
4
+ Summary: Instant codebase comprehension for AI coding agents
5
+ Author: CosmoHac
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Cranot/roam-code
8
+ Project-URL: Documentation, https://github.com/Cranot/roam-code#readme
9
+ Project-URL: Repository, https://github.com/Cranot/roam-code
10
+ Project-URL: Issues, https://github.com/Cranot/roam-code/issues
11
+ Keywords: code-intelligence,static-analysis,mcp-server,tree-sitter,architecture,code-graph,ai-coding,graph-analysis,code-quality,cli,codebase,code-analysis,ai-tools,mcp
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development
23
+ Classifier: Topic :: Software Development :: Code Generators
24
+ Classifier: Topic :: Software Development :: Quality Assurance
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: click>=8.0
30
+ Requires-Dist: tree-sitter>=0.23
31
+ Requires-Dist: tree-sitter-language-pack>=0.6
32
+ Requires-Dist: networkx>=3.0
33
+ Provides-Extra: mcp
34
+ Requires-Dist: fastmcp>=2.0; extra == "mcp"
35
+ Provides-Extra: semantic
36
+ Requires-Dist: numpy>=1.24; extra == "semantic"
37
+ Requires-Dist: onnxruntime>=1.16; extra == "semantic"
38
+ Requires-Dist: tokenizers>=0.15; extra == "semantic"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=7.0; extra == "dev"
41
+ Requires-Dist: pytest-xdist>=3.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.4; extra == "dev"
43
+ Requires-Dist: build>=1.0; extra == "dev"
44
+ Requires-Dist: twine>=5.0; extra == "dev"
45
+ Dynamic: license-file
46
+
47
+ <div align="center">
48
+
49
+ # roam-code
50
+
51
+ **The architectural intelligence layer for AI coding agents. Structural graph, architecture governance, multi-agent orchestration, vulnerability mapping, runtime analysis -- one CLI, zero API keys.**
52
+
53
+ *137 commands · 101 MCP tools · 26 languages · 100% local*
54
+
55
+ [![PyPI version](https://img.shields.io/pypi/v/roam-code?style=flat-square&color=blue)](https://pypi.org/project/roam-code/)
56
+ [![GitHub stars](https://img.shields.io/github/stars/Cranot/roam-code?style=flat-square)](https://github.com/Cranot/roam-code/stargazers)
57
+ [![CI](https://github.com/Cranot/roam-code/actions/workflows/roam-ci.yml/badge.svg)](https://github.com/Cranot/roam-code/actions/workflows/roam-ci.yml)
58
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-3776AB?logo=python&logoColor=white)](https://www.python.org/downloads/)
59
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
60
+
61
+ </div>
62
+
63
+ ---
64
+
65
+ ## What is Roam?
66
+
67
+ Roam is a structural intelligence engine for software. It pre-indexes your codebase into a semantic graph -- symbols, dependencies, call graphs, architecture layers, git history, and runtime traces -- stored in a local SQLite DB. Agents query it via CLI or MCP instead of repeatedly grepping files and guessing structure.
68
+
69
+ Unlike LSPs (editor-bound, language-specific) or Sourcegraph (hosted search), Roam provides architecture-level graph queries -- offline, cross-language, and compact. It goes beyond comprehension: Roam governs architecture through budget gates, simulates refactoring outcomes, orchestrates multi-agent swarms with zero-conflict guarantees, maps vulnerability reachability paths, and enables graph-level code editing without syntax errors.
70
+
71
+ ```
72
+ Codebase ──> [Index] ──> Semantic Graph ──> 137 Commands ──> AI Agent
73
+ │ │ │
74
+ tree-sitter symbols comprehend
75
+ 26 languages + edges govern
76
+ git history + metrics refactor
77
+ runtime traces + architecture orchestrate
78
+ ```
79
+
80
+ ### The problem
81
+
82
+ Coding agents explore codebases inefficiently: dozens of grep/read cycles, high token cost, no structural understanding. Roam replaces this with one graph query:
83
+
84
+ ```
85
+ $ roam context Flask
86
+ Callers: 47 Callees: 3
87
+ Affected tests: 31
88
+
89
+ Files to read:
90
+ src/flask/app.py:76-963 # definition
91
+ src/flask/__init__.py:1-15 # re-export
92
+ src/flask/testing.py:22-45 # caller: FlaskClient.__init__
93
+ tests/test_basic.py:12-30 # caller: test_app_factory
94
+ ...12 more files
95
+ ```
96
+
97
+ ### Terminal demo
98
+
99
+ ![roam terminal demo](docs/assets/roam-terminal-demo.gif)
100
+
101
+ ### Core commands
102
+
103
+ ```bash
104
+ $ roam understand # full codebase briefing
105
+ $ roam context <name> # files-to-read with exact line ranges
106
+ $ roam preflight <name> # blast radius + tests + complexity + architecture rules
107
+ $ roam health # composite score (0-100)
108
+ $ roam diff # blast radius of uncommitted changes
109
+ ```
110
+
111
+ ## What's New in v11
112
+
113
+ ### MCP v2 for Agent-First Workflows
114
+ - In-process MCP execution removes per-call subprocess overhead.
115
+ - 4 compound operations (`roam_explore`, `roam_prepare_change`, `roam_review_change`, `roam_diagnose_issue`) reduce multi-step agent workflows to single calls.
116
+ - Preset-based tool surfacing (`core`, `review`, `refactor`, `debug`, `architecture`, `full`) keeps default tool choice tight for agents while retaining full depth on demand.
117
+ - MCP tools now expose structured schemas and richer annotations for safer planner behavior.
118
+ - MCP token overhead for default core context dropped from ~36K to <3K tokens (about 92% reduction).
119
+
120
+ ### Performance and Retrieval
121
+ - Symbol search moved to SQLite FTS5/BM25: typical search moved from seconds to milliseconds (about 1000x on benchmarked paths).
122
+ - Incremental indexing shifted from O(N) full-edge rebuild behavior to O(changed) updates.
123
+ - DB/runtime optimizations (`mmap_size`, safer large-graph guards, batched writes) reduce first-run and reindex friction on larger repos.
124
+
125
+ ### CI, Governance, and Delivery
126
+ - GitHub Action supports quality gates, SARIF upload, sticky PR comments, and cache-aware execution.
127
+ - CI hardening includes changed-only analysis mode, trend-aware gates, and SARIF pre-upload guardrails (size/result caps + truncation signaling).
128
+ - Agent governance expanded with verification and AI-quality tooling (`roam verify`, `roam vibe-check`, `roam ai-readiness`, `roam ai-ratio`) for teams managing agent-written code.
129
+
130
+ ## Best for
131
+
132
+ - **Agent-assisted coding** -- structured answers that reduce token usage vs raw file exploration
133
+ - **Large codebases (100+ files)** -- graph queries beat linear search at scale
134
+ - **Architecture governance** -- health scores, CI quality gates, budget enforcement, fitness functions
135
+ - **Safe refactoring** -- blast radius, affected tests, pre-change safety checks, graph-level editing
136
+ - **Multi-agent orchestration** -- partition codebases for parallel agent work with zero-conflict guarantees
137
+ - **Security analysis** -- vulnerability reachability mapping, auth gaps, CVE path tracing
138
+ - **Algorithm optimization** -- detect O(n^2) loops, N+1 queries, and 21 other anti-patterns with suggested fixes
139
+ - **Backend quality** -- auth gaps, missing indexes, over-fetching models, non-idempotent migrations, orphan routes, API drift
140
+ - **Runtime analysis** -- overlay production trace data onto the static graph for hotspot detection
141
+ - **Multi-repo projects** -- cross-repo API edge detection between frontend and backend
142
+
143
+ ### When NOT to use Roam
144
+
145
+ - **Real-time type checking** -- use an LSP (pyright, gopls, tsserver). Roam is static and offline.
146
+ - **Small scripts (<10 files)** -- just read the files directly.
147
+ - **Pure text search** -- ripgrep is faster for raw string matching.
148
+
149
+ ## Why use Roam
150
+
151
+ **Speed.** One command replaces 5-10 tool calls (in typical workflows). Under 0.5s for any query.
152
+
153
+ **Dependency-aware.** Computes structure, not string matches. Knows `Flask` has 47 dependents and 31 affected tests. `grep` knows it appears 847 times.
154
+
155
+ **LLM-optimized output.** Plain ASCII, compact abbreviations (`fn`, `cls`, `meth`), `--json` envelopes. Designed for agent consumption, not human decoration.
156
+
157
+ **Fully local.** No API keys, telemetry, or network calls. Works in air-gapped environments.
158
+
159
+ **Algorithm-aware.** Built-in catalog of 23 anti-patterns. Detects suboptimal algorithms (quadratic loops, N+1 queries, unbounded recursion) and suggests fixes with Big-O improvements and confidence scores. Receiver-aware loop-invariant analysis minimizes false positives.
160
+
161
+ **CI-ready.** `--json` output, `--gate` quality gates, GitHub Action, SARIF 2.1.0.
162
+
163
+ | | Without Roam | With Roam |
164
+ |--|-------------|-----------|
165
+ | Tool calls | 8 | **1** |
166
+ | Wall time | ~11s | **<0.5s** |
167
+ | Tokens consumed | ~15,000 | **~3,000** |
168
+
169
+ *Measured on a typical agent workflow in a 200-file Python project (Flask). See [benchmarks](#performance) for more.*
170
+
171
+ <details>
172
+ <summary><strong>Table of Contents</strong></summary>
173
+
174
+ **Getting Started:** [What is Roam?](#what-is-roam) · [What's New in v11](#whats-new-in-v11) · [Best for](#best-for) · [Why use Roam](#why-use-roam) · [Install](#install) · [Quick Start](#quick-start)
175
+
176
+ **Using Roam:** [Commands](#commands) · [Walkthrough](#walkthrough-investigating-a-codebase) · [AI Coding Tools](#integration-with-ai-coding-tools) · [MCP Server](#mcp-server)
177
+
178
+ **Operations:** [CI/CD Integration](#cicd-integration) · [SARIF Output](#sarif-output) · [For Teams](#for-teams)
179
+
180
+ **Reference:** [Language Support](#language-support) · [Performance](#performance) · [How It Works](#how-it-works) · [How Roam Compares](#how-roam-compares) · [FAQ](#faq)
181
+
182
+ **More:** [Limitations](#limitations) · [Troubleshooting](#troubleshooting) · [Update / Uninstall](#update--uninstall) · [Development](#development) · [Contributing](#contributing)
183
+
184
+ </details>
185
+
186
+ ## Install
187
+
188
+ ```bash
189
+ pip install roam-code
190
+
191
+ # Recommended: isolated environment
192
+ pipx install roam-code
193
+ # or
194
+ uv tool install roam-code
195
+
196
+ # From source
197
+ pip install git+https://github.com/Cranot/roam-code.git
198
+ ```
199
+
200
+ Requires Python 3.9+. Works on Linux, macOS, and Windows.
201
+
202
+ > **Windows:** If `roam` is not found after installing with `uv`, run `uv tool update-shell` and restart your terminal.
203
+
204
+ ### Docker (alpine-based)
205
+
206
+ ```bash
207
+ docker build -t roam-code .
208
+ docker run --rm -v "$PWD:/workspace" roam-code index
209
+ docker run --rm -v "$PWD:/workspace" roam-code health
210
+ ```
211
+
212
+ ## Quick Start
213
+
214
+ ```bash
215
+ cd your-project
216
+ roam init # indexes codebase, creates config + CI workflow
217
+ roam understand # full codebase briefing
218
+ ```
219
+
220
+ First index takes ~5s for 200 files, ~15s for 1,000 files. Subsequent runs are incremental and near-instant.
221
+
222
+ **Next steps:**
223
+
224
+ - **Set up your AI agent:** `roam describe --write` (auto-detects CLAUDE.md, AGENTS.md, .cursor/rules, etc. — see [integration instructions](#integration-with-ai-coding-tools))
225
+ - **Explore:** `roam health` → `roam weather` → `roam map`
226
+ - **Add to CI:** `roam init` already generated a GitHub Action
227
+
228
+ <details>
229
+ <summary><strong>Try it on Roam itself</strong></summary>
230
+
231
+ ```bash
232
+ git clone https://github.com/Cranot/roam-code.git
233
+ cd roam-code
234
+ pip install -e .
235
+ roam init
236
+ roam understand
237
+ roam health
238
+ ```
239
+
240
+ </details>
241
+
242
+ ## Works With
243
+
244
+ <p align="center">
245
+ <a href="#integration-with-ai-coding-tools">Claude Code</a> &bull;
246
+ <a href="#integration-with-ai-coding-tools">Cursor</a> &bull;
247
+ <a href="#integration-with-ai-coding-tools">Windsurf</a> &bull;
248
+ <a href="#integration-with-ai-coding-tools">GitHub Copilot</a> &bull;
249
+ <a href="#integration-with-ai-coding-tools">Aider</a> &bull;
250
+ <a href="#integration-with-ai-coding-tools">Cline</a> &bull;
251
+ <a href="#integration-with-ai-coding-tools">Gemini CLI</a> &bull;
252
+ <a href="#integration-with-ai-coding-tools">OpenAI Codex CLI</a> &bull;
253
+ <a href="#mcp-server">MCP</a> &bull;
254
+ <a href="#cicd-integration">GitHub Actions</a> &bull;
255
+ <a href="#cicd-integration">GitLab CI</a> &bull;
256
+ <a href="#cicd-integration">Azure DevOps</a>
257
+ </p>
258
+
259
+ ## Commands
260
+
261
+ The [5 core commands](#core-commands) shown above cover ~80% of agent workflows. All 137 commands are organized into 7 categories.
262
+
263
+ <details>
264
+ <summary><strong>Full command reference</strong></summary>
265
+
266
+ ### Getting Started
267
+
268
+ | Command | Description |
269
+ |---------|-------------|
270
+ | `roam index [--force] [--verbose]` | Build or rebuild the codebase index |
271
+ | `roam watch [--interval N] [--debounce N] [--webhook-port P] [--guardian]` | Long-running index daemon: poll/webhook-triggered refreshes plus optional continuous architecture-guardian snapshots and JSONL compliance artifacts |
272
+ | `roam init` | Guided onboarding: creates `.roam/fitness.yaml`, CI workflow, runs index, shows health |
273
+ | `roam hooks [--install] [--uninstall]` | Manage git hooks for automated roam index updates and health gates |
274
+ | `roam doctor` | Diagnose installation and environment: verify tree-sitter grammars, SQLite, git, and config health |
275
+ | `roam reset [--hard]` | Reset the roam index and cached data. `--hard` removes all `.roam/` artifacts |
276
+ | `roam clean [--all]` | Remove stale or orphaned index entries without a full rebuild |
277
+ | `roam understand` | Full codebase briefing: tech stack, architecture, key abstractions, health, conventions, complexity overview, entry points |
278
+ | `roam onboard` | Structured onboarding guide: architecture map, key files, suggested reading order, and first tasks |
279
+ | `roam tour [--write PATH]` | Auto-generated onboarding guide: top symbols, reading order, entry points, language breakdown. `--write` saves to Markdown |
280
+ | `roam describe [--write] [--force] [-o PATH] [--agent-prompt]` | Auto-generate project description for AI agents. `--write` auto-detects your agent's config file. `--agent-prompt` returns a compact (<500 token) system prompt |
281
+ | `roam agent-export [--format F] [--write]` | Generate agent-context bundle from project analysis (`AGENTS.md` + provider-specific overlays) |
282
+ | `roam minimap [--update] [-o FILE] [--init-notes]` | Compact annotated codebase snapshot for agent config injection: stack, annotated directory tree, key symbols by PageRank, high fan-in symbols to avoid touching, hotspots, conventions. Sentinel-based in-place updates |
283
+ | `roam config [--set-db-dir PATH] [--semantic-backend MODE]` | Manage `.roam/config.json` (DB path, excludes, optional ONNX semantic settings) |
284
+ | `roam map [-n N] [--full] [--budget N]` | Project skeleton: files, languages, entry points, top symbols by PageRank. `--budget` caps output to N tokens |
285
+ | `roam schema [--diff] [--version V]` | JSON envelope schema versioning: view, diff, and validate output schemas |
286
+ | `roam mcp [--list-tools] [--transport T]` | Start MCP server (stdio/SSE/streamable-http), inspect available tools, and expose roam to coding agents |
287
+ | `roam mcp-setup <platform>` | Generate MCP config snippets for AI platforms: claude-code, cursor, windsurf, vscode, gemini-cli, codex-cli |
288
+
289
+ ### Daily Workflow
290
+
291
+ | Command | Description |
292
+ |---------|-------------|
293
+ | `roam file <path> [--full] [--changed] [--deps-of PATH]` | File skeleton: all definitions with signatures, cognitive load index, health score |
294
+ | `roam symbol <name> [--full]` | Symbol definition + callers + callees + metrics. Supports `file:symbol` disambiguation |
295
+ | `roam context <symbol> [--task MODE] [--for-file PATH]` | AI-optimized context: definition + callers + callees + files-to-read with line ranges |
296
+ | `roam search <pattern> [--kind KIND]` | Find symbols by name pattern, PageRank-ranked |
297
+ | `roam grep <pattern> [-g glob] [-n N]` | Text search annotated with enclosing symbol context |
298
+ | `roam deps <path> [--full]` | What a file imports and what imports it |
299
+ | `roam trace <source> <target> [-k N]` | Dependency paths with coupling strength and hub detection |
300
+ | `roam impact <symbol>` | Blast radius: what breaks if a symbol changes (Personalized PageRank weighted) |
301
+ | `roam diff [--staged] [--full] [REV_RANGE]` | Blast radius of uncommitted changes or a commit range |
302
+ | `roam pr-risk [REV_RANGE]` | PR risk score (0-100, multiplicative model) + structural spread + suggested reviewers |
303
+ | `roam pr-diff [--staged] [--range R] [--format markdown]` | Structural PR diff: metric deltas, edge analysis, symbol changes, footprint. Not text diff — graph delta |
304
+ | `roam api-changes [REV_RANGE]` | API change classifier: breaking/non-breaking changes, severity, and affected contracts |
305
+ | `roam semantic-diff [REV_RANGE]` | Structural change summary: symbols added/removed/modified and changed call edges |
306
+ | `roam test-gaps [REV_RANGE]` | Changed-symbol test gap detection: what changed and what still lacks test coverage |
307
+ | `roam affected [REV_RANGE]` | Monorepo/package impact analysis: what components are affected by a change |
308
+ | `roam attest [REV_RANGE] [--format markdown] [--sign]` | Proof-carrying PR attestation: bundles blast radius, risk, breaking changes, fitness, budget, tests, effects into one verifiable artifact |
309
+ | `roam annotate <symbol> <note>` | Attach persistent notes to symbols (agentic memory across sessions) |
310
+ | `roam annotations [--file F] [--symbol S]` | View stored annotations |
311
+ | `roam diagnose <symbol> [--depth N]` | Root cause analysis: ranks suspects by z-score normalized risk |
312
+ | `roam preflight <symbol\|file>` | Compound pre-change check: blast radius + tests + complexity + coupling + fitness |
313
+ | `roam guard <symbol>` | Compact sub-agent preflight bundle: definition, 1-hop callers/callees, test files, breaking-risk score, and layer signals |
314
+ | `roam agent-plan --agents N` | Decompose partitions into dependency-ordered agent tasks with merge sequencing and handoffs |
315
+ | `roam agent-context --agent-id N [--agents M]` | Generate per-agent execution context: write scope, read-only dependencies, and interface contracts |
316
+ | `roam syntax-check [--changed] [PATHS...]` | Tree-sitter syntax integrity check for changed files and multi-agent judge workflows |
317
+ | `roam verify [--threshold N]` | Pre-commit AI-code consistency check across naming, imports, error handling, and duplication signals |
318
+ | `roam verify-imports [--file F]` | Import hallucination firewall: validate all imports against indexed symbol table, suggest corrections via FTS5 fuzzy matching |
319
+ | `roam safe-delete <symbol>` | Safe deletion check: SAFE/REVIEW/UNSAFE verdict |
320
+ | `roam test-map <name>` | Map a symbol or file to its test coverage |
321
+ | `roam adversarial [--staged] [--range R]` | Adversarial architecture review: generates targeted challenges based on changes |
322
+ | `roam plan [--staged] [--range R] [--agents N]` | Agent work planner: decompose changes into sequenced, dependency-aware steps |
323
+ | `roam closure <symbol> [--rename] [--delete]` | Minimal-change synthesis: all files to touch for a safe rename/delete |
324
+ | `roam mutate move\|rename\|add-call\|extract` | Graph-level code editing: move symbols, rename across codebase, add calls, extract functions. Dry-run by default |
325
+
326
+ ### Codebase Health
327
+
328
+ | Command | Description |
329
+ |---------|-------------|
330
+ | `roam health [--no-framework] [--gate]` | Composite health score (0-100): weighted geometric mean of tangle ratio, god components, bottlenecks, layer violations. `--gate` runs quality gate checks from `.roam-gates.yml` (exit 5 on failure) |
331
+ | `roam smells [--file F] [--min-severity S]` | Code smell detection: 15 deterministic detectors (brain methods, god classes, feature envy, shotgun surgery, data clumps, etc.) with per-file health scores |
332
+ | `roam dashboard` | Unified single-screen project status: health, hotspots, risks, ownership, and AI-rot indicators |
333
+ | `roam vibe-check [--threshold N]` | AI-rot auditor: 8-pattern taxonomy with composite risk score and prioritized findings |
334
+ | `roam ai-readiness` | 0-100 score for how well this codebase supports AI coding agents |
335
+ | `roam ai-ratio [--since N]` | Statistical estimate of AI-generated code ratio using commit-behavior signals |
336
+ | `roam trends [--record] [--days N] [--metric M]` | Historical metrics snapshots with sparklines and trend deltas |
337
+ | `roam complexity [--bumpy-road]` | Per-function cognitive complexity (SonarSource-compatible, triangular nesting penalty) + Halstead metrics (volume, difficulty, effort, bugs) + cyclomatic density |
338
+ | `roam algo [--task T] [--confidence C] [--profile P]` | Algorithm anti-pattern detection: 23-pattern catalog detects suboptimal algorithms (O(n^2) loops, N+1 queries, quadratic string building, branching recursion, loop-invariant calls) and suggests better approaches with Big-O improvements. Confidence calibration via caller-count + runtime traces, evidence paths, impact scoring, framework-aware N+1 packs, and language-aware fix templates. Alias: `roam math` |
339
+ | `roam n1 [--confidence C] [--verbose]` | Implicit N+1 I/O detection: finds ORM model computed properties (`$appends`/accessors) that trigger lazy-loaded DB queries in collection contexts. Cross-references with eager loading config. Supports Laravel, Django, Rails, SQLAlchemy, JPA |
340
+ | `roam over-fetch [--threshold N] [--confidence C]` | Detect models serializing too many fields: large `$fillable` without `$hidden`/`$visible`, direct controller returns bypassing API Resources, poor exposed-to-hidden ratio |
341
+ | `roam missing-index [--table T] [--confidence C]` | Find queries on non-indexed columns: cross-references `WHERE`/`ORDER BY` clauses, foreign keys, and paginated queries against migration-defined indexes |
342
+ | `roam weather [-n N]` | Hotspots ranked by geometric mean of churn x complexity (percentile-normalized) |
343
+ | `roam debt [--roi]` | Hotspot-weighted tech debt prioritization with SQALE remediation costs and optional refactoring ROI estimates |
344
+ | `roam fitness [--explain]` | Architectural fitness functions from `.roam/fitness.yaml` |
345
+ | `roam alerts` | Health degradation trend detection (Mann-Kendall + Sen's slope) |
346
+ | `roam snapshot [--tag TAG]` | Persist health metrics snapshot for trend tracking |
347
+ | `roam trend` | Health score history with sparkline visualization |
348
+ | `roam digest [--brief] [--since TAG]` | Compare current metrics against last snapshot |
349
+ | `roam forecast [--symbol S] [--horizon N] [--alert-only]` | Predict when metrics will exceed thresholds: Theil-Sen regression on snapshot history + churn-weighted per-symbol risk |
350
+ | `roam budget [--init] [--staged] [--range R]` | Architectural budget enforcement: per-PR delta limits on health, cycles, complexity. CI gate (exit 1 on violation) |
351
+ | `roam bisect [--metric M] [--range R]` | Architectural git bisect: find the commit that degraded a specific metric |
352
+ | `roam ingest-trace <file> [--otel\|--jaeger\|--zipkin\|--generic]` | Ingest runtime trace data (OpenTelemetry, Jaeger, Zipkin) for hotspot overlay |
353
+ | `roam hotspots [--runtime] [--discrepancy]` | Runtime hotspot analysis: find symbols missed by static analysis but critical at runtime |
354
+
355
+ <details>
356
+ <summary><strong>roam algo — algorithm anti-pattern catalog (23 patterns)</strong></summary>
357
+
358
+ `roam algo` scans every indexed function against a 23-pattern catalog, ranks findings by runtime-aware impact score, and shows the exact Big-O improvement available. Findings include semantic evidence paths, precision metadata, and language-aware tips/fixes (Python, JS, Go, Rust, Java, etc.):
359
+
360
+ ```
361
+ $ roam algo
362
+ VERDICT: 8 algorithmic improvements found (3 high, 4 medium, 1 low)
363
+ Ordering: highest impact first
364
+ Profile: balanced (filtered 0 low-signal findings)
365
+
366
+ Nested loop lookup (2):
367
+ fn resolve_permissions src/auth/rbac.py:112 [high, impact=86.4]
368
+ Current: Nested iteration -- O(n*m)
369
+ Better: Hash-map join -- O(n+m)
370
+ Tip: Build a dict/set from one collection, iterate the other
371
+
372
+ fn find_matching_rule src/rules/engine.py:67 [high, impact=78.1]
373
+ Current: Nested iteration -- O(n*m)
374
+ Better: Hash-map join -- O(n+m)
375
+ Tip: Build a dict/set from one collection, iterate the other
376
+
377
+ String building (1):
378
+ meth build_query src/db/query.py:88 [high, impact=74.0]
379
+ Current: Loop concatenation -- O(n^2)
380
+ Better: Join / StringBuilder -- O(n)
381
+ Tip: Collect parts in a list, join once at the end
382
+
383
+ Branching recursion without memoization (1):
384
+ fn compute_cost src/pricing/calc.py:34 [medium, impact=49.5]
385
+ Current: Naive branching recursion -- O(2^n)
386
+ Better: Memoized / iterative DP -- O(n)
387
+ Tip: Add @cache / @lru_cache, or convert to iterative with a table
388
+ ```
389
+
390
+ **Full catalog — 23 patterns:**
391
+
392
+ | Pattern | Anti-pattern detected | Better approach | Improvement |
393
+ |---------|----------------------|-----------------|-------------|
394
+ | Nested loop lookup | `for x in a: for y in b: if x==y` | Hash-map join | O(n·m) → O(n+m) |
395
+ | Membership test | `if x in list` in a loop | Set lookup | O(n) → O(1) per check |
396
+ | Sorting | Bubble / selection sort | Built-in sort | O(n²) → O(n log n) |
397
+ | Search in sorted data | Linear scan on sorted sequence | Binary search | O(n) → O(log n) |
398
+ | String building | `s += chunk` in loop | `join()` / StringBuilder | O(n²) → O(n) |
399
+ | Deduplication | Nested loop dedup | `set()` / `dict.fromkeys` | O(n²) → O(n) |
400
+ | Max / min | Manual tracking loop | `max()` / `min()` | idiom |
401
+ | Accumulation | Manual accumulator | `sum()` / `reduce()` | idiom |
402
+ | Group by key | Manual key-existence check | `defaultdict` / `groupingBy` | idiom |
403
+ | Fibonacci | Naive recursion | Iterative / `@lru_cache` | O(2ⁿ) → O(n) |
404
+ | Exponentiation | Loop multiplication | `pow(b, e, mod)` | O(n) → O(log n) |
405
+ | GCD | Manual loop | `math.gcd()` | O(n) → O(log n) |
406
+ | Matrix multiply | Naive triple loop | NumPy / BLAS | same asymptotic, ~1000× faster via SIMD |
407
+ | Busy wait | `while True: sleep()` poll | Event / condition variable | O(k) → O(1) wake-up |
408
+ | Regex in loop | `re.match()` compiled per iteration | Pre-compiled pattern | O(n·(p+m)) → O(p + n·m) |
409
+ | N+1 query | Per-item DB / API call in loop | Batch `WHERE IN (...)` | n round-trips → 1 |
410
+ | List front operations | `list.insert(0, x)` in loop | `collections.deque` | O(n) → O(1) per op |
411
+ | Sort to select | `sorted(x)[0]` or `sorted(x)[:k]` | `min()` / `heapq.nsmallest` | O(n log n) → O(n) or O(n log k) |
412
+ | Repeated lookup | `.index()` / `.contains()` inside loop | Pre-built set / dict | O(m) → O(1) per lookup |
413
+ | Branching recursion | Naive `f(n-1) + f(n-2)` without cache | `@cache` / iterative DP | O(2ⁿ) → O(n) |
414
+ | Quadratic string building | `result += chunk` across multiple scopes | `parts.append` + `join` at end | O(n²) → O(n) |
415
+ | Loop-invariant call | `get_config()` / `compile_schema()` inside loop body | Hoist before loop | per-iter cost → O(1) |
416
+ | String reversal | Manual char-by-char loop | `s[::-1]` / `.reverse()` | idiom |
417
+
418
+ **Filtering:**
419
+
420
+ ```bash
421
+ roam algo --task nested-lookup # one pattern type only
422
+ roam algo --confidence high # high-confidence findings only
423
+ roam algo --profile strict # precision-first filtering
424
+ roam algo --task io-in-loop -n 5 # top 5 N+1 query sites
425
+ roam --json algo # machine-readable output
426
+ roam --sarif algo > roam-algo.sarif # SARIF with fingerprints + fixes
427
+ ```
428
+
429
+ **Confidence calibration:** `high` = strong structural signal (unbounded loop + high caller/runtime impact + pattern confirmed); `medium` = pattern matched but uncertainty remains; `low` = heuristic signal only.
430
+
431
+ **Profiles:** `balanced` (default), `strict` (precision-first), `aggressive` (surface more candidates).
432
+
433
+ </details>
434
+
435
+ <details>
436
+ <summary><strong>roam minimap — annotated codebase snapshot for agent configs</strong></summary>
437
+
438
+ `roam minimap` generates a compact block (stack, annotated directory tree, key symbols, hotspots, conventions) wrapped in sentinel comments for in-place agent config updates:
439
+
440
+ ```
441
+ $ roam minimap
442
+ <!-- roam:minimap generated=2026-02-25 -->
443
+ **Stack:** Python · JavaScript · YAML
444
+
445
+ ```
446
+ .github/ (CI + Action)
447
+ benchmarks/ (agent-eval + oss-eval)
448
+ src/
449
+ roam/
450
+ bridges/
451
+ base.py # LanguageBridge
452
+ registry.py # register_bridge, detect_bridges
453
+ commands/ (134 files) # is_test_file, get_changed_files
454
+ db/
455
+ connection.py # find_project_root, batched_in
456
+ schema.py
457
+ graph/
458
+ builder.py # build_symbol_graph, build_file_graph
459
+ pagerank.py # compute_pagerank, compute_centrality
460
+ languages/ (20 files) # ApexExtractor
461
+ output/
462
+ formatter.py # to_json, json_envelope
463
+ cli.py # cli, LazyGroup
464
+ mcp_server.py
465
+ tests/ (151 files)
466
+ ` ` `
467
+
468
+ **Key symbols** (PageRank): `open_db` · `ensure_index` · `json_envelope` · `to_json` · `LanguageExtractor`
469
+
470
+ **Touch carefully** (fan-in >= 15): `to_json` (116 callers) · `json_envelope` (116 callers) · `open_db` (105 callers) · `ensure_index` (100 callers)
471
+
472
+ **Hotspots** (churn x complexity): `cmd_context.py` · `csharp_lang.py` · `cmd_dead.py`
473
+
474
+ **Conventions:** snake_case fns, PascalCase classes
475
+ <!-- /roam:minimap -->
476
+ ```
477
+
478
+ **Workflow:**
479
+
480
+ ```bash
481
+ roam minimap # print to stdout
482
+ roam minimap --update # replace sentinel block in CLAUDE.md in-place
483
+ roam minimap -o docs/AGENTS.md # target a different file
484
+ roam minimap --init-notes # scaffold .roam/minimap-notes.md for project gotchas
485
+ ```
486
+
487
+ The sentinel pair `<!-- roam:minimap -->` / `<!-- /roam:minimap -->` is replaced on each run — surrounding content is left intact. Add project-specific gotchas to `.roam/minimap-notes.md` and they appear in every subsequent output.
488
+
489
+ **Tree annotations** come from the top exported symbols by fan-in per file. Non-source root directories (`.github/`, `benchmarks/`, `docs/`) are collapsed immediately. Large subdirectories (e.g. `commands/`, `languages/`) are collapsed at depth 2+ with a file count.
490
+
491
+ </details>
492
+
493
+ ### Architecture
494
+
495
+ | Command | Description |
496
+ |---------|-------------|
497
+ | `roam clusters [--min-size N]` | Community detection vs directory structure. Modularity Q-score (Newman 2004) + per-cluster conductance |
498
+ | `roam spectral [--depth N] [--compare] [--gap-only] [--k K]` | Spectral bisection: Fiedler vector partition tree with algebraic connectivity gap verdict |
499
+ | `roam layers` | Topological dependency layers + upward violations + Gini balance |
500
+ | `roam dead [--all] [--summary] [--clusters]` | Unreferenced exported symbols with safety verdicts + confidence scoring (60-95%) |
501
+ | `roam fan [symbol\|file] [-n N] [--no-framework]` | Fan-in/fan-out: most connected symbols or files |
502
+ | `roam risk [-n N] [--domain KW] [--explain]` | Domain-weighted risk ranking |
503
+ | `roam why <name> [name2 ...]` | Role classification (Hub/Bridge/Core/Leaf), reach, criticality |
504
+ | `roam split <file>` | Internal symbol groups with isolation % and extraction suggestions |
505
+ | `roam entry-points` | Entry point catalog with protocol classification |
506
+ | `roam patterns` | Architectural pattern recognition: Strategy, Factory, Observer, etc. |
507
+ | `roam visualize [--format mermaid\|dot] [--focus NAME] [--limit N]` | Generate Mermaid or DOT architecture diagrams. Smart filtering via PageRank, cluster grouping, cycle highlighting |
508
+ | `roam effects [TARGET] [--file F] [--type T]` | Side-effect classification: DB writes, network I/O, filesystem, global mutation. Direct + transitive effects through call graph |
509
+ | `roam dark-matter [--min-cochanges N]` | Detect hidden co-change couplings not explained by import/call edges |
510
+ | `roam simulate move\|extract\|merge\|delete` | Counterfactual architecture simulator: test refactoring ideas in-memory, see metric deltas before writing code |
511
+ | `roam orchestrate --agents N [--files P]` | Multi-agent swarm partitioning: split codebase for parallel agents with zero-conflict guarantees |
512
+ | `roam partition [--agents N]` | Multi-agent partition manifest: conflict risk, complexity, and suggested ownership splits |
513
+ | `roam fingerprint [--compact] [--compare F]` | Topology fingerprint: extract/compare architectural signatures across repos |
514
+ | `roam cut <target> [--depth N]` | Minimum graph cuts: find critical edges whose removal disconnects components |
515
+ | `roam safe-zones` | Graph-based containment boundaries |
516
+ | `roam coverage-gaps` | Unprotected entry points with no path to gate symbols |
517
+ | `roam duplicates [--threshold T] [--min-lines N]` | Semantic duplicate detector: functionally equivalent code clusters with divergent edge-case handling |
518
+
519
+ ### Exploration
520
+
521
+ | Command | Description |
522
+ |---------|-------------|
523
+ | `roam module <path>` | Directory contents: exports, signatures, dependencies, cohesion |
524
+ | `roam sketch <dir> [--full]` | Compact structural skeleton of a directory |
525
+ | `roam uses <name>` | All consumers: callers, importers, inheritors |
526
+ | `roam owner <path>` | Code ownership: who owns a file or directory |
527
+ | `roam coupling [-n N] [--set]` | Temporal coupling: file pairs that change together (NPMI + lift) |
528
+ | `roam fn-coupling` | Function-level temporal coupling across files |
529
+ | `roam bus-factor [--brain-methods]` | Knowledge loss risk per module |
530
+ | `roam doc-staleness` | Detect stale docstrings |
531
+ | `roam docs-coverage` | Public-symbol doc coverage + stale docs + PageRank-ranked missing-doc hotlist |
532
+ | `roam suggest-refactoring [--limit N] [--min-score N]` | Proactive refactoring recommendations ranked by complexity, coupling, churn, smells, coverage gaps, and debt |
533
+ | `roam plan-refactor <symbol> [--operation auto\|extract\|move]` | Ordered refactor plan with blast radius, test gaps, layer risk, and simulation-based strategy preview |
534
+ | `roam conventions` | Auto-detect naming styles, import preferences. Flags outliers |
535
+ | `roam breaking [REV_RANGE]` | Breaking change detection: removed exports, signature changes |
536
+ | `roam affected-tests <symbol\|file>` | Trace reverse call graph to test files |
537
+ | `roam relate <sym1> <sym2>` | Show relationship between two symbols: shared callers, shortest path, common ancestors |
538
+ | `roam endpoints [--routes] [--api]` | Enumerate all HTTP/API endpoint definitions and surface them for review or cross-repo matching |
539
+ | `roam metrics <file\|symbol>` | Unified vital signs: complexity, fan-in/out, PageRank, churn, test coverage, dead code risk -- all in one call |
540
+ | `roam search-semantic <query>` | Hybrid semantic search: BM25 + TF-IDF + optional local ONNX vectors (select via `--backend`) with framework/library packs |
541
+ | `roam intent [--staged] [--range R]` | Doc-to-code linking: match documentation to symbols, detect drift |
542
+ | `roam x-lang [--bridges] [--edges]` | Cross-language edge browser: inspect bridge-resolved connections |
543
+
544
+ ### Reports & CI
545
+
546
+ | Command | Description |
547
+ |---------|-------------|
548
+ | `roam report [--list] [--config FILE] [PRESET]` | Compound presets: `first-contact`, `security`, `pre-pr`, `refactor`, `guardian` |
549
+ | `roam describe --write` | Generate agent config (auto-detects: CLAUDE.md, AGENTS.md, .cursor/rules, etc.) |
550
+ | `roam auth-gaps [--routes-only] [--controllers-only] [--min-confidence C]` | Find endpoints missing authentication or authorization: routes outside auth middleware groups, CRUD methods without `$this->authorize()` / `Gate::allows()` checks. String-aware PHP brace parsing |
551
+ | `roam orphan-routes [-n N] [--confidence C]` | Detect backend routes with no frontend consumer: parses route definitions, searches frontend for API call references, reports controller methods with no route mapping |
552
+ | `roam migration-safety [-n N] [--include-archive]` | Detect non-idempotent migrations: missing `hasTable`/`hasColumn` guards, raw SQL without `IF NOT EXISTS`, index operations without existence checks |
553
+ | `roam api-drift [--model M] [--confidence C]` | Detect mismatches between PHP model `$fillable`/`$appends` fields and TypeScript interface properties. Auto-converts snake_case/camelCase for comparison. Single-repo; cross-repo planned for `roam ws api-drift` |
554
+ | `roam codeowners [--unowned] [--owner NAME]` | CODEOWNERS coverage analysis: owned/unowned files, top owners, and ownership risk |
555
+ | `roam drift [--threshold N]` | Ownership drift detection: declared ownership vs observed maintenance activity |
556
+ | `roam suggest-reviewers [REV_RANGE]` | Reviewer recommendation via ownership, recency, breadth, and impact signals |
557
+ | `roam simulate-departure <developer>` | Knowledge-loss simulation: what breaks if a key contributor leaves |
558
+ | `roam dev-profile [--developer NAME] [--since N]` | Developer productivity profile: commit patterns, specialization, impact, and knowledge concentration per contributor |
559
+ | `roam secrets [--fail-on-found] [--include-tests]` | Secret scanning with masking, entropy detection, env-var suppression, remediation suggestions, and optional CI gate failure |
560
+ | `roam vulns [--import-file F] [--reachable-only]` | Vulnerability scanning: ingest npm/pip/trivy/osv reports, auto-detect format, reachability filtering, SARIF output |
561
+ | `roam path-coverage [--from P] [--to P] [--max-depth N]` | Find critical call paths (entry -> sink) with zero test protection. Suggests optimal test insertion points |
562
+ | `roam capsule [--redact-paths] [--no-signatures] [--output F]` | Export sanitized structural graph (no code bodies) for external architectural review |
563
+ | `roam rules [--init] [--ci] [--rules-dir D]` | Plugin DSL for governance: user-defined path/symbol/AST rules via `.roam/rules/` YAML (`$METAVAR` captures supported) |
564
+ | `roam check-rules [--severity S] [--fix]` | Evaluate built-in and user-defined governance rules (10 built-in: no-circular-imports, max-fan-out, etc.) |
565
+ | `roam vuln-map --generic\|--npm-audit\|--trivy F` | Ingest vulnerability reports and match to codebase symbols |
566
+ | `roam vuln-reach [--cve C] [--from E]` | Vulnerability reachability: exact paths from entry points to vulnerable calls |
567
+ | `roam supply-chain [--top N]` | Dependency risk dashboard: pin coverage, risk scoring, supply-chain health |
568
+ | `roam invariants [--staged] [--range R]` | Discover architectural contracts (invariants) from the codebase structure |
569
+
570
+ ### Multi-Repo Workspace
571
+
572
+ | Command | Description |
573
+ |---------|-------------|
574
+ | `roam ws init <repo1> <repo2> [--name NAME]` | Initialize a workspace from sibling repos. Auto-detects frontend/backend roles |
575
+ | `roam ws status` | Show workspace repos, index ages, cross-repo edge count |
576
+ | `roam ws resolve` | Scan for REST API endpoints and match frontend calls to backend routes |
577
+ | `roam ws understand` | Unified workspace overview: per-repo stats + cross-repo connections |
578
+ | `roam ws health` | Workspace-wide health report with cross-repo coupling assessment |
579
+ | `roam ws context <symbol>` | Cross-repo augmented context: find a symbol across repos + show API callers |
580
+ | `roam ws trace <source> <target>` | Trace cross-repo paths via API edges |
581
+
582
+ ### Global Options
583
+
584
+ | Option | Description |
585
+ |--------|-------------|
586
+ | `roam --json <command>` | Structured JSON output with consistent envelope |
587
+ | `roam --compact <command>` | Token-efficient output: TSV tables, minimal JSON envelope |
588
+ | `roam --sarif <command>` | SARIF 2.1.0 output for dead, health, complexity, rules, secrets, and algo (GitHub/CI integration) |
589
+ | `roam <command> --gate EXPR` | CI quality gate (e.g., `--gate score>=70`). Exit code 1 on failure |
590
+
591
+ </details>
592
+
593
+ ## Walkthrough: Investigating a Codebase
594
+
595
+ <details>
596
+ <summary><strong>10-step walkthrough using Flask as an example</strong> (click to expand)</summary>
597
+
598
+ Here's how you'd use Roam to understand a project you've never seen before. Using Flask as an example:
599
+
600
+ **Step 1: Onboard and get the full picture**
601
+
602
+ ```
603
+ $ roam init
604
+ Created .roam/fitness.yaml (6 starter rules)
605
+ Created .github/workflows/roam.yml
606
+ Done. 226 files, 1132 symbols, 233 edges.
607
+ Health: 78/100
608
+
609
+ $ roam understand
610
+ Tech stack: Python (flask, jinja2, werkzeug)
611
+ Architecture: Monolithic — 3 layers, 5 clusters
612
+ Key abstractions: Flask, Blueprint, Request, Response
613
+ Health: 78/100 — 1 god component (Flask)
614
+ Entry points: src/flask/__init__.py, src/flask/cli.py
615
+ Conventions: snake_case functions, PascalCase classes, relative imports
616
+ Complexity: avg 4.2, 3 high (>15), 0 critical (>25)
617
+ ```
618
+
619
+ **Step 2: Drill into a key file**
620
+
621
+ ```
622
+ $ roam file src/flask/app.py
623
+ src/flask/app.py (python, 963 lines)
624
+
625
+ cls Flask(App) :76-963
626
+ meth __init__(self, import_name, ...) :152
627
+ meth route(self, rule, **options) :411
628
+ meth register_blueprint(self, blueprint, ...) :580
629
+ meth make_response(self, rv) :742
630
+ ...12 more methods
631
+ ```
632
+
633
+ **Step 3: Who depends on this?**
634
+
635
+ ```
636
+ $ roam deps src/flask/app.py
637
+ Imported by:
638
+ file symbols
639
+ -------------------------- -------
640
+ src/flask/__init__.py 3
641
+ src/flask/testing.py 2
642
+ tests/test_basic.py 1
643
+ ...18 files total
644
+ ```
645
+
646
+ **Step 4: Find the hotspots**
647
+
648
+ ```
649
+ $ roam weather
650
+ === Hotspots (churn x complexity) ===
651
+ Score Churn Complexity Path Lang
652
+ ----- ----- ---------- ---------------------- ------
653
+ 18420 460 40.0 src/flask/app.py python
654
+ 12180 348 35.0 src/flask/blueprints.py python
655
+ ```
656
+
657
+ **Step 5: Check architecture health**
658
+
659
+ ```
660
+ $ roam health
661
+ Health: 78/100
662
+ Tangle: 0.0% (0/1132 symbols in cycles)
663
+ 1 god component (Flask, degree 47, actionable)
664
+ 0 bottlenecks, 0 layer violations
665
+
666
+ === God Components (degree > 20) ===
667
+ Sev Name Kind Degree Cat File
668
+ ------- ----- ---- ------ --- ------------------
669
+ WARNING Flask cls 47 act src/flask/app.py
670
+ ```
671
+
672
+ **Step 6: Get AI-ready context for a symbol**
673
+
674
+ ```
675
+ $ roam context Flask
676
+ Files to read:
677
+ src/flask/app.py:76-963 # definition
678
+ src/flask/__init__.py:1-15 # re-export
679
+ src/flask/testing.py:22-45 # caller: FlaskClient.__init__
680
+ tests/test_basic.py:12-30 # caller: test_app_factory
681
+ ...12 more files
682
+
683
+ Callers: 47 Callees: 3
684
+ ```
685
+
686
+ **Step 7: Pre-change safety check**
687
+
688
+ ```
689
+ $ roam preflight Flask
690
+ === Preflight: Flask ===
691
+ Blast radius: 47 callers, 89 transitive
692
+ Affected tests: 31 (DIRECT: 12, TRANSITIVE: 19)
693
+ Complexity: cc=40 (critical), nesting=6
694
+ Coupling: 3 hidden co-change partners
695
+ Fitness: 1 violation (max-complexity exceeded)
696
+ Verdict: HIGH RISK — consider splitting before modifying
697
+ ```
698
+
699
+ **Step 8: Decompose a large file**
700
+
701
+ ```
702
+ $ roam split src/flask/app.py
703
+ === Split analysis: src/flask/app.py ===
704
+ 87 symbols, 42 internal edges, 95 external edges
705
+ Cross-group coupling: 18%
706
+
707
+ Group 1 (routing) — 12 symbols, isolation: 83% [extractable]
708
+ meth route L411 PR=0.0088
709
+ meth add_url_rule L450 PR=0.0045
710
+ ...
711
+
712
+ === Extraction Suggestions ===
713
+ Extract 'routing' group: route, add_url_rule, endpoint (+9 more)
714
+ 83% isolated, only 3 edges to other groups
715
+ ```
716
+
717
+ **Step 9: Understand why a symbol matters**
718
+
719
+ ```
720
+ $ roam why Flask url_for Blueprint
721
+ Symbol Role Fan Reach Risk Verdict
722
+ --------- ------------ ---------- -------- -------- --------------------------------------------------
723
+ Flask Hub fan-in:47 reach:89 CRITICAL God symbol (47 in, 12 out). Consider splitting.
724
+ url_for Core utility fan-in:31 reach:45 HIGH Widely used utility (31 callers). Stable interface.
725
+ Blueprint Bridge fan-in:18 reach:34 moderate Coupling point between clusters.
726
+ ```
727
+
728
+ **Step 10: Generate docs and set up CI**
729
+
730
+ ```
731
+ $ roam describe --write
732
+ Wrote CLAUDE.md (98 lines) # auto-detects: CLAUDE.md, AGENTS.md, .cursor/rules, etc.
733
+
734
+ $ roam health --gate score>=70
735
+ Health: 78/100 — PASS
736
+ ```
737
+
738
+ Ten commands. Complete picture: structure, dependencies, hotspots, health, context, safety checks, decomposition, and CI gates.
739
+
740
+ </details>
741
+
742
+ ## Integration with AI Coding Tools
743
+
744
+ Roam is designed to be called by coding agents via shell commands. Instead of repeatedly grepping and reading files, the agent runs one `roam` command and gets structured output.
745
+
746
+ **Decision order for agents:**
747
+
748
+ | Situation | Command |
749
+ |-----------|---------|
750
+ | First time in a repo | `roam understand` then `roam tour` |
751
+ | Need to modify a symbol | `roam preflight <name>` (blast radius + tests + fitness) |
752
+ | Debugging a failure | `roam diagnose <name>` (root cause ranking) |
753
+ | Need files to read | `roam context <name>` (files + line ranges) |
754
+ | Need to find a symbol | `roam search <pattern>` |
755
+ | Need file structure | `roam file <path>` |
756
+ | Pre-PR check | `roam pr-risk HEAD~3..HEAD` |
757
+ | What breaks if I change X? | `roam impact <symbol>` |
758
+ | Check for N+1 queries | `roam n1` (implicit lazy-load detection) |
759
+ | Check auth coverage | `roam auth-gaps` (routes + controllers) |
760
+ | Check migration safety | `roam migration-safety` (idempotency guards) |
761
+
762
+ **Fastest setup:**
763
+
764
+ ```bash
765
+ roam describe --write # auto-detects your agent's config file
766
+ roam describe --write -o AGENTS.md # or specify an explicit path
767
+ roam describe --agent-prompt # compact ~500-token prompt (append to any config)
768
+ roam minimap --update # inject/refresh annotated codebase minimap in CLAUDE.md
769
+ ```
770
+
771
+ **Agent not using Roam correctly?** If your agent is ignoring Roam and falling back to grep/read exploration, it likely doesn't have the instructions. Run:
772
+
773
+ ```bash
774
+ roam describe --write # writes instructions to your agent's config (CLAUDE.md, AGENTS.md, etc.)
775
+ ```
776
+
777
+ If you already have a config file and don't want to overwrite it:
778
+
779
+ ```bash
780
+ roam describe --agent-prompt # prints a compact prompt — copy-paste into your existing config
781
+ roam minimap --update # injects an annotated codebase snapshot into CLAUDE.md (won't touch other content)
782
+ ```
783
+
784
+ This teaches the agent which Roam command to use for each situation (e.g., `roam preflight` before changes, `roam context` for files to read, `roam diagnose` for debugging).
785
+
786
+ <details>
787
+ <summary><strong>Copy-paste agent instructions</strong></summary>
788
+
789
+ ```markdown
790
+ ## Codebase navigation
791
+
792
+ This project uses `roam` for codebase comprehension. Always prefer roam over Glob/Grep/Read exploration.
793
+
794
+ Before modifying any code:
795
+ 1. First time in the repo: `roam understand` then `roam tour`
796
+ 2. Find a symbol: `roam search <pattern>`
797
+ 3. Before changing a symbol: `roam preflight <name>` (blast radius + tests + fitness)
798
+ 4. Need files to read: `roam context <name>` (files + line ranges, prioritized)
799
+ 5. Debugging a failure: `roam diagnose <name>` (root cause ranking)
800
+ 6. After making changes: `roam diff` (blast radius of uncommitted changes)
801
+
802
+ Additional: `roam health` (0-100 score), `roam impact <name>` (what breaks),
803
+ `roam pr-risk` (PR risk), `roam file <path>` (file skeleton).
804
+
805
+ Run `roam --help` for all commands. Use `roam --json <cmd>` for structured output.
806
+ ```
807
+
808
+ </details>
809
+
810
+ <details>
811
+ <summary><strong>Where to put this for each tool</strong></summary>
812
+
813
+ | Tool | Config file |
814
+ |------|-------------|
815
+ | **Claude Code** | `CLAUDE.md` in your project root |
816
+ | **OpenAI Codex CLI** | `AGENTS.md` in your project root |
817
+ | **Gemini CLI** | `GEMINI.md` in your project root |
818
+ | **Cursor** | `.cursor/rules/roam.mdc` (add `alwaysApply: true` frontmatter) |
819
+ | **Windsurf** | `.windsurf/rules/roam.md` (add `trigger: always_on` frontmatter) |
820
+ | **GitHub Copilot** | `.github/copilot-instructions.md` |
821
+ | **Aider** | `CONVENTIONS.md` |
822
+ | **Continue.dev** | `config.yaml` rules |
823
+ | **Cline** | `.clinerules/` directory |
824
+
825
+ </details>
826
+
827
+ <details>
828
+ <summary><strong>Roam vs native tools</strong></summary>
829
+
830
+ | Task | Use Roam | Use native tools |
831
+ |------|----------|-----------------|
832
+ | "What calls this function?" | `roam symbol <name>` | LSP / Grep |
833
+ | "What files do I need to read?" | `roam context <name>` | Manual tracing (5+ calls) |
834
+ | "Is it safe to change X?" | `roam preflight <name>` | Multiple manual checks |
835
+ | "Show me this file's structure" | `roam file <path>` | Read the file directly |
836
+ | "Understand project architecture" | `roam understand` | Manual exploration |
837
+ | "What breaks if I change X?" | `roam impact <symbol>` | No direct equivalent |
838
+ | "What tests to run?" | `roam affected-tests <name>` | Grep for imports (misses indirect) |
839
+ | "What's causing this bug?" | `roam diagnose <name>` | Manual call-chain tracing |
840
+ | "Codebase health score for CI" | `roam health --gate score>=70` | No equivalent |
841
+
842
+ </details>
843
+
844
+ ## MCP Server
845
+
846
+ Roam includes a [Model Context Protocol](https://modelcontextprotocol.io/) server for direct integration with tools that support MCP.
847
+
848
+ ```bash
849
+ pip install "roam-code[mcp]"
850
+ roam mcp
851
+ ```
852
+
853
+ 101 tools, 10 resources, and 5 prompts are available in the full preset. Most tools are read-only index queries; side-effect tools are explicitly annotated.
854
+
855
+ **MCP v2 highlights (v11):**
856
+ - In-process MCP execution (no subprocess shell-out per call)
857
+ - Preset-based tool surfacing (`core`, `review`, `refactor`, `debug`, `architecture`, `full`)
858
+ - Compound tools that collapse multi-step exploration/review flows into one call
859
+ - Structured output schemas + tool annotations for safer planner behavior
860
+
861
+ **Default preset:** `core` (24 tools: 23 core + `roam_expand_toolset` meta-tool).
862
+
863
+ ```bash
864
+ # Default
865
+ roam mcp
866
+
867
+ # Full toolset
868
+ ROAM_MCP_PRESET=full roam mcp
869
+
870
+ # Legacy compatibility (same as full preset)
871
+ ROAM_MCP_LITE=0 roam mcp
872
+ ```
873
+
874
+ Core preset tools: `roam_affected_tests`, `roam_batch_get`, `roam_batch_search`, `roam_complexity_report`, `roam_context`, `roam_dead_code`, `roam_deps`, `roam_diagnose`, `roam_diagnose_issue`, `roam_diff`, `roam_expand_toolset`, `roam_explore`, `roam_file_info`, `roam_health`, `roam_impact`, `roam_pr_risk`, `roam_preflight`, `roam_prepare_change`, `roam_review_change`, `roam_search_symbol`, `roam_syntax_check`, `roam_trace`, `roam_understand`, `roam_uses`.
875
+
876
+ <details>
877
+ <summary><strong>MCP tool list (all 101)</strong></summary>
878
+
879
+ | Tool | Description |
880
+ |------|-------------|
881
+ | `roam_understand` | Full codebase briefing |
882
+ | `roam_health` | Health score (0-100) + issues |
883
+ | `roam_preflight` | Pre-change safety check |
884
+ | `roam_search_symbol` | Find symbols by name |
885
+ | `roam_context` | Files-to-read for modifying a symbol |
886
+ | `roam_trace` | Dependency path between two symbols |
887
+ | `roam_impact` | Blast radius of changing a symbol |
888
+ | `roam_file_info` | File skeleton with all definitions |
889
+ | `roam_pr_risk` | Risk score for pending changes |
890
+ | `roam_breaking_changes` | Detect breaking changes between refs |
891
+ | `roam_affected_tests` | Find tests affected by a change |
892
+ | `roam_dead_code` | List unreferenced exports |
893
+ | `roam_complexity_report` | Per-symbol cognitive complexity |
894
+ | `roam_repo_map` | Project skeleton with key symbols |
895
+ | `roam_tour` | Auto-generated onboarding guide |
896
+ | `roam_diagnose` | Root cause analysis for debugging |
897
+ | `roam_visualize` | Generate Mermaid or DOT architecture diagrams |
898
+ | `roam_algo` | Algorithm anti-pattern detection with language-aware tips |
899
+ | `roam_ws_understand` | Unified multi-repo workspace overview |
900
+ | `roam_ws_context` | Cross-repo augmented symbol context |
901
+ | `roam_pr_diff` | Structural PR diff: metric deltas, edge analysis, symbol changes |
902
+ | `roam_budget_check` | Check changes against architectural budgets |
903
+ | `roam_effects` | Side-effect classification (DB writes, network, filesystem) |
904
+ | `roam_attest` | Proof-carrying PR attestation with all evidence bundled |
905
+ | `roam_capsule_export` | Export sanitized structural graph (no code bodies) |
906
+ | `roam_path_coverage` | Find critical untested call paths (entry -> sink) |
907
+ | `roam_forecast` | Predict when metrics will exceed thresholds |
908
+ | `roam_simulate` | Counterfactual architecture simulator |
909
+ | `roam_orchestrate` | Multi-agent swarm partitioning |
910
+ | `roam_fingerprint` | Topology fingerprint comparison |
911
+ | `roam_mutate` | Graph-level code editing (move/rename/extract) |
912
+ | `roam_dark_matter` | Hidden co-change coupling detection |
913
+ | `roam_closure` | Minimal-change synthesis for rename/delete |
914
+ | `roam_adversarial_review` | Adversarial architecture review |
915
+ | `roam_generate_plan` | Agent work planner |
916
+ | `roam_get_invariants` | Architectural invariant discovery |
917
+ | `roam_bisect_blame` | Architectural git bisect |
918
+ | `roam_doc_intent` | Doc-to-code linking |
919
+ | `roam_cut_analysis` | Minimum graph cut analysis |
920
+ | `roam_annotate_symbol` | Attach persistent notes to symbols |
921
+ | `roam_get_annotations` | View stored annotations |
922
+ | `roam_relate` | Show relationship between two symbols |
923
+ | `roam_search_semantic` | Semantic search by meaning |
924
+ | `roam_rules_check` | Plugin DSL governance rules |
925
+ | `roam_check_rules` | Built-in + user-defined governance rule evaluation with autofix templates |
926
+ | `roam_supply_chain` | Dependency risk dashboard: pin coverage and supply-chain health |
927
+ | `roam_spectral` | Spectral bisection: Fiedler vector partition tree and modularity gap |
928
+ | `roam_vuln_map` | Vulnerability report ingestion |
929
+ | `roam_vuln_reach` | Vulnerability reachability paths |
930
+ | `roam_ingest_trace` | Ingest runtime trace data |
931
+ | `roam_runtime_hotspots` | Runtime hotspot analysis |
932
+ | `roam_diff` | Blast radius of uncommitted/committed changes |
933
+ | `roam_symbol` | Symbol definition, callers, callees, metrics |
934
+ | `roam_deps` | File-level import/imported-by relationships |
935
+ | `roam_uses` | All consumers of a symbol by edge type |
936
+ | `roam_weather` | Code hotspots: churn x complexity ranking |
937
+ | `roam_debt` | Hotspot-weighted technical debt prioritization with optional ROI estimate |
938
+ | `roam_docs_coverage` | Doc coverage and stale-doc drift with PageRank-ranked missing docs |
939
+ | `roam_suggest_refactoring` | Rank proactive refactoring candidates using complexity, coupling, churn, smells, and coverage gaps |
940
+ | `roam_plan_refactor` | Build an ordered refactor plan for one symbol with risk/test/simulation context |
941
+ | `roam_n1` | Detect N+1 I/O patterns in ORM code |
942
+ | `roam_auth_gaps` | Find endpoints missing auth |
943
+ | `roam_over_fetch` | Detect models serializing too many fields |
944
+ | `roam_missing_index` | Find queries on non-indexed columns |
945
+ | `roam_orphan_routes` | Detect dead backend routes |
946
+ | `roam_migration_safety` | Detect non-idempotent migrations |
947
+ | `roam_api_drift` | Backend/frontend model mismatch detection |
948
+ | `roam_expand_toolset` | Discover presets, active toolset, and switch instructions |
949
+ | `roam_explore` | Compound first-contact exploration bundle for fast repo orientation |
950
+ | `roam_prepare_change` | Compound pre-change bundle: context, blast radius, risk, and tests |
951
+ | `roam_review_change` | Compound review bundle for changed code and architecture checks |
952
+ | `roam_diagnose_issue` | Compound debugging bundle with ranked suspects and dependency context |
953
+ | `roam_onboard` | Structured onboarding brief for new contributors/agents |
954
+ | `roam_syntax_check` | Tree-sitter syntax integrity validation for changed paths |
955
+ | `roam_agent_export` | Generate multi-agent instruction bundles (`AGENTS.md` + overlays) |
956
+ | `roam_vibe_check` | AI-rot auditor with 8-pattern taxonomy and composite score |
957
+ | `roam_ai_readiness` | AI-agent effectiveness readiness scoring and recommendations |
958
+ | `roam_dashboard` | Unified status snapshot across health, risk, churn, and quality |
959
+ | `roam_codeowners` | CODEOWNERS coverage analysis and unowned file discovery |
960
+ | `roam_drift` | Ownership drift detection from declared vs observed ownership |
961
+ | `roam_suggest_reviewers` | Reviewer recommendations with multi-signal scoring |
962
+ | `roam_simulate_departure` | Knowledge-loss simulation for contributor departure scenarios |
963
+ | `roam_verify` | Pre-commit consistency verification and policy checks |
964
+ | `roam_api_changes` | API signature change classification and severity labeling |
965
+ | `roam_test_gaps` | Changed-symbol test gap analysis |
966
+ | `roam_ai_ratio` | Estimated AI-generated code ratio from repository signals |
967
+ | `roam_duplicates` | Semantic duplicate detection across structurally similar functions |
968
+ | `roam_partition` | Multi-agent partition manifest with conflict and complexity scores |
969
+ | `roam_affected` | Monorepo/package affected-set analysis for diffs |
970
+ | `roam_semantic_diff` | Structural diff of symbol/edge changes |
971
+ | `roam_trends` | Historical metric trend retrieval with sparkline output |
972
+ | `roam_secrets` | Secret scanning with masking and CI-friendly fail behavior |
973
+ | `roam_endpoints` | Enumerate HTTP/API endpoint definitions across the codebase |
974
+ | `roam_doctor` | Diagnose installation and environment health |
975
+ | `roam_init` | Initialize roam workspace state and build the first index |
976
+ | `roam_reindex` | Refresh or force-rebuild the index with task-mode support |
977
+ | `roam_reset` | Reset the roam index and cached data |
978
+ | `roam_clean` | Remove stale or orphaned index entries |
979
+ | `roam_batch_search` | Batch symbol search: run multiple pattern queries in a single call |
980
+ | `roam_batch_get` | Batch context retrieval: fetch multiple symbols/files in a single call |
981
+ | `roam_dev_profile` | Developer productivity profile: commit patterns, specialization, and impact |
982
+
983
+ **Resources:** `roam://health` (current health score), `roam://summary` (project overview)
984
+
985
+ </details>
986
+
987
+ <details>
988
+ <summary><strong>Claude Code</strong></summary>
989
+
990
+ ```bash
991
+ claude mcp add roam-code -- roam mcp
992
+ ```
993
+
994
+ Or add to `.mcp.json` in your project root:
995
+
996
+ ```json
997
+ {
998
+ "mcpServers": {
999
+ "roam-code": {
1000
+ "command": "roam",
1001
+ "args": ["mcp"]
1002
+ }
1003
+ }
1004
+ }
1005
+ ```
1006
+
1007
+ </details>
1008
+
1009
+ <details>
1010
+ <summary><strong>Claude Desktop</strong></summary>
1011
+
1012
+ Add to your `claude_desktop_config.json`:
1013
+
1014
+ ```json
1015
+ {
1016
+ "mcpServers": {
1017
+ "roam-code": {
1018
+ "command": "roam",
1019
+ "args": ["mcp"],
1020
+ "cwd": "/path/to/your/project"
1021
+ }
1022
+ }
1023
+ }
1024
+ ```
1025
+
1026
+ </details>
1027
+
1028
+ <details>
1029
+ <summary><strong>Cursor</strong></summary>
1030
+
1031
+ Add to `.cursor/mcp.json`:
1032
+
1033
+ ```json
1034
+ {
1035
+ "mcpServers": {
1036
+ "roam-code": {
1037
+ "command": "roam",
1038
+ "args": ["mcp"]
1039
+ }
1040
+ }
1041
+ }
1042
+ ```
1043
+
1044
+ </details>
1045
+
1046
+ <details>
1047
+ <summary><strong>VS Code + Copilot</strong></summary>
1048
+
1049
+ Add to `.vscode/mcp.json`:
1050
+
1051
+ ```json
1052
+ {
1053
+ "servers": {
1054
+ "roam-code": {
1055
+ "type": "stdio",
1056
+ "command": "roam",
1057
+ "args": ["mcp"]
1058
+ }
1059
+ }
1060
+ }
1061
+ ```
1062
+
1063
+ </details>
1064
+
1065
+ ## CI/CD Integration
1066
+
1067
+ All you need is Python 3.9+ and `pip install roam-code`.
1068
+
1069
+ ### GitHub Actions
1070
+
1071
+ ```yaml
1072
+ # .github/workflows/roam.yml
1073
+ name: Roam Analysis
1074
+ on: [pull_request]
1075
+
1076
+ jobs:
1077
+ roam:
1078
+ runs-on: ubuntu-latest
1079
+ steps:
1080
+ - uses: actions/checkout@v4
1081
+ with:
1082
+ fetch-depth: 0
1083
+
1084
+ - uses: Cranot/roam-code@main
1085
+ with:
1086
+ command: health --gate score>=70
1087
+ comment: true
1088
+ fail-on-violation: true
1089
+ ```
1090
+
1091
+ Use `roam init` to auto-generate this workflow.
1092
+
1093
+ | Input | Default | Description |
1094
+ |-------|---------|-------------|
1095
+ | `command` | `health` | Roam command to run |
1096
+ | `python-version` | `3.12` | Python version |
1097
+ | `comment` | `false` | Post results as PR comment |
1098
+ | `fail-on-violation` | `false` | Fail the job on violations |
1099
+ | `roam-version` | (latest) | Pin to a specific version |
1100
+
1101
+ <details>
1102
+ <summary><strong>GitLab CI</strong></summary>
1103
+
1104
+ ```yaml
1105
+ roam-analysis:
1106
+ stage: test
1107
+ image: python:3.12-slim
1108
+ before_script:
1109
+ - pip install roam-code
1110
+ script:
1111
+ - roam index
1112
+ - roam health --gate score>=70
1113
+ - roam --json pr-risk origin/main..HEAD > roam-report.json
1114
+ artifacts:
1115
+ paths:
1116
+ - roam-report.json
1117
+ rules:
1118
+ - if: $CI_MERGE_REQUEST_IID
1119
+ ```
1120
+
1121
+ </details>
1122
+
1123
+ <details>
1124
+ <summary><strong>Azure DevOps / any CI</strong></summary>
1125
+
1126
+ Universal pattern:
1127
+
1128
+ ```bash
1129
+ pip install roam-code
1130
+ roam index
1131
+ roam health --gate score>=70 # exit 1 on failure
1132
+ roam --json health > report.json
1133
+ ```
1134
+
1135
+ </details>
1136
+
1137
+ ## SARIF Output
1138
+
1139
+ Roam exports analysis results in [SARIF 2.1.0](https://sarifweb.azurewebsites.net/) format for GitHub Code Scanning.
1140
+
1141
+ ```python
1142
+ from roam.output.sarif import health_to_sarif, write_sarif
1143
+
1144
+ sarif = health_to_sarif(health_data)
1145
+ write_sarif(sarif, "roam-health.sarif")
1146
+ ```
1147
+
1148
+ ```yaml
1149
+ - uses: github/codeql-action/upload-sarif@v3
1150
+ with:
1151
+ sarif_file: roam-health.sarif
1152
+ ```
1153
+
1154
+ ## For Teams
1155
+
1156
+ Zero infrastructure, zero vendor lock-in, zero data leaving your network.
1157
+
1158
+ | Tool | Annual cost (20-dev team) | Infrastructure | Setup time |
1159
+ |------|--------------------------|----------------|------------|
1160
+ | SonarQube Server | $15,000-$45,000 | Self-hosted server | Days |
1161
+ | CodeScene | $20,000-$60,000 | SaaS or on-prem | Hours |
1162
+ | Code Climate | $12,000-$36,000 | SaaS | Hours |
1163
+ | **Roam** | **$0 (MIT license)** | **None (local)** | **5 minutes** |
1164
+
1165
+ <details>
1166
+ <summary><strong>Team rollout guide</strong></summary>
1167
+
1168
+ **Week 1-2 (pilot):** 1-2 developers run `roam init` on one repo. Use `roam preflight` before changes, `roam pr-risk` before PRs.
1169
+
1170
+ **Week 3-4 (expand):** Add `roam health --gate score>=60` to CI as a non-blocking check.
1171
+
1172
+ **Month 2+ (standardize):** Tighten to `--gate score>=70`. Expand to additional repos. Track trajectory with `roam trend`.
1173
+
1174
+ </details>
1175
+
1176
+ <details>
1177
+ <summary><strong>Complements your existing stack</strong></summary>
1178
+
1179
+ | If you use... | Roam adds... |
1180
+ |---------------|-------------|
1181
+ | **SonarQube** | Architecture-level analysis: dependency cycles, god components, blast radius, health scoring |
1182
+ | **CodeScene** | Free, local alternative for health scoring and hotspot analysis |
1183
+ | **ESLint / Pylint** | Cross-language architecture checks. Linters enforce style per file; Roam enforces architecture across the codebase |
1184
+ | **LSP** | AI-agent-optimized queries. `roam context` answers "what calls this?" with PageRank-ranked results in one call |
1185
+
1186
+ </details>
1187
+
1188
+ ## Language Support
1189
+
1190
+ ### Tier 1 -- Full extraction (dedicated parsers)
1191
+
1192
+ | Language | Extensions | Symbols | References | Inheritance |
1193
+ |----------|-----------|---------|------------|-------------|
1194
+ | Python | `.py` `.pyi` | classes, functions, methods, decorators, variables | imports, calls, inheritance | extends, `__all__` exports |
1195
+ | JavaScript | `.js` `.jsx` `.mjs` `.cjs` | classes, functions, arrow functions, CJS exports | imports, require(), calls | extends |
1196
+ | TypeScript | `.ts` `.tsx` `.mts` `.cts` | interfaces, type aliases, enums + all JS | imports, calls, type refs | extends, implements |
1197
+ | Java | `.java` | classes, interfaces, enums, constructors, fields | imports, calls | extends, implements |
1198
+ | Go | `.go` | structs, interfaces, functions, methods, fields | imports, calls | embedded structs |
1199
+ | Rust | `.rs` | structs, traits, impls, enums, functions | use, calls | impl Trait for Struct |
1200
+ | C / C++ | `.c` `.h` `.cpp` `.hpp` `.cc` | structs, classes, functions, namespaces, templates | includes, calls | extends |
1201
+ | C# | `.cs` | classes, interfaces, structs, enums, records, methods, constructors, properties, delegates, events, fields | using directives, calls, `new`, attributes | extends, implements |
1202
+ | PHP | `.php` | classes, interfaces, traits, enums, methods, properties | namespace use, calls, static calls, `new` | extends, implements, use (traits) |
1203
+ | Visual FoxPro | `.prg` | functions, procedures, classes, methods, properties, constants | DO, SET PROCEDURE/CLASSLIB, CREATEOBJECT, `=func()`, `obj.method()` | DEFINE CLASS ... AS |
1204
+ | YAML (CI/CD) | `.yml` `.yaml` | GitLab CI: jobs, template anchors, stages. GitHub Actions: workflow name, jobs, reusable workflows. Generic: top-level keys | `extends:`, `needs:`, `!reference`, `uses:` | — |
1205
+ | HCL / Terraform | `.tf` `.tfvars` `.hcl` | `resource`, `data`, `variable`, `output`, `module`, `provider`, `locals` entries | `var.*`, `module.*`, `data.*`, `local.*`, resource cross-refs | — |
1206
+ | Vue | `.vue` | via `<script>` block extraction (TS/JS) | imports, calls, type refs | extends, implements |
1207
+ | Svelte | `.svelte` | via `<script>` block extraction (TS/JS) | imports, calls, type refs | extends, implements |
1208
+
1209
+ <details>
1210
+ <summary><strong>Salesforce ecosystem (Tier 1)</strong></summary>
1211
+
1212
+ | Language | Extensions | Symbols | References |
1213
+ |----------|-----------|---------|------------|
1214
+ | Apex | `.cls` `.trigger` | classes, triggers, SOQL, annotations | imports, calls, System.Label, generic type refs |
1215
+ | Aura | `.cmp` `.app` `.evt` `.intf` `.design` | components, attributes, methods, events | controller refs, component refs |
1216
+ | LWC (JavaScript) | `.js` (in LWC dirs) | anonymous class from filename | `@salesforce/apex/`, `@salesforce/schema/`, `@salesforce/label/` |
1217
+ | Visualforce | `.page` `.component` | pages, components | controller/extensions, merge fields, includes |
1218
+ | SF Metadata XML | `*-meta.xml` | objects, fields, rules, layouts | Apex class refs, formula field refs, Flow actionCalls |
1219
+
1220
+ Cross-language edges mean `roam impact AccountService` shows blast radius across Apex, LWC, Aura, Visualforce, and Flows.
1221
+
1222
+ </details>
1223
+
1224
+ | Ruby | `.rb` | classes, modules, methods, singleton methods, constants | require, require_relative, include/extend, calls, ClassName.new | class inheritance |
1225
+ | JSONC | `.jsonc` | via JSON grammar | -- | -- |
1226
+ | MDX | `.mdx` | via Markdown grammar | -- | -- |
1227
+
1228
+ ### Tier 2 -- Generic extraction
1229
+
1230
+ Kotlin (`.kt` `.kts`), Swift (`.swift`), Scala (`.scala` `.sc`)
1231
+
1232
+ Tier 2 languages get symbol extraction and basic inheritance via a generic tree-sitter walker.
1233
+
1234
+ ## Performance
1235
+
1236
+ | Metric | Value |
1237
+ |--------|-------|
1238
+ | Index 200 files | ~3-5s |
1239
+ | Index 3,000 files | ~2 min |
1240
+ | Incremental (no changes) | <1s |
1241
+ | Any query command | <0.5s |
1242
+
1243
+ <details>
1244
+ <summary><strong>Detailed benchmarks</strong></summary>
1245
+
1246
+ ### Indexing Speed
1247
+
1248
+ | Project | Language | Files | Symbols | Edges | Index Time | Rate |
1249
+ |---------|----------|-------|---------|-------|-----------|------|
1250
+ | Express | JS | 211 | 624 | 804 | 3s | 70 files/s |
1251
+ | Axios | JS | 237 | 1,065 | 868 | 6s | 41 files/s |
1252
+ | Vue | TS | 697 | 5,335 | 8,984 | 25s | 28 files/s |
1253
+ | Laravel | PHP | 3,058 | 39,097 | 38,045 | 1m46s | 29 files/s |
1254
+ | Svelte | TS | 8,445 | 16,445 | 19,618 | 2m40s | 52 files/s |
1255
+
1256
+ ### Quality Benchmark
1257
+
1258
+ | Repo | Language | Score | Coverage | Edge Density |
1259
+ |------|----------|-------|----------|--------------|
1260
+ | Laravel | PHP | **9.55** | 91.2% | 0.97 |
1261
+ | Vue | TS | **9.27** | 85.8% | 1.68 |
1262
+ | Svelte | TS | **9.04** | 94.7% | 1.19 |
1263
+ | Axios | JS | **8.98** | 85.9% | 0.82 |
1264
+ | Express | JS | **8.46** | 96.0% | 1.29 |
1265
+
1266
+ ### Token Efficiency
1267
+
1268
+ | Metric | Value |
1269
+ |--------|-------|
1270
+ | 1,600-line file → `roam file` | ~5,000 chars (~70:1 compression) |
1271
+ | Full project map | ~4,000 chars |
1272
+ | `--compact` mode | 40-50% additional token reduction |
1273
+ | `roam preflight` replaces | 5-7 separate agent tool calls |
1274
+
1275
+ </details>
1276
+
1277
+ Agent-efficiency benchmarks: see the [`benchmarks/`](benchmarks/) directory for harness, repos, and results.
1278
+
1279
+ ## How It Works
1280
+
1281
+ ```
1282
+ Codebase
1283
+ |
1284
+ [1] Discovery ──── git ls-files (respects .gitignore + .roamignore)
1285
+ |
1286
+ [2] Parse ──────── tree-sitter AST per file (26 languages)
1287
+ |
1288
+ [3] Extract ────── symbols + references (calls, imports, inheritance)
1289
+ |
1290
+ [4] Resolve ────── match references to definitions → edges
1291
+ |
1292
+ [5] Metrics ────── adaptive PageRank, betweenness, cognitive complexity, Halstead
1293
+ |
1294
+ [6] Algorithms ── 23-pattern anti-pattern catalog (O(n^2) loops, N+1, recursion)
1295
+ |
1296
+ [7] Git ────────── churn, co-change matrix, authorship, Renyi entropy
1297
+ |
1298
+ [8] Clusters ───── Louvain community detection
1299
+ |
1300
+ [9] Health ─────── per-file scores (7-factor) + composite score (0-100)
1301
+ |
1302
+ [10] Store ─────── .roam/index.db (SQLite, WAL mode)
1303
+ ```
1304
+
1305
+ After the first full index, `roam index` only re-processes changed files (mtime + SHA-256 hash). Incremental updates are near-instant.
1306
+
1307
+ <details>
1308
+ <summary><strong>Graph algorithms</strong></summary>
1309
+
1310
+ - **Adaptive PageRank** -- damping factor auto-tunes based on cycle density (0.82-0.92); identifies the most important symbols (used by `map`, `search`, `context`)
1311
+ - **Personalized PageRank** -- distance-weighted blast radius for `impact` (Gleich, 2015)
1312
+ - **Adaptive betweenness centrality** -- exact for small graphs, sqrt-scaled sampling for large (Brandes & Pich, 2007); finds bottleneck symbols
1313
+ - **Edge betweenness centrality** -- identifies critical cycle-breaking edges in SCCs (Brandes, 2001)
1314
+ - **Tarjan's SCC** -- detects dependency cycles with tangle ratio
1315
+ - **Propagation Cost** -- fraction of system affected by any change, via transitive closure (MacCormack, Rusnak & Baldwin, 2006)
1316
+ - **Algebraic connectivity (Fiedler value)** -- second-smallest Laplacian eigenvalue; measures architectural robustness (Fiedler, 1973)
1317
+ - **Louvain community detection** -- groups related symbols into clusters
1318
+ - **Modularity Q-score** -- measures if cluster boundaries match natural community structure (Newman, 2004)
1319
+ - **Conductance** -- per-cluster boundary tightness: cut(S, S_bar) / min(vol(S), vol(S_bar)) (Yang & Leskovec)
1320
+ - **Topological sort** -- computes dependency layers, Gini coefficient for layer balance (Gini, 1912), weighted violation severity
1321
+ - **k-shortest simple paths** -- traces dependency paths with coupling strength
1322
+ - **Renyi entropy (order 2)** -- measures co-change distribution; more robust to outliers than Shannon (Renyi, 1961)
1323
+ - **Mann-Kendall trend test** -- non-parametric degradation detection, robust to noise (Mann, 1945; Kendall, 1975)
1324
+ - **Sen's slope estimator** -- robust trend magnitude, resistant to outliers (Sen, 1968)
1325
+ - **NPMI** -- Normalized Pointwise Mutual Information for coupling strength (Bouma, 2009)
1326
+ - **Lift** -- association rule mining metric for co-change statistical significance (Agrawal & Srikant, 1994)
1327
+ - **Halstead metrics** -- volume, difficulty, effort, and predicted bugs from operator/operand counts (Halstead, 1977)
1328
+ - **SQALE remediation cost** -- time-to-fix estimates per issue type for tech debt prioritization (Letouzey, 2012)
1329
+ - **Algorithm anti-pattern catalog** -- 23 patterns detecting suboptimal algorithms (quadratic loops, N+1 queries, quadratic string building, branching recursion, manual top-k, loop-invariant calls) with confidence calibration via caller-count and bounded-loop analysis
1330
+
1331
+ </details>
1332
+
1333
+ <details>
1334
+ <summary><strong>Health scoring</strong></summary>
1335
+
1336
+ Composite health score (0-100) using a **weighted geometric mean** of sigmoid health factors. Non-compensatory: a zero in any dimension cannot be masked by high scores in others.
1337
+
1338
+ | Factor | Weight | What it measures |
1339
+ |--------|--------|-----------------|
1340
+ | Tangle ratio | 30% | % of symbols in dependency cycles |
1341
+ | God components | 20% | Symbols with extreme fan-in/fan-out |
1342
+ | Bottlenecks | 15% | High-betweenness chokepoints |
1343
+ | Layer violations | 15% | Upward dependency violations (severity-weighted by layer distance) |
1344
+ | Per-file health | 20% | Average of 7-factor file health scores |
1345
+
1346
+ Each factor uses sigmoid health: `h = e^(-signal/scale)` (1 = pristine, approaches 0 = worst). Score = `100 * product(h_i ^ w_i)`. Also reports **propagation cost** (MacCormack 2006) and **algebraic connectivity** (Fiedler 1973). Per-file health (1-10) combines: cognitive complexity (triangular nesting penalty per Sweller's Cognitive Load Theory), indentation complexity, cycle membership, god component membership, dead export ratio, co-change entropy, and churn amplification.
1347
+
1348
+ </details>
1349
+
1350
+ ## How Roam Compares
1351
+
1352
+ roam-code is the only tool that combines graph algorithms (PageRank, Tarjan SCC, Louvain clustering), git archaeology, architecture simulation, and multi-agent partitioning in a single local CLI with zero API keys.
1353
+
1354
+ Documentation (local HTML in `docs/site/`, CI-deployed via `.github/workflows/pages.yml`):
1355
+ - `docs/site/getting-started.html` — tutorial
1356
+ - `docs/site/command-reference.html` — examples
1357
+ - `docs/site/architecture.html` — diagram + internals
1358
+ - `docs/site/landscape.html` — competitor matrix
1359
+
1360
+ | Capability | roam-code | AI IDEs (Cursor, Windsurf) | AI Agents (Claude Code, Codex) | SAST (SonarQube, CodeQL) |
1361
+ |---|---|---|---|---|
1362
+ | Persistent local index | SQLite | Cloud embeddings | None | Per-scan |
1363
+ | Call graph analysis | Yes | No | No | Yes (CodeQL) |
1364
+ | PageRank / centrality | Yes | No | No | No |
1365
+ | Cycle detection (Tarjan) | Yes | No | No | Deprecated (SonarQube) |
1366
+ | Community detection (Louvain) | Yes | No | No | No |
1367
+ | Git churn / co-change | Yes | No | No | No |
1368
+ | Architecture simulation | Yes | No | No | No |
1369
+ | Multi-agent partitioning | Yes | No | No | No |
1370
+ | MCP tools for agents | 101 (24 in default core preset) | Client only | Client only | 34 (SonarQube) |
1371
+ | Languages | 26 | 70+ | 50+ | 12-42 |
1372
+ | 100% local, zero API keys | Yes | No | No | Partial |
1373
+ | Open source | MIT | No | Partial | Partial |
1374
+
1375
+ ### Key Differentiators
1376
+
1377
+ - **vs AI IDEs** (Cursor, Windsurf, Augment): roam-code provides deterministic structural analysis. AI IDEs use probabilistic embeddings that can't guarantee reproducible results.
1378
+ - **vs AI Agents** (Claude Code, Codex CLI, Gemini CLI): These agents read files one at a time. roam-code pre-computes relationships so agents get instant answers about architecture, blast radius, and dependencies.
1379
+ - **vs SAST Tools** (SonarQube, CodeQL, Semgrep): SAST tools find bugs and vulnerabilities. roam-code understands architecture -- how code is structured, where it's coupled, and what breaks when you change it. Complementary, not competitive.
1380
+ - **vs Code Search** (Sourcegraph/Amp, Greptile): Text search finds where code is. roam-code understands why code matters -- which functions are central, which modules are tangled, which files are high-risk.
1381
+
1382
+ ## FAQ
1383
+
1384
+ **Does Roam send any data externally?**
1385
+ No. Zero network calls. No telemetry, no analytics, no update checks.
1386
+
1387
+ **Can Roam run in air-gapped environments?**
1388
+ Yes. Once installed, no internet access is required.
1389
+
1390
+ **Does Roam modify my source code?**
1391
+ Read-only by default. Creates `.roam/` with an index database. The `roam mutate` command can apply code changes (move/rename/extract) but defaults to `--dry-run` mode — you must explicitly pass `--apply` to write changes.
1392
+
1393
+ **How does Roam handle monorepos?**
1394
+ Indexes from the root. Batched SQL handles 100k+ symbols. Incremental updates stay fast.
1395
+
1396
+ **How does Roam handle multi-repo projects (e.g., frontend + backend)?**
1397
+ Use `roam ws init <repo1> <repo2>` to create a workspace. Each repo keeps its own index; a workspace overlay DB stores cross-repo API edges. `roam ws resolve` scans for REST endpoints and matches frontend calls to backend routes. Then `roam ws context`, `roam ws trace`, etc. work across repos.
1398
+
1399
+ **Is Roam compatible with SonarQube / CodeScene?**
1400
+ Yes. Roam complements existing tools. Both can run in the same CI pipeline. SARIF output integrates with GitHub Code Scanning.
1401
+
1402
+ ## Limitations
1403
+
1404
+ Static analysis trade-offs:
1405
+
1406
+ - **Static analysis primarily** -- can't trace dynamic dispatch, reflection, or eval'd code. Runtime trace ingestion (`roam ingest-trace`) adds production data but requires external trace export
1407
+ - **Import resolution is heuristic** -- complex re-exports or conditional imports may not resolve
1408
+ - **Limited cross-language edges** -- Salesforce, Protobuf, REST API, and multi-repo edges are supported, but not arbitrary FFI
1409
+ - **Tier 2 languages** (Kotlin, Swift, Scala) get basic symbol extraction only
1410
+ - **Large monorepos** (100k+ files) may have slow initial indexing
1411
+
1412
+ ## Troubleshooting
1413
+
1414
+ | Problem | Solution |
1415
+ |---------|----------|
1416
+ | `roam: command not found` | Ensure install location is on PATH. For `uv`: `uv tool update-shell` |
1417
+ | `Another indexing process is running` | Delete `.roam/index.lock` and retry |
1418
+ | `database is locked` | `roam index --force` to rebuild |
1419
+ | Unicode errors on Windows | `chcp 65001` for UTF-8 |
1420
+ | Symbol resolves to wrong file | Use `file:symbol` syntax: `roam symbol myfile:MyFunction` |
1421
+ | Health score seems wrong | `roam health --json` for factor breakdown |
1422
+ | Index stale after `git pull` | `roam index` (incremental). After major refactors: `roam index --force` |
1423
+
1424
+ ## Update / Uninstall
1425
+
1426
+ ```bash
1427
+ # Update
1428
+ pipx upgrade roam-code
1429
+ uv tool upgrade roam-code
1430
+ pip install --upgrade roam-code
1431
+
1432
+ # Uninstall
1433
+ pipx uninstall roam-code
1434
+ uv tool uninstall roam-code
1435
+ pip uninstall roam-code
1436
+ ```
1437
+
1438
+ Delete `.roam/` from your project root to clean up local data.
1439
+
1440
+ ## Development
1441
+
1442
+ ```bash
1443
+ git clone https://github.com/Cranot/roam-code.git
1444
+ cd roam-code
1445
+ pip install -e ".[dev]" # includes pytest, ruff
1446
+ pytest tests/ # ~5000 tests, Python 3.9-3.13
1447
+
1448
+ # Or use Make targets:
1449
+ make dev # install with dev extras
1450
+ make test # run tests
1451
+ make lint # ruff check
1452
+ ```
1453
+
1454
+ <details>
1455
+ <summary><strong>Project structure</strong></summary>
1456
+
1457
+ ```
1458
+ roam-code/
1459
+ ├── pyproject.toml
1460
+ ├── action.yml # Reusable GitHub Action
1461
+ ├── src/roam/
1462
+ │ ├── __init__.py # Version (from pyproject.toml)
1463
+ │ ├── cli.py # Click CLI (137 commands)
1464
+ │ ├── mcp_server.py # MCP server (101 tools, 10 resources, 5 prompts)
1465
+ │ ├── db/
1466
+ │ │ ├── connection.py # SQLite (WAL, pragmas, batched IN)
1467
+ │ │ ├── schema.py # Tables, indexes, migrations
1468
+ │ │ └── queries.py # Named SQL constants
1469
+ │ ├── index/
1470
+ │ │ ├── indexer.py # Orchestrates full pipeline
1471
+ │ │ ├── discovery.py # git ls-files, .gitignore
1472
+ │ │ ├── parser.py # Tree-sitter parsing
1473
+ │ │ ├── symbols.py # Symbol + reference extraction
1474
+ │ │ ├── relations.py # Reference resolution -> edges
1475
+ │ │ ├── complexity.py # Cognitive complexity (SonarSource) + Halstead metrics
1476
+ │ │ ├── git_stats.py # Churn, co-change, blame, Renyi entropy
1477
+ │ │ ├── incremental.py # mtime + hash change detection
1478
+ │ │ ├── file_roles.py # Smart file role classifier
1479
+ │ │ └── test_conventions.py # Pluggable test naming adapters
1480
+ │ ├── languages/
1481
+ │ │ ├── base.py # Abstract LanguageExtractor
1482
+ │ │ ├── registry.py # Language detection + aliasing
1483
+ │ │ ├── *_lang.py # One file per language (19 dedicated + generic)
1484
+ │ │ └── generic_lang.py # Tier 2 fallback
1485
+ │ ├── bridges/
1486
+ │ │ ├── base.py, registry.py # Cross-language bridge framework
1487
+ │ │ ├── bridge_salesforce.py # Apex <-> Aura/LWC/Visualforce
1488
+ │ │ └── bridge_protobuf.py # .proto -> Go/Java/Python stubs
1489
+ │ ├── catalog/
1490
+ │ │ ├── tasks.py # Universal algorithm catalog (23 patterns)
1491
+ │ │ └── detectors.py # Anti-pattern detectors with confidence calibration
1492
+ │ ├── workspace/
1493
+ │ │ ├── config.py # .roam-workspace.json
1494
+ │ │ ├── db.py # Workspace overlay DB
1495
+ │ │ ├── api_scanner.py # REST API endpoint detection
1496
+ │ │ └── aggregator.py # Cross-repo aggregation
1497
+ │ ├── graph/
1498
+ │ │ ├── builder.py, pagerank.py # DB -> NetworkX, PageRank
1499
+ │ │ ├── cycles.py, clusters.py # Tarjan SCC, propagation cost, Louvain, modularity Q
1500
+ │ │ ├── layers.py, pathfinding.py # Topo layers, k-shortest paths
1501
+ │ │ ├── simulate.py, spectral.py # Architecture simulation, Fiedler bisection
1502
+ │ │ ├── partition.py, fingerprint.py # Multi-agent partitioning, topology fingerprints
1503
+ │ │ └── anomaly.py # Statistical anomaly detection
1504
+ │ ├── commands/
1505
+ │ │ ├── resolve.py # Shared symbol resolution
1506
+ │ │ ├── graph_helpers.py # Shared graph utilities (adj builders, BFS)
1507
+ │ │ ├── context_helpers.py # Data-gathering helpers for context command
1508
+ │ │ ├── gate_presets.py # Framework-specific gate rules
1509
+ │ │ └── cmd_*.py # One module per command
1510
+ │ ├── analysis/
1511
+ │ │ ├── effects.py # Side-effect classification engine
1512
+ │ │ └── taint.py # Taint analysis
1513
+ │ ├── refactor/
1514
+ │ │ ├── codegen.py # Import generation (Python/JS/Go)
1515
+ │ │ └── transforms.py # move/rename/add-call/extract transforms
1516
+ │ ├── rules/
1517
+ │ │ ├── engine.py # YAML rule parser + graph query evaluator
1518
+ │ │ ├── builtin.py # 10 built-in governance rules
1519
+ │ │ ├── ast_match.py # AST pattern matching with $METAVAR captures
1520
+ │ │ └── dataflow.py # Intra-procedural dataflow analysis
1521
+ │ ├── runtime/
1522
+ │ │ ├── trace_ingest.py # OpenTelemetry/Jaeger/Zipkin ingestion
1523
+ │ │ └── hotspots.py # Runtime hotspot analysis
1524
+ │ ├── search/
1525
+ │ │ ├── tfidf.py # TF-IDF semantic search engine
1526
+ │ │ ├── index_embeddings.py # Embedding index builder
1527
+ │ │ └── onnx_embeddings.py # Optional local ONNX semantic backend
1528
+ │ ├── security/
1529
+ │ │ ├── vuln_store.py # CVE/vulnerability storage
1530
+ │ │ └── vuln_reach.py # Vulnerability reachability paths
1531
+ │ └── output/
1532
+ │ ├── formatter.py # Token-efficient formatting
1533
+ │ ├── sarif.py # SARIF 2.1.0 output
1534
+ │ └── schema_registry.py # JSON envelope schema versioning
1535
+ └── tests/ # ~5000 tests across 151 test files
1536
+ ```
1537
+
1538
+ </details>
1539
+
1540
+ ### Dependencies
1541
+
1542
+ | Package | Purpose |
1543
+ |---------|---------|
1544
+ | [click](https://click.palletsprojects.com/) >= 8.0 | CLI framework |
1545
+ | [tree-sitter](https://github.com/tree-sitter/py-tree-sitter) >= 0.23 | AST parsing |
1546
+ | [tree-sitter-language-pack](https://github.com/nicolo-ribaudo/tree-sitter-language-pack) >= 0.6 | 165+ grammars |
1547
+ | [networkx](https://networkx.org/) >= 3.0 | Graph algorithms |
1548
+
1549
+ Optional: [fastmcp](https://github.com/jlowin/fastmcp) >= 2.0 (MCP server — install with `pip install "roam-code[mcp]"`)
1550
+
1551
+ Optional: Local semantic ONNX stack (`numpy`, `onnxruntime`, `tokenizers`) via `pip install "roam-code[semantic]"`
1552
+
1553
+ ## Roadmap
1554
+
1555
+ ### Shipped
1556
+
1557
+ - [x] MCP v2 agent surface: in-process execution, compound operations, presets, schemas, annotations, and compatibility profiles.
1558
+ - [x] Full command and MCP inventory parity in docs: 137 CLI commands and 101 MCP tools.
1559
+ - [x] CI hardening: composite action, changed-only mode, trend-aware gates, sticky PR updater, and SARIF guardrails.
1560
+ - [x] Performance foundation: FTS5/BM25 search, O(changed) incremental indexing, DB/index optimizations.
1561
+ - [x] Agent governance suite: `vibe-check`, `ai-readiness`, `verify`, `ai-ratio`, `duplicates`, advanced `algo` scoring/SARIF.
1562
+ - [x] Ownership/review intelligence: `codeowners`, `drift`, `simulate-departure`, `suggest-reviewers`, `api-changes`, `test-gaps`, `semantic-diff`, `secrets`.
1563
+ - [x] Multi-agent operations: `partition`, `affected`, `syntax-check`, workspace-aware context and traces.
1564
+ - [x] Budget-aware context delivery: `--budget` (partial rollout), PageRank-weighted truncation, conversation-aware ranking.
1565
+
1566
+ ### Next
1567
+
1568
+ - [x] Terminal demo GIF in README.
1569
+ - [ ] GitHub repo topics.
1570
+ - [ ] GitHub Discussions enabled.
1571
+ - [ ] MCP directory + awesome-list submissions.
1572
+
1573
+ ## Contributing
1574
+
1575
+ ```bash
1576
+ git clone https://github.com/Cranot/roam-code.git
1577
+ cd roam-code
1578
+ pip install -e .
1579
+ pytest tests/ # all ~5000 tests must pass
1580
+ ```
1581
+
1582
+ Good first contributions: add a [Tier 1 language](src/roam/languages/) (see `go_lang.py` or `php_lang.py` as templates), improve reference resolution, add benchmark repos, extend SARIF converters, add MCP tools.
1583
+
1584
+ Please open an issue first to discuss larger changes.
1585
+
1586
+ ## License
1587
+
1588
+ [MIT](LICENSE)