@rryando/arcs 4.1.0 → 4.2.1

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 (213) hide show
  1. package/README.md +17 -19
  2. package/dist/cli/arcs-flash.d.ts +1 -1
  3. package/dist/cli/arcs-flash.d.ts.map +1 -1
  4. package/dist/cli/arcs-flash.js +10 -53
  5. package/dist/cli/arcs-flash.js.map +1 -1
  6. package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -2
  7. package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
  8. package/dist/cli/arcs-orchestrate-caveman.js +2 -8
  9. package/dist/cli/arcs-orchestrate-caveman.js.map +1 -1
  10. package/dist/cli/arcs-orchestrate.d.ts +1 -1
  11. package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
  12. package/dist/cli/arcs-orchestrate.js +4 -54
  13. package/dist/cli/arcs-orchestrate.js.map +1 -1
  14. package/dist/cli/commands/index.d.ts +0 -1
  15. package/dist/cli/commands/index.d.ts.map +1 -1
  16. package/dist/cli/commands/index.js +0 -1
  17. package/dist/cli/commands/index.js.map +1 -1
  18. package/dist/cli/commands/project.js +1 -30
  19. package/dist/cli/commands/project.js.map +1 -1
  20. package/dist/cli/commands/proposal-doc.d.ts +2 -0
  21. package/dist/cli/commands/proposal-doc.d.ts.map +1 -0
  22. package/dist/cli/commands/proposal-doc.js +381 -0
  23. package/dist/cli/commands/proposal-doc.js.map +1 -0
  24. package/dist/cli/commands/web.js +4 -10
  25. package/dist/cli/commands/web.js.map +1 -1
  26. package/dist/cli/orchestrator-shared-blocks.d.ts +11 -30
  27. package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -1
  28. package/dist/cli/orchestrator-shared-blocks.js +49 -126
  29. package/dist/cli/orchestrator-shared-blocks.js.map +1 -1
  30. package/dist/utils/diagram-generator.d.ts.map +1 -1
  31. package/dist/utils/diagram-generator.js +11 -6
  32. package/dist/utils/diagram-generator.js.map +1 -1
  33. package/dist/utils/graphify-knowledge.d.ts +22 -0
  34. package/dist/utils/graphify-knowledge.d.ts.map +1 -0
  35. package/dist/utils/graphify-knowledge.js +47 -0
  36. package/dist/utils/graphify-knowledge.js.map +1 -0
  37. package/dist/utils/graphify.d.ts +104 -0
  38. package/dist/utils/graphify.d.ts.map +1 -0
  39. package/dist/utils/graphify.js +439 -0
  40. package/dist/utils/graphify.js.map +1 -0
  41. package/dist/utils/session-store.d.ts +24 -2
  42. package/dist/utils/session-store.d.ts.map +1 -1
  43. package/dist/utils/session-store.js +16 -7
  44. package/dist/utils/session-store.js.map +1 -1
  45. package/dist/utils/storage-utils.d.ts +1 -1
  46. package/dist/utils/storage-utils.d.ts.map +1 -1
  47. package/dist/utils/storage-utils.js +1 -1
  48. package/dist/utils/storage-utils.js.map +1 -1
  49. package/dist/web-client/assets/{GraphCanvas-BPDgvsyT.js → GraphCanvas-Dw6EcoDb.js} +1 -1
  50. package/dist/web-client/assets/{MarkdownEditor-D7TLp78z.js → MarkdownEditor-Cz5_44Ej.js} +1 -1
  51. package/dist/web-client/assets/{abnfDiagram-VRR7QNED-CyuP2N9t.js → abnfDiagram-VRR7QNED-CFJzLuew.js} +1 -1
  52. package/dist/web-client/assets/architecture-TIHT7OUA-CoHvhex9.js +1 -0
  53. package/dist/web-client/assets/{architectureDiagram-ZJ3FMSHR-DZ0ul9QX.js → architectureDiagram-ZJ3FMSHR-FRlSgnnW.js} +1 -1
  54. package/dist/web-client/assets/{blockDiagram-677ZJIJ3-LLGzlc9l.js → blockDiagram-677ZJIJ3-WUkkunPZ.js} +1 -1
  55. package/dist/web-client/assets/{c4Diagram-LMCZKHZV-CViu3CTc.js → c4Diagram-LMCZKHZV-BKeAsL6F.js} +1 -1
  56. package/dist/web-client/assets/channel-D8xMXC5_.js +1 -0
  57. package/dist/web-client/assets/{chunk-32BRIVSS-Bw_IuJCM.js → chunk-32BRIVSS-B0b9kUcF.js} +1 -1
  58. package/dist/web-client/assets/{chunk-52WLFC77-C29h440W.js → chunk-52WLFC77-i6Y-vfL3.js} +1 -1
  59. package/dist/web-client/assets/{chunk-C7G6YPKG-hhOrvw5w.js → chunk-C7G6YPKG-atYWm6iP.js} +1 -1
  60. package/dist/web-client/assets/{chunk-EX3LRPZG-COMzol-M.js → chunk-EX3LRPZG-CZD6y0UU.js} +1 -1
  61. package/dist/web-client/assets/{chunk-FWX5IMBZ-6vdX9EUn.js → chunk-FWX5IMBZ-CVErR-UZ.js} +2 -2
  62. package/dist/web-client/assets/{chunk-HOUHSVGY-DWDW6sxp.js → chunk-HOUHSVGY-BlHO2iQ3.js} +1 -1
  63. package/dist/web-client/assets/{chunk-ICXQ74PX-BdMYglo2.js → chunk-ICXQ74PX-Ar8kfXfa.js} +1 -1
  64. package/dist/web-client/assets/{chunk-MOJQB5TN-C0LAX_dC.js → chunk-MOJQB5TN-DKrK867P.js} +1 -1
  65. package/dist/web-client/assets/{chunk-OGEWGWER-CBx8MB7f.js → chunk-OGEWGWER-BmGykUeg.js} +1 -1
  66. package/dist/web-client/assets/{chunk-PUDLZKDR-DKssR1nf.js → chunk-PUDLZKDR-Bq23pnso.js} +1 -1
  67. package/dist/web-client/assets/{chunk-Q4XR5HBZ-B3kcxFE-.js → chunk-Q4XR5HBZ-g15qvFAN.js} +1 -1
  68. package/dist/web-client/assets/{chunk-V7JOEXUC-CAlymndy.js → chunk-V7JOEXUC-uyXA7S9r.js} +1 -1
  69. package/dist/web-client/assets/{chunk-VAUOI2AC-BowfsmTW.js → chunk-VAUOI2AC-WofZ-2M0.js} +1 -1
  70. package/dist/web-client/assets/{chunk-VR4S4FIN-BBOydgvt.js → chunk-VR4S4FIN-DtTkK86v.js} +1 -1
  71. package/dist/web-client/assets/{chunk-WYO6CB5R-DcymFbES.js → chunk-WYO6CB5R-zVyUwJq3.js} +1 -1
  72. package/dist/web-client/assets/{chunk-ZGVPDNZ5--uKFP-Lr.js → chunk-ZGVPDNZ5-CA1Oe3TK.js} +1 -1
  73. package/dist/web-client/assets/classDiagram-OUVF2IWQ-Doj1_hvZ.js +1 -0
  74. package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-Doj1_hvZ.js +1 -0
  75. package/dist/web-client/assets/{cynefin-VYW2F7L2-CjboUOMA.js → cynefin-VYW2F7L2-ivJY1h_9.js} +1 -1
  76. package/dist/web-client/assets/{cynefinDiagram-TSTJHNR4-BcxygBP7.js → cynefinDiagram-TSTJHNR4-D2DstShq.js} +1 -1
  77. package/dist/web-client/assets/{dagre-VKFMJZFB-D-tiERQE.js → dagre-VKFMJZFB-CwnMRy0K.js} +1 -1
  78. package/dist/web-client/assets/{diagram-FQU43EPY-ChPXczaS.js → diagram-FQU43EPY-BKJv6Cvw.js} +1 -1
  79. package/dist/web-client/assets/{diagram-G47NLZAW-CVL3Y91h.js → diagram-G47NLZAW-CwCXcgU5.js} +1 -1
  80. package/dist/web-client/assets/{diagram-NH7WQ7WH-DsaNA9Lh.js → diagram-NH7WQ7WH-CkghU1-6.js} +1 -1
  81. package/dist/web-client/assets/{diagram-OA4YK3LP-CXhrhdhU.js → diagram-OA4YK3LP-D3siQIGu.js} +1 -1
  82. package/dist/web-client/assets/{diagram-WEI45ONY-BTVPnk4E.js → diagram-WEI45ONY-CSs9xTBn.js} +1 -1
  83. package/dist/web-client/assets/{ebnfDiagram-CCIWWBDH-BAyrRBtM.js → ebnfDiagram-CCIWWBDH--i52vMiv.js} +1 -1
  84. package/dist/web-client/assets/{erDiagram-Q63AITRT-Qm24Wepm.js → erDiagram-Q63AITRT-q2hgOBY1.js} +1 -1
  85. package/dist/web-client/assets/eventmodeling-45OFAUF4-ESVuFkJJ.js +1 -0
  86. package/dist/web-client/assets/flowDiagram-23GEKE2U-DN9SdR9f.js +1 -0
  87. package/dist/web-client/assets/{ganttDiagram-NO4QXBWP-D8h7l3XJ.js → ganttDiagram-NO4QXBWP-BZ2rBbTe.js} +1 -1
  88. package/dist/web-client/assets/{gitGraph-TEB2WS4Q-DIBml1SB.js → gitGraph-TEB2WS4Q-OnJ8tHgt.js} +1 -1
  89. package/dist/web-client/assets/{gitGraphDiagram-IHSO6WYX-CtkYoXjn.js → gitGraphDiagram-IHSO6WYX-CPNExFAr.js} +1 -1
  90. package/dist/web-client/assets/{index-DOSH4Q9H.js → index-DCBn-YrR.js} +38 -38
  91. package/dist/web-client/assets/{info-DKCQHKI2-DLEUtV5Q.js → info-DKCQHKI2-DGuJbmdY.js} +1 -1
  92. package/dist/web-client/assets/{infoDiagram-FWYZ7A6U-BJQ7aQux.js → infoDiagram-FWYZ7A6U-ADIAn-P5.js} +1 -1
  93. package/dist/web-client/assets/{ishikawaDiagram-FXEZZL3T-BPM11FvG.js → ishikawaDiagram-FXEZZL3T-CUx-RGfg.js} +1 -1
  94. package/dist/web-client/assets/{journeyDiagram-5HDEW3XC-C0aX2z3c.js → journeyDiagram-5HDEW3XC-BH7-tBBy.js} +1 -1
  95. package/dist/web-client/assets/{kanban-definition-HUTT4EX6-C56F29Ib.js → kanban-definition-HUTT4EX6-BGEXBnI2.js} +1 -1
  96. package/dist/web-client/assets/{line-BLFHLF2N.js → line-CC-5ezU8.js} +1 -1
  97. package/dist/web-client/assets/{mermaid-parser.core-BLC8FhgU.js → mermaid-parser.core-Dw18Fjbq.js} +3 -3
  98. package/dist/web-client/assets/{mermaid.core-BBqkKuXt.js → mermaid.core-CMQBgE43.js} +3 -3
  99. package/dist/web-client/assets/{mindmap-definition-LN4V7U3C-aVZbsoPc.js → mindmap-definition-LN4V7U3C-CGtjw8tB.js} +1 -1
  100. package/dist/web-client/assets/{packet-7NZHBO7P-D4aqSQfB.js → packet-7NZHBO7P-w71Y4Hzd.js} +1 -1
  101. package/dist/web-client/assets/{pegDiagram-2B236MQR-DjfyNI0U.js → pegDiagram-2B236MQR-DWtfEm4T.js} +1 -1
  102. package/dist/web-client/assets/{pie-RZYD4A2V-ChCwYsYj.js → pie-RZYD4A2V-S9ztgnWs.js} +1 -1
  103. package/dist/web-client/assets/{pieDiagram-ENE6RG2P-BeHLKkXC.js → pieDiagram-ENE6RG2P-BWZQPN4m.js} +1 -1
  104. package/dist/web-client/assets/{quadrantDiagram-ABIIQ3AL-stga3gvq.js → quadrantDiagram-ABIIQ3AL-DINDwblH.js} +1 -1
  105. package/dist/web-client/assets/{radar-I7S5WNFK-DOGheiwT.js → radar-I7S5WNFK-BOGl9krB.js} +1 -1
  106. package/dist/web-client/assets/{railroad-3IZDKUUU-_JnU7M6L.js → railroad-3IZDKUUU-CR9kuYSZ.js} +1 -1
  107. package/dist/web-client/assets/railroad-abnf-AHOZXSZD-BvbCHrlR.js +1 -0
  108. package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-D869lbCL.js +1 -0
  109. package/dist/web-client/assets/railroad-peg-LSFZ7HO6-r4TXaJPI.js +1 -0
  110. package/dist/web-client/assets/{railroadDiagram-RFXS5EU6-C0CkMsOd.js → railroadDiagram-RFXS5EU6-byLCs9hp.js} +1 -1
  111. package/dist/web-client/assets/{requirementDiagram-TGXJPOKE-DuImwoRD.js → requirementDiagram-TGXJPOKE-Dn_FtbqW.js} +1 -1
  112. package/dist/web-client/assets/{sankeyDiagram-HTMAVEWB-kprq0XF9.js → sankeyDiagram-HTMAVEWB-DUjRrCeC.js} +1 -1
  113. package/dist/web-client/assets/{sequenceDiagram-DBY2YBRQ-DiXKJMF6.js → sequenceDiagram-DBY2YBRQ-BmBz8Wpq.js} +1 -1
  114. package/dist/web-client/assets/{stateDiagram-2N3HPSRC-D5qbVStE.js → stateDiagram-2N3HPSRC-BAYHjmqB.js} +1 -1
  115. package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-Bl-1K1zV.js +1 -0
  116. package/dist/web-client/assets/{swimlanes-5IMT3BWC-DCbw389c.js → swimlanes-5IMT3BWC-Bm942AR-.js} +1 -1
  117. package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DHU7bsfA.js +8 -0
  118. package/dist/web-client/assets/{timeline-definition-FHXFAJF6-CQeaYN_9.js → timeline-definition-FHXFAJF6-CHAZHhQk.js} +1 -1
  119. package/dist/web-client/assets/{treeView-QDETBFTQ-Cf7Sq3qo.js → treeView-QDETBFTQ-DHHkLsSy.js} +1 -1
  120. package/dist/web-client/assets/{treemap-6X3UGDF4-BovzvoTU.js → treemap-6X3UGDF4-BUxZ8fhY.js} +1 -1
  121. package/dist/web-client/assets/{vennDiagram-L72KCM5P-CZsJy139.js → vennDiagram-L72KCM5P-BL9TRcUU.js} +1 -1
  122. package/dist/web-client/assets/{wardley-OPB4EBWU-DJ7MS6XZ.js → wardley-OPB4EBWU-CfJ5mO-y.js} +1 -1
  123. package/dist/web-client/assets/{wardleyDiagram-EHGQE667-rqhcmsbM.js → wardleyDiagram-EHGQE667-BlH1TSjy.js} +1 -1
  124. package/dist/web-client/assets/{xychartDiagram-FW5EYKEG-HuK4Seps.js → xychartDiagram-FW5EYKEG-BJN6wtrV.js} +1 -1
  125. package/dist/web-client/index.html +1 -1
  126. package/dist/web-server/app.d.ts.map +1 -1
  127. package/dist/web-server/app.js +1 -7
  128. package/dist/web-server/app.js.map +1 -1
  129. package/dist/web-server/claude-runner.d.ts +11 -4
  130. package/dist/web-server/claude-runner.d.ts.map +1 -1
  131. package/dist/web-server/claude-runner.js +10 -14
  132. package/dist/web-server/claude-runner.js.map +1 -1
  133. package/dist/web-server/index.d.ts.map +1 -1
  134. package/dist/web-server/index.js +4 -1
  135. package/dist/web-server/index.js.map +1 -1
  136. package/dist/web-server/opencode-client.d.ts +123 -0
  137. package/dist/web-server/opencode-client.d.ts.map +1 -0
  138. package/dist/web-server/opencode-client.js +514 -0
  139. package/dist/web-server/opencode-client.js.map +1 -0
  140. package/dist/web-server/prompt-assembly.d.ts.map +1 -1
  141. package/dist/web-server/prompt-assembly.js +1 -2
  142. package/dist/web-server/prompt-assembly.js.map +1 -1
  143. package/dist/web-server/routes/sessions.d.ts +9 -6
  144. package/dist/web-server/routes/sessions.d.ts.map +1 -1
  145. package/dist/web-server/routes/sessions.js +272 -205
  146. package/dist/web-server/routes/sessions.js.map +1 -1
  147. package/dist/web-server/run-driver.d.ts +113 -0
  148. package/dist/web-server/run-driver.d.ts.map +1 -0
  149. package/dist/web-server/run-driver.js +214 -0
  150. package/dist/web-server/run-driver.js.map +1 -0
  151. package/dist/web-server/run-event-log.d.ts +23 -1
  152. package/dist/web-server/run-event-log.d.ts.map +1 -1
  153. package/dist/web-server/run-event-log.js +29 -5
  154. package/dist/web-server/run-event-log.js.map +1 -1
  155. package/dist/web-server/web-auth.d.ts +3 -5
  156. package/dist/web-server/web-auth.d.ts.map +1 -1
  157. package/dist/web-server/web-auth.js +6 -11
  158. package/dist/web-server/web-auth.js.map +1 -1
  159. package/dist/web-server/web-token.d.ts +1 -2
  160. package/dist/web-server/web-token.d.ts.map +1 -1
  161. package/dist/web-server/web-token.js +1 -2
  162. package/dist/web-server/web-token.js.map +1 -1
  163. package/opencode/arcs/bundle-runtime.json +0 -6
  164. package/opencode/arcs/manifest.json +8 -25
  165. package/opencode/arcs/prompts/arcs-docs.txt +19 -157
  166. package/opencode/arcs/prompts/arcs-flash.txt +46 -155
  167. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +48 -164
  168. package/opencode/arcs/prompts/arcs-orchestrate.txt +47 -157
  169. package/opencode/arcs/prompts/code-reviewer.txt +20 -60
  170. package/opencode/arcs/prompts/graph-explorer.txt +19 -49
  171. package/opencode/arcs/prompts/software-engineer.txt +21 -67
  172. package/opencode/arcs/prompts/tech-architect.txt +20 -130
  173. package/opencode/arcs/skills/brainstorming/SKILL.md +20 -100
  174. package/opencode/arcs/skills/brainstorming/visual-companion.md +6 -264
  175. package/opencode/arcs/skills/caveman-commit/SKILL.md +6 -43
  176. package/opencode/arcs/skills/deep-pr-review/SKILL.md +18 -200
  177. package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +7 -93
  178. package/opencode/arcs/skills/deep-pr-review/review-template.md +13 -60
  179. package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +16 -156
  180. package/opencode/arcs/skills/implementation/SKILL.md +20 -46
  181. package/opencode/arcs/skills/init-project/SKILL.md +12 -150
  182. package/opencode/arcs/skills/systematic-debugging/SKILL.md +13 -152
  183. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +7 -110
  184. package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +7 -119
  185. package/opencode/arcs/skills/systematic-debugging/phases-reference.md +9 -166
  186. package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +8 -165
  187. package/opencode/arcs/skills/test-driven-development/SKILL.md +10 -61
  188. package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +7 -154
  189. package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +8 -295
  190. package/opencode/arcs/skills/to-diagram/SKILL.md +18 -206
  191. package/opencode/arcs/skills/writing-knowledge/SKILL.md +11 -63
  192. package/opencode/arcs/skills/writing-plans/SKILL.md +25 -118
  193. package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +10 -61
  194. package/package.json +1 -1
  195. package/skills/explore-dag.md +9 -52
  196. package/skills/init-project.md +9 -98
  197. package/skills/orchestrate.md +15 -109
  198. package/skills/update-docs.md +9 -60
  199. package/dist/web-client/assets/architecture-TIHT7OUA-Bdo2Yvm9.js +0 -1
  200. package/dist/web-client/assets/channel-DBNmizpo.js +0 -1
  201. package/dist/web-client/assets/classDiagram-OUVF2IWQ-CB3HiA1_.js +0 -1
  202. package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-CB3HiA1_.js +0 -1
  203. package/dist/web-client/assets/eventmodeling-45OFAUF4-DoTBIvl5.js +0 -1
  204. package/dist/web-client/assets/flowDiagram-23GEKE2U-BEH23L1A.js +0 -1
  205. package/dist/web-client/assets/railroad-abnf-AHOZXSZD-nhNub7LE.js +0 -1
  206. package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-BlQYe7Yf.js +0 -1
  207. package/dist/web-client/assets/railroad-peg-LSFZ7HO6-B3E8pRVN.js +0 -1
  208. package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-DWwTAG1r.js +0 -1
  209. package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DabrCsjZ.js +0 -8
  210. package/opencode/arcs/prompts/devil-advocate.txt +0 -79
  211. package/opencode/arcs/skills/executing-plans/SKILL.md +0 -49
  212. package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +0 -143
  213. package/scripts/claude-code-session-hook.mjs +0 -146
