vgxness 1.20.4 → 1.20.6

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 (375) hide show
  1. package/dist/adapters/claude/agent-renderer.js +82 -0
  2. package/dist/{mcp → adapters/claude/install}/claude-code-agent-config.js +64 -9
  3. package/dist/{mcp → adapters/claude/install}/claude-code-config.js +28 -6
  4. package/dist/{mcp → adapters/claude/install}/claude-code-project-memory.js +35 -5
  5. package/dist/{mcp → adapters/claude/install}/claude-code-scope.js +12 -3
  6. package/dist/{mcp → adapters/claude/install}/claude-code-user-config.js +26 -5
  7. package/dist/{mcp → adapters/claude/install}/claude-code-user-memory.js +47 -7
  8. package/dist/{mcp → adapters/claude/install}/client-install-claude-code-contract.js +45 -8
  9. package/dist/{mcp → adapters/claude/install}/client-install-claude-code.js +98 -14
  10. package/dist/adapters/json/agent-renderer.js +104 -0
  11. package/dist/adapters/opencode/agent-renderer.js +113 -0
  12. package/dist/{mcp → adapters/opencode/install}/client-install-opencode-contract.js +2 -2
  13. package/dist/{mcp → adapters/opencode/install}/client-install-opencode.js +1 -1
  14. package/dist/{mcp → adapters/opencode/install}/opencode-default-agent-config.js +2 -2
  15. package/dist/{mcp → adapters/opencode/install}/opencode-handoff-preview.js +60 -7
  16. package/dist/{mcp → adapters/opencode/install}/opencode-visibility.js +1 -1
  17. package/dist/adapters/provider-renderer.js +6 -0
  18. package/dist/agents/agent-activation-service.js +1 -263
  19. package/dist/agents/agent-lookup-contexts.js +1 -28
  20. package/dist/agents/agent-registry-service.js +1 -81
  21. package/dist/agents/agent-resolver.js +1 -287
  22. package/dist/agents/agent-seed-service.js +1 -157
  23. package/dist/agents/agent-seed-upgrade-service.js +1 -231
  24. package/dist/agents/agent-selector-resolver.js +1 -28
  25. package/dist/agents/boot-upgrade.js +1 -59
  26. package/dist/agents/canonical-agent-manifest.js +1 -245
  27. package/dist/agents/canonical-agent-projection.js +1 -236
  28. package/dist/agents/manager-profile-overlay-service.js +1 -60
  29. package/dist/agents/profile-model-routing.js +1 -30
  30. package/dist/agents/renderers/claude-renderer.js +1 -82
  31. package/dist/agents/renderers/index.js +1 -14
  32. package/dist/agents/renderers/json-renderer.js +1 -104
  33. package/dist/agents/renderers/opencode-renderer.js +1 -113
  34. package/dist/agents/renderers/provider-adapter.js +1 -6
  35. package/dist/agents/repositories/agent-seed-history.js +1 -128
  36. package/dist/agents/repositories/agents.js +1 -200
  37. package/dist/agents/repositories/manager-profile-overlays.js +1 -90
  38. package/dist/agents/schema.js +1 -1
  39. package/dist/application/agents/agent-activation-service.js +261 -0
  40. package/dist/application/agents/agent-lookup-contexts.js +28 -0
  41. package/dist/application/agents/agent-registry-service.js +81 -0
  42. package/dist/application/agents/agent-resolver.js +287 -0
  43. package/dist/application/agents/agent-seed-service.js +157 -0
  44. package/dist/application/agents/agent-seed-upgrade-service.js +231 -0
  45. package/dist/application/agents/agent-selector-resolver.js +28 -0
  46. package/dist/application/agents/boot-upgrade.js +59 -0
  47. package/dist/application/agents/canonical-agent-projection.js +236 -0
  48. package/dist/application/agents/manager-profile-overlay-service.js +68 -0
  49. package/dist/application/agents/profile-model-routing.js +30 -0
  50. package/dist/application/agents/renderers/claude-renderer.js +1 -0
  51. package/dist/application/agents/renderers/index.js +14 -0
  52. package/dist/application/agents/renderers/json-renderer.js +1 -0
  53. package/dist/application/agents/renderers/opencode-renderer.js +1 -0
  54. package/dist/application/agents/renderers/provider-adapter.js +1 -0
  55. package/dist/application/memory/active-work-preview.js +75 -0
  56. package/dist/application/memory/agent-memory-capture-service.js +498 -0
  57. package/dist/application/memory/import/dry-run-planner.js +58 -0
  58. package/dist/application/memory/import/index.js +3 -0
  59. package/dist/application/memory/import/observation-writer.js +226 -0
  60. package/dist/application/memory/import/package.js +179 -0
  61. package/dist/application/memory/memory-service.js +202 -0
  62. package/dist/application/memory/search.js +11 -0
  63. package/dist/{mcp → application/provider-setup}/provider-change-plan.js +74 -13
  64. package/dist/{mcp → application/provider-setup}/provider-doctor.js +201 -31
  65. package/dist/{mcp → application/provider-setup}/provider-health-types.js +1 -1
  66. package/dist/{mcp → application/provider-setup}/provider-status.js +170 -33
  67. package/dist/application/runs/execution-planning.js +180 -0
  68. package/dist/application/runs/operation-execution.js +1 -0
  69. package/dist/application/runs/operation-retry.js +129 -0
  70. package/dist/application/runs/resume-after-approval-result.js +88 -0
  71. package/dist/application/runs/run-insights.js +270 -0
  72. package/dist/application/runs/run-service.js +1480 -0
  73. package/dist/application/runs/run-snapshot-export-service.js +31 -0
  74. package/dist/application/runs/sandbox-process-execution.js +244 -0
  75. package/dist/application/runs/sandbox-worktree-planning.js +59 -0
  76. package/dist/application/runs/task-scoped-command-grant-service.js +224 -0
  77. package/dist/application/sdd/artifact-portability-service.js +137 -0
  78. package/dist/application/sdd/cockpit-read-model.js +195 -0
  79. package/dist/application/sdd/sdd-continuation-plan.js +265 -0
  80. package/dist/application/sdd/sdd-workflow-service.js +892 -0
  81. package/dist/application/skills/boot-seed.js +42 -0
  82. package/dist/application/skills/personal-skills.js +41 -0
  83. package/dist/application/skills/skill-export-service.js +34 -0
  84. package/dist/application/skills/skill-index-service.js +126 -0
  85. package/dist/application/skills/skill-payload.js +186 -0
  86. package/dist/application/skills/skill-registry-service.js +648 -0
  87. package/dist/application/skills/skill-resolver.js +368 -0
  88. package/dist/application/skills/skill-seed-service.js +242 -0
  89. package/dist/application/skills/skill-status-service.js +147 -0
  90. package/dist/cli/bun-bin.js +0 -0
  91. package/dist/cli/cli-flags.js +1 -387
  92. package/dist/cli/cli-help.js +1 -173
  93. package/dist/cli/cli-helpers.js +1 -77
  94. package/dist/cli/cli-types.js +1 -1
  95. package/dist/cli/commands/agent-skill-dispatcher.js +1 -700
  96. package/dist/cli/commands/index.js +1 -9
  97. package/dist/cli/commands/interactive-entrypoint-dispatcher.js +1 -14
  98. package/dist/cli/commands/mcp-dispatcher.js +1 -232
  99. package/dist/cli/commands/memory-sdd-dispatcher.js +1 -367
  100. package/dist/cli/commands/run-permission-dispatcher.js +1 -455
  101. package/dist/cli/commands/setup-dispatcher.js +1 -496
  102. package/dist/cli/commands/status-dispatcher.js +1 -130
  103. package/dist/cli/commands/verification-dispatcher.js +1 -47
  104. package/dist/cli/commands/workflow-dispatcher.js +1 -566
  105. package/dist/cli/dispatcher.js +1 -247
  106. package/dist/cli/doctor-renderer.js +1 -26
  107. package/dist/cli/home-tui-app.js +1 -411
  108. package/dist/cli/home-tui-controller.js +1 -314
  109. package/dist/cli/mcp-start-path.js +1 -21
  110. package/dist/cli/product-resume-renderer.js +1 -32
  111. package/dist/cli/product-status-renderer.js +1 -81
  112. package/dist/cli/sdd-renderer.js +1 -247
  113. package/dist/cli/setup-plan-renderer.js +1 -79
  114. package/dist/cli/setup-status-renderer.js +1 -50
  115. package/dist/cli/setup-tui-app.js +1 -130
  116. package/dist/cli/setup-tui-controller.js +1 -89
  117. package/dist/cli/tui/focus-reducer.js +1 -0
  118. package/dist/cli/tui/focus-types.js +1 -0
  119. package/dist/cli/tui/ink/app-shell.js +1 -0
  120. package/dist/cli/tui/ink/components.js +1 -38
  121. package/dist/cli/tui/ink/help-overlay.js +1 -0
  122. package/dist/cli/tui/ink/state-components.js +1 -0
  123. package/dist/cli/tui/ink/theme.js +1 -36
  124. package/dist/cli/tui/key-intents.js +1 -0
  125. package/dist/cli/tui/keymap.js +1 -20
  126. package/dist/cli/tui/navigation.js +1 -10
  127. package/dist/cli/tui/screen-registry.js +1 -0
  128. package/dist/cli/tui/terminal-capabilities.js +1 -12
  129. package/dist/cli/tui/tui-types.js +1 -1
  130. package/dist/cli/tui/visual/badges.js +1 -19
  131. package/dist/cli/tui/visual/footer.js +1 -27
  132. package/dist/cli/tui/visual/index.js +1 -3
  133. package/dist/cli/tui/visual/viewport.js +1 -11
  134. package/dist/cli/tui-render-helpers.js +1 -200
  135. package/dist/cli/verification-plan-renderer.js +1 -25
  136. package/dist/cli/verification-report-renderer.js +1 -19
  137. package/dist/domain/agents/canonical-agent-manifest.js +355 -0
  138. package/dist/domain/agents/schema.js +1 -0
  139. package/dist/domain/memory/active-work-topics.js +64 -0
  140. package/dist/domain/memory/memory-capture-schema.js +1 -0
  141. package/dist/domain/memory/schema.js +1 -0
  142. package/dist/domain/runs/schema.js +5 -0
  143. package/dist/domain/sdd/cockpit-types.js +1 -0
  144. package/dist/domain/sdd/schema.js +111 -0
  145. package/dist/domain/skills/schema.js +1 -0
  146. package/dist/governance/risk-classifier.js +2 -0
  147. package/dist/interfaces/cli/bun-bin.js +46 -0
  148. package/dist/interfaces/cli/cli-flags.js +391 -0
  149. package/dist/interfaces/cli/cli-help.js +173 -0
  150. package/dist/interfaces/cli/cli-helpers.js +77 -0
  151. package/dist/interfaces/cli/cli-types.js +1 -0
  152. package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +700 -0
  153. package/dist/interfaces/cli/commands/index.js +9 -0
  154. package/dist/interfaces/cli/commands/interactive-entrypoint-dispatcher.js +14 -0
  155. package/dist/interfaces/cli/commands/mcp-dispatcher.js +252 -0
  156. package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +367 -0
  157. package/dist/interfaces/cli/commands/run-permission-dispatcher.js +460 -0
  158. package/dist/interfaces/cli/commands/setup-dispatcher.js +496 -0
  159. package/dist/interfaces/cli/commands/status-dispatcher.js +130 -0
  160. package/dist/interfaces/cli/commands/verification-dispatcher.js +47 -0
  161. package/dist/interfaces/cli/commands/workflow-dispatcher.js +566 -0
  162. package/dist/interfaces/cli/dispatcher.js +247 -0
  163. package/dist/interfaces/cli/doctor-renderer.js +26 -0
  164. package/dist/interfaces/cli/home-tui-app.js +462 -0
  165. package/dist/interfaces/cli/home-tui-controller.js +341 -0
  166. package/dist/interfaces/cli/index.js +27 -0
  167. package/dist/interfaces/cli/mcp-start-path.js +21 -0
  168. package/dist/interfaces/cli/product-resume-renderer.js +32 -0
  169. package/dist/interfaces/cli/product-status-renderer.js +81 -0
  170. package/dist/interfaces/cli/sdd-renderer.js +247 -0
  171. package/dist/interfaces/cli/setup-plan-renderer.js +79 -0
  172. package/dist/interfaces/cli/setup-status-renderer.js +50 -0
  173. package/dist/interfaces/cli/setup-tui-app.js +135 -0
  174. package/dist/interfaces/cli/setup-tui-controller.js +89 -0
  175. package/dist/interfaces/cli/tui/focus-reducer.js +60 -0
  176. package/dist/interfaces/cli/tui/focus-types.js +10 -0
  177. package/dist/interfaces/cli/tui/ink/app-shell.js +16 -0
  178. package/dist/interfaces/cli/tui/ink/components.js +38 -0
  179. package/dist/interfaces/cli/tui/ink/help-overlay.js +6 -0
  180. package/dist/interfaces/cli/tui/ink/state-components.js +22 -0
  181. package/dist/interfaces/cli/tui/ink/theme.js +36 -0
  182. package/dist/interfaces/cli/tui/key-intents.js +33 -0
  183. package/dist/interfaces/cli/tui/keymap.js +20 -0
  184. package/dist/interfaces/cli/tui/navigation.js +10 -0
  185. package/dist/interfaces/cli/tui/screen-registry.js +43 -0
  186. package/dist/interfaces/cli/tui/terminal-capabilities.js +12 -0
  187. package/dist/interfaces/cli/tui/tui-types.js +1 -0
  188. package/dist/interfaces/cli/tui/visual/badges.js +19 -0
  189. package/dist/interfaces/cli/tui/visual/footer.js +27 -0
  190. package/dist/interfaces/cli/tui/visual/index.js +3 -0
  191. package/dist/interfaces/cli/tui/visual/viewport.js +11 -0
  192. package/dist/interfaces/cli/tui-render-helpers.js +200 -0
  193. package/dist/interfaces/cli/verification-plan-renderer.js +25 -0
  194. package/dist/interfaces/cli/verification-report-renderer.js +19 -0
  195. package/dist/interfaces/mcp/contracts/agents.js +1 -0
  196. package/dist/interfaces/mcp/contracts/context.js +1 -0
  197. package/dist/interfaces/mcp/contracts/governance.js +1 -0
  198. package/dist/interfaces/mcp/contracts/index.js +1 -0
  199. package/dist/interfaces/mcp/contracts/memory.js +1 -0
  200. package/dist/interfaces/mcp/contracts/providers.js +1 -0
  201. package/dist/interfaces/mcp/contracts/runs.js +1 -0
  202. package/dist/interfaces/mcp/contracts/sdd.js +1 -0
  203. package/dist/interfaces/mcp/contracts/sessions.js +1 -0
  204. package/dist/interfaces/mcp/contracts/skills.js +1 -0
  205. package/dist/interfaces/mcp/contracts/verification.js +1 -0
  206. package/dist/interfaces/mcp/control-plane/handlers/agents.js +38 -0
  207. package/dist/interfaces/mcp/control-plane/handlers/context.js +12 -0
  208. package/dist/interfaces/mcp/control-plane/handlers/memory.js +95 -0
  209. package/dist/interfaces/mcp/control-plane/handlers/providers.js +19 -0
  210. package/dist/interfaces/mcp/control-plane/handlers/runs.js +134 -0
  211. package/dist/interfaces/mcp/control-plane/handlers/sdd.js +225 -0
  212. package/dist/interfaces/mcp/control-plane/handlers/sessions.js +39 -0
  213. package/dist/interfaces/mcp/control-plane/handlers/skills.js +82 -0
  214. package/dist/interfaces/mcp/control-plane/handlers/verification.js +11 -0
  215. package/dist/interfaces/mcp/control-plane/types.js +1 -0
  216. package/dist/interfaces/mcp/control-plane.js +235 -0
  217. package/dist/interfaces/mcp/schema.js +174 -0
  218. package/dist/interfaces/mcp/schemas/common.js +121 -0
  219. package/dist/interfaces/mcp/schemas/inputs/agents.js +69 -0
  220. package/dist/interfaces/mcp/schemas/inputs/context.js +32 -0
  221. package/dist/interfaces/mcp/schemas/inputs/governance.js +23 -0
  222. package/dist/interfaces/mcp/schemas/inputs/index.js +10 -0
  223. package/dist/interfaces/mcp/schemas/inputs/memory.js +50 -0
  224. package/dist/interfaces/mcp/schemas/inputs/providers.js +35 -0
  225. package/dist/interfaces/mcp/schemas/inputs/runs.js +146 -0
  226. package/dist/interfaces/mcp/schemas/inputs/sdd.js +102 -0
  227. package/dist/interfaces/mcp/schemas/inputs/sessions.js +32 -0
  228. package/dist/interfaces/mcp/schemas/inputs/skills.js +231 -0
  229. package/dist/interfaces/mcp/schemas/inputs/verification.js +9 -0
  230. package/dist/interfaces/mcp/schemas/outputs/index.js +2 -0
  231. package/dist/interfaces/mcp/schemas/outputs/providers.js +28 -0
  232. package/dist/interfaces/mcp/schemas/outputs/sdd.js +166 -0
  233. package/dist/interfaces/mcp/stdio-server.js +116 -0
  234. package/dist/interfaces/mcp/validation/agents.js +189 -0
  235. package/dist/interfaces/mcp/validation/common.js +415 -0
  236. package/dist/interfaces/mcp/validation/governance.js +50 -0
  237. package/dist/interfaces/mcp/validation/memory.js +133 -0
  238. package/dist/interfaces/mcp/validation/providers.js +94 -0
  239. package/dist/interfaces/mcp/validation/runs.js +514 -0
  240. package/dist/interfaces/mcp/validation/sdd.js +247 -0
  241. package/dist/interfaces/mcp/validation/sessions.js +51 -0
  242. package/dist/interfaces/mcp/validation/skills.js +685 -0
  243. package/dist/interfaces/mcp/validation/verification.js +24 -0
  244. package/dist/interfaces/mcp/validation.js +149 -0
  245. package/dist/mcp/control-plane-snapshot-service.js +65 -2
  246. package/dist/mcp/control-plane.js +1 -646
  247. package/dist/mcp/doctor.js +1 -1
  248. package/dist/mcp/index.js +17 -17
  249. package/dist/mcp/schema.js +1 -1072
  250. package/dist/mcp/stdio-server.js +1 -116
  251. package/dist/mcp/validation.js +1 -2239
  252. package/dist/memory/active-work-preview.js +1 -75
  253. package/dist/memory/active-work-topics.js +1 -64
  254. package/dist/memory/agent-memory-capture-service.js +1 -497
  255. package/dist/memory/import/dry-run-planner.js +1 -58
  256. package/dist/memory/import/index.js +1 -3
  257. package/dist/memory/import/observation-writer.js +1 -226
  258. package/dist/memory/import/package.js +1 -179
  259. package/dist/memory/memory-capture-schema.js +1 -1
  260. package/dist/memory/memory-service.js +1 -201
  261. package/dist/memory/repositories/artifacts.js +1 -67
  262. package/dist/memory/repositories/observations.js +1 -217
  263. package/dist/memory/repositories/sessions.js +1 -125
  264. package/dist/memory/repositories/traces.js +1 -78
  265. package/dist/memory/schema.js +1 -1
  266. package/dist/memory/search.js +1 -11
  267. package/dist/memory/sqlite/database.js +1 -228
  268. package/dist/memory/storage-paths.js +1 -72
  269. package/dist/payload/context-budget-policy.js +10 -0
  270. package/dist/payload/context-budget-service.js +26 -0
  271. package/dist/payload/payload-diagnostics.js +50 -0
  272. package/dist/permissions/explicit-request-authorization.js +126 -0
  273. package/dist/permissions/policy-evaluator.js +54 -14
  274. package/dist/runs/execution-planning.js +1 -178
  275. package/dist/runs/operation-execution.js +1 -1
  276. package/dist/runs/operation-retry.js +1 -129
  277. package/dist/runs/repositories/runs.js +1 -676
  278. package/dist/runs/repositories/task-scoped-command-grants.js +1 -462
  279. package/dist/runs/resume-after-approval-result.js +1 -84
  280. package/dist/runs/run-insights.js +1 -270
  281. package/dist/runs/run-service.js +1 -1439
  282. package/dist/runs/run-snapshot-export-service.js +1 -31
  283. package/dist/runs/sandbox-process-execution.js +1 -240
  284. package/dist/runs/sandbox-worktree-planning.js +1 -59
  285. package/dist/runs/schema.js +1 -5
  286. package/dist/runs/task-scoped-command-grant-service.js +1 -216
  287. package/dist/sdd/artifact-portability-service.js +1 -137
  288. package/dist/sdd/cockpit-read-model.js +1 -195
  289. package/dist/sdd/cockpit-types.js +1 -1
  290. package/dist/sdd/schema.js +1 -111
  291. package/dist/sdd/sdd-continuation-plan.js +1 -265
  292. package/dist/sdd/sdd-workflow-service.js +1 -822
  293. package/dist/setup/providers/claude-setup-adapter.js +11 -4
  294. package/dist/setup/providers/opencode-setup-adapter.js +10 -7
  295. package/dist/setup/setup-plan.js +20 -7
  296. package/dist/skills/boot-seed.js +1 -42
  297. package/dist/skills/personal-skills.js +1 -41
  298. package/dist/skills/repositories/skill-evaluation-requests.js +1 -190
  299. package/dist/skills/repositories/skill-evaluation-scenarios.js +1 -305
  300. package/dist/skills/repositories/skill-improvement-proposals.js +1 -355
  301. package/dist/skills/repositories/skills.js +1 -1077
  302. package/dist/skills/schema.js +1 -1
  303. package/dist/skills/skill-export-service.js +1 -34
  304. package/dist/skills/skill-index-service.js +1 -126
  305. package/dist/skills/skill-payload.js +1 -186
  306. package/dist/skills/skill-registry-service.js +1 -644
  307. package/dist/skills/skill-resolver.js +1 -368
  308. package/dist/skills/skill-seed-service.js +1 -242
  309. package/dist/skills/skill-status-service.js +1 -147
  310. package/dist/storage/agents/repositories/agent-seed-history.js +128 -0
  311. package/dist/storage/agents/repositories/agents.js +200 -0
  312. package/dist/storage/agents/repositories/manager-profile-overlays.js +90 -0
  313. package/dist/storage/memory/repositories/artifacts.js +67 -0
  314. package/dist/storage/memory/repositories/observations.js +217 -0
  315. package/dist/storage/memory/repositories/sessions.js +125 -0
  316. package/dist/storage/memory/repositories/traces.js +78 -0
  317. package/dist/storage/memory/sqlite/database.js +228 -0
  318. package/dist/storage/memory/storage-paths.js +72 -0
  319. package/dist/storage/runs/repositories/runs.js +676 -0
  320. package/dist/storage/runs/repositories/task-scoped-command-grants.js +464 -0
  321. package/dist/storage/skills/repositories/skill-evaluation-requests.js +190 -0
  322. package/dist/storage/skills/repositories/skill-evaluation-scenarios.js +305 -0
  323. package/dist/storage/skills/repositories/skill-improvement-proposals.js +355 -0
  324. package/dist/storage/skills/repositories/skills.js +1084 -0
  325. package/docs/architecture.md +2 -2
  326. package/docs/glossary.md +1 -1
  327. package/docs/mcp.md +1 -1
  328. package/docs/module-boundaries.md +114 -0
  329. package/docs/prd.md +1 -1
  330. package/docs/project-health-audit-v1.10.x.md +1 -1
  331. package/docs/providers.md +2 -2
  332. package/docs/safety.md +3 -3
  333. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/apply-progress.md +122 -0
  334. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/archive-report.md +61 -0
  335. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/design.md +66 -0
  336. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/proposal.md +79 -0
  337. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/spec.md +67 -0
  338. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/tasks.md +63 -0
  339. package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/verify-report.md +71 -0
  340. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/apply-progress.md +68 -0
  341. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/archive-report.md +61 -0
  342. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/design.md +43 -0
  343. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/proposal.md +61 -0
  344. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/spec.md +31 -0
  345. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/tasks.md +27 -0
  346. package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/verify-report.md +58 -0
  347. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/apply-progress.md +65 -0
  348. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/archive-report.md +53 -0
  349. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/design.md +64 -0
  350. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/proposal.md +62 -0
  351. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/spec.md +51 -0
  352. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/tasks.md +50 -0
  353. package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/verify-report.md +66 -0
  354. package/docs/storage.md +2 -2
  355. package/package.json +2 -2
  356. /package/dist/{mcp → adapters/claude/install}/claude-code-cli.js +0 -0
  357. /package/dist/{memory → storage/memory}/sqlite/migrations/001_initial.sql +0 -0
  358. /package/dist/{memory → storage/memory}/sqlite/migrations/002_observation_revisions.sql +0 -0
  359. /package/dist/{memory → storage/memory}/sqlite/migrations/003_agent_registry.sql +0 -0
  360. /package/dist/{memory → storage/memory}/sqlite/migrations/004_run_runtime.sql +0 -0
  361. /package/dist/{memory → storage/memory}/sqlite/migrations/005_run_approvals.sql +0 -0
  362. /package/dist/{memory → storage/memory}/sqlite/migrations/006_run_operation_attempts.sql +0 -0
  363. /package/dist/{memory → storage/memory}/sqlite/migrations/007_abandoned_operation_attempts.sql +0 -0
  364. /package/dist/{memory → storage/memory}/sqlite/migrations/008_run_execution_plan_events.sql +0 -0
  365. /package/dist/{memory → storage/memory}/sqlite/migrations/009_multiple_operation_attempts.sql +0 -0
  366. /package/dist/{memory → storage/memory}/sqlite/migrations/010_skill_registry.sql +0 -0
  367. /package/dist/{memory → storage/memory}/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +0 -0
  368. /package/dist/{memory → storage/memory}/sqlite/migrations/012_skill_improvement_proposals.sql +0 -0
  369. /package/dist/{memory → storage/memory}/sqlite/migrations/013_skill_evaluation_scenarios.sql +0 -0
  370. /package/dist/{memory → storage/memory}/sqlite/migrations/014_manager_profile_overlays.sql +0 -0
  371. /package/dist/{memory → storage/memory}/sqlite/migrations/015_artifact_metadata.sql +0 -0
  372. /package/dist/{memory → storage/memory}/sqlite/migrations/016_agent_seed_history.sql +0 -0
  373. /package/dist/{memory → storage/memory}/sqlite/migrations/017_intent_signal_skill_targets.sql +0 -0
  374. /package/dist/{memory → storage/memory}/sqlite/migrations/018_skill_system_v2.sql +0 -0
  375. /package/dist/{memory → storage/memory}/sqlite/migrations/019_task_scoped_command_grants.sql +0 -0
