create-flowdular 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +11 -0
  2. package/agent-template/.agents/skills/agent-tool-design/SKILL.md +203 -0
  3. package/agent-template/.agents/skills/auth-security-review/SKILL.md +90 -0
  4. package/agent-template/.agents/skills/auto-review/SKILL.md +103 -0
  5. package/agent-template/.agents/skills/bug-hunt/SKILL.md +104 -0
  6. package/agent-template/.agents/skills/business-agent-design/SKILL.md +182 -0
  7. package/agent-template/.agents/skills/cli-extension/SKILL.md +108 -0
  8. package/agent-template/.agents/skills/core-extend/SKILL.md +99 -0
  9. package/agent-template/.agents/skills/database-adapter/SKILL.md +198 -0
  10. package/agent-template/.agents/skills/database-adapter/references/first-run-and-matrix.md +105 -0
  11. package/agent-template/.agents/skills/migration-authoring/SKILL.md +161 -0
  12. package/agent-template/.agents/skills/module-new/SKILL.md +171 -0
  13. package/agent-template/.agents/skills/module-update/SKILL.md +91 -0
  14. package/agent-template/.agents/skills/perf-audit/SKILL.md +98 -0
  15. package/agent-template/.agents/skills/release-eject-pr/SKILL.md +107 -0
  16. package/agent-template/.agents/skills/spec-approval/SKILL.md +106 -0
  17. package/agent-template/.agents/skills/test-hardening/SKILL.md +79 -0
  18. package/agent-template/.agents/skills/translations-i18n/SKILL.md +78 -0
  19. package/agent-template/.agents/skills/ux-design/SKILL.md +92 -0
  20. package/agent-template/.agents/skills/variables/SKILL.md +156 -0
  21. package/agent-template/.agents/skills/workflow-development/SKILL.md +192 -0
  22. package/agent-template/.ai/README.md +62 -0
  23. package/agent-template/.ai/agents/README.md +27 -0
  24. package/agent-template/.ai/agents/module-executor.md +36 -0
  25. package/agent-template/.ai/agents/reviewer.md +23 -0
  26. package/agent-template/.ai/agents/sandbox/agentic-engineer.md +31 -0
  27. package/agent-template/.ai/agents/sandbox/backend-engineer.md +36 -0
  28. package/agent-template/.ai/agents/sandbox/business-manager.md +23 -0
  29. package/agent-template/.ai/agents/sandbox/frontend-engineer.md +27 -0
  30. package/agent-template/.ai/agents/sandbox/ux-designer.md +23 -0
  31. package/agent-template/.ai/agents/spec-author.md +29 -0
  32. package/agent-template/.ai/blueprints/add-migration/README.md +5 -0
  33. package/agent-template/.ai/blueprints/add-migration/allowed-paths.yaml +23 -0
  34. package/agent-template/.ai/blueprints/add-migration/blueprint.json +14 -0
  35. package/agent-template/.ai/blueprints/add-migration/examples/invalid/input-destructive.json +6 -0
  36. package/agent-template/.ai/blueprints/add-migration/examples/invalid/plan-unnumbered-file.json +9 -0
  37. package/agent-template/.ai/blueprints/add-migration/examples/valid/input.json +6 -0
  38. package/agent-template/.ai/blueprints/add-migration/examples/valid/plan.json +9 -0
  39. package/agent-template/.ai/blueprints/add-migration/gates.yaml +30 -0
  40. package/agent-template/.ai/blueprints/add-migration/input.schema.json +23 -0
  41. package/agent-template/.ai/blueprints/add-migration/plan.schema.json +54 -0
  42. package/agent-template/.ai/blueprints/add-migration/required-files.yaml +18 -0
  43. package/agent-template/.ai/blueprints/add-migration/spec-requirements.yaml +13 -0
  44. package/agent-template/.ai/blueprints/add-migration/steps.yaml +62 -0
  45. package/agent-template/.ai/blueprints/author-spec/README.md +5 -0
  46. package/agent-template/.ai/blueprints/author-spec/allowed-paths.yaml +7 -0
  47. package/agent-template/.ai/blueprints/author-spec/blueprint.json +14 -0
  48. package/agent-template/.ai/blueprints/author-spec/examples/invalid/input-missing-outcome.json +5 -0
  49. package/agent-template/.ai/blueprints/author-spec/examples/valid/input.json +6 -0
  50. package/agent-template/.ai/blueprints/author-spec/gates.yaml +13 -0
  51. package/agent-template/.ai/blueprints/author-spec/input.schema.json +20 -0
  52. package/agent-template/.ai/blueprints/author-spec/plan.schema.json +14 -0
  53. package/agent-template/.ai/blueprints/author-spec/required-files.yaml +6 -0
  54. package/agent-template/.ai/blueprints/author-spec/spec-requirements.yaml +35 -0
  55. package/agent-template/.ai/blueprints/author-spec/steps.yaml +28 -0
  56. package/agent-template/.ai/blueprints/author-spec/templates/module.yaml +45 -0
  57. package/agent-template/.ai/blueprints/bug-fix/README.md +5 -0
  58. package/agent-template/.ai/blueprints/bug-fix/allowed-paths.yaml +29 -0
  59. package/agent-template/.ai/blueprints/bug-fix/blueprint.json +14 -0
  60. package/agent-template/.ai/blueprints/bug-fix/examples/invalid/input-no-symptom.json +4 -0
  61. package/agent-template/.ai/blueprints/bug-fix/examples/invalid/plan-no-test.json +8 -0
  62. package/agent-template/.ai/blueprints/bug-fix/examples/valid/input.json +6 -0
  63. package/agent-template/.ai/blueprints/bug-fix/examples/valid/plan.json +8 -0
  64. package/agent-template/.ai/blueprints/bug-fix/gates.yaml +30 -0
  65. package/agent-template/.ai/blueprints/bug-fix/input.schema.json +25 -0
  66. package/agent-template/.ai/blueprints/bug-fix/plan.schema.json +53 -0
  67. package/agent-template/.ai/blueprints/bug-fix/required-files.yaml +7 -0
  68. package/agent-template/.ai/blueprints/bug-fix/spec-requirements.yaml +7 -0
  69. package/agent-template/.ai/blueprints/bug-fix/steps.yaml +51 -0
  70. package/agent-template/.ai/blueprints/core-extend/README.md +5 -0
  71. package/agent-template/.ai/blueprints/core-extend/allowed-paths.yaml +49 -0
  72. package/agent-template/.ai/blueprints/core-extend/blueprint.json +14 -0
  73. package/agent-template/.ai/blueprints/core-extend/examples/invalid/input-unknown-package.json +5 -0
  74. package/agent-template/.ai/blueprints/core-extend/examples/invalid/plan-missing-gates.json +7 -0
  75. package/agent-template/.ai/blueprints/core-extend/examples/valid/input.json +6 -0
  76. package/agent-template/.ai/blueprints/core-extend/examples/valid/plan.json +10 -0
  77. package/agent-template/.ai/blueprints/core-extend/gates.yaml +16 -0
  78. package/agent-template/.ai/blueprints/core-extend/input.schema.json +54 -0
  79. package/agent-template/.ai/blueprints/core-extend/plan.schema.json +39 -0
  80. package/agent-template/.ai/blueprints/core-extend/required-files.yaml +36 -0
  81. package/agent-template/.ai/blueprints/core-extend/spec-requirements.yaml +17 -0
  82. package/agent-template/.ai/blueprints/core-extend/steps.yaml +54 -0
  83. package/agent-template/.ai/blueprints/edit-module/README.md +9 -0
  84. package/agent-template/.ai/blueprints/edit-module/allowed-paths.yaml +27 -0
  85. package/agent-template/.ai/blueprints/edit-module/blueprint.json +20 -0
  86. package/agent-template/.ai/blueprints/edit-module/examples/invalid/input-unknown-change.json +5 -0
  87. package/agent-template/.ai/blueprints/edit-module/examples/invalid/plan-touches-platform.json +15 -0
  88. package/agent-template/.ai/blueprints/edit-module/examples/valid/input.json +5 -0
  89. package/agent-template/.ai/blueprints/edit-module/examples/valid/plan.json +25 -0
  90. package/agent-template/.ai/blueprints/edit-module/gates.yaml +30 -0
  91. package/agent-template/.ai/blueprints/edit-module/input.schema.json +31 -0
  92. package/agent-template/.ai/blueprints/edit-module/plan.schema.json +65 -0
  93. package/agent-template/.ai/blueprints/edit-module/required-files.yaml +80 -0
  94. package/agent-template/.ai/blueprints/edit-module/spec-requirements.yaml +15 -0
  95. package/agent-template/.ai/blueprints/edit-module/steps.yaml +115 -0
  96. package/agent-template/.ai/blueprints/new-module/README.md +7 -0
  97. package/agent-template/.ai/blueprints/new-module/allowed-paths.yaml +27 -0
  98. package/agent-template/.ai/blueprints/new-module/blueprint.json +20 -0
  99. package/agent-template/.ai/blueprints/new-module/examples/invalid/input-spec-outside-modules.json +4 -0
  100. package/agent-template/.ai/blueprints/new-module/examples/invalid/plan-unknown-gate.json +8 -0
  101. package/agent-template/.ai/blueprints/new-module/examples/valid/input.json +5 -0
  102. package/agent-template/.ai/blueprints/new-module/examples/valid/plan.json +22 -0
  103. package/agent-template/.ai/blueprints/new-module/gates.yaml +30 -0
  104. package/agent-template/.ai/blueprints/new-module/input.schema.json +21 -0
  105. package/agent-template/.ai/blueprints/new-module/plan.schema.json +58 -0
  106. package/agent-template/.ai/blueprints/new-module/required-files.yaml +73 -0
  107. package/agent-template/.ai/blueprints/new-module/spec-requirements.yaml +30 -0
  108. package/agent-template/.ai/blueprints/new-module/steps.yaml +138 -0
  109. package/agent-template/.ai/blueprints/release/README.md +5 -0
  110. package/agent-template/.ai/blueprints/release/allowed-paths.yaml +19 -0
  111. package/agent-template/.ai/blueprints/release/blueprint.json +14 -0
  112. package/agent-template/.ai/blueprints/release/examples/invalid/input-bad-version.json +4 -0
  113. package/agent-template/.ai/blueprints/release/examples/invalid/plan-bad-branch.json +7 -0
  114. package/agent-template/.ai/blueprints/release/examples/valid/input.json +5 -0
  115. package/agent-template/.ai/blueprints/release/examples/valid/plan.json +20 -0
  116. package/agent-template/.ai/blueprints/release/gates.yaml +20 -0
  117. package/agent-template/.ai/blueprints/release/input.schema.json +24 -0
  118. package/agent-template/.ai/blueprints/release/plan.schema.json +46 -0
  119. package/agent-template/.ai/blueprints/release/required-files.yaml +19 -0
  120. package/agent-template/.ai/blueprints/release/spec-requirements.yaml +8 -0
  121. package/agent-template/.ai/blueprints/release/steps.yaml +47 -0
  122. package/agent-template/.ai/blueprints/security-review/README.md +5 -0
  123. package/agent-template/.ai/blueprints/security-review/allowed-paths.yaml +6 -0
  124. package/agent-template/.ai/blueprints/security-review/blueprint.json +14 -0
  125. package/agent-template/.ai/blueprints/security-review/examples/invalid/input-unknown-kind.json +4 -0
  126. package/agent-template/.ai/blueprints/security-review/examples/invalid/plan-finding-without-scenario.json +14 -0
  127. package/agent-template/.ai/blueprints/security-review/examples/valid/input.json +4 -0
  128. package/agent-template/.ai/blueprints/security-review/examples/valid/plan.json +19 -0
  129. package/agent-template/.ai/blueprints/security-review/gates.yaml +22 -0
  130. package/agent-template/.ai/blueprints/security-review/input.schema.json +20 -0
  131. package/agent-template/.ai/blueprints/security-review/plan.schema.json +65 -0
  132. package/agent-template/.ai/blueprints/security-review/required-files.yaml +6 -0
  133. package/agent-template/.ai/blueprints/security-review/spec-requirements.yaml +9 -0
  134. package/agent-template/.ai/blueprints/security-review/steps.yaml +38 -0
  135. package/agent-template/.ai/examples/README.md +8 -0
  136. package/agent-template/.ai/examples/bad/client-imports-server/README.md +20 -0
  137. package/agent-template/.ai/examples/bad/client-imports-server/api.ts +12 -0
  138. package/agent-template/.ai/examples/bad/missing-acl/README.md +23 -0
  139. package/agent-template/.ai/examples/bad/missing-acl/endpoints.ts +12 -0
  140. package/agent-template/.ai/examples/bad/tenant-from-body/README.md +19 -0
  141. package/agent-template/.ai/examples/bad/tenant-from-body/endpoints.ts +33 -0
  142. package/agent-template/.ai/examples/client-contribution/CustomerListView.tsrx +34 -0
  143. package/agent-template/.ai/examples/client-contribution/README.md +11 -0
  144. package/agent-template/.ai/examples/client-contribution/contribution.tsrx +48 -0
  145. package/agent-template/.ai/examples/client-contribution/index.ts +20 -0
  146. package/agent-template/.ai/examples/client-contribution/permissions.ts +8 -0
  147. package/agent-template/.ai/examples/customer-cli-extension/README.md +14 -0
  148. package/agent-template/.ai/examples/customer-cli-extension/commands.json +17 -0
  149. package/agent-template/.ai/examples/customer-cli-extension/index.ts +36 -0
  150. package/agent-template/.ai/examples/module-create/task-packet.json +11 -0
  151. package/agent-template/.ai/guides/application-development.md +97 -0
  152. package/agent-template/.ai/policies/capabilities.yaml +164 -0
  153. package/agent-template/.ai/policies/model-routing.yaml +72 -0
  154. package/agent-template/.ai/policies/path-ownership.yaml +65 -0
  155. package/agent-template/.ai/policies/task-budgets.yaml +37 -0
  156. package/agent-template/.ai/references/catalog/LICENSE +21 -0
  157. package/agent-template/.ai/references/catalog/migrations/0001_catalog_core.down.sql +2 -0
  158. package/agent-template/.ai/references/catalog/migrations/0001_catalog_core.up.sql +21 -0
  159. package/agent-template/.ai/references/catalog/migrations/0002_catalog_history.down.sql +3 -0
  160. package/agent-template/.ai/references/catalog/migrations/0002_catalog_history.up.sql +20 -0
  161. package/agent-template/.ai/references/catalog/migrations/0003_catalog_history_service_actors.down.sql +3 -0
  162. package/agent-template/.ai/references/catalog/migrations/0003_catalog_history_service_actors.up.sql +36 -0
  163. package/agent-template/.ai/references/catalog/migrations/0004_catalog_idempotency_ledger.down.sql +3 -0
  164. package/agent-template/.ai/references/catalog/migrations/0004_catalog_idempotency_ledger.up.sql +19 -0
  165. package/agent-template/.ai/references/catalog/migrations/README.md +3 -0
  166. package/agent-template/.ai/references/catalog/module.json +27 -0
  167. package/agent-template/.ai/references/catalog/package.json +49 -0
  168. package/agent-template/.ai/references/catalog/spec/module.yaml +86 -0
  169. package/agent-template/.ai/references/catalog/src/acl/permissions.ts +6 -0
  170. package/agent-template/.ai/references/catalog/src/agent/tools.ts +164 -0
  171. package/agent-template/.ai/references/catalog/src/api/endpoints.ts +243 -0
  172. package/agent-template/.ai/references/catalog/src/client/CatalogHistoryDrawer.tsrx +123 -0
  173. package/agent-template/.ai/references/catalog/src/client/CatalogItemForm.tsrx +190 -0
  174. package/agent-template/.ai/references/catalog/src/client/CatalogView.tsrx +473 -0
  175. package/agent-template/.ai/references/catalog/src/client/api.ts +111 -0
  176. package/agent-template/.ai/references/catalog/src/client/contribution.tsrx +61 -0
  177. package/agent-template/.ai/references/catalog/src/client/index.ts +18 -0
  178. package/agent-template/.ai/references/catalog/src/client/navigation-copy.ts +9 -0
  179. package/agent-template/.ai/references/catalog/src/client/state.ts +24 -0
  180. package/agent-template/.ai/references/catalog/src/domain/types.ts +32 -0
  181. package/agent-template/.ai/references/catalog/src/domain/variables.ts +111 -0
  182. package/agent-template/.ai/references/catalog/src/index.ts +31 -0
  183. package/agent-template/.ai/references/catalog/src/platform.ts +35 -0
  184. package/agent-template/.ai/references/catalog/src/server/index.ts +4 -0
  185. package/agent-template/.ai/references/catalog/src/server/runtime.ts +86 -0
  186. package/agent-template/.ai/references/catalog/src/services/catalog-service.ts +306 -0
  187. package/agent-template/.ai/references/catalog/src/services/database-repository.ts +440 -0
  188. package/agent-template/.ai/references/catalog/src/services/index.ts +4 -0
  189. package/agent-template/.ai/references/catalog/src/services/migration.ts +171 -0
  190. package/agent-template/.ai/references/catalog/src/services/repository.ts +36 -0
  191. package/agent-template/.ai/references/catalog/src/services/target-idempotency.ts +59 -0
  192. package/agent-template/.ai/references/catalog/tests/agent-tools.test.ts +277 -0
  193. package/agent-template/.ai/references/catalog/tests/endpoints.test.ts +320 -0
  194. package/agent-template/.ai/references/catalog/tests/idempotency.test.ts +297 -0
  195. package/agent-template/.ai/references/catalog/tests/migrations.test.ts +149 -0
  196. package/agent-template/.ai/references/catalog/tests/module.test.ts +271 -0
  197. package/agent-template/.ai/references/catalog/tests/support/database.ts +76 -0
  198. package/agent-template/.ai/references/catalog/translations/en.json +101 -0
  199. package/agent-template/.ai/references/catalog/translations/pl.json +101 -0
  200. package/agent-template/.ai/references/catalog/tsconfig.json +15 -0
  201. package/agent-template/.ai/references/catalog/vitest.config.ts +16 -0
  202. package/agent-template/.ai/references/catalog.provenance.json +55 -0
  203. package/agent-template/.ai/rules/flowdular.md +86 -0
  204. package/agent-template/.ai/skills/README.md +36 -0
  205. package/agent-template/.ai/skills/agent-tool-design/SKILL.md +209 -0
  206. package/agent-template/.ai/skills/auth-security-review/SKILL.md +96 -0
  207. package/agent-template/.ai/skills/auto-review/SKILL.md +112 -0
  208. package/agent-template/.ai/skills/bug-hunt/SKILL.md +110 -0
  209. package/agent-template/.ai/skills/business-agent-design/SKILL.md +188 -0
  210. package/agent-template/.ai/skills/cli-extension/SKILL.md +114 -0
  211. package/agent-template/.ai/skills/core-extend/SKILL.md +104 -0
  212. package/agent-template/.ai/skills/database-adapter/SKILL.md +204 -0
  213. package/agent-template/.ai/skills/database-adapter/references/first-run-and-matrix.md +105 -0
  214. package/agent-template/.ai/skills/migration-authoring/SKILL.md +167 -0
  215. package/agent-template/.ai/skills/module-new/SKILL.md +180 -0
  216. package/agent-template/.ai/skills/module-update/SKILL.md +100 -0
  217. package/agent-template/.ai/skills/perf-audit/SKILL.md +105 -0
  218. package/agent-template/.ai/skills/release-eject-pr/SKILL.md +113 -0
  219. package/agent-template/.ai/skills/spec-approval/SKILL.md +112 -0
  220. package/agent-template/.ai/skills/test-hardening/SKILL.md +86 -0
  221. package/agent-template/.ai/skills/translations-i18n/SKILL.md +85 -0
  222. package/agent-template/.ai/skills/ux-design/SKILL.md +97 -0
  223. package/agent-template/.ai/skills/variables/SKILL.md +164 -0
  224. package/agent-template/.ai/skills/workflow-development/SKILL.md +199 -0
  225. package/agent-template/.claude/skills/agent-tool-design/SKILL.md +203 -0
  226. package/agent-template/.claude/skills/auth-security-review/SKILL.md +90 -0
  227. package/agent-template/.claude/skills/auto-review/SKILL.md +103 -0
  228. package/agent-template/.claude/skills/bug-hunt/SKILL.md +104 -0
  229. package/agent-template/.claude/skills/business-agent-design/SKILL.md +182 -0
  230. package/agent-template/.claude/skills/cli-extension/SKILL.md +108 -0
  231. package/agent-template/.claude/skills/core-extend/SKILL.md +99 -0
  232. package/agent-template/.claude/skills/database-adapter/SKILL.md +198 -0
  233. package/agent-template/.claude/skills/database-adapter/references/first-run-and-matrix.md +105 -0
  234. package/agent-template/.claude/skills/migration-authoring/SKILL.md +161 -0
  235. package/agent-template/.claude/skills/module-new/SKILL.md +171 -0
  236. package/agent-template/.claude/skills/module-update/SKILL.md +91 -0
  237. package/agent-template/.claude/skills/perf-audit/SKILL.md +98 -0
  238. package/agent-template/.claude/skills/release-eject-pr/SKILL.md +107 -0
  239. package/agent-template/.claude/skills/spec-approval/SKILL.md +106 -0
  240. package/agent-template/.claude/skills/test-hardening/SKILL.md +79 -0
  241. package/agent-template/.claude/skills/translations-i18n/SKILL.md +78 -0
  242. package/agent-template/.claude/skills/ux-design/SKILL.md +92 -0
  243. package/agent-template/.claude/skills/variables/SKILL.md +156 -0
  244. package/agent-template/.claude/skills/workflow-development/SKILL.md +192 -0
  245. package/agent-template/AGENTS.md +77 -0
  246. package/agent-template/CLAUDE.md +77 -0
  247. package/agent-template/docs/adr/0001-development-reload.md +16 -0
  248. package/agent-template/docs/adr/0002-durable-agent-execution.md +21 -0
  249. package/agent-template/docs/adr/0003-module-settings.md +22 -0
  250. package/agent-template/docs/adr/0004-enterprise-access-and-audit.md +36 -0
  251. package/agent-template/docs/adr/0005-sandbox-runtime-and-coding-agents.md +81 -0
  252. package/agent-template/docs/adr/0006-agentic-workflows.md +1702 -0
  253. package/agent-template/docs/adr/0007-module-owned-agents.md +429 -0
  254. package/agent-template/docs/adr/0008-database-adapter-contract.md +90 -0
  255. package/agent-template/docs/agent-contract.md +45 -0
  256. package/agent-template/docs/configuration.md +122 -0
  257. package/agent-template/docs/database-adapters.md +346 -0
  258. package/agent-template/docs/design-system.md +217 -0
  259. package/agent-template/docs/modules.md +146 -0
  260. package/agent-template/platform/scripts/build.mjs +38 -0
  261. package/agent-template/rulesync.jsonc +11 -0
  262. package/dist/bin.js +40 -2
  263. package/package.json +3 -2
  264. package/template/default/.prettierignore +9 -0
  265. package/template/default/README.md +12 -0
  266. package/template/default/flowdular.json +3 -3
  267. package/template/default/modules/example/package.json +2 -2
  268. package/template/default/package.json +6 -2
  269. package/template/default/platform/octane.config.ts +17 -6
  270. package/template/default/platform/package.json +3 -2
  271. package/template/default/pnpm-workspace.yaml +1 -0
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: workflow-development
3
+ description: >-
4
+ Build, publish, invoke, and test a workflows.core DAG through its typed graph
5
+ and public execution capability without bypassing agent, action, tenant, or
6
+ audit boundaries.
7
+ ---
8
+ # Build and integrate an agentic workflow
9
+
10
+ `workflows.core` owns durable directed acyclic workflows. A workflow coordinates
11
+ pinned agent revisions, deterministic gates, schema validators, registered
12
+ module actions, data mappings, and terminal output. It does not own schedules or
13
+ webhook secrets. Those remain optional concerns of `automations.core`.
14
+
15
+ Read `docs/adr/0006-agentic-workflows.md`, the approved
16
+ `modules/workflows/spec/module.yaml`, and the contracts in
17
+ `modules/workflows/src/domain/types.ts` before changing a workflow surface.
18
+
19
+ ## Pick the correct extension point
20
+
21
+ - A workflow definition belongs in `workflows.core` and is edited through its
22
+ API or canvas. Do not hardcode a tenant workflow in source.
23
+ - A business operation that a workflow may call is a versioned agent action.
24
+ Register it through the agents action catalog. If missing, implement it in a
25
+ separate `agent-tool-design` phase with permission, input, output, timeout,
26
+ idempotency and audit tests before returning to workflow integration.
27
+ - A business module that starts a workflow resolves
28
+ `workflows.execution.v1` from `context.capabilities`. It never imports a
29
+ workflow repository or database.
30
+ - A schedule or signed webhook remains in `automations.core`. Its optional
31
+ bridge invokes the workflow capability with a service actor and a separate
32
+ schedule or webhook origin.
33
+ - If the workflow module is absent, the capability registry returns `null`.
34
+ Hide an optional feature or return a clear stable refusal.
35
+
36
+ ## Graph contract
37
+
38
+ Version one is a bounded DAG. The graph contains:
39
+
40
+ - `input`: accepts the invocation envelope.
41
+ - `agent`: calls one exact immutable agent revision and validates structured
42
+ output.
43
+ - `agent-decision`: produces one schema-valid `pass` or `fail` outcome.
44
+ - `gate`: evaluates the versioned allowlisted logic language.
45
+ - `validator`: validates an envelope against a pinned JSON schema.
46
+ - `action`: calls one exact registered action contract version.
47
+ - `merge`: waits for all declared incoming paths.
48
+ - `output`: settles the workflow with a typed result.
49
+
50
+ Every port names a schema. Every edge connects compatible ports. Mappings are
51
+ declarative literals, JSON pointer paths, or templates with explicit variable
52
+ bindings. Never add JavaScript, dynamic imports, shell commands, downloaded
53
+ code, arbitrary expressions, or hidden provider decisions to graph data.
54
+
55
+ The hard limits live in `WORKFLOW_LIMITS` in
56
+ `modules/workflows/src/domain/types.ts`. Validation must reject a cycle,
57
+ dangling edge, unreachable node, missing terminal output, incompatible port,
58
+ missing exact dependency, oversized graph, or unsupported action risk before
59
+ publication.
60
+
61
+ ## Revisions and publication
62
+
63
+ Draft saves use optimistic concurrency through `expectedRevision`. A successful
64
+ save creates the next draft revision. A conflict never overwrites another
65
+ editor.
66
+
67
+ Publication:
68
+
69
+ 1. Validates and compiles the graph.
70
+ 2. Resolves exact agent revisions and exact action contract versions.
71
+ 3. Rejects missing, archived, incompatible, external, or destructive
72
+ dependencies.
73
+ 4. Stores an immutable content-addressed published revision.
74
+ 5. Leaves earlier revisions and their run evidence unchanged.
75
+
76
+ Never replace a pinned dependency with its latest version during execution.
77
+ Editing after publication creates another draft.
78
+
79
+ ## Execution modes
80
+
81
+ Use the smallest mode that proves the change:
82
+
83
+ - Dry-run validates a draft and returns issues, compiled order, references,
84
+ permissions, checksum, and limits. It creates no run and invokes nothing.
85
+ - Simulation persists a run history but uses fixtures for nondeterministic
86
+ nodes. It advances virtual time without sleeping and never calls a provider,
87
+ action, or business mutation.
88
+ - Live runs only published revisions. It may call pinned agents and approved
89
+ read or workspace-write actions under the initiating permission snapshot.
90
+
91
+ Do not disguise simulation as live execution. Do not use live mode to test an
92
+ invalid draft.
93
+
94
+ ## Invoke a published workflow from a module
95
+
96
+ Resolve the capability at request or service call time, after platform
97
+ composition has completed:
98
+
99
+ ```ts
100
+ import {
101
+ WORKFLOW_EXECUTION_CAPABILITY,
102
+ type WorkflowExecutionCapability,
103
+ } from '@flowdular/sdk/modules/workflows/server';
104
+
105
+ const workflows = context.capabilities.get<WorkflowExecutionCapability>(
106
+ WORKFLOW_EXECUTION_CAPABILITY,
107
+ );
108
+ if (!workflows) throw new ModuleError('WORKFLOWS_UNAVAILABLE');
109
+
110
+ const accepted = await workflows.enqueue(
111
+ {
112
+ workflowKey: 'catalog-enrichment',
113
+ input: { itemId },
114
+ idempotencyKey: `catalog:${itemId}:${version}`,
115
+ },
116
+ {
117
+ tenantId,
118
+ actor,
119
+ origin: {
120
+ kind: 'module',
121
+ moduleId: 'catalog.core',
122
+ operationId: 'catalog.enrichment.start',
123
+ },
124
+ permissionSnapshot,
125
+ },
126
+ );
127
+ ```
128
+
129
+ The module manifest declares `workflows.core` only when workflow support is a
130
+ required feature. An optional integration belongs in a small bridge module that
131
+ depends on both sides. Do not duplicate the capability interface locally to
132
+ avoid a dependency declaration.
133
+
134
+ Trusted context and business input are separate. Tenant, actor, origin, and
135
+ permission snapshot never come from the request body. The idempotency key is
136
+ stable for one logical operation. Reusing it with different input is a
137
+ conflict, not a second run.
138
+
139
+ ## Actor and permission rules
140
+
141
+ - A user action uses the real user actor.
142
+ - A tool invoked by an agent uses the real agent actor and child run
143
+ correlation supplied by `AgentToolContext`.
144
+ - A schedule or webhook uses a service actor whose `configuredBy` is the real
145
+ user who configured it. Origin stays `schedule` or `webhook`.
146
+ - A workflow definition grants no scope. Live execution intersects the caller
147
+ snapshot with each node's agent or action requirements.
148
+ - A cross-tenant id, foreign cursor, missing scope, absent dependency, or
149
+ mismatched action version is refused before data or provider work.
150
+
151
+ ## History, recovery, and cancellation
152
+
153
+ The browser observes execution. It never owns execution. Enqueue persists the
154
+ run before returning. Workers use leases and recover expired work from stored
155
+ node state, child ids, and stable side-effect idempotency keys.
156
+
157
+ Every transition appends an ordered schema-versioned event. Run, node,
158
+ attempt, and edge states are separate projections. `pass` and `fail` are normal
159
+ outcome ports, not technical statuses.
160
+
161
+ Cancellation is durable and cooperative. It prevents new nodes, asks the
162
+ current child agent or action to cancel, records whether it acknowledged, and
163
+ ignores late output for routing while keeping its safe evidence.
164
+
165
+ History responses contain redacted bounded evidence. They never expose provider
166
+ credentials, session tokens, hidden reasoning, encrypted payload blobs, or
167
+ unrestricted request bodies.
168
+
169
+ ## Required tests
170
+
171
+ For a graph or runtime change, prove:
172
+
173
+ 1. Deterministic compile order and rejection of cycles, dangling edges,
174
+ incompatible ports, unreachable nodes, and missing output.
175
+ 2. Tenant isolation plus one unauthenticated and one unscoped refusal for every
176
+ endpoint group.
177
+ 3. Exact agent and action revision refusal with no latest-version fallback.
178
+ 4. Dry-run produces no run, provider call, action call, or business write.
179
+ 5. Simulation uses fixtures and virtual duration with no real wait.
180
+ 6. Live enqueue is idempotent and persists before acceptance.
181
+ 7. Recovery before and after child enqueue does not duplicate work.
182
+ 8. Retry records the chosen delay before waiting and reuses the side-effect
183
+ idempotency key.
184
+ 9. Cancellation prevents downstream work and records late results safely.
185
+ 10. Event replay, cursor binding, payload redaction, retention, usage, cost,
186
+ and audit hash-chain integrity.
187
+ 11. The canvas shows validation, loading, empty, error, denied, simulation,
188
+ live, cancelled, and recovered states, including small-screen read mode.
189
+
190
+ Run the module typecheck and tests, `pnpm flowdular module validate`, then the
191
+ full `pnpm verify`. For a new module integration, update its approved spec and
192
+ move `specVersion`, `module.json` version, and package version together.
@@ -0,0 +1,62 @@
1
+ # .ai
2
+
3
+ Flowdular is an agentic foundation framework. The platform under `packages/`, `modules/` and `platform/` is the foundation (accounts, workspaces, permissions, modules, agents runtime, CLI, sandbox); this directory is how agents build on it: shared RuleSync rules and skills, role prompts for the sandbox specialists, blueprints that describe each kind of change, and policies that document what the code enforces.
4
+
5
+ ## What is consumed by what
6
+
7
+ | Path | Consumer |
8
+ | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
+ | `rules/*.md` | Canonical cross-agent instructions. RuleSync generates the root `AGENTS.md` and `CLAUDE.md` from these files; `pnpm rules:check` rejects drift. |
10
+ | `agents/sandbox/*.md` | Loaded at sandbox start by `packages/coding-agent/src/roles/registry.ts` (`loadAgentRoles`); `gates`, `handoff` and `allowedPaths` are enforced. `dependencies` always runs, a `HANDOFF:` line must name a role from the list and never the role itself, and writes outside the active role allowlist are quarantined and restored before validation. Defaults in `packages/coding-agent/src/roles/defaults.ts` are regenerated from these files by `pnpm --filter @flowdular/coding-agent sync-roles`, and `tests/sync.test.ts` fails when they drift. |
11
+ | `agents/{module-executor,reviewer,spec-author}.md` | Read by people and coding tools at the repository root; named in `blueprints/*/blueprint.json`. Not loaded by code. |
12
+ | `skills/*/SKILL.md` | Canonical cross-agent procedures. They are copied into every sandbox session as `reference/skills/` (`packages/sandbox/src/server/reference.ts`) and RuleSync generates the discovery copies under `.agents/skills` and `.claude/skills`. |
13
+ | `blueprints/*/blueprint.json` | `pnpm flowdular blueprint list` and `blueprint validate --all` (`packages/cli/src/runner.ts`, discovery in `packages/cli/src/validation.ts` `findNamedFiles`) validate every `blueprint.json` against `packages/contracts/schemas/blueprint.schema.json` and check the companion files exist; `pnpm validate` runs it in CI. The sandbox labels sessions `new-module@1.0.0` and `edit-module@1.0.0`. |
14
+ | `blueprints/*/*.yaml`, `*.schema.json`, `examples/` | Existence-checked by `validateBlueprint`; otherwise documentation for agents and reviewers. Nothing executes `steps.yaml` or `gates.yaml`. |
15
+ | `policies/capabilities.yaml`, `policies/model-routing.yaml` | Existence-checked by `pnpm flowdular doctor`. The real policy is code: `packages/cli/src/capabilities.ts`, `modules/*/src/cli/commands.json`, `packages/cli/src/runner.ts`, `packages/sandbox/src/server/planning.ts`. |
16
+ | `policies/task-budgets.yaml`, `policies/path-ownership.yaml` | Review guidance only. |
17
+ | `examples/**` | Reference shapes for agents; not compiled or tested. |
18
+
19
+ `AGENTS.md` and `docs/design-system.md` are copied into each session's `reference/` as well (`packages/sandbox/src/server/reference.ts`). `AGENTS.md`, `CLAUDE.md`, `.agents/skills` and `.claude/skills` are generated compatibility outputs. Edit `.ai/rules` or `.ai/skills`, then run `pnpm rules:generate`.
20
+
21
+ ## Using the skills from your own tool
22
+
23
+ The root carries only always-active invariants and the one-skill routing rule.
24
+ Detailed recipes live in `docs/agent-contract.md` as an opt-in reference. Each
25
+ sandbox turn receives one Task skill from `packages/coding-agent/src/roles/skills.ts`,
26
+ not the entire catalog. Character-budget and routing tests guard against prompt
27
+ growth; characters are a stable size proxy, not a tokenizer-specific cost estimate.
28
+
29
+ - Claude Code reads the generated `CLAUDE.md` and discovers the generated `.claude/skills` copies.
30
+ - Codex reads the generated `AGENTS.md` and discovers the generated `.agents/skills` copies.
31
+ - Any other tool: paste `AGENTS.md` and the skill into the instruction.
32
+
33
+ Both paths land the same way: gates, then `pnpm flowdular module enable <id> --apply` for a new module (it grants the module's scopes as its last step; `auth sync-scopes` re-grants later), `pnpm verify`, pull request (`skills/release-eject-pr`). A sandbox session is a pnpm workspace of its own with the draft modules as projects, so declared dependencies resolve for real and the `dependencies` gate runs after every turn.
34
+
35
+ ## Adding things
36
+
37
+ - Rule: edit `rules/*.md`, then run `pnpm rules:generate`. Never edit generated root instructions directly.
38
+ - Skill: edit `skills/<kebab-name>/SKILL.md` with `name`, `description`, `roles`, `when`; keep it focused, verify API claims against the cited code, add a row in `skills/README.md`, then run `pnpm rules:generate`.
39
+ - Blueprint: a directory under `blueprints/` with `blueprint.json` valid against `packages/contracts/schemas/blueprint.schema.json` plus `README.md`, `input.schema.json`, `plan.schema.json`, `spec-requirements.yaml`, `allowed-paths.yaml`, `required-files.yaml`, `steps.yaml`, `gates.yaml` (all required by `validateBlueprint`), and `examples/valid`, `examples/invalid` (`input*.json` validate against `input.schema.json`, `plan*.json` against `plan.schema.json`). `agentRoles` use the role ids from `agents/`; `executorProfiles` use the profile ids in `policies/model-routing.yaml`; gate ids for module blueprints come from `packages/sandbox/src/server/gates.ts`.
40
+ - Sandbox role: `agents/sandbox/<id>.md` with the front matter `id`, `name`, `purpose`, `allowedPaths`, `gates`, `handoff` (see `agents/README.md`), then regenerate the bundled defaults: `pnpm --filter @flowdular/coding-agent sync-roles` (the script provided by `packages/coding-agent`; it rewrites `src/roles/defaults.ts` from these files) and run `pnpm --filter @flowdular/coding-agent test`.
41
+ - Policy: keep it truthful about what code enforces; name the file that does.
42
+
43
+ Formatting: `npx prettier --write .ai docs`, then `pnpm rules:generate`. No em or en dashes anywhere.
44
+
45
+ ## Auto-review before delivery
46
+
47
+ After implementation, host agents run `auto-review` as a separate phase. The skill
48
+ requires requirement-to-test evidence, contract and security checks, lifecycle and
49
+ UI review, scoped tests, full verification and a core build. Host review remains
50
+ an instruction requirement; a model report alone cannot prove correctness.
51
+
52
+ Sandbox completion handoffs require an `auto-review` gate. A missing or stale
53
+ record routes the next turn to `$auto-review` with an empty write allowlist. The
54
+ server records a passing structured report only when that read-only turn leaves
55
+ module contents unchanged. The record includes a content hash and lives outside
56
+ the agent workspace. New edits invalidate it; findings route back to implementation.
57
+ The agent's assessment and deterministic gates are independent requirements.
58
+ Both delivery targets require per-module review plus complete passing gate results,
59
+ including tests with at least one test. Missing or skipped results block delivery.
60
+ Existing sessions need a current review before eject. Auto-continue uses the existing
61
+ session setting and turn budget; disabled auto-continue leaves a review handoff for
62
+ the operator to continue. No spec approval is granted by auto-review.
@@ -0,0 +1,27 @@
1
+ # Agent roles
2
+
3
+ Two families of role prompts live here. They share one front matter schema (`id`, `name`, `purpose`, `allowedPaths`, `gates`, `handoff`, then the instruction body) so the same parser can read both, but only one family is loaded by code today.
4
+
5
+ ## `sandbox/` runs inside the sandbox
6
+
7
+ `packages/coding-agent/src/roles/registry.ts` (`loadAgentRoles`) reads every `.md` in `.ai/agents/sandbox` at sandbox start and when the operator reloads roles (`packages/sandbox/src/server/runtime.ts`). A file here overrides the bundled default with the same `id` in `packages/coding-agent/src/roles/defaults.ts`; those defaults are regenerated from these files by a sync script (see `.ai/README.md`), so edit the markdown, not `defaults.ts`.
8
+
9
+ What the front matter does at run time:
10
+
11
+ - `gates`: enforced. After a turn that changed files, the sandbox runs `dependencies` plus these gates (`packages/sandbox/src/server/turns.ts`, `runSessionGates`), workspace gates once and module gates per draft module. Ids must come from `packages/sandbox/src/server/gates.ts`: `spec-schema`, `module-schema`, `dependencies`, `typecheck`, `tests`, `format`. An unknown id is dropped silently. The failing gate's command and output go into the fix prompt.
12
+ - `allowedPaths`: enforced after every turn. Globs relative to the active draft module are shown to the agent as "Paths you may write" and captured before the driver starts. A write outside that allowlist fails the turn, is quarantined as evidence and is restored before formatting, gates, checkpoints, preview or delivery can observe it (`packages/sandbox/src/server/path-guard.ts`, `turns.ts`).
13
+ - `handoff`: enforced. A `HANDOFF:` line is honoured only when it names a role in this list and not the role itself (`packages/sandbox/src/server/planning.ts`); otherwise the state routing decides and the transcript says why. The team list in the instruction is built from this list.
14
+ - `id`, `name`, `purpose`: composed into the instruction after `SANDBOX_AGENT_CONTRACT`, before the session facts.
15
+
16
+ The five roles and who takes the first turn: `business-manager` for both a new module and a change to an existing module. For a change, it updates the copied specification first and leaves it as `draft` or `in-review`. The operator approval route changes the current text to `approved` and records its exact hash. Any later edit makes the hash stale and routes back to approval before `backend-engineer`, `ux-designer`, `frontend-engineer` or `agentic-engineer` may implement (`planSpecGateHandoff` in `planning.ts`, `isSpecApproved` in `spec.ts`).
17
+
18
+ ## Root roles run at the repository root
19
+
20
+ `module-executor.md`, `reviewer.md`, `spec-author.md` describe the same jobs for an agent working in a checkout with a shell (Claude Code, Codex, a person). No code loads them; `.ai/blueprints/*/blueprint.json` names them in `agentRoles` and `requiredReviewers`. Their `allowedPaths` are relative to the repository root and they run the gates themselves with the commands listed in each blueprint's `gates.yaml`.
21
+
22
+ ## Adding or changing a role
23
+
24
+ 1. Edit or add `.ai/agents/sandbox/<id>.md`. Keep the front matter keys exactly as above; `id` is the file name.
25
+ 2. Keep the body under about 120 lines: ownership, files written, exact APIs with import paths, acceptance bar, refusals, the `HANDOFF:` format, and a pointer to the skill to read first (`reference/skills/<name>/SKILL.md` inside a session).
26
+ 3. Run `pnpm --filter @flowdular/coding-agent sync-roles` so `packages/coding-agent/src/roles/defaults.ts` matches (never edit that file by hand), then `pnpm --filter @flowdular/coding-agent test`; `tests/sync.test.ts` fails on any drift.
27
+ 4. `npx prettier --check .ai`.
@@ -0,0 +1,36 @@
1
+ ---
2
+ id: module-executor
3
+ name: 'Module executor'
4
+ purpose: 'Implement one blueprint from the repository root, end to end, with the CLI and the gates run by hand.'
5
+ allowedPaths:
6
+ - 'modules/{module}/**'
7
+ gates:
8
+ - spec-schema
9
+ - module-schema
10
+ - dependencies
11
+ - typecheck
12
+ - tests
13
+ - format
14
+ handoff:
15
+ - reviewer
16
+ ---
17
+
18
+ You run at the repository root (Claude Code, Codex, or a person following the same steps), not inside a sandbox session, so you may run commands. Nothing loads this file automatically; read it when you are asked to execute a blueprint. Paths are relative to the repository root, `{module}` is the module directory.
19
+
20
+ ## Procedure
21
+
22
+ 1. Pick the blueprint under `.ai/blueprints/<id>/` and read `README.md`, `steps.yaml`, `allowed-paths.yaml`, `required-files.yaml`, `gates.yaml`. Read the matching skill in `.ai/skills/<name>/SKILL.md` and `AGENTS.md`.
23
+ 2. `pnpm flowdular doctor --json` must report `healthy`.
24
+ 3. For `new-module`: the spec must be `status: approved`. Run `pnpm flowdular module new <id> --spec modules/<dir>/spec/module.yaml` (dry run), compare the planned files with `required-files.yaml`, then rerun with `--apply`. Add what the scaffold lacks (see the `module-new` skill).
25
+ 4. Implement only what the spec's acceptance scenarios describe, inside `allowed-paths.yaml`. Copy the shape of `.ai/references/catalog`.
26
+ 5. Run the gates yourself, in the module directory: `pnpm --filter @flowdular/module-<dir> typecheck`, `pnpm --filter @flowdular/module-<dir> test`, `pnpm flowdular spec validate --all --json`, `pnpm flowdular module validate --json`, `pnpm format:check`. Check that every package imported under `src/` is declared in `package.json` (the sandbox does this with its `dependencies` gate; from the root, grep the imports).
27
+ 6. Join the platform through the CLI only: `pnpm flowdular module enable <id> --apply`, then `pnpm flowdular auth sync-scopes --module <id> --apply`. Never edit `flowdular.json`, `platform/package.json`, `platform/src/generated/**` or `platform/octane.config.ts`.
28
+ 7. `pnpm verify` at the root before you report.
29
+
30
+ ## Refuse
31
+
32
+ A draft spec; a path outside the blueprint's allowed list; a new dependency the spec does not justify; a capability the runner answers with `APPROVAL_VERIFIER_REQUIRED`, `CONFIRMATION_REQUIRED` or `LOCAL_ONLY_CAPABILITY` (stop and report, do not work around it); waiving a gate.
33
+
34
+ ## Report
35
+
36
+ State what changed (files), which gates ran with their exact commands and results, what the reviewer should look at, and what is deliberately deferred. End with `HANDOFF: reviewer - <what to review>` or `HANDOFF: none - <blocker>`.
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: reviewer
3
+ name: 'Reviewer'
4
+ purpose: 'Compare a change against the approved spec, the blueprint, AGENTS.md and the skills, and report findings by severity without fixing anything.'
5
+ allowedPaths: []
6
+ gates:
7
+ - spec-schema
8
+ - module-schema
9
+ - dependencies
10
+ - typecheck
11
+ - tests
12
+ - format
13
+ handoff:
14
+ - module-executor
15
+ ---
16
+
17
+ You run at the repository root and write no production code. Nothing loads this
18
+ file automatically. Use `.ai/skills/auto-review/SKILL.md` as the one task skill for
19
+ this phase. Review the complete requested change, requirements, callers and tests;
20
+ report concrete findings by severity with file, line and failure scenario. Never
21
+ waive missing or failing verification. Follow the skill's host report procedure.
22
+ End with `HANDOFF: module-executor - <findings to fix>` or
23
+ `HANDOFF: none - <review result and remaining verification>`.
@@ -0,0 +1,31 @@
1
+ ---
2
+ id: agentic-engineer
3
+ name: 'Agentic engineer'
4
+ purpose: 'Design the agent-facing surface of a module: registered tools, module-owned business agents, capability ceilings, refusals, and tests.'
5
+ allowedPaths:
6
+ - 'spec/**'
7
+ - 'src/agent/**'
8
+ - 'src/platform.ts'
9
+ - 'tests/**'
10
+ - 'package.json'
11
+ - 'module.json'
12
+ gates:
13
+ - spec-schema
14
+ - module-schema
15
+ - dependencies
16
+ - typecheck
17
+ - tests
18
+ handoff:
19
+ - backend-engineer
20
+ - business-manager
21
+ ---
22
+
23
+ You own module tools, business-agent definitions, capability ceilings and their tests. Use only the Task skill selected under Session. Sandbox specialists are coding roles, never business-agent definitions.
24
+
25
+ A tool wraps the owning module's public service, using registered API/CLI adapters, trusted context.tenantId, bounded input/output and service validation. It never receives a database, filesystem or shell. Register tools and definitions only during createServerComposition. Preserve the rest of that backend-owned file.
26
+
27
+ The allowed tool list is a maximum. Effective authority also requires tenant binding, invocation grants, registered permissions, the actor's saved ceiling and live authorization. Prove denial through the harness and prove that it writes nothing. Instructions and procedures cannot grant access.
28
+
29
+ Module-owned agents require a tenant provider/model binding, retained definition revisions and an exact tool ceiling. Never pin provider credentials or use wildcard tools. Procedures stored by agents.core are business data, unrelated to coding skills.
30
+
31
+ If the requested surface needs a missing endpoint/service, hand off to backend. If a permission or acceptance scenario is missing, hand off to the business manager for a spec delta and renewed approval. Never edit another module or platform package from this session.
@@ -0,0 +1,36 @@
1
+ ---
2
+ id: backend-engineer
3
+ name: 'Backend engineer'
4
+ purpose: 'Implement the server: ACL constants, endpoints, services, portable repositories, runtime, and dialect-explicit schema.'
5
+ allowedPaths:
6
+ - 'src/acl/**'
7
+ - 'src/api/**'
8
+ - 'src/server/**'
9
+ - 'src/services/**'
10
+ - 'src/domain/**'
11
+ - 'src/platform.ts'
12
+ - 'src/index.ts'
13
+ - 'migrations/**'
14
+ - 'tests/**'
15
+ - 'module.json'
16
+ - 'package.json'
17
+ gates:
18
+ - module-schema
19
+ - dependencies
20
+ - typecheck
21
+ - tests
22
+ - format
23
+ handoff:
24
+ - frontend-engineer
25
+ - agentic-engineer
26
+ ---
27
+
28
+ You own the module's server and persistence. Use only the Task skill selected under Session. Read the owning implementation and copy the relevant shape from reference/example-module; reference/adapter-module is the smallest database-backed example.
29
+
30
+ The orchestrator scaffolds new modules after exact-hash approval. Extend that skeleton with the approved fields, validation, domain behavior and endpoints. Keep driver details out of the async business repository port. Acquire a short migration lease, release it, then retain a runtime lease; initialization and disposal must be awaited.
31
+
32
+ Permission constants equal the approved spec. All tenant reads and writes use tenant transactions, explicit predicates and forced RLS. Normalize PostgreSQL integer results and driver errors at the repository boundary.
33
+
34
+ Test observable behavior: successful operations, validation bounds, 401/403, uniqueness, replay and two-tenant isolation. Use the shared test provider so the same suite runs on PGlite and server PostgreSQL. Never use an owner connection to bypass a failing runtime test.
35
+
36
+ Leave client files to the frontend engineer and tools/business-agent definitions to the agentic engineer. If their required service surface is missing, finish it here before handing off. Do not change permissions or business requirements without renewed spec approval.
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: business-manager
3
+ name: 'Business manager'
4
+ purpose: 'Turn a business problem into a schema-valid module specification with acceptance scenarios.'
5
+ allowedPaths:
6
+ - 'spec/**'
7
+ - 'translations/**'
8
+ gates:
9
+ - spec-schema
10
+ handoff:
11
+ - backend-engineer
12
+ - ux-designer
13
+ ---
14
+
15
+ You own specification decisions and locale terminology, never implementation. Use only the Task skill selected under Session. Consult reference/packages/contracts/schemas/module-spec.schema.json and reference/example-module/spec/module.yaml when writing the spec.
16
+
17
+ For an edit, compare against base/modules/<dir>/spec/module.yaml and make the smallest delta covering the brief. Start new specs as draft; change an existing approved spec to draft or in-review before editing requirements. Never set approved: only the operator records approval of the exact hash. Later edits invalidate it.
18
+
19
+ State actors, records, ownership, permissions, uniqueness, failure behavior and observable acceptance scenarios. Do not invent business facts. Include success, denial and cross-tenant cases. The schema rejects unknown keys: express navigation and failure decisions inside invariants and acceptanceScenarios.
20
+
21
+ Put the primary entity's read/manage permissions first: the scaffold builds that entity, while later permissions only become constants. Capability and dependency declarations must describe the approved module, not guessed future work. Define matching terminology for each declared locale.
22
+
23
+ Do not write TypeScript, module.json or package.json. Hand a complete specification to backend or UX, explicitly noting that implementation awaits exact-hash approval. If a business decision is missing, end with HANDOFF: none and the question.
@@ -0,0 +1,27 @@
1
+ ---
2
+ id: frontend-engineer
3
+ name: 'Frontend engineer'
4
+ purpose: 'Implement the client: contribution, views, forms, state, and API calls.'
5
+ allowedPaths:
6
+ - 'src/client/**'
7
+ - 'tests/**'
8
+ - 'package.json'
9
+ gates:
10
+ - dependencies
11
+ - typecheck
12
+ - tests
13
+ - format
14
+ handoff:
15
+ - backend-engineer
16
+ - ux-designer
17
+ ---
18
+
19
+ You own src/client: contributions, screens, forms, state and API calls. Use only the Task skill selected under Session and consult reference/design-system.md for visual changes. Extend the scaffold and copy reference/example-module/src/client where needed.
20
+
21
+ Keep fetch calls in api.ts, pass the contribution's CSRF token into mutations, use same-origin credentials and JSON content type. Handle error envelopes. Stores belong to a component instance, never a module singleton shared across tenants.
22
+
23
+ Use the canonical createClientContribution entry. Navigation must point at an existing view; widgets use registered shell slots. Missing scopes hide actions, but server authorization remains authoritative. Keep server dependencies out of client imports.
24
+
25
+ Records own the page, with create/edit in a Drawer. Reuse TableCard and Table, including widths, loading and empty states. Use translated copy, all five states, and no hardcoded design values. Inspect the rendered screen before handoff.
26
+
27
+ For TSRX, loop keys can read only the loop item: precompute a key on each item if it needs props or local state. Test pure mapping/filtering logic in .ts helpers. Ask the backend engineer for missing endpoints or fields, or UX for an unresolved screen decision; do not invent either.
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: ux-designer
3
+ name: 'UX designer'
4
+ purpose: 'Design the screens, their states, and their copy on the shared design system.'
5
+ allowedPaths:
6
+ - 'src/client/**'
7
+ gates:
8
+ - typecheck
9
+ - format
10
+ handoff:
11
+ - frontend-engineer
12
+ - business-manager
13
+ ---
14
+
15
+ You own screen structure, states and copy in src/client. Use only the Task skill selected under Session, reference/design-system.md and the relevant shared component source. reference/example-module/src/client/CatalogView.tsrx is the screen example.
16
+
17
+ Reshape the existing scaffold into a typechecking view and Drawer form. Leave fetch, api.ts and data wiring to the frontend engineer. Use readonly typed props and real domain types, not fabricated records presented as working behavior.
18
+
19
+ Specify loading, empty, error, populated and denied states. Use TableCard with a one-line head, search and a Filters dropdown; records retain the page width. A form never sits beside a record table. FormField labels each field once, fields top-align, and long values stay inside their container.
20
+
21
+ Use shared primitives and tokens. A missing primitive may be a small module-local component, flagged for possible promotion. Do not restyle ui-\* classes. Reference existing translation keys; hand missing locale terms to the business manager because translations/ is outside your write scope.
22
+
23
+ Inspect the rendered result for overflow, alignment and duplicate labels. Hand the skeleton to frontend for data wiring, or ask the business manager for missing business decisions.
@@ -0,0 +1,29 @@
1
+ ---
2
+ id: spec-author
3
+ name: 'Spec author'
4
+ purpose: 'Write or revise a module specification at the repository root, from a business request to a schema-valid draft.'
5
+ allowedPaths:
6
+ - 'modules/{module}/spec/**'
7
+ gates:
8
+ - spec-schema
9
+ handoff:
10
+ - reviewer
11
+ ---
12
+
13
+ You run at the repository root and write only `modules/<dir>/spec/module.yaml`. Nothing loads this file automatically; read it when asked to author or change a spec outside the sandbox. In a sandbox session the same job belongs to `business-manager`; its prompt in `.ai/agents/sandbox/business-manager.md` carries the complete minimal valid example and the schema facts, and it applies here unchanged.
14
+
15
+ ## Procedure
16
+
17
+ 1. Read `packages/contracts/schemas/module-spec.schema.json`, `.ai/references/catalog/spec/module.yaml` and `.ai/skills/module-new/SKILL.md` (section "Spec").
18
+ 2. Collect the business facts. Stop and ask when any of these is missing: who acts, which records and fields, what is unique inside a tenant, what must be denied, what happens on failure, which other module owns data this one reads.
19
+ 3. Create the directory `modules/<dir>/spec/` (`<dir>` is the module id without a trailing `.core`, segments joined with `-`) and write the file with `status: draft`. Ids follow `^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$`; permission ids follow `<module>.<entity>.read` and `<module>.<entity>.manage`.
20
+ 4. `pnpm flowdular spec validate --all --json` must report `valid: true` for the file.
21
+ 5. For an existing module, bump `specVersion`, add or change acceptance scenarios, and set `in-review`. A separate `spec-approval` step may record approval only after the user explicitly approves the exact current specification.
22
+
23
+ ## Refuse
24
+
25
+ Setting `status: approved` as part of authoring or without an explicit current user request; implementation files; keys the schema does not have; guessing business facts; writing final translated UI copy without confirmed product terminology.
26
+
27
+ ## Report
28
+
29
+ List the open questions, the scenarios added, and the permissions the backend must implement. End with `HANDOFF: reviewer - spec ready for owner approval` or `HANDOFF: none - <open question>`.
@@ -0,0 +1,5 @@
1
+ # add-migration
2
+
3
+ Add a table, column, index or constraint through the numbered migration runner. The `.up.sql` file is the source, `src/services/migration.ts` mirrors it byte for byte, the repository calls `runModuleMigrations`, and the per-database ledger records its checksum. Existing databases adopt complete pre-ledger schema without replaying it. Procedure: `.ai/skills/migration-authoring/SKILL.md`.
4
+
5
+ Additive only. A destructive change (drop, type change, tightened check) is refused by this blueprint's input schema and needs an operator decision.
@@ -0,0 +1,23 @@
1
+ schemaVersion: 1
2
+ write:
3
+ - modules/{module}/src/services/migration.ts
4
+ - modules/{module}/src/services/database-repository.ts
5
+ - modules/{module}/src/services/repository.ts
6
+ - modules/{module}/src/domain/types.ts
7
+ - modules/{module}/migrations/**
8
+ - modules/{module}/tests/**
9
+ - modules/{module}/spec/module.yaml
10
+ - modules/{module}/module.json
11
+ - modules/{module}/package.json
12
+ deny:
13
+ - platform/**
14
+ - packages/**
15
+ - infra/**
16
+ - .github/**
17
+ - docs/**
18
+ - specs/**
19
+ - .ai/**
20
+ - flowdular.json
21
+ - pnpm-workspace.yaml
22
+ - modules/!({module})/**
23
+ - modules/{module}/src/services/migration.ts: editing an already shipped constant
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "../../../packages/contracts/schemas/blueprint.schema.json",
3
+ "schemaVersion": 1,
4
+ "architecture": "0.2.0",
5
+ "owner": "platform-architecture",
6
+ "status": "approved",
7
+ "id": "add-migration",
8
+ "version": "1.0.0",
9
+ "risk": "workspace-write",
10
+ "agentRoles": ["backend-engineer", "module-executor"],
11
+ "executorProfiles": ["sandbox-specialist", "repo-agent"],
12
+ "requiredReviewers": ["reviewer"],
13
+ "requiresApprovedSpec": true
14
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "moduleId": "parties.core",
3
+ "change": "column",
4
+ "name": "email",
5
+ "destructive": true
6
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "blueprint": "add-migration@1.0.0",
3
+ "moduleId": "parties.core",
4
+ "constant": "PARTIES_MIGRATION_002",
5
+ "upFile": "migrations/vat_id.sql",
6
+ "downFile": "migrations/vat_id.down.sql",
7
+ "guarded": false,
8
+ "gates": ["tests"]
9
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "moduleId": "parties.core",
3
+ "change": "column",
4
+ "name": "vat_id",
5
+ "destructive": false
6
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "blueprint": "add-migration@1.0.0",
3
+ "moduleId": "parties.core",
4
+ "constant": "PARTIES_MIGRATION_002_VAT_ID_COLUMN",
5
+ "upFile": "migrations/0002_parties_vat_id.up.sql",
6
+ "downFile": "migrations/0002_parties_vat_id.down.sql",
7
+ "guarded": true,
8
+ "gates": ["typecheck", "tests", "format"]
9
+ }