@voybio/ace-swarm 0.1.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 (334) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE +186 -0
  3. package/README.md +229 -0
  4. package/assets/.agents/ACE/ACE-Init/AGENTS.md +210 -0
  5. package/assets/.agents/ACE/ACE-Init/instructions.md +118 -0
  6. package/assets/.agents/ACE/ACE_coders/AGENTS.md +154 -0
  7. package/assets/.agents/ACE/ACE_coders/INSTRUCTIONS.md +216 -0
  8. package/assets/.agents/ACE/AGENT_REGISTRY.md +70 -0
  9. package/assets/.agents/ACE/AGENT_REGISTRY_7.md +9 -0
  10. package/assets/.agents/ACE/DIRECTIVE_KERNEL.md +234 -0
  11. package/assets/.agents/ACE/UI/AGENTS.md +115 -0
  12. package/assets/.agents/ACE/UI/instructions.md +178 -0
  13. package/assets/.agents/ACE/VOS/ACE_VOS_MISSING_INFO_MATRIX.md +42 -0
  14. package/assets/.agents/ACE/VOS/AGENTS.md +72 -0
  15. package/assets/.agents/ACE/VOS/instructions.md +211 -0
  16. package/assets/.agents/ACE/agent-astgrep/AGENTS.md +123 -0
  17. package/assets/.agents/ACE/agent-astgrep/instructions.md +91 -0
  18. package/assets/.agents/ACE/agent-builder/AGENTS.md +172 -0
  19. package/assets/.agents/ACE/agent-builder/instructions.md +137 -0
  20. package/assets/.agents/ACE/agent-docs/AGENTS.md +159 -0
  21. package/assets/.agents/ACE/agent-docs/instructions.md +133 -0
  22. package/assets/.agents/ACE/agent-eval/AGENTS.md +46 -0
  23. package/assets/.agents/ACE/agent-eval/instructions.md +56 -0
  24. package/assets/.agents/ACE/agent-memory/AGENTS.md +49 -0
  25. package/assets/.agents/ACE/agent-memory/instructions.md +50 -0
  26. package/assets/.agents/ACE/agent-observability/AGENTS.md +46 -0
  27. package/assets/.agents/ACE/agent-observability/instructions.md +50 -0
  28. package/assets/.agents/ACE/agent-ops/AGENTS.md +201 -0
  29. package/assets/.agents/ACE/agent-ops/instructions.md +136 -0
  30. package/assets/.agents/ACE/agent-qa/AGENTS.md +189 -0
  31. package/assets/.agents/ACE/agent-qa/instructions.md +121 -0
  32. package/assets/.agents/ACE/agent-release/AGENTS.md +48 -0
  33. package/assets/.agents/ACE/agent-release/instructions.md +49 -0
  34. package/assets/.agents/ACE/agent-research/AGENTS.md +160 -0
  35. package/assets/.agents/ACE/agent-research/instructions.md +118 -0
  36. package/assets/.agents/ACE/agent-security/AGENTS.md +48 -0
  37. package/assets/.agents/ACE/agent-security/instructions.md +50 -0
  38. package/assets/.agents/ACE/agent-skeptic/AGENTS.md +178 -0
  39. package/assets/.agents/ACE/agent-skeptic/instructions.md +196 -0
  40. package/assets/.agents/ACE/agent-spec/AGENTS.md +169 -0
  41. package/assets/.agents/ACE/agent-spec/instructions.md +116 -0
  42. package/assets/.agents/ACE/orchestrator/AGENTS.md +365 -0
  43. package/assets/.agents/ACE/orchestrator/instructions.md +231 -0
  44. package/assets/.agents/skills/ace-orchestrator/SKILL.md +63 -0
  45. package/assets/.agents/skills/ace-orchestrator/references/engineering-bootstrap-playbook.md +360 -0
  46. package/assets/.agents/skills/astgrep-index/SKILL.md +58 -0
  47. package/assets/.agents/skills/codemunch/SKILL.md +65 -0
  48. package/assets/.agents/skills/codemunch/references/ast-driven-protocol.md +543 -0
  49. package/assets/.agents/skills/codesnipe/SKILL.md +64 -0
  50. package/assets/.agents/skills/codesnipe/references/dual-codebase-playbook.md +671 -0
  51. package/assets/.agents/skills/eval-harness/SKILL.md +203 -0
  52. package/assets/.agents/skills/handoff-lint/SKILL.md +164 -0
  53. package/assets/.agents/skills/incident-commander/SKILL.md +174 -0
  54. package/assets/.agents/skills/landing-review-watcher/SKILL.md +68 -0
  55. package/assets/.agents/skills/memory-curator/SKILL.md +179 -0
  56. package/assets/.agents/skills/problem-triage/SKILL.md +57 -0
  57. package/assets/.agents/skills/problem-triage/agents/openai.yaml +3 -0
  58. package/assets/.agents/skills/release-sentry/SKILL.md +189 -0
  59. package/assets/.agents/skills/risk-quant/SKILL.md +190 -0
  60. package/assets/.agents/skills/schema-forge/SKILL.md +174 -0
  61. package/assets/.agents/skills/skill-auditor/SKILL.md +52 -0
  62. package/assets/.agents/skills/state-auditor/SKILL.md +182 -0
  63. package/assets/.github/hooks/ace-copilot.json +68 -0
  64. package/assets/agent-state/ACE_WORKFLOW.md +131 -0
  65. package/assets/agent-state/ARTIFACT_MANIFEST.json +5 -0
  66. package/assets/agent-state/AST_GREP_COMMANDS.md +121 -0
  67. package/assets/agent-state/AST_GREP_INDEX.json +13 -0
  68. package/assets/agent-state/AST_GREP_INDEX.md +15 -0
  69. package/assets/agent-state/DECISIONS.md +7 -0
  70. package/assets/agent-state/EVIDENCE_LOG.md +7 -0
  71. package/assets/agent-state/HANDOFF.json +24 -0
  72. package/assets/agent-state/INTERFACE_REGISTRY.md +75 -0
  73. package/assets/agent-state/MODULES/gates/gate-autonomy.json +7 -0
  74. package/assets/agent-state/MODULES/gates/gate-completeness.json +7 -0
  75. package/assets/agent-state/MODULES/gates/gate-correctness.json +7 -0
  76. package/assets/agent-state/MODULES/gates/gate-evaluation.json +7 -0
  77. package/assets/agent-state/MODULES/gates/gate-operability.json +7 -0
  78. package/assets/agent-state/MODULES/gates/gate-security.json +7 -0
  79. package/assets/agent-state/MODULES/gates/gate-typescript-public-surface.json +7 -0
  80. package/assets/agent-state/MODULES/registry.json +41 -0
  81. package/assets/agent-state/MODULES/roles/capability-astgrep.json +49 -0
  82. package/assets/agent-state/MODULES/roles/capability-build.json +39 -0
  83. package/assets/agent-state/MODULES/roles/capability-docs.json +38 -0
  84. package/assets/agent-state/MODULES/roles/capability-eval.json +20 -0
  85. package/assets/agent-state/MODULES/roles/capability-memory.json +20 -0
  86. package/assets/agent-state/MODULES/roles/capability-observability.json +20 -0
  87. package/assets/agent-state/MODULES/roles/capability-ops.json +45 -0
  88. package/assets/agent-state/MODULES/roles/capability-qa.json +40 -0
  89. package/assets/agent-state/MODULES/roles/capability-release.json +21 -0
  90. package/assets/agent-state/MODULES/roles/capability-research.json +44 -0
  91. package/assets/agent-state/MODULES/roles/capability-security.json +21 -0
  92. package/assets/agent-state/MODULES/roles/capability-skeptic.json +48 -0
  93. package/assets/agent-state/MODULES/roles/capability-spec.json +42 -0
  94. package/assets/agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json +289 -0
  95. package/assets/agent-state/MODULES/schemas/ARTIFACT_MANIFEST.schema.json +185 -0
  96. package/assets/agent-state/MODULES/schemas/HANDOFF.agent-state.schema.json +124 -0
  97. package/assets/agent-state/MODULES/schemas/HANDOFF.schema.json +55 -0
  98. package/assets/agent-state/MODULES/schemas/RUNTIME_EXECUTOR_SESSION_REGISTRY.schema.json +290 -0
  99. package/assets/agent-state/MODULES/schemas/RUNTIME_TOOL_SPEC_REGISTRY.schema.json +144 -0
  100. package/assets/agent-state/MODULES/schemas/STATUS_EVENT.schema.json +84 -0
  101. package/assets/agent-state/MODULES/schemas/SWARM_HANDOFF.schema.json +138 -0
  102. package/assets/agent-state/MODULES/schemas/TRACKER_SNAPSHOT.schema.json +134 -0
  103. package/assets/agent-state/MODULES/schemas/VERICIFY_BRIDGE_SNAPSHOT.schema.json +157 -0
  104. package/assets/agent-state/MODULES/schemas/VERICIFY_PROCESS_POST_LOG.schema.json +93 -0
  105. package/assets/agent-state/MODULES/schemas/WORKSPACE_SESSION_REGISTRY.schema.json +133 -0
  106. package/assets/agent-state/PROVENANCE_LOG.md +28 -0
  107. package/assets/agent-state/QUALITY_GATES.md +15 -0
  108. package/assets/agent-state/RISKS.md +8 -0
  109. package/assets/agent-state/SCOPE.md +20 -0
  110. package/assets/agent-state/SKILL_CATALOG.md +48 -0
  111. package/assets/agent-state/STATUS.md +8 -0
  112. package/assets/agent-state/STATUS_EVENTS.ndjson +1 -0
  113. package/assets/agent-state/TASK.md +18 -0
  114. package/assets/agent-state/TEAL_CONFIG.md +117 -0
  115. package/assets/agent-state/handoff-registry.json +5 -0
  116. package/assets/agent-state/index-fingerprints.json +7 -0
  117. package/assets/agent-state/index.json +32 -0
  118. package/assets/agent-state/run-ledger.json +5 -0
  119. package/assets/agent-state/runtime-executor-sessions.json +5 -0
  120. package/assets/agent-state/runtime-tool-specs.json +5 -0
  121. package/assets/agent-state/runtime-workspaces.json +5 -0
  122. package/assets/agent-state/todo-state.json +7 -0
  123. package/assets/agent-state/tracker-snapshot.json +7 -0
  124. package/assets/agent-state/vericify/ace-bridge.json +60 -0
  125. package/assets/agent-state/vericify/process-posts.json +5 -0
  126. package/assets/instructions/ACE.instructions.md +187 -0
  127. package/assets/instructions/ACE_Coder.instructions.md +146 -0
  128. package/assets/instructions/ACE_UI.instructions.md +178 -0
  129. package/assets/instructions/ACE_VOS.instructions.md +211 -0
  130. package/assets/scripts/ace-hook-dispatch.mjs +538 -0
  131. package/assets/scripts/bootstrap-workspace.sh +27 -0
  132. package/assets/scripts/copilot-hook-dispatch.mjs +3 -0
  133. package/assets/scripts/eval-harness.sh +68 -0
  134. package/assets/scripts/render-mcp-configs.sh +396 -0
  135. package/assets/tasks/README.md +48 -0
  136. package/assets/tasks/SWARM_HANDOFF.example.json +53 -0
  137. package/assets/tasks/SWARM_HANDOFF.example_ui_to_coders.json +55 -0
  138. package/assets/tasks/SWARM_HANDOFF.example_vos_to_ui.json +55 -0
  139. package/assets/tasks/SWARM_HANDOFF.template.json +52 -0
  140. package/assets/tasks/cli_work_split.md +22 -0
  141. package/assets/tasks/lessons.md +17 -0
  142. package/assets/tasks/role_tasks.md +206 -0
  143. package/assets/tasks/todo.md +23 -0
  144. package/dist/ace-autonomy.d.ts +137 -0
  145. package/dist/ace-autonomy.js +472 -0
  146. package/dist/ace-context.d.ts +29 -0
  147. package/dist/ace-context.js +240 -0
  148. package/dist/ace-internal-tools.d.ts +8 -0
  149. package/dist/ace-internal-tools.js +76 -0
  150. package/dist/ace-server-instructions.d.ts +12 -0
  151. package/dist/ace-server-instructions.js +324 -0
  152. package/dist/agent-runtime/role-adapters.d.ts +29 -0
  153. package/dist/agent-runtime/role-adapters.js +573 -0
  154. package/dist/astgrep-index.d.ts +24 -0
  155. package/dist/astgrep-index.js +476 -0
  156. package/dist/cli.d.ts +3 -0
  157. package/dist/cli.js +591 -0
  158. package/dist/git-ops.d.ts +53 -0
  159. package/dist/git-ops.js +238 -0
  160. package/dist/handoff-registry.d.ts +71 -0
  161. package/dist/handoff-registry.js +422 -0
  162. package/dist/helpers.d.ts +126 -0
  163. package/dist/helpers.js +1687 -0
  164. package/dist/index-store.d.ts +51 -0
  165. package/dist/index-store.js +328 -0
  166. package/dist/index.d.ts +3 -0
  167. package/dist/index.js +7 -0
  168. package/dist/internal-tool-runtime.d.ts +21 -0
  169. package/dist/internal-tool-runtime.js +136 -0
  170. package/dist/job-scheduler.d.ts +175 -0
  171. package/dist/job-scheduler.js +1217 -0
  172. package/dist/kanban.d.ts +27 -0
  173. package/dist/kanban.js +339 -0
  174. package/dist/local-model-runtime.d.ts +40 -0
  175. package/dist/local-model-runtime.js +174 -0
  176. package/dist/model-bridge.d.ts +54 -0
  177. package/dist/model-bridge.js +587 -0
  178. package/dist/orchestrator-supervisor.d.ts +100 -0
  179. package/dist/orchestrator-supervisor.js +399 -0
  180. package/dist/problem-triage.d.ts +23 -0
  181. package/dist/problem-triage.js +448 -0
  182. package/dist/prompts.d.ts +7 -0
  183. package/dist/prompts.js +628 -0
  184. package/dist/public-surface.d.ts +30 -0
  185. package/dist/public-surface.js +316 -0
  186. package/dist/resources.d.ts +7 -0
  187. package/dist/resources.js +545 -0
  188. package/dist/run-ledger.d.ts +36 -0
  189. package/dist/run-ledger.js +257 -0
  190. package/dist/runtime-command.d.ts +18 -0
  191. package/dist/runtime-command.js +76 -0
  192. package/dist/runtime-executor.d.ts +104 -0
  193. package/dist/runtime-executor.js +985 -0
  194. package/dist/runtime-profile.d.ts +116 -0
  195. package/dist/runtime-profile.js +532 -0
  196. package/dist/runtime-tool-specs.d.ts +68 -0
  197. package/dist/runtime-tool-specs.js +527 -0
  198. package/dist/safe-edit.d.ts +52 -0
  199. package/dist/safe-edit.js +255 -0
  200. package/dist/schemas.d.ts +44 -0
  201. package/dist/schemas.js +830 -0
  202. package/dist/semantic-cache.d.ts +147 -0
  203. package/dist/semantic-cache.js +552 -0
  204. package/dist/semantic-hash.d.ts +83 -0
  205. package/dist/semantic-hash.js +346 -0
  206. package/dist/server.d.ts +10 -0
  207. package/dist/server.js +46 -0
  208. package/dist/shared.d.ts +136 -0
  209. package/dist/shared.js +269 -0
  210. package/dist/skill-auditor.d.ts +26 -0
  211. package/dist/skill-auditor.js +184 -0
  212. package/dist/skill-catalog.d.ts +60 -0
  213. package/dist/skill-catalog.js +305 -0
  214. package/dist/status-events.d.ts +40 -0
  215. package/dist/status-events.js +269 -0
  216. package/dist/store/ace-packed-store.d.ts +69 -0
  217. package/dist/store/ace-packed-store.js +434 -0
  218. package/dist/store/bootstrap-store.d.ts +46 -0
  219. package/dist/store/bootstrap-store.js +242 -0
  220. package/dist/store/catalog-builder.d.ts +21 -0
  221. package/dist/store/catalog-builder.js +68 -0
  222. package/dist/store/importer.d.ts +19 -0
  223. package/dist/store/importer.js +157 -0
  224. package/dist/store/knowledge-bake.d.ts +59 -0
  225. package/dist/store/knowledge-bake.js +339 -0
  226. package/dist/store/materializers/hook-context-materializer.d.ts +25 -0
  227. package/dist/store/materializers/hook-context-materializer.js +100 -0
  228. package/dist/store/materializers/host-file-materializer.d.ts +37 -0
  229. package/dist/store/materializers/host-file-materializer.js +271 -0
  230. package/dist/store/materializers/todo-syncer.d.ts +30 -0
  231. package/dist/store/materializers/todo-syncer.js +140 -0
  232. package/dist/store/materializers/vericify-projector.d.ts +38 -0
  233. package/dist/store/materializers/vericify-projector.js +239 -0
  234. package/dist/store/repositories/discovery-repository.d.ts +24 -0
  235. package/dist/store/repositories/discovery-repository.js +58 -0
  236. package/dist/store/repositories/handoff-repository.d.ts +31 -0
  237. package/dist/store/repositories/handoff-repository.js +67 -0
  238. package/dist/store/repositories/ledger-repository.d.ts +26 -0
  239. package/dist/store/repositories/ledger-repository.js +49 -0
  240. package/dist/store/repositories/runtime-kv-repository.d.ts +16 -0
  241. package/dist/store/repositories/runtime-kv-repository.js +36 -0
  242. package/dist/store/repositories/scheduler-repository.d.ts +50 -0
  243. package/dist/store/repositories/scheduler-repository.js +123 -0
  244. package/dist/store/repositories/session-repository.d.ts +33 -0
  245. package/dist/store/repositories/session-repository.js +82 -0
  246. package/dist/store/repositories/todo-repository.d.ts +31 -0
  247. package/dist/store/repositories/todo-repository.js +77 -0
  248. package/dist/store/repositories/tracker-repository.d.ts +25 -0
  249. package/dist/store/repositories/tracker-repository.js +43 -0
  250. package/dist/store/repositories/vericify-repository.d.ts +32 -0
  251. package/dist/store/repositories/vericify-repository.js +58 -0
  252. package/dist/store/skills-install.d.ts +28 -0
  253. package/dist/store/skills-install.js +86 -0
  254. package/dist/store/state-reader.d.ts +49 -0
  255. package/dist/store/state-reader.js +111 -0
  256. package/dist/store/store-artifacts.d.ts +12 -0
  257. package/dist/store/store-artifacts.js +138 -0
  258. package/dist/store/store-snapshot.d.ts +19 -0
  259. package/dist/store/store-snapshot.js +140 -0
  260. package/dist/store/topology-bake.d.ts +15 -0
  261. package/dist/store/topology-bake.js +215 -0
  262. package/dist/store/types.d.ts +155 -0
  263. package/dist/store/types.js +35 -0
  264. package/dist/store/workspace-snapshot.d.ts +26 -0
  265. package/dist/store/workspace-snapshot.js +107 -0
  266. package/dist/store/write-queue.d.ts +7 -0
  267. package/dist/store/write-queue.js +26 -0
  268. package/dist/todo-state.d.ts +41 -0
  269. package/dist/todo-state.js +399 -0
  270. package/dist/tools-agent.d.ts +7 -0
  271. package/dist/tools-agent.js +1542 -0
  272. package/dist/tools-discovery.d.ts +6 -0
  273. package/dist/tools-discovery.js +178 -0
  274. package/dist/tools-drift.d.ts +13 -0
  275. package/dist/tools-drift.js +357 -0
  276. package/dist/tools-files.d.ts +6 -0
  277. package/dist/tools-files.js +679 -0
  278. package/dist/tools-framework.d.ts +7 -0
  279. package/dist/tools-framework.js +1414 -0
  280. package/dist/tools-git.d.ts +6 -0
  281. package/dist/tools-git.js +183 -0
  282. package/dist/tools-handoff.d.ts +32 -0
  283. package/dist/tools-handoff.js +489 -0
  284. package/dist/tools-lifecycle.d.ts +6 -0
  285. package/dist/tools-lifecycle.js +205 -0
  286. package/dist/tools-memory.d.ts +6 -0
  287. package/dist/tools-memory.js +260 -0
  288. package/dist/tools-scheduler.d.ts +6 -0
  289. package/dist/tools-scheduler.js +228 -0
  290. package/dist/tools-skills.d.ts +3 -0
  291. package/dist/tools-skills.js +104 -0
  292. package/dist/tools-todo.d.ts +6 -0
  293. package/dist/tools-todo.js +154 -0
  294. package/dist/tools.d.ts +9 -0
  295. package/dist/tools.js +33 -0
  296. package/dist/tracker-adapters.d.ts +74 -0
  297. package/dist/tracker-adapters.js +776 -0
  298. package/dist/tracker-sync.d.ts +10 -0
  299. package/dist/tracker-sync.js +84 -0
  300. package/dist/tui/agent-runner.d.ts +137 -0
  301. package/dist/tui/agent-runner.js +466 -0
  302. package/dist/tui/agent-worker.d.ts +10 -0
  303. package/dist/tui/agent-worker.js +347 -0
  304. package/dist/tui/chat.d.ts +84 -0
  305. package/dist/tui/chat.js +368 -0
  306. package/dist/tui/commands.d.ts +57 -0
  307. package/dist/tui/commands.js +432 -0
  308. package/dist/tui/dashboard.d.ts +24 -0
  309. package/dist/tui/dashboard.js +110 -0
  310. package/dist/tui/index.d.ts +114 -0
  311. package/dist/tui/index.js +1059 -0
  312. package/dist/tui/input.d.ts +49 -0
  313. package/dist/tui/input.js +336 -0
  314. package/dist/tui/layout.d.ts +116 -0
  315. package/dist/tui/layout.js +367 -0
  316. package/dist/tui/ollama.d.ts +116 -0
  317. package/dist/tui/ollama.js +192 -0
  318. package/dist/tui/openai-compatible.d.ts +63 -0
  319. package/dist/tui/openai-compatible.js +370 -0
  320. package/dist/tui/provider-discovery.d.ts +59 -0
  321. package/dist/tui/provider-discovery.js +530 -0
  322. package/dist/tui/renderer.d.ts +166 -0
  323. package/dist/tui/renderer.js +304 -0
  324. package/dist/tui/tabs.d.ts +70 -0
  325. package/dist/tui/tabs.js +208 -0
  326. package/dist/tui/telemetry.d.ts +56 -0
  327. package/dist/tui/telemetry.js +106 -0
  328. package/dist/vericify-bridge.d.ts +146 -0
  329. package/dist/vericify-bridge.js +571 -0
  330. package/dist/vericify-context.d.ts +10 -0
  331. package/dist/vericify-context.js +72 -0
  332. package/dist/workspace-manager.d.ts +107 -0
  333. package/dist/workspace-manager.js +636 -0
  334. package/package.json +83 -0
