groundwork-method 0.0.1 → 0.11.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 (647) hide show
  1. package/CHANGELOG.md +823 -0
  2. package/LICENSE +21 -0
  3. package/README.md +44 -29
  4. package/bin/groundwork.js +1723 -0
  5. package/dist/src/generators/add-capability/generator.d.ts +8 -0
  6. package/dist/src/generators/add-capability/generator.js +60 -0
  7. package/dist/src/generators/add-capability/generator.js.map +1 -0
  8. package/dist/src/generators/cli-app/generator.d.ts +9 -0
  9. package/dist/src/generators/cli-app/generator.js +140 -0
  10. package/dist/src/generators/cli-app/generator.js.map +1 -0
  11. package/dist/src/generators/docs-site/generator.d.ts +5 -0
  12. package/dist/src/generators/docs-site/generator.js +441 -0
  13. package/dist/src/generators/docs-site/generator.js.map +1 -0
  14. package/dist/src/generators/electron-app/generator.d.ts +6 -0
  15. package/dist/src/generators/electron-app/generator.js +261 -0
  16. package/dist/src/generators/electron-app/generator.js.map +1 -0
  17. package/dist/src/generators/flutter-app/generator.d.ts +6 -0
  18. package/dist/src/generators/flutter-app/generator.js +314 -0
  19. package/dist/src/generators/flutter-app/generator.js.map +1 -0
  20. package/dist/src/generators/go-microservice/generator.d.ts +8 -0
  21. package/dist/src/generators/go-microservice/generator.js +232 -0
  22. package/dist/src/generators/go-microservice/generator.js.map +1 -0
  23. package/dist/src/generators/nextjs-app/generator.d.ts +8 -0
  24. package/dist/src/generators/nextjs-app/generator.js +294 -0
  25. package/dist/src/generators/nextjs-app/generator.js.map +1 -0
  26. package/dist/src/generators/python-microservice/generator.d.ts +13 -0
  27. package/dist/src/generators/python-microservice/generator.js +265 -0
  28. package/dist/src/generators/python-microservice/generator.js.map +1 -0
  29. package/dist/src/generators/shared/brand-tokens.d.ts +89 -0
  30. package/dist/src/generators/shared/brand-tokens.js +308 -0
  31. package/dist/src/generators/shared/brand-tokens.js.map +1 -0
  32. package/dist/src/generators/shared/capabilities.d.ts +101 -0
  33. package/dist/src/generators/shared/capabilities.js +279 -0
  34. package/dist/src/generators/shared/capabilities.js.map +1 -0
  35. package/dist/src/generators/shared/provenance.d.ts +2 -0
  36. package/dist/src/generators/shared/provenance.js +85 -0
  37. package/dist/src/generators/shared/provenance.js.map +1 -0
  38. package/dist/src/generators/shared/scaffold-helpers.d.ts +72 -0
  39. package/dist/src/generators/shared/scaffold-helpers.js +309 -0
  40. package/dist/src/generators/shared/scaffold-helpers.js.map +1 -0
  41. package/dist/src/generators/system-test-runner/generator.d.ts +23 -0
  42. package/dist/src/generators/system-test-runner/generator.js +173 -0
  43. package/dist/src/generators/system-test-runner/generator.js.map +1 -0
  44. package/dist/src/generators/workspace-dev-cli/generator.d.ts +7 -0
  45. package/dist/src/generators/workspace-dev-cli/generator.js +138 -0
  46. package/dist/src/generators/workspace-dev-cli/generator.js.map +1 -0
  47. package/generators.json +57 -0
  48. package/lib/repo-map/grammars/tree-sitter-c.wasm +0 -0
  49. package/lib/repo-map/grammars/tree-sitter-cpp.wasm +0 -0
  50. package/lib/repo-map/grammars/tree-sitter-csharp.wasm +0 -0
  51. package/lib/repo-map/grammars/tree-sitter-dart.wasm +0 -0
  52. package/lib/repo-map/grammars/tree-sitter-go.wasm +0 -0
  53. package/lib/repo-map/grammars/tree-sitter-java.wasm +0 -0
  54. package/lib/repo-map/grammars/tree-sitter-javascript.wasm +0 -0
  55. package/lib/repo-map/grammars/tree-sitter-kotlin.wasm +0 -0
  56. package/lib/repo-map/grammars/tree-sitter-lua.wasm +0 -0
  57. package/lib/repo-map/grammars/tree-sitter-php.wasm +0 -0
  58. package/lib/repo-map/grammars/tree-sitter-python.wasm +0 -0
  59. package/lib/repo-map/grammars/tree-sitter-ruby.wasm +0 -0
  60. package/lib/repo-map/grammars/tree-sitter-rust.wasm +0 -0
  61. package/lib/repo-map/grammars/tree-sitter-scala.wasm +0 -0
  62. package/lib/repo-map/grammars/tree-sitter-swift.wasm +0 -0
  63. package/lib/repo-map/grammars/tree-sitter-tsx.wasm +0 -0
  64. package/lib/repo-map/grammars/tree-sitter-typescript.wasm +0 -0
  65. package/lib/repo-map/index.js +386 -0
  66. package/lib/repo-map/languages.js +514 -0
  67. package/lib/repo-map/pagerank.js +59 -0
  68. package/migrations/README.md +60 -0
  69. package/migrations/_template/cli-migration.js +27 -0
  70. package/migrations/gw-bet-prose-redesign.js +105 -0
  71. package/migrations/gw-drop-test-manifest.js +37 -0
  72. package/migrations/gw-register-serena-mcp.js +42 -0
  73. package/migrations/gw-relocate-hidden-skills.js +40 -0
  74. package/migrations/gw-seed-config-toml.js +24 -0
  75. package/migrations/index.json +40 -0
  76. package/package.json +70 -6
  77. package/src/AGENTS.md +36 -0
  78. package/src/config/config.toml +30 -0
  79. package/src/config/groundwork-state.json +5 -0
  80. package/src/docs/llms.txt +72 -0
  81. package/src/docs/principles/ai-native/agent-native-systems.md +90 -0
  82. package/src/docs/principles/ai-native/agentic-systems.md +78 -0
  83. package/src/docs/principles/ai-native/ai-engineering.md +100 -0
  84. package/src/docs/principles/ai-native/ai-native-product.md +76 -0
  85. package/src/docs/principles/delivery/cost-engineering.md +89 -0
  86. package/src/docs/principles/delivery/day-2-operational-baseline.md +57 -0
  87. package/src/docs/principles/delivery/devex.md +88 -0
  88. package/src/docs/principles/delivery/platform.md +101 -0
  89. package/src/docs/principles/delivery/progressive-delivery.md +92 -0
  90. package/src/docs/principles/design/ai-native-design.md +73 -0
  91. package/src/docs/principles/design/design-foundations.md +80 -0
  92. package/src/docs/principles/design/design-systems-and-tokens.md +72 -0
  93. package/src/docs/principles/design/interaction-and-motion.md +69 -0
  94. package/src/docs/principles/design/layout-and-space.md +72 -0
  95. package/src/docs/principles/design/usability-and-ux.md +79 -0
  96. package/src/docs/principles/design/visual-design.md +84 -0
  97. package/src/docs/principles/foundations/code-craft.md +86 -0
  98. package/src/docs/principles/foundations/continuous-discovery.md +75 -0
  99. package/src/docs/principles/foundations/documentation.md +102 -0
  100. package/src/docs/principles/foundations/prioritization-and-appetite.md +78 -0
  101. package/src/docs/principles/foundations/product-engineering.md +90 -0
  102. package/src/docs/principles/foundations/product-risks.md +89 -0
  103. package/src/docs/principles/foundations/requirements-and-specs.md +80 -0
  104. package/src/docs/principles/foundations/success-metrics.md +66 -0
  105. package/src/docs/principles/foundations/testing.md +108 -0
  106. package/src/docs/principles/index.md +24 -0
  107. package/src/docs/principles/quality/accessibility.md +88 -0
  108. package/src/docs/principles/quality/observability.md +84 -0
  109. package/src/docs/principles/quality/performance.md +84 -0
  110. package/src/docs/principles/quality/privacy.md +92 -0
  111. package/src/docs/principles/quality/reliability.md +89 -0
  112. package/src/docs/principles/quality/security.md +78 -0
  113. package/src/docs/principles/stack/postgres.md +100 -0
  114. package/src/docs/principles/system-design/api-design.md +86 -0
  115. package/src/docs/principles/system-design/architecture-decisions.md +81 -0
  116. package/src/docs/principles/system-design/code-structure.md +104 -0
  117. package/src/docs/principles/system-design/data-engineering.md +87 -0
  118. package/src/docs/principles/system-design/durable-execution.md +89 -0
  119. package/src/docs/principles/system-design/evolutionary-architecture.md +81 -0
  120. package/src/docs/principles/system-design/identity-and-access.md +76 -0
  121. package/src/docs/principles/system-design/integration-patterns.md +84 -0
  122. package/src/docs/principles/system-design/real-time.md +83 -0
  123. package/src/docs/principles/system-design/surface-architecture.md +74 -0
  124. package/src/docs/ways-of-working/documentation.md +69 -0
  125. package/src/docs/ways-of-working/how-we-work.md +76 -0
  126. package/src/docs/ways-of-working/units-of-work.md +40 -0
  127. package/src/engineer-skills/groundwork-electron-engineer/SKILL.md +123 -0
  128. package/src/engineer-skills/groundwork-electron-engineer/references/documentation.md +126 -0
  129. package/src/engineer-skills/groundwork-electron-engineer/references/ipc-contracts.md +138 -0
  130. package/src/engineer-skills/groundwork-electron-engineer/references/observability.md +37 -0
  131. package/src/engineer-skills/groundwork-electron-engineer/references/packaging-and-updates.md +82 -0
  132. package/src/engineer-skills/groundwork-electron-engineer/references/performance-and-reliability.md +80 -0
  133. package/src/engineer-skills/groundwork-electron-engineer/references/process-model.md +94 -0
  134. package/src/engineer-skills/groundwork-electron-engineer/references/security.md +107 -0
  135. package/src/engineer-skills/groundwork-electron-engineer/references/testing-and-smoke.md +129 -0
  136. package/src/engineer-skills/groundwork-electron-engineer/references/theming-and-tokens.md +74 -0
  137. package/src/engineer-skills/groundwork-electron-engineer/sync-anchor.md +22 -0
  138. package/src/engineer-skills/groundwork-flutter-engineer/SKILL.md +114 -0
  139. package/src/engineer-skills/groundwork-flutter-engineer/references/accessibility.md +92 -0
  140. package/src/engineer-skills/groundwork-flutter-engineer/references/architecture.md +189 -0
  141. package/src/engineer-skills/groundwork-flutter-engineer/references/data-and-contracts.md +136 -0
  142. package/src/engineer-skills/groundwork-flutter-engineer/references/documentation.md +122 -0
  143. package/src/engineer-skills/groundwork-flutter-engineer/references/navigation.md +122 -0
  144. package/src/engineer-skills/groundwork-flutter-engineer/references/observability.md +37 -0
  145. package/src/engineer-skills/groundwork-flutter-engineer/references/performance-and-reliability.md +100 -0
  146. package/src/engineer-skills/groundwork-flutter-engineer/references/platform-channels.md +93 -0
  147. package/src/engineer-skills/groundwork-flutter-engineer/references/releases-and-distribution.md +84 -0
  148. package/src/engineer-skills/groundwork-flutter-engineer/references/security.md +96 -0
  149. package/src/engineer-skills/groundwork-flutter-engineer/references/state-management.md +166 -0
  150. package/src/engineer-skills/groundwork-flutter-engineer/references/testing.md +160 -0
  151. package/src/engineer-skills/groundwork-flutter-engineer/references/theming-and-design-tokens.md +109 -0
  152. package/src/engineer-skills/groundwork-flutter-engineer/references/widgets-and-composition.md +123 -0
  153. package/src/engineer-skills/groundwork-flutter-engineer/sync-anchor.md +24 -0
  154. package/src/engineer-skills/groundwork-go-engineer/SKILL.md +174 -0
  155. package/src/engineer-skills/groundwork-go-engineer/references/api-design.md +82 -0
  156. package/src/engineer-skills/groundwork-go-engineer/references/architecture.md +42 -0
  157. package/src/engineer-skills/groundwork-go-engineer/references/capability-ports.md +50 -0
  158. package/src/engineer-skills/groundwork-go-engineer/references/code-craft-security.md +34 -0
  159. package/src/engineer-skills/groundwork-go-engineer/references/concurrency.md +108 -0
  160. package/src/engineer-skills/groundwork-go-engineer/references/documentation.md +130 -0
  161. package/src/engineer-skills/groundwork-go-engineer/references/go-services.md +77 -0
  162. package/src/engineer-skills/groundwork-go-engineer/references/http-handlers.md +172 -0
  163. package/src/engineer-skills/groundwork-go-engineer/references/implementation-patterns.md +156 -0
  164. package/src/engineer-skills/groundwork-go-engineer/references/integration-realtime-data.md +57 -0
  165. package/src/engineer-skills/groundwork-go-engineer/references/observability.md +49 -0
  166. package/src/engineer-skills/groundwork-go-engineer/references/postgres.md +41 -0
  167. package/src/engineer-skills/groundwork-go-engineer/references/reliability-performance.md +105 -0
  168. package/src/engineer-skills/groundwork-go-engineer/references/testing.md +201 -0
  169. package/src/engineer-skills/groundwork-go-engineer/sync-anchor.md +20 -0
  170. package/src/engineer-skills/groundwork-nextjs-engineer/SKILL.md +112 -0
  171. package/src/engineer-skills/groundwork-nextjs-engineer/references/accessibility.md +111 -0
  172. package/src/engineer-skills/groundwork-nextjs-engineer/references/architecture.md +323 -0
  173. package/src/engineer-skills/groundwork-nextjs-engineer/references/data-fetching.md +458 -0
  174. package/src/engineer-skills/groundwork-nextjs-engineer/references/documentation.md +324 -0
  175. package/src/engineer-skills/groundwork-nextjs-engineer/references/error-boundaries.md +383 -0
  176. package/src/engineer-skills/groundwork-nextjs-engineer/references/mutations-and-forms.md +396 -0
  177. package/src/engineer-skills/groundwork-nextjs-engineer/references/observability.md +48 -0
  178. package/src/engineer-skills/groundwork-nextjs-engineer/references/performance-and-deployment.md +947 -0
  179. package/src/engineer-skills/groundwork-nextjs-engineer/references/routing-and-navigation.md +405 -0
  180. package/src/engineer-skills/groundwork-nextjs-engineer/references/security.md +131 -0
  181. package/src/engineer-skills/groundwork-nextjs-engineer/references/server-components.md +394 -0
  182. package/src/engineer-skills/groundwork-nextjs-engineer/references/tailwind-and-styling.md +134 -0
  183. package/src/engineer-skills/groundwork-nextjs-engineer/references/testing.md +491 -0
  184. package/src/engineer-skills/groundwork-nextjs-engineer/references/type-system.md +368 -0
  185. package/src/engineer-skills/groundwork-nextjs-engineer/references/ux-principles.md +230 -0
  186. package/src/engineer-skills/groundwork-nextjs-engineer/references/visual-language.md +69 -0
  187. package/src/engineer-skills/groundwork-nextjs-engineer/sync-anchor.md +16 -0
  188. package/src/engineer-skills/groundwork-python-engineer/SKILL.md +199 -0
  189. package/src/engineer-skills/groundwork-python-engineer/references/api-standards.md +88 -0
  190. package/src/engineer-skills/groundwork-python-engineer/references/architecture.md +57 -0
  191. package/src/engineer-skills/groundwork-python-engineer/references/async-patterns.md +103 -0
  192. package/src/engineer-skills/groundwork-python-engineer/references/capability-ports.md +44 -0
  193. package/src/engineer-skills/groundwork-python-engineer/references/database.md +88 -0
  194. package/src/engineer-skills/groundwork-python-engineer/references/documentation-mcp.md +167 -0
  195. package/src/engineer-skills/groundwork-python-engineer/references/implementation-patterns.md +166 -0
  196. package/src/engineer-skills/groundwork-python-engineer/references/ml-pipelines.md +119 -0
  197. package/src/engineer-skills/groundwork-python-engineer/references/ml-systems-ai-engineering.md +74 -0
  198. package/src/engineer-skills/groundwork-python-engineer/references/observability.md +57 -0
  199. package/src/engineer-skills/groundwork-python-engineer/references/resilience.md +126 -0
  200. package/src/engineer-skills/groundwork-python-engineer/references/security.md +148 -0
  201. package/src/engineer-skills/groundwork-python-engineer/references/testing.md +216 -0
  202. package/src/engineer-skills/groundwork-python-engineer/sync-anchor.md +20 -0
  203. package/src/generators/add-capability/generator.ts +70 -0
  204. package/src/generators/add-capability/schema.json +30 -0
  205. package/src/generators/capabilities/llm/capability.json +28 -0
  206. package/src/generators/capabilities/llm/providers/anthropic/footprint.json +13 -0
  207. package/src/generators/capabilities/llm/providers/anthropic/stacks/go/internal/llm/llm.go.template +102 -0
  208. package/src/generators/capabilities/llm/providers/anthropic/stacks/python/src/__packageName__/adapters/llm.py.template +61 -0
  209. package/src/generators/capabilities/llm/providers/local/footprint.json +13 -0
  210. package/src/generators/capabilities/llm/providers/local/stacks/go/internal/llm/llm.go.template +102 -0
  211. package/src/generators/capabilities/llm/providers/local/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  212. package/src/generators/capabilities/llm/providers/localai/footprint.json +29 -0
  213. package/src/generators/capabilities/llm/providers/localai/stacks/go/internal/llm/llm.go.template +102 -0
  214. package/src/generators/capabilities/llm/providers/localai/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  215. package/src/generators/capabilities/llm/providers/none/footprint.json +9 -0
  216. package/src/generators/capabilities/llm/providers/none/stacks/go/internal/llm/llm.go.template +35 -0
  217. package/src/generators/capabilities/llm/providers/none/stacks/python/src/__packageName__/adapters/llm.py.template +25 -0
  218. package/src/generators/capabilities/llm/providers/ollama/footprint.json +20 -0
  219. package/src/generators/capabilities/llm/providers/ollama/stacks/go/internal/llm/llm.go.template +102 -0
  220. package/src/generators/capabilities/llm/providers/ollama/stacks/python/src/__packageName__/adapters/llm.py.template +53 -0
  221. package/src/generators/capabilities/llm/providers/openai/footprint.json +13 -0
  222. package/src/generators/capabilities/llm/providers/openai/stacks/go/internal/llm/llm.go.template +98 -0
  223. package/src/generators/capabilities/llm/providers/openai/stacks/python/src/__packageName__/adapters/llm.py.template +60 -0
  224. package/src/generators/capabilities/llm/stacks/go/internal/core/service/llm.go.template +12 -0
  225. package/src/generators/capabilities/llm/stacks/go/internal/llm/llm_test.go.template +33 -0
  226. package/src/generators/capabilities/llm/stacks/python/src/__packageName__/core/llm.py.template +15 -0
  227. package/src/generators/capabilities/llm/stacks/python/tests/contracts/test_llm.py.template +37 -0
  228. package/src/generators/cli-app/files/README.md.template +76 -0
  229. package/src/generators/cli-app/files/build.mjs.template +15 -0
  230. package/src/generators/cli-app/files/package.json.template +21 -0
  231. package/src/generators/cli-app/files/src/cli.ts.template +67 -0
  232. package/src/generators/cli-app/files/src/commands/hello.ts.template +17 -0
  233. package/src/generators/cli-app/files/src/commands/status.ts.template +23 -0
  234. package/src/generators/cli-app/files/src/core/client.test.ts.template +80 -0
  235. package/src/generators/cli-app/files/src/core/client.ts.template +64 -0
  236. package/src/generators/cli-app/files/src/registry.test.ts.template +35 -0
  237. package/src/generators/cli-app/files/src/registry.ts.template +31 -0
  238. package/src/generators/cli-app/files/tsconfig.json.template +16 -0
  239. package/src/generators/cli-app/files/tsconfig.test.json.template +11 -0
  240. package/src/generators/cli-app/generator.ts +138 -0
  241. package/src/generators/cli-app/schema.json +24 -0
  242. package/src/generators/docs-site/files/.gitignore.ejs +40 -0
  243. package/src/generators/docs-site/files/app/docs/__slug__/page.tsx +101 -0
  244. package/src/generators/docs-site/files/app/docs/layout.tsx +14 -0
  245. package/src/generators/docs-site/files/app/docs.css +43 -0
  246. package/src/generators/docs-site/files/app/layout.tsx +24 -0
  247. package/src/generators/docs-site/files/app/page.tsx +135 -0
  248. package/src/generators/docs-site/files/app/source.ts +8 -0
  249. package/src/generators/docs-site/files/components/mermaid.tsx +67 -0
  250. package/src/generators/docs-site/files/next.config.mjs +10 -0
  251. package/src/generators/docs-site/files/package.json +32 -0
  252. package/src/generators/docs-site/files/pnpm-workspace.yaml +7 -0
  253. package/src/generators/docs-site/files/postcss.config.mjs +6 -0
  254. package/src/generators/docs-site/files/source.config.ts +77 -0
  255. package/src/generators/docs-site/files/tailwind.config.js +10 -0
  256. package/src/generators/docs-site/files/tsconfig.json +27 -0
  257. package/src/generators/docs-site/generator.ts +476 -0
  258. package/src/generators/docs-site/schema.json +17 -0
  259. package/src/generators/electron-app/docs/principles/stack/electron/index.md +49 -0
  260. package/src/generators/electron-app/docs/principles/stack/electron/ipc-contracts.md +71 -0
  261. package/src/generators/electron-app/docs/principles/stack/electron/packaging-and-updates.md +59 -0
  262. package/src/generators/electron-app/docs/principles/stack/electron/process-model.md +53 -0
  263. package/src/generators/electron-app/docs/principles/stack/electron/security.md +70 -0
  264. package/src/generators/electron-app/docs/principles/stack/typescript/frontend.md +65 -0
  265. package/src/generators/electron-app/files/.gitignore.template +20 -0
  266. package/src/generators/electron-app/files/README.md.template +125 -0
  267. package/src/generators/electron-app/files/electron.vite.config.ts +31 -0
  268. package/src/generators/electron-app/files/eslint.config.mjs +92 -0
  269. package/src/generators/electron-app/files/forge.config.ts.template +44 -0
  270. package/src/generators/electron-app/files/package.json.template +54 -0
  271. package/src/generators/electron-app/files/playwright.config.ts +18 -0
  272. package/src/generators/electron-app/files/project.json.template +65 -0
  273. package/src/generators/electron-app/files/src/main/core-client.test.ts +81 -0
  274. package/src/generators/electron-app/files/src/main/core-client.ts +55 -0
  275. package/src/generators/electron-app/files/src/main/index.ts +157 -0
  276. package/src/generators/electron-app/files/src/main/ipc.ts +52 -0
  277. package/src/generators/electron-app/files/src/main/policy.test.ts +71 -0
  278. package/src/generators/electron-app/files/src/main/policy.ts +73 -0
  279. package/src/generators/electron-app/files/src/preload/index.ts +23 -0
  280. package/src/generators/electron-app/files/src/renderer/index.html.template +20 -0
  281. package/src/generators/electron-app/files/src/renderer/src/App.test.tsx +61 -0
  282. package/src/generators/electron-app/files/src/renderer/src/App.tsx.template +43 -0
  283. package/src/generators/electron-app/files/src/renderer/src/assets/main.css +40 -0
  284. package/src/generators/electron-app/files/src/renderer/src/env.d.ts +14 -0
  285. package/src/generators/electron-app/files/src/renderer/src/main.tsx +25 -0
  286. package/src/generators/electron-app/files/src/shared/ipc.ts +54 -0
  287. package/src/generators/electron-app/files/tests/smoke/app.spec.ts.template +133 -0
  288. package/src/generators/electron-app/files/tool/electron_exec.sh.template +83 -0
  289. package/src/generators/electron-app/files/tsconfig.json +7 -0
  290. package/src/generators/electron-app/files/tsconfig.node.json +27 -0
  291. package/src/generators/electron-app/files/tsconfig.web.json +22 -0
  292. package/src/generators/electron-app/files/vitest.config.ts +32 -0
  293. package/src/generators/electron-app/files/vitest.setup.ts +1 -0
  294. package/src/generators/electron-app/generator.ts +288 -0
  295. package/src/generators/electron-app/schema.json +23 -0
  296. package/src/generators/flutter-app/docs/principles/stack/flutter/architecture.md +78 -0
  297. package/src/generators/flutter-app/docs/principles/stack/flutter/index.md +38 -0
  298. package/src/generators/flutter-app/docs/principles/stack/flutter/platform-channels.md +51 -0
  299. package/src/generators/flutter-app/docs/principles/stack/flutter/releases-and-distribution.md +59 -0
  300. package/src/generators/flutter-app/docs/principles/stack/flutter/state-management.md +85 -0
  301. package/src/generators/flutter-app/docs/principles/stack/flutter/testing.md +86 -0
  302. package/src/generators/flutter-app/docs/principles/stack/flutter/widgets-and-composition.md +69 -0
  303. package/src/generators/flutter-app/files/.gitignore.template +30 -0
  304. package/src/generators/flutter-app/files/README.md.template +100 -0
  305. package/src/generators/flutter-app/files/analysis_options.yaml.template +18 -0
  306. package/src/generators/flutter-app/files/integration_test/app_test.dart.template +64 -0
  307. package/src/generators/flutter-app/files/lib/app.dart.template +24 -0
  308. package/src/generators/flutter-app/files/lib/config/app_config.dart +15 -0
  309. package/src/generators/flutter-app/files/lib/data/repositories/status_repository.dart +36 -0
  310. package/src/generators/flutter-app/files/lib/data/services/api_client.dart +71 -0
  311. package/src/generators/flutter-app/files/lib/domain/models/health_status.dart +23 -0
  312. package/src/generators/flutter-app/files/lib/main.dart +11 -0
  313. package/src/generators/flutter-app/files/lib/router.dart +23 -0
  314. package/src/generators/flutter-app/files/lib/ui/core/theme/app_theme.dart +110 -0
  315. package/src/generators/flutter-app/files/lib/ui/home/home_view.dart +89 -0
  316. package/src/generators/flutter-app/files/lib/ui/home/home_view_model.dart.template +38 -0
  317. package/src/generators/flutter-app/files/project.json.template +51 -0
  318. package/src/generators/flutter-app/files/pubspec.yaml.template +47 -0
  319. package/src/generators/flutter-app/files/test/api_client_test.dart.template +63 -0
  320. package/src/generators/flutter-app/files/test/fakes/fake_status_repository.dart.template +19 -0
  321. package/src/generators/flutter-app/files/test/home_view_test.dart.template +58 -0
  322. package/src/generators/flutter-app/files/tool/flutter_exec.sh.template +60 -0
  323. package/src/generators/flutter-app/generator.ts +362 -0
  324. package/src/generators/flutter-app/schema.json +23 -0
  325. package/src/generators/go-microservice/docs/principles/stack/go/concurrency.md +123 -0
  326. package/src/generators/go-microservice/docs/principles/stack/go/index.md +70 -0
  327. package/src/generators/go-microservice/docs/principles/stack/go/testing.md +168 -0
  328. package/src/generators/go-microservice/files/.air.toml.template +38 -0
  329. package/src/generators/go-microservice/files/.env.template +4 -0
  330. package/src/generators/go-microservice/files/.golangci.yml.template +82 -0
  331. package/src/generators/go-microservice/files/Dockerfile.dev.template +12 -0
  332. package/src/generators/go-microservice/files/asyncapi-pubsub.yaml.template +33 -0
  333. package/src/generators/go-microservice/files/asyncapi-ws.yaml.template +34 -0
  334. package/src/generators/go-microservice/files/cmd/api/main.go.template +149 -0
  335. package/src/generators/go-microservice/files/cmd/api/main_test.go.template +99 -0
  336. package/src/generators/go-microservice/files/cmd/worker/cleanup/main.go.template +39 -0
  337. package/src/generators/go-microservice/files/db/schema.sql.template +24 -0
  338. package/src/generators/go-microservice/files/go.mod.template +39 -0
  339. package/src/generators/go-microservice/files/internal/config/config.go.template +52 -0
  340. package/src/generators/go-microservice/files/internal/config/otel.go.template +93 -0
  341. package/src/generators/go-microservice/files/internal/core/domain/errors.go.template +16 -0
  342. package/src/generators/go-microservice/files/internal/core/domain/model.go.template +28 -0
  343. package/src/generators/go-microservice/files/internal/core/domain/user.go.template +13 -0
  344. package/src/generators/go-microservice/files/internal/core/pagination.go.template +16 -0
  345. package/src/generators/go-microservice/files/internal/core/service/app_service.go.template +79 -0
  346. package/src/generators/go-microservice/files/internal/core/service/event_hub.go.template +9 -0
  347. package/src/generators/go-microservice/files/internal/core/service/message_queue.go.template +10 -0
  348. package/src/generators/go-microservice/files/internal/core/service/outbox_repository.go.template +31 -0
  349. package/src/generators/go-microservice/files/internal/core/service/repository.go.template +23 -0
  350. package/src/generators/go-microservice/files/internal/core/service/user_repository.go.template +15 -0
  351. package/src/generators/go-microservice/files/internal/core/service/user_service.go.template +43 -0
  352. package/src/generators/go-microservice/files/internal/entrypoints/api/app_handler.go.template +108 -0
  353. package/src/generators/go-microservice/files/internal/entrypoints/api/auth_middleware_test.go.template +52 -0
  354. package/src/generators/go-microservice/files/internal/entrypoints/api/clerk_webhook.go.template +202 -0
  355. package/src/generators/go-microservice/files/internal/entrypoints/api/clerk_webhook_test.go.template +82 -0
  356. package/src/generators/go-microservice/files/internal/entrypoints/api/health_handler.go.template +80 -0
  357. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/middleware.go.template +87 -0
  358. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/middleware_test.go.template +76 -0
  359. package/src/generators/go-microservice/files/internal/entrypoints/api/idempotency/repository.go.template +37 -0
  360. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_auth.go.template +40 -0
  361. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_loadshed.go.template +38 -0
  362. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_logging.go.template +40 -0
  363. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_ratelimit.go.template +48 -0
  364. package/src/generators/go-microservice/files/internal/entrypoints/api/middleware_test.go.template +81 -0
  365. package/src/generators/go-microservice/files/internal/entrypoints/api/router.go.template +105 -0
  366. package/src/generators/go-microservice/files/internal/entrypoints/api/types.go.template +70 -0
  367. package/src/generators/go-microservice/files/internal/entrypoints/api/websocket_handler.go.template +39 -0
  368. package/src/generators/go-microservice/files/internal/httpclient/http_client.go.template +87 -0
  369. package/src/generators/go-microservice/files/internal/kafka/kafka.go.template +34 -0
  370. package/src/generators/go-microservice/files/internal/postgres/postgres.go.template +195 -0
  371. package/src/generators/go-microservice/files/internal/postgres/postgres_test.go.template +156 -0
  372. package/src/generators/go-microservice/files/internal/postgres/user_repository.go.template +56 -0
  373. package/src/generators/go-microservice/files/internal/pubsub/gcp_pubsub.go.template +35 -0
  374. package/src/generators/go-microservice/files/internal/websocket/client.go.template +151 -0
  375. package/src/generators/go-microservice/files/internal/websocket/hub.go.template +261 -0
  376. package/src/generators/go-microservice/files/scripts/apply-schema.sh.template +21 -0
  377. package/src/generators/go-microservice/files/tools/tools.go.template +10 -0
  378. package/src/generators/go-microservice/generator.ts +240 -0
  379. package/src/generators/go-microservice/schema.json +63 -0
  380. package/src/generators/nextjs-app/docs/principles/stack/typescript/frontend.md +65 -0
  381. package/src/generators/nextjs-app/files/.dockerignore.template +7 -0
  382. package/src/generators/nextjs-app/files/.env.example.template +24 -0
  383. package/src/generators/nextjs-app/files/.gitignore.template +5 -0
  384. package/src/generators/nextjs-app/files/Dockerfile +53 -0
  385. package/src/generators/nextjs-app/files/app/(auth)/sign-in/__sign-in__/page.tsx.template +9 -0
  386. package/src/generators/nextjs-app/files/app/(auth)/sign-up/__sign-up__/page.tsx.template +9 -0
  387. package/src/generators/nextjs-app/files/app/api/config/route.ts.template +39 -0
  388. package/src/generators/nextjs-app/files/app/api/healthz/route.test.ts +15 -0
  389. package/src/generators/nextjs-app/files/app/api/healthz/route.ts +5 -0
  390. package/src/generators/nextjs-app/files/app/api/proxy/__path__/route.test.ts.template +55 -0
  391. package/src/generators/nextjs-app/files/app/api/proxy/__path__/route.ts.template +126 -0
  392. package/src/generators/nextjs-app/files/app/error.tsx +39 -0
  393. package/src/generators/nextjs-app/files/app/global-error.tsx +68 -0
  394. package/src/generators/nextjs-app/files/app/globals.css +105 -0
  395. package/src/generators/nextjs-app/files/app/layout.tsx +59 -0
  396. package/src/generators/nextjs-app/files/app/loading.tsx +13 -0
  397. package/src/generators/nextjs-app/files/app/not-found.tsx +30 -0
  398. package/src/generators/nextjs-app/files/app/page.tsx +20 -0
  399. package/src/generators/nextjs-app/files/components/providers/default.tsx +19 -0
  400. package/src/generators/nextjs-app/files/components/providers/production.tsx +32 -0
  401. package/src/generators/nextjs-app/files/components/providers/telemetry.tsx +76 -0
  402. package/src/generators/nextjs-app/files/components/render-smoke.test.tsx +29 -0
  403. package/src/generators/nextjs-app/files/components/theme-provider.tsx +11 -0
  404. package/src/generators/nextjs-app/files/components.json +21 -0
  405. package/src/generators/nextjs-app/files/eslint.config.mjs +120 -0
  406. package/src/generators/nextjs-app/files/hooks/use-toast.ts +7 -0
  407. package/src/generators/nextjs-app/files/instrumentation.ts +90 -0
  408. package/src/generators/nextjs-app/files/lib/api/fetcher.ts.template +130 -0
  409. package/src/generators/nextjs-app/files/lib/config.ts +21 -0
  410. package/src/generators/nextjs-app/files/lib/logger.ts +29 -0
  411. package/src/generators/nextjs-app/files/lib/schemas/index.ts +19 -0
  412. package/src/generators/nextjs-app/files/lib/utils.ts +6 -0
  413. package/src/generators/nextjs-app/files/next.config.mjs +9 -0
  414. package/src/generators/nextjs-app/files/package.json +70 -0
  415. package/src/generators/nextjs-app/files/postcss.config.mjs +8 -0
  416. package/src/generators/nextjs-app/files/proxy.test.ts.template +30 -0
  417. package/src/generators/nextjs-app/files/proxy.ts +31 -0
  418. package/src/generators/nextjs-app/files/public/.gitkeep +1 -0
  419. package/src/generators/nextjs-app/files/tsconfig.json +42 -0
  420. package/src/generators/nextjs-app/files/vitest.config.mts +15 -0
  421. package/src/generators/nextjs-app/files/vitest.setup.ts +7 -0
  422. package/src/generators/nextjs-app/generator.ts +307 -0
  423. package/src/generators/nextjs-app/schema.json +44 -0
  424. package/src/generators/python-microservice/docs/principles/stack/python/async.md +168 -0
  425. package/src/generators/python-microservice/docs/principles/stack/python/documentation.md +240 -0
  426. package/src/generators/python-microservice/docs/principles/stack/python/mcp.md +147 -0
  427. package/src/generators/python-microservice/docs/principles/stack/python/resilience.md +193 -0
  428. package/src/generators/python-microservice/docs/principles/stack/python/testing.md +322 -0
  429. package/src/generators/python-microservice/files/.env.example.template +30 -0
  430. package/src/generators/python-microservice/files/Dockerfile.template +36 -0
  431. package/src/generators/python-microservice/files/db/schema.sql.template +19 -0
  432. package/src/generators/python-microservice/files/pyproject.toml.template +76 -0
  433. package/src/generators/python-microservice/files/scripts/apply-schema.sh.template +25 -0
  434. package/src/generators/python-microservice/files/src/__packageName__/adapters/comfyui.py.template +87 -0
  435. package/src/generators/python-microservice/files/src/__packageName__/adapters/config.py.template +48 -0
  436. package/src/generators/python-microservice/files/src/__packageName__/adapters/database.py.template +21 -0
  437. package/src/generators/python-microservice/files/src/__packageName__/adapters/message_queue.py.template +29 -0
  438. package/src/generators/python-microservice/files/src/__packageName__/adapters/repository.py.template +130 -0
  439. package/src/generators/python-microservice/files/src/__packageName__/adapters/telemetry.py.template +68 -0
  440. package/src/generators/python-microservice/files/src/__packageName__/adapters/websocket_hub.py.template +36 -0
  441. package/src/generators/python-microservice/files/src/__packageName__/core/domain/entities.py.template +22 -0
  442. package/src/generators/python-microservice/files/src/__packageName__/core/domain/exceptions.py.template +43 -0
  443. package/src/generators/python-microservice/files/src/__packageName__/core/ports.py.template +42 -0
  444. package/src/generators/python-microservice/files/src/__packageName__/core/service/example_service.py.template +68 -0
  445. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/dependencies.py.template +50 -0
  446. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/middleware.py.template +131 -0
  447. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/router.py.template +37 -0
  448. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/api/websocket_handler.py.template +20 -0
  449. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/worker/cleanup.py.template +35 -0
  450. package/src/generators/python-microservice/files/src/__packageName__/entrypoints/worker/worker.py.template +28 -0
  451. package/src/generators/python-microservice/files/src/__packageName__/main.py.template +108 -0
  452. package/src/generators/python-microservice/files/tests/test_main.py.template +74 -0
  453. package/src/generators/python-microservice/files/tests/test_middleware.py.template +109 -0
  454. package/src/generators/python-microservice/files/tests/test_worker.py.template +16 -0
  455. package/src/generators/python-microservice/generator.ts +286 -0
  456. package/src/generators/python-microservice/schema.json +86 -0
  457. package/src/generators/shared/brand-tokens.ts +301 -0
  458. package/src/generators/shared/capabilities.ts +349 -0
  459. package/src/generators/shared/provenance.ts +61 -0
  460. package/src/generators/shared/scaffold-helpers.ts +309 -0
  461. package/src/generators/system-test-runner/NATIVE-CHECK-CONTRACT.md +20 -0
  462. package/src/generators/system-test-runner/files/tests/bets/.gitkeep +0 -0
  463. package/src/generators/system-test-runner/files/tests/bets/_archive/.gitkeep +0 -0
  464. package/src/generators/system-test-runner/files/tests/conftest.py.template +503 -0
  465. package/src/generators/system-test-runner/files/tests/pyproject.toml.template +20 -0
  466. package/src/generators/system-test-runner/files/tests/system/pages/__init__.py.template +9 -0
  467. package/src/generators/system-test-runner/files/tests/system/pages/base_page.py.template +36 -0
  468. package/src/generators/system-test-runner/files/tests/system/test_a11y_smoke.py.template +132 -0
  469. package/src/generators/system-test-runner/files/tests/system/test_contract_conformance.py.template +140 -0
  470. package/src/generators/system-test-runner/files/tests/system/test_layout_geometry.py.template +109 -0
  471. package/src/generators/system-test-runner/files/tests/system/test_render_smoke.py.template +257 -0
  472. package/src/generators/system-test-runner/files/tests/system/test_system.py.template +158 -0
  473. package/src/generators/system-test-runner/files/tests/system/test_token_conformance.py.template +206 -0
  474. package/src/generators/system-test-runner/files/tests/system/test_visual_regression.py.template +104 -0
  475. package/src/generators/system-test-runner/generator.ts +196 -0
  476. package/src/generators/system-test-runner/schema.json +24 -0
  477. package/src/generators/workspace-dev-cli/cli-src/build.mjs +42 -0
  478. package/src/generators/workspace-dev-cli/cli-src/dist/dev-bundle.js +2168 -0
  479. package/src/generators/workspace-dev-cli/cli-src/src/commands/bet.ts +442 -0
  480. package/src/generators/workspace-dev-cli/cli-src/src/commands/completion.ts +87 -0
  481. package/src/generators/workspace-dev-cli/cli-src/src/commands/doctor.ts +139 -0
  482. package/src/generators/workspace-dev-cli/cli-src/src/commands/lifecycle.ts +548 -0
  483. package/src/generators/workspace-dev-cli/cli-src/src/commands/quality.ts +127 -0
  484. package/src/generators/workspace-dev-cli/cli-src/src/commands/surface.ts +214 -0
  485. package/src/generators/workspace-dev-cli/cli-src/src/index.ts +127 -0
  486. package/src/generators/workspace-dev-cli/cli-src/src/registry.ts +194 -0
  487. package/src/generators/workspace-dev-cli/cli-src/src/theme/color.ts +130 -0
  488. package/src/generators/workspace-dev-cli/cli-src/src/theme/render.ts +158 -0
  489. package/src/generators/workspace-dev-cli/cli-src/src/theme/tokens.ts +122 -0
  490. package/src/generators/workspace-dev-cli/cli-src/src/util/context.ts +43 -0
  491. package/src/generators/workspace-dev-cli/cli-src/src/util/extensions.ts +99 -0
  492. package/src/generators/workspace-dev-cli/cli-src/src/util/paths.ts +46 -0
  493. package/src/generators/workspace-dev-cli/cli-src/src/util/proc.ts +106 -0
  494. package/src/generators/workspace-dev-cli/cli-src/src/util/prompt.ts +108 -0
  495. package/src/generators/workspace-dev-cli/cli-src/src/util/runners.ts +70 -0
  496. package/src/generators/workspace-dev-cli/cli-src/src/util/services.ts +221 -0
  497. package/src/generators/workspace-dev-cli/cli-src/src/util/version.ts +21 -0
  498. package/src/generators/workspace-dev-cli/cli-src/tsconfig.json +16 -0
  499. package/src/generators/workspace-dev-cli/files/.agents/skills/workspace-cli/SKILL.md.template +74 -0
  500. package/src/generators/workspace-dev-cli/files/dev.template +16 -0
  501. package/src/generators/workspace-dev-cli/files/docker-compose.yml.template +20 -0
  502. package/src/generators/workspace-dev-cli/files/scripts/cli/templates/milestone-test.pytmpl.template +46 -0
  503. package/src/generators/workspace-dev-cli/files/scripts/cli/templates/slice-test.pytmpl.template +38 -0
  504. package/src/generators/workspace-dev-cli/generator.ts +136 -0
  505. package/src/generators/workspace-dev-cli/schema.json +22 -0
  506. package/src/hidden-skills/code-intelligence.md +135 -0
  507. package/src/hidden-skills/groundwork-architect/SKILL.md +114 -0
  508. package/src/hidden-skills/groundwork-architect/references/agentic-systems.md +44 -0
  509. package/src/hidden-skills/groundwork-architect/references/ai-native-architecture.md +37 -0
  510. package/src/hidden-skills/groundwork-architect/references/api-and-contracts.md +45 -0
  511. package/src/hidden-skills/groundwork-architect/references/core-and-boundaries.md +45 -0
  512. package/src/hidden-skills/groundwork-architect/references/data-architecture.md +33 -0
  513. package/src/hidden-skills/groundwork-architect/references/decision-records.md +34 -0
  514. package/src/hidden-skills/groundwork-architect/references/durable-execution.md +45 -0
  515. package/src/hidden-skills/groundwork-architect/references/evolutionary-architecture.md +37 -0
  516. package/src/hidden-skills/groundwork-architect/references/identity-and-access.md +41 -0
  517. package/src/hidden-skills/groundwork-architect/references/integration-patterns.md +39 -0
  518. package/src/hidden-skills/groundwork-architect/references/observability.md +36 -0
  519. package/src/hidden-skills/groundwork-architect/references/performance-and-scale.md +41 -0
  520. package/src/hidden-skills/groundwork-architect/references/platform-and-delivery.md +47 -0
  521. package/src/hidden-skills/groundwork-architect/references/realtime-and-async.md +28 -0
  522. package/src/hidden-skills/groundwork-architect/references/reliability.md +31 -0
  523. package/src/hidden-skills/groundwork-architect/references/security-and-trust.md +47 -0
  524. package/src/hidden-skills/groundwork-architect/references/surface-architecture.md +40 -0
  525. package/src/hidden-skills/groundwork-architect/sync-anchor.md +34 -0
  526. package/src/hidden-skills/groundwork-architecture/architecture-template.md +50 -0
  527. package/src/hidden-skills/groundwork-architecture/instructions.md +139 -0
  528. package/src/hidden-skills/groundwork-architecture/phases/01-context-ingestion.md +18 -0
  529. package/src/hidden-skills/groundwork-architecture/phases/02-technical-constraints.md +27 -0
  530. package/src/hidden-skills/groundwork-architecture/phases/03-service-design.md +19 -0
  531. package/src/hidden-skills/groundwork-architecture/phases/04-data-flow-communication.md +23 -0
  532. package/src/hidden-skills/groundwork-architecture/phases/05-component-boundaries-contracts.md +17 -0
  533. package/src/hidden-skills/groundwork-architecture/phases/06-draft-review-present.md +38 -0
  534. package/src/hidden-skills/groundwork-architecture/phases/07-commit.md +33 -0
  535. package/src/hidden-skills/groundwork-architecture/templates/architecture-cache.md +43 -0
  536. package/src/hidden-skills/groundwork-architecture-extract/instructions.md +163 -0
  537. package/src/hidden-skills/groundwork-architecture-extract/templates/architecture-extract-cache.md +21 -0
  538. package/src/hidden-skills/groundwork-bet/briefs/acceptance-auditor.md +68 -0
  539. package/src/hidden-skills/groundwork-bet/briefs/blind-reviewer.md +56 -0
  540. package/src/hidden-skills/groundwork-bet/briefs/coverage-auditor.md +95 -0
  541. package/src/hidden-skills/groundwork-bet/briefs/edge-case-tracer.md +64 -0
  542. package/src/hidden-skills/groundwork-bet/briefs/experience-auditor.md +83 -0
  543. package/src/hidden-skills/groundwork-bet/briefs/slice-worker.md +257 -0
  544. package/src/hidden-skills/groundwork-bet/instructions.md +88 -0
  545. package/src/hidden-skills/groundwork-bet/templates/bet-progress-test.md +115 -0
  546. package/src/hidden-skills/groundwork-bet/templates/change-proposal.md +38 -0
  547. package/src/hidden-skills/groundwork-bet/templates/decomposition/meta.json +4 -0
  548. package/src/hidden-skills/groundwork-bet/templates/decomposition/milestone-index.md +31 -0
  549. package/src/hidden-skills/groundwork-bet/templates/decomposition/slice.md +31 -0
  550. package/src/hidden-skills/groundwork-bet/templates/pitch.md +45 -0
  551. package/src/hidden-skills/groundwork-bet/templates/technical-design/01-ui-design.md +51 -0
  552. package/src/hidden-skills/groundwork-bet/templates/technical-design/02-data-flows.md +36 -0
  553. package/src/hidden-skills/groundwork-bet/templates/technical-design/03-api-design.md +90 -0
  554. package/src/hidden-skills/groundwork-bet/templates/technical-design/04-data-design.md +29 -0
  555. package/src/hidden-skills/groundwork-bet/workflows/01-discovery.md +200 -0
  556. package/src/hidden-skills/groundwork-bet/workflows/02-design.md +178 -0
  557. package/src/hidden-skills/groundwork-bet/workflows/03-decomposition.md +242 -0
  558. package/src/hidden-skills/groundwork-bet/workflows/04-delivery.md +226 -0
  559. package/src/hidden-skills/groundwork-bet/workflows/05-validation.md +210 -0
  560. package/src/hidden-skills/groundwork-design-system/instructions.md +125 -0
  561. package/src/hidden-skills/groundwork-design-system/templates/brand-tokens.md +182 -0
  562. package/src/hidden-skills/groundwork-design-system/templates/design-system-cache.md +64 -0
  563. package/src/hidden-skills/groundwork-design-system/tracks/_foundation.md +136 -0
  564. package/src/hidden-skills/groundwork-design-system/tracks/agentic-protocol.md +269 -0
  565. package/src/hidden-skills/groundwork-design-system/tracks/cli.md +355 -0
  566. package/src/hidden-skills/groundwork-design-system/tracks/graphical-ui.md +330 -0
  567. package/src/hidden-skills/groundwork-design-system-extract/instructions.md +124 -0
  568. package/src/hidden-skills/groundwork-design-system-extract/templates/design-system-extract-cache.md +19 -0
  569. package/src/hidden-skills/groundwork-designer/SKILL.md +108 -0
  570. package/src/hidden-skills/groundwork-designer/references/accessibility.md +33 -0
  571. package/src/hidden-skills/groundwork-designer/references/ai-native-design.md +37 -0
  572. package/src/hidden-skills/groundwork-designer/references/design-review.md +29 -0
  573. package/src/hidden-skills/groundwork-designer/references/design-systems-and-tokens.md +33 -0
  574. package/src/hidden-skills/groundwork-designer/references/interaction-and-motion.md +37 -0
  575. package/src/hidden-skills/groundwork-designer/references/layout-and-space.md +33 -0
  576. package/src/hidden-skills/groundwork-designer/references/usability-and-ux.md +33 -0
  577. package/src/hidden-skills/groundwork-designer/references/visual-craft.md +49 -0
  578. package/src/hidden-skills/groundwork-designer/sync-anchor.md +20 -0
  579. package/src/hidden-skills/groundwork-doc-sync/instructions.md +100 -0
  580. package/src/hidden-skills/groundwork-elicit/instructions.md +66 -0
  581. package/src/hidden-skills/groundwork-elicit/methods.md +65 -0
  582. package/src/hidden-skills/groundwork-infra-adopt/instructions.md +168 -0
  583. package/src/hidden-skills/groundwork-infra-adopt/templates/infra-adopt-cache.md +21 -0
  584. package/src/hidden-skills/groundwork-mvp/instructions.md +223 -0
  585. package/src/hidden-skills/groundwork-mvp/templates/mvp-cache.md +9 -0
  586. package/src/hidden-skills/groundwork-patch/instructions.md +40 -0
  587. package/src/hidden-skills/groundwork-persona/instructions.md +65 -0
  588. package/src/hidden-skills/groundwork-product/SKILL.md +102 -0
  589. package/src/hidden-skills/groundwork-product/references/ai-native-product.md +45 -0
  590. package/src/hidden-skills/groundwork-product/references/discovery-and-opportunity.md +38 -0
  591. package/src/hidden-skills/groundwork-product/references/product-risks.md +52 -0
  592. package/src/hidden-skills/groundwork-product/references/requirements-and-specs.md +39 -0
  593. package/src/hidden-skills/groundwork-product/references/scope-and-sequencing.md +35 -0
  594. package/src/hidden-skills/groundwork-product/references/shaping-and-appetite.md +48 -0
  595. package/src/hidden-skills/groundwork-product/references/success-metrics-and-signals.md +37 -0
  596. package/src/hidden-skills/groundwork-product/sync-anchor.md +19 -0
  597. package/src/hidden-skills/groundwork-product-brief/instructions.md +231 -0
  598. package/src/hidden-skills/groundwork-product-brief-extract/instructions.md +139 -0
  599. package/src/hidden-skills/groundwork-product-brief-extract/templates/product-brief-extract-cache.md +17 -0
  600. package/src/hidden-skills/groundwork-review/checklists/architecture.md +93 -0
  601. package/src/hidden-skills/groundwork-review/checklists/bet-pitch.md +94 -0
  602. package/src/hidden-skills/groundwork-review/checklists/decomposition.md +135 -0
  603. package/src/hidden-skills/groundwork-review/checklists/design-system.md +85 -0
  604. package/src/hidden-skills/groundwork-review/checklists/domain-entity.md +66 -0
  605. package/src/hidden-skills/groundwork-review/checklists/implementation-readiness.md +47 -0
  606. package/src/hidden-skills/groundwork-review/checklists/infrastructure.md +68 -0
  607. package/src/hidden-skills/groundwork-review/checklists/maturity.md +71 -0
  608. package/src/hidden-skills/groundwork-review/checklists/product-brief.md +69 -0
  609. package/src/hidden-skills/groundwork-review/checklists/technical-design.md +112 -0
  610. package/src/hidden-skills/groundwork-review/instructions.md +181 -0
  611. package/src/hidden-skills/groundwork-scaffold/instructions.md +254 -0
  612. package/src/hidden-skills/groundwork-scaffold/phases/01-ingestion-service-mapping.md +87 -0
  613. package/src/hidden-skills/groundwork-scaffold/phases/02-scaffolding-execution.md +15 -0
  614. package/src/hidden-skills/groundwork-scaffold/phases/03-service-documentation-api-stubs.md +100 -0
  615. package/src/hidden-skills/groundwork-scaffold/phases/04-infrastructure-verification.md +17 -0
  616. package/src/hidden-skills/groundwork-scaffold/phases/05-draft-review.md +19 -0
  617. package/src/hidden-skills/groundwork-scaffold/phases/06-commit.md +19 -0
  618. package/src/hidden-skills/groundwork-scaffold/templates/scaffold-cache.md +23 -0
  619. package/src/hidden-skills/groundwork-scan/instructions.md +164 -0
  620. package/src/hidden-skills/groundwork-scan/references/digest-schema.md +66 -0
  621. package/src/hidden-skills/groundwork-scan/references/exclusions.md +44 -0
  622. package/src/hidden-skills/groundwork-scan/templates/architecture-findings.md +42 -0
  623. package/src/hidden-skills/groundwork-scan/templates/design-findings.md +23 -0
  624. package/src/hidden-skills/groundwork-scan/templates/overview.md +26 -0
  625. package/src/hidden-skills/groundwork-scan/templates/product-findings.md +23 -0
  626. package/src/hidden-skills/groundwork-scan/templates/scan-state.json +19 -0
  627. package/src/hidden-skills/groundwork-stack-forge/instructions.md +150 -0
  628. package/src/hidden-skills/groundwork-stack-forge/references/authoring-engineer-skills.md +107 -0
  629. package/src/hidden-skills/groundwork-surface-activation/instructions.md +138 -0
  630. package/src/hidden-skills/groundwork-update/briefs/reconcile-worker.md +196 -0
  631. package/src/hidden-skills/groundwork-update/instructions.md +200 -0
  632. package/src/hidden-skills/groundwork-writer/SKILL.md +278 -0
  633. package/src/hidden-skills/maturity-model.md +125 -0
  634. package/src/hidden-skills/operating-contract.md +400 -0
  635. package/src/hidden-skills/repo-map-schema.md +90 -0
  636. package/src/hidden-skills/templates/adr.md +57 -0
  637. package/src/hidden-skills/templates/capability-ports.md +71 -0
  638. package/src/hidden-skills/templates/discovery-notes.md +33 -0
  639. package/src/hidden-skills/templates/domain-entity.md +80 -0
  640. package/src/hidden-skills/templates/gap-ledger.md +21 -0
  641. package/src/hidden-skills/templates/handoff.md +37 -0
  642. package/src/hidden-skills/templates/maturity.md +39 -0
  643. package/src/hidden-skills/templates/surfaces.md +207 -0
  644. package/src/skills/groundwork-check/SKILL.md +56 -0
  645. package/src/skills/groundwork-check/instructions.md +70 -0
  646. package/src/skills/groundwork-orchestrator/SKILL.md +176 -0
  647. package/src/skills/groundwork-orchestrator/workflow-index.md +50 -0
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: groundwork-architecture
3
+ description: >
4
+ Runs a collaborative architecture design session and produces
5
+ `docs/architecture/index.md`, the macro-level foundation for all downstream service
6
+ design. Surfaces modern best practices, explores trade-offs with the user,
7
+ and records the system's services, boundaries, and contracts.
8
+ ---
9
+
10
+ # groundwork-architecture
11
+
12
+ This is the greenfield Architecture phase: a collaborative design session that produces `docs/architecture/index.md`, the macro-level foundation for all downstream service design.
13
+
14
+ **Adopt the architect persona.** Load `.groundwork/skills/groundwork-architect/SKILL.md` and operate as it for this entire workflow. It carries your identity — a senior, pragmatic, trade-off-fluent architect — the engineering principles you apply, and a self-contained reference library (`references/`) routed by decision shape. This workflow choreographs the *conversation* — phases, gates, hand-off; the persona supplies the *expertise*. When a phase below reaches a decision the persona holds a reference for, load that reference and apply its reasoning rather than re-deriving it here.
15
+
16
+ Lead with curiosity and discovery before leading with proposals. Understand what the user envisions and what they are trying to achieve. When you can articulate their intent clearly enough to explain it back to them, you are ready to propose an architecture that delivers on it. Assumptions left unexamined here become expensive to undo in service-level design.
17
+
18
+ Education is part of this role. Most users have a clear picture of what they want the product to do; fewer have visibility into the full engineering surface that realising it requires. When a problem a user describes has a well-understood solution — a technology, an approach, a set of tradeoffs — surface it. Closing that gap is part of what makes this conversation valuable.
19
+
20
+ Apply the `groundwork-writer` skill when producing the final output document. Declarative, assertive, zero-hedging.
21
+
22
+ ---
23
+
24
+ ## How This Conversation Works
25
+
26
+ Architecture is a multi-phase collaborative design session, not a questionnaire. Each phase has a distinct goal. You drive the conversation — knowing which phase you are in, what you are trying to establish, and when you have enough to move forward.
27
+
28
+ - **Discover before proposing.** In each phase, explore the user's intent and preferences before presenting an architectural recommendation. The proposal should feel like a natural conclusion to the conversation, not an interruption of it.
29
+ - **Reflect what you heard.** Show the user you understood before moving on. Vary how you do this — a brief acknowledgment is sometimes enough; synthesising across multiple answers adds value when connections matter.
30
+ - **Resolve ambiguity, don't assume past it.** When a constraint or preference is unclear, surface it and resolve it before moving on.
31
+
32
+ ---
33
+
34
+ ## Operating Contract
35
+
36
+ Standard assistant behaviour — covering too much ground per turn, rushing to draft before the conversation has earned its conclusions, and treating documents as static after committing them — undermines collaborative design. These are the failure modes this process is built to prevent.
37
+
38
+ The shared operating contract at `.groundwork/skills/operating-contract.md` (contract v1) defines how to manage conversational pacing, discovery notes, living documents, and phase lifecycles. Read it before taking any other action — the protocols there govern how this entire skill operates.
39
+
40
+ ---
41
+
42
+ ## Initialization & Resume Protocol
43
+
44
+ ### Step 1: Cache Check
45
+
46
+ Check if `.groundwork/cache/architecture-cache.md` exists.
47
+
48
+ - If it **does not exist**, copy the template from `.groundwork/skills/groundwork-architecture/templates/architecture-cache.md` to `.groundwork/cache/architecture-cache.md`. Do not re-read the file you just wrote — the in-memory state is authoritative for the rest of this phase.
49
+ - If it **does exist**, read it. If any phases have a status of `complete`, summarise what has been established and ask whether the user wants to resume or start fresh. If they choose to start fresh, reset the cache from the template. If they choose to resume, skip to the first phase that is still `pending` — read that phase's file from the Phase Flow table below and continue from there.
50
+
51
+ ### Step 2: Discovery Notes Check
52
+
53
+ Check if `.groundwork/cache/discovery-notes.md` exists and has entries under `## Architecture`.
54
+
55
+ - If entries exist, treat them as pre-discovered context — the user has already communicated these signals and should not be asked about them again. Carry this context into the relevant phases.
56
+ - If the file does not exist, skip this step.
57
+
58
+ ### Step 2.5: User Defaults Check
59
+
60
+ Read `.groundwork/config/config.toml` if it exists. Entries under `[defaults]` (stack, llm_provider, llm_model) are the user's standing preferences — bring each one into the relevant phase as your opening proposal, with the same reasoning you would give any recommendation, and let the user confirm or override. A default is a starting position the user configured once so they stop re-answering it per project; it is never silently applied and never beyond challenge when the product's needs argue against it.
61
+
62
+ ---
63
+
64
+ ## Phase Flow
65
+
66
+ Each phase constrains the next. Completing them in order prevents decisions made late in the conversation from invalidating ones made early.
67
+
68
+ After the user confirms the output of each phase, update the corresponding section in `.groundwork/cache/architecture-cache.md` with the agreed content and set its status to `complete`.
69
+
70
+ **Cache discipline:** Write to the cache after each phase confirmation — deferred updates risk losing agreed decisions if the session is interrupted. Before starting Phase 2, verify the cache file exists (create from template if not).
71
+
72
+ **Phase gates are mandatory.** No phase may begin until all preceding phases in `.groundwork/cache/architecture-cache.md` have status `complete`. If the user asks to skip ahead, commit early, or wrap up before all phases are complete, do not comply — explain which phase remains and why it must be completed before the document can be drafted. A partial architecture document is worse than no document.
73
+
74
+ Each phase runs from its own file because each demands a different mode. At the start of each phase, read that phase's file from `.groundwork/skills/groundwork-architecture/phases/` and follow it. Never preload later phases — a session carrying instructions for work it has not reached spends working memory the current conversation needs.
75
+
76
+ | Phase | File | Establishes |
77
+ |---|---|---|
78
+ | 1. Context Ingestion | `phases/01-context-ingestion.md` | Silent read of upstream hand-off, summaries, and discovery notes |
79
+ | 2. Technical Constraints | `phases/02-technical-constraints.md` | The constraint envelope every later decision must fit |
80
+ | 3. Service Design | `phases/03-service-design.md` | The service map — core services and surface apps, what each owns, and the core's deployment |
81
+ | 4. Data Flow & Communication | `phases/04-data-flow-communication.md` | How data moves, communication patterns, and the technology per capability |
82
+ | 5. Component Boundaries & Contracts | `phases/05-component-boundaries-contracts.md` | Precise ownership and contract format per service; each surface's access path and auth model |
83
+ | 6. Draft, Review & Present | `phases/06-draft-review-present.md` | The reviewed draft, presented section by section for approval |
84
+ | 7. Commit | `phases/07-commit.md` | `docs/architecture/index.md`, the surface registry (`docs/surfaces.md` + `.groundwork/surfaces.json`), domain stubs, ADRs, hand-off, and cleanup |
85
+
86
+ ---
87
+
88
+ ## Quality Standard: What "Deep Enough" Looks Like
89
+
90
+ This is the architect persona's Output Expectations applied to the document draft — see its SKILL.md for the underlying standard; the worked example below is how it lands in `docs/architecture/index.md`.
91
+
92
+ The architecture document must give downstream engineers enough context to design services and contracts without coming back to ask "but why did we choose this?" or "what does this service actually own?" An architecture that reads like a technology shopping list has failed — it needs to convey the *reasoning* behind each decision.
93
+
94
+ **Shallow output (insufficient):**
95
+ ```markdown
96
+ ### Technology Stack
97
+
98
+ - **Database:** PostgreSQL
99
+ - **Queue:** RabbitMQ
100
+ - **Cache:** Redis
101
+ - **Auth:** Auth0
102
+ ```
103
+
104
+ **Deep output (required standard):**
105
+ ```markdown
106
+ ### Technology Stack
107
+
108
+ **Primary Data Store — PostgreSQL**
109
+
110
+ PostgreSQL serves all services requiring relational data with ACID guarantees.
111
+ The system's core domain — user accounts, story metadata, character definitions
112
+ — is inherently relational with complex query patterns (filtered searches, joins
113
+ across ownership boundaries, audit trails). PostgreSQL's JSONB support handles
114
+ the semi-structured data in story state without requiring a separate document store.
115
+
116
+ *Downstream obligations:* Every service that persists data defines its schema
117
+ migrations as versioned, idempotent scripts. Connection pooling is required at
118
+ the service level — direct connections do not scale past the connection limit
119
+ under concurrent load.
120
+
121
+ **Async Messaging — NATS JetStream**
122
+
123
+ NATS JetStream handles all asynchronous communication between services. The
124
+ system's event patterns — generation triggers, notification fan-out, analytics
125
+ capture — require durable, at-least-once delivery with consumer groups. NATS was
126
+ selected over RabbitMQ for operational simplicity (single binary, no Erlang
127
+ runtime) and over Kafka for lower resource footprint at the expected scale.
128
+
129
+ *Downstream obligations:* Every async producer defines its message schema as a
130
+ versioned AsyncAPI document. Consumer services implement idempotent handlers —
131
+ at-least-once delivery means duplicate processing is expected, not exceptional.
132
+ ```
133
+
134
+ The shallow version tells a developer what to install. The deep version tells them *why* each technology was chosen, what constraints it imposes on their service design, and what obligations flow downstream.
135
+
136
+ The same depth applies across the entire document:
137
+ - **Service boundaries** are not org charts. Each boundary should convey what the service owns, why the boundary sits where it does, and what would break if the boundary moved.
138
+ - **Data flows** are not arrows on a diagram. Each flow should explain the communication pattern, why sync or async was chosen, and what consistency model applies.
139
+ - **Contract definitions** are not API lists. Each contract should specify the format, the versioning strategy, and the downstream obligations it imposes.
@@ -0,0 +1,18 @@
1
+ # Phase 1: Context Ingestion
2
+
3
+ **This phase is silent preparation — do not speak to the user.**
4
+
5
+ Read upstream context in the order the Operating Contract Protocol 3.2 prescribes — hand-off first, then Downstream Context files, then full body only when a specific decision requires it. Pre-loading the full upstream docs into context wastes the working memory you need for the architectural decisions ahead.
6
+
7
+ Read in this order:
8
+
9
+ 1. **Hand-off file (full)** — `.groundwork/cache/handoff/design-system.md` if it exists. Carries the design system phase's rejected directions, deferred decisions, and user instincts that did not fit in `docs/design-system.md`. Read in full.
10
+ 2. **Downstream Context files (Protocol 5)** — read the upstream phases' context files from `.groundwork/context/`:
11
+ - `.groundwork/context/product-brief.md` — Key Decisions, Binding Constraints, Deferred Questions
12
+ - `.groundwork/context/design-system.md` — non-functional requirements, performance and interaction budgets, accessibility floors
13
+ 3. **Discovery notes** — `.groundwork/cache/discovery-notes.md`, only entries under `## Architecture`.
14
+ 4. **Full body sections — lazy** — read a section from the body of an upstream `docs/*.md` only when a specific decision in Phases 2–5 requires detail the Downstream Context file does not carry. Do not pre-load the full body.
15
+
16
+ The orchestrator guarantees the upstream docs and their Downstream Context files exist before this skill is invoked — if a file is missing, proceed without it and note the gap internally. The hand-off file is optional; if absent, the previous phase had nothing to drop.
17
+
18
+ Arrive at Phase 2 already knowing as much about the system as the Downstream Context files and hand-off can tell you, with the body available for lazy reads when specific decisions demand it.
@@ -0,0 +1,27 @@
1
+ # Phase 2: Technical Constraints
2
+
3
+ Constraints define the boundaries of the design space. Establishing them first means technology and topology decisions are made within a realistic envelope — not revisited when a hard constraint rules out a design already agreed on.
4
+
5
+ **Apply from the architect references:** `security-and-trust.md` (trust model, multi-tenancy strategy, the privacy and compliance inputs), `reliability.md` (SLOs, RTO/RPO and what they demand of the topology), and `performance-and-scale.md` (reading the demand shape, scale-to-zero, managed-vs-self-managed). Load the reference when its constraint area is in play and apply its reasoning rather than re-deriving it.
6
+
7
+ **How to run this conversation:**
8
+
9
+ Open by summarising what you already know from the existing documents. Then work through the constraint areas — one at a time if needed, but if a single exchange gives you confident answers across multiple areas, capture them all. Never advance on a constraint that is unclear or assumed; resolve it before moving on.
10
+
11
+ These areas commonly surface constraints, but the conversation may reveal others. Cover them in whatever order flows naturally:
12
+
13
+ - **Content and regulatory** — what the product handles and where it operates determines which platforms, providers, and data handling approaches are available. Sensitive content categories, regulated data types (PII, health, financial), data residency obligations, and jurisdiction-specific hosting requirements can each eliminate entire infrastructure approaches. Explore compliance frameworks that may apply — GDPR, HIPAA, PCI-DSS, SOC 2 — as these drive audit logging, access control, and encryption requirements beyond just data location.
14
+
15
+ - **Security and trust model** — how the system authenticates users and services, how it authorises access to resources, and how it isolates data between users or tenants are architectural decisions, not implementation details. Multi-tenancy strategy (shared database, schema-per-tenant, database-per-tenant) must be decided here because it affects data models, query patterns, and compliance boundaries across every service.
16
+
17
+ - **Scale and infrastructure model** — understand the shape of the system's demand and what the team is willing to manage. For indie and hobby projects, a key question is whether costs can reach near-zero during inactivity — scale-to-zero is a legitimate architectural requirement that shapes every infrastructure choice that follows. For systems expecting continuous load, understand whether demand is spiky and unpredictable or stable and forecastable — these require fundamentally different approaches. Fully managed services trade operational burden for higher spend and vendor dependency; self-managed infrastructure trades convenience and reliability for control and cost.
18
+
19
+ - **Availability and reliability** — understand the system's availability expectations and what happens when parts of it fail. The acceptable recovery time if the system goes down (RTO) and how much data loss is tolerable in a failure scenario (RPO) drive decisions about redundancy, replication, failover, and backup strategy. A system that must be 99.99% available is architecturally different from one where an hour of downtime is acceptable.
20
+
21
+ - **Geographic distribution** — where users are and whether the system needs to serve them from multiple regions. Latency-sensitive products with a global user base may require edge delivery, regional deployments, or CDN strategies that fundamentally change the topology — this is about where the system physically runs, not just how fast it responds.
22
+
23
+ - **Existing technology and vendor constraints** — what is already in place, what is off the table, and what commitments already exist. An existing cloud provider relationship, a legacy system that must be integrated, a technology ban, or a team's existing expertise all constrain the design space in ways that the documents may not have captured.
24
+
25
+ - **Performance** — latency and throughput targets are typically captured in the Design System NFRs. Reference those directly. Only explore further here if they are absent or if the architecture introduces system paths the design phase did not account for.
26
+
27
+ When you have a clear picture of the constraints, summarise them and confirm with the user before moving to Phase 3.
@@ -0,0 +1,19 @@
1
+ # Phase 3: Service Design
2
+
3
+ Decide how the system is divided into services and what each one owns. This decision determines deployment independence, operational complexity, and every integration contract downstream. Getting the boundaries wrong is expensive to undo.
4
+
5
+ The goal is right-sized services — few enough to avoid distributed systems overhead, well-defined enough that each can be deployed and scaled independently. Splitting too finely creates operational noise for no benefit. Splitting too coarsely forces incompatible workloads into a single deployment.
6
+
7
+ **Apply from the architect references:** `core-and-boundaries.md` — the converging-signals test for when a boundary is justified, the core/surface model, and the inward-dependency rule that keeps the domain clean. This is the persona's core reference; load it before proposing the service map.
8
+
9
+ A service boundary is justified when multiple signals converge: the language and mental model shift, the runtime or scaling profile is incompatible with the rest, or the deployment cadence is fundamentally different. One signal alone is rarely enough.
10
+
11
+ **The core/surface classification.** Every product is one **capability core** — the domain logic, data, and contracts, always designed and validated headless — plus zero or more **surfaces**, the deployed artifacts consumers interact with: a web app, a CLI binary, a mobile app, an MCP server. Surfaces are adapters over the core. The service map carries this classification because downstream phases read it: the scaffold generates one app per surface, and the bet loop proves capability behaviour against the core's contracts with no surface running.
12
+
13
+ The core's **deployment** is decided here too: **hosted** (services reached over a network) or **embedded** (a library in-process with its single surface). A service fleet behind a gateway is a hosted core; a self-contained CLI is an embedded core its command layer calls in-process — the same model with one deployment answer. The decision determines the contract spec format downstream (OpenAPI/AsyncAPI for hosted HTTP/event boundaries, a typed public module API for an embedded core); nothing else branches on it.
14
+
15
+ **How to run this conversation:**
16
+
17
+ Start by sharing your current read of the system from the existing documents. Then explore with the user where the natural fault lines are — where the work feels different, where the technology or scaling needs diverge.
18
+
19
+ Propose the service map in text form: for each component, what it owns, why the boundary sits where it does, whether it is a core service or a surface app, and a name following modern service naming conventions. The surface set comes from the product brief's summary — propose the classification rather than interrogating for it. For most products it is obvious (each client app is a surface; everything that owns domain logic or persistence is core), and for a single-surface product it settles in the same exchange as the service map. Spend conversation only where the line is genuinely contestable — an admin panel that owns its own data, a worker that renders user-facing output. Propose the core's deployment alongside the classification: one surface over an in-process core is embedded; anything reached over a network is hosted. Confirm before moving on.
@@ -0,0 +1,23 @@
1
+ # Phase 4: Data Flow & Communication
2
+
3
+ Define how data moves through the system — what each service receives, what it produces, how services communicate with each other, and what storage each service requires.
4
+
5
+ This phase turns the service map from Phase 3 into a living system. Understanding data flow before committing to specific technologies prevents premature optimisation and ensures technology choices serve the actual communication patterns rather than hypothetical ones.
6
+
7
+ API contracts and database schemas are not designed here. They belong to the Bet phase, where each feature is designed in detail. The architecture phase produces the skeleton those details will be built on.
8
+
9
+ **Apply from the architect references:** `integration-patterns.md` (the sync-vs-async decision, outbox, retries, timeouts as budgets), `realtime-and-async.md` (any streaming/live path), `data-architecture.md` (data ownership, event/table contracts, retention), and `ai-native-architecture.md` (the model-provider decision and what it obligates). Load the reference for the pattern in play and embed its trade-off in the proposal.
10
+
11
+ **How to run this conversation:**
12
+
13
+ Use the service map from Phase 3 and the constraints from Phase 2 to draft a complete data flow proposal covering every service at once. For each service, specify: inputs and their sources, outputs and their consumers, communication pattern (sync vs async) with the reasoning behind the choice, and storage needs including data shape and access patterns. Present this as a single structured proposal the user can scan, correct, and refine — proposing all flows together exposes cross-service dependencies and inconsistencies that per-service interrogation hides.
14
+
15
+ For every sync/async decision, embed the tradeoff in the proposal — sync creates coupling but simplifies reasoning; async adds resilience but introduces eventual consistency. The user reacts to concrete tradeoffs faster than they answer abstract questions about them.
16
+
17
+ Once data flows are confirmed, propose the specific technology for each capability area: the database, the queue, the streaming platform, the cache, the auth provider, the file store. Attach rationale and downstream obligations to each choice — the implementation requirements that flow from each decision into service-level design.
18
+
19
+ For any system that calls an LLM, the **model provider and model** are a first-class technology decision here, not an implementation detail to settle later — name them explicitly (provider plus the specific model), with rationale and the downstream obligations they impose (a streaming path, prompt caching of any large shared context, a moderation/safety gate, cost and latency budgets). This is an ADR-worthy decision: the scaffold phase maps the named provider onto a generator flag and the bet that follows builds the provider-specific integration against it, so an unnamed or assumed provider becomes a silent mismatch the moment code is generated. State it.
20
+
21
+ As implementation details emerge — async flows, ownership decisions, callback patterns, schema implications — capture them immediately in `## Design Details` in `.groundwork/cache/discovery-notes.md`. These details feed the API contract and database schema design phases downstream.
22
+
23
+ Think across the full range of capabilities a system typically requires — data persistence, real-time delivery, search, background processing, file storage, authentication, messaging, and external integrations — and address each one that applies.
@@ -0,0 +1,17 @@
1
+ # Phase 5: Component Boundaries & Contracts
2
+
3
+ Define the precise boundary of each service: what it owns, what it explicitly does not own, and how it exposes its capabilities.
4
+
5
+ **How to run this conversation:**
6
+
7
+ Use the service map and confirmed data flows to draft a complete boundary proposal for all services at once. For each service, specify: what it owns, what it explicitly does not own, and the contract format for each interface (REST APIs → OpenAPI spec, async events → AsyncAPI schema, agent capabilities → MCP schema). Present this as a structured summary the user can scan and correct in a single pass — batch presentation lets the user spot ownership conflicts across services that sequential discussion obscures.
8
+
9
+ Where ownership is ambiguous — two services have a reasonable claim over a concept or a piece of data — call out the conflict explicitly, present the competing options with their consequences, and resolve with the user before finalising. Clear ownership precedes contract definition; a contract assigned to the wrong owner compounds the error into every downstream service that depends on it.
10
+
11
+ **Per surface, settle the access path and auth model.** How does each surface app from the Phase 3 map reach the core — directly against a service, through a shared gateway, or through a BFF of its own? Ask the BFF question rather than presuming an answer in either direction: a BFF earns its place when a surface's data-shaping needs diverge enough that a shared contract serves it badly, and it costs an extra deployment and another contract to keep honest. Surface that trade-off per surface and let the user decide. Settle each surface's auth model against the core in the same pass — a browser session, an API token, an in-process call with no auth boundary — because the access path and the auth model constrain each other. For a single-surface product this is one short exchange: the access path falls out of the core's deployment and there is one auth model to name.
12
+
13
+ **Contract compatibility across independently deployed surfaces.** When two or more surfaces deploy independently — a web app ships continuously while a mobile fleet lags releases by months — published contracts outlive any single deploy and every contract change becomes a cross-surface event. Extract a contract-compatibility stance from the user: what the system promises about published contract fields ("we never break a published contract field; removal requires deprecation across N releases" is the common shape) and how breaking changes, when unavoidable, are versioned and rolled out. This is an architecture commitment, not a delivery afterthought — record it as a Binding Constraint so every downstream bet designs its contracts inside it. A product whose surfaces deploy as one artifact, or that has a single surface, skips this entirely.
14
+
15
+ **Per capability, settle the provider and its footprint.** A service consumes technical capabilities — LLM inference, a relational/vector store, messaging, telemetry, object storage — and each is an interface the architecture must bind to a concrete provider. For each, decide the provider and its operational footprint (exactly one of `env` for a hosted API reached by key, `compose-service` for a container the stack runs, `runner` for a native process `./dev` manages, or `none`). **`none` is the bare-interface choice** — ship the interface and a failing contract test now, build the provider as a bet later — and it is the honest answer whenever the implementation is genuinely undecided or deferred: prefer it over inventing a provider the product has not committed to. Infrastructure is a *consequence* of these choices, never a default — a database exists because a store provider's footprint is a compose service, a tracing backend because a telemetry provider was selected. Record each capability → provider → footprint in the architecture's "Capability Ports & Providers" table (§3); the scaffold reads this to compose generators, infrastructure, and runners, and to know which capabilities are bets.
16
+
17
+ Every data boundary is a trust boundary. Identifying which boundaries exist is an architectural decision made here; how validation is implemented is enforced at the service level.
@@ -0,0 +1,38 @@
1
+ # Phase 6: Draft, Review & Present
2
+
3
+ The architecture document synthesises decisions from Phases 2 through 5. Drafting before all phases are complete produces a document missing data flows, technology rationale, and boundary definitions — the sections that make the difference between a useful architecture and a technology shopping list. Verify that all phases in `.groundwork/cache/architecture-cache.md` are marked `complete` before starting the draft.
4
+
5
+ **Before drafting**, silently scan the conversation. If any area from Phases 2–5 surfaced but remains too thin to write about, ask one more targeted question before proceeding.
6
+
7
+ When ready:
8
+
9
+ 1. **Load the template.** Read `.groundwork/skills/groundwork-architecture/architecture-template.md` to load the required section structure. Do not invent a custom structure — the template is the canonical format.
10
+
11
+ 2. **Draft.** Synthesize Phases 2–5 into the template structure. The Service-Level Requirements table carries the architectural obligations into service-level design — every decision made in Phase 4 that imposes a requirement on a downstream service gets a row in this table. Apply the `groundwork-writer` skill: declarative, active voice, no hedging. Record decisions and their rationale — not the options that were considered.
12
+
13
+ Write the draft as a directory of per-section files under `.groundwork/cache/architecture-draft/`. Each file stays bounded in size, so any later change (review revise, post-review edit) touches only the affected files instead of regenerating the whole doc in a single turn. Regenerating the whole doc at once exhausts the per-response output token budget on rich architectures; the per-section layout makes that failure structurally impossible. Use one `write_file` call per section (the tool creates parent directories automatically):
14
+
15
+ | File | Content |
16
+ |---|---|
17
+ | `00-header.md` | The document title and brief introduction. No summary section — the Downstream Context (Protocol 5) is written separately at commit, not concatenated into the doc |
18
+ | `01-constraints-and-budgets.md` | Template section 1 |
19
+ | `02-top-level-topology.md` | Template section 2 |
20
+ | `03-key-capabilities.md` | Template section 3 (capability areas and technology decisions with rationale, including the **Capability Ports & Providers** table: each capability → provider → footprint settled in Phase 5) |
21
+ | `04-component-boundaries.md` | Template section 4 |
22
+ | `05-communication-patterns.md` | Template section 5 |
23
+ | `06-service-level-requirements.md` | Template section 6 (the SLR table) |
24
+ | `07-surfaces-and-capability-core.md` | Template section 7: the core's deployment (hosted or embedded) with its consequence for contract format, and one line per surface — type, access path, auth. For independently deployed surfaces, the contract-compatibility stance. Detail lives in `docs/surfaces.md` (written at commit); this section carries the decisions |
25
+
26
+ The numeric prefixes determine concatenation order at commit. Each file is a self-contained markdown section — its top-level heading should start at H2 (`## 1. Constraints & Budgets`) to compose cleanly when the files are concatenated.
27
+
28
+ 3. **Review.** Announce that the review process is starting. Assemble the draft for review: `run_command("cat .groundwork/cache/architecture-draft/*.md > .groundwork/cache/architecture-draft.md")`. This is a shell operation, not a model emission — it does not consume output tokens regardless of doc size. Then invoke the review subagent (Protocol 9) with `document_path: .groundwork/cache/architecture-draft.md` and `document_type: architecture`. Report the verdict and any findings explicitly before proceeding. The gate is fail-closed (Protocol 8): proceed only on a parseable `VERDICT: PRESENT`; a review that errors, hangs, or returns no verdict follows Protocol 9's failure path.
29
+
30
+ 4. **Revise loop.** If the verdict is **REVISE**:
31
+ - Apply all 🔴 Critical findings directly to the affected section file(s) under `.groundwork/cache/architecture-draft/`. Do not produce a list of suggestions — rewrite only the files the finding implicates. Each `write_file` is bounded by the size of one section, never the whole doc.
32
+ - Re-assemble: `run_command("cat .groundwork/cache/architecture-draft/*.md > .groundwork/cache/architecture-draft.md")`.
33
+ - Run the review again. Repeat until the verdict is **PRESENT**.
34
+ - **Cap.** After 3 REVISE verdicts, apply the revise cap defined in Protocol 8: stop revising, surface remaining 🔴 Critical findings as 🟡 Advisory, and disclose that the review did not reach PRESENT and how many critical findings remain.
35
+
36
+ 5. **Present.** Once the verdict is PRESENT, present the final draft section by section — emit each section file's contents in turn, pausing briefly between sections so the user can respond. Do not emit the full document in a single message; large architectures exceed the per-response output token budget. After all sections are presented, surface any 🟡 Advisory findings from the final review pass so the user can decide whether to act on them. Clean up the assembled file once presentation is complete: `run_command("rm .groundwork/cache/architecture-draft.md")`. The section files remain the source of truth for Phase 7.
37
+
38
+ 6. Ask the user whether to save the architecture as-is or refine anything first. When the user wants to push a section deeper — or a section reads thin against the quality standard in the entry `instructions.md` — load `.groundwork/skills/groundwork-elicit/instructions.md` and follow it. Proceed to Phase 7 only on explicit approval.
@@ -0,0 +1,33 @@
1
+ # Phase 7: Commit
2
+
3
+ Execute **only** after the user has explicitly approved the complete draft in Phase 6 and all phases in `.groundwork/cache/architecture-cache.md` are marked `complete`. Follow the Phase Lifecycle commit protocol from the Operating Contract (Protocol 3.4).
4
+
5
+ 1. **Write the Downstream Context file (Protocol 5).** Apply the `groundwork-writer` skill to write `.groundwork/context/architecture.md` — the four-subsection contract per Protocol 5: Key Decisions (technology choices, service boundaries, communication patterns), Binding Constraints (the constraints from Phase 2 that downstream services must respect), Deferred Questions (anything punted to bet planning), Out of Scope. This is the contract every downstream phase reads first, and it is written to the ephemeral context store, not into `docs/architecture/index.md` — the assembled doc carries no summary section. Carry forward any binding user-facing constraint inherited from the product brief or design system — age or consent gating, confirmation requirements, data-handling rules — into the Binding Constraints here. If the product's surfaces deploy independently, record the contract-compatibility stance from Phase 5 under Binding Constraints — downstream bets design contracts inside it. Downstream domain docs are reviewed against this Downstream Context and the ADRs, never against the brief, so a constraint absent here is invisible to every entity that must honour it.
6
+
7
+ 2. **Extract domain entities.** Identify every core domain entity that surfaces in the architecture — the nouns that services own (users, accounts, orders, sessions, events, and similar). For each entity, write a stub to `docs/architecture/domain/<entity-name>.md` using the template at `.groundwork/skills/templates/domain-entity.md`. Each stub must specify: what the entity is, its core fields, its lifecycle states with transition triggers, the service that owns it, and the events it emits on state change. Stubs are explicitly incomplete — bet planning extends them as the system grows. Create the `docs/architecture/domain/` directory if it does not exist.
8
+
9
+ 3. **Write architectural decision records.** For each significant decision made during the architecture conversation — auth strategy, messaging pattern, database choice, communication patterns, service boundaries, deployment approach — write an ADR to `docs/architecture/decisions/NNNN-<slug>.md` using the template at `.groundwork/skills/templates/adr.md`. Significance test: would a new engineer joining the project need to know this decision to avoid relitigating it? If yes, record it. Number sequentially: read the existing `docs/architecture/decisions/` directory and use the next available integer (zero-padded to four digits, starting at `0001`). Each ADR follows the governed template: context (what forced the decision), decision (what was chosen), **assumptions** (what must stay true for it to remain right — the conditions that, if they break, bring it back for review), a **review trigger** (the condition or date that should resurface it), and trade-offs (what was given up, what risk was accepted), with an **owner** accountable for it. The assumptions and trigger are what let the decision be re-evaluated when circumstances change rather than silently going stale. Status starts as `accepted`; a later decision supersedes rather than overwrites this one. Create the `docs/architecture/decisions/` directory if it does not exist.
10
+
11
+ 4. **Assemble the final architecture.** Concatenate the section files into the canonical location: `run_command("mkdir -p docs/architecture && cat .groundwork/cache/architecture-draft/*.md > docs/architecture/index.md")`. The `mkdir -p` guarantees the nested directory exists even when the product has no domain entities or ADRs to create it first. The numeric prefixes guarantee the correct section order. This is a shell operation, not a model emission — it does not consume output tokens regardless of doc size.
12
+
13
+ 4b. **Seed the architecture section's sidebar order.** If `docs/architecture/meta.json` does not yet exist, write it so the docs-site rail orders the section overview first: `{ "pages": ["index", "infrastructure", "domain", "services", "api", "decisions", "..."] }`. This is the within-folder companion to the top-level `docs/meta.json` the docs-site generator seeds; writing it here means a fresh project gets the right order without waiting for a docs-site regeneration. Never clobber an existing one.
14
+
15
+ 5. **Write the surface registry.** Create `docs/surfaces.md` following the contract at `.groundwork/skills/templates/surfaces.md`, projecting the decisions already made: the Capability Core section (what the core owns, its deployment from Phase 3, where its contracts will live), one Surface Registry entry per surface app in the service map (the access path and auth model come from Phase 5; `scaffold` names the generator the stack decision implies, or `manual` when no generator exists for the platform — the registry never blocks on tooling; `status` follows the brief's horizon: MVP-horizon surfaces `active`, roadmap surfaces `planned`), and the Capability Ledger section as its table headers with no rows — bet validation writes the rows as capabilities ship. In the same step, write the machine twin `.groundwork/surfaces.json` per the schema in the template, with an empty `capabilities` array — the two files are projections of the same decisions and are always written together. The scaffold phase derives its targets from this registry, so a registry that disagrees with the architecture's service map silently breaks the build chain. Write the registry even for a single-surface product — it is cheap, and downstream phases read it.
16
+
17
+ 5b. **Write the capability-ports registry.** Project the architecture's "Capability Ports & Providers" table (§3) into its machine twin `.groundwork/capability-ports.json`, following the contract at `.groundwork/skills/templates/capability-ports.md`: one entry per capability with its `capability`, the chosen `provider`, and its `footprint` (`env` · `compose-service` · `runner` · `none`). Prose (`docs/architecture/index.md` §3) and JSON are projections of the same decisions and are written in the same commit. The scaffold phase reads this to choose generator flags, inject only the infrastructure providers require, register runner-footprint providers, and seed a bare interface (`none`) with a failing contract test. A product with no technical capabilities writes an empty `ports` array — downstream phases still read it.
18
+
19
+ 6. **Review the domain stubs and ADRs.** The domain docs (step 2) and ADRs (step 3) were written but not yet gated, and `groundwork-review` defines a `domain-entity` document type precisely for them. Invoke the review subagent on each `docs/architecture/domain/<entity>.md` with `document_type: domain-entity`. The isolated reviewer checks each entity against the architecture's Downstream Context (`.groundwork/context/architecture.md`, Protocol 5) and the accepted ADRs, catching an invariant that asserts a guarantee an ADR surrendered, a domain event that implies a broker the architecture does not provision, and any field, owner, or lifecycle that contradicts the committed architecture. Apply 🔴 findings to the affected domain doc or ADR and re-review until `PRESENT`. The gate is fail-closed and the revise cap applies (Protocol 8).
20
+
21
+ 7. **Write the hand-off file.** Copy `.groundwork/skills/templates/handoff.md` to `.groundwork/cache/handoff/architecture.md` and fill in only the sections that have content: rejected technology choices with rationale, deferred decisions (multi-region rollout, observability stack, anything punted), user instincts about scaling or vendor preferences not yet committed, and any other context the scaffold phase needs. Omit empty sections. This is the Hand-off Cache contract from Protocol 6.
22
+
23
+ 8. **Clean up caches.** Remove the architecture phase's own caches and the previous phase's consumed hand-off: `run_command("rm -rf .groundwork/cache/architecture-draft .groundwork/cache/architecture-cache.md .groundwork/cache/handoff/design-system.md")`. The Cache Isolation rule (Protocol 7) requires the previous hand-off to be deleted once consumed.
24
+
25
+ 9. Apply the Living Documents protocol — scan the conversation for insights that refine any existing `docs/` artifact (e.g. `docs/product-brief.md`, `docs/design-system.md`). Apply surgical updates and refresh the affected Downstream Context files in `.groundwork/context/` (Protocol 5). Report what changed. If an update **reverses** a prior Key Decision or Binding Constraint (Protocol 2 — e.g. architecture overturns a design-system or brief commitment), follow the Reversal Protocol: reconcile the full body of the affected doc, fix dependent docs, write the superseding ADR, and re-invoke `groundwork-review` on each mutated doc before committing.
26
+
27
+ 10. Update discovery notes — scan for out-of-phase signals not captured in real time. Remove `## Architecture` entries incorporated into `docs/architecture/index.md` or the hand-off file.
28
+
29
+ 11. Confirm that the phase is complete.
30
+
31
+ 12. Recommend a fresh context for the next phase — a clean context gives the next skill full working memory.
32
+
33
+ 13. Immediately load and execute the `groundwork-orchestrator` skill to show the user what's next. Do not ask the user to invoke it — hand off automatically.
@@ -0,0 +1,43 @@
1
+ # Architecture Cache
2
+
3
+ > This file captures approved outputs from each phase of the Architecture design session. It is used to resume work and to compile the final `docs/architecture/index.md`. Do not edit manually.
4
+
5
+ ---
6
+
7
+ ## Phase 2: Technical Constraints
8
+
9
+ **Status:** pending
10
+
11
+ <!-- Replace with the agreed constraints summary once the user confirms. -->
12
+
13
+ ---
14
+
15
+ ## Phase 3: Service Design
16
+
17
+ **Status:** pending
18
+
19
+ <!-- Replace with the agreed service boundaries, ownership decisions, topology, the core/surface classification of every component, and the core's deployment (hosted or embedded) once the user confirms. -->
20
+
21
+ ---
22
+
23
+ ## Phase 4: Data Flow & Communication
24
+
25
+ **Status:** pending
26
+
27
+ <!-- Replace with the agreed data flows, communication patterns, and technology decisions once the user confirms. -->
28
+
29
+ ---
30
+
31
+ ## Phase 5: Component Boundaries & Contracts
32
+
33
+ **Status:** pending
34
+
35
+ <!-- Replace with the agreed service boundaries, trust boundaries, contract definitions, each surface's access path and auth model, and the contract-compatibility stance where surfaces deploy independently, once the user confirms. -->
36
+
37
+ ---
38
+
39
+ ## Phase 6: Draft, Review & Present
40
+
41
+ **Status:** pending
42
+
43
+ <!-- Set to complete once the user has approved the final draft for commit. -->
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: groundwork-architecture-extract
3
+ description: >
4
+ Reconstructs an existing system's architecture from the scan findings and
5
+ deterministic code map into `docs/architecture/index.md`, the surface registry
6
+ (`docs/surfaces.md` + `.groundwork/surfaces.json`), domain stubs, and ADRs —
7
+ exact structural facts, not guesses. Confirms the recovered structure with
8
+ the user and mints ADRs only where the user supplies the rationale.
9
+ ---
10
+
11
+ # groundwork-architecture-extract
12
+
13
+ You are a systems archaeologist with an architect's eye. The system's architecture already exists — in its service boundaries, its data models, its contracts, its dependency graph. Your job is to recover it into `docs/architecture/index.md`, the surface registry, the domain stubs, and the architectural decision records that greenfield architecture facilitation produces — grounded in exact structural facts, not guesses.
14
+
15
+ This is Phase 3 of the brownfield track, and the heaviest extract phase. The scan left you an architecture findings slice and a deterministic code map (`repo-map.json`). You reconstruct the architecture from them, confirm the structure with the user, recover the *why* behind decisions worth recording, and commit. The output matches greenfield architecture exactly — and downstream domain docs are reviewed against its Downstream Context file.
16
+
17
+ Two principles govern this phase:
18
+
19
+ - **Structure is recovered, not invented.** The service map, boundaries, data flows, and dependency edges come from the code map and findings — exact facts, not inference. You confirm them with the user; you do not guess them.
20
+ - **Code reveals what was chosen, rarely why.** An ADR needs a rationale and the alternatives that were weighed. The code shows the decision but not the reasoning. **Mint an ADR only where the user supplies the rationale in conversation** — otherwise the fact belongs in `docs/architecture/index.md`, not in a fabricated decision record. Do not manufacture a decisions zoo from observation.
21
+
22
+ Apply the `groundwork-writer` skill when producing output documents. Declarative, assertive, zero-hedging.
23
+
24
+ ---
25
+
26
+ ## Why This Step Matters
27
+
28
+ `docs/architecture/index.md` is the macro foundation every later phase builds on:
29
+
30
+ | Consumer | Depends on the architecture for... |
31
+ |---|---|
32
+ | **Infra Adoption** | The service map, ports, dependencies, and contracts — to adopt existing services into `docs/architecture/services` and `docs/architecture/api` and to wire the operational layer without regenerating them — plus the surface registry's test mediums, which the system-test harness is provisioned against. |
33
+ | **Domain docs & ADRs** | Reviewed against this document's Downstream Context file (`.groundwork/context/architecture-extract.md`) and accepted ADRs — a constraint absent there is invisible to every entity that must honour it. |
34
+ | **First Bet** | The boundaries and contracts a new bet must respect, and the gap ledger this phase fills most heavily. |
35
+
36
+ ---
37
+
38
+ ## Operating Contract
39
+
40
+ The shared operating contract at `.groundwork/skills/operating-contract.md` (contract v1) governs how this skill operates. Read it before taking any other action. This is a Sequential Setup phase. Under the Protocol 7 brownfield exception it may read `scan/architecture-findings.md`, `scan/overview.md`, `scan-state.json`, and `repo-map.json`, plus the upstream Downstream Context files and the design-system-extract hand-off.
41
+
42
+ ---
43
+
44
+ ## Initialization & Resume Protocol
45
+
46
+ ### Step 1: Mode Detection — Extract or Adopt/Upgrade
47
+
48
+ Check whether `docs/architecture/index.md` already exists.
49
+
50
+ - **Absent** — standard **Extract** mode.
51
+ - **Present but lacking an element this phase's commit produces** (for the architecture: its Downstream Context file at `.groundwork/context/architecture-extract.md`, or the `generation_mode`/`source_of_truth` frontmatter) — **Adopt/Upgrade** mode. Ingest the existing architecture as primary source, preserve its decisions and ADRs, and fill the missing contract sections and frontmatter rather than reconstructing from scratch. An architecture doc authored under another framework (a BMAD architecture document, a design RFC) is exactly this shape — bring it forward the same way, reconciling it against the code where they disagree (the code wins).
52
+
53
+ ### Step 2: Read Upstream Context (Protocol 3.2 order)
54
+
55
+ 1. **Hand-off (full)** — `.groundwork/cache/handoff/design-system-extract.md` if present.
56
+ 2. **Downstream Context files** — `.groundwork/context/product-brief-extract.md` and `.groundwork/context/design-system-extract.md` (the design system's non-functional budgets are binding constraints here).
57
+ 3. **Discovery notes** — `.groundwork/cache/discovery-notes.md` entries under `## Architecture` and `## Design Details`.
58
+ 4. **Body sections — lazy** — read an upstream doc body only when a specific decision needs detail the Downstream Context file lacks.
59
+
60
+ ### Step 3: Cache Check
61
+
62
+ Create `.groundwork/cache/architecture-extract-cache.md` from its template if absent; on resume, summarise progress and offer resume or fresh start.
63
+
64
+ ---
65
+
66
+ ## Stage 1: Ingest the Structure (silent)
67
+
68
+ Read `scan/architecture-findings.md` and `repo-map.json` together — the findings give the interpreted picture, the code map gives the exact edges. Where the findings cite a contract file (an OpenAPI spec, a migration, a proto), read it directly for precise detail. The code map's centrality ranking tells you which services and modules are the hubs the architecture turns on.
69
+
70
+ Build a complete structural model before speaking: the services and what each owns, the dependency edges between them, the data models and where they are persisted, the external contracts each service exposes, the communication patterns (sync vs async), and the infrastructure topology. This is recovery from fact, not inference.
71
+
72
+ ---
73
+
74
+ ## Stage 2: Reconstruct & Confirm
75
+
76
+ Present the recovered architecture to the user and let them correct it. This is propose-first and paced per Protocol 4 — you are confirming a structure read from the code, not running greenfield discovery.
77
+
78
+ Work through, leading each with what you recovered:
79
+
80
+ - **Service map & boundaries** — the services, what each owns, why the boundary sits where it does (from the dependency graph). Confirm the boundaries are real and intended, not accidental.
81
+ - **Surfaces & capability core** — which partitions are interface surfaces (the scan typed each in the Service Map's Surface column) and which form the capability core; whether the core is hosted (services reached over a network) or embedded (a library in-process with its single surface); per surface, the core-access path and auth model the code shows. Confirm every surface — a repo can carry a web app and a CLI, and the registry written at commit records each one.
82
+ - **Data flows & communication** — how data moves between services, sync vs async, what each persists. Confirm the patterns and surface any the code makes ambiguous.
83
+ - **Technology stack** — the datastores, brokers, auth providers, and any LLM provider the code reveals, with the obligations each imposes. Name an LLM provider and model explicitly if the system calls one — it is a first-class architectural fact.
84
+ - **Capability ports & providers** — recover the technical capabilities the code already binds (an LLM client, a store, a messaging client, a telemetry exporter) and the provider satisfying each, with its observed operational footprint: a hosted API by key (`env`), a container in compose (`compose-service`), a native process (`runner`), or an interface with no implementation behind it (`none` — a bare interface the code stubs). Record capability → provider → footprint; this becomes the architecture's Capability Ports & Providers table (§3) and its machine twin. A capability the code declares but never implements is `none`, not a guess at a provider.
85
+ - **Constraints & budgets** — the binding constraints inherited from the design system's non-functional requirements, plus any the infrastructure enforces (scale-to-zero, regional hosting, compliance posture visible in the code).
86
+
87
+ Resolve ambiguity with the user rather than assuming past it.
88
+
89
+ ---
90
+
91
+ ## Stage 3: Recover Rationale & Gaps (the interview)
92
+
93
+ Two distinct pursuits in one focused conversation:
94
+
95
+ - **Rationale for ADR-worthy decisions.** For each significant decision the code reveals — the auth strategy, the messaging pattern, the database choice, a notable service boundary — ask the user *why* it was chosen and what alternatives were weighed. Where the user supplies real rationale, that decision earns an ADR. Where they cannot (the decision predates them, or was incidental), record the fact in `docs/architecture/index.md` and mint no ADR. An ADR without a genuine context-decision-tradeoff is noise.
96
+ - **Delivery gaps.** Identify where the system diverges from a clean GroundWork service standard in ways that will hamper the bet loop. The sharpest: **a service exposes routes with no machine-readable contract** — the contract-driven bet loop cannot verify work against it. Flag these for the gap ledger at blocks-delivery severity. Also note off-pattern divergences (no transactional outbox where events cross services, missing health endpoints, no contract versioning) at standard-divergence severity.
97
+
98
+ Capture out-of-phase signals under their headers in `.groundwork/cache/discovery-notes.md` (Protocol 1).
99
+
100
+ ---
101
+
102
+ ## Quality Standard: What "Deep Enough" Looks Like
103
+
104
+ The recovered architecture must convey the *reasoning* the system embodies, not just inventory its parts. "Service A calls Service B over HTTP" is an inventory line. "The booking service calls the inventory service synchronously because a hold must fail closed — an async hold risks double-selling, which the domain cannot tolerate" is architecture. Recover the reasoning the structure implies, and confirm or correct it with the user. The depth bar matches greenfield: service boundaries explain what would break if the boundary moved; data flows explain the consistency model; technology choices carry their downstream obligations.
105
+
106
+ ---
107
+
108
+ ## Stage 4: Draft, Review & Present
109
+
110
+ 1. **Load the template.** Read `.groundwork/skills/groundwork-architecture/architecture-template.md` for the canonical section structure. Do not invent a structure.
111
+
112
+ 2. **Draft as per-section files** under `.groundwork/cache/architecture-extract-draft/`, one `write_file` per section, so any later edit touches only the affected file and never exhausts the output budget on a rich architecture:
113
+
114
+ | File | Content |
115
+ |---|---|
116
+ | `00-header.md` | The document title and intro (no summary section — the cross-phase contract is written separately to the Downstream Context file at commit, Protocol 5) |
117
+ | `01-constraints-and-budgets.md` | Template section 1 |
118
+ | `02-top-level-topology.md` | Template section 2 (the recovered service map) |
119
+ | `03-key-capabilities.md` | Template section 3 (technology decisions with rationale and obligations) |
120
+ | `04-component-boundaries.md` | Template section 4 |
121
+ | `05-communication-patterns.md` | Template section 5 |
122
+ | `06-service-level-requirements.md` | Template section 6 (the SLR table — every obligation a service must honour) |
123
+ | `07-surfaces-and-capability-core.md` | Template section 7: the core's deployment as observed (hosted or embedded) with its consequence for contract format, and one line per observed surface — type, access path, auth. Detail lives in `docs/surfaces.md` (written at commit); this section carries the facts |
124
+
125
+ Each section's heading starts at H2 to concatenate cleanly. Apply `groundwork-writer`.
126
+
127
+ 3. **Review.** Assemble: `run_command("cat .groundwork/cache/architecture-extract-draft/*.md > .groundwork/cache/architecture-extract-draft.md")`. Invoke the review subagent (Protocol 9) with `document_path: .groundwork/cache/architecture-extract-draft.md` and `document_type: architecture`. Fail-closed gate (Protocol 8): proceed only on `VERDICT: PRESENT`.
128
+
129
+ 4. **Revise loop.** On REVISE, apply all 🔴 Critical findings to the affected section file(s), re-assemble, and re-review. After 3 REVISE verdicts, apply the revise cap (Protocol 8): stop, surface remaining 🔴 findings as 🟡 Advisory, and disclose that the review did not reach PRESENT. The cap is a hard stop, not a target to push past. If the reviewer keeps finding fresh contract↔body desyncs every pass, the fault is an unreconciled Downstream Context file (Protocol 5: author it last at commit, from the finished doc), not a draft that needs five reviews.
130
+
131
+ 5. **Present** section by section (not the whole doc in one message), then surface 🟡 Advisory findings. Clean up the assembled file: `run_command("rm .groundwork/cache/architecture-extract-draft.md")`. Proceed to commit only on explicit approval.
132
+
133
+ ---
134
+
135
+ ## Stage 5: Commit
136
+
137
+ Execute **only** after explicit user approval (Protocol 3.4):
138
+
139
+ 1. **Assemble** the final doc and **write its Downstream Context file.** `run_command("mkdir -p docs/architecture && cat .groundwork/cache/architecture-extract-draft/*.md > docs/architecture/index.md")` to produce the clean published doc (no summary section). If `docs/architecture/meta.json` is absent, seed the section's sidebar order — `{ "pages": ["index", "infrastructure", "domain", "services", "api", "decisions", "..."] }` — without clobbering an existing one. Then then write the Downstream Context file to `.groundwork/context/architecture-extract.md` (Protocol 5) via `groundwork-writer`: the four subsections (Key Decisions, Binding Constraints, Deferred Questions, Out of Scope), ≤200 words. Carry forward every binding user-facing constraint from the brief and design system into Binding Constraints — domain docs are reviewed against this Downstream Context file, so a constraint absent there is invisible.
140
+
141
+ 2. **Extract domain entities.** For every core entity the architecture owns (recovered from schemas, migrations, and models), write a stub to `docs/architecture/domain/<entity>.md` using `.groundwork/skills/templates/domain-entity.md`: what it is, core fields, lifecycle states with triggers, the owning service, events emitted. Create `docs/architecture/domain/` if absent.
142
+
143
+ 3. **Write ADRs — only where rationale exists.** For each decision the user supplied genuine rationale for in Stage 3, write an ADR to `docs/architecture/decisions/NNNN-<slug>.md` using `.groundwork/skills/templates/adr.md`: context, decision, trade-offs. Number sequentially from the existing `docs/architecture/decisions/`. Status `accepted`. **Do not write an ADR for a decision whose rationale you could not recover** — record that fact in `docs/architecture/index.md` instead.
144
+
145
+ 4. **Write the surface registry.** Create `docs/surfaces.md` following the contract at `.groundwork/skills/templates/surfaces.md`, projecting what the code shows: the Capability Core section (what the core owns, its deployment as observed, where its contracts live), and one Surface Registry entry per observed surface with `status: active` — these surfaces ship today, so the registry records each one, and one dropped here is invisible to design tracks, scaffolding, and parity tracking for the life of the product. Per entry: `core access` and `auth` as the code shows them; `scaffold: manual` — adopted surfaces were not generated, and `manual` is first-class; `test medium` as the fixture family the surface's type and platform imply (`playwright` for a web `graphical-ui`, `subprocess-cli` for a `cli`, `protocol-client` for an `agentic-protocol`) — infra adoption provisions the harness against it; `design track` pointing at the matching type section of `docs/design-system.md`. The Capability Ledger section is its table header with **no rows**, and the machine twin `.groundwork/surfaces.json` is written in the same step with an empty `capabilities` array — the two files are projections of the same facts and are always written together. Do not reverse-engineer capability rows from the code: a scanned ledger is confidently wrong where an empty one is honestly unknown — rows grow per-bet as validation touches capabilities, and infra adoption records this stance in the gap ledger. Write the registry even for a single-surface repo — one entry, and downstream phases read it.
146
+
147
+ In the same commit, write the **capability-ports registry** — `docs/architecture/index.md` §3 Capability Ports & Providers and its machine twin `.groundwork/capability-ports.json` per the contract at `.groundwork/skills/templates/capability-ports.md` — projecting the capability → provider → footprint facts recovered above. A capability the code declares but leaves unimplemented is recorded `provider: none, footprint: none` (a bare interface), never a fabricated provider. An empty `ports` array is legal for a repo with no technical capabilities.
148
+
149
+ 5. **Stamp drift-baseline frontmatter.** Add frontmatter to `docs/architecture/index.md` and each `docs/architecture/domain/<entity>.md`: `generation_mode: extracted`, `source_of_truth:` (the code paths each doc was reconstructed from — service roots, contract files, migration dirs), and `last_reviewed:` (today's date). This is what `groundwork-check` reads to detect drift between the extracted docs and the code they came from, and the `extracted` mode routes its recovery through `groundwork-doc-sync` rather than a generator re-run.
150
+
151
+ 6. **Review the domain stubs and ADRs.** Invoke the review subagent on each `docs/architecture/domain/<entity>.md` with `document_type: domain-entity`. The isolated reviewer checks each entity against the architecture's Downstream Context file and the accepted ADRs. Apply 🔴 findings and re-review until PRESENT. Fail-closed, revise cap applies (Protocol 8).
152
+
153
+ 7. **Append architecture gaps to the ledger** at `.groundwork/cache/gap-ledger.md` (create from `.groundwork/skills/templates/gap-ledger.md` if absent). This is the heaviest gap contribution: every missing machine-readable contract at blocks-delivery severity, every standard divergence at its tier, with the evidence path.
154
+
155
+ 8. **Write the hand-off** to `.groundwork/cache/handoff/architecture-extract.md` from the shared template: deferred decisions, recovered-but-unrecorded reasoning the infra phase needs, user instincts about the operational layer. Omit empty sections (Protocol 6).
156
+
157
+ 9. **Teardown.** Delete the consumed findings slice `.groundwork/cache/scan/architecture-findings.md`, the previous hand-off `.groundwork/cache/handoff/design-system-extract.md`, the draft directory, and the phase cache. Leave `scan/overview.md`, `scan-state.json`, and `repo-map.json` — infra adoption still reads them.
158
+
159
+ 10. Apply the Living Documents protocol — refine `docs/product-brief.md` or `docs/design-system.md` where the architecture conversation surfaced refinements, and refresh their live Downstream Context files where the change touched a Key Decision, Binding Constraint, or Deferred Question. If any update reverses a prior Key Decision or Binding Constraint, follow the Reversal Protocol: reconcile the full body and dependent docs, write the superseding ADR, and re-review every mutated doc.
160
+
161
+ 11. Update discovery notes — remove `## Architecture` and `## Design Details` entries now captured.
162
+
163
+ 12. Confirm completion, recommend a fresh context, and immediately load and execute `groundwork-orchestrator`. Do not ask the user to invoke it. Record nothing in `state.json` — the orchestrator infers this phase's completion from `docs/architecture/index.md` plus its Downstream Context file `.groundwork/context/architecture-extract.md` and the stamped `generation_mode`/`source_of_truth` frontmatter; only the scan writes a durable marker, because it leaves no `docs/` artifact.
@@ -0,0 +1,21 @@
1
+ # Architecture Extract — Phase Cache
2
+
3
+ > Resume state for `groundwork-architecture-extract`. Deleted at commit.
4
+
5
+ - **Mode:** <!-- extract | adopt-upgrade -->
6
+ - **Stage 1 — Ingest structure:** pending
7
+ - **Stage 2 — Reconstruct & confirm:** pending
8
+ - **Stage 3 — Recover rationale & gaps:** pending
9
+ - **Stage 4 — Draft, review & present:** pending
10
+
11
+ ## Recovered structure
12
+
13
+ <!-- Service map, boundaries, surfaces (every one, typed) and core deployment, data flows, stack — as confirmed. -->
14
+
15
+ ## ADR candidates
16
+
17
+ <!-- Decisions the user supplied rationale for (→ ADR) vs decisions with no recoverable why (→ fact in architecture.md). -->
18
+
19
+ ## Gap-ledger candidates
20
+
21
+ <!-- Missing contracts (blocks-delivery), standard divergences, with evidence paths. -->