codex-genesis-harness 0.1.0 → 0.1.4

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 (328) hide show
  1. package/.codebase/API_CONTRACTS.md +12 -0
  2. package/.codebase/ARCHITECTURE.md +6 -0
  3. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -0
  4. package/.codebase/CURRENT_STATE.md +8 -0
  5. package/.codebase/DEPENDENCY_GRAPH.md +14 -0
  6. package/.codebase/DOMAIN_MODELS.md +10 -0
  7. package/.codebase/EVOLUTION_PLAN.md +35 -0
  8. package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -0
  9. package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -0
  10. package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -0
  11. package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -0
  12. package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -0
  13. package/.codebase/KNOWN_PROBLEMS.md +6 -0
  14. package/.codebase/MODULE_INDEX.md +13 -0
  15. package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -0
  16. package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -0
  17. package/.codebase/PIPELINE_FLOW.md +14 -0
  18. package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -0
  19. package/.codebase/README.md +139 -0
  20. package/.codebase/RECOVERY_POINTS.md +438 -0
  21. package/.codebase/TEST_MATRIX.md +11 -0
  22. package/.codebase/UI_ROUTES.md +4 -0
  23. package/.codebase/context/backend-summary.md +4 -0
  24. package/.codebase/context/frontend-summary.md +4 -0
  25. package/.codebase/context/pipeline-summary.md +4 -0
  26. package/.codebase/context/providers-summary.md +4 -0
  27. package/.codebase/context/render-summary.md +4 -0
  28. package/.codebase/context/tests-summary.md +4 -0
  29. package/.codex/skills/genesis-ai-provider/SKILL.md +46 -0
  30. package/.codex/skills/genesis-ai-provider/agents/openai.yaml +7 -0
  31. package/.codex/skills/genesis-ai-provider/checklists/checklist.md +9 -0
  32. package/.codex/skills/genesis-ai-provider/examples/example.md +4 -0
  33. package/.codex/skills/genesis-ai-provider/templates/provider-contract-template.md +9 -0
  34. package/.codex/skills/genesis-api-contract/SKILL.md +46 -0
  35. package/.codex/skills/genesis-api-contract/agents/openai.yaml +7 -0
  36. package/.codex/skills/genesis-api-contract/checklists/checklist.md +8 -0
  37. package/.codex/skills/genesis-api-contract/examples/example.md +4 -0
  38. package/.codex/skills/genesis-api-contract/templates/api-contract-template.md +4 -0
  39. package/.codex/skills/genesis-api-sync/SKILL.md +354 -0
  40. package/.codex/skills/genesis-api-sync/agents/openai.yaml +7 -0
  41. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -0
  42. package/.codex/skills/genesis-api-sync/examples/example.md +68 -0
  43. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -0
  44. package/.codex/skills/genesis-architecture/SKILL.md +46 -0
  45. package/.codex/skills/genesis-architecture/agents/openai.yaml +7 -0
  46. package/.codex/skills/genesis-architecture/checklists/checklist.md +8 -0
  47. package/.codex/skills/genesis-architecture/examples/example.md +4 -0
  48. package/.codex/skills/genesis-architecture/templates/architecture-decision-template.md +14 -0
  49. package/.codex/skills/genesis-codebase-map/SKILL.md +46 -0
  50. package/.codex/skills/genesis-codebase-map/agents/openai.yaml +7 -0
  51. package/.codex/skills/genesis-codebase-map/checklists/checklist.md +7 -0
  52. package/.codex/skills/genesis-codebase-map/examples/example.md +4 -0
  53. package/.codex/skills/genesis-codebase-map/templates/map-update-template.md +8 -0
  54. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -0
  55. package/.codex/skills/genesis-debug-guide/agents/openai.yaml +7 -0
  56. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -0
  57. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -0
  58. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -0
  59. package/.codex/skills/genesis-debug-guide/examples/example.md +48 -0
  60. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -0
  61. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -0
  62. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -0
  63. package/.codex/skills/genesis-design-spec/SKILL.md +46 -0
  64. package/.codex/skills/genesis-design-spec/agents/openai.yaml +7 -0
  65. package/.codex/skills/genesis-design-spec/checklists/checklist.md +7 -0
  66. package/.codex/skills/genesis-design-spec/examples/example.md +4 -0
  67. package/.codex/skills/genesis-design-spec/templates/design-spec-template.md +9 -0
  68. package/.codex/skills/genesis-docs/SKILL.md +46 -0
  69. package/.codex/skills/genesis-docs/agents/openai.yaml +7 -0
  70. package/.codex/skills/genesis-docs/checklists/checklist.md +7 -0
  71. package/.codex/skills/genesis-docs/examples/example.md +4 -0
  72. package/.codex/skills/genesis-docs/templates/docs-update-template.md +8 -0
  73. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -0
  74. package/.codex/skills/genesis-docs-automation/agents/openai.yaml +7 -0
  75. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -0
  76. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -0
  77. package/.codex/skills/genesis-docs-automation/examples/example.md +59 -0
  78. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -0
  79. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -0
  80. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -0
  81. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -0
  82. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -0
  83. package/.codex/skills/genesis-harness/SKILL.md +1418 -0
  84. package/.codex/skills/genesis-harness/agents/openai.yaml +9 -0
  85. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -0
  86. package/.codex/skills/genesis-harness/checklists/checklist.md +10 -0
  87. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -0
  88. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -0
  89. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -0
  90. package/.codex/skills/genesis-harness/examples/example.md +4 -0
  91. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -0
  92. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -0
  93. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -0
  94. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -0
  95. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-architecture-boundaries.sh +23 -23
  96. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-docs-sync.sh +24 -24
  97. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-no-debug-logs.sh +21 -21
  98. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-required-planning-files.sh +46 -46
  99. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-spec-changelog.sh +24 -24
  100. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/check-task-tracking.sh +25 -25
  101. package/.codex/skills/genesis-harness/scripts/compact-context.sh +54 -0
  102. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/create-adr.sh +74 -74
  103. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/create-bug.sh +160 -160
  104. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/create-feature.sh +217 -217
  105. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/detect-stack.sh +26 -26
  106. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/init-planning.sh +750 -719
  107. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/list-changed-files.sh +12 -12
  108. package/.codex/skills/genesis-harness/scripts/offload-log.sh +72 -0
  109. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/run-verification.sh +47 -47
  110. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +75 -0
  111. package/.codex/skills/{project-genesis-harness → genesis-harness}/scripts/update-state.sh +33 -33
  112. package/.codex/skills/genesis-harness/templates/harness-workflow-template.md +10 -0
  113. package/.codex/skills/genesis-harness-engineering/SKILL.md +159 -0
  114. package/.codex/skills/genesis-harness-engineering/agents/openai.yaml +7 -0
  115. package/.codex/skills/genesis-harness-engineering/checklists/checklist.md +48 -0
  116. package/.codex/skills/genesis-harness-engineering/examples/example.md +57 -0
  117. package/.codex/skills/genesis-harness-engineering/playbooks/harness-evolution.md +99 -0
  118. package/.codex/skills/genesis-harness-engineering/templates/harness-change-template.md +37 -0
  119. package/.codex/skills/genesis-new-design/SKILL.md +95 -0
  120. package/.codex/skills/genesis-new-design/agents/openai.yaml +4 -0
  121. package/.codex/skills/genesis-new-design/checklists/checklist.md +8 -0
  122. package/.codex/skills/genesis-new-design/examples/example.md +4 -0
  123. package/.codex/skills/genesis-new-design/templates/new-design-template.md +9 -0
  124. package/.codex/skills/genesis-observability-automation/SKILL.md +382 -0
  125. package/.codex/skills/genesis-observability-automation/agents/openai.yaml +7 -0
  126. package/.codex/skills/genesis-observability-automation/examples/example.md +86 -0
  127. package/.codex/skills/genesis-performance-profiling/SKILL.md +510 -0
  128. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +6 -0
  129. package/.codex/skills/genesis-performance-profiling/checklists/optimization-verification.md +199 -0
  130. package/.codex/skills/genesis-performance-profiling/checklists/performance-baseline.md +183 -0
  131. package/.codex/skills/genesis-performance-profiling/examples/example.md +234 -0
  132. package/.codex/skills/genesis-performance-profiling/observability/performance-tracking.md +202 -0
  133. package/.codex/skills/genesis-performance-profiling/playbooks/load-testing-orchestration.md +593 -0
  134. package/.codex/skills/genesis-performance-profiling/playbooks/profiling-playbook.md +601 -0
  135. package/.codex/skills/genesis-performance-profiling/templates/load-test-config-template.md +428 -0
  136. package/.codex/skills/genesis-performance-profiling/templates/performance-report-template.md +238 -0
  137. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +46 -0
  138. package/.codex/skills/genesis-pipeline-orchestration/agents/openai.yaml +7 -0
  139. package/.codex/skills/genesis-pipeline-orchestration/checklists/checklist.md +12 -0
  140. package/.codex/skills/genesis-pipeline-orchestration/examples/example.md +4 -0
  141. package/.codex/skills/genesis-pipeline-orchestration/templates/orchestration-template.md +12 -0
  142. package/.codex/skills/genesis-planning/SKILL.md +46 -0
  143. package/.codex/skills/genesis-planning/agents/openai.yaml +7 -0
  144. package/.codex/skills/genesis-planning/checklists/checklist.md +8 -0
  145. package/.codex/skills/genesis-planning/examples/example.md +4 -0
  146. package/.codex/skills/genesis-planning/templates/plan-template.md +11 -0
  147. package/.codex/skills/genesis-release/SKILL.md +46 -0
  148. package/.codex/skills/genesis-release/agents/openai.yaml +7 -0
  149. package/.codex/skills/genesis-release/checklists/checklist.md +8 -0
  150. package/.codex/skills/genesis-release/examples/example.md +4 -0
  151. package/.codex/skills/genesis-release/templates/release-checklist-template.md +9 -0
  152. package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -0
  153. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +7 -0
  154. package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -0
  155. package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -0
  156. package/.codex/skills/genesis-release-orchestration/examples/example.md +78 -0
  157. package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -0
  158. package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -0
  159. package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -0
  160. package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -0
  161. package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -0
  162. package/.codex/skills/genesis-research/SKILL.md +46 -0
  163. package/.codex/skills/genesis-research/agents/openai.yaml +7 -0
  164. package/.codex/skills/genesis-research/checklists/checklist.md +7 -0
  165. package/.codex/skills/genesis-research/examples/example.md +4 -0
  166. package/.codex/skills/genesis-research/templates/research-note-template.md +9 -0
  167. package/.codex/skills/genesis-research-first/SKILL.md +237 -0
  168. package/.codex/skills/genesis-research-first/agents/openai.yaml +7 -0
  169. package/.codex/skills/genesis-research-first/examples/example.md +85 -0
  170. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -0
  171. package/.codex/skills/genesis-spec-propagation/agents/openai.yaml +7 -0
  172. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -0
  173. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -0
  174. package/.codex/skills/genesis-spec-propagation/examples/example.md +63 -0
  175. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -0
  176. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -0
  177. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -0
  178. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -0
  179. package/.codex/skills/genesis-upgrade-design/SKILL.md +97 -0
  180. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +4 -0
  181. package/.codex/skills/genesis-upgrade-design/checklists/checklist.md +8 -0
  182. package/.codex/skills/genesis-upgrade-design/examples/example.md +4 -0
  183. package/.codex/skills/genesis-upgrade-design/templates/upgrade-design-template.md +9 -0
  184. package/.codex/skills/spec-impact-engine/SKILL.md +504 -0
  185. package/.codex/skills/spec-impact-engine/agents/openai.yaml +7 -0
  186. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +262 -0
  187. package/.codex/skills/spec-impact-engine/examples/example.md +98 -0
  188. package/.codex/skills/spec-impact-engine/templates/impact-report.md +248 -0
  189. package/.codex/skills/spec-impact-engine/templates/migration-guide.md +223 -0
  190. package/.codex/skills/ui-ux-test-skill/SKILL.md +46 -0
  191. package/.codex/skills/ui-ux-test-skill/agents/openai.yaml +7 -0
  192. package/.codex/skills/ui-ux-test-skill/checklists/checklist.md +8 -0
  193. package/.codex/skills/ui-ux-test-skill/examples/example.md +4 -0
  194. package/.codex/skills/ui-ux-test-skill/templates/playwright-test-template.md +4 -0
  195. package/.codex-plugin/plugin.json +13 -11
  196. package/README.EN.md +719 -0
  197. package/README.VI.md +712 -0
  198. package/README.md +318 -181
  199. package/VERSION +1 -1
  200. package/bin/genesis-harness.js +133 -79
  201. package/contracts/agents/CharacterBibleAgent/error.json +1 -0
  202. package/contracts/agents/CharacterBibleAgent/example.json +1 -0
  203. package/contracts/agents/CharacterBibleAgent/request.json +1 -0
  204. package/contracts/agents/CharacterBibleAgent/response.json +1 -0
  205. package/contracts/agents/CharacterBibleAgent/schema.json +1 -0
  206. package/contracts/agents/ImageGenerationAgent/error.json +1 -0
  207. package/contracts/agents/ImageGenerationAgent/example.json +1 -0
  208. package/contracts/agents/ImageGenerationAgent/request.json +1 -0
  209. package/contracts/agents/ImageGenerationAgent/response.json +1 -0
  210. package/contracts/agents/ImageGenerationAgent/schema.json +1 -0
  211. package/contracts/agents/PipelineOrchestrator/error.json +1 -0
  212. package/contracts/agents/PipelineOrchestrator/example.json +1 -0
  213. package/contracts/agents/PipelineOrchestrator/request.json +1 -0
  214. package/contracts/agents/PipelineOrchestrator/response.json +1 -0
  215. package/contracts/agents/PipelineOrchestrator/schema.json +1 -0
  216. package/contracts/agents/PromptGenerationAgent/error.json +1 -0
  217. package/contracts/agents/PromptGenerationAgent/example.json +1 -0
  218. package/contracts/agents/PromptGenerationAgent/request.json +1 -0
  219. package/contracts/agents/PromptGenerationAgent/response.json +1 -0
  220. package/contracts/agents/PromptGenerationAgent/schema.json +1 -0
  221. package/contracts/agents/RenderAgent/error.json +1 -0
  222. package/contracts/agents/RenderAgent/example.json +1 -0
  223. package/contracts/agents/RenderAgent/request.json +1 -0
  224. package/contracts/agents/RenderAgent/response.json +1 -0
  225. package/contracts/agents/RenderAgent/schema.json +1 -0
  226. package/contracts/agents/ScenePlanningAgent/error.json +1 -0
  227. package/contracts/agents/ScenePlanningAgent/example.json +1 -0
  228. package/contracts/agents/ScenePlanningAgent/request.json +1 -0
  229. package/contracts/agents/ScenePlanningAgent/response.json +1 -0
  230. package/contracts/agents/ScenePlanningAgent/schema.json +1 -0
  231. package/contracts/agents/ScreenplayAgent/error.json +1 -0
  232. package/contracts/agents/ScreenplayAgent/example.json +1 -0
  233. package/contracts/agents/ScreenplayAgent/request.json +1 -0
  234. package/contracts/agents/ScreenplayAgent/response.json +1 -0
  235. package/contracts/agents/ScreenplayAgent/schema.json +1 -0
  236. package/contracts/agents/StoryAnalysisAgent/error.json +1 -0
  237. package/contracts/agents/StoryAnalysisAgent/example.json +1 -0
  238. package/contracts/agents/StoryAnalysisAgent/request.json +1 -0
  239. package/contracts/agents/StoryAnalysisAgent/response.json +1 -0
  240. package/contracts/agents/StoryAnalysisAgent/schema.json +1 -0
  241. package/contracts/agents/SubtitleGenerationAgent/error.json +1 -0
  242. package/contracts/agents/SubtitleGenerationAgent/example.json +1 -0
  243. package/contracts/agents/SubtitleGenerationAgent/request.json +1 -0
  244. package/contracts/agents/SubtitleGenerationAgent/response.json +1 -0
  245. package/contracts/agents/SubtitleGenerationAgent/schema.json +1 -0
  246. package/contracts/agents/VoiceGenerationAgent/error.json +1 -0
  247. package/contracts/agents/VoiceGenerationAgent/example.json +1 -0
  248. package/contracts/agents/VoiceGenerationAgent/request.json +1 -0
  249. package/contracts/agents/VoiceGenerationAgent/response.json +1 -0
  250. package/contracts/agents/VoiceGenerationAgent/schema.json +1 -0
  251. package/contracts/api/README.md +4 -0
  252. package/contracts/api/endpoint-template/error.json +7 -0
  253. package/contracts/api/endpoint-template/example.json +11 -0
  254. package/contracts/api/endpoint-template/request.json +7 -0
  255. package/contracts/api/endpoint-template/response.json +6 -0
  256. package/contracts/api/endpoint-template/schema.json +9 -0
  257. package/contracts/events/README.md +4 -0
  258. package/contracts/events/event-template/error.json +4 -0
  259. package/contracts/events/event-template/example.json +6 -0
  260. package/contracts/events/event-template/request.json +6 -0
  261. package/contracts/events/event-template/response.json +3 -0
  262. package/contracts/events/event-template/schema.json +8 -0
  263. package/contracts/ui/README.md +4 -0
  264. package/contracts/ui/screen-template/error.json +4 -0
  265. package/contracts/ui/screen-template/example.json +7 -0
  266. package/contracts/ui/screen-template/request.json +4 -0
  267. package/contracts/ui/screen-template/response.json +4 -0
  268. package/contracts/ui/screen-template/schema.json +8 -0
  269. package/fixtures/agents/agent-fixture-template.md +14 -0
  270. package/fixtures/api/api-fixture-template.md +14 -0
  271. package/fixtures/images/image-fixture-template.md +14 -0
  272. package/fixtures/pipeline/pipeline-fixture-template.md +14 -0
  273. package/fixtures/render/render-fixture-template.md +14 -0
  274. package/fixtures/tts/tts-fixture-template.md +14 -0
  275. package/fixtures/videos/video-fixture-template.md +14 -0
  276. package/observability/agent-runs/agent-run-template.md +22 -0
  277. package/observability/decision-logs/decision-log-template.md +18 -0
  278. package/observability/failures/failure-template.md +18 -0
  279. package/package.json +8 -2
  280. package/playwright/e2e/e2e-template.md +4 -0
  281. package/playwright/fixtures/ui-fixture-template.md +4 -0
  282. package/playwright/smoke/smoke-template.md +4 -0
  283. package/playwright/visual/visual-regression-template.md +4 -0
  284. package/scripts/README.md +342 -0
  285. package/scripts/compact-context.sh +54 -0
  286. package/scripts/detect-changes.sh +152 -0
  287. package/scripts/install.sh +103 -69
  288. package/scripts/offload-log.sh +72 -0
  289. package/scripts/run-evals.sh +118 -52
  290. package/scripts/run-verify-loop.sh +75 -0
  291. package/scripts/uninstall.sh +81 -52
  292. package/scripts/verify.sh +380 -109
  293. package/tests/contracts/contract-template.test.md +10 -0
  294. package/tests/fixtures/fixture-index.md +4 -0
  295. package/tests/integration/integration-template.test.md +4 -0
  296. package/tests/unit/unit-template.test.md +4 -0
  297. package/.codex/skills/project-genesis-harness/SKILL.md +0 -727
  298. package/.codex/skills/project-genesis-harness/agents/openai.yaml +0 -9
  299. /package/.codex/skills/{project-genesis-harness → genesis-harness}/references/planning-schema.md +0 -0
  300. /package/.codex/skills/{project-genesis-harness → genesis-harness}/references/quality-rubric.md +0 -0
  301. /package/.codex/skills/{project-genesis-harness → genesis-harness}/references/research-rubric.md +0 -0
  302. /package/.codex/skills/{project-genesis-harness → genesis-harness}/references/workflows.md +0 -0
  303. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/agents-template.md +0 -0
  304. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/api-docs-template.md +0 -0
  305. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/architecture-template.md +0 -0
  306. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/audit-template.md +0 -0
  307. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/bug-template.md +0 -0
  308. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/check-template.md +0 -0
  309. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/conventions-template.md +0 -0
  310. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/decision-template.md +0 -0
  311. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/design-template.md +0 -0
  312. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/escalation-template.md +0 -0
  313. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/feature-template.md +0 -0
  314. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/integrations-template.md +0 -0
  315. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/journeys-template.md +0 -0
  316. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/lessons-learned-template.md +0 -0
  317. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/observability-template.md +0 -0
  318. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/phase-template.md +0 -0
  319. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/pitfalls-template.md +0 -0
  320. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/planning-tree-template.md +0 -0
  321. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/project-template.md +0 -0
  322. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/quality-score-template.md +0 -0
  323. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/requirements-template.md +0 -0
  324. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/research-template.md +0 -0
  325. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/review-template.md +0 -0
  326. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/spec-changelog-template.md +0 -0
  327. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/stack-template.md +0 -0
  328. /package/.codex/skills/{project-genesis-harness → genesis-harness}/resources/verification-template.md +0 -0
