@ambystech/ambykit 1.3.1 → 1.5.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 (310) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/README.md +8 -0
  3. package/dist/cli/activity.d.ts +5 -1
  4. package/dist/cli/activity.js +22 -8
  5. package/dist/cli/activity.js.map +1 -1
  6. package/dist/cli/add.js +12 -5
  7. package/dist/cli/add.js.map +1 -1
  8. package/dist/cli/analyze.js +68 -4
  9. package/dist/cli/analyze.js.map +1 -1
  10. package/dist/cli/base-command.js +6 -0
  11. package/dist/cli/base-command.js.map +1 -1
  12. package/dist/cli/check.js +18 -3
  13. package/dist/cli/check.js.map +1 -1
  14. package/dist/cli/dashboard.js +3 -1
  15. package/dist/cli/dashboard.js.map +1 -1
  16. package/dist/cli/directive.d.ts +7 -0
  17. package/dist/cli/directive.js +43 -0
  18. package/dist/cli/directive.js.map +1 -0
  19. package/dist/cli/fleet.d.ts +16 -0
  20. package/dist/cli/fleet.js +472 -0
  21. package/dist/cli/fleet.js.map +1 -0
  22. package/dist/cli/graph.d.ts +13 -0
  23. package/dist/cli/graph.js +40 -0
  24. package/dist/cli/graph.js.map +1 -0
  25. package/dist/cli/index.js +10 -0
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/cli/io/fsops.d.ts +4 -0
  28. package/dist/cli/io/fsops.js +62 -0
  29. package/dist/cli/io/fsops.js.map +1 -1
  30. package/dist/cli/mcp.d.ts +21 -0
  31. package/dist/cli/mcp.js +27 -0
  32. package/dist/cli/mcp.js.map +1 -0
  33. package/dist/cli/sync.d.ts +2 -0
  34. package/dist/cli/sync.js +31 -5
  35. package/dist/cli/sync.js.map +1 -1
  36. package/dist/cli/trace.d.ts +14 -0
  37. package/dist/cli/trace.js +89 -0
  38. package/dist/cli/trace.js.map +1 -0
  39. package/dist/cli/ui/dashboard/feature-chart.js +15 -2
  40. package/dist/cli/ui/dashboard/feature-chart.js.map +1 -1
  41. package/dist/cli/ui/dashboard/feature-view.js +11 -1
  42. package/dist/cli/ui/dashboard/feature-view.js.map +1 -1
  43. package/dist/cli/ui/dashboard/graph-view.d.ts +44 -0
  44. package/dist/cli/ui/dashboard/graph-view.js +78 -0
  45. package/dist/cli/ui/dashboard/graph-view.js.map +1 -0
  46. package/dist/cli/ui/dashboard/help-overlay.d.ts +1 -1
  47. package/dist/cli/ui/dashboard/help-overlay.js +9 -0
  48. package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
  49. package/dist/cli/ui/dashboard/quality-view.d.ts +8 -0
  50. package/dist/cli/ui/dashboard/quality-view.js +31 -0
  51. package/dist/cli/ui/dashboard/quality-view.js.map +1 -0
  52. package/dist/cli/ui/dashboard/story-detail.d.ts +1 -1
  53. package/dist/cli/ui/dashboard/story-detail.js +10 -3
  54. package/dist/cli/ui/dashboard/story-detail.js.map +1 -1
  55. package/dist/cli/ui/dashboard/tokens.d.ts +26 -0
  56. package/dist/cli/ui/dashboard/tokens.js +26 -0
  57. package/dist/cli/ui/dashboard/tokens.js.map +1 -1
  58. package/dist/cli/ui/interactive/overview.d.ts +13 -1
  59. package/dist/cli/ui/interactive/overview.js +62 -0
  60. package/dist/cli/ui/interactive/overview.js.map +1 -1
  61. package/dist/cli/ui/tool-options.d.ts +3 -2
  62. package/dist/cli/ui/tool-options.js +3 -3
  63. package/dist/cli/ui/tool-options.js.map +1 -1
  64. package/dist/cli/update.d.ts +1 -1
  65. package/dist/cli/update.js +8 -3
  66. package/dist/cli/update.js.map +1 -1
  67. package/dist/core/activity.d.ts +15 -2
  68. package/dist/core/activity.js +19 -4
  69. package/dist/core/activity.js.map +1 -1
  70. package/dist/core/analyze.d.ts +80 -2
  71. package/dist/core/analyze.js +200 -61
  72. package/dist/core/analyze.js.map +1 -1
  73. package/dist/core/checkouts.js +2 -0
  74. package/dist/core/checkouts.js.map +1 -1
  75. package/dist/core/config.d.ts +28 -1
  76. package/dist/core/config.js +44 -0
  77. package/dist/core/config.js.map +1 -1
  78. package/dist/core/dashboard.d.ts +4 -0
  79. package/dist/core/dashboard.js +5 -3
  80. package/dist/core/dashboard.js.map +1 -1
  81. package/dist/core/decisions.d.ts +60 -0
  82. package/dist/core/decisions.js +231 -0
  83. package/dist/core/decisions.js.map +1 -0
  84. package/dist/core/emit.d.ts +16 -1
  85. package/dist/core/emit.js +49 -5
  86. package/dist/core/emit.js.map +1 -1
  87. package/dist/core/features.js +6 -1
  88. package/dist/core/features.js.map +1 -1
  89. package/dist/core/fleet/claims.d.ts +45 -0
  90. package/dist/core/fleet/claims.js +85 -0
  91. package/dist/core/fleet/claims.js.map +1 -0
  92. package/dist/core/fleet/directives.d.ts +56 -0
  93. package/dist/core/fleet/directives.js +99 -0
  94. package/dist/core/fleet/directives.js.map +1 -0
  95. package/dist/core/fleet/flow-input.d.ts +6 -0
  96. package/dist/core/fleet/flow-input.js +35 -0
  97. package/dist/core/fleet/flow-input.js.map +1 -0
  98. package/dist/core/fleet/index.d.ts +9 -0
  99. package/dist/core/fleet/index.js +10 -0
  100. package/dist/core/fleet/index.js.map +1 -0
  101. package/dist/core/fleet/lane-status.d.ts +39 -0
  102. package/dist/core/fleet/lane-status.js +63 -0
  103. package/dist/core/fleet/lane-status.js.map +1 -0
  104. package/dist/core/fleet/lock.d.ts +23 -0
  105. package/dist/core/fleet/lock.js +103 -0
  106. package/dist/core/fleet/lock.js.map +1 -0
  107. package/dist/core/fleet/notes.d.ts +31 -0
  108. package/dist/core/fleet/notes.js +56 -0
  109. package/dist/core/fleet/notes.js.map +1 -0
  110. package/dist/core/fleet/run-flow.d.ts +157 -0
  111. package/dist/core/fleet/run-flow.js +205 -0
  112. package/dist/core/fleet/run-flow.js.map +1 -0
  113. package/dist/core/fleet/runs.d.ts +46 -0
  114. package/dist/core/fleet/runs.js +182 -0
  115. package/dist/core/fleet/runs.js.map +1 -0
  116. package/dist/core/fleet/types.d.ts +63 -0
  117. package/dist/core/fleet/types.js +11 -0
  118. package/dist/core/fleet/types.js.map +1 -0
  119. package/dist/core/graph-format.d.ts +51 -0
  120. package/dist/core/graph-format.js +99 -0
  121. package/dist/core/graph-format.js.map +1 -0
  122. package/dist/core/graph-paths.d.ts +27 -0
  123. package/dist/core/graph-paths.js +94 -0
  124. package/dist/core/graph-paths.js.map +1 -0
  125. package/dist/core/graph-scope.d.ts +7 -0
  126. package/dist/core/graph-scope.js +31 -0
  127. package/dist/core/graph-scope.js.map +1 -0
  128. package/dist/core/graph-types.d.ts +55 -0
  129. package/dist/core/graph-types.js +6 -0
  130. package/dist/core/graph-types.js.map +1 -0
  131. package/dist/core/graph.d.ts +14 -0
  132. package/dist/core/graph.js +144 -0
  133. package/dist/core/graph.js.map +1 -0
  134. package/dist/core/index.d.ts +13 -0
  135. package/dist/core/index.js +13 -0
  136. package/dist/core/index.js.map +1 -1
  137. package/dist/core/markers.d.ts +44 -0
  138. package/dist/core/markers.js +139 -0
  139. package/dist/core/markers.js.map +1 -0
  140. package/dist/core/merge-json.d.ts +15 -0
  141. package/dist/core/merge-json.js +46 -0
  142. package/dist/core/merge-json.js.map +1 -0
  143. package/dist/core/moved-targets.d.ts +23 -0
  144. package/dist/core/moved-targets.js +23 -0
  145. package/dist/core/moved-targets.js.map +1 -0
  146. package/dist/core/overview-types.d.ts +27 -1
  147. package/dist/core/overview-types.js.map +1 -1
  148. package/dist/core/overview.d.ts +1 -1
  149. package/dist/core/overview.js +91 -74
  150. package/dist/core/overview.js.map +1 -1
  151. package/dist/core/path-guard.d.ts +5 -0
  152. package/dist/core/path-guard.js +9 -0
  153. package/dist/core/path-guard.js.map +1 -0
  154. package/dist/core/paths.d.ts +2 -0
  155. package/dist/core/paths.js +4 -0
  156. package/dist/core/paths.js.map +1 -1
  157. package/dist/core/query.d.ts +91 -0
  158. package/dist/core/query.js +197 -0
  159. package/dist/core/query.js.map +1 -0
  160. package/dist/core/report.d.ts +36 -0
  161. package/dist/core/report.js +62 -0
  162. package/dist/core/report.js.map +1 -0
  163. package/dist/core/rules.js +3 -0
  164. package/dist/core/rules.js.map +1 -1
  165. package/dist/core/scaffold.d.ts +2 -2
  166. package/dist/core/scaffold.js +3 -1
  167. package/dist/core/scaffold.js.map +1 -1
  168. package/dist/core/subagents.d.ts +29 -0
  169. package/dist/core/subagents.js +52 -0
  170. package/dist/core/subagents.js.map +1 -0
  171. package/dist/core/tasks-edit.d.ts +34 -0
  172. package/dist/core/tasks-edit.js +115 -0
  173. package/dist/core/tasks-edit.js.map +1 -0
  174. package/dist/core/test-design.d.ts +94 -0
  175. package/dist/core/test-design.js +325 -0
  176. package/dist/core/test-design.js.map +1 -0
  177. package/dist/core/trace-cite.d.ts +16 -0
  178. package/dist/core/trace-cite.js +24 -0
  179. package/dist/core/trace-cite.js.map +1 -0
  180. package/dist/core/trace-coverage.d.ts +8 -0
  181. package/dist/core/trace-coverage.js +40 -0
  182. package/dist/core/trace-coverage.js.map +1 -0
  183. package/dist/core/trace-design.d.ts +6 -0
  184. package/dist/core/trace-design.js +16 -0
  185. package/dist/core/trace-design.js.map +1 -0
  186. package/dist/core/trace-io.d.ts +14 -0
  187. package/dist/core/trace-io.js +97 -0
  188. package/dist/core/trace-io.js.map +1 -0
  189. package/dist/core/trace-requirements.d.ts +9 -0
  190. package/dist/core/trace-requirements.js +27 -0
  191. package/dist/core/trace-requirements.js.map +1 -0
  192. package/dist/core/trace-tests.d.ts +7 -0
  193. package/dist/core/trace-tests.js +27 -0
  194. package/dist/core/trace-tests.js.map +1 -0
  195. package/dist/core/trace-types.d.ts +81 -0
  196. package/dist/core/trace-types.js +3 -0
  197. package/dist/core/trace-types.js.map +1 -0
  198. package/dist/core/trace.d.ts +18 -0
  199. package/dist/core/trace.js +109 -0
  200. package/dist/core/trace.js.map +1 -0
  201. package/dist/core/types.d.ts +43 -1
  202. package/dist/emitters/antigravity-cli.d.ts +4 -0
  203. package/dist/emitters/antigravity-cli.js +8 -0
  204. package/dist/emitters/antigravity-cli.js.map +1 -1
  205. package/dist/emitters/antigravity.d.ts +6 -0
  206. package/dist/emitters/antigravity.js +8 -0
  207. package/dist/emitters/antigravity.js.map +1 -1
  208. package/dist/emitters/base-emitter.d.ts +28 -0
  209. package/dist/emitters/base-emitter.js +41 -1
  210. package/dist/emitters/base-emitter.js.map +1 -1
  211. package/dist/emitters/claude.d.ts +12 -2
  212. package/dist/emitters/claude.js +34 -5
  213. package/dist/emitters/claude.js.map +1 -1
  214. package/dist/emitters/copilot-cli.d.ts +7 -1
  215. package/dist/emitters/copilot-cli.js +9 -0
  216. package/dist/emitters/copilot-cli.js.map +1 -1
  217. package/dist/emitters/copilot.d.ts +5 -0
  218. package/dist/emitters/copilot.js +23 -1
  219. package/dist/emitters/copilot.js.map +1 -1
  220. package/dist/emitters/cursor.d.ts +3 -0
  221. package/dist/emitters/cursor.js +8 -1
  222. package/dist/emitters/cursor.js.map +1 -1
  223. package/dist/emitters/index.d.ts +10 -3
  224. package/dist/emitters/index.js +6 -6
  225. package/dist/emitters/index.js.map +1 -1
  226. package/dist/emitters/opencode.d.ts +8 -0
  227. package/dist/emitters/opencode.js +23 -0
  228. package/dist/emitters/opencode.js.map +1 -1
  229. package/dist/index.d.ts +5 -0
  230. package/dist/index.js +4 -0
  231. package/dist/index.js.map +1 -1
  232. package/dist/mcp/protocol.d.ts +44 -0
  233. package/dist/mcp/protocol.js +114 -0
  234. package/dist/mcp/protocol.js.map +1 -0
  235. package/dist/mcp/registry.d.ts +40 -0
  236. package/dist/mcp/registry.js +44 -0
  237. package/dist/mcp/registry.js.map +1 -0
  238. package/dist/mcp/server.d.ts +7 -0
  239. package/dist/mcp/server.js +14 -0
  240. package/dist/mcp/server.js.map +1 -0
  241. package/dist/mcp/tools/common.d.ts +12 -0
  242. package/dist/mcp/tools/common.js +12 -0
  243. package/dist/mcp/tools/common.js.map +1 -0
  244. package/dist/mcp/tools/fleet.d.ts +10 -0
  245. package/dist/mcp/tools/fleet.js +102 -0
  246. package/dist/mcp/tools/fleet.js.map +1 -0
  247. package/dist/mcp/tools/index.d.ts +3 -0
  248. package/dist/mcp/tools/index.js +13 -0
  249. package/dist/mcp/tools/index.js.map +1 -0
  250. package/dist/mcp/tools/read.d.ts +6 -0
  251. package/dist/mcp/tools/read.js +62 -0
  252. package/dist/mcp/tools/read.js.map +1 -0
  253. package/dist/mcp/tools/write.d.ts +6 -0
  254. package/dist/mcp/tools/write.js +34 -0
  255. package/dist/mcp/tools/write.js.map +1 -0
  256. package/dist/plugins/api.d.ts +39 -0
  257. package/dist/plugins/api.js +28 -0
  258. package/dist/plugins/api.js.map +1 -0
  259. package/dist/plugins/index.d.ts +11 -0
  260. package/dist/plugins/index.js +9 -0
  261. package/dist/plugins/index.js.map +1 -0
  262. package/dist/plugins/loader.d.ts +35 -0
  263. package/dist/plugins/loader.js +117 -0
  264. package/dist/plugins/loader.js.map +1 -0
  265. package/dist/plugins/manifest.d.ts +21 -0
  266. package/dist/plugins/manifest.js +53 -0
  267. package/dist/plugins/manifest.js.map +1 -0
  268. package/dist/plugins/registry.d.ts +36 -0
  269. package/dist/plugins/registry.js +30 -0
  270. package/dist/plugins/registry.js.map +1 -0
  271. package/dist/plugins/report.d.ts +9 -0
  272. package/dist/plugins/report.js +19 -0
  273. package/dist/plugins/report.js.map +1 -0
  274. package/dist/plugins/semver.d.ts +23 -0
  275. package/dist/plugins/semver.js +106 -0
  276. package/dist/plugins/semver.js.map +1 -0
  277. package/dist/plugins/session.d.ts +18 -0
  278. package/dist/plugins/session.js +22 -0
  279. package/dist/plugins/session.js.map +1 -0
  280. package/dist/testkit/contract.d.ts +33 -0
  281. package/dist/testkit/contract.js +118 -0
  282. package/dist/testkit/contract.js.map +1 -0
  283. package/dist/testkit/index.d.ts +15 -0
  284. package/dist/testkit/index.js +15 -0
  285. package/dist/testkit/index.js.map +1 -0
  286. package/docs/architecture.md +33 -5
  287. package/docs/artifacts/decision-record.md +54 -0
  288. package/docs/artifacts/tasks.md +37 -0
  289. package/docs/artifacts/tests.md +43 -0
  290. package/docs/cli-reference.md +178 -5
  291. package/docs/concepts/mcp-server.md +93 -0
  292. package/docs/contributing.md +9 -0
  293. package/docs/index.md +1 -1
  294. package/docs/plugin-api.md +124 -0
  295. package/docs/plugin-split.md +55 -0
  296. package/docs/plugin-trust.md +51 -0
  297. package/docs/tool-compatibility.md +54 -6
  298. package/docs/workflow.md +37 -5
  299. package/package.json +5 -2
  300. package/src/agents/worker.md +37 -0
  301. package/src/prompts/converge.md +8 -3
  302. package/src/prompts/decide.md +31 -0
  303. package/src/prompts/implement.md +15 -7
  304. package/src/prompts/revise.md +4 -2
  305. package/src/prompts/run.md +100 -0
  306. package/src/prompts/tasks.md +13 -3
  307. package/src/roles/security.md +17 -0
  308. package/src/templates/adr.md +29 -0
  309. package/src/templates/tasks.md +6 -0
  310. package/src/templates/tests.md +29 -0
