@rryando/arcs 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/README.md +448 -0
  2. package/dist/cli/arcs-orchestrate-caveman.d.ts +16 -0
  3. package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -0
  4. package/dist/cli/arcs-orchestrate-caveman.js +109 -0
  5. package/dist/cli/arcs-orchestrate-caveman.js.map +1 -0
  6. package/dist/cli/arcs-orchestrate.d.ts +2 -0
  7. package/dist/cli/arcs-orchestrate.d.ts.map +1 -0
  8. package/dist/cli/arcs-orchestrate.js +431 -0
  9. package/dist/cli/arcs-orchestrate.js.map +1 -0
  10. package/dist/cli/arg-parser.d.ts +20 -0
  11. package/dist/cli/arg-parser.d.ts.map +1 -0
  12. package/dist/cli/arg-parser.js +216 -0
  13. package/dist/cli/arg-parser.js.map +1 -0
  14. package/dist/cli/brief-renderer.d.ts +32 -0
  15. package/dist/cli/brief-renderer.d.ts.map +1 -0
  16. package/dist/cli/brief-renderer.js +67 -0
  17. package/dist/cli/brief-renderer.js.map +1 -0
  18. package/dist/cli/bundle-installer.d.ts +77 -0
  19. package/dist/cli/bundle-installer.d.ts.map +1 -0
  20. package/dist/cli/bundle-installer.js +328 -0
  21. package/dist/cli/bundle-installer.js.map +1 -0
  22. package/dist/cli/command-registry.d.ts +52 -0
  23. package/dist/cli/command-registry.d.ts.map +1 -0
  24. package/dist/cli/command-registry.js +68 -0
  25. package/dist/cli/command-registry.js.map +1 -0
  26. package/dist/cli/commands/batch.d.ts +2 -0
  27. package/dist/cli/commands/batch.d.ts.map +1 -0
  28. package/dist/cli/commands/batch.js +307 -0
  29. package/dist/cli/commands/batch.js.map +1 -0
  30. package/dist/cli/commands/brief.d.ts +2 -0
  31. package/dist/cli/commands/brief.d.ts.map +1 -0
  32. package/dist/cli/commands/brief.js +146 -0
  33. package/dist/cli/commands/brief.js.map +1 -0
  34. package/dist/cli/commands/bundle.d.ts +2 -0
  35. package/dist/cli/commands/bundle.d.ts.map +1 -0
  36. package/dist/cli/commands/bundle.js +90 -0
  37. package/dist/cli/commands/bundle.js.map +1 -0
  38. package/dist/cli/commands/dependency.d.ts +2 -0
  39. package/dist/cli/commands/dependency.d.ts.map +1 -0
  40. package/dist/cli/commands/dependency.js +260 -0
  41. package/dist/cli/commands/dependency.js.map +1 -0
  42. package/dist/cli/commands/diagnostics.d.ts +2 -0
  43. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  44. package/dist/cli/commands/diagnostics.js +91 -0
  45. package/dist/cli/commands/diagnostics.js.map +1 -0
  46. package/dist/cli/commands/diagram.d.ts +2 -0
  47. package/dist/cli/commands/diagram.d.ts.map +1 -0
  48. package/dist/cli/commands/diagram.js +305 -0
  49. package/dist/cli/commands/diagram.js.map +1 -0
  50. package/dist/cli/commands/done.d.ts +2 -0
  51. package/dist/cli/commands/done.d.ts.map +1 -0
  52. package/dist/cli/commands/done.js +140 -0
  53. package/dist/cli/commands/done.js.map +1 -0
  54. package/dist/cli/commands/graph.d.ts +2 -0
  55. package/dist/cli/commands/graph.d.ts.map +1 -0
  56. package/dist/cli/commands/graph.js +105 -0
  57. package/dist/cli/commands/graph.js.map +1 -0
  58. package/dist/cli/commands/index.d.ts +21 -0
  59. package/dist/cli/commands/index.d.ts.map +1 -0
  60. package/dist/cli/commands/index.js +22 -0
  61. package/dist/cli/commands/index.js.map +1 -0
  62. package/dist/cli/commands/knowledge-search.d.ts +2 -0
  63. package/dist/cli/commands/knowledge-search.d.ts.map +1 -0
  64. package/dist/cli/commands/knowledge-search.js +43 -0
  65. package/dist/cli/commands/knowledge-search.js.map +1 -0
  66. package/dist/cli/commands/knowledge.d.ts +2 -0
  67. package/dist/cli/commands/knowledge.d.ts.map +1 -0
  68. package/dist/cli/commands/knowledge.js +416 -0
  69. package/dist/cli/commands/knowledge.js.map +1 -0
  70. package/dist/cli/commands/loop.d.ts +2 -0
  71. package/dist/cli/commands/loop.d.ts.map +1 -0
  72. package/dist/cli/commands/loop.js +192 -0
  73. package/dist/cli/commands/loop.js.map +1 -0
  74. package/dist/cli/commands/maintenance.d.ts +2 -0
  75. package/dist/cli/commands/maintenance.d.ts.map +1 -0
  76. package/dist/cli/commands/maintenance.js +231 -0
  77. package/dist/cli/commands/maintenance.js.map +1 -0
  78. package/dist/cli/commands/next.d.ts +2 -0
  79. package/dist/cli/commands/next.d.ts.map +1 -0
  80. package/dist/cli/commands/next.js +116 -0
  81. package/dist/cli/commands/next.js.map +1 -0
  82. package/dist/cli/commands/plan.d.ts +2 -0
  83. package/dist/cli/commands/plan.d.ts.map +1 -0
  84. package/dist/cli/commands/plan.js +340 -0
  85. package/dist/cli/commands/plan.js.map +1 -0
  86. package/dist/cli/commands/project-updates.d.ts +2 -0
  87. package/dist/cli/commands/project-updates.d.ts.map +1 -0
  88. package/dist/cli/commands/project-updates.js +243 -0
  89. package/dist/cli/commands/project-updates.js.map +1 -0
  90. package/dist/cli/commands/project.d.ts +2 -0
  91. package/dist/cli/commands/project.d.ts.map +1 -0
  92. package/dist/cli/commands/project.js +362 -0
  93. package/dist/cli/commands/project.js.map +1 -0
  94. package/dist/cli/commands/remember.d.ts +2 -0
  95. package/dist/cli/commands/remember.d.ts.map +1 -0
  96. package/dist/cli/commands/remember.js +70 -0
  97. package/dist/cli/commands/remember.js.map +1 -0
  98. package/dist/cli/commands/status.d.ts +2 -0
  99. package/dist/cli/commands/status.d.ts.map +1 -0
  100. package/dist/cli/commands/status.js +104 -0
  101. package/dist/cli/commands/status.js.map +1 -0
  102. package/dist/cli/commands/task.d.ts +6 -0
  103. package/dist/cli/commands/task.d.ts.map +1 -0
  104. package/dist/cli/commands/task.js +361 -0
  105. package/dist/cli/commands/task.js.map +1 -0
  106. package/dist/cli/commands/utility.d.ts +9 -0
  107. package/dist/cli/commands/utility.d.ts.map +1 -0
  108. package/dist/cli/commands/utility.js +302 -0
  109. package/dist/cli/commands/utility.js.map +1 -0
  110. package/dist/cli/config.d.ts +42 -0
  111. package/dist/cli/config.d.ts.map +1 -0
  112. package/dist/cli/config.js +134 -0
  113. package/dist/cli/config.js.map +1 -0
  114. package/dist/cli/dag-commands.d.ts +7 -0
  115. package/dist/cli/dag-commands.d.ts.map +1 -0
  116. package/dist/cli/dag-commands.js +152 -0
  117. package/dist/cli/dag-commands.js.map +1 -0
  118. package/dist/cli/diagram-renderer.d.ts +26 -0
  119. package/dist/cli/diagram-renderer.d.ts.map +1 -0
  120. package/dist/cli/diagram-renderer.js +118 -0
  121. package/dist/cli/diagram-renderer.js.map +1 -0
  122. package/dist/cli/help-generator.d.ts +21 -0
  123. package/dist/cli/help-generator.d.ts.map +1 -0
  124. package/dist/cli/help-generator.js +100 -0
  125. package/dist/cli/help-generator.js.map +1 -0
  126. package/dist/cli/index.d.ts +8 -0
  127. package/dist/cli/index.d.ts.map +1 -0
  128. package/dist/cli/index.js +95 -0
  129. package/dist/cli/index.js.map +1 -0
  130. package/dist/cli/instructions.d.ts +53 -0
  131. package/dist/cli/instructions.d.ts.map +1 -0
  132. package/dist/cli/instructions.js +219 -0
  133. package/dist/cli/instructions.js.map +1 -0
  134. package/dist/cli/lean-output.d.ts +15 -0
  135. package/dist/cli/lean-output.d.ts.map +1 -0
  136. package/dist/cli/lean-output.js +66 -0
  137. package/dist/cli/lean-output.js.map +1 -0
  138. package/dist/cli/md-renderer.d.ts +6 -0
  139. package/dist/cli/md-renderer.d.ts.map +1 -0
  140. package/dist/cli/md-renderer.js +396 -0
  141. package/dist/cli/md-renderer.js.map +1 -0
  142. package/dist/cli/output-envelope.d.ts +15 -0
  143. package/dist/cli/output-envelope.d.ts.map +1 -0
  144. package/dist/cli/output-envelope.js +61 -0
  145. package/dist/cli/output-envelope.js.map +1 -0
  146. package/dist/cli/setup.d.ts +11 -0
  147. package/dist/cli/setup.d.ts.map +1 -0
  148. package/dist/cli/setup.js +415 -0
  149. package/dist/cli/setup.js.map +1 -0
  150. package/dist/cli/status-dashboard.d.ts +5 -0
  151. package/dist/cli/status-dashboard.d.ts.map +1 -0
  152. package/dist/cli/status-dashboard.js +248 -0
  153. package/dist/cli/status-dashboard.js.map +1 -0
  154. package/dist/index.d.ts +3 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js +25 -0
  157. package/dist/index.js.map +1 -0
  158. package/dist/retrieval/bm25.d.ts +23 -0
  159. package/dist/retrieval/bm25.d.ts.map +1 -0
  160. package/dist/retrieval/bm25.js +92 -0
  161. package/dist/retrieval/bm25.js.map +1 -0
  162. package/dist/retrieval/cross-project-search.d.ts +30 -0
  163. package/dist/retrieval/cross-project-search.d.ts.map +1 -0
  164. package/dist/retrieval/cross-project-search.js +109 -0
  165. package/dist/retrieval/cross-project-search.js.map +1 -0
  166. package/dist/retrieval/graph-builder.d.ts +6 -0
  167. package/dist/retrieval/graph-builder.d.ts.map +1 -0
  168. package/dist/retrieval/graph-builder.js +196 -0
  169. package/dist/retrieval/graph-builder.js.map +1 -0
  170. package/dist/retrieval/graph-cache.d.ts +15 -0
  171. package/dist/retrieval/graph-cache.d.ts.map +1 -0
  172. package/dist/retrieval/graph-cache.js +66 -0
  173. package/dist/retrieval/graph-cache.js.map +1 -0
  174. package/dist/retrieval/graph-invalidate.d.ts +18 -0
  175. package/dist/retrieval/graph-invalidate.d.ts.map +1 -0
  176. package/dist/retrieval/graph-invalidate.js +23 -0
  177. package/dist/retrieval/graph-invalidate.js.map +1 -0
  178. package/dist/retrieval/graph-retrieval.d.ts +24 -0
  179. package/dist/retrieval/graph-retrieval.d.ts.map +1 -0
  180. package/dist/retrieval/graph-retrieval.js +165 -0
  181. package/dist/retrieval/graph-retrieval.js.map +1 -0
  182. package/dist/retrieval/graph-traverse.d.ts +3 -0
  183. package/dist/retrieval/graph-traverse.d.ts.map +1 -0
  184. package/dist/retrieval/graph-traverse.js +53 -0
  185. package/dist/retrieval/graph-traverse.js.map +1 -0
  186. package/dist/retrieval/graph-types.d.ts +37 -0
  187. package/dist/retrieval/graph-types.d.ts.map +1 -0
  188. package/dist/retrieval/graph-types.js +12 -0
  189. package/dist/retrieval/graph-types.js.map +1 -0
  190. package/dist/retrieval/index-builder.d.ts +21 -0
  191. package/dist/retrieval/index-builder.d.ts.map +1 -0
  192. package/dist/retrieval/index-builder.js +94 -0
  193. package/dist/retrieval/index-builder.js.map +1 -0
  194. package/dist/retrieval/knowledge-selection.d.ts +7 -0
  195. package/dist/retrieval/knowledge-selection.d.ts.map +1 -0
  196. package/dist/retrieval/knowledge-selection.js +80 -0
  197. package/dist/retrieval/knowledge-selection.js.map +1 -0
  198. package/dist/retrieval/task-scoped.d.ts +23 -0
  199. package/dist/retrieval/task-scoped.d.ts.map +1 -0
  200. package/dist/retrieval/task-scoped.js +51 -0
  201. package/dist/retrieval/task-scoped.js.map +1 -0
  202. package/dist/utils/content-assembly.d.ts +44 -0
  203. package/dist/utils/content-assembly.d.ts.map +1 -0
  204. package/dist/utils/content-assembly.js +101 -0
  205. package/dist/utils/content-assembly.js.map +1 -0
  206. package/dist/utils/dag.d.ts +28 -0
  207. package/dist/utils/dag.d.ts.map +1 -0
  208. package/dist/utils/dag.js +68 -0
  209. package/dist/utils/dag.js.map +1 -0
  210. package/dist/utils/diagram-generator.d.ts +17 -0
  211. package/dist/utils/diagram-generator.d.ts.map +1 -0
  212. package/dist/utils/diagram-generator.js +38 -0
  213. package/dist/utils/diagram-generator.js.map +1 -0
  214. package/dist/utils/errors.d.ts +40 -0
  215. package/dist/utils/errors.d.ts.map +1 -0
  216. package/dist/utils/errors.js +83 -0
  217. package/dist/utils/errors.js.map +1 -0
  218. package/dist/utils/file-lock.d.ts +13 -0
  219. package/dist/utils/file-lock.d.ts.map +1 -0
  220. package/dist/utils/file-lock.js +80 -0
  221. package/dist/utils/file-lock.js.map +1 -0
  222. package/dist/utils/git.d.ts +14 -0
  223. package/dist/utils/git.d.ts.map +1 -0
  224. package/dist/utils/git.js +56 -0
  225. package/dist/utils/git.js.map +1 -0
  226. package/dist/utils/graphify-knowledge.d.ts +6 -0
  227. package/dist/utils/graphify-knowledge.d.ts.map +1 -0
  228. package/dist/utils/graphify-knowledge.js +60 -0
  229. package/dist/utils/graphify-knowledge.js.map +1 -0
  230. package/dist/utils/graphify.d.ts +49 -0
  231. package/dist/utils/graphify.d.ts.map +1 -0
  232. package/dist/utils/graphify.js +306 -0
  233. package/dist/utils/graphify.js.map +1 -0
  234. package/dist/utils/json-schemas.d.ts +723 -0
  235. package/dist/utils/json-schemas.d.ts.map +1 -0
  236. package/dist/utils/json-schemas.js +147 -0
  237. package/dist/utils/json-schemas.js.map +1 -0
  238. package/dist/utils/json.d.ts +15 -0
  239. package/dist/utils/json.d.ts.map +1 -0
  240. package/dist/utils/json.js +39 -0
  241. package/dist/utils/json.js.map +1 -0
  242. package/dist/utils/knowledge-store.d.ts +49 -0
  243. package/dist/utils/knowledge-store.d.ts.map +1 -0
  244. package/dist/utils/knowledge-store.js +191 -0
  245. package/dist/utils/knowledge-store.js.map +1 -0
  246. package/dist/utils/loop-state.d.ts +51 -0
  247. package/dist/utils/loop-state.d.ts.map +1 -0
  248. package/dist/utils/loop-state.js +123 -0
  249. package/dist/utils/loop-state.js.map +1 -0
  250. package/dist/utils/paths.d.ts +16 -0
  251. package/dist/utils/paths.d.ts.map +1 -0
  252. package/dist/utils/paths.js +66 -0
  253. package/dist/utils/paths.js.map +1 -0
  254. package/dist/utils/plan-store.d.ts +46 -0
  255. package/dist/utils/plan-store.d.ts.map +1 -0
  256. package/dist/utils/plan-store.js +184 -0
  257. package/dist/utils/plan-store.js.map +1 -0
  258. package/dist/utils/project-documents.d.ts +20 -0
  259. package/dist/utils/project-documents.d.ts.map +1 -0
  260. package/dist/utils/project-documents.js +10 -0
  261. package/dist/utils/project-documents.js.map +1 -0
  262. package/dist/utils/project-memory.d.ts +16 -0
  263. package/dist/utils/project-memory.d.ts.map +1 -0
  264. package/dist/utils/project-memory.js +16 -0
  265. package/dist/utils/project-memory.js.map +1 -0
  266. package/dist/utils/project-resolver.d.ts +28 -0
  267. package/dist/utils/project-resolver.d.ts.map +1 -0
  268. package/dist/utils/project-resolver.js +119 -0
  269. package/dist/utils/project-resolver.js.map +1 -0
  270. package/dist/utils/quick-scan.d.ts +13 -0
  271. package/dist/utils/quick-scan.d.ts.map +1 -0
  272. package/dist/utils/quick-scan.js +156 -0
  273. package/dist/utils/quick-scan.js.map +1 -0
  274. package/dist/utils/schemas.d.ts +13 -0
  275. package/dist/utils/schemas.d.ts.map +1 -0
  276. package/dist/utils/schemas.js +6 -0
  277. package/dist/utils/schemas.js.map +1 -0
  278. package/dist/utils/slug.d.ts +10 -0
  279. package/dist/utils/slug.d.ts.map +1 -0
  280. package/dist/utils/slug.js +18 -0
  281. package/dist/utils/slug.js.map +1 -0
  282. package/dist/utils/stdin.d.ts +6 -0
  283. package/dist/utils/stdin.d.ts.map +1 -0
  284. package/dist/utils/stdin.js +25 -0
  285. package/dist/utils/stdin.js.map +1 -0
  286. package/dist/utils/storage-utils.d.ts +48 -0
  287. package/dist/utils/storage-utils.d.ts.map +1 -0
  288. package/dist/utils/storage-utils.js +175 -0
  289. package/dist/utils/storage-utils.js.map +1 -0
  290. package/dist/utils/task-store.d.ts +49 -0
  291. package/dist/utils/task-store.d.ts.map +1 -0
  292. package/dist/utils/task-store.js +178 -0
  293. package/dist/utils/task-store.js.map +1 -0
  294. package/dist/utils/template.d.ts +15 -0
  295. package/dist/utils/template.d.ts.map +1 -0
  296. package/dist/utils/template.js +27 -0
  297. package/dist/utils/template.js.map +1 -0
  298. package/dist/utils/tool-response.d.ts +37 -0
  299. package/dist/utils/tool-response.d.ts.map +1 -0
  300. package/dist/utils/tool-response.js +44 -0
  301. package/dist/utils/tool-response.js.map +1 -0
  302. package/dist/utils/workflow-policy.d.ts +50 -0
  303. package/dist/utils/workflow-policy.d.ts.map +1 -0
  304. package/dist/utils/workflow-policy.js +111 -0
  305. package/dist/utils/workflow-policy.js.map +1 -0
  306. package/dist/utils/workspace-match.d.ts +35 -0
  307. package/dist/utils/workspace-match.d.ts.map +1 -0
  308. package/dist/utils/workspace-match.js +58 -0
  309. package/dist/utils/workspace-match.js.map +1 -0
  310. package/opencode/arcs/.opencode/plugins/arcs.js +348 -0
  311. package/opencode/arcs/bundle-runtime.json +68 -0
  312. package/opencode/arcs/manifest.json +279 -0
  313. package/opencode/arcs/prompts/arcs-docs.txt +124 -0
  314. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +529 -0
  315. package/opencode/arcs/prompts/arcs-orchestrate.txt +437 -0
  316. package/opencode/arcs/prompts/code-reviewer.txt +55 -0
  317. package/opencode/arcs/prompts/devil-advocate.txt +121 -0
  318. package/opencode/arcs/prompts/docs-researcher.txt +54 -0
  319. package/opencode/arcs/prompts/oncall-ops.txt +54 -0
  320. package/opencode/arcs/prompts/qa-analyst.txt +54 -0
  321. package/opencode/arcs/prompts/software-engineer.txt +48 -0
  322. package/opencode/arcs/prompts/system-architect.txt +60 -0
  323. package/opencode/arcs/prompts/tech-architect.txt +54 -0
  324. package/opencode/arcs/skills/brainstorming/SKILL.md +144 -0
  325. package/opencode/arcs/skills/brainstorming/scripts/frame-template.html +214 -0
  326. package/opencode/arcs/skills/brainstorming/scripts/helper.js +88 -0
  327. package/opencode/arcs/skills/brainstorming/scripts/server.js +338 -0
  328. package/opencode/arcs/skills/brainstorming/scripts/start-server.sh +137 -0
  329. package/opencode/arcs/skills/brainstorming/scripts/stop-server.sh +31 -0
  330. package/opencode/arcs/skills/brainstorming/spec-document-reviewer-prompt.md +50 -0
  331. package/opencode/arcs/skills/brainstorming/visual-companion.md +277 -0
  332. package/opencode/arcs/skills/caveman-commit/SKILL.md +51 -0
  333. package/opencode/arcs/skills/code-agent/SKILL.md +58 -0
  334. package/opencode/arcs/skills/deep-pr-review/SKILL.md +191 -0
  335. package/opencode/arcs/skills/deep-pr-review/graphify-diff.md +102 -0
  336. package/opencode/arcs/skills/deep-pr-review/review-template.md +69 -0
  337. package/opencode/arcs/skills/executing-plans/SKILL.md +91 -0
  338. package/opencode/arcs/skills/init-project/SKILL.md +150 -0
  339. package/opencode/arcs/skills/quick-dev/SKILL.md +47 -0
  340. package/opencode/arcs/skills/requesting-code-review/SKILL.md +47 -0
  341. package/opencode/arcs/skills/requesting-code-review/code-reviewer.md +179 -0
  342. package/opencode/arcs/skills/subagent-driven-development/SKILL.md +162 -0
  343. package/opencode/arcs/skills/subagent-driven-development/code-quality-reviewer-prompt.md +53 -0
  344. package/opencode/arcs/skills/subagent-driven-development/implementer-prompt.md +148 -0
  345. package/opencode/arcs/skills/subagent-driven-development/spec-reviewer-prompt.md +85 -0
  346. package/opencode/arcs/skills/systematic-debugging/SKILL.md +174 -0
  347. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  348. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +115 -0
  349. package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +122 -0
  350. package/opencode/arcs/skills/systematic-debugging/find-polluter.sh +63 -0
  351. package/opencode/arcs/skills/systematic-debugging/phases-reference.md +168 -0
  352. package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +169 -0
  353. package/opencode/arcs/skills/test-driven-development/SKILL.md +72 -0
  354. package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +157 -0
  355. package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +299 -0
  356. package/opencode/arcs/skills/to-diagram/SKILL.md +235 -0
  357. package/opencode/arcs/skills/to-diagram/scripts/manage-diagram.mjs +963 -0
  358. package/opencode/arcs/skills/writing-plans/SKILL.md +179 -0
  359. package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +52 -0
  360. package/package.json +60 -0
  361. package/scripts/arcs-cli.mjs +45 -0
  362. package/skills/explore-dag.md +57 -0
  363. package/skills/init-project.md +105 -0
  364. package/skills/orchestrate.md +94 -0
  365. package/skills/update-docs.md +72 -0
  366. package/templates/dependency.md.tmpl +9 -0
  367. package/templates/knowledge.md.tmpl +15 -0
  368. package/templates/project-meta.json.tmpl +13 -0
  369. package/templates/project.md.tmpl +11 -0
  370. package/templates/task.md.tmpl +9 -0