@@ -0,0 +1,1418 @@
1
+ ---
2
+ name: genesis-harness
3
+ description: Initialize and operate a project planning harness for Codex. Use this skill when the user types /init, asks to create a new project, add a feature, fix a bug, plan work, generate tests first, update docs, track phases, review changes, audit a repository, or manage architecture decisions.
4
+ ---
5
+
6
+ # Project Genesis Harness
7
+
8
+ This skill turns Codex into a project operating harness.
9
+
10
+ Codex must not behave like a simple code generator. Codex must behave like a disciplined engineering agent that understands the project before coding, confirms missing product intent, researches the repository and best practices, plans before implementation, defines tests or verification first, keeps docs synchronized with code, tracks tasks explicitly, records bug lessons, maintains architecture diagrams, reviews changed files after implementation, removes unnecessary changes, and escalates when human judgment is required.
11
+
12
+ ## Purpose
13
+ Operate a repository through test-first, contract-first, memory-aware Codex workflows.
14
+
15
+ ## When to use
16
+ Use for project initialization, planning, feature work, bug fixes, audits, reviews, verification, and repository memory updates.
17
+
18
+ ## When NOT to use
19
+ Do not use for simple read-only answers that do not require repository workflow or durable artifacts.
20
+
21
+ ## Inputs required
22
+ Read `.codebase/CURRENT_STATE.md`, `.codebase/MODULE_INDEX.md`, and `.codebase/TEST_MATRIX.md` when present, then inspect only relevant files.
23
+
24
+ ## Outputs required
25
+ Plan or implementation artifact, tests, fixtures, verification evidence, docs sync, and codebase memory updates.
26
+
27
+ ## Required tests
28
+ Create or update failing tests before implementation.
29
+
30
+ ## Required fixtures
31
+ Create fixtures for expected inputs, outputs, validation notes, and recovery cases.
32
+
33
+ ## Required contract updates
34
+ Update API, agent, event, or UI contracts when public behavior changes.
35
+
36
+ ## Required codebase map updates
37
+ Update `.codebase` memory after meaningful changes.
38
+
39
+ ## Token saving rules
40
+ Read summaries before source files, maps before modules, and avoid loading the entire repository.
41
+
42
+ ## Acceptance criteria
43
+ Work is complete only when tests pass, contracts and docs are current, and verification evidence is reported.
44
+
45
+ ## Common mistakes
46
+ Implementing before tests, skipping fixtures, overloading `AGENTS.md`, and duplicating long context across skills.
47
+
48
+ ## Recovery workflow
49
+ If blocked or interrupted, reread current state, rerun verification, identify the first failing phase, and resume from that point.
50
+
51
+ ## Core Principle
52
+
53
+ Do not code first.
54
+
55
+ Correct order:
56
+
57
+ ```txt
58
+ Confirm intent
59
+ -> Inspect repository
60
+ -> Initialize planning
61
+ -> Research
62
+ -> Decide
63
+ -> Diagram
64
+ -> Plan
65
+ -> Test contract
66
+ -> Implement
67
+ -> Verify
68
+ -> Review
69
+ -> Sync docs
70
+ -> Track completion
71
+ -> Report
72
+ ```
73
+
74
+ Never skip confirmation when intent is unclear, research, planning, test or verification, docs synchronization, task tracking, or review.
75
+
76
+ ## Supported Commands
77
+
78
+ Support these user intents:
79
+
80
+ ```txt
81
+ /init
82
+ /new-feature <description>
83
+ /fix-bug <description>
84
+ /plan <description>
85
+ /audit
86
+ /review
87
+ /status
88
+ /spec-change <file> [NEW]
89
+ /propagate-spec [NEW]
90
+ /validate-specs [NEW]
91
+ ```
92
+
93
+ If the user does not type an exact command but clearly asks for one of these workflows, infer the correct workflow.
94
+
95
+ ## NEW: Spec Impact & Propagation Commands
96
+
97
+ These commands enable automatic cascade prevention:
98
+
99
+ ### `/spec-change <file>` - Detect & Analyze Spec Changes
100
+
101
+ ```bash
102
+ /spec-change .planning/API_DOCS.md
103
+
104
+ What it does:
105
+ 1. Detects what changed in the file
106
+ 2. Identifies breaking changes vs feature additions
107
+ 3. Finds all downstream phases that depend on the change
108
+ 4. Calculates impact severity (high/medium/low)
109
+ 5. Generates impact report with recommendations
110
+ 6. Offers to auto-update all affected phases
111
+ ```
112
+
113
+ ### `/propagate-spec` - Auto-Update Downstream Phases
114
+
115
+ ```bash
116
+ /propagate-spec
117
+
118
+ What it does:
119
+ 1. Checks SPEC_CHANGELOG.md for unpropagated changes
120
+ 2. Queries PHASE_DEPENDENCY_MAP for affected phases
121
+ 3. AUTO-UPDATES all dependent phase specs
122
+ 4. AUTO-UPDATES all affected phase tests
123
+ 5. Runs validation tests in all phases
124
+ 6. Generates migration guides for breaking changes
125
+ 7. Updates ROADMAP.md if timeline affected
126
+ 8. Creates comprehensive impact report
127
+ ```
128
+
129
+ ### `/validate-specs` - Check All Phases Aligned
130
+
131
+ ```bash
132
+ /validate-specs
133
+
134
+ What it does:
135
+ 1. Validates all phases against their dependencies
136
+ 2. Detects spec drift (phase using stale upstream specs)
137
+ 3. Identifies breaking changes not yet propagated
138
+ 4. Lists any alignment issues
139
+ 5. Suggests fixes
140
+ 6. Blocks start of phase if upstream specs incomplete
141
+ ```
142
+
143
+ ## Resource And Script Map
144
+
145
+ Bundled resources live under `resources/`. Use them as starting content when creating `.planning/` files:
146
+
147
+ - `planning-tree-template.md`: required `.planning/` tree.
148
+ - `agents-template.md`: concise root `AGENTS.md`.
149
+ - `project-template.md` through `check-template.md`: starter content for project, phase, feature, bug, ADR, research, review, verification, audit, and check files.
150
+ - `post-implementation-guide.md`: Auto-update workflow after successful implementation. Guides doc synchronization, state tracking, and continuity.
151
+ - `requirements-validation.md`: Final validation checklist before implementation to ensure all requirements are clear and complete.
152
+
153
+ Bundled checklists live under `checklists/`. Use these as structured Q&A before planning:
154
+
155
+ - **MANDATORY**: `new-feature-qa.md`: Comprehensive Q&A for new features. Complete before `/new-feature` planning.
156
+ - **MANDATORY**: `bug-fix-qa.md`: Comprehensive Q&A for bug fixes. Complete before `/fix-bug` planning.
157
+ - **MANDATORY**: `refactor-qa.md`: Comprehensive Q&A for refactors. Complete before refactor planning.
158
+ - **MANDATORY**: `requirements-validation.md`: Final validation checklist. Use after Q&A, before contracts and tests.
159
+ - `checklist.md`: General Genesis Harness workflow checklist.
160
+
161
+ Bundled skills live under `skills/`. These are specialized automation tools:
162
+
163
+ - **NEW**: `spec-impact-engine/SKILL.md`: Automatically detect when specs change and update all downstream phases. Prevents cascading rework.
164
+ - `api-sync-skill/SKILL.md`: Auto-sync API contracts with implementation after changes.
165
+ - `docs-skill/SKILL.md`: Auto-update documentation after implementation.
166
+
167
+ Bundled references live under `references/`. Load them only when needed:
168
+
169
+ - `references/workflows.md`: command routing, readiness gate, and completion gate.
170
+ - `references/planning-schema.md`: detailed `.planning/` file meanings and required subtrees.
171
+ - `references/research-rubric.md`: local/external evidence format for research.
172
+ - `references/quality-rubric.md`: scoring rubric for `QUALITY_SCORE.md`.
173
+
174
+ Bundled scripts live under `scripts/`. Prefer copying or adapting these into `.planning/scripts/` or project scripts during `/init`:
175
+
176
+ - `init-planning.sh`: creates `AGENTS.md` and the `.planning/` tree.
177
+ - `create-feature.sh`: scaffolds `.planning/features/NNN-feature-slug/`.
178
+ - `create-bug.sh`: scaffolds `.planning/bugs/NNN-bug-slug/`.
179
+ - `create-adr.sh`: scaffolds `.planning/decisions/ADR-NNN-slug.md`.
180
+ - `update-state.sh`: updates common fields in `.planning/STATE.md`.
181
+ - `offload-log.sh`: captures and trims large command outputs to protect the context window.
182
+ - `compact-context.sh`: intelligent context compaction summarizing state to disk.
183
+ - `run-verify-loop.sh`: state-tracked Ralph Loop verify-fix loop executor.
184
+ - `detect-stack.sh`: inspects repository stack clues.
185
+ - `list-changed-files.sh`: lists git changes when git is available.
186
+ - `run-verification.sh`: runs detected lint/typecheck/test/build checks.
187
+ - `detect-changes.sh`: Auto-detect file changes and identify what `.codebase` docs need updating.
188
+ - `check-docs-sync.sh`, `check-task-tracking.sh`, `check-no-debug-logs.sh`, `check-spec-changelog.sh`, `check-required-planning-files.sh`, `check-architecture-boundaries.sh`: mechanical harness checks.
189
+ - **NEW**: `spec-impact-engine/detect-spec-changes.sh`: Auto-detect spec changes and generate impact report.
190
+
191
+ ## `/init` Workflow
192
+
193
+ When the user types `/init`, initialize the project planning harness. Before creating files, inspect the current repository.
194
+
195
+ **Important**: Do not create feature-specific phases. Create only a Foundation phase (Phase 0) as a planning framework. Feature phases are created only after requirements are confirmed and roadmap is finalized.
196
+
197
+ Look for:
198
+
199
+ - `README.md`
200
+ - `AGENTS.md`
201
+ - `package.json`
202
+ - `composer.json`
203
+ - `pyproject.toml`
204
+ - `requirements.txt`
205
+ - `Cargo.toml`
206
+ - `go.mod`
207
+ - `*.csproj` or `*.sln`
208
+ - `Dockerfile`
209
+ - `docker-compose.yml`
210
+ - `src/` or `app/`
211
+ - existing docs
212
+ - existing tests
213
+ - existing API routes
214
+ - existing database schema
215
+ - existing architecture clues
216
+
217
+ ### Confirmation Rule
218
+
219
+ If there is enough information to infer the product idea, summarize the detected project brief and ask for confirmation:
220
+
221
+ ```md
222
+ ## Detected Project Brief
223
+
224
+ Product:
225
+ Target users:
226
+ Core features:
227
+ Tech stack:
228
+ Integrations:
229
+ First milestone:
230
+ Out of scope:
231
+ Assumptions:
232
+
233
+ Please confirm before I initialize `.planning/`.
234
+
235
+ Note: I will create a Foundation phase (Phase 0) for documentation
236
+ only. Feature phases will be created later when requirements are finalized.
237
+ ```
238
+
239
+ If the app idea is missing or ambiguous, stop and ask:
240
+
241
+ 1. What application are we building?
242
+ 2. Who are the target users?
243
+ 3. What are the core features?
244
+ 4. What tech stack do you prefer?
245
+ 5. What integrations are required?
246
+ 6. What is explicitly out of scope?
247
+ 7. What is the first milestone?
248
+ 8. Are there any design, architecture, security, or deployment constraints?
249
+
250
+ Do not create implementation code until the project idea is confirmed.
251
+
252
+ After confirmation, create root `AGENTS.md`, the `.planning/` structure, initial planning files, base Mermaid diagrams, a Foundation phase (Phase 0) as planning framework only, initial checks, the initial quality score, and the phase dependency map. Use `scripts/init-planning.sh` when it fits the repository.
253
+
254
+ **Foundation Phase (Phase 0)**: This is a setup phase only, not a feature phase. It contains:
255
+ - Tasks to complete project documentation
256
+ - No feature implementation tasks
257
+ - Placeholder roadmap with no feature phases yet
258
+
259
+ **Phase Dependency Map**: Created as `.codebase/PHASE_DEPENDENCY_MAP.md`, this is:
260
+ - Mapping of which phases provide what
261
+ - Which phases depend on which other phases
262
+ - Impact calculation rules for spec changes
263
+ - Timeline sensitivity analysis
264
+ - Used by spec-impact-engine for auto-updates
265
+
266
+ Feature phases must not be created until requirements are finalized and prioritized. Each feature gets its own numbered phase folder when work begins.
267
+
268
+ `scripts/init-planning.sh` must only be run after confirmation, using `--confirmed` or `PROJECT_BRIEF_CONFIRMED=1`. Do not bypass this guard unless the user explicitly asks to create a blank harness with unknown product details.
269
+
270
+ ## Root `AGENTS.md`
271
+
272
+ Create a short root-level `AGENTS.md`. It is a table of contents for Codex, not a giant instruction dump. It must point Codex to the real project knowledge in `.planning/`.
273
+
274
+ Minimum contents:
275
+
276
+ ```md
277
+ # AGENTS.md
278
+
279
+ This repository uses the Project Genesis Harness.
280
+
281
+ Before doing feature work, bug fixes, refactors, or architecture changes, read:
282
+
283
+ 1. `.planning/SUMMARY.md`
284
+ 2. `.planning/STATE.md`
285
+ 3. `.planning/PROJECT.md`
286
+ 4. `.planning/REQUIREMENTS.md`
287
+ 5. `.planning/STACK.md`
288
+ 6. `.planning/ARCHITECTURE.md`
289
+ 7. `.planning/CONVENTIONS.md`
290
+ 8. `.planning/PITFALLS.md`
291
+ 9. `.planning/LESSONS_LEARNED.md`
292
+
293
+ For new features, create a folder under `.planning/features/`.
294
+ For bug fixes, create a folder under `.planning/bugs/`.
295
+ For major decisions, create an ADR under `.planning/decisions/`.
296
+
297
+ Do not claim completion unless verification passed, docs were synchronized, task tracking was updated, and changed files were reviewed.
298
+ ```
299
+
300
+ Keep `AGENTS.md` concise.
301
+
302
+ ## Required `.planning/` Architecture
303
+
304
+ Create the full tree described in `resources/planning-tree-template.md`, including:
305
+
306
+ - core docs: `PROJECT.md`, `REQUIREMENTS.md`, `ROADMAP.md`, `STATE.md`, `STACK.md`, `ARCHITECTURE.md`, `DESIGN.md`, `API_DOCS.md`, `INTEGRATIONS.md`, `CONVENTIONS.md`, `PITFALLS.md`, `LESSONS_LEARNED.md`, `SPEC_CHANGELOG.md`, `FEATURE_INDEX.md`, `CHANGE_IMPACT_MATRIX.md`, `QUALITY_SCORE.md`, `ESCALATION.md`, `OBSERVABILITY.md`, `SMOKE_TESTS.md`, `JOURNEYS.md`, `SUMMARY.md`, `config.json`
307
+ - diagrams: `system-context.mmd`, `container-architecture.mmd`, `database-erd.mmd`, `deployment-flow.mmd`, `roadmap-flow.mmd`
308
+ - research, decisions, phases, features, bugs, audits, checks, quick, codebase, and templates folders.
309
+
310
+ ## Meaning Of Core Files
311
+
312
+ - `PROJECT.md`: project identity, target users, value, scope, out of scope, constraints, assumptions, current milestone, success criteria.
313
+ - `REQUIREMENTS.md`: functional and non-functional requirements, user stories, acceptance criteria, edge cases, known unknowns.
314
+ - `ROADMAP.md`: milestones, phases, dependencies, status, acceptance criteria.
315
+ - `STATE.md`: current phase, active feature or bug, last completed task, next task, blockers, latest verification.
316
+ - `STACK.md`: language, framework, runtime, database, package manager, test framework, lint/typecheck tools, deployment target, versions, local commands.
317
+ - `ARCHITECTURE.md`: architecture, module boundaries, data flow, dependency direction, service boundaries, principles, forbidden patterns.
318
+ - `DESIGN.md`: UX principles, screens/pages, component conventions, state management, accessibility, constraints.
319
+ - `API_DOCS.md`: endpoints, examples, errors, auth, versioning.
320
+ - `INTEGRATIONS.md`: services, SDKs, env vars, secrets, failure handling, fallbacks, rate limits.
321
+ - `CONVENTIONS.md`: naming, folders, style, errors, logging, tests, API rules, security rules, patterns to follow and avoid.
322
+ - `PITFALLS.md`: common mistakes, risky areas, fragile dependencies, historical warnings.
323
+ - `LESSONS_LEARNED.md`: fixed bugs, root causes, failed assumptions, correct patterns, prevention rules, changed files, verification evidence.
324
+ - `SPEC_CHANGELOG.md`: every spec-affecting change with date/time, reason, impacted docs, impacted tests, migration notes.
325
+ - `FEATURE_INDEX.md`: table of features with status, phase, path, notes.
326
+ - `CHANGE_IMPACT_MATRIX.md`: mapping from change types to docs that must update.
327
+ - `QUALITY_SCORE.md`: quality areas and scores; update during `/audit`, `/review`, major features, and major bug fixes.
328
+ - `ESCALATION.md`: when Codex must stop and ask the user.
329
+ - `OBSERVABILITY.md`: logs, metrics, traces, errors, health checks, debug commands, local inspection.
330
+ - `JOURNEYS.md`: important user journeys with expected UI/API/DB/log state and verification.
331
+ - `SMOKE_TESTS.md`: minimal checks proving the app is alive.
332
+
333
+ ## Task Tracking Rule
334
+
335
+ Every phase, feature, bug, audit, and task must use checkbox tracking:
336
+
337
+ ```txt
338
+ [ ] not started
339
+ [~] in progress
340
+ [x] completed
341
+ [!] blocked
342
+ ```
343
+
344
+ When a task is started:
345
+
346
+ 1. update checkbox from `[ ]` to `[~]`
347
+ 2. update `.planning/STATE.md`
348
+
349
+ When a task is completed:
350
+
351
+ 1. update checkbox from `[~]` or `[ ]` to `[x]`
352
+ 2. update `.planning/STATE.md`
353
+ 3. update related phase `TASKS.md`
354
+ 4. update related feature or bug `TASKS.md` if applicable
355
+ 5. update `.planning/SUMMARY.md`
356
+
357
+ Never claim a task is complete unless tracking files were updated.
358
+
359
+ ## Definition Of Ready
360
+
361
+ Feature, bug, phase, audit, and architecture work is ready to implement only when:
362
+
363
+ - [x] product intent or bug report is clear enough to avoid guessing
364
+ - [x] required planning docs were read
365
+ - [x] relevant local codebase patterns were researched
366
+ - [x] best-practice research is recorded or internet unavailability is stated
367
+ - [x] impact on API, data, UI, auth, integrations, config, docs, and tests is known
368
+ - [x] test contract or verification contract exists
369
+ - [x] diagram or ADR impact is handled when architecture changes
370
+ - [x] escalation concerns were resolved or explicitly recorded
371
+
372
+ If any item is false, do not implement. Update tracking to `[!]` or ask the user.
373
+
374
+ ## Definition Of Done
375
+
376
+ Work is done only when:
377
+
378
+ - [x] implementation is complete and scoped to the plan
379
+ - [x] automated tests or documented verification passed
380
+ - [x] docs were synchronized (see Docs Sync Rule below)
381
+ - [x] task tracking moved from `[ ]` or `[~]` to `[x]`
382
+ - [x] `.planning/STATE.md` updated (current phase, active feature, next task)
383
+ - [x] `.planning/SUMMARY.md` updated (recent changes, next recommended task)
384
+ - [x] `.planning/SPEC_CHANGELOG.md` updated if behavior/API/requirements changed
385
+ - [x] `.planning/QUALITY_SCORE.md` recalculated
386
+ - [x] `.planning/FEATURE_INDEX.md` updated with feature status
387
+ - [x] changed files were reviewed
388
+ - [x] debug logs, dead code, unrelated edits, and unnecessary files were removed
389
+ - [x] risks and follow-up tasks are recorded
390
+
391
+ **Never use completion language until ALL items above are satisfied.**
392
+
393
+ If a doc doesn't need updating, explicitly explain why in the completion report.
394
+
395
+ ## Research Rule
396
+
397
+ Before planning or implementing any non-trivial task:
398
+
399
+ 1. Research the existing codebase.
400
+ 2. Identify similar patterns already present.
401
+ 3. Research best practices using official docs, Google, GitHub, or reputable sources when internet access is available.
402
+ 4. Record findings in `.planning/research/`.
403
+ 5. Mention evidence in the plan.
404
+
405
+ The plan must state what will change, where, why, the pattern or best practice supporting the change, risks, and verification commands. If internet access is unavailable, state this clearly and rely on local codebase research. Never invent external research results.
406
+
407
+ Use this evidence format in `.planning/research/`:
408
+
409
+ ```md
410
+ ## Research: <topic>
411
+
412
+ Date:
413
+ Question:
414
+
415
+ ## Local Evidence
416
+
417
+ | File / Command | Finding | Impact |
418
+ |---|---|---|
419
+ | `path/to/file` | TBD | TBD |
420
+
421
+ ## External Evidence
422
+
423
+ | Source | Date Checked | Finding | Impact |
424
+ |---|---|---|---|
425
+ | URL or official doc name | YYYY-MM-DD | TBD | TBD |
426
+
427
+ ## Decision Impact
428
+
429
+ - [ ] TBD
430
+
431
+ ## Confidence / Gaps
432
+
433
+ - [ ] TBD
434
+ ```
435
+
436
+ External findings must include a source name or URL and date checked. If browsing is unavailable, write `External Evidence: unavailable in this environment` and do not fabricate sources.
437
+
438
+ ## Mermaid Diagram Rule
439
+
440
+ Use Mermaid diagrams as architecture source of truth. Before implementation, create or update diagrams when the task affects architecture, data flow, API flow, database schema, deployment, integration, phase dependency, feature workflow, background jobs, or auth.
441
+
442
+ Required base diagrams:
443
+
444
+ ```txt
445
+ .planning/diagrams/system-context.mmd
446
+ .planning/diagrams/container-architecture.mmd
447
+ .planning/diagrams/database-erd.mmd
448
+ .planning/diagrams/deployment-flow.mmd
449
+ .planning/diagrams/roadmap-flow.mmd
450
+ ```
451
+
452
+ A feature must also have `.planning/features/NNN-feature-name/DIAGRAM.mmd`. Do not implement architecture-changing work before updating the relevant diagram.
453
+
454
+ ## `/new-feature` Workflow
455
+
456
+ **IMPORTANT**: Always use `checklists/new-feature-qa.md` BEFORE starting any feature work.
457
+
458
+ When adding a new feature:
459
+
460
+ ### Step 0: Complete Q&A Checklist (MANDATORY)
461
+
462
+ ```bash
463
+ # Before any planning, complete:
464
+ cat .codex/skills/genesis-harness/checklists/new-feature-qa.md
465
+
466
+ # Answer all questions:
467
+ - User story clearly defined?
468
+ - Success criteria measurable?
469
+ - Out of scope documented?
470
+ - Requirements clear?
471
+ - API/database/UI impacts known?
472
+ - Edge cases identified?
473
+ - Test strategy defined?
474
+ - No unknowns remaining?
475
+ ```
476
+
477
+ If ANY question is unanswered → Stop and get clarification before continuing.
478
+
479
+ ### Step 1: Requirements Validation
480
+
481
+ After Q&A is complete, validate requirements:
482
+
483
+ ```bash
484
+ # Use requirements validation checklist:
485
+ cat .codex/skills/genesis-harness/checklists/requirements-validation.md
486
+
487
+ # Verify:
488
+ - All items are specific and measurable
489
+ - Scope is bounded
490
+ - Technical feasibility confirmed
491
+ - Acceptance criteria are testable
492
+ - Stakeholder alignment obtained
493
+ ```
494
+
495
+ If ANY validation fails → Do not continue. Fix before proceeding.
496
+
497
+ ### Step 2: Confirm Definition of Ready
498
+
499
+ Then read:
500
+
501
+ ```txt
502
+ .planning/SUMMARY.md
503
+ .planning/STATE.md
504
+ .planning/PITFALLS.md
505
+ .planning/LESSONS_LEARNED.md
506
+ .planning/CONVENTIONS.md
507
+ .planning/ARCHITECTURE.md
508
+ .planning/STACK.md
509
+ ```
510
+
511
+ Verify ALL of these are TRUE:
512
+
513
+ ```
514
+ [ ] Q&A checklist completed and all questions answered
515
+ [ ] Requirements validation passed
516
+ [ ] Product intent is clear enough to avoid guessing
517
+ [ ] Required planning docs were read (7 docs above)
518
+ [ ] Relevant local codebase patterns were researched
519
+ [ ] Best-practice research is recorded or internet unavailability stated
520
+ [ ] Impact on API, database, UI, auth, integrations, config, docs, and tests is KNOWN
521
+ [ ] Test contract or verification contract will be created
522
+ [ ] Diagram or ADR impact is handled if architecture changes
523
+ [ ] Escalation concerns are resolved or explicitly recorded
524
+
525
+ If ANY checkbox is FALSE → Do not continue.
526
+ Ask user for clarification or update tracking to [!] blocked.
527
+ ```
528
+
529
+ ### Step 3: Research & Plan
530
+
531
+ Research local patterns and best practices. Create:
532
+
533
+ ```txt
534
+ .planning/features/NNN-feature-slug/
535
+ ├── SPEC.md
536
+ ├── IMPACT.md
537
+ ├── PLAN.md
538
+ ├── TEST_CONTRACT.md
539
+ ├── TASKS.md
540
+ ├── VERIFICATION.md
541
+ ├── REVIEW.md
542
+ └── DIAGRAM.mmd
543
+ ```
544
+
545
+ `SPEC.md` must include summary, user story, expected behavior, edge cases, out of scope, and acceptance criteria.
546
+
547
+ `IMPACT.md` must answer whether the feature affects API, database, UI, auth/security, integrations, environment variables, architecture, docs, tests, migrations, or existing user journeys.
548
+
549
+ `PLAN.md` must include files to create/change, why each changes, implementation steps, test strategy, docs to update, diagrams to update, risks, rollback plan, and verification commands. Each planned file change must use:
550
+
551
+ ```md
552
+ ### File: `path/to/file`
553
+
554
+ Change:
555
+ Why:
556
+ Risk:
557
+ Test:
558
+ Docs impact:
559
+ ```
560
+
561
+ `TEST_CONTRACT.md` must include normal input/output, edge cases, invalid inputs, expected errors, acceptance tests, and manual verification if automated tests are unavailable.
562
+
563
+ `TASKS.md` must include checkbox tasks for:
564
+
565
+ **Phase 1: Confirmation & Research**
566
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/new-feature-qa.md`
567
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/requirements-validation.md`
568
+ - [ ] Read required `.planning/` docs (SUMMARY, STATE, PITFALLS, LESSONS, CONVENTIONS, ARCHITECTURE, STACK)
569
+ - [ ] Verify Definition of Ready (all 10 items confirmed YES)
570
+
571
+ **Phase 2: Planning & Contracts**
572
+ - [ ] Research codebase patterns for similar features
573
+ - [ ] Research best practices (external sources or mark unavailable)
574
+ - [ ] Complete SPEC.md with full acceptance criteria
575
+ - [ ] Complete IMPACT.md answering all 11 impact questions
576
+ - [ ] Complete PLAN.md with file changes, risks, rollback
577
+ - [ ] Create TEST_CONTRACT.md with test cases
578
+ - [ ] Create DIAGRAM.mmd if architecture affected
579
+ - [ ] Identify all docs that will need updates (API_DOCS? REQUIREMENTS? DESIGN? etc.)
580
+
581
+ **Phase 3: Implementation**
582
+ - [ ] Create failing test or verification
583
+ - [ ] Implement to pass test
584
+ - [ ] Run verification - all pass?
585
+ - [ ] Review code for quality
586
+
587
+ **Phase 4: Documentation & Sync**
588
+ - [ ] Check CHANGE_IMPACT_MATRIX.md → which docs must update?
589
+ - [ ] Update REQUIREMENTS.md (if behavior/feature added)
590
+ - [ ] Update API_DOCS.md (if API endpoints changed)
591
+ - [ ] Update ARCHITECTURE.md (if structure changed)
592
+ - [ ] Update DESIGN.md (if UI/UX changed)
593
+ - [ ] Update INTEGRATIONS.md (if external services changed)
594
+ - [ ] Update CONVENTIONS.md (if new patterns established)
595
+ - [ ] Update STACK.md (if new tech added)
596
+ - [ ] Update SPEC_CHANGELOG.md with: date, reason, impacted docs, impacted tests, migration notes
597
+ - [ ] Update .planning/STATE.md (current phase, active feature, next task)
598
+ - [ ] Update .planning/SUMMARY.md (recent changes, next recommended task)
599
+ - [ ] Update .planning/FEATURE_INDEX.md (add feature status)
600
+ - [ ] Update .planning/QUALITY_SCORE.md (recalculate scores)
601
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
602
+
603
+ **Phase 5: Review & Completion**
604
+ - [ ] Review changed files (remove debug logs, dead code, unrelated changes)
605
+ - [ ] Update feature REVIEW.md with findings
606
+ - [ ] Verify cleanup pass complete
607
+ - [ ] Create `.codebase/RECOVERY_POINTS.md` entry for resumption
608
+ - [ ] Create or update `.codebase/IMPLEMENTATION_HANDOFF.md`
609
+ - [ ] Mark TASKS checklist complete [x]
610
+
611
+ Prefer `scripts/create-feature.sh` for the initial folder and file scaffold, then fill the generated files with task-specific content.
612
+
613
+ ## `/fix-bug` Workflow
614
+
615
+ **IMPORTANT**: Always use `checklists/bug-fix-qa.md` BEFORE starting any bug fix work.
616
+
617
+ Before fixing a bug, always:
618
+
619
+ ### Step 0: Complete Bug Fix Q&A (MANDATORY)
620
+
621
+ ```bash
622
+ # Complete the bug fix questionnaire:
623
+ cat .codex/skills/genesis-harness/checklists/bug-fix-qa.md
624
+
625
+ # Answer all questions:
626
+ - Bug clearly reproduced?
627
+ - Root cause identified?
628
+ - Severity assessed?
629
+ - Affected versions known?
630
+ - Impact assessed?
631
+ - Fix approach decided?
632
+ - Regression prevention plan?
633
+ - Deployment strategy known?
634
+ ```
635
+
636
+ If ANY question is unanswered → Stop and get clarification before continuing.
637
+
638
+ ### Step 1: Requirements Validation
639
+
640
+ After bug Q&A is complete:
641
+
642
+ ```bash
643
+ # Use requirements validation checklist:
644
+ cat .codex/skills/genesis-harness/checklists/requirements-validation.md
645
+
646
+ # For bugs, verify:
647
+ - Root cause is clear
648
+ - Fix approach is feasible
649
+ - Test strategy is defined
650
+ - No scope creep
651
+ - Stakeholders aligned
652
+ ```
653
+
654
+ ### Step 2: Read Context
655
+
656
+ Then read:
657
+
658
+ ```txt
659
+ .planning/PITFALLS.md
660
+ .planning/LESSONS_LEARNED.md
661
+ .planning/CONVENTIONS.md
662
+ .planning/ARCHITECTURE.md
663
+ .planning/STACK.md
664
+ ```
665
+
666
+ Then reproduce and diagnose before changing code. Create:
667
+
668
+ ```txt
669
+ .planning/bugs/NNN-bug-slug/
670
+ ├── REPORT.md
671
+ ├── ROOT_CAUSE.md
672
+ ├── PLAN.md
673
+ ├── TEST_CONTRACT.md
674
+ ├── TASKS.md
675
+ ├── VERIFICATION.md
676
+ └── REVIEW.md
677
+ ```
678
+
679
+ ### Step 3: Bug Documentation
680
+
681
+ Create `TASKS.md` with checkboxes for:
682
+
683
+ **Phase 1: Understanding**
684
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/bug-fix-qa.md`
685
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/requirements-validation.md`
686
+ - [ ] Read PITFALLS.md and LESSONS_LEARNED.md
687
+ - [ ] Reproduce bug with exact steps
688
+ - [ ] Identify root cause
689
+ - [ ] Check for similar bugs in LESSONS_LEARNED.md
690
+
691
+ **Phase 2: Planning**
692
+ - [ ] Complete REPORT.md (what is broken?)
693
+ - [ ] Complete ROOT_CAUSE.md (why is it broken?)
694
+ - [ ] Complete PLAN.md (how to fix it?)
695
+ - [ ] Create TEST_CONTRACT.md (regression test)
696
+ - [ ] Identify risk level (low/medium/high)
697
+ - [ ] Plan rollback strategy
698
+
699
+ **Phase 3: Implementation**
700
+ - [ ] Create regression test (should fail with current code)
701
+ - [ ] Fix with minimal change (don't refactor unrelated code)
702
+ - [ ] Verify regression test now passes
703
+ - [ ] Run full test suite - all pass?
704
+
705
+ **Phase 4: Documentation & Sync**
706
+ - [ ] Update LESSONS_LEARNED.md with bug finding
707
+ - [ ] Check which docs affected
708
+ - [ ] Update REQUIREMENTS.md (if behavior changed)
709
+ - [ ] Update API_DOCS.md (if API changed)
710
+ - [ ] Update .planning/STATE.md
711
+ - [ ] Update .planning/SUMMARY.md
712
+ - [ ] Update .planning/SPEC_CHANGELOG.md if needed
713
+ - [ ] Update .planning/QUALITY_SCORE.md
714
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
715
+
716
+ **Phase 5: Review & Completion**
717
+ - [ ] Review changed files (minimal change?)
718
+ - [ ] Update bug REVIEW.md
719
+ - [ ] Verify cleanup pass complete
720
+ - [ ] Create `.codebase/RECOVERY_POINTS.md` entry
721
+ - [ ] Create or update `.codebase/IMPLEMENTATION_HANDOFF.md`
722
+ - [ ] Mark TASKS checklist complete [x]
723
+
724
+ Append to `.planning/LESSONS_LEARNED.md`:
725
+
726
+ ```md
727
+ ## Bug: <name>
728
+
729
+ Date:
730
+ Root cause:
731
+ Failed assumption:
732
+ Correct pattern:
733
+ Prevention rule:
734
+ Files changed:
735
+ Verification:
736
+ ```
737
+
738
+ Never fix the same type of bug without checking `LESSONS_LEARNED.md`.
739
+
740
+ Prefer `scripts/create-bug.sh` for the initial folder and file scaffold, then fill the generated files with task-specific evidence.
741
+
742
+ ## `/api-sync` Workflow
743
+
744
+ **NEW**: After implementing API-related features or changes, use the **api-sync-skill** to automatically sync contracts with implementation.
745
+
746
+ When API code is modified, invoke:
747
+
748
+ ```bash
749
+ invoke api-sync-skill
750
+
751
+ # Parameters:
752
+ - changed_files: [list of API files modified]
753
+ - contract_file: ".codebase/API_CONTRACTS.md"
754
+ - breaking_changes: true/false
755
+ - version_bump: "major/minor/patch"
756
+ ```
757
+
758
+ This workflow:
759
+
760
+ 1. Detects API endpoint changes (new, modified, deprecated)
761
+ 2. Extracts request/response schemas from code
762
+ 3. Updates API_CONTRACTS.md with all changes
763
+ 4. Identifies breaking changes
764
+ 5. Generates test contracts
765
+ 6. Creates migration guide if needed
766
+ 7. Documents version changes
767
+
768
+ See `.codex/skills/api-sync-skill/SKILL.md` for full workflow.
769
+
770
+ **Important**: Run before committing API changes.
771
+
772
+ ## `/spec-change` Workflow
773
+
774
+ **NEW**: When a specification document changes, use this to propagate changes to downstream phases.
775
+
776
+ When user calls `/spec-change <file>` or notifies you of spec changes:
777
+
778
+ ### Step 1: Detect the Change
779
+
780
+ ```bash
781
+ # User says: "I updated the API response format in API_DOCS.md"
782
+
783
+ Harness:
784
+ 1. Reads old vs new version of .planning/API_DOCS.md
785
+ 2. Identifies what changed (breaking vs additive)
786
+ 3. Classifies severity (high/medium/low)
787
+ 4. Extracts specific changes (what field changed, how)
788
+ ```
789
+
790
+ ### Step 2: Query Impact
791
+
792
+ ```bash
793
+ # Using PHASE_DEPENDENCY_MAP.md
794
+
795
+ Query: Which phases depend on the API_DOCS.md changes?
796
+
797
+ Example:
798
+ - Phase 1 changed: GET /api/users/:id response format
799
+ - PHASE_DEPENDENCY_MAP shows:
800
+ - Phase 2 imports user_api ← AFFECTED
801
+ - Phase 3 imports user_api ← AFFECTED
802
+ - Phase 4 imports user_api ← AFFECTED
803
+ ```
804
+
805
+ ### Step 3: Generate Impact Report
806
+
807
+ ```bash
808
+ # Create .codebase/IMPACT_REPORT_<timestamp>.md
809
+
810
+ Contains:
811
+ - What changed (before/after)
812
+ - Severity level
813
+ - All affected phases
814
+ - Estimated impact time (30 min? 2 hours?)
815
+ - Recommended fix order
816
+ - Rollback strategy
817
+ ```
818
+
819
+ ### Step 4: Auto-Update (Optional)
820
+
821
+ ```bash
822
+ # If user says: "Auto-update all affected phases"
823
+
824
+ For each affected phase:
825
+ 1. Auto-update SPEC.md (replace old API calls)
826
+ 2. Auto-update TEST_CONTRACT.md (update assertions)
827
+ 3. Auto-update PLAN.md (note breaking change)
828
+ 4. Run validation tests
829
+ 5. Flag for developer review if HIGH severity
830
+ ```
831
+
832
+ ### Step 5: Update Tracking
833
+
834
+ ```bash
835
+ 1. Add entry to SPEC_CHANGELOG.md
836
+ 2. Update STATE.md with status
837
+ 3. Create notification with impact details
838
+ 4. Suggest next steps
839
+ ```
840
+
841
+ ---
842
+
843
+ ## `/propagate-spec` Workflow
844
+
845
+ **NEW**: Automatically propagate all pending spec changes to downstream phases.
846
+
847
+ When user calls `/propagate-spec`:
848
+
849
+ ### Step 1: Find Pending Changes
850
+
851
+ ```bash
852
+ # Scan SPEC_CHANGELOG.md for entries marked "pending_propagation"
853
+
854
+ These are changes that were made but not yet pushed to dependent phases.
855
+ ```
856
+
857
+ ### Step 2: Identify Affected Phases
858
+
859
+ ```bash
860
+ # For each pending change:
861
+ # 1. Query PHASE_DEPENDENCY_MAP
862
+ # 2. Find phases that depend on the changed capability
863
+ # 3. Build execution order (upstream first)
864
+ ```
865
+
866
+ ### Step 3: Auto-Update All Phases
867
+
868
+ ```bash
869
+ # For each affected phase (in order):
870
+
871
+ 1. Update SPEC.md
872
+ - Replace old patterns with new ones
873
+ - Update examples
874
+ - Note breaking changes
875
+
876
+ 2. Update TEST_CONTRACT.md
877
+ - Update test expectations
878
+ - Add migration notes
879
+
880
+ 3. Update PLAN.md
881
+ - Note: "Depends on Phase N spec change"
882
+ - Estimate new work time
883
+
884
+ 4. Generate migration guide if breaking change
885
+
886
+ 5. Run tests
887
+ - If PASS: Mark phase as ready ✓
888
+ - If FAIL: Flag for manual review ⚠️
889
+ ```
890
+
891
+ ### Step 4: Update Timeline
892
+
893
+ ```bash
894
+ # If any phase specs changed significantly:
895
+
896
+ 1. Recalculate ROADMAP.md
897
+ - Update phase timelines
898
+ - Recalculate critical path
899
+ - Notify if project delay > 1 day
900
+
901
+ 2. Update STATE.md
902
+ - Note propagation completed
903
+ - Mark phases as ready to resume
904
+ ```
905
+
906
+ ### Step 5: Generate Summary
907
+
908
+ ```bash
909
+ # Create comprehensive report:
910
+
911
+ "Spec propagation complete
912
+
913
+ Updated phases:
914
+ - Phase 2: 1 spec, 3 tests (HIGH severity - requires review)
915
+ - Phase 3: 2 specs, 5 tests (MEDIUM - ready to resume)
916
+ - Phase 4: 0 changes (LOW severity, no impact)
917
+
918
+ Timeline impact: +2 hours estimated work
919
+ Critical path: No changes
920
+ Status: Ready to proceed
921
+
922
+ Next steps:
923
+ 1. Review Phase 2 changes
924
+ 2. Run tests in Phase 2
925
+ 3. Continue Phase 2 implementation"
926
+ ```
927
+
928
+ ---
929
+
930
+ ## `/validate-specs` Workflow
931
+
932
+ **NEW**: Check that all phases are aligned with their dependencies.
933
+
934
+ When user calls `/validate-specs`:
935
+
936
+ ### Step 1: Load Dependency Map
937
+
938
+ ```bash
939
+ # Read PHASE_DEPENDENCY_MAP.md
940
+
941
+ For each phase:
942
+ - What it provides
943
+ - What it requires
944
+ - Which phases it depends on
945
+ ```
946
+
947
+ ### Step 2: Validate Each Phase
948
+
949
+ ```bash
950
+ # For each phase N:
951
+
952
+ Check: Does phase N's SPEC.md match what upstream provides?
953
+
954
+ Example:
955
+ Phase 2 spec says: "Uses user_api with { name, email, role }"
956
+ Phase 1 API_DOCS says: "Returns { id, name, email, roles[] }"
957
+
958
+ Result: MISALIGNED ❌
959
+ Phase 2 spec is STALE (3 days old)
960
+
961
+ Action: Flag for update
962
+ ```
963
+
964
+ ### Step 3: Check for Drift
965
+
966
+ ```bash
967
+ # Detect stale specs:
968
+
969
+ For each phase:
970
+ 1. How old is SPEC.md?
971
+ 2. How old is TEST_CONTRACT.md?
972
+ 3. Have upstream phases changed since?
973
+ 4. If spec older than upstream change → DRIFT DETECTED
974
+
975
+ Report all drifted phases.
976
+ ```
977
+
978
+ ### Step 4: Identify Breaking Changes Not Propagated
979
+
980
+ ```bash
981
+ # Query: Are there HIGH severity changes in SPEC_CHANGELOG?
982
+ # That haven't been propagated to dependent phases?
983
+
984
+ If YES:
985
+ - Flag as blocker
986
+ - Cannot start downstream phase work until propagated
987
+ - Suggest running /propagate-spec
988
+ ```
989
+
990
+ ### Step 5: Generate Alignment Report
991
+
992
+ ```bash
993
+ # Create report with:
994
+
995
+ ✓ Phases in alignment:
996
+ - Phase 1, 3, 4
997
+
998
+ ❌ Phases with issues:
999
+ - Phase 2: Spec STALE (3 days, Phase 1 changed 2 days ago)
1000
+ - Phase 5: Cannot start until Phase 4 propagation complete
1001
+
1002
+ ⚠️ Risky:
1003
+ - Phase 3 depends on Phase 2 which depends on Phase 1
1004
+ - Both Phase 1 and 2 have HIGH severity changes
1005
+ - Timeline risk: +4 hours if cascading changes needed
1006
+
1007
+ Recommendations:
1008
+ 1. Run /propagate-spec immediately
1009
+ 2. Re-validate after propagation
1010
+ 3. Run tests in all phases
1011
+ ```
1012
+
1013
+ ---
1014
+
1015
+ ## Spec Impact Integration into `/new-feature`
1016
+
1017
+ When a feature is completed and phases are affected:
1018
+
1019
+ ### Phase 4: Documentation & Sync (Updated)
1020
+
1021
+ - [ ] Check CHANGE_IMPACT_MATRIX.md → which docs must update?
1022
+ - [ ] Update REQUIREMENTS.md (if behavior/feature added)
1023
+ - [ ] Update API_DOCS.md (if API endpoints changed)
1024
+ - [ ] Update ARCHITECTURE.md (if structure changed)
1025
+ - [ ] Update DESIGN.md (if UI/UX changed)
1026
+ - [ ] Update INTEGRATIONS.md (if external services changed)
1027
+ - [ ] Update CONVENTIONS.md (if new patterns established)
1028
+ - [ ] Update STACK.md (if new tech added)
1029
+ - [ ] Update SPEC_CHANGELOG.md with: date, reason, impacted docs, impacted tests, migration notes
1030
+ - [ ] Update .planning/STATE.md (current phase, active feature, next task)
1031
+ - [ ] Update .planning/SUMMARY.md (recent changes, next recommended task)
1032
+ - [ ] Update .planning/FEATURE_INDEX.md (add feature status)
1033
+ - [ ] Update .planning/QUALITY_SCORE.md (recalculate scores)
1034
+ - [ ] **NEW**: Run `/spec-change <changed-file>` for each updated spec file
1035
+ - [ ] **NEW**: Review impact report from spec-impact-engine
1036
+ - [ ] **NEW**: Run `/propagate-spec` to auto-update downstream phases
1037
+ - [ ] **NEW**: Run `/validate-specs` to confirm all phases aligned
1038
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
1039
+
1040
+ When the user asks for a plan:
1041
+
1042
+ 1. Read required planning docs.
1043
+ 2. Research the codebase.
1044
+ 3. Research best practices if internet is available.
1045
+ 4. Create or update relevant diagrams.
1046
+ 5. Write a plan with:
1047
+
1048
+ ```md
1049
+ ## Goal
1050
+
1051
+ ## Current State
1052
+
1053
+ ## Research Findings
1054
+
1055
+ ## Files to Change
1056
+
1057
+ ### File: `path/to/file`
1058
+ Change:
1059
+ Why:
1060
+ Risk:
1061
+ Test:
1062
+ Docs impact:
1063
+
1064
+ ## Test Contract
1065
+
1066
+ ## Verification Commands
1067
+
1068
+ ## Docs to Update
1069
+
1070
+ ## Risks
1071
+
1072
+ ## Rollback Plan
1073
+ ```
1074
+
1075
+ Do not implement unless the user asks to implement or the workflow clearly requires implementation.
1076
+
1077
+ ## `/audit` Workflow
1078
+
1079
+ When the user asks for `/audit`, perform a harness audit. Review architecture drift, docs freshness, dead code, duplicated logic, dependency risk, security risk, missing tests, missing diagrams, stale decisions, stale feature tasks, and stale phase tasks.
1080
+
1081
+ Update:
1082
+
1083
+ ```txt
1084
+ .planning/audits/architecture-drift.md
1085
+ .planning/audits/dependency-audit.md
1086
+ .planning/audits/dead-code-audit.md
1087
+ .planning/audits/security-audit.md
1088
+ .planning/audits/docs-freshness-audit.md
1089
+ .planning/QUALITY_SCORE.md
1090
+ .planning/STATE.md
1091
+ .planning/SUMMARY.md
1092
+ ```
1093
+
1094
+ Create follow-up tasks if needed. Do not make risky code changes during `/audit` unless explicitly requested.
1095
+
1096
+ ## `/review` Workflow
1097
+
1098
+ When the user asks for `/review`, review changed files. Check unnecessary files, unused code, duplicated logic, debug logs, poor naming, missing tests, missing docs update, architecture drift, convention violations, security risks, performance risks, and best-practice improvements.
1099
+
1100
+ Record the review in the related feature `REVIEW.md`, related phase `REVIEW.md`, and `.planning/SUMMARY.md`. If problems are found, create tracked follow-up tasks.
1101
+
1102
+ ## `/status` Workflow
1103
+
1104
+ When the user asks for `/status`, summarize current project state, current phase, active feature or bug, completed tasks, blocked tasks, latest verification result, next recommended task, and docs that may be stale.
1105
+
1106
+ Use `.planning/STATE.md`, `.planning/ROADMAP.md`, `.planning/FEATURE_INDEX.md`, and `.planning/SUMMARY.md`. Do not guess.
1107
+
1108
+ ## Test-First Rule
1109
+
1110
+ Before implementation:
1111
+
1112
+ 1. create or update tests
1113
+ 2. define input/output expectations
1114
+ 3. define edge cases
1115
+ 4. run tests and confirm they fail for the expected reason
1116
+
1117
+ If no test framework exists, create a minimal verification script, document manual verification steps, and add a test framework recommendation to `STACK.md` or `ROADMAP.md`. Never claim completion without verification.
1118
+
1119
+ ## Implementation Rule
1120
+
1121
+ During implementation, make the smallest working change. Follow `CONVENTIONS.md`, `ARCHITECTURE.md`, and `STACK.md`. Reuse existing utilities. Avoid unrelated refactors, hidden dependencies, public behavior changes without docs, integrations without `INTEGRATIONS.md`, deleting files without justification, and destructive migrations without user confirmation.
1122
+
1123
+ ## State Continuity & Resumption
1124
+
1125
+ **NEW**: After each implementation phase, document state for resumption:
1126
+
1127
+ ### Create `.codebase/IMPLEMENTATION_HANDOFF.md`
1128
+
1129
+ After successful implementation completion:
1130
+
1131
+ ```bash
1132
+ # Create handoff document with:
1133
+ - What was built (modules created/modified)
1134
+ - Current state (what's complete, known issues)
1135
+ - Files changed (detailed list)
1136
+ - Metrics and status
1137
+ - For continuation (resumption instructions)
1138
+ - Recovery points (where to resume if paused)
1139
+ - Architecture decisions (why this approach?)
1140
+ ```
1141
+
1142
+ See `.codebase/IMPLEMENTATION_HANDOFF.md` for template.
1143
+
1144
+ ### Create `.codebase/RECOVERY_POINTS.md`
1145
+
1146
+ Track where work can be safely paused:
1147
+
1148
+ ```bash
1149
+ # For each phase, document:
1150
+ - Phase status (complete, in-progress, paused)
1151
+ - What was completed
1152
+ - What remains
1153
+ - How to resume from this point
1154
+ - Rollback procedures
1155
+ ```
1156
+
1157
+ See `.codebase/RECOVERY_POINTS.md` for template and examples.
1158
+
1159
+ ### Use After Implementation
1160
+
1161
+ Run this workflow after implementation passes tests:
1162
+
1163
+ ```bash
1164
+ # 1. Verify all tests passing
1165
+ npm test
1166
+
1167
+ # 2. Auto-detect changes and sync docs
1168
+ ./scripts/detect-changes.sh
1169
+
1170
+ # 3. Follow post-implementation guide
1171
+ cat .codex/skills/genesis-harness/resources/post-implementation-guide.md
1172
+
1173
+ # 4. Update state tracking
1174
+ cat .codebase/IMPLEMENTATION_HANDOFF.md # Fill out
1175
+ cat .codebase/RECOVERY_POINTS.md # Fill out
1176
+
1177
+ # 5. Verify all docs in sync
1178
+ ./scripts/check-docs-sync.sh
1179
+ ```
1180
+
1181
+ ## Docs Sync Rule
1182
+
1183
+ **CRITICAL**: Whenever implementation changes behavior, API, data model, UI, integration, architecture, convention, config, environment variable, security behavior, or requirement, update ALL related docs.
1184
+
1185
+ Reference `.planning/CHANGE_IMPACT_MATRIX.md` to identify which docs must be updated based on change type.
1186
+
1187
+ Possible docs to update:
1188
+
1189
+ - `.planning/REQUIREMENTS.md` - If feature/behavior/requirement changed
1190
+ - `.planning/API_DOCS.md` - If endpoints/schemas/auth changed
1191
+ - `.planning/ARCHITECTURE.md` - If module boundaries/data flow changed
1192
+ - `.planning/DESIGN.md` - If UI/UX/screens/components changed
1193
+ - `.planning/INTEGRATIONS.md` - If external services/env vars changed
1194
+ - `.planning/STACK.md` - If tech stack/versions/commands changed
1195
+ - `.planning/CONVENTIONS.md` - If patterns/style/rules changed
1196
+ - `.planning/ROADMAP.md` - If timeline/phases/priorities changed
1197
+ - `.planning/STATE.md` - ALWAYS update (current phase, active work, next task)
1198
+ - `.planning/SPEC_CHANGELOG.md` - ALWAYS update (date, reason, impacted docs)
1199
+ - `.planning/QUALITY_SCORE.md` - Update with new metrics
1200
+ - `.planning/OBSERVABILITY.md` - If logging/metrics/traces changed
1201
+ - `.planning/SMOKE_TESTS.md` - If verification paths changed
1202
+ - `.planning/JOURNEYS.md` - If user flows changed
1203
+ - `.planning/diagrams/*.mmd` - If architecture/flow changed
1204
+ - `.planning/decisions/*.md` - If ADR-level changes made
1205
+ - `.planning/features/*/*.md` - Update feature folder docs
1206
+ - `.planning/FEATURE_INDEX.md` - Update feature table
1207
+
1208
+ **Docs Sync Checklist (from TASKS.md)**:
1209
+ - [ ] Check CHANGE_IMPACT_MATRIX.md for required updates
1210
+ - [ ] Update all applicable docs from list above
1211
+ - [ ] Add entry to SPEC_CHANGELOG.md with date and reason
1212
+ - [ ] Update STATE.md and SUMMARY.md
1213
+ - [ ] Recalculate QUALITY_SCORE.md
1214
+
1215
+ If no docs need updating, explicitly state why in the completion report (e.g., "Internal refactor, no behavior change").
1216
+
1217
+ ## Decision Record Rule
1218
+
1219
+ Use ADR files for important decisions. Create files like `.planning/decisions/ADR-003-use-postgres.md`.
1220
+
1221
+ Each ADR must include status, context, decision, alternatives considered, consequences, risks, mitigation, and verification evidence.
1222
+
1223
+ Use ADRs for tech stack decisions, database choice, auth strategy, architecture boundaries, external integrations, major library choices, deployment strategy, security strategy, and API versioning strategy.
1224
+
1225
+ Prefer `scripts/create-adr.sh` for ADR numbering and starter content.
1226
+
1227
+ ## Quality Rubric
1228
+
1229
+ Use this rubric when updating `QUALITY_SCORE.md`:
1230
+
1231
+ | Score | Meaning |
1232
+ |---:|---|
1233
+ | 0 | Unknown, absent, or not evaluated |
1234
+ | 2 | Known major gaps with no mitigation |
1235
+ | 4 | Basic structure exists but is inconsistent or mostly manual |
1236
+ | 6 | Working baseline with known gaps and follow-up tasks |
1237
+ | 8 | Strong, verified, documented, and mostly automated |
1238
+ | 10 | Mature, automated, documented, reviewed, and low-risk |
1239
+
1240
+ Area guidance:
1241
+
1242
+ - Architecture: module boundaries, dependency direction, diagrams, ADRs, forbidden patterns.
1243
+ - Tests: regression coverage, smoke tests, edge cases, failing-first evidence, CI/local repeatability.
1244
+ - Docs Sync: docs updated with behavior changes, changelog entries, impact matrix compliance.
1245
+ - Security: auth, secrets, data protection, dependency risk, destructive-operation safeguards.
1246
+ - Maintainability: naming, duplication, dead code, conventions, file/module size, refactor risk.
1247
+ - Observability: logs, metrics, traces, errors, health checks, debug commands, inspection workflow.
1248
+
1249
+ ## Mechanical Checks Rule
1250
+
1251
+ When possible, use or create scripts that check harness consistency. Scripts should include:
1252
+
1253
+ ```txt
1254
+ scripts/check-docs-sync.sh
1255
+ scripts/check-task-tracking.sh
1256
+ scripts/check-no-debug-logs.sh
1257
+ scripts/check-spec-changelog.sh
1258
+ scripts/check-required-planning-files.sh
1259
+ scripts/check-architecture-boundaries.sh
1260
+ scripts/run-verification.sh
1261
+ ```
1262
+
1263
+ These scripts do not need to be perfect, but they should provide practical guardrails. Document all checks in `.planning/checks/CHECKS.md`.
1264
+
1265
+ ## Escalation Rule
1266
+
1267
+ Stop and ask the user before continuing when product intent is unclear, requirements conflict, a public API breaking change is required, destructive migration is required, deleting user data is possible, credentials or secrets are missing, paid external services are required, a security tradeoff is unclear, legal/compliance concern exists, or the change conflicts with existing architecture decisions.
1268
+
1269
+ Record escalations in `.planning/ESCALATION.md`.
1270
+
1271
+ ## Review Rule
1272
+
1273
+ After tests pass, review all changed files. Check unnecessary files, unused code, duplicated logic, debug logs, poor naming, missing tests, missing docs update, architecture drift, convention violations, security risks, performance risks, and best-practice improvements.
1274
+
1275
+ Record the review in the related feature `REVIEW.md`, bug `REVIEW.md`, phase `REVIEW.md`, and `.planning/SUMMARY.md`.
1276
+
1277
+ ## Completion Report Rule
1278
+
1279
+ Final response must include:
1280
+
1281
+ ```md
1282
+ ## Completed
1283
+
1284
+ - What was done
1285
+
1286
+ ## Planning Updated
1287
+
1288
+ - Files updated under `.planning/`
1289
+
1290
+ ## Code Changed
1291
+
1292
+ - Files changed
1293
+
1294
+ ## Tests / Verification
1295
+
1296
+ - Tests added/updated
1297
+ - Commands run
1298
+ - Result
1299
+
1300
+ ## Docs Sync
1301
+
1302
+ - Docs updated
1303
+ - If none, explain why
1304
+
1305
+ ## Tracking
1306
+
1307
+ - Tasks changed from `[ ]` or `[~]` to `[x]`
1308
+
1309
+ ## Review
1310
+
1311
+ - Changed files reviewed
1312
+ - Cleanup performed
1313
+
1314
+ ## Risks / Follow-up
1315
+
1316
+ - Remaining risks
1317
+ - Suggested next step
1318
+ ```
1319
+
1320
+ Do not say completion is done unless tests or verification passed, tracking was updated, docs were synced or explicitly declared unnecessary, changed files were reviewed, and unnecessary files/debug code were removed.
1321
+
1322
+ ## Default `config.json`
1323
+
1324
+ When initializing, create:
1325
+
1326
+ ```json
1327
+ {
1328
+ "workflow": {
1329
+ "init_requires_confirmation": true,
1330
+ "research_before_plan": true,
1331
+ "best_practice_research": true,
1332
+ "diagram_before_implementation": true,
1333
+ "test_first": true,
1334
+ "task_tracking": true,
1335
+ "docs_sync_required": true,
1336
+ "lessons_read_required": true,
1337
+ "code_review": true,
1338
+ "cleanup_pass": true,
1339
+ "mechanical_checks": true,
1340
+ "audit_supported": true,
1341
+ "escalation_required": true
1342
+ },
1343
+ "tracking": {
1344
+ "todo": "[ ]",
1345
+ "in_progress": "[~]",
1346
+ "done": "[x]",
1347
+ "blocked": "[!]"
1348
+ },
1349
+ "required_reads_before_work": [
1350
+ ".planning/SUMMARY.md",
1351
+ ".planning/STATE.md",
1352
+ ".planning/PITFALLS.md",
1353
+ ".planning/LESSONS_LEARNED.md",
1354
+ ".planning/CONVENTIONS.md",
1355
+ ".planning/ARCHITECTURE.md",
1356
+ ".planning/STACK.md"
1357
+ ],
1358
+ "docs_sync_targets": [
1359
+ ".planning/REQUIREMENTS.md",
1360
+ ".planning/API_DOCS.md",
1361
+ ".planning/ARCHITECTURE.md",
1362
+ ".planning/DESIGN.md",
1363
+ ".planning/INTEGRATIONS.md",
1364
+ ".planning/CONVENTIONS.md",
1365
+ ".planning/ROADMAP.md",
1366
+ ".planning/STATE.md",
1367
+ ".planning/SPEC_CHANGELOG.md",
1368
+ ".planning/QUALITY_SCORE.md",
1369
+ ".planning/OBSERVABILITY.md",
1370
+ ".planning/JOURNEYS.md",
1371
+ ".planning/SMOKE_TESTS.md"
1372
+ ],
1373
+ "mermaid_required_for": [
1374
+ "architecture",
1375
+ "database",
1376
+ "api_flow",
1377
+ "integration",
1378
+ "deployment",
1379
+ "feature_flow",
1380
+ "auth_flow",
1381
+ "background_job_flow"
1382
+ ],
1383
+ "escalate_when": [
1384
+ "ambiguous_product_intent",
1385
+ "conflicting_requirements",
1386
+ "breaking_api_change",
1387
+ "destructive_migration",
1388
+ "possible_user_data_loss",
1389
+ "missing_credentials",
1390
+ "paid_external_service_required",
1391
+ "unclear_security_tradeoff",
1392
+ "legal_or_compliance_risk"
1393
+ ]
1394
+ }
1395
+ ```
1396
+
1397
+ ## Final Hard Rules
1398
+
1399
+ 1. `/init` must not blindly create implementation code.
1400
+ 2. If the app idea is missing or ambiguous, ask for confirmation first.
1401
+ 3. Create root `AGENTS.md` as a concise table of contents.
1402
+ 4. Every task must be tracked with `[ ]`, `[~]`, `[x]`, or `[!]`.
1403
+ 5. Do not say a task is done unless tracking files are updated.
1404
+ 6. Every behavior/spec/API/DB/UI/integration/config/security change must update related docs.
1405
+ 7. Before bug fix or feature work, always read `PITFALLS.md`, `LESSONS_LEARNED.md`, `CONVENTIONS.md`, `ARCHITECTURE.md`, and `STACK.md`.
1406
+ 8. Every bug fix must append a lesson to `LESSONS_LEARNED.md`.
1407
+ 9. Every non-trivial feature must have `SPEC.md`, `IMPACT.md`, `PLAN.md`, `TEST_CONTRACT.md`, `TASKS.md`, `VERIFICATION.md`, `REVIEW.md`, and `DIAGRAM.mmd`.
1408
+ 10. Plans must clearly say what changes, where it changes, why it changes, risks, docs impact, and verification commands.
1409
+ 11. Research best practices before planning when internet is available.
1410
+ 12. Never invent external research results.
1411
+ 13. Mermaid diagrams must be updated before architecture-impacting implementation.
1412
+ 14. Tests or verification must be created before implementation.
1413
+ 15. Review changed files after verification passes.
1414
+ 16. Remove unnecessary files, debug logs, dead code, and unrelated changes.
1415
+ 17. Use ADRs for major technical decisions.
1416
+ 18. Use `/audit` to detect architecture drift, stale docs, dead code, missing tests, and quality gaps.
1417
+ 19. Escalate to the user when human judgment is required.
1418
+ 20. Final response must include changed files, tests, docs sync, tracking updates, review result, and remaining risks.