@@ -0,0 +1,93 @@
1
+ # AmbyKit as an MCP server
2
+
3
+ `ambykit mcp` serves a few small tools over the Model Context Protocol (stdio), so an assistant can ask
4
+ for **state** (the next task, a story's blockers) instead of reading `tasks.md` and the spec, and can
5
+ change state through **one validated path** instead of editing files by hand. It runs locally, uses zero
6
+ model tokens, and is **opt-in**: nothing changes until you turn it on, and every phase prompt still works
7
+ from files when the server is absent.
8
+
9
+ ## Turning it on
10
+
11
+ Set it in `.amby/config.json` and run `ambykit sync`:
12
+
13
+ ```json
14
+ { "tools": ["claude"], "mcp": { "enabled": true } }
15
+ ```
16
+
17
+ `sync` then adds one entry, `ambykit`, to each enabled assistant's MCP config, keeping every other key and
18
+ server in that file as you wrote it (the file is backed up under `.amby/backups/` before it changes). The
19
+ server is started as `ambykit mcp`, so `ambykit` must be on your `PATH`; AmbyKit never writes an `npx` fetch.
20
+
21
+ Only formats confirmed in the vendor's documentation are written (sources in
22
+ `specs/025-mcp-server/research.md`, rows in [`tool-compatibility.md`](../tool-compatibility.md)):
23
+
24
+ | Assistant | File | Written |
25
+ |---|---|---|
26
+ | Claude Code | `.mcp.json` (`mcpServers`) | with `mcp.enabled` |
27
+ | Copilot (VS Code) | `.vscode/mcp.json` (`servers`) | with `mcp.enabled` |
28
+ | Cursor and Cursor CLI | `.cursor/mcp.json` (`mcpServers`) | with `mcp.enabled` |
29
+ | Antigravity CLI | `.agents/mcp_config.json` (`mcpServers`) | with `mcp.enabled` |
30
+ | Copilot CLI | `~/.copilot/mcp-config.json` (user level) | only with `ambykit sync --include-user`; never part of `sync --check` |
31
+ | OpenCode, Antigravity IDE, Codex and the rest | — | **not written**; `sync` names each one and why |
32
+
33
+ A config file that is not plain JSON (comments, trailing commas) is left untouched and reported.
34
+
35
+ ## The tools
36
+
37
+ All inputs are validated and published through `tools/list`. `feature` is the number (`025`) or the
38
+ directory name. Failures are `{ "error": … }` naming what was not found.
39
+
40
+ | Tool | What it returns or does |
41
+ |---|---|
42
+ | `next_task` | The next unchecked task whose story is not blocked and that is not marked BLOCKED: `{ id, text, paths[], story }`, or `{ none }` |
43
+ | `story_status` | `{ story, status, priority, blockers[] }` from the dependency graph |
44
+ | `lane_tasks` | A lane's tasks and checked state, capped at 40 |
45
+ | `lane_status` | A lane's state, whether it is **stalled**, and its directive |
46
+ | `analyze_report` | The findings of `ambykit analyze`, sliced to a feature and capped |
47
+ | `tick_task` | Checks off one task (one changed line); releases that task's file claims |
48
+ | `set_story_status` | Sets one story's status; refuses values outside `draft ready in-progress blocked done` |
49
+ | `report_activity` | Records what the assistant is doing; returns a directive. Never fails the agent |
50
+ | `claim_file` | Claims files for a task; refused, naming the owner, when another worker holds an overlapping path |
51
+ | `post_note` | Posts one `T### \| files \| text` line to the run's notes board |
52
+
53
+ An answer to `next_task` or `story_status` is under 1 KB.
54
+
55
+ ## Reporting and directives
56
+
57
+ A worker reports at the start of a task, at the end of a task, and whenever it is blocked or waiting. It
58
+ never reports on a timer and never reports progress. The reply carries a **directive** for its lane:
59
+ `continue`, `pause` or `stop`. On `pause` or `stop` the worker finishes the task it is on, then obeys at its
60
+ next report.
61
+
62
+ Any host can steer a lane through the same single writer:
63
+
64
+ ```bash
65
+ ambykit directive 025 lane-1-1 pause # or resume (writes continue) / stop
66
+ ```
67
+
68
+ A directive status is derived, never stored: **pause requested**, **paused**, **pending** or **obeyed**.
69
+
70
+ ## Runs and fleet state
71
+
72
+ Directives, claims, notes and the run record live in the **primary checkout** under
73
+ `.amby/fleet/<run>/` (git-ignored), so every lane worktree sees the same files. A run `<feature>.<n>` is
74
+ created only on explicit request; there is no implicit run. A report with no run still records the
75
+ activity marker and comes back with a warning, never a failure; with several unfinished runs the warning
76
+ names them and you pass `run`.
77
+
78
+ `fleet` in `.amby/config.json` holds the shared settings (defaults shown):
79
+
80
+ ```json
81
+ { "fleet": { "stallMinutes": 15, "restartLimit": 2, "concurrency": { "total": 3, "perType": 2 }, "roundLimit": 3 } }
82
+ ```
83
+
84
+ A lane is **stalled** when its state is `working` and it has made neither a report nor a change to its
85
+ `tasks.md` for `stallMinutes`. That limit is the fleet's own and is independent of the dashboard's idle limit.
86
+
87
+ ## Safety
88
+
89
+ - Edits are patches: `tick_task` and `set_story_status` change one line under a lockfile, re-parse the
90
+ result with the same parsers every other command uses, and refuse anything that would not read back.
91
+ - The server speaks the protocol on stdout only; diagnostics go to stderr.
92
+ - It supports the `initialize` handshake of the 2024-11-05 to 2025-11-25 revisions and the handshake-free
93
+ 2026-07-28 revision (`server/discover`).
@@ -48,3 +48,12 @@ run `ambykit sync` and include the regenerated files in your commit.
48
48
 
