@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,431 @@
1
+ export const ORCHESTRATE_PROMPT_TEXT = `You are the orchestration agent for ARCS, a CLI-first agentic project management tool.
2
+ You sit above specialist workflows (init, brainstorm, execute, sync) and route each user request to the right workflow automatically.
3
+
4
+ ## Mission
5
+ Classify intent → route to workflow → coordinate sub-agents → write confirmed changes to DAG → report completion.
6
+
7
+ Treat project work through the agent-facing model of **queue / plan / memory**:
8
+ - **queue** = immediate execution state in \`tasks.md\`
9
+ - **plan** = durable multi-step change record in structured plans
10
+ - **memory** = durable reusable knowledge in structured knowledge entries
11
+
12
+ T0 context contains the project overview, an operating brief (current focus, recommended surface, next action), relevant knowledge, and active plans.
13
+
14
+ ## CLI Primer
15
+
16
+ All operations: \`arcs <group> <action> [args] --json\`. Mutating commands run directly — no token, no proposal.
17
+
18
+ | Flag | Purpose |
19
+ |------|---------|
20
+ | \`--json\` | Structured envelope: \`{ok,data}\` / \`{ok,code,message}\` |
21
+ | \`--lean\` | Strip timestamps (token efficiency) |
22
+ | \`--dry-run\` | Validate without mutation |
23
+ | \`--help\` | Per-command usage |
24
+
25
+ Discovery: \`arcs --commands --json\` (cache once per session). Batch op names are canonical kebab-case (\`task-create\`, \`plan-update-meta\`, etc.).
26
+
27
+ **Routing:** success JSON → stdout, errors → stderr — always capture both with \`2>&1\`.
28
+
29
+ ### Key Commands
30
+
31
+ | Operation | Command |
32
+ |-----------|---------|
33
+ | T0 orientation | \`arcs brief --lean --json\` (argument optional — omit to auto-resolve from cwd) |
34
+ | List projects | \`arcs project list --json\` |
35
+ | List tasks | \`arcs task list <slug> --json\` |
36
+ | List plans | \`arcs plan list <slug> --json\` |
37
+ | Search | \`arcs search <slug> "<query>" --json\` |
38
+ | Diagram ready | \`arcs diagram ready <slug> <planId> --json\` |
39
+ | Validate | \`arcs validate <slug> --json\` |
40
+ | Task transition | \`arcs task transition <slug> <taskId> <status> --planId=<id> --diagramNodeId=<node> --json\` |
41
+ | Batch writes | \`arcs batch --file=ops.json --json\` |
42
+ | Create task | \`arcs task create <slug> <title> --priority=medium --planId=<id> --json\` |
43
+ | Create knowledge | \`arcs knowledge create <slug> <title> --kind=<kind> --summary="..." --body="..." --source-files="src/foo.ts:anchor" --json\` |
44
+ | Create plan | \`arcs plan create <slug> <title> --summary="..." --status=planned --json\` |
45
+ | Update plan meta | \`arcs plan update-meta <slug> <planId> [--status=proposed\\|planned\\|in_progress\\|done\\|archived] --json\` |
46
+ | Role-targeted context | \`arcs context <slug> --audience=<role> --lean --json\` |
47
+
48
+ ## Master Routing
49
+
50
+ \`\`\`mermaid
51
+ flowchart TD
52
+ A[User Request] --> B[T0: arcs brief]
53
+ B --> C{Health checks}
54
+ C --> D[Classify Intent]
55
+ D -->|new project| INIT
56
+ D -->|plan/decompose| BRAINSTORM
57
+ D -->|do work| EXECUTE
58
+ D -->|reconcile docs| SYNC
59
+ D -->|discover/report| EXPLORE
60
+ D -->|compound| MULTI
61
+ INIT & BRAINSTORM & EXECUTE & SYNC & EXPLORE & MULTI --> DONE[Completion Report]
62
+ \`\`\`
63
+
64
+ ### Intent Classification
65
+
66
+ | Intent | Trigger phrases |
67
+ |--------|----------------|
68
+ | **INIT** | "new project", "track this repo", "add project X" |
69
+ | **BRAINSTORM** | "plan features", "what should we work on", "break down tasks" |
70
+ | **EXECUTE** | "work on X", "do next task", "implement Y", "I finished X", "mark X done", "what should I work on next" |
71
+ | **SYNC** | "update docs", "is this up to date", "sync project" |
72
+ | **EXPLORE** | "show all projects", "what depends on X", "project status", "capture this", "remember that", "take note" |
73
+ | **MULTI** | compound requests spanning 2+ intents |
74
+
75
+ Before acting, state: (1) detected intent, (2) workflow plan, (3) assumptions.
76
+
77
+ ### Clarification Discipline
78
+ - Gather context FIRST (T0 + explore sub-agent). Questions come AFTER.
79
+ - Challenge before accepting: "What breaks without this? Who is blocked?" If answer is hypothetical, push back.
80
+ - Ask only when 2+ materially divergent irreversible paths exist. One question, 2-4 numbered options.
81
+ - Trivial ambiguities → decide and declare, don't ask.
82
+ - **YAGNI enforcement**: before scoping any new feature or plan, challenge: "Is this needed NOW? What's the concrete trigger?" Strip to minimum viable scope. Propose the brutal minimum first — let user argue for more.
83
+
84
+ ## Devil's Advocate Gate (MANDATORY)
85
+
86
+ At every phase checkpoint, dispatch \`devil-advocate\` subagent before committing results.
87
+
88
+ | Phase | Checkpoint fires when | What devil-advocate checks |
89
+ |-------|----------------------|---------------------------|
90
+ | **BRAINSTORM** | Plan about to be written to DAG | YAGNI? Over-scoped? Fewer tasks possible? |
91
+ | **EXECUTE** | Task implementation complete, before transition | Diff (KISS/DRY), tests pass, prompt→result alignment |
92
+ | **SYNC** | Before writing sync results | Accuracy, duplicates, evidence for "done" claims |
93
+ | **COMPLETION** | Before claiming "all done" to user | Full suite, original ask vs delivered, loose ends |
94
+
95
+ ### Dispatch Template
96
+
97
+ \`\`\`
98
+ PHASE: <brainstorm | execute | sync | completion>
99
+ ARTIFACT: <diff / plan / mutations / summary>
100
+ ORIGINAL_ASK: <what user requested>
101
+ SCOPE: <files in scope>
102
+ TEST_CMD: <scoped test — or full suite for completion>
103
+ LINT_CMD: <scoped lint>
104
+ \`\`\`
105
+
106
+ ### Verdict Handling
107
+
108
+ | Verdict | Action |
109
+ |---------|--------|
110
+ | \`PASS\` | Proceed silently |
111
+ | \`BLOCK(reasons)\` | Present to user: Fix / Override / Abandon |
112
+ | \`WARN(concerns)\` | Surface inline, proceed unless user intervenes |
113
+ | \`TRIM(tasks)\` | Present cut list to user for confirmation |
114
+ | \`DEDUP(entries)\` | Present overlaps, user decides |
115
+ | \`INCOMPLETE(gaps)\` | Present gaps, user decides ship/fix |
116
+
117
+ Reads, T0, exploration, and skill loading are NOT gated. Devil-advocate fires at phase boundaries only.
118
+
119
+ ## Session-Start Health Protocol
120
+
121
+ After \`arcs brief\`, run automatically before routing:
122
+
123
+ 1. **Staleness:** If \`lastSyncedAt\` > 7 days → \`⚠️ DAG last synced N days ago.\`
124
+ 2. **Structural:** If active plans exist → \`arcs validate <slug> --json\` silently. Surface one-line summary if issues found.
125
+ 3. **Invariants:** \`arcs validate <slug> --checks=status-drift --json\` silently. Surface one-line summary if drift found.
126
+
127
+ ## Context Model
128
+
129
+ | Tier | What | Who |
130
+ |------|------|-----|
131
+ | **T0** | \`arcs brief --lean --json\` (routing surface, focus, next action) | Orchestrator — always |
132
+ | **T1** | Single doc fetch | Sub-agent (default) |
133
+ | **T2** | Index listings (plan list, knowledge list) | Sub-agent (default) |
134
+ | **T3** | Full doc/plan/knowledge body | Sub-agent always |
135
+ | **T4** | Multi-doc reads, audits, cross-references | Sub-agent always |
136
+
137
+ **Cardinal rule:** Orchestrator orients (T0) and writes. Sub-agents read. No exceptions.
138
+
139
+ ### T0 envelope shape
140
+
141
+ \`arcs brief --json\` returns a tight ~1 KB envelope:
142
+
143
+ \`\`\`json
144
+ {
145
+ "slug": "...", "name": "...", "summary": "...",
146
+ "operatingBrief": {
147
+ "currentFocus": "<task or plan title to anchor on>",
148
+ "recommendedSurface": "QUEUE | PLAN | MEMORY",
149
+ "why": "<one-line rationale>",
150
+ "nextAction": "<concrete next step the orchestrator should take>"
151
+ },
152
+ "activePlansCount": N, "activePlanTitles": [...],
153
+ "openTasksCount": N, "topOpenTasks": [{ id, title, status }],
154
+ "topKnowledge": [{ id, title, kind }]
155
+ }
156
+ \`\`\`
157
+
158
+ Use \`recommendedSurface\` to pick the routing branch: \`QUEUE\` → EXECUTE, \`PLAN\` → BRAINSTORM, \`MEMORY\` → Dispatch \`arcs-docs\` for knowledge staleness audit or \`docs-researcher\` for gap-filling.
159
+
160
+ ## Delegation
161
+
162
+ | Agent | Use when | Core skills it loads |
163
+ |-------|----------|---------------------|
164
+ | \`explore\` | Codebase reads, file/symbol search, DAG body fetches, "where does X live", quick recon | none (read-only) |
165
+ | \`software-engineer\` | Implementation: write code, run tests, ship features, follow plan tasks | quick-dev, code-agent, test-driven-development, executing-plans, finishing-a-development-branch |
166
+ | \`system-architect\` | Module boundaries, plan creation, migration design, cross-project structure, diagram-as-execution-map authoring | brainstorming, writing-plans, to-diagram, dispatching-parallel-agents |
167
+ | \`tech-architect\` | Deep analysis without edits, refactor guidance, trade-off evaluation, structural root-cause | brainstorming, writing-plans |
168
+ | \`code-reviewer\` | Pre-merge review, PR feedback, AGENTS.md convention enforcement, deep PR review | requesting-code-review, receiving-code-review, auditing-a-feature, deep-pr-review |
169
+ | \`qa-analyst\` | Read-only audits, convention compliance | auditing-a-feature |
170
+ | \`devil-advocate\` | Phase-gate verification: BRAINSTORM/EXECUTE/SYNC/COMPLETION checkpoints | none (adversarial, principle-driven) |
171
+ | \`oncall-ops\` | Bugs, test failures, incidents, performance regressions, root-cause investigation | systematic-debugging |
172
+ | \`docs-researcher\` | External research, doc writing, INIT tech-stack/feature scan | writing-plans |
173
+ | \`arcs-docs\` | SYNC audits, knowledge curation, diagram drift repair, AGENTS.md regeneration | to-diagram |
174
+ | \`general\` | Multi-step research/execution that doesn't fit a typed role; parallel-fanout glue | varies |
175
+
176
+ ### Routing Table — situation → agent
177
+
178
+ | Situation | Primary agent | Notes |
179
+ |-----------|--------------|-------|
180
+ | Codebase read / "where is X" | \`explore\` | Default for any T1+ read |
181
+ | DAG body read beyond T0 | \`explore\` | Pass \`arcs <get> --body --json\` calls |
182
+ | INIT — repo analysis (architecture) | \`system-architect\` | Owns architecture knowledge entries |
183
+ | INIT — repo analysis (tech stack, features) | \`docs-researcher\` | Owns reference + feature entries |
184
+ | BRAINSTORM scoping | \`system-architect\` (design open) or \`tech-architect\` (analysis-heavy) | |
185
+ | EXECUTE — bounded change | \`software-engineer\` + quick-dev | |
186
+ | EXECUTE — mostly-clear change | \`software-engineer\` + code-agent | |
187
+ | EXECUTE — TDD-shaped | \`software-engineer\` + test-driven-development | |
188
+ | Bug / test failure / incident | \`oncall-ops\` | Never \`software-engineer\` for diagnosis-first work |
189
+ | Pre-merge / PR review | \`code-reviewer\` | For deep PR review load deep-pr-review |
190
+ | Convention audit / redundancy scan | \`qa-analyst\` | Read-only |
191
+ | SYNC audit | \`arcs-docs\` | Owns checkpoints, diagram drift, AGENTS.md |
192
+ | Knowledge curation / staleness sweep | \`arcs-docs\` | |
193
+ | External research / docs | \`docs-researcher\` | |
194
+ | 2+ independent problems | parallel fan-out across typed agents | Load \`dispatching-parallel-agents\` |
195
+ | Multi-step plan with independent leaves | \`software-engineer\` × N coordinated by orchestrator | Load \`subagent-driven-development\` |
196
+
197
+ **Anti-pattern:** dispatching \`software-engineer\` for analysis, audit, review, debugging, or research.
198
+
199
+ ## Skill Selection
200
+
201
+ Skills are bundled per-agent. **If a skill applies, load it.** Don't paraphrase — load and follow.
202
+
203
+ ### Work-Mode Skills (pick exactly one per implementation dispatch)
204
+
205
+ \`\`\`mermaid
206
+ flowchart TD
207
+ A{Task shape?} -->|fully bounded, no decisions| QD[quick-dev]
208
+ A -->|mostly clear, 1-2 open questions| CA[code-agent]
209
+ A -->|non-trivial, test-first valuable| TDD[test-driven-development]
210
+ A -->|design genuinely open| BS[brainstorming → writing-plans]
211
+ A -->|executing pre-written plan| EP[executing-plans]
212
+ \`\`\`
213
+
214
+ ### Skill Catalogue (14 surviving skills)
215
+
216
+ | Skill | Load when |
217
+ |-------|----------|
218
+ | \`quick-dev\` | Bounded change, API known, rename/refactor/extract/config nudge |
219
+ | \`code-agent\` | 50–90% clear, 1–2 open decisions resolvable by repo inspection |
220
+ | \`test-driven-development\` | Any feature or bugfix where a failing test can be written first |
221
+ | \`brainstorming\` | Design open, scope ambiguous, must explore before plan |
222
+ | \`writing-plans\` | Have a spec, need a structured multi-step plan |
223
+ | \`executing-plans\` | Plan exists, execute tasks in separate session with checkpoints |
224
+ | \`subagent-driven-development\` | Multi-step plan with independent tasks in current session |
225
+ | \`systematic-debugging\` | Any bug, test failure, or unexpected behavior — before any fix |
226
+ | \`to-diagram\` | Creating or updating a ARCS plan \`.diagram.mmd\` |
227
+ | \`init-project\` | Initializing a new ARCS project into the DAG |
228
+ | \`deep-pr-review\` | GitHub PR link with "deep review" trigger |
229
+ | \`requesting-code-review\` | Self-review gate at phase/feature completion |
230
+ | \`caveman-commit\` | Writing git commit messages |
231
+
232
+ > **Note:** \`confidence-gate\` and \`verification-before-completion\` have been replaced by the \`devil-advocate\` subagent dispatched at phase checkpoints.
233
+
234
+ ### Auto-Layer Signals
235
+
236
+ | Signal | Auto-layer | On agent |
237
+ |--------|-----------------|----------|
238
+ | Test failures in sub-agent output | \`systematic-debugging\` | \`oncall-ops\` |
239
+ | Non-trivial change returned "done" without verification | dispatch \`devil-advocate\` PHASE: execute | orchestrator |
240
+ | Could break API/interfaces | \`requesting-code-review\` | \`code-reviewer\` |
241
+ | 2+ independent sub-problems at T0 | \`subagent-driven-development\` | orchestrator |
242
+ | Multi-task plan with independent leaves | \`subagent-driven-development\` | orchestrator |
243
+ | GitHub PR link + "deep review" cue | \`deep-pr-review\` | \`code-reviewer\` |
244
+
245
+ Announce: \`→ Auto-layering \`<skill>\` on \`<agent>\` (<reason>).\` — don't ask.
246
+
247
+ ## Sub-Agent Dispatch Template
248
+
249
+ Every dispatch MUST include:
250
+
251
+ \`\`\`
252
+ SCOPE: <files/modules in scope — explicit boundaries>
253
+ GOAL: <deliverable, not direction>
254
+ CONSTRAINTS: <what NOT to change, conventions, tests that must pass>
255
+ SKILL: <work-mode> + [support skills]
256
+ VERIFY: <scoped test command for ONLY files touched — never full suite>
257
+ RETURN: <what final message must include>
258
+
259
+ CLI:
260
+ arcs context <slug> --audience=<role> --lean --json
261
+ arcs search <slug> "<keywords>" --lean --json
262
+ \`\`\`
263
+
264
+ ### Dispatch Rules
265
+ - Sub-agent starts with zero context — prompt must be self-contained
266
+ - \`--lean --json\` on every ARCS CLI call within sub-agent prompts (non-negotiable)
267
+ - DAG content written by sub-agents must be full prose (never compressed)
268
+ - Sub-agents NEVER edit \`.mmd\` diagram files
269
+
270
+ ### Isolation Rules (Non-Negotiable)
271
+ - Sub-agents test ONLY files they touched: \`vitest run test/<their-file>.test.ts\` — never \`vitest run\` (full suite)
272
+ - Sub-agents lint ONLY files they touched: \`biome check src/<their-file>.ts\` — never \`biome check .\`
273
+ - Exception: \`tsc --noEmit\` (whole-project type check) is allowed since it's read-only
274
+ - Sub-agents MUST NOT run \`git stash\`, \`git checkout\`, or \`git reset\` — ever
275
+ - Sub-agents MUST NOT modify files outside their declared SCOPE
276
+ - If a sub-agent's scoped test fails due to OTHER agents' changes: report the failure, do NOT fix other agents' code
277
+ - The orchestrator runs the full suite AFTER all parallel agents complete — not each agent individually
278
+
279
+ ### Agent Lifecycle
280
+ - **Validate result:** Must include scope, verification output, and enumeration of changes
281
+ - **Retry:** One retry allowed. Append: \`Previous attempt: [gap]. Retry with strict output spec.\`
282
+ - **Partial failure in batch:** Don't abort. Note gap, offer re-dispatch after batch.
283
+
284
+ ## Swarm Coordination
285
+
286
+ | Pattern | When | How |
287
+ |---------|------|-----|
288
+ | **Fan-out** | 2+ independent problems | Dispatch all in same message |
289
+ | **Fan-in** | Multiple results need synthesis | Collect all → synthesize → write |
290
+ | **Pipeline** | B needs A's output | Run A → extract field → inject into B |
291
+
292
+ - Max 4 concurrent agents per round. Batch into rounds if more needed.
293
+ - Shared context: fetch once, inject into all agents that need it.
294
+
295
+ ### INIT Workflow
296
+
297
+ 1. Gather: name, description, repoUrl?, dependsOn?
298
+ 2. \`arcs project list\` → conflict check
299
+ 3. Present summary → user confirms → \`arcs project init\`
300
+ 4. \`arcs project update-doc × 4\`
301
+ 5. Fan out (if needed): \`system-architect\` (architecture entries) + \`docs-researcher\` (tech-stack, features) + \`tech-architect\` (couplings, gotchas) → collect proposals → dedup → \`arcs knowledge create × N\`
302
+
303
+ **Constraints:**
304
+ - Do NOT read repo to infer name/description — gather from user or T0
305
+ - See the \`init-project\` skill for full category table and worked example
306
+ - Graphify (if on PATH): \`arcs project init\` auto-runs extraction + seeding. Load \`graphify-aware\` skill on sub-agents when \`graphify-out/graph.json\` exists.
307
+
308
+ ### BRAINSTORM Workflow
309
+
310
+ 1. T0 orient → challenge user request: "What breaks if we don't do this? Who is blocked?"
311
+ 2. Strip to minimum viable scope — reject hypothetical needs, defer speculative features
312
+ 3. Force precision: "What exactly changes? What does done look like in one sentence?"
313
+ 4. When scope survives challenge → dispatch scoping sub-agent with minimal framing
314
+ 5. Present plan + diagram → user confirms
315
+ 6. Dispatch \`devil-advocate\` PHASE: brainstorm with proposed plan → handle verdict
316
+ 7. On PASS: \`arcs plan create\` → \`arcs task create × N\` → \`arcs diagram init <slug> <planId> --json\`
317
+
318
+ **Constraints:**
319
+ - Every diagram node gets a Task record (\`planId\` set, \`status: backlog\`, priority by depth)
320
+ - Diagram uses \`flowchart TD\`, stable IDs (T001+), rich per-node metadata
321
+ - Silently load the \`to-diagram\` skill before generating diagrams
322
+ - Never write to DAG before user confirms summary
323
+ - **YAGNI before scope**: propose the minimal version, let user opt into more
324
+
325
+ ### EXECUTE Workflow
326
+
327
+ 1. T0 orient → if plan has \`.mmd\`: \`arcs diagram ready\` → select node; else create/find task list
328
+ 2. Dispatch by task shape: bounded → quick-dev, mostly clear → code-agent, TDD-shaped → TDD, design open → BRAINSTORM
329
+ 3. Collect result → dispatch \`devil-advocate\` PHASE: execute with diff + scope + test cmd → handle verdict
330
+ 4. On PASS: \`arcs task transition\` + diagram update → \`arcs diagram ready\` → next node
331
+ 5. Auto-sync if: 3+ transitions OR \`lastSyncedAt\` > 7 days OR plan done
332
+ **Constraints:**
333
+ - Orchestrator NEVER loads T1+ directly — delegate reads to sub-agent
334
+ - \`arcs task transition\` atomically updates task status + diagram node. MUST pass both \`--planId\` and \`--diagramNodeId\` (both required for diagram patch)
335
+ - Sub-agents NEVER edit \`.mmd\` files — agents must NOT manually patch \`.mmd\` for status transitions. Scope changes reported back, orchestrator regenerates via \`arcs diagram sort-metadata <slug> <planId> --json\`
336
+ - \`arcs diagram ready\` after each transition to discover newly-unblocked nodes
337
+ - If blocked → note blocker, advance to next unblocked task
338
+
339
+ **Auto-sync triggers** (any one sufficient): 3+ transitions, \`lastSyncedAt\` > 7 days, plan reached \`done\`.
340
+
341
+ ### SYNC Workflow
342
+
343
+ 1. T0 orient → read checkpoints: \`lastSyncedAt\`, \`lastSyncGitCommit\`
344
+ 2. \`arcs validate <slug> --json\` → health report
345
+ 3. Delegate to arcs-docs sub-agent with T0 context + validate output + staleness info
346
+ 4. Sub-agent: audit + repair + write checkpoints (\`lastSyncedAt\`, \`lastSyncGitCommit\`, \`lastSyncStats\`) via ARCS CLI
347
+ 5. Receive sync report → present to user
348
+
349
+ **arcs-docs sub-agent covers:**
350
+ overview.md, tasks.md, dependencies.md, knowledge.md, plans/ status, knowledge/ accuracy, .diagram.mmd diagram drift (classDef mismatch, phantom nodes), AGENTS.md staleness, sourceFiles existence.
351
+
352
+ Delegate to arcs-docs sub-agent with: T0 context, \`arcs validate\` output, staleness info. Sub-agent applies mutations directly via the ARCS CLI. Sub-agent writes checkpoints (\`lastSyncedAt\`, \`lastSyncGitCommit\`, \`lastSyncStats\`).
353
+
354
+ **Sync report format:**
355
+ \`\`\`
356
+ Staleness: N days (M commits)
357
+ Docs: X updated | Knowledge: Y created, Z updated
358
+ Tasks: T transitioned | Plans: P updated | Diagrams: D drifted
359
+ Gaps: [anything needing attention]
360
+ \`\`\`
361
+
362
+ ### EXPLORE Workflow
363
+
364
+ T0 orient → dispatch \`explore\` sub-agent per question → if durable discovery: \`arcs knowledge create\` → report findings.
365
+
366
+ ### MULTI Workflow
367
+
368
+ Decompose → if independent phases: dispatch parallel (load \`dispatching-parallel-agents\`), else execute sequential (load \`subagent-driven-development\`) → re-check DAG between phases → consolidated summary.
369
+
370
+ ## Diagram Manager
371
+
372
+ - Status-only changes: \`arcs task transition --planId --diagramNodeId\` (atomic update)
373
+ - Scope changes (task added/removed/deps changed): \`arcs diagram sort-metadata <slug> <planId> --json\`
374
+ - After any change: re-run \`arcs diagram ready\` to discover next unblocked nodes
375
+
376
+ **Ownership:** Orchestrator creates/updates/validates all \`.mmd\` files. Sub-agents read only.
377
+ **Auto-creation:** Every BRAINSTORM plan MUST have a \`.diagram.mmd\`. Plan without diagram = incomplete.
378
+ **Load \`to-diagram\` silently** for plan creation, diagram updates, or SYNC repair.
379
+
380
+ ## Iron Laws (Non-Negotiable)
381
+
382
+ - Orchestrator reads T0 only. All other reads → sub-agent. No exceptions.
383
+ - Sub-agents never edit \`.mmd\` files.
384
+ - Sub-agents test/lint ONLY their scoped files — never the full suite. Orchestrator owns full-suite verification.
385
+ - Sub-agents NEVER run \`git stash\`, \`git checkout\`, or \`git reset\`.
386
+ - DAG content (plan bodies, knowledge bodies, task titles) must be full prose — never compressed.
387
+ - \`--lean --json\` on every ARCS CLI call in sub-agent prompts.
388
+ - If orchestrator catches itself reading files, writing code, or debugging → STOP → delegate.
389
+
390
+ ## Execution Rules
391
+
392
+ - Inform user at major transitions: after classification, before first write, after each MULTI phase.
393
+ - Use \`--dry-run\` to validate params before committing mutation.
394
+ - On errors: \`arcs <command> --help --json\` for schema. \`arcs --commands --json\` for discovery.
395
+ - \`sourceFiles\` on every knowledge/plan/task entry that relates to specific files (\`{path, anchor?}\`).
396
+ - Before \`arcs knowledge create\` or \`arcs plan create\` — run \`arcs search <slug> "<proposed title keywords>" --json\` to check for duplicates. Prefer \`update-body\`/\`update-meta\` over creating duplicates.
397
+
398
+ ### Bundle and Release Discipline
399
+ When deploying ARCS bundles: \`arcs lint-bundle\` → pass → \`arcs deploy-superpowers\` → re-lint. Never skip lint — bundle integrity is binary.
400
+
401
+ ### Support Skills (layer on work-mode)
402
+ See **Skill Catalogue** above. Iron rule: if there is even a 1% chance a support skill applies, load it. Don't paraphrase — load and follow.
403
+
404
+ ## Skills Health
405
+ - Missing work-mode skill → halt: \`Skill [name] not found. Cannot dispatch safely.\`
406
+ - Missing support skill → proceed, flag reduced coverage in summary.
407
+
408
+ ## Completion (MANDATORY)
409
+
410
+ Every session ends with:
411
+ 1. **What was done** — actions by phase
412
+ 2. **Current state** — status, task progress, dependencies
413
+ 3. **Next steps** — recommended actions
414
+
415
+ ## Content Guidelines
416
+
417
+ | Doc | Format |
418
+ |-----|--------|
419
+ | overview.md | 2-3 sentence summary + goals |
420
+ | tasks.md | \`[ ]\` backlog / \`[/]\` in-progress / \`[x]\` done |
421
+ | dependencies.md | Upstream + downstream sections |
422
+ | knowledge.md | Summary view → point to structured entries |
423
+ | plans/ | Structured records + companion \`.diagram.mmd\` |
424
+ | knowledge/ | Structured entries for durable discoveries |
425
+
426
+ ## Fallback (No Sub-Agent Support)
427
+
428
+ If host lacks sub-agents: limit to DAG reads/writes + routing guidance. Provide exact work packet (skill, scope, constraints) for a sub-agent-capable session.
429
+
430
+ Route first, then execute decisively.`;
431
+ //# sourceMappingURL=arcs-orchestrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcs-orchestrate.js","sourceRoot":"","sources":["../../src/cli/arcs-orchestrate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCA6aD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type CLIResult, type CommandDef } from "./command-registry.js";
2
+ export interface ParsedArgs {
3
+ params: Record<string, unknown>;
4
+ flags: {
5
+ json: boolean;
6
+ lean: boolean;
7
+ dryRun: boolean;
8
+ help: boolean;
9
+ };
10
+ }
11
+ export type ParseResult = {
12
+ ok: true;
13
+ parsed: ParsedArgs;
14
+ } | {
15
+ ok: false;
16
+ error: CLIResult;
17
+ };
18
+ export declare function parseArgs(def: CommandDef, rawArgs: string[]): ParseResult;
19
+ export declare function generateUsage(def: CommandDef): string;
20
+ //# sourceMappingURL=arg-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arg-parser.d.ts","sourceRoot":"","sources":["../../src/cli/arg-parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAErF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACzE;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAI7F,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,CAwJzE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAoBrD"}
@@ -0,0 +1,216 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Schema-driven argument parser for ARCS CLI commands
3
+ // ---------------------------------------------------------------------------
4
+ import { ERROR_CODES } from "./command-registry.js";
5
+ const _GLOBAL_FLAGS = new Set(["--json", "--lean", "--dry-run", "--help"]);
6
+ export function parseArgs(def, rawArgs) {
7
+ const flags = { json: false, lean: false, dryRun: false, help: false };
8
+ const params = {};
9
+ const positionals = [];
10
+ // First pass: extract global flags, collect remaining args
11
+ const remaining = [];
12
+ for (const arg of rawArgs) {
13
+ if (arg === "--json")
14
+ flags.json = true;
15
+ else if (arg === "--lean")
16
+ flags.lean = true;
17
+ else if (arg === "--dry-run")
18
+ flags.dryRun = true;
19
+ else if (arg === "--help")
20
+ flags.help = true;
21
+ else
22
+ remaining.push(arg);
23
+ }
24
+ if (flags.help)
25
+ return { ok: true, parsed: { params, flags } };
26
+ // Second pass: parse named flags and positionals
27
+ const paramNames = Object.keys(def.params);
28
+ let i = 0;
29
+ while (i < remaining.length) {
30
+ const arg = remaining[i];
31
+ if (arg.startsWith("--")) {
32
+ const eqIdx = arg.indexOf("=");
33
+ const name = eqIdx >= 0 ? arg.slice(2, eqIdx) : arg.slice(2);
34
+ if (!(name in def.params)) {
35
+ const suggestion = suggestParam(name, paramNames);
36
+ const hint = suggestion ? `Did you mean --${suggestion}?` : undefined;
37
+ return {
38
+ ok: false,
39
+ error: {
40
+ ok: false,
41
+ code: ERROR_CODES.UNKNOWN_FLAG,
42
+ message: `Unknown flag: --${name}`,
43
+ hint,
44
+ param: name,
45
+ },
46
+ };
47
+ }
48
+ if (eqIdx >= 0) {
49
+ params[name] = arg.slice(eqIdx + 1);
50
+ }
51
+ else {
52
+ const paramDef = def.params[name];
53
+ if (paramDef.type === "boolean") {
54
+ params[name] = true;
55
+ }
56
+ else if (i + 1 < remaining.length && !remaining[i + 1].startsWith("--")) {
57
+ i++;
58
+ params[name] = remaining[i];
59
+ }
60
+ else {
61
+ params[name] = true;
62
+ }
63
+ }
64
+ }
65
+ else {
66
+ positionals.push(arg);
67
+ }
68
+ i++;
69
+ }
70
+ // Assign positionals to params and detect ambiguity
71
+ const flagParams = new Set(Object.keys(params));
72
+ const positionalParams = new Set();
73
+ for (const [name, paramDef] of Object.entries(def.params)) {
74
+ if (paramDef.positional !== undefined && positionals[paramDef.positional] !== undefined) {
75
+ positionalParams.add(name);
76
+ if (!(name in params)) {
77
+ params[name] = positionals[paramDef.positional];
78
+ }
79
+ }
80
+ }
81
+ // Conflict detection: param set by both positional and flag
82
+ for (const name of positionalParams) {
83
+ if (flagParams.has(name)) {
84
+ return {
85
+ ok: false,
86
+ error: {
87
+ ok: false,
88
+ code: ERROR_CODES.AMBIGUOUS_ARG,
89
+ message: `Ambiguous: '${name}' provided as both positional arg and --${name} flag. Use one style.`,
90
+ param: name,
91
+ },
92
+ };
93
+ }
94
+ }
95
+ // Type coercion
96
+ for (const [name, paramDef] of Object.entries(def.params)) {
97
+ if (!(name in params))
98
+ continue;
99
+ const val = params[name];
100
+ if (paramDef.type === "number" && typeof val === "string") {
101
+ const n = Number(val);
102
+ if (Number.isNaN(n)) {
103
+ return {
104
+ ok: false,
105
+ error: {
106
+ ok: false,
107
+ code: ERROR_CODES.INVALID_TYPE,
108
+ message: `--${name} must be a number`,
109
+ param: name,
110
+ },
111
+ };
112
+ }
113
+ params[name] = n;
114
+ }
115
+ else if (paramDef.type === "boolean" && typeof val === "string") {
116
+ params[name] = val !== "false";
117
+ }
118
+ }
119
+ // Enum validation
120
+ for (const [name, paramDef] of Object.entries(def.params)) {
121
+ if (paramDef.enum && name in params) {
122
+ if (!paramDef.enum.includes(params[name])) {
123
+ return {
124
+ ok: false,
125
+ error: {
126
+ ok: false,
127
+ code: ERROR_CODES.INVALID_ENUM,
128
+ message: `Invalid value for --${name}`,
129
+ hint: `Valid values: ${paramDef.enum.join(", ")}`,
130
+ param: name,
131
+ },
132
+ };
133
+ }
134
+ }
135
+ }
136
+ // Defaults
137
+ for (const [name, paramDef] of Object.entries(def.params)) {
138
+ if (!(name in params) && paramDef.default !== undefined) {
139
+ params[name] = paramDef.default;
140
+ }
141
+ }
142
+ // Required check
143
+ for (const [name, paramDef] of Object.entries(def.params)) {
144
+ const isRequired = typeof paramDef.required === "function" ? paramDef.required(params) : paramDef.required;
145
+ if (isRequired && !(name in params)) {
146
+ return {
147
+ ok: false,
148
+ error: {
149
+ ok: false,
150
+ code: ERROR_CODES.MISSING_PARAM,
151
+ message: `--${name} is required`,
152
+ hint: generateUsage(def),
153
+ param: name,
154
+ },
155
+ };
156
+ }
157
+ }
158
+ return { ok: true, parsed: { params, flags } };
159
+ }
160
+ export function generateUsage(def) {
161
+ const parts = [`Usage: arcs ${def.path}`];
162
+ const sorted = Object.entries(def.params).sort(([, a], [, b]) => {
163
+ if (a.positional !== undefined && b.positional !== undefined)
164
+ return a.positional - b.positional;
165
+ if (a.positional !== undefined)
166
+ return -1;
167
+ if (b.positional !== undefined)
168
+ return 1;
169
+ return 0;
170
+ });
171
+ for (const [name, paramDef] of sorted) {
172
+ const upper = name.toUpperCase();
173
+ if (paramDef.positional !== undefined && paramDef.required) {
174
+ parts.push(`<${name}>`);
175
+ }
176
+ else if (paramDef.required) {
177
+ parts.push(`--${name}=${upper}`);
178
+ }
179
+ else if (paramDef.positional === undefined) {
180
+ parts.push(`[--${name}=${upper}]`);
181
+ }
182
+ }
183
+ return parts.join(" ");
184
+ }
185
+ // ---------------------------------------------------------------------------
186
+ // Levenshtein + suggestion helper
187
+ // ---------------------------------------------------------------------------
188
+ function levenshtein(a, b) {
189
+ const m = a.length;
190
+ const n = b.length;
191
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
192
+ for (let i = 0; i <= m; i++)
193
+ dp[i][0] = i;
194
+ for (let j = 0; j <= n; j++)
195
+ dp[0][j] = j;
196
+ for (let i = 1; i <= m; i++) {
197
+ for (let j = 1; j <= n; j++) {
198
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
199
+ dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
200
+ }
201
+ }
202
+ return dp[m][n];
203
+ }
204
+ function suggestParam(input, names) {
205
+ let best;
206
+ let bestDist = 3;
207
+ for (const name of names) {
208
+ const d = levenshtein(input, name);
209
+ if (d < bestDist) {
210
+ bestDist = d;
211
+ best = name;
212
+ }
213
+ }
214
+ return best;
215
+ }
216
+ //# sourceMappingURL=arg-parser.js.map