@@ -0,0 +1,277 @@
1
+ # Visual Companion Guide
2
+
3
+ Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
4
+
5
+ ## When to Use
6
+
7
+ Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
8
+
9
+ **Use the browser** when the content itself is visual:
10
+
11
+ - **UI mockups** — wireframes, layouts, navigation structures, component designs
12
+ - **Architecture diagrams** — system components, data flow, relationship maps
13
+ - **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
14
+ - **Design polish** — when the question is about look and feel, spacing, visual hierarchy
15
+ - **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
16
+
17
+ **Use the terminal** when the content is text or tabular:
18
+
19
+ - **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
20
+ - **Conceptual A/B/C choices** — picking between approaches described in words
21
+ - **Tradeoff lists** — pros/cons, comparison tables
22
+ - **Technical decisions** — API design, data modeling, architectural approach selection
23
+ - **Clarifying questions** — anything where the answer is words, not a visual preference
24
+
25
+ A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
26
+
27
+ ## How It Works
28
+
29
+ The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content, the user sees it in their browser and can click to select options. Selections are recorded to a `.events` file that you read on your next turn.
30
+
31
+ **Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, selection indicator, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
32
+
33
+ ## Starting a Session
34
+
35
+ ```bash
36
+ # Start server with persistence (mockups saved to project)
37
+ scripts/start-server.sh --project-dir /path/to/project
38
+
39
+ # Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341",
40
+ # "screen_dir":"/path/to/project/.arcs/brainstorm/12345-1706000000"}
41
+ ```
42
+
43
+ Save `screen_dir` from the response. Tell user to open the URL.
44
+
45
+ **Finding connection info:** The server writes its startup JSON to `$SCREEN_DIR/.server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.arcs/brainstorm/` for the session directory.
46
+
47
+ **Note:** Pass the project root as `--project-dir` so mockups persist in `.arcs/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.arcs/` to `.gitignore` if it's not already there.
48
+
49
+ **Launching the server by platform:**
50
+
51
+ **Claude Code:**
52
+ ```bash
53
+ # Default mode works — the script backgrounds the server itself
54
+ scripts/start-server.sh --project-dir /path/to/project
55
+ ```
56
+
57
+ **Codex:**
58
+ ```bash
59
+ # Codex reaps background processes. The script auto-detects CODEX_CI and
60
+ # switches to foreground mode. Run it normally — no extra flags needed.
61
+ scripts/start-server.sh --project-dir /path/to/project
62
+ ```
63
+
64
+ **Gemini CLI:**
65
+ ```bash
66
+ # Use --foreground and set is_background: true on your shell tool call
67
+ # so the process survives across turns
68
+ scripts/start-server.sh --project-dir /path/to/project --foreground
69
+ ```
70
+
71
+ **Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
72
+
73
+ If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
74
+
75
+ ```bash
76
+ scripts/start-server.sh \
77
+ --project-dir /path/to/project \
78
+ --host 0.0.0.0 \
79
+ --url-host localhost
80
+ ```
81
+
82
+ Use `--url-host` to control what hostname is printed in the returned URL JSON.
83
+
84
+ ## The Loop
85
+
86
+ 1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
87
+ - Before each write, check that `$SCREEN_DIR/.server-info` exists. If it doesn't (or `.server-stopped` exists), the server has shut down — restart it with `start-server.sh` before continuing. The server auto-exits after 30 minutes of inactivity.
88
+ - Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
89
+ - **Never reuse filenames** — each screen gets a fresh file
90
+ - Use Write tool — **never use cat/heredoc** (dumps noise into terminal)
91
+ - Server automatically serves the newest file
92
+
93
+ 2. **Tell user what to expect and end your turn:**
94
+ - Remind them of the URL (every step, not just first)
95
+ - Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
96
+ - Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
97
+
98
+ 3. **On your next turn** — after the user responds in the terminal:
99
+ - Read `$SCREEN_DIR/.events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
100
+ - Merge with the user's terminal text to get the full picture
101
+ - The terminal message is the primary feedback; `.events` provides structured interaction data
102
+
103
+ 4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
104
+
105
+ 5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
106
+
107
+ ```html
108
+ <!-- filename: waiting.html (or waiting-2.html, etc.) -->
109
+ <div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
110
+ <p class="subtitle">Continuing in terminal...</p>
111
+ </div>
112
+ ```
113
+
114
+ This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
115
+
116
+ 6. Repeat until done.
117
+
118
+ ## Writing Content Fragments
119
+
120
+ Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, selection indicator, and all interactive infrastructure).
121
+
122
+ **Minimal example:**
123
+
124
+ ```html
125
+ <h2>Which layout works better?</h2>
126
+ <p class="subtitle">Consider readability and visual hierarchy</p>
127
+
128
+ <div class="options">
129
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
130
+ <div class="letter">A</div>
131
+ <div class="content">
132
+ <h3>Single Column</h3>
133
+ <p>Clean, focused reading experience</p>
134
+ </div>
135
+ </div>
136
+ <div class="option" data-choice="b" onclick="toggleSelect(this)">
137
+ <div class="letter">B</div>
138
+ <div class="content">
139
+ <h3>Two Column</h3>
140
+ <p>Sidebar navigation with main content</p>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ ```
145
+
146
+ That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
147
+
148
+ ## CSS Classes Available
149
+
150
+ The frame template provides these CSS classes for your content:
151
+
152
+ ### Options (A/B/C choices)
153
+
154
+ ```html
155
+ <div class="options">
156
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
157
+ <div class="letter">A</div>
158
+ <div class="content">
159
+ <h3>Title</h3>
160
+ <p>Description</p>
161
+ </div>
162
+ </div>
163
+ </div>
164
+ ```
165
+
166
+ **Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item. The indicator bar shows the count.
167
+
168
+ ```html
169
+ <div class="options" data-multiselect>
170
+ <!-- same option markup — users can select/deselect multiple -->
171
+ </div>
172
+ ```
173
+
174
+ ### Cards (visual designs)
175
+
176
+ ```html
177
+ <div class="cards">
178
+ <div class="card" data-choice="design1" onclick="toggleSelect(this)">
179
+ <div class="card-image"><!-- mockup content --></div>
180
+ <div class="card-body">
181
+ <h3>Name</h3>
182
+ <p>Description</p>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ ```
187
+
188
+ ### Mockup container
189
+
190
+ ```html
191
+ <div class="mockup">
192
+ <div class="mockup-header">Preview: Dashboard Layout</div>
193
+ <div class="mockup-body"><!-- your mockup HTML --></div>
194
+ </div>
195
+ ```
196
+
197
+ ### Split view (side-by-side)
198
+
199
+ ```html
200
+ <div class="split">
201
+ <div class="mockup"><!-- left --></div>
202
+ <div class="mockup"><!-- right --></div>
203
+ </div>
204
+ ```
205
+
206
+ ### Pros/Cons
207
+
208
+ ```html
209
+ <div class="pros-cons">
210
+ <div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
211
+ <div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
212
+ </div>
213
+ ```
214
+
215
+ ### Mock elements (wireframe building blocks)
216
+
217
+ ```html
218
+ <div class="mock-nav">Logo | Home | About | Contact</div>
219
+ <div style="display: flex;">
220
+ <div class="mock-sidebar">Navigation</div>
221
+ <div class="mock-content">Main content area</div>
222
+ </div>
223
+ <button class="mock-button">Action Button</button>
224
+ <input class="mock-input" placeholder="Input field">
225
+ <div class="placeholder">Placeholder area</div>
226
+ ```
227
+
228
+ ### Typography and sections
229
+
230
+ - `h2` — page title
231
+ - `h3` — section heading
232
+ - `.subtitle` — secondary text below title
233
+ - `.section` — content block with bottom margin
234
+ - `.label` — small uppercase label text
235
+
236
+ ## Browser Events Format
237
+
238
+ When the user clicks options in the browser, their interactions are recorded to `$SCREEN_DIR/.events` (one JSON object per line). The file is cleared automatically when you push a new screen.
239
+
240
+ ```jsonl
241
+ {"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
242
+ {"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
243
+ {"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
244
+ ```
245
+
246
+ The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
247
+
248
+ If `.events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
249
+
250
+ ## Design Tips
251
+
252
+ - **Scale fidelity to the question** — wireframes for layout, polish for polish questions
253
+ - **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
254
+ - **Iterate before advancing** — if feedback changes current screen, write a new version
255
+ - **2-4 options max** per screen
256
+ - **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
257
+ - **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
258
+
259
+ ## File Naming
260
+
261
+ - Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
262
+ - Never reuse filenames — each screen must be a new file
263
+ - For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
264
+ - Server serves newest file by modification time
265
+
266
+ ## Cleaning Up
267
+
268
+ ```bash
269
+ scripts/stop-server.sh $SCREEN_DIR
270
+ ```
271
+
272
+ If the session used `--project-dir`, mockup files persist in `.arcs/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
273
+
274
+ ## Reference
275
+
276
+ - Frame template (CSS reference): `scripts/frame-template.html`
277
+ - Helper script (client-side): `scripts/helper.js`
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: caveman-commit
3
+ description: Use when writing git commit messages, especially when ARCS Caveman mode is active. Produces Conventional Commits with terse, intent-preserving prose. Subject ≤50 chars; body only when the "why" isn't obvious from the diff.
4
+ ---
5
+
6
+ # Skill: caveman-commit
7
+
8
+ ## When
9
+
10
+ Writing git commit messages. Terse, exact, Conventional Commits. Why over what.
11
+
12
+ ## Flow
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ A[Read diff] --> B[Classify: feat/fix/refactor/perf/docs/test/chore]
17
+ B --> C["Write subject: type(scope): imperative ≤50"]
18
+ C --> D{Why obvious from diff?}
19
+ D -->|yes| E[Subject only — done]
20
+ D -->|no| F[Write body: why + context]
21
+ F --> G{Breaking/security/migration?}
22
+ G -->|yes| H[MUST include body]
23
+ G -->|no| E
24
+ H --> E
25
+ ```
26
+
27
+ ## Format Rules
28
+
29
+ | Element | Rule |
30
+ |---------|------|
31
+ | Subject | `<type>(<scope>): <imperative>` ≤50 chars (hard cap 72) |
32
+ | Types | feat, fix, refactor, perf, docs, test, chore, build, ci, style, revert |
33
+ | Mood | Imperative: "add", "fix", "remove" — not past/present tense |
34
+ | Body | Wrap 72 chars, bullets `-`, skip if subject self-explanatory |
35
+ | Issues | End of body: `Closes #42`, `Refs #17` |
36
+
37
+ ## Never Include
38
+
39
+ - "This commit does X", "I", "we", "now" — diff says what
40
+ - AI attribution (unless explicitly requested)
41
+ - Emoji (unless project history uses them)
42
+ - Trailing period on subject
43
+
44
+ ## Always Include Body For
45
+
46
+ - Breaking changes, security fixes (cite CVE), data migrations, reverts (name SHA)
47
+
48
+ ## Constraints
49
+
50
+ - Output message as code block only — do not run `git commit`
51
+ - "Stop caveman-commit" or "normal mode" → revert to verbose style
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: code-agent
3
+ description: Use when the task is mostly clear (50-90%) with one or two open decisions that can likely be resolved by inspecting the repo — not fully bounded, not a blank-slate design problem
4
+ ---
5
+
6
+ # Skill: code-agent
7
+
8
+ ## When
9
+
10
+ Task is mostly clear (50-90%) but 1-2 decisions remain open — resolvable by inspecting the repo.
11
+
12
+ ## Flow
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ A[Orient: arcs brief --lean --json] --> K[Knowledge: arcs knowledge search slug keywords]
17
+ K --> B[Search: arcs search slug keywords]
18
+ B --> C[Inspect repo — patterns, types, fixtures]
19
+ C --> D{Confidence score >=80?}
20
+ D -->|Yes| E[Implement — TDD for new behavior]
21
+ D -->|No, inferable| E
22
+ D -->|No, genuine ambiguity| F[Ask ONE targeted question]
23
+ F --> E
24
+ E --> G[Verify — affected tests + lint on changed files]
25
+ G --> H{Complexity expanded?}
26
+ H -->|No| I[Done]
27
+ H -->|Yes| J[Pause — state issue — offer brainstorming]
28
+ ```
29
+
30
+ ## Phase 0: Check Existing Knowledge
31
+
32
+ Before investigating or implementing, check what the DAG already knows:
33
+
34
+ ```bash
35
+ arcs knowledge search <slug> "<task-keywords>" --lean --json
36
+ ```
37
+
38
+ Look for:
39
+ - `kind: pattern` — existing conventions that apply to this change
40
+ - `kind: gotcha` — known traps in this area
41
+ - `kind: lesson` — prior learnings from similar work
42
+
43
+ If relevant entries exist, incorporate their guidance. Don't rediscover what's already known.
44
+
45
+ ## Behaviour
46
+
47
+ - Inspect repo before asking anything
48
+ - Score self-confidence per `confidence-gate` before any code edit; <80% triggers explore/web recovery, not improvisation
49
+ - Proceed on inferred defaults when repo makes it clear
50
+ - Ask at most one targeted question (product direction, naming, breaking trade-off)
51
+ - TDD for new non-trivial behavior; skip for structural changes covered by existing tests
52
+ - Lightweight bullet plan only when 3+ files and sequencing matters
53
+ - Verify scoped: lint + test only files you touched (full suite only if change is pervasive — shared types, config, build)
54
+
55
+ ## NOT for
56
+
57
+ - Fully bounded, no decisions → `quick-dev`
58
+ - Unclear/creative/design-shaping → `brainstorming`
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: deep-pr-review
3
+ description: Use when the user provides a GitHub PR link with a "deep review" trigger inside a locally cloned repo, to perform a thorough multi-dimensional code review grounded in ARCS DAG context, AGENTS.md conventions, and optional graphify coupling analysis, then post findings as inline GitHub review comments under explicit user gate
4
+ ---
5
+
6
+ # Skill: deep-pr-review
7
+
8
+ ## When
9
+
10
+ User gives a GitHub PR URL plus a "deep review" trigger inside the locally cloned repo of that PR. Reviewer-side workflow: read-only by default, posts to GitHub only after explicit user gate.
11
+
12
+ > CLI: `arcs --commands --json` for discovery. Posting is user-gated. ARCS writes (optional knowledge harvest) run directly via the CLI.
13
+
14
+ ## Flow
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ classDef bail fill:#ef4444,color:#fff
19
+
20
+ A[User: 'deep review' + PR URL] --> B[Gather phase — see Data Gathering section]
21
+ B --> C{cwd repo == PR repo?}
22
+ C -->|no| Z[Halt — wrong checkout]:::bail
23
+ C -->|yes| D{Label = wip/draft?}
24
+ D -->|yes| D1[Soften severity — flag as WIP]
25
+ D -->|no| D2[Standard severity]
26
+ D1 & D2 --> E[arcs context --audience=implementer --lean --json]
27
+ E -->|found| F[Load AGENTS.md + targeted arcs search]
28
+ E -->|missing| G[Degraded mode — heuristics only]
29
+ F --> H{Prior AI review exists?}
30
+ G --> H
31
+ H -->|yes| I[Diff against prior review commit_id only]
32
+ H -->|no| J[Use full PR diff]
33
+ I --> K[Pick adaptive rubric from diff context]
34
+ J --> K
35
+ K --> L{Diff size?}
36
+ L -->|huge >40 files OR >2000 lines| M[Force summary mode]
37
+ L -->|normal| N{graphify available?}
38
+ N -->|yes| O[Run affected/query on changed symbols]
39
+ N -->|no| P[Skip coupling check — note in report]
40
+ M --> Q[Aggregate findings + cite each]
41
+ O --> Q
42
+ P --> Q
43
+ Q --> R[Present report + 5 posting modes]
44
+ R --> S{User choice}
45
+ S -->|don't post| END1[Show report only]
46
+ S -->|post| T[gh api: review + inline comments]
47
+ T --> U{Recurring pattern surfaced?}
48
+ U -->|yes + opt-in| V[Propose knowledge:create]
49
+ U -->|no| END2[Done]
50
+ V --> END2
51
+ ```
52
+
53
+ ## Data Gathering (ONE PASS — no repeat `gh` reads)
54
+
55
+ Run these three commands once at the start. Cache the results. All downstream steps read from cache — never call `gh repo view` or `gh pr view` again.
56
+
57
+ ```
58
+ 1. gh repo view --json name,owner → REPO
59
+ 2. gh pr view <number> --json number,title,body,author,labels,reviews,state,files,headRefName,baseRefName → PR_META
60
+ 3. gh pr diff <number> → DIFF
61
+ ```
62
+
63
+ | Downstream need | Read from |
64
+ |-----------------|-----------|
65
+ | Repo-match check | `REPO.name`, `REPO.owner` |
66
+ | WIP / draft check | `PR_META.labels`, `PR_META.state` |
67
+ | Author context | `PR_META.author` |
68
+ | Prior review detection | `PR_META.reviews` |
69
+ | File list / LOC delta | `PR_META.files` |
70
+ | Diff text | `DIFF` |
71
+
72
+ ## Adaptive Rubric
73
+
74
+ Agent picks dimensions from diff context. **Correctness is always evaluated.** Other dimensions activate when the diff signals them:
75
+
76
+ | Dimension | Activates when |
77
+ |-----------|----------------|
78
+ | **Correctness** | Always — bugs, off-by-one, error handling, null safety |
79
+ | **DRY** | New code resembles existing patterns; cross-module grep finds duplicates |
80
+ | **KISS** | New abstraction layers, deep nesting, premature generalization |
81
+ | **YAGNI** | Code written "for later" with no current caller; abstractions with one concrete use; configurable hooks with one known value; generic machinery built for hypothetical consumers |
82
+ | **SOLID** | Module gains responsibilities, dependency direction shifts, large classes touched |
83
+ | **Convention fit** | AGENTS.md or DAG `pattern`/`architecture` knowledge applies to changed files |
84
+ | **Architectural risk** → handoff `architecture-review` | Diff crosses module boundaries, touches god nodes, changes public API |
85
+ | **Performance risk** → handoff `performance-diagnosis` | Hot paths, loops over external IO, new queries, allocations in render |
86
+
87
+ Skipped dimensions are reported as `cleared (not applicable: <reason>)`. Never silently dropped.
88
+
89
+ ## Severity Prefixes
90
+
91
+ Reuses `caveman-review` format for inline output:
92
+
93
+ | Prefix | Meaning | Posting default |
94
+ |--------|---------|-----------------|
95
+ | `🔴 bug:` | Broken behavior, will cause incident | Always post |
96
+ | `🟠 risk:` | Works but fragile, edge case unhandled | Always post |
97
+ | `🟡 suggestion:` | Concrete fix improving quality | Posted in modes 2/3 |
98
+ | `🔵 nit:` | Style / naming / minor consistency | Posted only in mode 3 |
99
+ | `❓ q:` | Genuine question for the author | Always post |
100
+
101
+ ## Posting Modes
102
+
103
+ User picks one before any `gh` write:
104
+
105
+ | # | Mode | What posts |
106
+ |---|------|------------|
107
+ | 1 | **Critical-only** | 🔴 bug + 🟠 risk + ❓ q only |
108
+ | 2 | **Critical + actionable** | Above + 🟡 suggestion |
109
+ | 3 | **All findings** | Above + 🔵 nit |
110
+ | 4 | **Summary only** | Single top-level review body, no inline comments |
111
+ | 5 | **Don't post** | Show report only — no `gh` calls |
112
+
113
+ ## Iron Law
114
+
115
+ **READ ONLY until user picks a posting mode.** No `gh` writes, no ARCS writes, no auto-approve. Approval is only ever produced via explicit user override (`approve it`, `lgtm post approve`) — never inferred from finding count.
116
+
117
+ ## Citation Rule
118
+
119
+ Every finding cites a source. No uncited findings:
120
+
121
+ - `see knowledge/<id>: <title>` — ARCS knowledge entry
122
+ - `AGENTS.md §<section>` — project convention
123
+ - `graphify: <observation>` — coupling/affected result
124
+ - `principle: <KISS|DRY|YAGNI|SOLID|correctness>` — first-principles label
125
+
126
+ If only first-principles applies, that is sufficient — but it must be stated.
127
+
128
+ ## Inline Suggestion Rule
129
+
130
+ GitHub `​```suggestion` blocks render an "Apply suggestion" button. Use **only** when the fix is a one-to-few-line replacement of existing lines on the diff. For larger fixes:
131
+
132
+ - Multi-line code restructure → inline review comment with a fenced code block (no `suggestion` tag)
133
+ - Missing block / new file content → top-level review body bullet
134
+ - Cross-file refactor → handoff finding with `architecture-review` recommendation
135
+
136
+ ## Posting Protocol (ONE `gh api` call — never per-finding)
137
+
138
+ All findings are batched into a **single** GitHub review submission. Never loop through findings and post each one individually.
139
+
140
+ ```
141
+ gh api POST /repos/{owner}/{repo}/pulls/{number}/reviews \
142
+ --field commit_id="<PR head SHA from PR_META>" \
143
+ --field event="COMMENT" \
144
+ --field body="<top-level summary>" \
145
+ --field 'comments=[{"path":"...","position":N,"body":"..."},...]'
146
+ ```
147
+
148
+ | Rule | Detail |
149
+ |------|--------|
150
+ | One call per review session | Top-level body + all inline comments in the same `comments[]` array |
151
+ | Never mix `gh pr review` and `gh api` | Pick one entry point — use `gh api` for full control; `gh pr review` for body-only (mode 4) |
152
+ | Never call `gh pr comment` after `gh api reviews` | `gh pr comment` adds a stand-alone comment, not a review — it will duplicate the top-level body |
153
+ | Dry-run before sending | Print the full payload to the user for confirmation; only call `gh api` once user confirms |
154
+
155
+ ### Mode → command mapping
156
+
157
+ | Mode | Command |
158
+ |------|---------|
159
+ | 1–3 (inline + summary) | `gh api POST .../reviews` with `body` + `comments[]` — **one call** |
160
+ | 4 (summary only) | `gh pr review <number> --comment --body "..."` — **one call, no `comments[]`** |
161
+ | 5 (don't post) | No `gh` writes |
162
+
163
+ ## Report Structure
164
+
165
+ ```
166
+ # Deep PR Review: <repo>#<number> — <title>
167
+ ## Pre-flight (repo match, PR state, prior reviews)
168
+ ## Scope (files touched, LOC delta, modules affected)
169
+ ## Rubric Selection (which dimensions activated, why)
170
+ ## Findings (grouped by severity)
171
+ ## Cleared Dimensions (with evidence)
172
+ ## Architectural / Performance Handoffs (if any)
173
+ ## Posting Plan (mode chosen → exact comments to be posted)
174
+ ## Confidence & Gaps
175
+ ```
176
+
177
+ ## Constraints
178
+
179
+ - **Never repeat `gh repo view` or `gh pr view` after the initial gather pass** — all data is cached upfront
180
+ - **ONE `gh api` call to post the review** — batch all inline comments into the `comments[]` array; never loop and post per-finding; never mix `gh pr review` + `gh api` + `gh pr comment` in the same session
181
+ - Never auto-approve; approval only on explicit user override
182
+ - Never post to GitHub before user picks a posting mode
183
+ - Cite every finding — no uncited claims
184
+ - ` ```suggestion ` blocks only for small line-replacement fixes
185
+ - Defer to `architecture-review` for full structural drift; surface as handoff flag, do not run inline
186
+ - Defer to `performance-diagnosis` for perf investigation; surface as risk flag
187
+ - Compose with `auditing-a-feature` rubric and `caveman-review` inline format — do not duplicate
188
+ - Re-review detection: if AI has reviewed before, scope to diff since last review's commit_id
189
+ - Tag each posted suggestion with `<!-- arcs:deep-review:<finding-id> -->` for re-review tracking
190
+ - See `review-template.md` for GitHub review body template
191
+ - See `graphify-diff.md` for the changed-symbols-to-affected algorithm
@@ -0,0 +1,102 @@
1
+ # Graphify Diff Algorithm
2
+
3
+ `graphify` has no native "diff against PR" command. This file defines how `deep-pr-review` builds coupling/duplication checks on top of the existing `affected`, `query`, and `diagnose multigraph` primitives.
4
+
5
+ ## Prerequisites
6
+
7
+ ```bash
8
+ which graphify || echo "skip" # graceful absence
9
+ ls graphify-out/graph.json 2>/dev/null # graph must exist
10
+ ```
11
+
12
+ If graphify is missing or `graph.json` is older than the PR's base commit, refresh:
13
+ ```bash
14
+ graphify update .
15
+ ```
16
+
17
+ ## Step 1: Extract changed symbols from the diff
18
+
19
+ ```bash
20
+ gh pr diff <num> --patch > /tmp/pr.diff
21
+ ```
22
+
23
+ Parse `/tmp/pr.diff` to extract changed symbols:
24
+ - For each `+++ b/<file>` hunk, capture the file path
25
+ - For each added / modified function or exported identifier, capture `<file>::<symbol>`
26
+ - Skip pure deletions (handled separately under "removed coupling" check)
27
+
28
+ Heuristic for symbol extraction (language-aware):
29
+ - TypeScript / JavaScript: `function X`, `class X`, `export const X`, `export function X`, `const X = `
30
+ - Python: `def X`, `class X`
31
+ - Go: `func X`, `type X`
32
+ - Rust: `fn X`, `struct X`, `impl X`
33
+ - Other: fall back to file-level granularity
34
+
35
+ ## Step 2: Run `affected` per changed symbol
36
+
37
+ ```bash
38
+ graphify affected "<file>::<symbol>" --depth 2 --json
39
+ ```
40
+
41
+ Collect for each symbol:
42
+ - **Fan-out callers** — who depends on this symbol (changes ripple here)
43
+ - **Fan-out depth** — how many hops to leaves
44
+ - **Cross-module edges** — callers in different top-level dirs
45
+
46
+ ## Step 3: Detect surprising fan-out
47
+
48
+ Flag as 🟠 **risk** in the report when:
49
+
50
+ | Pattern | Meaning |
51
+ |---------|---------|
52
+ | Changed symbol has >10 callers across >3 modules | Wide blast radius — non-obvious from diff alone |
53
+ | Changed signature on a symbol with >5 callers | Breaking-change risk |
54
+ | New symbol has same name as existing symbol in another module | Naming collision risk → DRY check |
55
+
56
+ ## Step 4: Duplication check
57
+
58
+ For each new function added in the diff, run:
59
+ ```bash
60
+ graphify query "functions similar to <new-symbol-signature>" --budget 8 --json
61
+ ```
62
+
63
+ If results include symbols with similar signatures (≥70% name overlap or matching parameter shape), flag as 🟡 **suggestion** with citation `graphify: similar to <existing-symbol>` and propose extraction or reuse.
64
+
65
+ ## Step 5: Diagnose multigraph (architectural drift)
66
+
67
+ ```bash
68
+ graphify diagnose multigraph --json
69
+ ```
70
+
71
+ If the PR introduces edges that contribute to a multigraph collapse (multiple edges between the same node pair), flag as 🟠 **risk** with handoff to `architecture-review`. Same-endpoint multi-edges are a structural duplication signal worth surfacing but not worth diagnosing inline.
72
+
73
+ ## Step 6: Aggregate findings
74
+
75
+ Each graphify-derived finding must include:
76
+ - The `graphify` command that produced it (for reproducibility)
77
+ - The cited symbol(s) — use backticks
78
+ - The cited module path(s)
79
+ - A finding ID for re-review tracking: `<file>:<line>:<dimension>:<short-hash>`
80
+
81
+ ## Performance bounds
82
+
83
+ - Cap symbols analyzed per PR at 50. If diff contains more, sample by:
84
+ - All exported / public symbols first (always)
85
+ - Then internal symbols by descending hunk size
86
+ - Skip step 4 (duplication) entirely if diff size exceeds 1500 LOC — too noisy
87
+ - Skip step 5 (multigraph) if `graphify diagnose multigraph` runtime exceeds 10s — log and continue without
88
+
89
+ ## Graceful degradation
90
+
91
+ If any graphify call fails or returns empty:
92
+ - Note in report: `Graphify step <N> unavailable: <reason>` under "Cleared Dimensions"
93
+ - Continue with the remaining dimensions
94
+ - Never let a graphify failure abort the review
95
+
96
+ ## Output integration
97
+
98
+ Graphify findings flow back into the standard finding pipeline. Each one is:
99
+ - Cited as `graphify: <one-line observation>`
100
+ - Severity-classified (most are 🟡 suggestion or 🟠 risk; rarely 🔴)
101
+ - Attached to a specific file+line if possible; otherwise lives in the top-level review body
102
+ - Tagged for re-review with `<!-- arcs:deep-review:<finding-id> -->`