49
49
  - Keep changes small and focused; update docs and the compatibility matrix alongside code.
50
50
  - Ensure `npm run typecheck` and `npm test` pass before opening a PR.
51
+
52
+ ## Release checklist
53
+
54
+ - Move the `[Unreleased]` entries in `CHANGELOG.md` under the new version and bump `package.json`.
55
+ - **Plugins:** state in the changelog whether plugins are affected. A change to anything in
56
+ [`plugin-api.md`](./plugin-api.md) (extension points, the `PluginApi`, the matrix-row shape, the
57
+ `ambykit.pluginApi` range, `PLUGIN_API_VERSION`) gets a line starting `[plugin-api]`; otherwise write
58
+ "Plugins: not affected." If the API changed incompatibly, bump `PLUGIN_API_VERSION`.
59
+ - Run `npm run typecheck`, `npm test` and `ambykit sync --check`.
package/docs/index.md CHANGED
@@ -25,7 +25,7 @@ native format — Claude Code, OpenCode, GitHub Copilot (VS Code + CLI), Cursor
25
25
  ## Read next
26
26
 
27
27
  - [Getting started](./getting-started.md) — install and run your first feature.
28
- - [The workflow](./workflow.md) — the eleven phases in order.
28
+ - [The workflow](./workflow.md) — the twelve phases in order.
29
29
  - Concepts: [Spec-Driven Development](./concepts/spec-driven-development.md) ·
