@williambeto/ai-workflow 1.19.1 → 2.2.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 (397) hide show
  1. package/CHANGELOG.md +56 -838
  2. package/PUBLISH_MANIFEST.json +34 -0
  3. package/README.md +78 -148
  4. package/{packages/ai-workflow/bin → bin}/ai-workflow.js +0 -0
  5. package/dist-assets/AGENTS.md +27 -0
  6. package/dist-assets/agents/astra.md +63 -0
  7. package/dist-assets/agents/atlas.md +169 -0
  8. package/dist-assets/agents/nexus.md +42 -0
  9. package/dist-assets/agents/orion.md +44 -0
  10. package/dist-assets/agents/phoenix.md +42 -0
  11. package/dist-assets/agents/sage.md +54 -0
  12. package/dist-assets/commands/README.md +14 -0
  13. package/dist-assets/commands/atlas.md +12 -0
  14. package/dist-assets/commands/audit.md +10 -0
  15. package/dist-assets/commands/deploy.md +12 -0
  16. package/dist-assets/commands/discover.md +10 -0
  17. package/dist-assets/commands/implement.md +28 -0
  18. package/dist-assets/commands/optimize-tokens.md +10 -0
  19. package/dist-assets/commands/plan.md +10 -0
  20. package/dist-assets/commands/release.md +12 -0
  21. package/dist-assets/commands/run.md +26 -0
  22. package/dist-assets/commands/spec-create.md +10 -0
  23. package/dist-assets/commands/spec-implement.md +10 -0
  24. package/dist-assets/commands/spec-review.md +10 -0
  25. package/dist-assets/commands/update-memory.md +10 -0
  26. package/dist-assets/commands/validate.md +12 -0
  27. package/dist-assets/docs/INDEX.md +21 -0
  28. package/dist-assets/docs/QUICKSTART.md +23 -0
  29. package/dist-assets/docs/adr/ADR-0000.md +19 -0
  30. package/dist-assets/docs/adr/ADR-0001.md +45 -0
  31. package/dist-assets/docs/adr/ADR-0002.md +62 -0
  32. package/dist-assets/docs/adr/ADR-0003.md +60 -0
  33. package/dist-assets/docs/adr/ADR-0004.md +71 -0
  34. package/dist-assets/docs/adr/ADR-0005.md +22 -0
  35. package/dist-assets/docs/adr/ADR-0006.md +82 -0
  36. package/dist-assets/docs/adr/ADR-0007.md +78 -0
  37. package/dist-assets/docs/api-engine-reference.md +7 -0
  38. package/{docs → dist-assets/docs}/architecture-policy.md +1 -1
  39. package/dist-assets/docs/cli-reference.md +27 -0
  40. package/dist-assets/docs/compatibility/provider-usage.md +38 -0
  41. package/dist-assets/docs/compatibility/runtime-matrix.md +30 -0
  42. package/dist-assets/docs/consumer-onboarding.md +17 -0
  43. package/dist-assets/docs/contributing-guide.md +11 -0
  44. package/{docs → dist-assets/docs}/design-patterns-policy.md +2 -2
  45. package/dist-assets/docs/full-documentation.md +113 -0
  46. package/{docs → dist-assets/docs}/npm-consumer-quickstart.md +18 -46
  47. package/dist-assets/docs/opencode-readme.md +8 -0
  48. package/dist-assets/docs/policies/01-BRANCH_GATE.md +63 -0
  49. package/dist-assets/docs/policies/02-SDD_METHODOLOGY.md +95 -0
  50. package/dist-assets/docs/policies/03-QUALITY_GATE.md +22 -0
  51. package/dist-assets/docs/policies/05-AGENT_CONTRACT.md +7 -0
  52. package/dist-assets/docs/policies/06-FINAL_EVIDENCE_CONTRACT.md +31 -0
  53. package/dist-assets/docs/policies/07-RELEASE_GATE.md +47 -0
  54. package/dist-assets/docs/policies/08-PRODUCT_TRUTHFULNESS_AND_PROJECT_DOCS.md +18 -0
  55. package/dist-assets/docs/policies/09-SPEC_VISIBILITY_AND_PUBLICATION.md +28 -0
  56. package/dist-assets/docs/policies/10-BEHAVIORAL_CONTRACT_HARDENING.md +9 -0
  57. package/dist-assets/docs/policies/11-EXECUTABLE_DELEGATION_AND_TRUTHFULNESS.md +7 -0
  58. package/dist-assets/docs/policies/ORCHESTRATION_PROTOCOL.md +15 -0
  59. package/dist-assets/docs/policies/PROCEDURE_DELIVERY_ARTIFACTS.md +21 -0
  60. package/dist-assets/docs/policies/PROCEDURE_DOCUMENTATION_CHECKLIST.md +24 -0
  61. package/dist-assets/docs/policies/PROCEDURE_UI_CHECKLIST.md +54 -0
  62. package/dist-assets/docs/profiles/README.md +19 -0
  63. package/dist-assets/docs/profiles/backend-api.md +5 -0
  64. package/dist-assets/docs/profiles/documentation.md +3 -0
  65. package/dist-assets/docs/profiles/frontend-product.md +19 -0
  66. package/dist-assets/docs/profiles/frontend-utility.md +19 -0
  67. package/dist-assets/docs/profiles/refactor.md +3 -0
  68. package/dist-assets/docs/profiles/security-review.md +3 -0
  69. package/dist-assets/docs/references/frontend-quality/landing-page-quality-checklist.md +11 -0
  70. package/dist-assets/docs/references/frontend-quality/product-copy-truthfulness.md +7 -0
  71. package/dist-assets/docs/references/frontend-quality/quality-failure-examples.md +20 -0
  72. package/dist-assets/docs/references/frontend-quality/visual-composition-patterns.md +10 -0
  73. package/dist-assets/docs/specs/runtime-operational-contract.md +39 -0
  74. package/dist-assets/docs/troubleshooting-guide.md +21 -0
  75. package/dist-assets/docs/visual-validation-guide.md +76 -0
  76. package/dist-assets/examples/README.md +10 -0
  77. package/dist-assets/examples/autopilot-cycle/00-CONTEXT.md +3 -0
  78. package/dist-assets/examples/autopilot-cycle/01-requirement.md +16 -0
  79. package/dist-assets/examples/autopilot-cycle/02-gate-a-check.md +23 -0
  80. package/dist-assets/examples/autopilot-cycle/03-orion-planning.md +20 -0
  81. package/dist-assets/examples/autopilot-cycle/04-astra-implementation.md +17 -0
  82. package/dist-assets/examples/autopilot-cycle/05-sage-validation.md +15 -0
  83. package/dist-assets/examples/autopilot-cycle/06-phoenix-healing.md +12 -0
  84. package/dist-assets/examples/autopilot-cycle/07-orchestration-report.md +18 -0
  85. package/dist-assets/examples/backend-api/00-CONTEXT.md +12 -0
  86. package/dist-assets/examples/backend-api/01-requirement.md +19 -0
  87. package/dist-assets/examples/backend-api/02-functional-spec.md +20 -0
  88. package/dist-assets/examples/backend-api/03-technical-plan.md +15 -0
  89. package/dist-assets/examples/backend-api/04-pr-breakdown.md +10 -0
  90. package/dist-assets/examples/backend-api/05-execution-handoff.md +13 -0
  91. package/dist-assets/examples/backend-api/06-validation-report.md +11 -0
  92. package/dist-assets/examples/backend-api/07-orchestration-report.md +7 -0
  93. package/dist-assets/examples/blocked-scenarios/00-CONTEXT.md +9 -0
  94. package/dist-assets/examples/blocked-scenarios/01-branch-gate-block.md +12 -0
  95. package/dist-assets/examples/blocked-scenarios/02-quality-gate-block.md +13 -0
  96. package/dist-assets/examples/blocked-scenarios/03-scope-creep-block.md +13 -0
  97. package/dist-assets/examples/blocked-scenarios/04-unblock-resolution.md +9 -0
  98. package/dist-assets/examples/blocked-scenarios/05-orchestration-decision-log.md +11 -0
  99. package/dist-assets/examples/bugfix-critical/00-CONTEXT.md +12 -0
  100. package/dist-assets/examples/bugfix-critical/01-bug-report.md +11 -0
  101. package/dist-assets/examples/bugfix-critical/02-diagnosis-hypothesis.md +11 -0
  102. package/dist-assets/examples/bugfix-critical/03-technical-plan.md +12 -0
  103. package/dist-assets/examples/bugfix-critical/04-implementation-handoff.md +8 -0
  104. package/dist-assets/examples/bugfix-critical/05-validation-report.md +10 -0
  105. package/dist-assets/examples/bugfix-critical/06-orchestration-report.md +7 -0
  106. package/dist-assets/examples/cli-package/00-CONTEXT.md +9 -0
  107. package/dist-assets/examples/cli-package/01-requirement.md +14 -0
  108. package/dist-assets/examples/cli-package/02-technical-spec.md +16 -0
  109. package/dist-assets/examples/cli-package/03-technical-plan.md +12 -0
  110. package/dist-assets/examples/cli-package/04-pr-breakdown.md +9 -0
  111. package/dist-assets/examples/cli-package/05-release-report.md +15 -0
  112. package/dist-assets/examples/docs-only-repo/01-requirement.md +31 -0
  113. package/dist-assets/examples/docs-only-repo/02-functional-spec.md +25 -0
  114. package/dist-assets/examples/docs-only-repo/03-technical-plan.md +21 -0
  115. package/dist-assets/examples/docs-only-repo/04-pr-breakdown.md +13 -0
  116. package/dist-assets/examples/docs-only-repo/05-execution-handoff.md +17 -0
  117. package/dist-assets/examples/docs-only-repo/06-validation-report.md +16 -0
  118. package/dist-assets/examples/docs-only-repo/README.md +26 -0
  119. package/dist-assets/examples/full-stack-checkout/00-CONTEXT.md +9 -0
  120. package/dist-assets/examples/full-stack-checkout/01-requirement.md +12 -0
  121. package/dist-assets/examples/full-stack-checkout/02-functional-spec.md +15 -0
  122. package/dist-assets/examples/full-stack-checkout/03-technical-plan.md +15 -0
  123. package/dist-assets/examples/full-stack-checkout/04-pr-breakdown.md +8 -0
  124. package/dist-assets/examples/full-stack-checkout/05-execution-handoff.md +14 -0
  125. package/dist-assets/examples/full-stack-checkout/06-validation-report.md +12 -0
  126. package/dist-assets/examples/healing-cycle/00-CONTEXT.md +15 -0
  127. package/dist-assets/examples/healing-cycle/01-broken-implementation.md +10 -0
  128. package/dist-assets/examples/healing-cycle/02-sage-fails.md +14 -0
  129. package/dist-assets/examples/healing-cycle/03-phoenix-diagnosis.md +17 -0
  130. package/dist-assets/examples/healing-cycle/04-phoenix-fix.md +18 -0
  131. package/dist-assets/examples/healing-cycle/05-sage-revalidation.md +12 -0
  132. package/dist-assets/examples/healing-cycle/06-orchestration-log.md +14 -0
  133. package/dist-assets/examples/infra-deploy/00-CONTEXT.md +9 -0
  134. package/dist-assets/examples/infra-deploy/01-operational-goal.md +12 -0
  135. package/dist-assets/examples/infra-deploy/02-architecture-specs.md +15 -0
  136. package/dist-assets/examples/infra-deploy/03-implementation-plan.md +14 -0
  137. package/dist-assets/examples/infra-deploy/04-step-breakdown.md +9 -0
  138. package/dist-assets/examples/infra-deploy/05-execution-handoff.md +13 -0
  139. package/dist-assets/examples/infra-deploy/06-operational-report.md +11 -0
  140. package/dist-assets/examples/multi-pr-release/00-CONTEXT.md +9 -0
  141. package/dist-assets/examples/multi-pr-release/01-requirement.md +13 -0
  142. package/dist-assets/examples/multi-pr-release/02-strategic-plan.md +13 -0
  143. package/dist-assets/examples/multi-pr-release/03-pr-breakdown.md +14 -0
  144. package/dist-assets/examples/multi-pr-release/04-release-plan.md +12 -0
  145. package/dist-assets/examples/multi-pr-release/05-orchestration-report.md +7 -0
  146. package/dist-assets/examples/nuxt-dashboard/01-requirement.md +81 -0
  147. package/dist-assets/examples/nuxt-dashboard/02-functional-spec.md +88 -0
  148. package/dist-assets/examples/nuxt-dashboard/03-technical-plan.md +76 -0
  149. package/dist-assets/examples/nuxt-dashboard/04-pr-breakdown.md +219 -0
  150. package/dist-assets/examples/nuxt-dashboard/05-execution-handoff.md +88 -0
  151. package/dist-assets/examples/nuxt-dashboard/06-validation-report.md +56 -0
  152. package/dist-assets/examples/nuxt-dashboard/07-orchestration-report.md +79 -0
  153. package/dist-assets/examples/nuxt-dashboard/README.md +52 -0
  154. package/dist-assets/examples/react-dashboard/01-requirement.md +84 -0
  155. package/dist-assets/examples/react-dashboard/02-functional-spec.md +88 -0
  156. package/dist-assets/examples/react-dashboard/03-technical-plan.md +76 -0
  157. package/dist-assets/examples/react-dashboard/04-pr-breakdown.md +218 -0
  158. package/dist-assets/examples/react-dashboard/05-execution-handoff.md +13 -0
  159. package/dist-assets/examples/react-dashboard/06-validation-report.md +12 -0
  160. package/dist-assets/examples/react-dashboard/07-orchestration-report.md +7 -0
  161. package/dist-assets/examples/react-dashboard/README.md +70 -0
  162. package/dist-assets/examples/refactoring-service/00-CONTEXT.md +9 -0
  163. package/dist-assets/examples/refactoring-service/01-debt-report.md +12 -0
  164. package/dist-assets/examples/refactoring-service/02-behavior-spec.md +11 -0
  165. package/dist-assets/examples/refactoring-service/03-technical-plan.md +13 -0
  166. package/dist-assets/examples/refactoring-service/04-pr-breakdown.md +9 -0
  167. package/dist-assets/examples/refactoring-service/05-execution-handoff.md +14 -0
  168. package/dist-assets/examples/refactoring-service/06-stability-report.md +12 -0
  169. package/dist-assets/examples/sdd-cycle/00-CONTEXT.md +12 -0
  170. package/dist-assets/examples/sdd-cycle/01-raw-request.md +13 -0
  171. package/dist-assets/examples/sdd-cycle/02-spec-creation.md +18 -0
  172. package/dist-assets/examples/sdd-cycle/03-spec-review.md +12 -0
  173. package/dist-assets/examples/sdd-cycle/04-technical-plan.md +16 -0
  174. package/dist-assets/examples/sdd-cycle/05-pr-breakdown.md +9 -0
  175. package/dist-assets/examples/sdd-cycle/06-spec-implement.md +13 -0
  176. package/dist-assets/examples/sdd-cycle/07-validation-against-spec.md +13 -0
  177. package/dist-assets/examples/wordpress-theme/01-requirement.md +29 -0
  178. package/dist-assets/examples/wordpress-theme/02-functional-spec.md +22 -0
  179. package/dist-assets/examples/wordpress-theme/03-technical-plan.md +22 -0
  180. package/dist-assets/examples/wordpress-theme/04-pr-breakdown.md +14 -0
  181. package/dist-assets/examples/wordpress-theme/05-execution-handoff.md +17 -0
  182. package/dist-assets/examples/wordpress-theme/06-validation-report.md +16 -0
  183. package/dist-assets/examples/wordpress-theme/README.md +32 -0
  184. package/{harness → dist-assets/harness}/handoffs/HANDOFF.template.md +2 -2
  185. package/{harness → dist-assets/harness}/workflows/agent-evaluation-checklist.md +5 -5
  186. package/{harness → dist-assets/harness}/workflows/implement-review-validate.md +24 -0
  187. package/{harness → dist-assets/harness}/workflows/multi-agent-handoff.md +4 -4
  188. package/{harness → dist-assets/harness}/workflows/planner-executor-workflow.md +5 -5
  189. package/{harness → dist-assets/harness}/workflows/requirement-to-pr.md +1 -1
  190. package/dist-assets/runbooks/agent-delegation-workflow.md +50 -0
  191. package/dist-assets/runbooks/apply-starter-to-real-project.md +45 -0
  192. package/dist-assets/runbooks/commands-cheatsheet.md +44 -0
  193. package/dist-assets/runbooks/how-to-use-skills.md +44 -0
  194. package/dist-assets/runbooks/private-spec-publication-safety.md +35 -0
  195. package/{runbooks → dist-assets/runbooks}/spec-driven-development.md +3 -6
  196. package/dist-assets/runbooks/tutorial-walkthroughs.md +23 -0
  197. package/dist-assets/runbooks/use-linear-for-operational-planning.md +45 -0
  198. package/dist-assets/runbooks/use-napkin-project-memory.md +33 -0
  199. package/dist-assets/skills/architecture/SKILL.md +166 -0
  200. package/dist-assets/skills/backend-development/SKILL.md +166 -0
  201. package/dist-assets/skills/deployment/SKILL.md +166 -0
  202. package/dist-assets/skills/design-principles/SKILL.md +166 -0
  203. package/dist-assets/skills/documentation/SKILL.md +171 -0
  204. package/dist-assets/skills/frontend-development/SKILL.md +225 -0
  205. package/dist-assets/skills/full-stack-development/SKILL.md +166 -0
  206. package/dist-assets/skills/optimize-tokens/SKILL.md +166 -0
  207. package/dist-assets/skills/pr-workflow/SKILL.md +166 -0
  208. package/dist-assets/skills/product-discovery/SKILL.md +166 -0
  209. package/dist-assets/skills/product-planning/SKILL.md +166 -0
  210. package/dist-assets/skills/project-memory/SKILL.md +166 -0
  211. package/dist-assets/skills/prompt-engineer/SKILL.md +166 -0
  212. package/dist-assets/skills/qa-workflow/SKILL.md +186 -0
  213. package/dist-assets/skills/refactoring/SKILL.md +166 -0
  214. package/dist-assets/skills/release-workflow/SKILL.md +166 -0
  215. package/dist-assets/skills/spec-driven-development/SKILL.md +166 -0
  216. package/dist-assets/skills/technical-leadership/SKILL.md +166 -0
  217. package/dist-assets/skills/ui-ux-design/SKILL.md +202 -0
  218. package/dist-assets/templates/.geminiignore.template +8 -0
  219. package/dist-assets/templates/CLAUDE.md.template +20 -0
  220. package/dist-assets/templates/CODEX.md.template +20 -0
  221. package/dist-assets/templates/GEMINI.md.template +20 -0
  222. package/dist-assets/templates/HANDOFF.template.md +45 -0
  223. package/dist-assets/templates/SPEC.template.md +38 -0
  224. package/dist-assets/templates/change-proposal.template.md +14 -0
  225. package/dist-assets/templates/owner-evidence/astra-implementation.json +10 -0
  226. package/dist-assets/templates/owner-evidence/phoenix-remediation.json +8 -0
  227. package/dist-assets/templates/owner-evidence/sage-revalidation.json +8 -0
  228. package/dist-assets/templates/owner-evidence/sage-validation.json +8 -0
  229. package/dist-assets/templates/specs/deep.md +48 -0
  230. package/dist-assets/templates/specs/standard.md +38 -0
  231. package/dist-assets/templates/specs/tiny.md +19 -0
  232. package/package.json +43 -47
  233. package/src/adapters/index.js +3 -0
  234. package/src/adapters/platforms/claude.js +126 -0
  235. package/src/adapters/platforms/codex.js +100 -0
  236. package/src/adapters/platforms/gemini.js +232 -0
  237. package/src/cli.js +114 -0
  238. package/src/commands/collect-evidence.js +61 -0
  239. package/src/commands/doctor.js +186 -0
  240. package/src/commands/execute.js +172 -0
  241. package/{packages/ai-workflow/src → src}/commands/init.js +119 -20
  242. package/src/commands/run.js +112 -0
  243. package/src/core/completion-contract.js +35 -0
  244. package/src/core/execution-planner.js +59 -0
  245. package/src/core/gates/branch-gate.js +146 -0
  246. package/src/core/handoff/handoff-engine.js +104 -0
  247. package/src/core/healing/cli-remediation-executor.js +151 -0
  248. package/src/core/healing/healer-engine.js +179 -0
  249. package/src/core/identity.js +43 -0
  250. package/{packages/ai-workflow/src → src}/core/install-plan.js +3 -3
  251. package/src/core/opencode-merge.js +149 -0
  252. package/{packages/ai-workflow/src → src}/core/package-assets.js +29 -10
  253. package/src/core/request-classifier.js +58 -0
  254. package/src/core/runtime/opencode-adapter.js +94 -0
  255. package/src/core/sdd/validator.js +67 -0
  256. package/src/core/statuses.js +29 -0
  257. package/src/core/symlink-layout.js +93 -0
  258. package/src/core/templates.js +221 -0
  259. package/src/core/validation/canonical-finalization.js +43 -0
  260. package/src/core/validation/evidence-collector.js +109 -0
  261. package/src/core/validation/quality-guard.js +243 -0
  262. package/src/core/workflow-profiles.js +107 -0
  263. package/src/core/workflow-state-machine.js +46 -0
  264. package/.agents/napkin.md +0 -89
  265. package/.agents/skills/backend-implementer/SKILL.md +0 -490
  266. package/.agents/skills/build-and-validate/SKILL.md +0 -442
  267. package/.agents/skills/deploy-engineer/SKILL.md +0 -541
  268. package/.agents/skills/docs-writer/SKILL.md +0 -430
  269. package/.agents/skills/frontend-implementer/SKILL.md +0 -488
  270. package/.agents/skills/interface-design/SKILL.md +0 -428
  271. package/.agents/skills/interface-design/references/critique.md +0 -67
  272. package/.agents/skills/interface-design/references/example.md +0 -86
  273. package/.agents/skills/interface-design/references/principles.md +0 -235
  274. package/.agents/skills/interface-design/references/validation.md +0 -48
  275. package/.agents/skills/minimal-context/SKILL.md +0 -177
  276. package/.agents/skills/napkin/SKILL.md +0 -84
  277. package/.agents/skills/opencode-agent-design/SKILL.md +0 -77
  278. package/.agents/skills/playwright-cli/SKILL.md +0 -62
  279. package/.agents/skills/pr-orchestrator/SKILL.md +0 -366
  280. package/.agents/skills/product-manager/SKILL.md +0 -519
  281. package/.agents/skills/seo-audit/SKILL.md +0 -176
  282. package/.agents/skills/stack-variant-creator/SKILL.md +0 -265
  283. package/.agents/skills/tech-lead/SKILL.md +0 -453
  284. package/.agents/skills/tester/SKILL.md +0 -399
  285. package/.agents/skills/token-economy/SKILL.md +0 -137
  286. package/.agents/skills/vue-nuxt/SKILL.md +0 -102
  287. package/.agents/skills/wordpress-engineer/SKILL.md +0 -75
  288. package/.codex/prompts/README.md +0 -44
  289. package/.codex/prompts/autopilot.md +0 -50
  290. package/.codex/prompts/deploy.md +0 -33
  291. package/.codex/prompts/execute-selected-pr.md +0 -35
  292. package/.codex/prompts/fix-issue.md +0 -34
  293. package/.codex/prompts/minimal-context-mode.md +0 -55
  294. package/.codex/prompts/orchestrate-next.md +0 -33
  295. package/.codex/prompts/plan-from-requirement.md +0 -37
  296. package/.codex/prompts/review-implementation.md +0 -33
  297. package/.codex/prompts/roadmap-audit.md +0 -22
  298. package/.codex/prompts/specs/create-spec-from-requirement.md +0 -26
  299. package/.codex/prompts/specs/review-spec.md +0 -29
  300. package/.codex/prompts/specs/spec-to-pr-breakdown.md +0 -23
  301. package/.codex/prompts/specs/spec-to-technical-plan.md +0 -28
  302. package/.codex/prompts/start-project.md +0 -29
  303. package/.codex/prompts/token-economy-mode.md +0 -48
  304. package/.codex/prompts/validate-work.md +0 -28
  305. package/checklists/change-spec-readiness-checklist.md +0 -34
  306. package/docs/full-documentation.md +0 -661
  307. package/docs/setup-codex-opencode.md +0 -313
  308. package/harness/README.md +0 -106
  309. package/opencode/README.md +0 -84
  310. package/opencode/agents/README.md +0 -113
  311. package/opencode/agents/atlas.md +0 -127
  312. package/opencode/agents/discovery.md +0 -61
  313. package/opencode/agents/fixer.md +0 -51
  314. package/opencode/agents/implementer.md +0 -61
  315. package/opencode/agents/orchestrator.md +0 -145
  316. package/opencode/agents/planner.md +0 -60
  317. package/opencode/agents/prompt-engineer.md +0 -50
  318. package/opencode/agents/release-manager.md +0 -50
  319. package/opencode/agents/reviewer.md +0 -51
  320. package/opencode/agents/spec-engineer.md +0 -85
  321. package/opencode/agents/validator.md +0 -50
  322. package/opencode/agents/wordpress-engineer.md +0 -49
  323. package/opencode/commands/README.md +0 -48
  324. package/opencode/commands/autopilot.md +0 -50
  325. package/opencode/commands/deploy.md +0 -35
  326. package/opencode/commands/execute.md +0 -47
  327. package/opencode/commands/orchestrate.md +0 -37
  328. package/opencode/commands/plan.md +0 -39
  329. package/opencode/commands/review.md +0 -33
  330. package/opencode/commands/roadmap-audit.md +0 -30
  331. package/opencode/commands/ship.md +0 -48
  332. package/opencode/commands/specs/create-spec-from-request.md +0 -27
  333. package/opencode/commands/specs/create-spec-from-requirement.md +0 -25
  334. package/opencode/commands/specs/review-spec.md +0 -26
  335. package/opencode/commands/specs/spec-to-pr-breakdown.md +0 -19
  336. package/opencode/commands/specs/spec-to-tasks.md +0 -26
  337. package/opencode/commands/specs/spec-to-technical-plan.md +0 -27
  338. package/opencode/commands/start.md +0 -45
  339. package/opencode/commands/token-economy.md +0 -29
  340. package/opencode/commands/validate.md +0 -33
  341. package/opencode.jsonc +0 -235
  342. package/packages/ai-workflow/README.md +0 -82
  343. package/packages/ai-workflow/src/cli.js +0 -70
  344. package/packages/ai-workflow/src/commands/codex.js +0 -37
  345. package/packages/ai-workflow/src/commands/doctor.js +0 -168
  346. package/packages/ai-workflow/src/commands/guide.js +0 -194
  347. package/packages/ai-workflow/src/core/opencode-merge.js +0 -172
  348. package/packages/ai-workflow/src/core/symlink-layout.js +0 -54
  349. package/packages/ai-workflow/src/core/templates.js +0 -276
  350. package/runbooks/agent-delegation-workflow.md +0 -111
  351. package/runbooks/apply-starter-to-real-project.md +0 -445
  352. package/runbooks/commands-cheatsheet.md +0 -71
  353. package/runbooks/how-to-use-skills.md +0 -713
  354. package/runbooks/quick-start-guide.md +0 -213
  355. package/runbooks/tutorial-walkthroughs.md +0 -416
  356. package/runbooks/use-linear-for-operational-planning.md +0 -185
  357. package/runbooks/use-napkin-project-memory.md +0 -77
  358. package/templates/AGENTS.template.md +0 -397
  359. package/templates/DESIGN.template.md +0 -484
  360. package/templates/PR-PLAN.template.md +0 -172
  361. package/templates/README.template.md +0 -293
  362. package/templates/REQUIREMENT.template.md +0 -165
  363. package/templates/SPEC.template.md +0 -397
  364. package/templates/TECH-PLAN.template.md +0 -244
  365. package/templates/change-proposal.template.md +0 -97
  366. /package/{checklists/spec-readiness-checklist.md → dist-assets/docs/policies/SPEC_READINESS.md} +0 -0
  367. /package/{prompts → dist-assets/prompts}/00-bootstrap-project.md +0 -0
  368. /package/{prompts → dist-assets/prompts}/01-create-requirement.md +0 -0
  369. /package/{prompts → dist-assets/prompts}/02-create-spec.md +0 -0
  370. /package/{prompts → dist-assets/prompts}/03-create-tech-plan.md +0 -0
  371. /package/{prompts → dist-assets/prompts}/04-breakdown-prs.md +0 -0
  372. /package/{prompts → dist-assets/prompts}/05-implement-pr.md +0 -0
  373. /package/{prompts → dist-assets/prompts}/06-review-and-fix.md +0 -0
  374. /package/{prompts → dist-assets/prompts}/07-apply-design.md +0 -0
  375. /package/{prompts → dist-assets/prompts}/08-validate.md +0 -0
  376. /package/{prompts → dist-assets/prompts}/09-deploy.md +0 -0
  377. /package/{prompts → dist-assets/prompts}/commands/implement.md +0 -0
  378. /package/{prompts → dist-assets/prompts}/commands/requirement.md +0 -0
  379. /package/{prompts → dist-assets/prompts}/commands/spec.md +0 -0
  380. /package/{prompts → dist-assets/prompts}/commands/tech-plan.md +0 -0
  381. /package/{prompts → dist-assets/prompts}/commands/validate.md +0 -0
  382. /package/{runbooks → dist-assets/runbooks}/branch-cleanup.md +0 -0
  383. /package/{runbooks → dist-assets/runbooks}/deploy-checklist.md +0 -0
  384. /package/{runbooks → dist-assets/runbooks}/publication-readiness-checklist.md +0 -0
  385. /package/{runbooks → dist-assets/runbooks}/publish-package-checklist.md +0 -0
  386. /package/{runbooks → dist-assets/runbooks}/team-governance-pr-readiness.md +0 -0
  387. /package/{runbooks → dist-assets/runbooks}/validate-starter-in-real-project.md +0 -0
  388. /package/{runbooks → dist-assets/runbooks}/validation-checklist.md +0 -0
  389. /package/{schemas → dist-assets/schemas}/README.md +0 -0
  390. /package/{schemas → dist-assets/schemas}/functional-spec.schema.json +0 -0
  391. /package/{schemas → dist-assets/schemas}/handoff.schema.json +0 -0
  392. /package/{schemas → dist-assets/schemas}/pr-breakdown.schema.json +0 -0
  393. /package/{schemas → dist-assets/schemas}/requirement.schema.json +0 -0
  394. /package/{schemas → dist-assets/schemas}/technical-plan.schema.json +0 -0
  395. /package/{schemas → dist-assets/schemas}/validation-report.schema.json +0 -0
  396. /package/{packages/ai-workflow/src → src}/core/backup.js +0 -0
  397. /package/{packages/ai-workflow/src → src}/core/filesystem.js +0 -0
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: phoenix
3
+ description: Applies bounded, targeted remediation for concrete validation findings.
4
+ mode: primary
5
+ ---
6
+
7
+ # Phoenix
8
+
9
+ ## Role
10
+
11
+ Phoenix fixes concrete findings supplied by validation. It does not redesign the solution or modify unrelated code.
12
+
13
+ ## Behavioral execution contract
14
+
15
+ Remediation is bounded by execution mode and must show progress. Repeated or unchanged findings become `BLOCKED`.
16
+
17
+ ## Responsibilities
18
+
19
+ - address only identified findings;
20
+ - preserve working behavior;
21
+ - keep the diff minimal;
22
+ - run targeted checks after changes;
23
+ - return the exact findings addressed and files changed.
24
+
25
+ ## Expected output
26
+
27
+ Return the remediation diff summary, targeted validation results, unresolved findings, and whether independent revalidation is needed.
28
+
29
+ ## Quality failure examples
30
+
31
+ - rewriting the feature to satisfy a report format;
32
+ - changing copy or layout unrelated to the finding;
33
+ - claiming a finding is fixed without running a relevant check;
34
+ - exceeding the remediation attempt budget.
35
+
36
+ ## Boundaries
37
+
38
+ Phoenix cannot approve its own remediation or convert failure into success.
39
+
40
+ ## Stop conditions
41
+
42
+ Stop when the attempt budget is exhausted, no progress is observed, the fix requires broader scope approval, or a safe correction is unavailable.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: sage
3
+ description: Independently validates software behavior, regressions, and delivery evidence when review is proportionate to risk.
4
+ mode: primary
5
+ ---
6
+
7
+ # Sage
8
+
9
+ ## Role
10
+
11
+ Sage validates independently from implementation when Atlas selects independent review, especially for full, risky, security-sensitive, or release work.
12
+
13
+ ## Behavioral execution contract
14
+
15
+ Sage validates independently. It inspects the actual diff and runs relevant commands. It does not help manufacture the documents needed to pass a gate.
16
+
17
+ ## Responsibilities
18
+
19
+ - review scope and changed files;
20
+ - run relevant tests, build, typecheck, lint, and targeted checks;
21
+ - identify concrete defects with evidence;
22
+ - distinguish blocking defects from notes;
23
+ - verify remediation against the changed workspace when requested.
24
+
25
+ ## Expected output
26
+
27
+ Return:
28
+
29
+ - commands and observed results;
30
+ - findings with severity and file evidence;
31
+ - blocking status;
32
+ - limitations of the validation performed.
33
+
34
+ ## Quality failure examples
35
+
36
+ - approving based only on a delivery report;
37
+ - accepting screenshots as proof of all behavior;
38
+ - repeating the implementer's claims without checking;
39
+ - accepting claims about sources, integrations, data handling, or available capabilities that are not supported by the delivered code or clearly qualified as mocked or conceptual;
40
+ - downgrading a failed required command to a note.
41
+
42
+ ## Boundaries
43
+
44
+ Sage does not implement broad fixes, create fake evidence, or promote unresolved blocking findings.
45
+
46
+ ## Stop conditions
47
+
48
+ Stop with a blocking result when required validation cannot run, the branch is unsafe, evidence contradicts the implementation, or remediation did not resolve a material finding.
49
+
50
+ ## Canonical policies
51
+
52
+ - `03-QUALITY_GATE.md`
53
+ - `06-FINAL_EVIDENCE_CONTRACT.md`
54
+ - `PROCEDURE_UI_CHECKLIST.md`
@@ -0,0 +1,14 @@
1
+ # Commands
2
+
3
+ Commands select a workflow action without changing the core safety rules.
4
+
5
+ - `/atlas`: classify and route;
6
+ - `/discover`: understand the project;
7
+ - `/plan`: prepare a proportionate plan;
8
+ - `/implement`: implement a scoped change;
9
+ - `/validate`: run observed validation;
10
+ - `/audit`: inspect and report findings;
11
+ - `/release`: prepare release readiness without publishing automatically;
12
+ - `/deploy`: prepare or execute deployment only with explicit approval.
13
+
14
+ Every write command enforces protected-branch safety and cannot report success after failed required validation.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Ask Atlas to classify, route, and coordinate a software request.
3
+ agent: atlas
4
+ ---
5
+
6
+ # Atlas
7
+
8
+ Classify the request, choose a proportionate mode and domain profile, enforce branch safety, delegate only when useful, require observed validation, and return a concise delivery summary.
9
+
10
+ Never write on a protected branch. Never promote failed or unavailable required validation to success.
11
+
12
+ Policies: `01-BRANCH_GATE.md`, `03-QUALITY_GATE.md`, `05-AGENT_CONTRACT.md`, `06-FINAL_EVIDENCE_CONTRACT.md`.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: audit
3
+ description: Audit real project files and report prioritized findings.
4
+ ---
5
+
6
+ # /audit
7
+
8
+ Inspect the requested scope, cite file evidence, separate confirmed issues from hypotheses, and do not change files unless explicitly authorized. Validation claims must be observed, not inferred.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: deploy
3
+ description: Prepare or perform a deployment only with explicit approval.
4
+ ---
5
+
6
+ # /deploy
7
+
8
+ Verify branch, release readiness, validation, target, rollback path, and approval. Never deploy from failed validation or create release actions beyond the user request.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
11
+
12
+ Policies: `01-BRANCH_GATE.md`, `06-FINAL_EVIDENCE_CONTRACT.md`, `07-RELEASE_GATE.md`.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: discover
3
+ description: Discover project context and clarify the safest next step.
4
+ ---
5
+
6
+ # /discover
7
+
8
+ Inspect only relevant files, identify architecture and constraints, record uncertainties, and avoid implementation. Return concise context and recommended next action.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Implement a scoped change using a proportionate workflow and observed validation.
3
+ agent: atlas
4
+ ---
5
+
6
+ # Implement
7
+
8
+ ## Task
9
+
10
+ Implement the requested scoped change.
11
+
12
+ ## Required behavior
13
+
14
+ 1. Verify branch and dirty state before editing.
15
+ 2. Never write on `main` or `master`; create a scoped branch when safe, otherwise stop `BLOCKED`.
16
+ 3. Select quick, standard, or full proportionately.
17
+ 4. Delegate only when specialization or independent review materially helps.
18
+ 5. Apply the minimum diff and preserve unrelated behavior.
19
+ 6. For new or changed executable behavior, add and run a proportional automated behavioral test; build/manual checks do not replace it.
20
+ 7. After the final implementation changes, run `npx ai-workflow collect-evidence --mode=<quick|standard> --task=<short-task-slug>`.
21
+ 8. Treat the finalizer exit code and public status as authoritative; never report success when it returns `BLOCKED` or fails.
22
+ 9. Use bounded remediation for recoverable findings.
23
+
24
+ ## Output
25
+
26
+ Return status, branch, changes, validation commands/results, and known limitations. Do not create workflow artefacts solely to satisfy this command.
27
+
28
+ Policies: `01-BRANCH_GATE.md`, `03-QUALITY_GATE.md`, `06-FINAL_EVIDENCE_CONTRACT.md`, `PROCEDURE_UI_CHECKLIST.md`.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: optimize-tokens
3
+ description: Reduce workflow context without weakening safety.
4
+ ---
5
+
6
+ # /optimize-tokens
7
+
8
+ Remove duplicated prose and unnecessary artefacts. Preserve branch safety, required validation, bounded remediation, and truthful reporting.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: plan
3
+ description: Create a proportionate implementation plan.
4
+ ---
5
+
6
+ # /plan
7
+
8
+ Define scope, risks, steps, validation, and stop conditions. Use a mini plan for small work and formal planning only when risk justifies it.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: release
3
+ description: Prepare release readiness without publishing automatically.
4
+ ---
5
+
6
+ # /release
7
+
8
+ Require clean branch state, successful required validation, safe package checks, changelog/version consistency, and explicit approval before tag, publish, or release.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
11
+
12
+ Policies: `01-BRANCH_GATE.md`, `06-FINAL_EVIDENCE_CONTRACT.md`, `07-RELEASE_GATE.md`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Run the safest proportionate workflow for an approved task.
3
+ agent: atlas
4
+ ---
5
+
6
+ # Run
7
+
8
+ ## Task
9
+
10
+ Route and execute the approved task using the lowest safe workflow mode.
11
+
12
+ ## Required behavior
13
+
14
+ - enforce protected-branch safety before writes;
15
+ - use project context and the closest domain profile;
16
+ - delegate proportionately, not ceremonially;
17
+ - run relevant validation from the project;
18
+ - block false success when validation fails or is unavailable;
19
+ - use bounded remediation and stop on no progress;
20
+ - persist evidence only for full, release, audit, security, or explicitly requested work.
21
+
22
+ ## Output
23
+
24
+ Return a concise delivery summary: status, branch, changed areas, observed validation, limitations, and next action when needed.
25
+
26
+ Policies: `01-BRANCH_GATE.md`, `03-QUALITY_GATE.md`, `05-AGENT_CONTRACT.md`, `06-FINAL_EVIDENCE_CONTRACT.md`.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: spec-create
3
+ description: Create a specification proportionate to scope.
4
+ ---
5
+
6
+ # /spec-create
7
+
8
+ Capture objective, scope, constraints, acceptance criteria, risks, and validation. Avoid ceremony for small work.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: spec-implement
3
+ description: Implement an approved specification safely.
4
+ ---
5
+
6
+ # /spec-implement
7
+
8
+ Enforce branch safety, implement incrementally, run relevant validation, remediate bounded findings, and return concise evidence.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: spec-review
3
+ description: Review specification readiness.
4
+ ---
5
+
6
+ # /spec-review
7
+
8
+ Find ambiguity, missing acceptance criteria, unsafe assumptions, scope creep, and validation gaps. Do not rewrite the spec unless requested.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: update-memory
3
+ description: Persist durable project memory.
4
+ ---
5
+
6
+ # /update-memory
7
+
8
+ Store only stable decisions, constraints, current state, and next approved step. Do not store temporary logs or duplicate delivery reports.
9
+
10
+ Core rules: never write on protected branches, never skip relevant validation, never report false success.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Validate the current scoped work using observed commands and objective findings.
3
+ agent: sage
4
+ ---
5
+
6
+ # Validate
7
+
8
+ Inspect the actual diff and run relevant tests, build, typecheck, lint, and domain checks. Do not approve based only on reports or checklists. A failed required command is blocking until resolved or safely accepted by the user.
9
+
10
+ Return commands/results, findings with evidence, limitations, and one status: `COMPLETED`, `COMPLETED_WITH_NOTES`, or `BLOCKED`.
11
+
12
+ Policies: `03-QUALITY_GATE.md`, `06-FINAL_EVIDENCE_CONTRACT.md`, `PROCEDURE_UI_CHECKLIST.md`.
@@ -0,0 +1,21 @@
1
+ # AI Workflow Kit v2 Documentation Index
2
+
3
+ This directory is installed under `.ai-workflow/docs/` in consumer projects.
4
+
5
+ ## Start here
6
+
7
+ - `../QUICKSTART.md` — generated consumer onboarding.
8
+ - `compatibility/runtime-matrix.md` — runtime support levels.
9
+ - `compatibility/provider-usage.md` — provider-specific usage and limitations.
10
+ - `troubleshooting-guide.md` — operational troubleshooting.
11
+ - `cli-reference.md` — CLI commands and flags.
12
+
13
+ ## Runtime contracts
14
+
15
+ - `policies/01-BRANCH_GATE.md`
16
+ - `policies/03-QUALITY_GATE.md`
17
+ - `policies/06-FINAL_EVIDENCE_CONTRACT.md`
18
+ - `policies/11-EXECUTABLE_DELEGATION_AND_TRUTHFULNESS.md`
19
+ - `specs/runtime-operational-contract.md`
20
+
21
+ These are packaged runtime documents. Repository maintainers edit their sources under `dist-assets/**`; consumers use the installed `.ai-workflow/**` paths.
@@ -0,0 +1,23 @@
1
+ # AI Workflow Kit quickstart
2
+
3
+ Give Atlas a natural software request. Atlas chooses the lowest safe mode and the closest workflow profile.
4
+
5
+ ## Modes
6
+
7
+ | Mode | Use | Required evidence |
8
+ |---|---|---|
9
+ | quick | small, reversible change | branch, changed files, targeted validation |
10
+ | standard | normal scoped feature | branch, changed areas, relevant commands/results, limitations |
11
+ | full | risky, broad, release, migration, security, or explicit audit | persisted machine-generated evidence and independent validation |
12
+
13
+ ## Safety
14
+
15
+ Write-capable work never runs on `main` or `master`. Existing relevant tests/build/typecheck/lint scripts are executed. Failed or unavailable required validation results in `BLOCKED`.
16
+
17
+ ## Final states
18
+
19
+ - `COMPLETED`
20
+ - `COMPLETED_WITH_NOTES`
21
+ - `BLOCKED`
22
+
23
+ Workflow documents are optional unless they provide lasting value or full mode requires them.
@@ -0,0 +1,19 @@
1
+ # ADR-0000: Primary agent routing protocol
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Context
8
+
9
+ The workspace uses six Primary Agents: Atlas, Nexus, Orion, Astra, Sage, and Phoenix. A clear routing and execution protocol prevents work from stopping at handoff messages and ensures delivery proceeds through documentation, tests, validation, and evidence.
10
+
11
+ ## Decision
12
+
13
+ Adopt a professional runtime taxonomy and require execution requests to continue to the correct owner/command when the runtime can act.
14
+
15
+ ## Consequences
16
+
17
+ - Routing is not completion.
18
+ - Branch Gate uses Auto-Recovery when safe.
19
+ - Implementation requires documentation, tests where feasible, validation, and evidence.
@@ -0,0 +1,45 @@
1
+ # ADR-0001: Isolated Branch Gate
2
+
3
+ - **Status**: Accepted
4
+ - **Date**: YYYY-MM-DD
5
+ - **Author**: José Willams
6
+
7
+ ## Context
8
+
9
+ Direct commits to `main` or `master` risk bypassing validation gates and introducing unvalidated changes. In a multi-agent workflow where agents (Astra, Phoenix) operate autonomously, there is no human reviewer at every step to catch a misdirected commit.
10
+
11
+ The project needed a programmatic guard that prevents write operations on protected branches unless explicitly overridden with a justified reason.
12
+
13
+ ## Decision
14
+
15
+ Implement an **Isolated Branch Gate** (`BranchGate` class) that:
16
+
17
+ 1. Reads the current branch via `git rev-parse --abbrev-ref HEAD`.
18
+ 2. Checks against a configurable list of protected branches (default: `["main", "master"]`).
19
+ 3. Blocks the operation with a clear reason if the branch is protected.
20
+ 4. Allows bypass only with `AI_OVERRIDE` environment variable containing a justification ≥20 characters.
21
+ 5. Logs all blocked attempts and authorized overrides to `GATE_ALERTS.log` in the memory directory.
22
+
23
+ The gate is evaluated before any write operation in the `runMasterOrchestrator` pipeline. If blocked, the process exits with code 1 before any spec reading, implementation, or evidence collection occurs.
24
+
25
+ ## Consequences
26
+
27
+ **Positive**:
28
+ - Prevents accidental commits to main from automated agents.
29
+ - Provides an audit trail of gate actions via `GATE_ALERTS.log`.
30
+ - Override mechanism preserves flexibility for emergency fixes.
31
+ - Early exit avoids wasting resources on a blocked pipeline.
32
+
33
+ **Negative**:
34
+ - Override justification requirement adds friction for legitimate main edits.
35
+ - Git must be available in the execution environment.
36
+
37
+ ## Compliance
38
+
39
+ - `src/core/gates/branch-gate.js` implements the gate logic.
40
+ - `src/commands/run.js` calls `BranchGate.check()` as the first step in the master orchestrator.
41
+ - All agent definitions reference the branch gate rule.
42
+
43
+ ## Notes
44
+
45
+ The 20-character minimum for overrides was chosen to force meaningful justifications while remaining short enough to type inline. The gate file is stored in `.ai-workflow/` to keep it within the managed workspace boundary.
@@ -0,0 +1,62 @@
1
+ # ADR-0002: Three-Layer Validation Pipeline
2
+
3
+ - **Status**: Accepted
4
+ - **Date**: YYYY-MM-DD
5
+ - **Author**: José Willams
6
+
7
+ ## Context
8
+
9
+ The project needed a validation system that provides comprehensive quality assurance across multiple dimensions. A single validation script would not cover the diverse validation concerns: JSON schema conformance, cross-reference integrity, documentation consistency, artifact safety, policy compliance, and privacy gates.
10
+
11
+ The `package.json` scripts section already defined individual validators, but there was no unified pipeline to run them all in sequence with a clear pass/fail summary.
12
+
13
+ ## Decision
14
+
15
+ Adopt a **Three-Layer Validation Pipeline** enforced via `npm run validate`:
16
+
17
+ ### Layer 1: Lint
18
+ Structural and formatting checks:
19
+ - JSON validation (`validate:json`)
20
+ - Repository structure validation (`validate:structure`)
21
+ - Skill validation (`validate:skills`)
22
+
23
+ ### Layer 2: Type / Reference Integrity
24
+ Cross-cutting consistency checks:
25
+ - Cross-reference validation (`validate:refs`)
26
+ - External link validation (`validate:links`)
27
+ - Documentation consistency (`validate:docs-consistency`)
28
+ - Canonical policy reference validation (`validate:policy-refs`)
29
+
30
+ ### Layer 3: Evidence
31
+ Safety, privacy, and quality gates:
32
+ - Artifact safety validation (`validate:artifact-safety`)
33
+ - Workflow state validation (`validate:workflow`)
34
+ - Schema validation (`validate:schemas`)
35
+ - Privacy publication gate (`validate:privacy-gate`)
36
+ - UI evidence gate (`validate:ui-evidence`)
37
+ - Delegation validation (`validate:delegation`)
38
+
39
+ The pipeline (`internal/validate/validate-all.mjs`) iterates through 14 checks sequentially. All checks must pass for the pipeline to succeed. The first failure does not abort — all checks run and a summary is printed at the end.
40
+
41
+ ## Consequences
42
+
43
+ **Positive**:
44
+ - Comprehensive coverage: 14 distinct validation checks.
45
+ - Any single validator can be run independently via `npm run validate:<name>`.
46
+ - Failures are collected and reported in aggregate, giving the full picture.
47
+ - Markdown linting via `lint:md` provides an additional optional layer.
48
+
49
+ **Negative**:
50
+ - 14 sequential checks can take longer to complete.
51
+ - New validators must be registered in both `package.json` and `validate-all.mjs`.
52
+
53
+ ## Compliance
54
+
55
+ - `internal/validate/validate-all.mjs` orchestrates all 14 checks.
56
+ - Each check maps to a `npm run validate:<name>` script.
57
+ - The pipeline is invoked before every push and PR submission.
58
+ - `EVIDENCE.json` records the results of these validation runs.
59
+
60
+ ## Notes
61
+
62
+ Markdown linting (`lint:md`) is intentionally kept as a separate script rather than included in the validate pipeline, because some valid Markdown patterns may trigger linter rules. It should be run during development but not as a hard gate.
@@ -0,0 +1,60 @@
1
+ # ADR-0003: Spec-Driven Development (SDD)
2
+
3
+ - **Status**: Accepted
4
+ - **Date**: YYYY-MM-DD
5
+ - **Author**: José Willams
6
+
7
+ ## Context
8
+
9
+ Implementation without approved specifications leads to scope creep, misaligned outcomes, and rework. In a multi-agent system where Astra (developer) implements while Sage (auditor) validates, there must be a clear contract defining what constitutes correct implementation.
10
+
11
+ The project needed a formal process ensuring that no code is written without an approved specification document.
12
+
13
+ ## Decision
14
+
15
+ Adopt **Spec-Driven Development (SDD)** as the mandatory workflow:
16
+
17
+ 1. **Proposal**: Nexus uses the `openspec-propose` skill to create a change with artifacts: `proposal.md` (what and why), `design.md` (how), `tasks.md` (implementation steps).
18
+ 2. **Specification**: A spec file is created in `specs/` with a tiered classification:
19
+ - `[DEEP]` — Complex, multi-step features
20
+ - `[STANDARD]` — Moderate changes
21
+ - `[TINY]` — Simple, low-risk changes
22
+ 3. **Approval**: The spec must include a `## Metadata` section with `Status: APPROVED`.
23
+ 4. **Validation**: `SpecValidator` (`src/core/sdd/validator.js`) enforces:
24
+ - Presence of tier identifier `[DEEP|STANDARD|TINY]`
25
+ - `## Metadata` section
26
+ - `## Acceptance Criteria` section
27
+ - `Status: APPROVED` in Metadata (not a template list)
28
+ 5. **Implementation**: `runMasterOrchestrator` requires `--spec-path` and validates the spec before proceeding.
29
+ 6. **No Spec, No Code**: The `AGENTS.md` hard constraint prohibits implementation without an approved spec.
30
+
31
+ ### OpenSpec Integration
32
+
33
+ The `openspec-propose` skill automates artifact generation:
34
+ 1. `openspec new change "<name>"` creates the change scaffold
35
+ 2. Artifacts are built in dependency order (proposal → design → tasks)
36
+ 3. When all `applyRequires` artifacts are complete, implementation is ready
37
+
38
+ ## Consequences
39
+
40
+ **Positive**:
41
+ - Clear contract between specification and implementation.
42
+ - Prevents unauthorized or misaligned code changes.
43
+ - Audit trail: each implementation is traceable to an approved spec.
44
+ - `SpecValidator` catches missing or unapproved specs early.
45
+
46
+ **Negative**:
47
+ - Adds overhead for tiny changes that could be implemented directly.
48
+ - Requires discipline to keep specs in sync with code.
49
+ - The spec approval process is manual (Status must be set to APPROVED).
50
+
51
+ ## Compliance
52
+
53
+ - `src/core/sdd/validator.js` enforces the approval gate.
54
+ - `src/commands/run.js` calls `SpecValidator.validate()` before any implementation.
55
+ - `AGENTS.md` lists "No Spec, No Code" as a hard constraint.
56
+ - Specs are stored in the `specs/` directory.
57
+
58
+ ## Notes
59
+
60
+ The tier system (`DEEP/STANDARD/TINY`) was introduced to allow proportional spec rigor. A TINY spec requires the same structure but can be shorter. The acceptance criteria section ensures that Sage has measurable outcomes to validate against.
@@ -0,0 +1,71 @@
1
+ # ADR-0004: Self-Healing Loop Architecture
2
+
3
+ - **Status**: Accepted
4
+ - **Date**: YYYY-MM-DD
5
+ - **Author**: José Willams
6
+
7
+ ## Context
8
+
9
+ In an autonomous multi-agent workflow, validation failures can occur due to transient issues, configuration drift, incomplete implementation, or environmental differences. When Sage (the Auditor) detects a failure, the pipeline should not simply abort — it should attempt recovery autonomously before escalating.
10
+
11
+ The project required a self-healing mechanism that:
12
+ - Detects failures from evidence collection
13
+ - Attempts repairs within safe limits
14
+ - Escalates only after exhausting retry attempts
15
+ - Maintains state across healing attempts
16
+
17
+ ## Decision
18
+
19
+ Implement a **Self-Healing Loop Architecture** with a maximum of 3 retry attempts:
20
+
21
+ ### Components
22
+
23
+ 1. **HealerEngine** (`src/core/healing/healer-engine.js`):
24
+ - Reads `EVIDENCE.json` to detect failures
25
+ - Manages attempt count via `.ai-workflow/healing-state.json`
26
+ - Prepares high-signal failure context for Phoenix (the Healer agent)
27
+ - Resets state after successful healing
28
+
29
+ 2. **Phoenix Agent** (The Healer):
30
+ - Receives structured failure context from HealerEngine
31
+ - Performs autonomous repair (re-runs failed commands, fixes issues)
32
+ - Reports back for re-validation
33
+
34
+ 3. **Loop Controller** (`src/commands/run.js`, Phase 2):
35
+ - Runs up to `maxHealingAttempts` (default: 3) iterations
36
+ - Each iteration: Sage collects evidence → if PASS, break → if FAIL, Phoenix repairs → increment counter → repeat
37
+ - After 3 failed attempts: `[MASTER BLOCKED] Self-Healing failed to resolve the issue.`
38
+
39
+ ### Healing Flow
40
+
41
+ ```
42
+ Sage collects evidence
43
+ ├─ PASS → proceed to Quality Shield
44
+ └─ FAIL → HealerEngine.getStatus()
45
+ ├─ shouldHeal=false AND maxAttempts reached → BLOCKED
46
+ └─ shouldHeal=true → preparePhoenixContext → Phoenix repairs → incrementAttempts → loop
47
+ ```
48
+
49
+ ## Consequences
50
+
51
+ **Positive**:
52
+ - Autonomous recovery for common transient failures.
53
+ - Stateful: knows how many attempts have been made (persisted to disk).
54
+ - Reset mechanism prevents infinite loops across sessions.
55
+ - Clear escalation path after max attempts.
56
+
57
+ **Negative**:
58
+ - Complex failure patterns may not be recoverable by Phoenix.
59
+ - Healing state persists on disk and may become stale.
60
+ - Each attempt consumes resources (tool calls, tokens, time).
61
+
62
+ ## Compliance
63
+
64
+ - `src/core/healing/healer-engine.js` implements the HealerEngine.
65
+ - `src/commands/run.js` integrates the healing loop in Phase 2.
66
+ - Healing state is stored in `.ai-workflow/healing-state.json`.
67
+ - Max attempts is configurable via `HealerEngine` constructor (default: 3).
68
+
69
+ ## Notes
70
+
71
+ The 3-attempt limit was chosen empirically: fewer attempts risk premature failure, while more attempts risk resource exhaustion without proportional benefit. The state file is stored in `.ai-workflow/` to keep it within the managed boundary and ensure cleanup on reset.
@@ -0,0 +1,22 @@
1
+ # ADR-0005: Optimize-Tokens Skill Selection
2
+
3
+ ## Status
4
+
5
+ Accepted.
6
+
7
+ ## Context
8
+
9
+ AI-assisted delivery workflows can waste tokens when agents load broad context or historical documents unnecessarily.
10
+
11
+ ## Decision
12
+
13
+ Use the `optimize-tokens` skill for token discipline and context minimization.
14
+
15
+ Agents and commands should prefer current runtime contracts, current policies, active specs, and directly relevant files over broad repository scans.
16
+
17
+ ## Consequences
18
+
19
+ - Less historical noise reaches the model.
20
+ - Agents should avoid loading obsolete planning material.
21
+ - Context selection must preserve enough evidence to validate claims.
22
+ - Token economy cannot override quality, safety, tests, documentation, or evidence requirements.