@@ -1,143 +0,0 @@
1
- ---
2
- name: install-claude-code-hook
3
- description: Use when retrofitting the Claude Code session-bridge hook onto an already-inited ARCS project — triggers "install the claude code hook", "enable session bridge", "set up hook for this project", "hook up claude code to arcs", "the arcs web UI can't see my session". Claude Code only; detects existing state, then installs after explicit confirmation.
4
- ---
5
-
6
- # Skill: install-claude-code-hook
7
-
8
- ## When
9
-
10
- The project is already in the DAG but its workspace never got the session-bridge hook — usually because `arcs project init` predated the offer, or the offer was declined. Triggers: "install the claude code hook", "enable session bridge", "set up hook for this project", "hook up claude code to arcs", "the arcs web UI can't see my session".
11
-
12
- > **Claude-Code-only skill.** Step 0 is self-knowledge, not detection: if you are not running as Claude Code, say so and stop. The hook registers into Claude Code's own settings file; installing it from another harness configures a client that will never run it. There is no environment-variable heuristic here by design — you know your own harness.
13
-
14
- > **Executes, unlike the proposal skills.** After explicit user confirmation this skill runs `arcs hooks install-claude-code <slug> --write` itself. That is not a `writing-knowledge`-style "propose, don't execute" case: the write is local machine config (`.claude/settings.local.json`), not a durable ARCS DAG mutation. It mirrors `promptAndInstallClaudeCodeHook`, which already executes directly inside `arcs project init` behind the same confirm.
15
-
16
- ## Flow
17
-
18
- ```mermaid
19
- flowchart TD
20
- classDef decision fill:#f59e0b,color:#fff
21
- classDef terminal fill:#22c55e,color:#fff
22
-
23
- A{Running as Claude Code?}:::decision -->|no| Stop[State Claude-Code-only, stop]:::terminal
24
- A -->|yes| B[arcs hooks status slug --json]
25
- B --> C{installed?}:::decision
26
- C -->|false| D[Explain the bridge, ask to install]
27
- C -->|true| E{matchesCurrentSlug?}:::decision
28
- E -->|true| F[Report found, no-op]:::terminal
29
- E -->|false| G[Warn: installing repoints matchedSlugs, re-confirm]
30
- D -->|declines| H[Print manual fallback, no mutation]:::terminal
31
- G -->|declines| H
32
- D -->|explicit yes| I[arcs hooks install-claude-code slug --write]
33
- G -->|explicit yes| I
34
- I --> J{ok?}:::decision
35
- J -->|true| K[Report settingsPath + events + new-session note]:::terminal
36
- J -->|false| L[Surface the CLI error verbatim, no repair]:::terminal
37
- ```
38
-
39
- ## CLI Primer
40
-
41
- ```bash
42
- arcs hooks status <slug> --json
43
- arcs hooks install-claude-code <slug> --write --json
44
- ```
45
- Discovery: `arcs --commands --json`. Mutating commands run directly — no token.
46
-
47
- `hooks status` is read-only and rotates nothing, so it is safe to call as many times as you like. Its envelope:
48
-
49
- | Field | Meaning |
50
- |---|---|
51
- | `installed` | `true` only when ALL THREE events (`SessionStart`, `UserPromptSubmit`, `SessionEnd`) are registered. A partial registration is a broken bridge and reports `false`. |
52
- | `matchesCurrentSlug` | The registered hook carries `ARCS_HOOK_SLUG=<slug>` for the project you asked about. |
53
- | `matchedSlugs` | Every slug found on a matching hook command — how you see a hook wired to a *different* project. |
54
- | `hookScriptPath` | Absolute path of the script the hook entry runs; the key both status and install match on. |
55
-
56
- `hooks install-claude-code <slug> --write` performs the write via the same consent-gated merge `arcs project init` uses, and returns `settingsPath` and `events` alongside the pre-existing `token` / `hookScriptPath` / `serverUrl` / `settingsSnippet` fields. Omitting `--write` keeps the old snippet-only behavior — no file is touched — which is the manual fallback.
57
-
58
- ## Constraints
59
-
60
- - Step 0 first: not Claude Code → state that this skill is Claude-Code-only and stop. No install, no status call.
61
- - Never write without EXPLICIT user confirmation. Default posture is do nothing; silence, ambiguity, or "sure, whatever you think" is not consent.
62
- - `matchesCurrentSlug: false` with a non-empty `matchedSlugs` demands a SECOND, explicit re-confirmation — the merge is keyed on `hookScriptPath`, so one workspace holds one hook and installing silently repoints it away from the other slug.
63
- - Never edit `.claude/settings.local.json`, `.claude/settings.json`, or `~/.claude/settings.json` yourself. `--write` is the only sanctioned mutation path.
64
- - Install failure (malformed existing settings file) → surface the CLI's own error message verbatim. Do NOT repair, reformat, or delete the settings file from this skill; the CLI aborted precisely so a hand-edited file is not clobbered.
65
- - Do not rerun `--write` "to be safe" — every run rotates the token and invalidates the previously installed entry.
66
- - Pass `--url` only when the user runs `arcs web` on a non-default port; the hook posts to `http://127.0.0.1:4173` otherwise.
67
-
68
- ## Opt-In Copy (what the user must be told before confirming)
69
-
70
- State all four, plainly, before asking:
71
-
72
- 1. **What it buys them** — the ARCS web UI can see this Claude Code session, and messages queued from the UI are delivered to the next prompt.
73
- 2. **What is written** — `<workspacePath>/.claude/settings.local.json` and nothing else. Never the global config, never a committed file; `settings.local.json` is the git-ignored variant and the token in it is a secret.
74
- 3. **What is registered** — one script under three events: `SessionStart`, `UserPromptSubmit`, `SessionEnd`.
75
- 4. **When it takes effect** — a NEW Claude Code session. The session asking for the install will not pick it up.
76
-
77
- ## Worked Example
78
-
79
- ```bash
80
- # 0. Self-check: you are Claude Code. If not → "This skill is Claude-Code-only." Stop here.
81
-
82
- # 1. Read-only detection (rotates nothing; safe to repeat)
83
- arcs hooks status arcs --json
84
- # → {"installed":false,"matchesCurrentSlug":false,"matchedSlugs":[],
85
- # "hookScriptPath":"/…/scripts/claude-code-session-hook.mjs"}
86
-
87
- # 2. Not installed → present the opt-in copy above, then ask:
88
- # "Install the Claude Code session-bridge hook for `arcs` now?"
89
- # Wait for an explicit yes. Anything else → step 4.
90
-
91
- # 3. Explicit yes → install and report
92
- arcs hooks install-claude-code arcs --write --json
93
- # → {"settingsPath":"/home/u/Work/arcs/.claude/settings.local.json",
94
- # "events":["SessionStart","UserPromptSubmit","SessionEnd"], …}
95
- # Report: settingsPath, the three events, and "start a NEW Claude Code session to pick it up".
96
-
97
- # 4. Declined → no mutation. Print the manual fallback (snippet only, writes nothing):
98
- arcs hooks install-claude-code arcs --json
99
- # Paste `settingsSnippet` into .claude/settings.local.json by hand.
100
- ```
101
-
102
- Already-installed branch:
103
-
104
- ```bash
105
- arcs hooks status arcs --json
106
- # → {"installed":true,"matchesCurrentSlug":true,"matchedSlugs":["arcs"], …}
107
- # Report "session-bridge hook already installed for `arcs`". No-op. Done.
108
- ```
109
-
110
- Different-slug branch:
111
-
112
- ```bash
113
- arcs hooks status arcs --json
114
- # → {"installed":true,"matchesCurrentSlug":false,"matchedSlugs":["legacy-app"], …}
115
- # Warn: "This workspace's hook is registered for `legacy-app`. One workspace holds
116
- # one hook by design — installing for `arcs` will silently repoint it and
117
- # `legacy-app` will stop reporting sessions."
118
- # Require a SECOND explicit confirmation, then:
119
- arcs hooks install-claude-code arcs --write --json
120
- ```
121
-
122
- Failure branch:
123
-
124
- ```bash
125
- arcs hooks install-claude-code arcs --write --json
126
- # → {"ok":false,"code":"hook_install_error","message":"/…/.claude/settings.local.json exists
127
- # but is not valid JSON — fix it manually or delete it, then re-run
128
- # `arcs hooks install-claude-code arcs`. Nothing was written."}
129
- # Relay that message verbatim. Do not touch the file.
130
- ```
131
-
132
- ## Exit Conditions
133
-
134
- | Condition | Action |
135
- |-----------|--------|
136
- | Not running as Claude Code | Stop. State the skill is Claude-Code-only; run nothing |
137
- | `installed: true` and `matchesCurrentSlug: true` | Stop. Report already installed; no-op |
138
- | `installed: true` and `matchesCurrentSlug: false` | Warn that installing repoints the hook away from `matchedSlugs`; require a second explicit confirmation before `--write` |
139
- | `installed: false` | Present the opt-in copy; install only on explicit confirmation |
140
- | User declines at any confirmation | Stop. No mutation. Print the manual fallback: `arcs hooks install-claude-code <slug> --json` (snippet only, no `--write`) |
141
- | `--write` succeeds | Report `settingsPath` and `events`; tell the user a NEW Claude Code session is required |
142
- | `--write` fails (e.g. malformed settings file) | Surface the CLI's error message verbatim. Attempt no repair; nothing was written |
143
- | Project has no workspace path (`no_workspace_paths`) | Stop. Relay the error and offer the snippet-only fallback |
@@ -1,146 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * ARCS ↔ Claude Code session-bridge hook.
4
- *
5
- * Registered four times in settings.json (SessionStart, UserPromptSubmit,
6
- * SessionEnd, Stop) and dispatches internally on the `hook_event_name` field
7
- * Claude Code writes to stdin. Install with `arcs hooks install-claude-code
8
- * <slug>`, which generates the token and prints the snippet to paste.
9
- *
10
- * One of the four can put text in front of the model: SessionStart mirrors
11
- * ARCS's staged environment (project, workspace, DAG position) into the new
12
- * session, emitting Claude Code's `hookSpecificOutput` envelope on stdout; the
13
- * other three print nothing.
14
- *
15
- * HARD RULE: this script never blocks the session. Any failure — ARCS not
16
- * running, token rejected, timeout, malformed JSON — is swallowed, nothing is
17
- * printed, and the exit code stays 0. Exit code 2 (the "block" signal) is never
18
- * produced. A broken bridge must be invisible, never an obstacle to the user's
19
- * actual Claude Code session.
20
- *
21
- * Config comes from the environment, assigned inline in the settings.json
22
- * command string:
23
- * ARCS_HOOK_TOKEN per-project token (required)
24
- * ARCS_HOOK_SLUG ARCS project slug (required)
25
- * ARCS_HOOK_URL ARCS web server URL (default http://127.0.0.1:4173)
26
- */
27
-
28
- // DEFAULT_URL and EVENTS are literals on purpose: this file runs standalone out
29
- // of the user's settings.json and importing ARCS would give the HARD RULE above
30
- // a way to fail. `src/utils/hook-contract.ts` owns the same two values for the
31
- // TypeScript side, and `test/hook-contract-parity.test.ts` parses THIS source
32
- // and fails if the two ever diverge — so keep the shapes greppable: a
33
- // double-quoted DEFAULT_URL, and a flat `new Set([...])` of string literals.
34
- const DEFAULT_URL = "http://127.0.0.1:4173";
35
- /** Short by design: a hung ARCS server must not stall prompt submission. */
36
- const TIMEOUT_MS = 1500;
37
- const EVENTS = new Set(["SessionStart", "UserPromptSubmit", "SessionEnd", "Stop"]);
38
- /**
39
- * Refusal bound on a context block the server sends, in characters.
40
- *
41
- * The server caps the SessionStart block at 2500 (`SESSION_START_STAGE_CAP` in
42
- * `src/web-server/routes/hook-events.ts`); this is the CLIENT's own limit, so a
43
- * misbehaving, mismatched or hostile ARCS cannot shove an unbounded body into
44
- * the head of the user's live session. Over the bound the block is dropped
45
- * whole rather than clipped — a clip would sever a wrapper's closing delimiter.
46
- * `test/claude-code-hook-script.test.ts` parses this literal and fails if the
47
- * server's cap ever climbs above it, so the two cannot silently cross.
48
- */
49
- const MAX_CONTEXT_CHARS = 4000;
50
-
51
- /** Never rejects: an unreadable stdin yields "" and the run turns into a no-op. */
52
- function readStdin() {
53
- return new Promise((resolveStdin) => {
54
- let raw = "";
55
- let settled = false;
56
- const finish = () => {
57
- if (settled) return;
58
- settled = true;
59
- clearTimeout(timer);
60
- process.stdin.destroy();
61
- resolveStdin(raw);
62
- };
63
- const timer = setTimeout(finish, TIMEOUT_MS);
64
-
65
- process.stdin.setEncoding("utf-8");
66
- process.stdin.on("data", (chunk) => {
67
- raw += chunk;
68
- });
69
- process.stdin.on("end", finish);
70
- process.stdin.on("error", finish);
71
- });
72
- }
73
-
74
- async function main() {
75
- const raw = await readStdin();
76
- if (!raw.trim()) return;
77
-
78
- const event = JSON.parse(raw);
79
- const eventName = event?.hook_event_name;
80
- const sessionId = event?.session_id;
81
- if (!EVENTS.has(eventName) || typeof sessionId !== "string" || !sessionId) return;
82
-
83
- const token = process.env.ARCS_HOOK_TOKEN;
84
- const slug = process.env.ARCS_HOOK_SLUG;
85
- if (!token || !slug) return;
86
- const baseUrl = (process.env.ARCS_HOOK_URL || DEFAULT_URL).replace(/\/+$/, "");
87
-
88
- const response = await fetch(`${baseUrl}/api/hook/${encodeURIComponent(slug)}/event`, {
89
- method: "POST",
90
- headers: {
91
- "content-type": "application/json",
92
- authorization: `Bearer ${token}`,
93
- },
94
- body: JSON.stringify({
95
- hook_event_name: eventName,
96
- session_id: sessionId,
97
- ...(typeof event.cwd === "string" && { cwd: event.cwd }),
98
- ...(typeof event.source === "string" && { source: event.source }),
99
- ...(typeof event.reason === "string" && { reason: event.reason }),
100
- ...(typeof event.transcript_path === "string" && { transcript_path: event.transcript_path }),
101
- }),
102
- signal: AbortSignal.timeout(TIMEOUT_MS),
103
- });
104
- if (!response.ok) return;
105
-
106
- // Only SessionStart can inject context: it mirrors ARCS's staged environment
107
- // into the fresh session. UserPromptSubmit, SessionEnd and Stop are pure
108
- // notifications and answer with empty stdout, so only SessionStart reads the
109
- // response body at all.
110
- if (eventName !== "SessionStart") return;
111
-
112
- const envelope = await response.json();
113
-
114
- const staged = envelope?.data?.stagedContext;
115
- // Every rejection here is a silent no-op, never a repair: an absent field,
116
- // a non-string, an empty string and an oversized body all mean "ARCS has
117
- // nothing usable to stage", and the session proceeds exactly as if the
118
- // bridge were not installed.
119
- if (typeof staged !== "string" || staged === "" || staged.length > MAX_CONTEXT_CHARS) return;
120
-
121
- process.stdout.write(
122
- JSON.stringify({
123
- hookSpecificOutput: {
124
- hookEventName: "SessionStart",
125
- additionalContext: staged,
126
- },
127
- }),
128
- );
129
- }
130
-
131
- // Belt and braces around the hard rule: even a bug in this file (or a stray
132
- // async rejection) must not surface as a non-zero exit for the user.
133
- process.on("uncaughtException", () => {
134
- process.exitCode = 0;
135
- });
136
- process.on("unhandledRejection", () => {
137
- process.exitCode = 0;
138
- });
139
-
140
- // No process.exit(): letting the event loop drain guarantees stdout is flushed
141
- // before the process ends, and the default exit code is already 0.
142
- main()
143
- .catch(() => {})
144
- .finally(() => {
145
- process.exitCode = 0;
146
- });