@@ -93,11 +93,11 @@ Gentle-AI/`gentle-pi` are strong references for the configurator and agent-behav
93
93
 
94
94
  ### Agent registry self-healing
95
95
 
96
- The canonical agent manifest in `src/agents/canonical-agent-manifest.ts` is the source of truth for built-in agents (1 manager + 10 SDD subagents). At every CLI/MCP boot, `src/agents/boot-upgrade.ts` reconciles the live `agents` table with that manifest via `src/agents/agent-seed-upgrade-service.ts`: missing rows are created, drifted rows (changed `vgxnessPromptContractVersion`, instructions, adapters, or description) are overwritten, and matches are recorded as noop. Each non-noop outcome is appended to the `agent_seed_history` table for audit. Operators can opt out with `VGXNESS_SKIP_AGENT_SEED_AUTO_UPGRADE=1`. This eliminates the long-standing drift between the canonical prompt contract and stored agent rows after a version bump.
96
+ The canonical agent manifest in `src/domain/agents/canonical-agent-manifest.ts` is the source of truth for built-in agents (1 manager + 10 SDD subagents). At every CLI/MCP boot, `src/application/agents/boot-upgrade.ts` reconciles the live `agents` table with that manifest via `src/application/agents/agent-seed-upgrade-service.ts`: missing rows are created, drifted rows (changed `vgxnessPromptContractVersion`, instructions, adapters, or description) are overwritten, and matches are recorded as noop. Each non-noop outcome is appended to the `agent_seed_history` table for audit. Operators can opt out with `VGXNESS_SKIP_AGENT_SEED_AUTO_UPGRADE=1`. This eliminates the long-standing drift between the canonical prompt contract and stored agent rows after a version bump. The old `src/agents/*` paths remain compatibility facades during the migration window.
97
97
 