30
30
  [The constitution](./concepts/constitution.md)
31
31
  - Artifacts: [spec](./artifacts/spec.md) · [UI design](./artifacts/ui-design.md) ·
@@ -0,0 +1,124 @@
1
+ # Plugin API (experimental)
2
+
3
+ > **Experimental in 1.6.** The API may change in minor releases until it is frozen at 2.0. Plugins say
4
+ > which API range they support, and AmbyKit refuses a plugin outside it. Read
5
+ > [`plugin-trust.md`](./plugin-trust.md) before you install one: a plugin is code that runs on your
6
+ > machine.
7
+
8
+ A plugin adds **emitter targets**: a new assistant that `ambykit sync` writes native command files for.
9
+ Roles, phases and templates are not extensible yet (they ship in a later 1.x release).
10
+
11
+ ## What a plugin is
12
+
13
+ An npm package named `ambykit-emitter-<name>` (a scope is fine: `@acme/ambykit-emitter-foo`) whose
14
+ default export is a **factory**:
15
+
16
+ ```js
17
+ export default function (api) {
18
+ class MyEmitter extends api.BaseEmitter {
19
+ toolId = "mytool";
20
+ displayName = "My tool";
21
+ commandSurface = "commands";
22
+ commandDir = ".mytool/commands";
23
+ commandFrontmatter(spec) {
24
+ return [["description", this.yamlQuote(spec.description)]];
25
+ }
26
+ }
27
+ return { targets: [{ id: "mytool", displayName: "My tool", emitter: new MyEmitter() }] };
28
+ }
29
+ ```
30
+
31
+ The factory receives the **extension points** (below), so your classes always extend the running copy of
32
+ AmbyKit, never a second install next to your package. A plain object `{ targets: [...] }` is also
33
+ accepted; it cannot subclass anything, so it is only useful for an emitter written from scratch. A
34
+ working example with all three extension points is in
35
+ [`examples/ambykit-emitter-example/`](../examples/ambykit-emitter-example/).
36
+
37
+ `package.json` must carry the range of plugin API versions the plugin supports:
38
+
39
+ ```json
40
+ { "name": "ambykit-emitter-mytool", "version": "1.0.0", "type": "module",
41
+ "ambykit": { "pluginApi": "^1" },
42
+ "peerDependencies": { "@ambystech/ambykit": ">=1.6.0" } }
43
+ ```
44
+
45
+ The current API version is `1.0.0` (`PLUGIN_API_VERSION`). A plugin whose range does not contain it is
46
+ refused, and the message names the range it asked for and the version found. Ranges may use an exact
47
+ version, `^`, `~`, `>=`, `>`, `<=`, `<`, spaces (AND) and `||` (OR); anything else is refused.
48
+
49
+ ## Extension points
50
+
51
+ Import from `@ambystech/ambykit/plugin`, or take them from the factory's `api` argument.
52
+
53
+ - `BaseEmitter` — the shared emit logic. Set `toolId`, `displayName`, `commandSurface`, `commandDir`
54
+ and override only what differs: `commandFrontmatter`, `commandFileName`, `commandFilePath`,
55
+ `renderCommand`, `transformBody`, `generatedNotice`, `rulesFiles`, `roleFiles`.
56
+ - `SkillsEmitter` — for hosts whose commands are skills: one `<commandDir>/<name>/SKILL.md` per phase
57
+ with `name` and `description`.
58
+ - `TomlCommandEmitter` — for hosts whose commands are TOML: `description` and a multi-line `prompt`.
59
+ - `skillName`, `skillPath`, `skillFrontmatter` — the skills helpers, for an emitter that cannot extend
60
+ `SkillsEmitter`.
61
+ - `tomlBasic`, `tomlPrompt` — TOML string helpers.
62
+ - `PLUGIN_API_VERSION`, `PLUGIN_API_EXPERIMENTAL` — the API version and the experimental flag.
63
+
64
+ Types: `TargetDef`, `CommandSpec`, `CommandSurface`, `EmittedFile`, `RulesContext`, `Role`,
65
+ `PluginModule`, `PluginFactory`, `PluginApi`.
66
+
67
+ ## Options and guarantees
68
+
69
+ - **A target** is `{ id, displayName, emitter }`. `id` is what a person writes in `tools`. It must not
70
+ equal a built-in target's id or another plugin's; if it does, the plugin target is reported and **not
71
+ registered** (nothing is overridden).
72
+ - **Shape, not class.** AmbyKit checks an emitter has `toolId`, `displayName`, `commandSurface`
73
+ (`commands`, `skills`, `workflows` or `none`), `commandDir` and an `emit` function. It never uses
74
+ `instanceof`.
75
+ - **Files stay in the project.** Every `scope: "project"` file path must be relative and stay inside the
76
+ project root (no absolute path, no drive letter, no `..`); otherwise the whole sync fails and names the
77
+ plugin. A `scope: "user"` file (under the home directory) is written only with
78
+ `ambykit sync --include-user` and is never part of `sync --check`.
79
+ - **Deterministic output.** A second `sync` over the same plugins writes nothing. Do not put timestamps
80
+ or random values in emitted files.
81
+ - **Output collisions.** Two targets writing one path must write identical bytes, or the sync fails
82
+ naming both owners (and their plugins).
83
+ - **Failures are isolated.** A plugin that is missing, mis-pinned, out of range, malformed or throws on
84
+ load is reported with a reason; the other targets still sync, and `sync` exits 1.
85
+ - **What AmbyKit prints.** On every `sync`, each loaded plugin as `name@version` and a note that the
86
+ API is experimental.
87
+
88
+ ## Using a plugin
89
+
90
+ 1. `npm install --save-exact ambykit-emitter-mytool` in the project (it must be in the project's own
91
+ `node_modules`: nothing is searched in parent folders or globally).
92
+ 2. List it with the **exact** installed version in `.amby/config.json`, and add its target:
93
+
94
+ ```json
95
+ { "tools": ["claude", "mytool"], "plugins": { "ambykit-emitter-mytool": "1.0.0" } }
96
+ ```
97
+
98
+ 3. `ambykit sync`.
99
+
100
+ An unlisted package is never loaded, and a version that differs from the pin is refused.
101
+
102
+ ## Testing a plugin
103
+
104
+ `@ambystech/ambykit/testkit` checks an emitter against a **matrix row** (the host's documented paths and
105
+ frontmatter keys). See [`tool-compatibility.md`](./tool-compatibility.md#matrix-rows-for-plugins).
106
+
107
+ ```js
108
+ import { readFileSync } from "node:fs";
109
+ import { assertEmitterContract, createPluginApi } from "@ambystech/ambykit/testkit";
110
+ import factory from "./index.js";
111
+
112
+ const rows = JSON.parse(readFileSync(new URL("./matrix-rows.json", import.meta.url), "utf8"));
113
+ const { targets } = factory(createPluginApi());
114
+ for (const target of targets) assertEmitterContract(target, rows.find((r) => r.target === target.id));
115
+ ```
116
+
117
+ `assertEmitterContract(target, row)` (a row is a plain object, see below) throws one error listing every difference, so it works under any
118
+ test runner; `checkEmitterContract` returns them as a list. With no row, the check fails: a plugin
119
+ without a documented row for its host cannot pass.
120
+
121
+ ## Stability
122
+
123
+ - 1.6: experimental; `[plugin-api]` entries in `CHANGELOG.md` say whether a release affects plugins.
124
+ - 2.0: frozen under semver. A breaking change then needs a new major plugin API version.
@@ -0,0 +1,55 @@
1
+ # Core versus plugin: the target split
2
+
3
+ Which assistants stay in AmbyKit's core and which could become official plugins
4
+ (feature 027, FR-013). **No target is removed from the core in 1.6.** The plugin API ships first
5
+ ([`plugin-api.md`](./plugin-api.md)); this page records the evidence the 2.0 gate review uses to decide
6
+ what to extract (SC-007). If a target does move, the mechanism for telling a project is already in
7
+ `ambykit sync` (`src/core/moved-targets.ts`); nothing it wrote is deleted.
8
+
9
+ **Rule used for the starting classification** (plan open decision 3): the families the roadmap names
10
+ (Claude, Copilot, Cursor, OpenCode, Codex, Antigravity) are *built in*, and so are their sibling targets
11
+ (VS Code and CLI variants, and Pi, which reuses Codex's output). The later additions are *plugin
12
+ candidates*: Gemini CLI, LLxprt Code, Qwen Code, Kilo Code, Augment Code, Windsurf and Kiro.
13
+
14
+ ## The 18 targets
15
+
16
+ Churn is measured from git history of the target's emitter source file as of 2026-11-16: commits that
17
+ touched the file, the date it was added and the date of the last change. It counts **our own** edits too
18
+ (worker agents, MCP files, the skills surface), so it is an upper bound on upstream format churn, not a
19
+ count of it. Aliases share their parent's file.
20
+
21
+ | Target | Emitter | Status | Churn: commits · added · last change | Demand evidence |
22
+ |---|---|---|---|---|
23
+ | `claude` | `claude.ts` | built in | 8 · 2026-07-07 · 2026-11-16 | not collected |
24
+ | `claude-vscode` | alias of `claude` | built in (sibling) | same file as `claude` | not collected |
25
+ | `copilot` | `copilot.ts` | built in | 7 · 2026-07-07 · 2026-11-16 | not collected |
26
+ | `copilot-cli` | `copilot-cli.ts` | built in (sibling) | 4 · 2026-07-07 · 2026-11-16 | not collected |
27
+ | `opencode` | `opencode.ts` | built in | 5 · 2026-07-07 · 2026-11-16 | not collected |
28
+ | `cursor` | `cursor.ts` | built in | 4 · 2026-07-07 · 2026-11-16 | not collected |
29
+ | `cursor-cli` | `cursor-cli.ts` | built in (sibling) | 1 · 2026-07-07 · 2026-07-07 | not collected |
30
+ | `antigravity` | `antigravity.ts` | built in | 4 · 2026-07-07 · 2026-11-16 | not collected |
31
+ | `antigravity-cli` | `antigravity-cli.ts` | built in (sibling) | 3 · 2026-07-07 · 2026-11-16 | not collected |
32
+ | `codex` | `codex.ts` | built in | 2 · 2026-07-13 · 2026-11-03 | not collected |
33
+ | `gemini` | `gemini.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
34
+ | `llxprt` | `llxprt.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
35
+ | `qwen` | `qwen.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
36
+ | `kilo` | `kilo.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
37
+ | `augment` | `augment.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
38
+ | `windsurf` | `windsurf.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
39
+ | `kiro` | `kiro.ts` | plugin candidate | 1 · 2026-11-03 · 2026-11-03 | not collected |
40
+ | `pi` | alias of `codex` | built in (sibling) | same file as `codex` | not collected |
41
+
42
+ ## Demand evidence is a gap
43
+
44
+ AmbyKit has no usage telemetry (Principle 7), so **no demand evidence exists yet**. Before the 2.0 gate,
45
+ collect what can be collected without tracking people: issues and discussions naming each assistant,
46
+ requests for a new target, and (for any official plugin) the plugin's own package downloads. Record the
47
+ figures in the column above with the date and source; a row with no evidence stays *built in*.
48
+
49
+ ## Reviewing at the 2.0 gate
50
+
51
+ 1. Update the churn column from git history, and separate upstream format changes from our own edits.
52
+ 2. Fill the demand column and the date it was read.
53
+ 3. A candidate moves only if its churn is mostly upstream and its demand is low. Moving means: publish
54
+ the plugin, add its entry to `MOVED_TARGETS`, drop it from `TARGETS`, and record it in the changelog
55
+ with a `[plugin-api]` line.
@@ -0,0 +1,51 @@
1
+ # Plugin trust
2
+
3
+ > The plugin API is **experimental** in 1.6 (see [`plugin-api.md`](./plugin-api.md)). **There is no
4
+ > sandbox.** A plugin is JavaScript that runs inside `ambykit sync` with your permissions. Install one
5
+ > only if you would run its author's code.
6
+
7
+ ## What AmbyKit does to keep this safe
8
+
9
+ - **Nothing is discovered.** A package loads only when it is named in `.amby/config.json` under
10
+ `plugins`. Installing one does not enable it, and a package that happens to be in `node_modules` is
11
+ never imported.
12
+ - **Exact pins.** Each entry is `"package name": "x.y.z"`. A range, a tag, an empty value or anything
13
+ that is not an exact version is refused before any file of the package is read.
14
+ - **Installed version = pin.** If `node_modules/<package>/package.json` is not exactly the pinned
15
+ version, the plugin is refused. Upgrading is a deliberate edit to the pin, reviewed like any change.
16
+ - **One place to look.** Only `<project>/node_modules/<package>` is searched. A copy in a parent folder,
17
+ a global install or `NODE_PATH` is ignored, so the same config loads the same code on every machine
18
+ or fails loudly.
19
+ - **Named.** Every `sync` and `check` prints each loaded plugin as `name@version`.
20
+ - **Names are constrained.** Only packages named `ambykit-emitter-*` (optionally scoped) are accepted.
21
+ - **Failures are contained.** A plugin that is missing, out of range, malformed or throws on load is
22
+ reported by name; the other targets still sync, and the run exits 1 so CI notices.
23
+
24
+ ## What a plugin can and cannot do
25
+
26
+ A plugin **can** run any code Node can run (read and write files, use the network, spawn processes) at
27
+ the moment it is loaded and while it emits. Nothing prevents that.
28
+
29
+ AmbyKit **does** limit what it will *write on a plugin's behalf*:
30
+
31
+ - Files a plugin asks AmbyKit to write must be **inside the project**. A path that is absolute, has a
32
+ drive letter or contains `..` fails the whole sync and names the plugin.
33
+ - A file in the **home directory** (`scope: "user"`) is written only when you run
34
+ `ambykit sync --include-user`. That flag is the recorded consent, it is per run, and those files are
35
+ never part of `sync --check`.
36
+ - A plugin cannot replace a built-in target or another plugin's target: a clash is reported and the
37
+ later target is not registered.
38
+ - Two targets writing the same path must write identical bytes, or the sync fails naming both plugins.
39
+
40
+ ## Before you install a plugin
41
+
42
+ 1. Read its source or trust its maintainers; check the repository and the published tarball.
43
+ 2. Install with `npm install --save-exact` so the version in `package.json` is the one you pin.
44
+ 3. Copy that exact version into `plugins` in `.amby/config.json`.
45
+ 4. Re-read the diff when you change the pin.
46
+
47
+ ## Reporting a problem
48
+
49
+ A plugin that writes where it should not, or runs code you did not expect, is a bug in the plugin;
50
+ report it to its author. If AmbyKit loads something that is not listed and exactly pinned, that is a bug
51
+ in AmbyKit; please open an issue.
@@ -40,8 +40,10 @@ Several targets share one emitter's output (why `BaseEmitter` + thin subclasses
40
40
  | Args placeholder | `$ARGUMENTS`, `$N`, `$name` | `$ARGUMENTS`, `$1` | `${input:x}` | — | prompt text | — | none — reworded as prose (as Codex) | none — trailing free text only (AmbyKit reworks `$ARGUMENTS` into prose) |
41
41
  | Agents | `.claude/agents/*.md` | `.opencode/agents/*.md` | `.github/agents/*.agent.md` | `.github/agents/*.agent.md` | UI modes (no file) | — | none (SDK only) | none (skills only) |
42
42
  | Agent frontmatter | `name`*, `description`*, `tools`, `model` (body = system prompt) | `description`* (+`mode`, `permission`; filename = id) | `description`*, `name`, `tools` | same as Copilot VS Code | — | — | — | — |
43
- | MCP file | `.mcp.json` | `opencode.json` → `mcp` | `.vscode/mcp.json` | `~/.copilot/mcp-config.json` (user) | `.cursor/mcp.json` | reads `.cursor/mcp.json` | `mcp_config.json` (user) | `.codex/config.toml` (TOML) — **out of scope**, AmbyKit does not write it |
44
- | MCP top-level key | (per-server `type`) | `mcp` | `servers` | `mcpServers` | `mcpServers` | — | `mcpServers` | `mcp_servers.<id>` (not written) |
43
+ | Subagents for `/amby.run` (019) | **confirmed**: the emitted `amby-*` agents are spawnable in a live Claude Code session (checked 2026-11-16); `amby-worker` is emitted at `.claude/agents/amby-worker.md` with `tools` incl. Write/Edit/Bash and `model` from `fleet.workerModel` | unconfirmed: format documented, `amby-worker` emitted at `.opencode/agents/` (no `model`), not run live | unconfirmed: `amby-worker` emitted at `.github/agents/amby-worker.agent.md`, not run live | unconfirmed (shares the Copilot file) | none (UI modes only) | none | none (SDK only) | none (skills only) |
44
+ | MCP file | `.mcp.json` | `opencode.json` — **not written** (two incompatible schemas; see `specs/025-mcp-server/research.md`) | `.vscode/mcp.json` | `~/.copilot/mcp-config.json` (user) | `.cursor/mcp.json` | reads `.cursor/mcp.json` | **not written** for the IDE (the CLI uses `.agents/mcp_config.json`, project) | `.codex/config.toml` (TOML) — **out of scope**, AmbyKit does not write it |
45
+ | MCP top-level key | `mcpServers` | `mcp` or `mcp.servers` (by version) | `servers` | `mcpServers` | `mcpServers` | `mcpServers` (shared file) | `mcpServers` | `mcp_servers.<id>` (not written) |
46
+ | MCP entry shape | `{type:"stdio",command,args}` | — | `{type:"stdio",command,args}` | `{type:"local",command,args,tools:["*"]}` (`tools` required) | `{type:"stdio",command,args}` | same as Cursor | `{command,args}` | — |
45
47
  | AGENTS.md native | No (bridge) | Yes | Yes (opt-in) | Yes | Yes | Yes | Yes | Yes |
46
48
 
47
49
  ## Matrix — additional targets (feature 016)
@@ -58,6 +60,7 @@ documented surfaces are emitted (Principle 4).
58
60
  | Command name | path under the dir, `/` ⇒ `:`; dots kept | as Gemini | as Gemini; dots kept | filename | filename; subdir ⇒ `:` | filename | directory name | invoked `/skill:<name>` |
59
61
  | AGENTS.md native | No (opt-in via `context.fileName`) | No (`contextFileName`) | Yes per source; the docs page still says `QWEN.md` only | Yes | Yes | Yes | Yes | Yes (also `CLAUDE.md`) |
60
62
  | Agents/personas | not emitted | not emitted | not emitted | not emitted | not emitted | not emitted | not emitted | not emitted |
63
+ | Subagents for `/amby.run` (019) | none (no documented file format) | none (`/subagent save` only) | none | none | none | none | none | none (shares the Codex output) |
61
64
  | Sources | github.com/google-gemini/gemini-cli (docs/cli/custom-commands.md, gemini-md.md) | github.com/vybestack/llxprt-code (docs/cli/commands.md, configuration.md) | qwenlm.github.io/qwen-code-docs (features/commands); github.com/QwenLM/qwen-code | kilo.ai/docs (customize/workflows, agents-md) | docs.augmentcode.com/cli (custom-commands, rules) | docs.devin.ai/desktop/cascade (workflows, memories) | kiro.dev/docs (skills, steering) | github.com/earendil-works/pi (packages/coding-agent/docs/skills.md) |
62
65
 
63
66
  **Gemini and LLxprt (TOML).** The prompt is a TOML literal multi-line string (`'''…'''`), so
@@ -78,6 +81,15 @@ identical and written once. Its activity self-report says `codex`.
78
81
  skill). This is documented, not suppressed. Augment also reads `.claude/commands/`; the names are
79
82
  identical and `.augment/` takes precedence, so Claude plus Augment yields no duplicates.
80
83
 
84
+ **Subagents (feature 019).** `/amby.run` delegates to a write-capable `amby-worker` and to the read-only
85
+ `amby-qa` and `amby-architect` personas. The per-target table is `src/core/subagents.ts`; only a target
86
+ confirmed on a live install counts as supported (Principle 4), every other target gets the same prompt with
87
+ `$SUBAGENTS` = `no`, so the lead does the worker, QA and review steps itself in sequence from the same state
88
+ files. Claude Code is confirmed (the `amby-*` agents from feature 013 are spawnable in a live session, and the
89
+ worker uses the same documented frontmatter plus write tools); the first live run of `amby-worker` from
90
+ `/amby.run` is the 019 dogfood gate. Only Claude documents a `model` key for agent files, so
91
+ `fleet.workerModel` is applied there and ignored elsewhere.
92
+
81
93
  ### Status notes (checked 2026-11-04)
82
94
 
83
95
  - **Gemini CLI** is being transitioned to Antigravity CLI. Since 2026-06-18 it no longer serves free
@@ -119,10 +131,14 @@ identical and `.augment/` takes precedence, so Claude plus Augment yields no dup
119
131
  - **Rules files are merged, not overwritten.** Every rules file wraps AmbyKit's content in a
120
132
  `### AmbyKit usage` section so it can be spliced into a file the user already authored; only that
121
133
  section is AmbyKit's. (Command/prompt/skill/workflow files remain fully generated and overwritten.)
122
- - **MCP top-level key differs**: `servers` (Copilot VS Code) vs `mcpServers` (Cursor, Copilot CLI,
123
- Antigravity) vs `mcp` (OpenCode) vs per-server `type` blocks (Claude `.mcp.json`).
124
- - **MCP scope differs**: Copilot CLI and Antigravity use **user-level** files outside the repo — AmbyKit
125
- writes these only with explicit consent and excludes them from the "repo in sync" check.
134
+ - **MCP top-level key differs**: `servers` (Copilot VS Code) vs `mcpServers` (Claude `.mcp.json`, Cursor,
135
+ Copilot CLI, Antigravity) vs `mcp` / `mcp.servers` (OpenCode, version-dependent, not written). Copilot CLI's
136
+ entry needs `type: "local"` and `tools`; the others use `type: "stdio"` (Antigravity has none).
137
+ - **MCP scope differs**: Copilot CLI uses a **user-level** file outside the repo, and the Antigravity IDE's
138
+ documented global file is user-level too. AmbyKit writes the Copilot CLI file only with explicit consent
139
+ (`--include-user`), never writes the Antigravity IDE's, and excludes user files from the "repo in sync"
140
+ check. Antigravity CLI has a project file, `.agents/mcp_config.json`. Verified shapes and sources are in
141
+ `specs/025-mcp-server/research.md`.
126
142
  - **Scoped-instruction key differs**: Copilot `applyTo` vs Cursor `globs` (+ `alwaysApply`).
127
143
  - **Command surface differs**: Copilot CLI has no `.prompt.md`; phases map to `SKILL.md`. Antigravity
128
144
  now uses skills (`.agents/skills/<name>/SKILL.md`); workflows (`.agents/workflows/*.md`, with a
@@ -198,3 +214,35 @@ and docs.github.com/copilot · Cursor: cursor.com/docs · Antigravity: antigravi
198
214
  Google Cloud blog. Codex CLI: developers.openai.com/codex (skills, custom prompts, config reference,
199
215
  AGENTS.md guide). Gemini CLI, LLxprt, Qwen Code, Kilo, Augment, Windsurf, Kiro and Pi: see the
200
216
  "Sources" row of the additional-targets matrix. AGENTS.md standard: agents.md.
217
+
218
+ ## Matrix rows for plugins
219
+
220
+ The matrix above is prose for people. A plugin (feature 027, experimental) records the same facts as
221
+ **data**, so the test kit in `@ambystech/ambykit/testkit` can check an emitter against them. One row
222
+ describes one target:
223
+
224
+ ```json
225
+ {
226
+ "target": "mytool",
227
+ "commandSurface": "commands",
228
+ "commandDir": ".mytool/commands",
229
+ "fileTemplate": "amby.<phase>.md",
230
+ "frontmatterKeys": ["description"],
231
+ "sourceUrl": "https://example.com/docs/custom-commands"
232
+ }
233
+ ```
234
+
235
+ | Field | Meaning |
236
+ |---|---|
237
+ | `target` | The target id the row describes. |
238
+ | `commandSurface` | `commands`, `skills`, `workflows` or `none` (rules-only: no command files). |
239
+ | `commandDir` | Directory holding the command files, relative to the project root. |
240
+ | `fileTemplate` | One command file's path under `commandDir`. `<phase>` is replaced by each phase id (`specify`, `plan`, …); a skills layout is `amby-<phase>/SKILL.md`. |
241
+ | `frontmatterKeys` | The exact, ordered keys the host documents: YAML `key:` lines, or TOML `key =` lines for `.toml` files. |
242
+ | `sourceUrl` | Where the row was verified. Principle 4: no row, no emit; a row without a source is a guess. |
243
+
244
+ `checkEmitterContract(target, row)` emits every phase and lists each difference: a wrong `commandSurface`
245
+ or `commandDir`, a missing or unexpected file, frontmatter keys that differ (grouped when many files
246
+ share the difference), a path outside the project, or `emit()` throwing. **A missing row fails.** An
247
+ official plugin ships its row as `matrix-rows.json` in its own repository; this document keeps only the
248
+ human-readable summary.
package/docs/workflow.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # The AmbyKit workflow
2
2
 
3
- Eleven phases, each a slash command in your assistant, each producing or updating one artifact. The
3
+ Thirteen phases, each a slash command in your assistant, each producing or updating one artifact. The
4
4
  happy path is **specify → design → plan → tasks → implement**, with `constitution` once up front and
5
- `clarify`/`revise`/`analyze`/`converge`/`review` when you need them.
5
+ `clarify`/`revise`/`analyze`/`converge`/`review`/`decide`/`run` when you need them.
6
6
 
7
7
  | Phase | Command | Reads | Writes |
8
8
  |---|---|---|---|
@@ -12,11 +12,13 @@ happy path is **specify → design → plan → tasks → implement**, with `con
12
12
  | Revise | `/amby.revise` | spec, ui | spec / ui (continues in place) |
13
13
  | Design (UI) | `/amby.design` | spec | `ui.md`, `design-tokens.json` |
14
14
  | Plan (HOW) | `/amby.plan` | spec, ui | `plan.md` (+ `data-model.md`, `contracts/`) |
15
- | Tasks | `/amby.tasks` | plan | `tasks.md` |
15
+ | Tasks | `/amby.tasks` | plan | `tasks.md` + `tests.md` (test design) |
16
16
  | Analyze | `/amby.analyze` | all | consistency report |
17
17
  | Implement | `/amby.implement` | tasks (one slice) | code + task/status updates |
18
18
  | Converge | `/amby.converge` | spec, plan, tasks + code | `tasks.md` (appends gap tasks), story status |
19
19
  | Review | `/amby.review` | any artifact + a role | findings (advisory); the artifact only with `--apply` |
20
+ | Decide | `/amby.decide` | decision index | `.amby/decisions/ADR-###.md` + the index |
21
+ | Run | `/amby.run` | spec, plan, tasks, `tests.md` | `tasks.md` check-offs + `.amby/fleet/<run>/` |
20
22
 
21
23
  ## 1. Constitution
22
24
 
@@ -59,7 +61,9 @@ needed. See [the plan artifact](./artifacts/plan.md).
59
61
 
60
62
  Turns the plan into an ordered, dependency-aware checklist: stable `T###` IDs, `[P]` parallel
61
63
  markers, `[US#]` story tags, and file paths, grouped so foundational work precedes feature work. See
62
- [the tasks artifact](./artifacts/tasks.md).
64
+ [the tasks artifact](./artifacts/tasks.md). The same phase also writes `tests.md`, the test design: one case per
65
+ acceptance criterion with an automate-or-manual decision, decided before any code. See
66
+ [the tests artifact](./artifacts/tests.md).
63
67
 
64
68
  ## 8. Analyze
65
69
 
@@ -71,12 +75,20 @@ Cross-checks spec ↔ plan ↔ tasks for coverage gaps and inconsistencies, and
71
75
  Executes tasks one slice at a time, checking off `tasks.md` checkboxes and updating each story's
72
76
  `status:` as it goes — which is what `ambykit dashboard` reports on.
73
77
 
78
+ A task that cannot proceed gets a trailing `⚠ BLOCKED: <reason>` marker (and `↪ DEVIATION: <note>` when it
79
+ was done differently than planned); the implementer moves on to another unblocked task. Each phase ends
80
+ with one `**Verify:**` line that is run before the checkpoint, and its result (`✓ passed`,
81
+ `✗ failed: <why>`, `? unverified`) is written back on that line; a failed Verify keeps the checkpoint
82
+ closed. `ambykit dashboard` and `ambykit analyze` surface both at zero model tokens. Syntax:
83
+ [tasks artifact](./artifacts/tasks.md).
84
+
74
85
  ## 10. Converge
75
86
 
76
87
  Closes the loop after implementation: checks the code against every `FR-###`/`SC-###`, plan
77
88
  decision, and checked task; appends one unchecked task per gap under `## Convergence` in `tasks.md`
78
89
  (`[VERIFY]` for inconclusive items); marks fully covered stories `done`. Append-only and idempotent —
79
- it never edits source. Loop `implement → converge` until it reports **converged**.
90
+ it never edits source. It starts from `ambykit trace <feature> --json` (which requirements have tests),
91
+ so it spends effort only on what the matrix cannot answer. Loop `implement → converge` until it reports **converged**.
80
92
 
81
93
  ## 11. Review
82
94
 
@@ -85,6 +97,26 @@ plan, the PM on a UI design, or any role via `--as <id>`. Findings are one per l
85
97
  stable ID with severity and a suggested fix; nothing is modified. `--apply` patches the artifact in
86
98
  place (IDs are never renumbered) and appends a `## Reviews` record. Advisory, like `analyze`.
87
99
 
100
+ ## 12. Decide
101
+
102
+ Records a durable decision as `.amby/decisions/ADR-###.md` (context, decision, alternatives, consequences)
103
+ and patches the index. Callable from any phase; it has no role. It points to an existing record instead of
104
+ duplicating one, keeps a decision that conflicts with a constitution principle `proposed` for a person to
105
+ settle, and `--supersede ADR-###` marks the old record superseded on both sides. Cite records elsewhere as
106
+ `ADR-###`; `ambykit analyze` flags a citation with no record. See `docs/artifacts/decision-record.md`.
107
+
108
+ ## 13. Run
109
+
110
+ `/amby.run <feature>` works a feature through its tasks as a team. The assistant you call it from is the
111
+ **lead**: it gives worker subagents only their task IDs, file ownership and artifact references, then runs a
112
+ QA step (the phase's `**Verify:**` line and acceptance criteria, with the `tests.md` cases when present) and an
113
+ architect review before a phase passes. A failing Verify never passes a checkpoint; a failed review returns only
114
+ finding IDs to the same worker, and at the round limit (default 3) the lead stops and asks you. State lives in
115
+ `.amby/fleet/<feature>.<n>/`, so a run resumes in a new session; pause, resume and stop are directives that
116
+ workers obey at their next report. Defaults (`stallMinutes`, `restartLimit`, `concurrency`, `roundLimit`,
117
+ `workerModel`) are the `fleet` object in `.amby/config.json`. Without verified subagent support the lead does
118
+ every step itself, in sequence. `ambykit fleet` is the helper the prompt calls; see `docs/cli-reference.md`.
119
+
88
120
  ## Roles
89
121
 
90
122
  Every phase acts as a role defined in `.amby/roles/<id>.md` (PM, UX Designer, Architect, Tech
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ambystech/ambykit",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "Spec-Driven Development framework that helps AI coding assistants build better software — author your specs, user stories, UI design, plans and tasks once, and emit native config for Claude Code, OpenCode, GitHub Copilot, Cursor, Antigravity and more.",
5
5
  "keywords": [
6
6
  "spec-driven-development",
@@ -39,12 +39,15 @@
39
39
  "ambykit": "dist/cli/index.js"
40
40
  },
41
41
  "exports": {
42
- ".": "./dist/index.js"
42
+ ".": "./dist/index.js",
43
+ "./plugin": "./dist/plugins/index.js",
44
+ "./testkit": "./dist/testkit/index.js"
43
45
  },
44
46
  "files": [
45
47
  "dist",
46
48
  "src/templates",
47
49
  "src/prompts",
50
+ "src/agents",
48
51
  "src/reference",
49
52
  "src/roles",
50
53
  "README.md",
@@ -0,0 +1,37 @@
1
+ ---
2
+ id: worker
3
+ name: Worker
4
+ description: AmbyKit fleet worker — implements the task IDs the lead gives it, checks them off and reports one line; used by /amby.run.
5
+ ---
6
+
7
+ You are an AmbyKit **worker**. The lead gave you a feature, a lane, task IDs and the files you own. Do those
8
+ tasks and nothing else; you are the only agent allowed to write for them.
9
+
10
+ **Load only what the tasks need:** your task lines in `specs/<feature>/tasks.md` by ID, the plan sections and
11
+ `US-#`/`FR-###` they cite, and `tests.md` cases for them if it exists. Never restate artifacts.
12
+
13
+ **For each task, in order:**
14
+
15
+ 1. Report (below), then claim the files you will edit: `ambykit fleet claim <feature> T### <file>...`. A refused
16
+ claim names the owner: do not edit that file; post a note (step 5) and tell the lead you are blocked.
17
+ 2. Do the task. Edit only files listed for it (plus its tests). Build to the `tests.md` cases when they exist.
18
+ 3. Check it off: `[ ]` → `[x]` on its line (the `tick_task` tool, or an edit of that one box). Checking off
19
+ frees the task's claims; if you edited by hand, also run `ambykit fleet release <feature> T###`.
20
+ 4. Report, then send the lead **one line**: `T###: <what changed> (<files>)`. No logs, no diffs.
21
+ 5. Anything the next person needs to know goes on the shared board as one line:
22
+ `ambykit fleet note <feature> T### --files=<files> "<text>"`.
23
+
24
+ **Stuck?** Stop work on that task and mark it, last on the task line: `⚠ BLOCKED: <reason>` (add
25
+ `↪ DEVIATION: <note>` if you did it differently than planned). Report `blocked`, tell the lead in one line, and
26
+ continue with another of your tasks that is not blocked. Never ask another worker directly: blocked work goes
27
+ through the lead.
28
+
29
+ **Reporting:** `ambykit activity <feature> --agent=$AGENT --phase=implement --task=T### --lane=<lane> --state=<state>`
30
+ (add `--run=<run>`; ignore any error), or the `report_activity` tool when it is available.
31
+ Report at the start of a task, at the end of a task, and whenever you are blocked or waiting. Never report on a timer and never report progress.
32
+ The reply carries a directive: continue, pause or stop. On pause or stop, finish the task you are on, then obey it at your next report: do not start another task.
33
+ `report_activity` returns the directive; without that tool, run `ambykit fleet directive <feature> <lane>` after
34
+ reporting, which prints it.
35
+
36
+ **Review findings:** when the lead returns finding IDs, fix exactly those in the same lane, check nothing new off
37
+ unless a task requires it, and report one line per ID: `<id>: fixed (<files>)`.
@@ -5,7 +5,7 @@ description: Check the codebase against spec, plan, and tasks after implementing
5
5
  argument-hint: "[feature id, defaults to current]"
6
6
  phase: converge
7
7
  role: qa
8
- reads: [specs/NNN-slug/spec.md, specs/NNN-slug/plan.md, specs/NNN-slug/tasks.md]
8
+ reads: [specs/NNN-slug/spec.md, specs/NNN-slug/plan.md, specs/NNN-slug/tasks.md, specs/NNN-slug/tests.md]
9
9
  writes: [specs/NNN-slug/tasks.md, specs/NNN-slug/spec.md]
10
10
  allowedTools: [read, edit]
11
11
  ---
@@ -14,13 +14,18 @@ Converge feature `$ARGUMENTS` (default: the current feature): does the code sati
14
14
  Never edit source code — only that feature's `tasks.md` and `spec.md` are writable.
15
15
 
16
16
  Run `ambykit activity <feature> --agent=$AGENT --phase=converge` first, with that feature's number; ignore any error.
17
+ Then run `ambykit trace <feature> --json`; if it fails, go on as without it. Its uncovered requirements are
18
+ gaps already — do not re-derive coverage by reading every test; read tests only to judge whether the covered
19
+ ones truly satisfy their requirement.
17
20
 
18
21
  1. No `tasks.md` → stop, say to run `/amby.tasks`. No `plan.md` → converge on spec + tasks and say so.
19
22
  2. For every `FR-###`/`SC-###`, plan decision (incl. `data-model.md`/`contracts/`), and checked
20
23
  `T###`: look for evidence only in files the plan/tasks name. Classify **covered**, **gap**
21
- (absent), or **unverified** (inconclusive). Skip items the plan marks deferred/out of scope.
24
+ (absent), or **unverified** (inconclusive). Skip items the plan marks deferred/out of scope. If `tests.md`
25
+ exists, read it after the `trace` matrix (where there is one) and treat its cases as the expected tests; spend
26
+ effort only on what neither answers.
22
27
  3. **Append, don't rewrite.** Under `## Convergence` in `tasks.md` (create at the end if absent) add
23
- `- [ ] [T###] [US#] … (closes FR-…)` per gap and `- [ ] [T###] [US#] [VERIFY] …` per unverified
28
+ `- [ ] [T###] [US#] … (closes NNN:FR-###)` per gap and `- [ ] [T###] [US#] [VERIFY] …` per unverified
24
29
  item. Continue IDs from the highest `T###` anywhere in the file; skip items already listed
25
30
  unchecked there. Nothing to add → leave the file untouched.
26
31
  4. In `spec.md`, patch only `status:` lines: a story → `done` when every FR/SC it maps to is