@@ -0,0 +1,360 @@
1
+ ---
2
+ name: ace-orchestrator
3
+ description:
4
+ Engineering-state bootstrap scanner for ACE-Orchestrator (invoked during the init discovery phase). Runs targeted ast-grep queries on ./src/ or ./engineering-state/ to populate ENGINEERING_SNAPSHOT.md in ./global-state/ giving the orchestrator real code facts before the first SWARM_HANDOFF.json is issued. Without this, GLOBAL_STATE_ANALYSIS is based on directory guesses.
5
+ ---
6
+
7
+ # ACE CodeMunch Boot — Engineering-State Bootstrap Scanner
8
+
9
+ **IMPORTANT**: Run this skill BEFORE writing `MASTER_PLAN.md` and BEFORE issuing
10
+ the first `SWARM_HANDOFF.json`. The Orchestrator's three alignment questions —
11
+ *"Does the Code match the Design? Does the Design match the Thesis?"* — cannot be
12
+ answered without structural facts about the codebase. This skill produces those
13
+ facts in under 60 seconds via ast-grep, costing near-zero tokens. A
14
+ `GLOBAL_STATE_ANALYSIS` issued without running this first is operating on fiction.
15
+
16
+ **Do NOT read source files directly.** Every engineering fact must come from an
17
+ ast-grep command or a targeted `find`/`grep` invocation. The Orchestrator is
18
+ a manager, not a code reader.
19
+
20
+ ---
21
+
22
+ ## MICE Boundaries
23
+
24
+ | Rule | Enforcement |
25
+ |---|---|
26
+ | **Modular** | Scans engineering state; does NOT write code, fix bugs, or change specs. |
27
+ | **Interoperable** | Snapshot output follows canonical `ENGINEERING_SNAPSHOT.md` schema. |
28
+ | **Customizable** | Language detection and quality thresholds adapt to detected project type. |
29
+ | **Extensible** | New language patterns added via ast-grep pattern sets in Step 2. |
30
+
31
+ ## Goal Orientation
32
+
33
+ - `DELETE_PROTOCOL`: Skip steps for languages not detected in Step 1.
34
+ - `ARTIFACT_PROTOCOL`: Session MUST produce `ENGINEERING_SNAPSHOT.md`. No snapshot = useless boot.
35
+ - `AGENCY_PROTOCOL`: Orchestrator reads snapshot signals to route first `SWARM_HANDOFF.json` without human input.
36
+
37
+ ## Wrong-Stuff Protocol
38
+
39
+ When engineering scan reveals issues:
40
+
41
+ | Finding | Classification | Route To |
42
+ |---|---|---|
43
+ | No source code found | `missing_engineering` | `agent-builder` (genesis) |
44
+ | No tests found | `quality_gap` | `agent-builder` (baseline tests) |
45
+ | No MVP spec found | `missing_spec` | VOS (thesis pipeline) |
46
+ | Spec-code misalignment > 50% | `spec_violation` | `agent-spec` + `agent-builder` |
47
+ | > 20 stubs/TODOs | `implementation_debt` | `agent-builder` (debt clear sprint) |
48
+
49
+
50
+
51
+ ---
52
+
53
+ ## When to Invoke
54
+
55
+ | Trigger | Action |
56
+ |---|---|
57
+ | `initiate ACE` boot sequence, Discovery phase | Run **all** steps |
58
+ | Orchestrator detects stale `ENGINEERING_SNAPSHOT.md` (>24h old) | Re-run all steps |
59
+ | ACE-Coders completes a build sprint | Re-run Steps 3 and 4 only (delta scan) |
60
+ | `SWARM_HANDOFF` routing decision requires engineering context | Run Step 4 only |
61
+ | ACE-VOS pivots thesis | Run Step 3 (spec alignment check) only |
62
+
63
+ ---
64
+
65
+ ## Steps
66
+
67
+ ### 1. Locate and Profile the Engineering State
68
+
69
+ Detect language, size, and structure before running any pattern queries.
70
+ Write nothing to global-state yet — this step only populates working memory.
71
+
72
+ ```bash
73
+ # Detect primary language(s)
74
+ find ./src . -type f \( -name "*.rs" -o -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.go" \) 2>/dev/null | grep -v ".git\|node_modules\|__pycache__\|target\|dist" | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -10
75
+
76
+ # Count total source files and rough LOC estimate
77
+ find ./src . -type f -name "*.py" -o -name "*.ts" -o -name "*.rs" 2>/dev/null | grep -v ".git\|node_modules\|target" | wc -l
78
+
79
+ # Detect entry point(s)
80
+ find . -name "main.rs" -o -name "main.py" -o -name "index.ts" -o -name "app.py" -o -name "server.py" -o -name "main.go" 2>/dev/null | grep -v ".git\|node_modules\|target" | head -5
81
+
82
+ # Detect build/package manifest
83
+ ls -1 Cargo.toml pyproject.toml setup.py package.json go.mod 2>/dev/null
84
+ ```
85
+
86
+ Record findings as working variables:
87
+ ```
88
+ LANG=<primary language>
89
+ ENTRY=<entry point path>
90
+ FILE_COUNT=<n>
91
+ BUILD_SYSTEM=<cargo|pip|npm|go>
92
+ ```
93
+
94
+ ---
95
+
96
+ ### 2. Rapid Public API Census
97
+
98
+ Extract the public symbol surface. This tells the Orchestrator what the codebase
99
+ currently DOES — the ground truth it needs to compare against the thesis.
100
+
101
+ ```bash
102
+ # --- Rust ---
103
+ # Public functions
104
+ ast-grep --pattern 'pub fn $NAME($$$)' --lang rust --color never | grep -oP 'pub fn \K\w+' | sort -u >> /tmp/ace_boot_symbols.txt
105
+
106
+ # Public types
107
+ ast-grep --pattern 'pub struct $NAME' --lang rust --color never | grep -oP 'pub struct \K\w+' | sort -u >> /tmp/ace_boot_symbols.txt
108
+
109
+ ast-grep --pattern 'pub enum $NAME' --lang rust --color never | grep -oP 'pub enum \K\w+' | sort -u >> /tmp/ace_boot_symbols.txt
110
+
111
+ # --- Python ---
112
+ ast-grep --pattern 'def $NAME($$$):' --lang python --color never --json | python3 -c "import sys,json; [print(s['metaVariables']['NAME']) for s in json.load(sys.stdin)]" | sort -u >> /tmp/ace_boot_symbols.txt
113
+
114
+ ast-grep --pattern 'class $NAME:' --lang python --color never --json | python3 -c "import sys,json; [print(s['metaVariables']['NAME']) for s in json.load(sys.stdin)]" | sort -u >> /tmp/ace_boot_symbols.txt
115
+
116
+ # --- TypeScript / JavaScript ---
117
+ ast-grep --pattern 'export function $NAME($$$)' --lang ts --color never --json | python3 -c "import sys,json; [print(s['metaVariables']['NAME']) for s in json.load(sys.stdin)]" | sort -u >> /tmp/ace_boot_symbols.txt
118
+
119
+ ast-grep --pattern 'export class $NAME' --lang ts --color never --json | python3 -c "import sys,json; [print(s['metaVariables']['NAME']) for s in json.load(sys.stdin)]" | sort -u >> /tmp/ace_boot_symbols.txt
120
+
121
+ # Total symbol count
122
+ wc -l /tmp/ace_boot_symbols.txt
123
+ ```
124
+
125
+ ---
126
+
127
+ ### 3. Engineering Quality Scan
128
+
129
+ Measures the HEALTH of the engineering state. The Orchestrator needs this to decide
130
+ whether ACE-Coders needs a quality pass before any new feature work.
131
+
132
+ ```bash
133
+ # --- Test coverage signal ---
134
+ # Rust: count test functions
135
+ ast-grep --pattern '#[test] fn $NAME()' --lang rust --color never | grep -c "fn " || echo "0 rust tests"
136
+
137
+ # Python: count test functions
138
+ ast-grep --pattern 'def test_$NAME($$$):' --lang python --color never | grep -c "def " || echo "0 python tests"
139
+
140
+ # TypeScript: count test blocks
141
+ ast-grep --pattern "it('$DESC', $$$)" --lang ts --color never | grep -c "it(" || echo "0 ts tests"
142
+ ast-grep --pattern 'test("$DESC", $$$)' --lang ts --color never | grep -c "test(" || echo "0 ts tests"
143
+
144
+ # --- Completion signal: stubs and TODOs ---
145
+ # Rust: unimplemented/todo macros (hard stubs)
146
+ ast-grep --pattern 'unimplemented!()' --lang rust --color never | grep -c "unimplemented"
147
+ ast-grep --pattern 'todo!()' --lang rust --color never | grep -c "todo"
148
+
149
+ # Python: NotImplemented raises
150
+ ast-grep --pattern 'raise NotImplementedError' --lang python --color never | grep -c "raise"
151
+
152
+ # Cross-language: comment-level TODOs (soft stubs)
153
+ grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.py" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.go" . 2>/dev/null | grep -v ".git\|node_modules\|target" | wc -l
154
+
155
+ # --- Risk signal: unsafe code, panics ---
156
+ # Rust: unsafe blocks (correctness risk surface)
157
+ ast-grep --pattern 'unsafe { $$$ }' --lang rust --color never | grep -c "unsafe"
158
+
159
+ # Rust: unwrap() calls (panic risk surface)
160
+ ast-grep --pattern '$EXPR.unwrap()' --lang rust --color never | grep -c "unwrap"
161
+
162
+ # --- Architecture signal: async vs sync ---
163
+ ast-grep --pattern 'async fn $NAME($$$)' --lang rust --color never | grep -c "async"
164
+ ast-grep --pattern 'async def $NAME($$$):' --lang python --color never | grep -c "async"
165
+ ast-grep --pattern 'async function $NAME($$$)' --lang ts --color never | grep -c "async"
166
+ ```
167
+
168
+ ---
169
+
170
+ ### 4. Spec Alignment Check
171
+
172
+ Compare what the code DOES against what the thesis/MVP spec CLAIMS it should do.
173
+ This is the Orchestrator's core alignment question answered with evidence.
174
+
175
+ ```bash
176
+ # Only run if venture-state MVP spec exists
177
+ if [ -f "./venture-state/MVP_SPEC.md" ]; then
178
+
179
+ # Extract feature keywords from MVP spec (nouns from headings and bullets)
180
+ grep -oP '(?<=^#{1,3} ).*|(?<=^- ).*' ./venture-state/MVP_SPEC.md | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9_' '
181
+ ' | sort -u | grep -v "^.$\|^..$" > /tmp/ace_spec_keywords.txt
182
+
183
+ # Check which spec keywords appear in engineering symbol names
184
+ comm -12 <(sort /tmp/ace_boot_symbols.txt | tr '[:upper:]' '[:lower:]') <(sort /tmp/ace_spec_keywords.txt) > /tmp/ace_covered_features.txt
185
+
186
+ # Keywords in spec NOT found in code (unbuilt features)
187
+ comm -23 <(sort /tmp/ace_spec_keywords.txt) <(sort /tmp/ace_boot_symbols.txt | tr '[:upper:]' '[:lower:]') > /tmp/ace_missing_features.txt
188
+
189
+ echo "=== COVERED (spec keyword found in code) ==="
190
+ cat /tmp/ace_covered_features.txt | head -20
191
+
192
+ echo "=== MISSING (spec keyword NOT found in code) ==="
193
+ cat /tmp/ace_missing_features.txt | head -20
194
+
195
+ fi
196
+
197
+ # Check for any existing engineering-state STATUS.md
198
+ if [ -f "./engineering-state/STATUS.md" ]; then
199
+ head -30 ./engineering-state/STATUS.md
200
+ fi
201
+ ```
202
+
203
+ ---
204
+
205
+ ### 5. Write ENGINEERING_SNAPSHOT.md
206
+
207
+ Crystallise all findings into a single artifact that the Orchestrator reads during
208
+ `GLOBAL_STATE_ANALYSIS`. This file becomes the engineering column of `MASTER_PLAN.md`.
209
+
210
+ Write to: `./global-state/ENGINEERING_SNAPSHOT.md`
211
+
212
+ ```markdown
213
+ # ENGINEERING_SNAPSHOT.md
214
+ Generated: <ISO8601 timestamp>
215
+ Scanned By: ace-codemunch-boot skill
216
+
217
+ ---
218
+
219
+ ## Profile
220
+ - **Primary Language:** <lang>
221
+ - **Build System:** <cargo | pip | npm | go | unknown>
222
+ - **Entry Point:** <path>
223
+ - **Source Files:** <n>
224
+ - **Public Symbols:** <n> (functions, classes, types)
225
+
226
+ ---
227
+
228
+ ## Quality Signals
229
+ | Signal | Value | Risk Level |
230
+ |---|---|---|
231
+ | Test functions found | <n> | 🟢 / 🟡 / 🔴 |
232
+ | Hard stubs (unimplemented!/todo!) | <n> | 🟢 / 🟡 / 🔴 |
233
+ | Soft stubs (TODO/FIXME comments) | <n> | 🟢 / 🟡 / 🔴 |
234
+ | Unsafe blocks (Rust) / unwrap() | <n> | 🟢 / 🟡 / 🔴 |
235
+ | Concurrency model | async / sync / mixed | — |
236
+
237
+ Risk thresholds: 🟢 = low (0–5), 🟡 = medium (6–20), 🔴 = high (>20)
238
+
239
+ ---
240
+
241
+ ## Spec Alignment (vs venture-state/MVP_SPEC.md)
242
+ - **Covered features** (keyword found in code): <n> — see /tmp/ace_covered_features.txt
243
+ - **Missing features** (keyword NOT found in code): <n> — see /tmp/ace_missing_features.txt
244
+
245
+ ### Top missing features (unbuilt spec items):
246
+ - <keyword 1>
247
+ - <keyword 2>
248
+ - <keyword 3>
249
+
250
+ ---
251
+
252
+ ## Routing Signals for Orchestrator
253
+
254
+ <!-- FILL THESE IN based on scan results above -->
255
+ <!-- These are the Orchestrator's inputs to SWARM_HANDOFF routing logic -->
256
+
257
+ CODERS_NEEDED_FOR:
258
+ - <stub count > 10 → "Coders must clear stubs before new features">
259
+ - <test count < 5 → "Coders must write baseline tests first">
260
+ - <missing spec features → list top 3>
261
+
262
+ VOS_NEEDED_FOR:
263
+ - <missing features count > 10 → "MVP scope may be too large; VOS must re-triage">
264
+ - <0 spec file found → "No thesis artifact; VOS must run genesis pipeline first">
265
+
266
+ UI_NEEDED_FOR:
267
+ - <no brand-state/ → "UI has not defined copy or flows yet">
268
+
269
+ PIPELINE_RECOMMENDATION: <genesis | pivot | ship_it>
270
+ Reason: <one sentence — e.g., "Code has 40% spec coverage and 3 stubs; pivot pipeline to clear debt first">
271
+
272
+ ---
273
+
274
+ ## Evidence Log
275
+ All ast-grep commands that produced this snapshot are appended below.
276
+ <paste raw command outputs here>
277
+ ```
278
+
279
+ ---
280
+
281
+ ### 6. Inject into MASTER_PLAN.md and Route
282
+
283
+ After `ENGINEERING_SNAPSHOT.md` is written, the Orchestrator uses it to:
284
+
285
+ 1. **Populate the Engineering column** of `MASTER_PLAN.md`:
286
+ ```markdown
287
+ ## Engineering State (from ENGINEERING_SNAPSHOT.md, <date>)
288
+ - Symbols: <n> | Tests: <n> | Stubs: <n> | Spec coverage: <n>%
289
+ - Status: <one sentence from routing signals>
290
+ ```
291
+
292
+ 2. **Check alignment** across all three pillars before routing:
293
+ ```
294
+ CODE alignment check:
295
+ venture-state/MVP_SPEC.md exists? → YES / NO
296
+ brand-state/DESIGN_SYSTEM.md exists? → YES / NO
297
+ MISSING FEATURES in snapshot > 0? → route to Coders or VOS
298
+ STUB COUNT > 10? → route to Coders (debt-clear sprint)
299
+ NO TESTS? → route to Coders (baseline test sprint)
300
+ NO MVP SPEC? → route to VOS (genesis pipeline)
301
+ ```
302
+
303
+ 3. **Emit the first SWARM_HANDOFF.json** with engineering context attached:
304
+ ```json
305
+ {
306
+ "router": {
307
+ "from": "ace-init",
308
+ "via": "ace-orchestrator",
309
+ "to": "<ace-vos | ace-ui | ace-coders>"
310
+ },
311
+ "context": {
312
+ "business_requirement": "./venture-state/MVP_SPEC.md",
313
+ "engineering_snapshot": "./global-state/ENGINEERING_SNAPSHOT.md",
314
+ "directive": "<derived from PIPELINE_RECOMMENDATION in snapshot>",
315
+ "engineering_signals": {
316
+ "symbol_count": "<n>",
317
+ "test_count": "<n>",
318
+ "stub_count": "<n>",
319
+ "missing_features": ["<f1>", "<f2>", "<f3>"],
320
+ "pipeline": "<genesis | pivot | ship_it>"
321
+ }
322
+ }
323
+ }
324
+ ```
325
+
326
+ ---
327
+
328
+ ## Anti-Patterns
329
+
330
+ | Anti-Pattern | Correct Behavior |
331
+ |---|---|
332
+ | Reading raw source files | Use ast-grep queries and `find`/`grep` only |
333
+ | Routing without engineering snapshot | Always run scan before first `SWARM_HANDOFF.json` |
334
+ | Guessing test count | Count via ast-grep test pattern queries |
335
+ | Issuing `SWARM_HANDOFF` with empty `engineering_signals` | Snapshot data must populate handoff context |
336
+ | Skipping delta scan after coder sprint | Re-run Steps 3-4 to update snapshot |
337
+
338
+ ---
339
+
340
+ ## Quick Reference: Signal → Pipeline Mapping
341
+
342
+ | Engineering State | Venture State | Recommended Pipeline |
343
+ |---|---|---|
344
+ | No code yet | No MVP spec | `genesis` — VOS → UI → Coders |
345
+ | Code exists, no tests, many stubs | MVP spec exists | `pivot` — Coders (debt clear) → Coders (build) |
346
+ | Code exists, tests passing | MVP spec exists | `ship_it` — UI critique → Coders (QA) |
347
+ | Code exists, stubs only | No MVP spec | `genesis` — VOS must define scope first |
348
+ | Code complete, spec coverage > 80% | MVP spec complete | `ship_it` — UI polish then deploy |
349
+
350
+ ---
351
+
352
+ ## Activation
353
+
354
+ This skill is called automatically during ACE boot. It can also be called explicitly:
355
+
356
+ **`ACE --mode boot --write-to ./global-state/ENGINEERING_SNAPSHOT.md`**
357
+
358
+ Or manually triggered by the Orchestrator at any time with:
359
+
360
+ **`ACE --mode delta`** — re-runs Steps 3 and 4 only (quality + alignment, no full census)
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: astgrep-index
3
+ description:
4
+ Build compact AST discovery indexes and routing hints for the current workspace. Use when ACE bootstrap, orchestration, or research needs structural discovery without loading raw file maps into context.
5
+ ---
6
+
7
+ # ASTGrep Index
8
+
9
+ Use this skill to refresh durable AST-level discovery artifacts before orchestration or research decisions depend on them.
10
+
11
+ ## Purpose
12
+
13
+ Replace broad file-dump discovery with compact, evidence-backed AST summaries that are safe to store and easy to reuse.
14
+
15
+ ## Canonical Use Cases
16
+
17
+ 1. `ace init` or a fresh workspace bootstrap needs structural discovery artifacts immediately after seeding `agent-state/`.
18
+ 2. Orchestrator or research flows need routing hints, top symbols, and hotspots without reading large file maps.
19
+ 3. A major refactor changed the workspace shape and the AST discovery index must be refreshed before the next planning pass.
20
+
21
+ ## Inputs
22
+
23
+ - `agent-state/AST_GREP_COMMANDS.md`
24
+ - `agent-state/TASK.md`
25
+ - `agent-state/SCOPE.md`
26
+ - Optional AST reference corpus such as `rep_astgrep.cxml`
27
+
28
+ ## Workflow
29
+
30
+ 1. Profile the requested scope using the command pack from `AST_GREP_COMMANDS.md`.
31
+ 2. Run symbol-surface and quality-signal queries for the active language mix.
32
+ 3. Summarize hotspots, top symbols, and routing hints instead of storing raw code or raw file dumps.
33
+ 4. Write both markdown and JSON discovery artifacts.
34
+ 5. Append an evidence anchor to `agent-state/EVIDENCE_LOG.md`.
35
+
36
+ ## Outputs
37
+
38
+ - `agent-state/AST_GREP_INDEX.md`
39
+ - `agent-state/AST_GREP_INDEX.json`
40
+ - An evidence entry linking the discovery run to the generated artifacts
41
+
42
+ ## Validation
43
+
44
+ - Verify both `agent-state/AST_GREP_INDEX.md` and `agent-state/AST_GREP_INDEX.json` are written during the same run.
45
+ - Verify the two artifacts agree on core metadata such as scope, generated timestamp, commands used, and summary findings.
46
+ - Verify `agent-state/EVIDENCE_LOG.md` contains an entry referencing both outputs.
47
+
48
+ ## Compatibility
49
+
50
+ - `SKILL.md` is the portable source of truth for the index workflow.
51
+ - The command pack is an input artifact, not a client-specific requirement.
52
+ - The skill should remain useful even when no extra reference corpus is available.
53
+
54
+ ## Failure Policy
55
+
56
+ - If the command pack is missing or ast-grep is unavailable, stop and surface the missing dependency explicitly.
57
+ - If the scope is too broad, narrow the scan instead of silently producing a low-signal index.
58
+ - Never dump raw file contents into the index artifacts; keep them summary-only and decision-oriented.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: codemunch
3
+ description:
4
+ Map an unfamiliar codebase into durable structural artifacts with ast-grep. Use when you need to understand, debug, contribute to, or borrow patterns from a codebase without broad raw-file reading.
5
+ ---
6
+
7
+ # CodeMunch
8
+
9
+ Use this skill to turn an unfamiliar codebase into a compact set of structural artifacts that downstream agents can trust.
10
+
11
+ ## Purpose
12
+
13
+ Extract architecture, public surface, relationships, and recurring patterns through AST-backed evidence so future work starts from a written map instead of ad-hoc memory.
14
+
15
+ ## Canonical Use Cases
16
+
17
+ 1. A team needs a codebase map before debugging, feature work, or onboarding into an unfamiliar repository.
18
+ 2. A contributor wants to identify the minimum insertion point for a change without reading large amounts of raw code first.
19
+ 3. An engineer wants reusable patterns, conventions, and hotspots distilled into durable artifacts for later handoff.
20
+
21
+ ## Inputs
22
+
23
+ - Target codebase path or repository checkout
24
+ - Goal or intent such as `understand`, `debug`, `contribute`, or `inspire`
25
+ - Project orientation artifacts like README, manifests, and existing `agent-state/` outputs when available
26
+ - ast-grep plus any language-specific patterns needed for the active language mix
27
+
28
+ ## Workflow
29
+
30
+ 1. Bootstrap language, build-system, and entry-point understanding with minimal orientation reads.
31
+ 2. Answer the Socratic question stack with ast-grep-backed evidence.
32
+ 3. Write the core structural artifacts: `CODEBASE_MAP.md`, `DEPENDENCY_GRAPH.md`, `PATTERNS.md`, `SOCRATIC_LOG.md`, and `EVIDENCE_LOG.md`.
33
+ 4. Produce a goal-specific synthesis artifact such as a contribution guide or bug hypothesis.
34
+ 5. Hand off from the written artifacts rather than from unwritten session memory.
35
+
36
+ ## Outputs
37
+
38
+ - `agent-state/CODEBASE_MAP.md`
39
+ - `agent-state/DEPENDENCY_GRAPH.md`
40
+ - `agent-state/PATTERNS.md`
41
+ - `agent-state/SOCRATIC_LOG.md`
42
+ - `agent-state/EVIDENCE_LOG.md`
43
+ - Optional goal-specific artifacts such as `CONTRIBUTION_GUIDE.md` or `BUG_HYPOTHESIS.md`
44
+
45
+ ## Validation
46
+
47
+ - Verify the core artifact set is written before any final synthesis or handoff occurs.
48
+ - Verify every structural claim in the synthesis can be traced back to an ast-grep-backed entry in `EVIDENCE_LOG.md`.
49
+ - Verify unanswered questions are recorded explicitly as known unknowns rather than guessed.
50
+
51
+ ## References
52
+
53
+ - `references/ast-driven-protocol.md` preserves the detailed Socratic stack, phase-by-phase command recipes, and advanced ast-grep cookbook.
54
+
55
+ ## Compatibility
56
+
57
+ - `SKILL.md` is the canonical portable contract for this skill.
58
+ - The long-form playbook lives under `references/` for progressive disclosure and must not redefine the top-level contract.
59
+ - The workflow should remain useful in any environment that can run ast-grep and basic shell discovery commands.
60
+
61
+ ## Failure Policy
62
+
63
+ - If ast-grep is unavailable or the language cannot be queried safely, stop and surface the limitation instead of pretending the structure is understood.
64
+ - If required artifacts were not written, treat the session as incomplete rather than summarizing from memory.
65
+ - Do not read large swaths of raw source just to compensate for missing structural evidence; mark the unknown and route accordingly.