98
98
  ### Manager overlay parity across providers
99
99
 
100
- A user-saved `manager_profile_overlay` flows to both providers symmetrically. OpenCode consults the overlay inside `OpenCodeManagerPayloadService.applyManagerOverlayWhenAvailable` (`src/providers/opencode/manager-payload.ts:152-156`), which calls `ManagerProfileOverlayService.resolveEffectiveManager` before producing the OpenCode manager payload. Claude Code was previously canonical-only; the fix routes the overlay through `withEffectiveManagerInstructions` (`src/agents/canonical-agent-projection.ts`) into the render path (`expectedClaudeCodeRenderedAgents` / `expectedClaudeCodeRenderedUserAgents`), with the caller (`mcp install claude` in `src/cli/commands/mcp-dispatcher.ts`) computing the effective instructions via `computeEffectiveManagerInstructions(database)` and passing them into `installClaudeCodeMcpClient`. As a result, `vgxness mcp install claude` writes the user's customized instructions into the user-global `~/.claude/agents/vgxness-manager.md` instead of silently falling back to canonical; project-local Claude agent files remain external/manual diagnostics.
100
+ A user-saved `manager_profile_overlay` flows to both providers symmetrically. OpenCode consults the overlay while building the manager payload, and Claude Code routes the overlay through `withEffectiveManagerInstructions` (`src/application/agents/canonical-agent-projection.ts`) into the render path (`expectedClaudeCodeRenderedAgents` / `expectedClaudeCodeRenderedUserAgents`), with the caller (`mcp install claude` in `src/interfaces/cli/commands/mcp-dispatcher.ts`) computing the effective instructions via `computeEffectiveManagerInstructions(database)` and passing them into `installClaudeCodeMcpClient`. As a result, `vgxness mcp install claude` writes the user's customized instructions into the user-global `~/.claude/agents/vgxness-manager.md` instead of silently falling back to canonical; project-local Claude agent files remain external/manual diagnostics.
101
101
 
102
102
  ## Storage model
103
103
 
package/docs/glossary.md CHANGED
@@ -32,7 +32,7 @@ The canonical installed CLI/MCP runtime and verification path. Required `>= 1.3.
32
32
 
33
33
  ## Canonical agent manifest
34
34
 
35
- The built-in, validated manifest that defines the manager agent and the SDD subagents (`vgxness-sdd-explore`, `vgxness-sdd-propose`, `vgxness-sdd-spec`, `vgxness-sdd-design`, `vgxness-sdd-tasks`, `vgxness-sdd-apply`, `vgxness-sdd-verify`, `vgxness-sdd-archive`, plus `init` and `onboard`). Lives in `src/agents/canonical-agent-manifest.ts`. `promptContractVersion` increments on breaking contract changes.
35
+ The built-in, validated manifest that defines the manager agent and the SDD subagents (`vgxness-sdd-explore`, `vgxness-sdd-propose`, `vgxness-sdd-spec`, `vgxness-sdd-design`, `vgxness-sdd-tasks`, `vgxness-sdd-apply`, `vgxness-sdd-verify`, `vgxness-sdd-archive`, plus `init` and `onboard`). Lives in `src/domain/agents/canonical-agent-manifest.ts` with old-path compatibility through `src/agents/canonical-agent-manifest.ts`. `promptContractVersion` increments on breaking contract changes.
36
36
 
37
37
  ## Change (SDD)
38
38
 
package/docs/mcp.md CHANGED
@@ -47,7 +47,7 @@ Use memory for durable, future-relevant facts that are reusable beyond the curre
47
47
  - **Good:** personal-scoped `preference` — "Prefer concise SDD apply summaries with changed files and verification evidence."
48
48
  - **Bad:** full phase artifacts, full transcripts, raw large logs, hidden reasoning, secrets, credentials, or sensitive user data.
49
49
 
50
- Memory is advisory only: it never proves SDD acceptance, readiness, verification, approval, or authorization. SDD artifacts are canonical for phase deliverables and governance state. Active-work memory remains advisory and should point to current context without replacing artifacts or runs. `memory-write` is a durable governed action; use preflight or explicit consent whenever policy marks it governed/risky.
50
+ Memory is advisory only: it never proves SDD acceptance, readiness, verification, approval, or authorization. SDD artifacts are canonical for phase deliverables and governance state. Active-work memory remains advisory and should point to current context without replacing artifacts or runs. Ordinary qualifying `memory-write` operations are agent-decided and audit-only so the manager can preserve durable decisions, architecture choices, reusable project conventions, workflow preferences, and non-obvious gotchas without duplicate confirmation. Ask first when the content is sensitive, ambiguous, user-personal beyond stated preferences, or the user explicitly says not to persist it.
51
51
 
52
52
  Lifecycle responses may include `memoryCapture` metadata for review-first memory candidates, such as session close summaries, run finalization outcomes, and SDD acceptance/archive references. These candidates are advisory only and are never persisted automatically: there is no durable candidate queue, and callers must make a separate explicit `vgxness_memory_save` or `vgxness_memory_update` decision under the same durable memory policy. `memoryCapture` must not include full SDD artifacts, transcripts, raw logs, hidden reasoning, secrets, credentials, sensitive data, or other protected content, and it is not proof of SDD acceptance, readiness, verification, approval, or authorization.
53
53
 
@@ -0,0 +1,114 @@
1
+ # Module Boundaries
2
+
3
+ `vgxness` is organized around a provider-neutral control plane with multiple interfaces. Source layout should make that architecture obvious: product rules live in domain/application modules, storage details live in storage modules, provider details live in adapters, and CLI/MCP/TUI code stays at the edge.
4
+
5
+ ## Target Layout
6
+
7
+ ```text
8
+ src/domain/<area>/ # schemas, contracts, invariants, pure policy
9
+ src/application/<area>/ # use-case services and orchestration
10
+ src/storage/<area>/ # repositories and store-specific code
11
+ src/adapters/<provider>/ # OpenCode, Claude Code, future providers
12
+ src/interfaces/cli/ # command parsing and human rendering
13
+ src/interfaces/mcp/ # MCP schemas, tool handlers, stdio server
14
+ src/interfaces/tui/ # Ink/TUI state and visual components
15
+ ```
16
+
17
+ ## Ownership Rules
18
+
19
+ | Layer | Owns | Must Not Own |
20
+ |---|---|---|
21
+ | `domain` | Types, schemas, invariants, pure policy decisions | SQLite calls, filesystem writes, CLI formatting, MCP transport |
22
+ | `application` | Use-case services and orchestration across domain/storage/adapters | Command-line parsing, terminal rendering, direct provider config file formats |
23
+ | `storage` | Repositories, migrations access, persistence-specific mapping | Product workflow rules or provider behavior |
24
+ | `adapters` | Provider-specific projections, config formats, external integration details | Provider-neutral workflow semantics |
25
+ | `interfaces/cli` | Args, command dispatch, human-readable output | Business rules not exposed by application services |
26
+ | `interfaces/mcp` | MCP schemas, tool handlers, stdio/server transport | Provider install semantics or duplicated service logic |
27
+ | `interfaces/tui` | Visual state and rendering | Product rules not available through shared services |
28
+
29
+ ## Import Rules
30
+
31
+ 1. Interface modules call application services; they should not reach into repositories directly.
32
+ 2. Application modules may use domain contracts, storage repositories, and adapters.
33
+ 3. Domain modules must be pure and should not import application, storage, adapters, or interfaces.
34
+ 4. Storage modules may import domain contracts for mapping, but must not make workflow decisions.
35
+ 5. Adapter modules may import domain/application contracts needed for projection, but provider-specific behavior must not leak into domain modules.
36
+ 6. Public barrels/facades should be intentional. Avoid exporting every internal file by default.
37
+
38
+ ## Compatibility Facades
39
+
40
+ During migration, existing public entrypoints may remain as facades that re-export or delegate to the new location. A compatibility facade is allowed when it:
41
+
42
+ - preserves existing imports during a reviewable slice;
43
+ - contains no duplicated business logic;
44
+ - clearly points maintainers to the new canonical module;
45
+ - has a planned removal or stabilization decision before the migration is archived.
46
+
47
+ Stable compatibility candidates include:
48
+
49
+ ```text
50
+ src/mcp/index.ts
51
+ src/mcp/schema.ts
52
+ src/mcp/validation.ts
53
+ src/mcp/control-plane.ts
54
+ src/mcp/stdio-server.ts
55
+ src/permissions/index.ts
56
+ src/verification/index.ts
57
+ src/setup/index.ts
58
+ src/cli/commands/index.ts
59
+ ```
60
+
61
+ After the structure reorganization, migrated compatibility paths are expected to
62
+ remain implementation-free facades unless they are deliberate executable
63
+ entrypoints such as `src/cli/index.ts` and `src/cli/bun-bin.ts`. Canonical code
64
+ now lives under the target layout below:
65
+
66
+ | Compatibility path | Canonical owner |
67
+ |---|---|
68
+ | `src/runs/*` | `src/domain/runs`, `src/application/runs`, `src/storage/runs` |
69
+ | `src/cli/*` | `src/interfaces/cli/*` |
70
+ | `src/mcp/index.ts`, `src/mcp/schema.ts`, `src/mcp/validation.ts`, `src/mcp/control-plane.ts`, `src/mcp/stdio-server.ts` | `src/interfaces/mcp/*` plus canonical application/adapter exports |
71
+ | `src/skills/*` | `src/domain/skills`, `src/application/skills`, `src/storage/skills` |
72
+ | `src/sdd/*` | `src/domain/sdd`, `src/application/sdd` |
73
+ | `src/agents/*` | `src/domain/agents`, `src/application/agents`, `src/storage/agents`, `src/adapters/*` |
74
+ | `src/application/agents/renderers/*` | `src/adapters/*` |
75
+ | `src/memory/*` | `src/domain/memory`, `src/application/memory`, `src/storage/memory` |
76
+
77
+ Obsolete narrow MCP facades were removed after audit. Provider install helpers
78
+ now live only under `src/adapters/opencode/install/*` and
79
+ `src/adapters/claude/install/*`; provider setup helpers live under
80
+ `src/application/provider-setup/*`; nested MCP interface subfacades such as
81
+ `src/mcp/contracts/*`, `src/mcp/schemas/*`, and `src/mcp/validation/*` were
82
+ deleted because active source/tests/docs do not import them.
83
+
84
+ ## Migration Map
85
+
86
+ | Current Area | Target Area | Migration Notes |
87
+ |---|---|---|
88
+ | `src/runs` | `src/domain/runs`, `src/application/runs`, `src/storage/runs` | Split lifecycle, approvals, checkpoints, grants, repositories |
89
+ | `src/mcp` | `src/interfaces/mcp`, `src/application/provider-setup`, `src/adapters/*` | Keep tool names stable; separate transport from provider setup |
90
+ | `src/cli` | `src/interfaces/cli` | Dispatch/render only; call application services for behavior |
91
+ | `src/skills` | `src/domain/skills`, `src/application/skills`, `src/storage/skills` | Separate schema, resolver, registry service, repository |
92
+ | `src/sdd` | `src/domain/sdd`, `src/application/sdd` | Keep workflow contracts separate from state service |
93
+ | `src/agents` | `src/domain/agents`, `src/application/agents`, `src/adapters/*` | Keep neutral agent model separate from provider projections |
94
+ | `src/memory` | `src/domain/memory`, `src/application/memory`, `src/storage/memory` | Keep SQLite and import/export mapping out of domain rules |
95
+ | `src/providers` | `src/adapters/*` | Provider-specific implementations move under adapter ownership |
96
+ | `src/setup` | `src/application/setup`, `src/adapters/*` | Setup lifecycle is application logic; provider writes stay adapter-specific |
97
+ | `src/verification` | `src/domain/verification`, `src/application/verification` | Plans/reports use shared contracts across CLI/MCP |
98
+ | `src/governance` | `src/domain/governance`, `src/application/governance` | Risk and report contracts should remain provider-neutral |
99
+ | `src/workflows` | `src/domain/workflows`, `src/application/workflows` | Workflow definitions and executor orchestration should be split |
100
+
101
+ ## Review Strategy
102
+
103
+ This migration should be implemented as stacked PRs to `main`. Each PR should be independently typecheckable and revertible.
104
+
105
+ Recommended order:
106
+
107
+ 1. boundary docs and compatibility rules;
108
+ 2. `runs` pilot;
109
+ 3. `mcp` pilot;
110
+ 4. CLI/interface migration;
111
+ 5. remaining domain migrations and provider adapter extraction;
112
+ 6. final verification, facade audit, and architecture documentation sync.
113
+
114
+ Each slice should run the smallest targeted tests that cover moved behavior plus `tsc --noEmit`. Bun-specific storage/runtime tests remain required for slices touching SQLite-backed behavior or package/runtime boundaries.
package/docs/prd.md CHANGED
@@ -353,7 +353,7 @@ Many early PRD questions were resolved by the v1.5.1 milestone. Tracking them he
353
353
  |---|---|
354
354
  | First integration adapter | OpenCode primary/default; Claude is supported secondary for user-global explicit apply. Project-local provider files are external/manual diagnostics only. |
355
355
  | Memory storage scopes | Project and personal/global data are separated by explicit scope. The selected SQLite store is resolved by `--db`, `VGXNESS_DB_PATH`, or the global default. |
356
- | Agent config format | Provider-neutral schema in `src/agents/schema.ts`; canonical manifest with validation in `src/agents/canonical-agent-manifest.ts`. |
356
+ | Agent config format | Provider-neutral schema in `src/domain/agents/schema.ts`; canonical manifest with validation in `src/domain/agents/canonical-agent-manifest.ts`. |
357
357
  | Skill config format | Versioned skills with source metadata (`path`/`url`/`inline`); active version gating in `src/skills/skill-registry-service.ts`. |
358
358
  | Skill improvement approval | All proposals require explicit human approval before activation; rejected/cancelled proposals cannot be applied. |
359
359
  | First public CLI surface | `vgxness {init, setup, doctor, mcp, sdd, agents, skills, memory, runs, opencode}`. See [CLI reference](./cli.md). |
@@ -19,7 +19,7 @@ Esta auditoría es una foto de salud v1.10.x basada en inspección read-only del
19
19
  | CLI | `src/cli/dispatcher.ts` centraliza comandos para status, next, resume, setup, agents, skills, SDD, runs, permissions, MCP y verification. | Implementado |
20
20
  | MCP | `src/mcp/stdio-server.ts` y `src/mcp/schema.ts` exponen herramientas tipadas; el estado observado durante v1.10.x reportó 41 MCP tools. | Implementado |
21
21
  | SDD | `src/sdd/sdd-workflow-service.ts` y `docs/architecture.md` definen `explore → proposal → spec → design → tasks → apply-progress → verify → archive`. | Implementado |
22
- | Storage | `src/memory/sqlite/*` y migraciones en `src/memory/sqlite/migrations/*.sql`; runtime real depende de `bun:sqlite`. | Implementado |
22
+ | Storage | `src/storage/memory/sqlite/*` y migraciones en `src/storage/memory/sqlite/migrations/*.sql`; runtime real depende de `bun:sqlite`. | Implementado |
23
23
  | Providers | OpenCode es primario; Claude está soportado/guarded; Antigravity/custom son extensiones futuras/placeholders. | Mixto |
24
24
  | Provider health | `vgxness_provider_doctor` para OpenCode pasó 12/12 checks, sin warnings/errors y sin escribir provider config. | Saludable |
25
25
  | Git | `git status --short --branch` reportó `## main...origin/main`; `git diff --stat` y cached diff sin cambios antes de esta auditoría. | Limpio antes del cambio |
package/docs/providers.md CHANGED
@@ -76,7 +76,7 @@ Manual/opt-in runtime validation checklist (not normal CI):
76
76
 
77
77
  ### OpenCode injection preview
78
78
 
79
- `OpenCodeInjectionPreviewService` (in `src/providers/opencode/`) composes existing read-only outputs into a single envelope:
79
+ Provider-specific preview/rendering code lives under `src/adapters/*`. `OpenCodeInjectionPreviewService` composes existing read-only outputs into a single envelope:
80
80
 
81
81
  | Output | Source |
82
82
  |---|---|
@@ -97,7 +97,7 @@ The experimental `vgxness code` runtime, its OpenAI-compatible/fake providers, a
97
97
 
98
98
  ## OpenCode provider install and doctor
99
99
 
100
- Provider install and doctor flows live in `src/mcp/client-install-opencode.ts` and `src/mcp/provider-doctor.ts` and are exposed through the MCP server and the CLI:
100
+ Provider install and doctor flows live in `src/adapters/opencode/install/client-install-opencode.ts` and `src/application/provider-setup/provider-doctor.ts` and are exposed through the MCP server and the CLI:
101
101
 
102
102
  - `vgxness mcp install opencode --plan` — plan that never writes provider config; local VGXNESS store initialization may occur when the selected SQLite store is needed.
103
103
  - `vgxness mcp install opencode --yes` — explicit write path; creates a backup first.
package/docs/safety.md CHANGED
@@ -27,8 +27,8 @@ The category list lives in `src/permissions/schema.ts` (`permissionCategories`).
27
27
  | `network` | `ask` | yes | Web fetch, API calls, package downloads. |
28
28
  | `git` | `ask` | yes | Status, diff, branch, commit. |
29
29
  | `git-write` | `ask` | yes | Push, merge, branch mutation. |
30
- | `memory` | `ask` | yes | Memory read/write/search. |
31
- | `memory-write` | `ask` | yes | Memory upsert/update. |
30
+ | `memory` | `audit` | no | Memory read/search and ordinary qualifying memory writes are audited but non-blocking. |
31
+ | `memory-write` | `audit` | no | Agent-decided memory upsert/update for durable, scoped, non-sensitive observations; ask only when content is sensitive, ambiguous, or explicitly non-persistent. |
32
32
  | `external-directory` | `deny` | yes | Access outside project/user-approved roots. Cannot be relaxed by agent overrides. |
33
33
  | `provider-tool` | `ask` | yes | Opaque adapter/provider tool calls. |
34
34
  | `secrets` | `deny` | yes | Environment variables, credentials, tokens. |
@@ -56,7 +56,7 @@ The matrix (`sddPhasePermissionMatrix`, version `sdd-phase-permissions-v1`) give
56
56
 
57
57
  | Phase | Distinctive modes (vs. the planning baseline) |
58
58
  |---|---|
59
- | `explore`, `proposal`, `spec`, `design`, `tasks`, `archive` | Planning baseline. Reads allowed; edits denied; spec/design/task writes, shell, install, network, git, memory all `require-preflight`; provider-tool `audit`; external-directory and secrets `deny`. |
59
+ | `explore`, `proposal`, `spec`, `design`, `tasks`, `archive` | Planning baseline. Reads allowed; edits denied; spec/design/task writes, shell, install, network, and git are `require-preflight`; memory and provider-tool are `audit`; external-directory and secrets `deny`. |
60
60
  | `apply-progress` | Edits and `implementation-edit` are `require-preflight` (instead of `deny`). Shell and `test-run` are `require-preflight`. |
61
61
  | `verify` | Edits and `implementation-edit` stay `deny`. Shell and `test-run` are `require-preflight`. |
62
62
 
@@ -0,0 +1,122 @@
1
+ # Apply Progress: Ambitious Structure Reorganization
2
+
3
+ ## Completed Tasks
4
+
5
+ - [x] 1.1 Created `docs/module-boundaries.md` with target layout, ownership rules, import rules, and migration map.
6
+ - [x] 1.2 Added compatibility policy for old barrels/facades and deprecation criteria.
7
+ - [x] 1.3 Identified stable public entrypoint candidates, including `src/mcp/index.ts`, `src/mcp/schema.ts`, `src/mcp/validation.ts`, `src/permissions/index.ts`, `src/verification/index.ts`, `src/setup/index.ts`, and `src/cli/commands/index.ts`.
8
+ - [x] 2.1 Created target folders for `src/domain/runs`, `src/application/runs`, and `src/storage/runs`.
9
+ - [x] 2.2 Moved run application services behind compatibility facades while preserving public imports.
10
+ - [x] 2.3 Moved run repositories under the storage layer while preserving old imports.
11
+ - [x] 2.4 Verified the runs pilot with typecheck and test execution.
12
+ - [x] 3.1 Created `src/interfaces/mcp` for MCP contracts, schemas, validation, control-plane handlers, and stdio server.
13
+ - [x] 3.3 Preserved MCP tool names and `SUPPORTED_VGX_MCP_TOOL_NAMES` behavior through old-path facades.
14
+ - [x] 3.4 Verified the MCP interface pilot with typecheck and targeted MCP tests.
15
+ - [x] 3.2 Moved provider setup/status services into `src/application/provider-setup` with old-path facades.
16
+ - [x] 4.1 Moved CLI command parsing/rendering modules into `src/interfaces/cli` with old-path facades while preserving executable entrypoints.
17
+ - [x] 4.2a Moved `skills` into `src/domain/skills`, `src/application/skills`, and `src/storage/skills` with old-path facades.
18
+ - [x] 4.2b Moved `sdd` into `src/domain/sdd` and `src/application/sdd` with old-path facades.
19
+ - [x] 4.2c Moved `agents` into `src/domain/agents`, `src/application/agents`, and `src/storage/agents` with old-path facades.
20
+ - [x] 4.2d Moved `memory` into `src/domain/memory`, `src/application/memory`, and `src/storage/memory` with old-path facades.
21
+ - [x] 4.3 Moved provider renderer/projection implementations into `src/adapters/*` with old-path facades.
22
+ - [x] 5.1 Ran final local verification and queued remote Bun CI-equivalent verification for the final cleanup PR.
23
+ - [x] 5.2 Audited migrated compatibility facades and documented remaining non-facade legacy provider-install paths.
24
+ - [x] 5.3 Updated architecture/module-boundary docs with final structure and deprecated-path notes.
25
+
26
+ ## Files Changed
27
+
28
+ | File | Action | What Changed |
29
+ |---|---|---|
30
+ | `docs/module-boundaries.md` | Created | Documents target layered layout, ownership rules, import rules, compatibility facades, migration map, and stacked PR strategy. |
31
+ | `docs/sdd/ambitious-structure-reorganization/tasks.md` | Updated | Records completed Phase 1, Phase 2, and MCP interface pilot tasks. |
32
+ | `src/domain/runs/schema.ts` | Moved | Establishes the domain boundary for run contracts and stable types. |
33
+ | `src/application/runs/*` | Moved | Houses run use-case services, execution planning, retry, insights, snapshot export, sandbox planning, and grant service code. |
34
+ | `src/storage/runs/repositories/*` | Moved | Houses SQLite-backed run and task-scoped command grant repositories. |
35
+ | `src/runs/*` | Modified | Compatibility facades re-export the new canonical modules for existing imports. |
36
+ | `src/interfaces/mcp/*` | Moved | Houses MCP contracts, schemas, validation, control-plane handlers/types, and stdio server. |
37
+ | `src/mcp/*` | Modified | Compatibility facades re-export moved MCP interface modules while provider setup/status modules stay in place. |
38
+ | `test/mcp/validation.test.ts` | Modified | Reads canonical MCP validation/control-plane sources from `src/interfaces/mcp`. |
39
+ | `src/application/provider-setup/*` | Moved | Houses provider status, doctor, change-plan, and provider health contracts. |
40
+ | `src/mcp/provider-*.ts` | Modified | Compatibility facades re-export provider setup modules from the application layer. |
41
+ | `src/interfaces/cli/*` | Moved | Canonical CLI command dispatchers, renderers, TUI helpers, and CLI support modules. |
42
+ | `src/cli/*` | Modified | Compatibility facades for old CLI imports; executable `index.ts` and `bun-bin.ts` remain real entrypoints for package/runtime tests. |
43
+ | `test/cli/tui-zero-import-gate.test.ts` | Modified | Allows canonical `src/interfaces/cli` Ink bridge paths while retaining old path compatibility. |
44
+ | `src/domain/skills/schema.ts` | Moved | Canonical skill domain contracts and types. |
45
+ | `src/application/skills/*` | Moved | Canonical skill registry, resolver, seed, status, index, payload, export, and boot/personal skill services. |
46
+ | `src/storage/skills/repositories/*` | Moved | Canonical skill repository implementations. |
47
+ | `src/skills/*` | Modified | Compatibility facades for old skill imports. |
48
+ | `src/domain/sdd/*` | Moved | Canonical SDD domain contracts, cockpit types, phases, and normalization helpers. |
49
+ | `src/application/sdd/*` | Moved | Canonical SDD workflow, continuation, cockpit read model, and artifact portability services. |
50
+ | `src/sdd/*` | Modified | Compatibility facades for old SDD imports. |
51
+ | `src/domain/agents/*` | Moved | Canonical agent contracts and canonical manifest constants. |
52
+ | `src/application/agents/*` | Moved | Canonical agent registry, resolver, activation, seed/upgrade, projection, overlay, model routing, and renderer services. |
53
+ | `src/storage/agents/repositories/*` | Moved | Canonical agent and manager overlay repository implementations. |
54
+ | `src/agents/*` | Modified | Compatibility facades for old agent imports. |
55
+ | `src/domain/memory/*` | Moved | Canonical memory contracts, capture schema, and active-work topic parsing. |
56
+ | `src/application/memory/*` | Moved | Canonical memory service, active-work preview, capture service, search, and import workflow modules. |
57
+ | `src/storage/memory/*` | Moved | Canonical memory repositories, SQLite database, storage path helpers, and migrations. |
58
+ | `src/memory/*` | Modified | Compatibility facades for old memory imports. |
59
+ | `scripts/copy-migrations.mjs` | Modified | Copies migrations from/to the new storage-layer paths. |
60
+ | `src/adapters/*` | Created | Canonical provider renderer/projection adapter implementations and shared provider-renderer contract. |
61
+ | `src/application/agents/renderers/*` | Modified | Compatibility facades and registry wiring for adapter-owned renderers. |
62
+ | `src/mcp/client-install-*` | Modified | Imports shared adapter sync contracts from the adapter boundary. |
63
+ | `docs/module-boundaries.md` | Updated | Adds post-migration compatibility facade audit and remaining deferred legacy provider-install paths. |
64
+ | `docs/architecture.md` | Updated | Points agent and manager-overlay sections at canonical domain/application/interface paths. |
65
+ | `docs/providers.md`, `docs/prd.md`, `docs/glossary.md` | Updated | Replaces stale provider/agent source paths with the new layered structure. |
66
+
67
+ ## Deviations from Design
68
+
69
+ - Runs pilot preserved compatibility by moving the full run service/application modules first rather than deeply splitting `RunService` internals into lifecycle/checkpoint/approval submodules in that PR.
70
+ - MCP pilot moved the interface/control-plane boundary first. Provider setup/status services now live under `application/provider-setup`; deeper OpenCode/Claude adapter extraction remains a later cleanup opportunity.
71
+ - Provider adapter extraction in task 4.3 focused on provider renderer/projection code and shared adapter sync contracts; full install workflow moves can remain a future cleanup if needed.
72
+
73
+ ## Issues Found
74
+
75
+ - The MCP registry sync test read old `src/mcp/validation.ts` and `src/mcp/control-plane.ts` implementation files directly. It was updated to inspect the new canonical `src/interfaces/mcp` sources.
76
+ - Local development environment does not have `bun`; Bun CI-equivalent verification is supplied by the GitHub checks on the final cleanup PR.
77
+
78
+ ## Verification
79
+
80
+ - [x] `npx biome check --write --unsafe src/application/runs src/domain/runs src/storage/runs src/runs`
81
+ - [x] `npx tsc --noEmit`
82
+ - [x] `node scripts/run-node-tests.mjs test/runs` — passed 516 tests, 513 pass, 3 skipped
83
+ - [x] `npx biome check --write --unsafe src/interfaces/mcp src/mcp test/mcp/validation.test.ts`
84
+ - [x] `npx tsc --noEmit`
85
+ - [x] `node scripts/run-node-tests.mjs test/mcp` — passed 516 tests, 513 pass, 3 skipped
86
+ - [x] `git diff --check`
87
+ - [x] `npx tsc --noEmit` after provider setup migration
88
+ - [x] `node scripts/run-node-tests.mjs test/mcp` after provider setup migration — passed 516 tests, 513 pass, 3 skipped
89
+ - [x] `npx biome check --write --unsafe src/interfaces/cli src/cli test/cli/tui-zero-import-gate.test.ts`
90
+ - [x] `npx tsc --noEmit` after CLI interface migration
91
+ - [x] `node scripts/run-node-tests.mjs test/cli` — passed 516 tests, 513 pass, 3 skipped
92
+ - [x] `npx biome check --write --unsafe src/domain/skills src/application/skills src/storage/skills src/skills`
93
+ - [x] `npx tsc --noEmit` after skills migration
94
+ - [x] `node scripts/run-node-tests.mjs test/skills` — passed 516 tests, 513 pass, 3 skipped
95
+ - [x] `npx biome check --write --unsafe src/domain/sdd src/application/sdd src/sdd`
96
+ - [x] `npx tsc --noEmit` after SDD migration
97
+ - [x] `node scripts/run-node-tests.mjs test/sdd` — passed 516 tests, 513 pass, 3 skipped
98
+ - [x] `npx biome check --write --unsafe src/domain/agents src/application/agents src/storage/agents src/agents`
99
+ - [x] `npx tsc --noEmit` after agents migration
100
+ - [x] `node scripts/run-node-tests.mjs test/agents` — passed 516 tests, 513 pass, 3 skipped
101
+ - [x] `npx biome check --write --unsafe src/domain/memory src/application/memory src/storage/memory src/memory scripts/copy-migrations.mjs scripts/probe-bun-package-evidence.mjs scripts/probe-bun-sqlite.mjs test/package/installable-cli.test.ts test/scripts/probe-bun-package-evidence.test.ts`
102
+ - [x] `npx tsc --noEmit` after memory migration
103
+ - [x] `npm run build` after migration copy path update
104
+ - [x] `node scripts/run-node-tests.mjs test/memory test/package/installable-cli.test.ts test/scripts/probe-bun-package-evidence.test.ts` — passed 516 tests, 513 pass, 3 skipped
105
+ - [x] `npx biome check --write --unsafe src/adapters src/application/agents/renderers src/agents/renderers src/mcp/client-install-opencode-contract.ts src/mcp/client-install-claude-code-contract.ts src/mcp/client-install-opencode.ts src/mcp/client-install-claude-code.ts test/mcp/client-install-opencode-contract.test.ts`
106
+ - [x] `npx tsc --noEmit` after provider adapter extraction
107
+ - [x] `node scripts/run-node-tests.mjs test/agents test/mcp/client-install-opencode-contract.test.ts` — passed 516 tests, 513 pass, 3 skipped
108
+ - [x] `npx tsc --noEmit` final cleanup verification
109
+ - [x] `npm run build` final cleanup verification
110
+ - [x] `node scripts/run-node-tests.mjs` final cleanup verification — passed 516 tests, 513 pass, 3 skipped
111
+ - [x] Bun CI-equivalent suites: to be verified by PR checks (`Bun verify` and `Bun package evidence` on ubuntu/macos/windows)
112
+
113
+ ## Remaining Tasks
114
+
115
+ Next recommended work unit: SDD verify/archive after the final cleanup PR lands.
116
+
117
+ ## Workload / PR Boundary
118
+
119
+ - Mode: stacked PR slice
120
+ - Current work unit: Final structure verification and cleanup
121
+ - Boundary: final local verification, compatibility facade audit, and architecture documentation sync; no behavior changes
122
+ - Estimated review budget impact: medium; full migration remains high
@@ -0,0 +1,61 @@
1
+ # Archive Report: Ambitious Structure Reorganization
2
+
3
+ ## Archive Summary
4
+
5
+ - Change: `ambitious-structure-reorganization`
6
+ - Archive date: 2026-06-26
7
+ - Source artifact mode: filesystem SDD artifacts under `docs/sdd/`
8
+ - Archived to: `docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/`
9
+ - Verification verdict: PASS WITH WARNINGS; no critical issues.
10
+
11
+ ## Source Artifacts
12
+
13
+ | Artifact | Status |
14
+ |---|---|
15
+ | `proposal.md` | Present |
16
+ | `spec.md` | Present |
17
+ | `design.md` | Present |
18
+ | `tasks.md` | Present; all implementation tasks checked |
19
+ | `apply-progress.md` | Present |
20
+ | `verify-report.md` | Present |
21
+
22
+ ## Task Completion Gate
23
+
24
+ PASS. `tasks.md` has no unchecked implementation tasks:
25
+
26
+ - Phase 1 complete
27
+ - Phase 2 complete
28
+ - Phase 3 complete
29
+ - Phase 4 complete
30
+ - Phase 5 complete
31
+
32
+ ## Specs Synced
33
+
34
+ No `openspec/` tree exists in this repository, so there are no delta specs to merge into main OpenSpec specs. The source of truth for this change is the archived filesystem SDD packet plus the updated architecture/module-boundary documentation already merged to `main`.
35
+
36
+ ## Source of Truth Updated
37
+
38
+ The following shipped docs now reflect the new structure:
39
+
40
+ - `docs/module-boundaries.md`
41
+ - `docs/architecture.md`
42
+ - `docs/providers.md`
43
+ - `docs/prd.md`
44
+ - `docs/glossary.md`
45
+
46
+ ## Verification Evidence
47
+
48
+ - `npx tsc --noEmit` — PASS
49
+ - `npm run build` — PASS
50
+ - `node scripts/run-node-tests.mjs` — PASS, 516 tests / 513 pass / 3 skipped / 0 fail
51
+ - `git diff --check` — PASS
52
+ - GitHub Bun Runtime CI on final merged cleanup commit `2e2fb85` — PASS, run `28272288089`
53
+
54
+ ## Remaining Follow-Up Candidates
55
+
56
+ - Provider install helpers under `src/mcp/client-install-*`, `src/mcp/claude-code-*`, and `src/mcp/opencode-*` remain deferred migration candidates.
57
+ - A future SDD can remove or stabilize compatibility facades after downstream imports are migrated.
58
+
59
+ ## SDD Cycle Complete
60
+
61
+ The change has been proposed, specified, designed, implemented through stacked PR slices, verified, and archived. The active change folder can be removed from `docs/sdd/` in favor of the dated archive copy.
@@ -0,0 +1,66 @@
1
+ # Design: Ambitious Structure Reorganization
2
+
3
+ ## Technical Approach
4
+
5
+ Use an incremental architecture migration: introduce the target layout and compatibility rules first, then move domains through reviewable slices. The migration is structural only; existing CLI/MCP/runtime behavior remains stable.
6
+
7
+ ## Architecture Decisions
8
+
9
+ ### Decision: Layer by architectural role, not current feature folders
10
+
11
+ **Choice**: Target `src/domain`, `src/application`, `src/storage`, `src/adapters`, and `src/interfaces`.
12
+ **Alternatives considered**: Keep current top-level feature folders and only split large files.
13
+ **Rationale**: The documented architecture already distinguishes domain, service layer, provider adapters, storage, and interfaces. Matching folders to that model improves maintainability for humans and agents.
14
+
15
+ ### Decision: Keep compatibility facades during migration
16
+
17
+ **Choice**: Old public files such as `src/mcp/index.ts`, `src/permissions/index.ts`, and service entrypoints stay as delegating facades until consumers are migrated.
18
+ **Alternatives considered**: Rename all imports in one PR.
19
+ **Rationale**: Facades reduce import churn, keep PRs reviewable, and make rollback possible.
20
+
21
+ ### Decision: Pilot before whole-repo migration
22
+
23
+ **Choice**: Start with `runs` and `mcp`, then apply the learned pattern to `cli`, `skills`, `sdd`, `agents`, `memory`, and remaining areas.
24
+ **Alternatives considered**: Big-bang move across all areas.
25
+ **Rationale**: `runs` and `mcp` are high-complexity and expose common pressures: service bloat, handler contracts, repositories, permissions, and tests.
26
+
27
+ ## Target Layout
28
+
29
+ ```text
30
+ src/domain/<area>/ # schemas, contracts, invariants, pure policy
31
+ src/application/<area>/ # use-case services and orchestration
32
+ src/storage/<area>/ # repositories and store-specific code
33
+ src/adapters/<provider>/ # OpenCode, Claude Code, future providers
34
+ src/interfaces/cli/ # command parsing and human rendering
35
+ src/interfaces/mcp/ # MCP schemas, tool handlers, stdio server
36
+ src/interfaces/tui/ # Ink/TUI state and visual components
37
+ ```
38
+
39
+ ## Migration Map
40
+
41
+ | Current Area | Target Area | Notes |
42
+ |---|---|---|
43
+ | `src/runs` | `domain/runs`, `application/runs`, `storage/runs` | First pilot; split lifecycle, approvals, checkpoints, grants |
44
+ | `src/mcp` | `interfaces/mcp`, `application/provider-setup`, `adapters/*` | Separate MCP transport/tools from provider setup logic |
45
+ | `src/cli` | `interfaces/cli` | Dispatch/render only; no product rules |
46
+ | `src/skills` | `domain/skills`, `application/skills`, `storage/skills` | Split schema, registry, resolver, repository |
47
+ | `src/sdd` | `domain/sdd`, `application/sdd` | Workflow contracts vs state service |
48
+ | `src/agents` | `domain/agents`, `application/agents`, `adapters/*` | Neutral agent model separate from provider projection |
49
+ | `src/memory` | `domain/memory`, `application/memory`, `storage/memory` | SQLite details under storage |
50
+
51
+ ## Testing Strategy
52
+
53
+ | Layer | What to Test | Approach |
54
+ |---|---|---|
55
+ | Type contracts | Facades and moved imports | `tsc --noEmit` |
56
+ | Unit | Extracted domain/application functions | Targeted Node tests |
57
+ | Integration | MCP/CLI behavior remains stable | Existing `test/mcp`, `test/cli`, `test/runs` |
58
+ | Runtime | Bun storage-backed paths | CI Bun storage suites |
59
+
60
+ ## Migration / Rollout
61
+
62
+ No data migration required. Roll out via chained PRs: docs/facades, `runs` pilot, `mcp` pilot, CLI/interface move, domain-by-domain cleanup.
63
+
64
+ ## Open Questions
65
+
66
+ - [ ] Confirm whether final public import paths should remain compatibility-first or move consumers entirely to the new layout before release.
@@ -0,0 +1,79 @@
1
+ # Proposal: Ambitious Structure Reorganization
2
+
3
+ ## Intent
4
+
5
+ Reorganize `vgxness` so the physical folder structure matches the product architecture: provider-neutral domain, application services, storage/repositories, provider adapters, and interfaces (`cli`, `mcp`, `tui`). The goal is maintainability: future agents and humans should know where behavior belongs, avoid duplicating rules across interfaces, and review large changes in clear architectural slices.
6
+
7
+ ## Scope
8
+
9
+ ### In Scope
10
+ - Define the target module layout and ownership rules.
11
+ - Rename/reorganize folders across all major areas: `mcp`, `cli`, `runs`, `sdd`, `skills`, `agents`, `memory`, `providers`, `setup`, `permissions`, `verification`, `workflows`, and `governance`.
12
+ - Keep compatibility facades/barrels for existing imports during migration.
13
+ - Split oversized services into cohesive domain/application/repository modules.
14
+ - Align tests with the new boundaries and reduce brittle UI-copy assertions.
15
+
16
+ ### Out of Scope
17
+ - Product behavior changes, MCP tool renames, SDD phase changes, provider install semantics, or storage schema redesign.
18
+ - Big-bang deletion of old public import paths without a deprecation bridge.
19
+ - New features beyond structural migration.
20
+
21
+ ## Capabilities
22
+
23
+ ### New Capabilities
24
+ - None.
25
+
26
+ ### Modified Capabilities
27
+ - None at product-contract level. This is an internal architecture and maintainability change.
28
+
29
+ ## Approach
30
+
31
+ Adopt a layered target structure:
32
+
33
+ ```text
34
+ src/domain/<area>/ # pure contracts, invariants, policy
35
+ src/application/<area>/ # use-case services
36
+ src/storage/<area>/ # repositories and migrations access
37
+ src/adapters/<provider>/ # OpenCode, Claude, future providers
38
+ src/interfaces/cli/ # CLI parsing/rendering only
39
+ src/interfaces/mcp/ # MCP schemas/handlers/server only
40
+ src/interfaces/tui/ # TUI rendering/state only
41
+ ```
42
+
43
+ Migration should happen in reviewable phases:
44
+ 1. Add `docs/module-boundaries.md` with naming/import rules.
45
+ 2. Create compatibility facades for current public entrypoints.
46
+ 3. Move one vertical slice per PR, starting with `runs` and `mcp`, then `cli`, `skills`, `sdd`, and remaining domains.
47
+ 4. Split large files behind stable facades before renaming directories.
48
+ 5. Verify each slice with typecheck, targeted tests, and Bun CI.
49
+
50
+ ## Affected Areas
51
+
52
+ | Area | Impact | Description |
53
+ |---|---|---|
54
+ | `docs/` | New | Boundary guide and migration map |
55
+ | `src/*` | Modified | Folder renames and module extraction across all areas |
56
+ | `src/*/index.ts` | Modified | Compatibility facades and intentional exports |
57
+ | `test/*` | Modified | Test paths aligned to domain/interface boundaries |
58
+ | `.github/workflows/` | Modified | CI may need path/test grouping updates |
59
+
60
+ ## Risks
61
+
62
+ | Risk | Likelihood | Mitigation |
63
+ |---|---:|---|
64
+ | Huge diff becomes unreviewable | High | Use staged PRs with a migration checklist |
65
+ | Import churn breaks consumers | Medium | Keep old barrels until migration completes |
66
+ | Behavior changes sneak into refactor | Medium | Require no behavior changes per slice and run targeted tests |
67
+ | Tests overfit new layout | Medium | Prefer public-contract tests over file-location tests |
68
+
69
+ ## Rollback Plan
70
+
71
+ Each slice must be independently revertible. Because compatibility facades remain, rollback should restore moved modules without changing public behavior. If a slice destabilizes CI, revert that slice and keep only documentation/checklist updates.
72
+
73
+ ## Success Criteria
74
+
75
+ - [ ] Target structure and ownership rules are documented.
76
+ - [ ] All major areas have an assigned target location.
77
+ - [ ] Existing public imports continue working during migration.
78
+ - [ ] At least one high-complexity pilot area is reorganized successfully.
79
+ - [ ] Typecheck, targeted tests, and CI pass after each slice.
@@ -0,0 +1,67 @@
1
+ # Spec: Ambitious Structure Reorganization
2
+
3
+ ## Requirements
4
+
5
+ ### Requirement: Layered Module Boundary Map
6
+
7
+ The system MUST define a target source layout that separates domain contracts, application services, storage, provider adapters, and user-facing interfaces.
8
+
9
+ #### Scenario: Target layout is documented
10
+
11
+ - GIVEN a maintainer needs to add or move code
12
+ - WHEN they read the SDD artifacts or module-boundary docs
13
+ - THEN they can identify the correct target layer for domain, service, storage, adapter, CLI, MCP, and TUI code
14
+
15
+ #### Scenario: All major areas are mapped
16
+
17
+ - GIVEN existing areas such as `mcp`, `cli`, `runs`, `sdd`, `skills`, `agents`, and `memory`
18
+ - WHEN migration planning is reviewed
19
+ - THEN every area has a target owner layer and target folder
20
+
21
+ ### Requirement: Compatibility During Migration
22
+
23
+ The system MUST preserve existing public import paths through facades or barrels until each migration slice explicitly removes a deprecated path.
24
+
25
+ #### Scenario: Existing consumers keep compiling
26
+
27
+ - GIVEN a module is moved to a new folder
28
+ - WHEN typecheck runs during the migration slice
29
+ - THEN imports through existing public entrypoints still compile
30
+
31
+ #### Scenario: Deprecated paths are intentional
32
+
33
+ - GIVEN an old barrel remains after migration
34
+ - WHEN maintainers inspect the facade
35
+ - THEN it clearly delegates to the new module location and does not contain duplicated business logic
36
+
37
+ ### Requirement: Behavior Preservation
38
+
39
+ The reorganization MUST NOT change product behavior, MCP tool names, SDD phase semantics, provider install semantics, or storage schema behavior unless a later SDD explicitly proposes that change.
40
+
41
+ #### Scenario: Refactor slice preserves behavior
42
+
43
+ - GIVEN a structural slice is implemented
44
+ - WHEN targeted tests and CI run
45
+ - THEN observable behavior remains equivalent to the pre-refactor baseline
46
+
47
+ #### Scenario: Behavior change is discovered
48
+
49
+ - GIVEN a structural slice requires a behavior change
50
+ - WHEN the change is identified
51
+ - THEN that behavior change is split into a separate SDD or explicitly rejected from the slice
52
+
53
+ ### Requirement: Reviewable Migration Slices
54
+
55
+ The migration MUST be planned as ordered, reviewable slices rather than one unbounded rewrite.
56
+
57
+ #### Scenario: High-risk migration is split
58
+
59
+ - GIVEN the total reorganization spans most of `src/`
60
+ - WHEN tasks are created
61
+ - THEN the work is divided into chained PR-sized units with clear verification per unit
62
+
63
+ #### Scenario: Pilot validates the pattern
64
+
65
+ - GIVEN the new structure is proposed
66
+ - WHEN implementation starts
67
+ - THEN one high-complexity area such as `runs` or `mcp` is migrated first before applying the pattern everywhere