codex-genesis-harness 0.1.1 → 0.1.5

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 (184) hide show
  1. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -0
  2. package/.codebase/CURRENT_STATE.md +4 -5
  3. package/.codebase/DOMAIN_MODELS.md +5 -3
  4. package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -0
  5. package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -0
  6. package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -0
  7. package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -0
  8. package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -0
  9. package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -0
  10. package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -0
  11. package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -0
  12. package/.codebase/README.md +139 -0
  13. package/.codebase/RECOVERY_POINTS.md +438 -0
  14. package/.codebase/state.json +37 -0
  15. package/.codex/skills/genesis-api-sync/SKILL.md +354 -0
  16. package/.codex/skills/genesis-api-sync/agents/openai.yaml +7 -0
  17. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -0
  18. package/.codex/skills/genesis-api-sync/examples/example.md +68 -0
  19. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -0
  20. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -0
  21. package/.codex/skills/genesis-debug-guide/agents/openai.yaml +7 -0
  22. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -0
  23. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -0
  24. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -0
  25. package/.codex/skills/genesis-debug-guide/examples/example.md +48 -0
  26. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -0
  27. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -0
  28. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -0
  29. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -0
  30. package/.codex/skills/genesis-docs-automation/agents/openai.yaml +7 -0
  31. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -0
  32. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -0
  33. package/.codex/skills/genesis-docs-automation/examples/example.md +59 -0
  34. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -0
  35. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -0
  36. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -0
  37. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -0
  38. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -0
  39. package/.codex/skills/genesis-harness/SKILL.md +743 -82
  40. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -0
  41. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -0
  42. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -0
  43. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -0
  44. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -0
  45. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -0
  46. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -0
  47. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -0
  48. package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +23 -23
  49. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +24 -24
  50. package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +21 -21
  51. package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +46 -46
  52. package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +24 -24
  53. package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +25 -25
  54. package/.codex/skills/genesis-harness/scripts/compact-context.sh +54 -0
  55. package/.codex/skills/genesis-harness/scripts/create-adr.sh +74 -74
  56. package/.codex/skills/genesis-harness/scripts/create-bug.sh +160 -160
  57. package/.codex/skills/genesis-harness/scripts/create-feature.sh +217 -217
  58. package/.codex/skills/genesis-harness/scripts/detect-stack.sh +26 -26
  59. package/.codex/skills/genesis-harness/scripts/init-planning.sh +750 -719
  60. package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +12 -12
  61. package/.codex/skills/genesis-harness/scripts/offload-log.sh +72 -0
  62. package/.codex/skills/genesis-harness/scripts/run-verification.sh +47 -47
  63. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +75 -0
  64. package/.codex/skills/genesis-harness/scripts/update-state.sh +33 -33
  65. package/.codex/skills/genesis-harness-engineering/SKILL.md +159 -0
  66. package/.codex/skills/genesis-harness-engineering/checklists/checklist.md +48 -0
  67. package/.codex/skills/genesis-harness-engineering/examples/example.md +57 -0
  68. package/.codex/skills/genesis-harness-engineering/playbooks/harness-evolution.md +99 -0
  69. package/.codex/skills/genesis-harness-engineering/templates/harness-change-template.md +37 -0
  70. package/.codex/skills/genesis-observability-automation/SKILL.md +382 -0
  71. package/.codex/skills/genesis-observability-automation/agents/openai.yaml +7 -0
  72. package/.codex/skills/genesis-observability-automation/examples/example.md +86 -0
  73. package/.codex/skills/genesis-performance-profiling/SKILL.md +510 -0
  74. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +6 -0
  75. package/.codex/skills/genesis-performance-profiling/checklists/optimization-verification.md +199 -0
  76. package/.codex/skills/genesis-performance-profiling/checklists/performance-baseline.md +183 -0
  77. package/.codex/skills/genesis-performance-profiling/examples/example.md +234 -0
  78. package/.codex/skills/genesis-performance-profiling/observability/performance-tracking.md +202 -0
  79. package/.codex/skills/genesis-performance-profiling/playbooks/load-testing-orchestration.md +593 -0
  80. package/.codex/skills/genesis-performance-profiling/playbooks/profiling-playbook.md +601 -0
  81. package/.codex/skills/genesis-performance-profiling/templates/load-test-config-template.md +428 -0
  82. package/.codex/skills/genesis-performance-profiling/templates/performance-report-template.md +238 -0
  83. package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -0
  84. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +7 -0
  85. package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -0
  86. package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -0
  87. package/.codex/skills/genesis-release-orchestration/examples/example.md +78 -0
  88. package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -0
  89. package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -0
  90. package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -0
  91. package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -0
  92. package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -0
  93. package/.codex/skills/genesis-research-first/SKILL.md +237 -0
  94. package/.codex/skills/genesis-research-first/agents/openai.yaml +7 -0
  95. package/.codex/skills/genesis-research-first/examples/example.md +85 -0
  96. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -0
  97. package/.codex/skills/genesis-spec-propagation/agents/openai.yaml +7 -0
  98. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -0
  99. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -0
  100. package/.codex/skills/genesis-spec-propagation/examples/example.md +63 -0
  101. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -0
  102. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -0
  103. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -0
  104. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -0
  105. package/.codex/skills/genesis-state-machine/SKILL.md +34 -0
  106. package/.codex/skills/spec-impact-engine/SKILL.md +504 -0
  107. package/.codex/skills/spec-impact-engine/agents/openai.yaml +7 -0
  108. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +262 -0
  109. package/.codex/skills/spec-impact-engine/examples/example.md +98 -0
  110. package/.codex/skills/spec-impact-engine/templates/impact-report.md +248 -0
  111. package/.codex/skills/spec-impact-engine/templates/migration-guide.md +223 -0
  112. package/.codex-plugin/plugin.json +7 -7
  113. package/README.EN.md +730 -0
  114. package/README.VI.md +723 -0
  115. package/README.md +266 -107
  116. package/VERSION +1 -1
  117. package/bin/genesis-harness.js +20 -11
  118. package/package.json +62 -43
  119. package/scripts/README.md +342 -0
  120. package/scripts/compact-context.sh +54 -0
  121. package/scripts/detect-changes.sh +152 -0
  122. package/scripts/install.sh +50 -41
  123. package/scripts/offload-log.sh +72 -0
  124. package/scripts/run-evals.sh +70 -43
  125. package/scripts/run-verify-loop.sh +75 -0
  126. package/scripts/transition_state.sh +67 -0
  127. package/scripts/uninstall.sh +52 -43
  128. package/scripts/validation_gates.sh +46 -0
  129. package/scripts/verify.sh +165 -73
  130. package/.codex/skills/harness-engineering-skill/SKILL.md +0 -45
  131. package/.codex/skills/harness-engineering-skill/checklists/checklist.md +0 -8
  132. package/.codex/skills/harness-engineering-skill/examples/example.md +0 -4
  133. package/.codex/skills/harness-engineering-skill/templates/harness-change-template.md +0 -8
  134. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/SKILL.md +0 -0
  135. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/agents/openai.yaml +0 -0
  136. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/checklists/checklist.md +0 -0
  137. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/examples/example.md +0 -0
  138. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/templates/provider-contract-template.md +0 -0
  139. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/SKILL.md +0 -0
  140. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/agents/openai.yaml +0 -0
  141. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/checklists/checklist.md +0 -0
  142. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/examples/example.md +0 -0
  143. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/templates/api-contract-template.md +0 -0
  144. /package/.codex/skills/{architecture-skill → genesis-architecture}/SKILL.md +0 -0
  145. /package/.codex/skills/{architecture-skill → genesis-architecture}/agents/openai.yaml +0 -0
  146. /package/.codex/skills/{architecture-skill → genesis-architecture}/checklists/checklist.md +0 -0
  147. /package/.codex/skills/{architecture-skill → genesis-architecture}/examples/example.md +0 -0
  148. /package/.codex/skills/{architecture-skill → genesis-architecture}/templates/architecture-decision-template.md +0 -0
  149. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/SKILL.md +0 -0
  150. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/agents/openai.yaml +0 -0
  151. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/checklists/checklist.md +0 -0
  152. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/examples/example.md +0 -0
  153. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/templates/map-update-template.md +0 -0
  154. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/SKILL.md +0 -0
  155. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/agents/openai.yaml +0 -0
  156. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/checklists/checklist.md +0 -0
  157. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/examples/example.md +0 -0
  158. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/templates/design-spec-template.md +0 -0
  159. /package/.codex/skills/{docs-skill → genesis-docs}/SKILL.md +0 -0
  160. /package/.codex/skills/{docs-skill → genesis-docs}/agents/openai.yaml +0 -0
  161. /package/.codex/skills/{docs-skill → genesis-docs}/checklists/checklist.md +0 -0
  162. /package/.codex/skills/{docs-skill → genesis-docs}/examples/example.md +0 -0
  163. /package/.codex/skills/{docs-skill → genesis-docs}/templates/docs-update-template.md +0 -0
  164. /package/.codex/skills/{harness-engineering-skill → genesis-harness-engineering}/agents/openai.yaml +0 -0
  165. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/SKILL.md +0 -0
  166. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/agents/openai.yaml +0 -0
  167. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/checklists/checklist.md +0 -0
  168. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/examples/example.md +0 -0
  169. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/templates/orchestration-template.md +0 -0
  170. /package/.codex/skills/{planning-skill → genesis-planning}/SKILL.md +0 -0
  171. /package/.codex/skills/{planning-skill → genesis-planning}/agents/openai.yaml +0 -0
  172. /package/.codex/skills/{planning-skill → genesis-planning}/checklists/checklist.md +0 -0
  173. /package/.codex/skills/{planning-skill → genesis-planning}/examples/example.md +0 -0
  174. /package/.codex/skills/{planning-skill → genesis-planning}/templates/plan-template.md +0 -0
  175. /package/.codex/skills/{release-skill → genesis-release}/SKILL.md +0 -0
  176. /package/.codex/skills/{release-skill → genesis-release}/agents/openai.yaml +0 -0
  177. /package/.codex/skills/{release-skill → genesis-release}/checklists/checklist.md +0 -0
  178. /package/.codex/skills/{release-skill → genesis-release}/examples/example.md +0 -0
  179. /package/.codex/skills/{release-skill → genesis-release}/templates/release-checklist-template.md +0 -0
  180. /package/.codex/skills/{research-skill → genesis-research}/SKILL.md +0 -0
  181. /package/.codex/skills/{research-skill → genesis-research}/agents/openai.yaml +0 -0
  182. /package/.codex/skills/{research-skill → genesis-research}/checklists/checklist.md +0 -0
  183. /package/.codex/skills/{research-skill → genesis-research}/examples/example.md +0 -0
  184. /package/.codex/skills/{research-skill → genesis-research}/templates/research-note-template.md +0 -0
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: genesis-harness
2
+ name: genesis-harness
3
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
4
  ---
5
5
 
@@ -7,48 +7,48 @@ description: Initialize and operate a project planning harness for Codex. Use th
7
7
 
8
8
  This skill turns Codex into a project operating harness.
9
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
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/state.json` (MANDATORY on boot), `.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, read `.codebase/state.json` to identify your exact FSM state. Rerun verification, identify the first failing phase, and resume from that point based on the strict state rules.
50
+
51
+ ## Core Principle
52
52
 
53
53
  Do not code first.
54
54
 
@@ -85,10 +85,61 @@ Support these user intents:
85
85
  /audit
86
86
  /review
87
87
  /status
88
+ /spec-change <file> [NEW]
89
+ /propagate-spec [NEW]
90
+ /validate-specs [NEW]
88
91
  ```
89
92
 
90
93
  If the user does not type an exact command but clearly asks for one of these workflows, infer the correct workflow.
91
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
+
92
143
  ## Resource And Script Map
93
144
 
94
145
  Bundled resources live under `resources/`. Use them as starting content when creating `.planning/` files:
@@ -96,6 +147,22 @@ Bundled resources live under `resources/`. Use them as starting content when cre
96
147
  - `planning-tree-template.md`: required `.planning/` tree.
97
148
  - `agents-template.md`: concise root `AGENTS.md`.
98
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.
99
166
 
100
167
  Bundled references live under `references/`. Load them only when needed:
101
168
 
@@ -111,15 +178,23 @@ Bundled scripts live under `scripts/`. Prefer copying or adapting these into `.p
111
178
  - `create-bug.sh`: scaffolds `.planning/bugs/NNN-bug-slug/`.
112
179
  - `create-adr.sh`: scaffolds `.planning/decisions/ADR-NNN-slug.md`.
113
180
  - `update-state.sh`: updates common fields in `.planning/STATE.md`.
181
+ - **NEW**: `transition_state.sh`: Strict FSM transition script. You MUST use this script to move between `INIT`, `REQUIREMENTS_GATHERING`, `PLANNING`, `IMPLEMENTATION`, `VERIFICATION`, and `COMPLETED` states.
182
+ - `offload-log.sh`: captures and trims large command outputs to protect the context window.
183
+ - `compact-context.sh`: intelligent context compaction summarizing state to disk.
184
+ - `run-verify-loop.sh`: state-tracked Ralph Loop verify-fix loop executor.
114
185
  - `detect-stack.sh`: inspects repository stack clues.
115
186
  - `list-changed-files.sh`: lists git changes when git is available.
116
187
  - `run-verification.sh`: runs detected lint/typecheck/test/build checks.
188
+ - `detect-changes.sh`: Auto-detect file changes and identify what `.codebase` docs need updating.
117
189
  - `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.
190
+ - **NEW**: `spec-impact-engine/detect-spec-changes.sh`: Auto-detect spec changes and generate impact report.
118
191
 
119
192
  ## `/init` Workflow
120
193
 
121
194
  When the user types `/init`, initialize the project planning harness. Before creating files, inspect the current repository.
122
195
 
196
+ **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.
197
+
123
198
  Look for:
124
199
 
125
200
  - `README.md`
@@ -157,6 +232,9 @@ Out of scope:
157
232
  Assumptions:
158
233
 
159
234
  Please confirm before I initialize `.planning/`.
235
+
236
+ Note: I will create a Foundation phase (Phase 0) for documentation
237
+ only. Feature phases will be created later when requirements are finalized.
160
238
  ```
161
239
 
162
240
  If the app idea is missing or ambiguous, stop and ask:
@@ -172,7 +250,21 @@ If the app idea is missing or ambiguous, stop and ask:
172
250
 
173
251
  Do not create implementation code until the project idea is confirmed.
174
252
 
175
- After confirmation, create root `AGENTS.md`, the `.planning/` structure, initial planning files, base Mermaid diagrams, the first roadmap phase, initial checks, and the initial quality score. Use `scripts/init-planning.sh` when it fits the repository.
253
+ 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.
254
+
255
+ **Foundation Phase (Phase 0)**: This is a setup phase only, not a feature phase. It contains:
256
+ - Tasks to complete project documentation
257
+ - No feature implementation tasks
258
+ - Placeholder roadmap with no feature phases yet
259
+
260
+ **Phase Dependency Map**: Created as `.codebase/PHASE_DEPENDENCY_MAP.md`, this is:
261
+ - Mapping of which phases provide what
262
+ - Which phases depend on which other phases
263
+ - Impact calculation rules for spec changes
264
+ - Timeline sensitivity analysis
265
+ - Used by spec-impact-engine for auto-updates
266
+
267
+ Feature phases must not be created until requirements are finalized and prioritized. Each feature gets its own numbered phase folder when work begins.
176
268
 
177
269
  `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.
178
270
 
@@ -280,20 +372,34 @@ Feature, bug, phase, audit, and architecture work is ready to implement only whe
280
372
 
281
373
  If any item is false, do not implement. Update tracking to `[!]` or ask the user.
282
374
 
375
+ ## Validation Gates
376
+
377
+ Before moving to the `COMPLETED` state, the agent MUST pass the validation gates:
378
+ - Run `bash scripts/validation_gates.sh`
379
+ - Ensure no leftover `TODO`, `FIXME`, `console.log`, or `print` statements remain in production code.
380
+ - Ensure all tests and `verify.sh` checks pass.
381
+ - If the validation gates fail, the agent is forced to remain in `VERIFICATION` or return to `IMPLEMENTATION` to fix the issues.
382
+
283
383
  ## Definition Of Done
284
384
 
285
385
  Work is done only when:
286
386
 
287
387
  - [x] implementation is complete and scoped to the plan
288
388
  - [x] automated tests or documented verification passed
289
- - [x] docs were synchronized, or no-docs-needed was justified
389
+ - [x] docs were synchronized (see Docs Sync Rule below)
290
390
  - [x] task tracking moved from `[ ]` or `[~]` to `[x]`
291
- - [x] `STATE.md`, `SUMMARY.md`, and feature/bug/phase tracking are current
391
+ - [x] `.planning/STATE.md` updated (current phase, active feature, next task)
392
+ - [x] `.planning/SUMMARY.md` updated (recent changes, next recommended task)
393
+ - [x] `.planning/SPEC_CHANGELOG.md` updated if behavior/API/requirements changed
394
+ - [x] `.planning/QUALITY_SCORE.md` recalculated
395
+ - [x] `.planning/FEATURE_INDEX.md` updated with feature status
292
396
  - [x] changed files were reviewed
293
397
  - [x] debug logs, dead code, unrelated edits, and unnecessary files were removed
294
398
  - [x] risks and follow-up tasks are recorded
295
399
 
296
- Never use completion language until the Definition of Done is satisfied.
400
+ **Never use completion language until ALL items above are satisfied.**
401
+
402
+ If a doc doesn't need updating, explicitly explain why in the completion report.
297
403
 
298
404
  ## Research Rule
299
405
 
@@ -356,7 +462,50 @@ A feature must also have `.planning/features/NNN-feature-name/DIAGRAM.mmd`. Do n
356
462
 
357
463
  ## `/new-feature` Workflow
358
464
 
359
- When adding a new feature, first read:
465
+ **IMPORTANT**: Always use `checklists/new-feature-qa.md` BEFORE starting any feature work.
466
+
467
+ When adding a new feature:
468
+
469
+ ### Step 0: Complete Q&A Checklist (MANDATORY)
470
+
471
+ ```bash
472
+ # Before any planning, complete:
473
+ cat .codex/skills/genesis-harness/checklists/new-feature-qa.md
474
+
475
+ # Answer all questions:
476
+ - User story clearly defined?
477
+ - Success criteria measurable?
478
+ - Out of scope documented?
479
+ - Requirements clear?
480
+ - API/database/UI impacts known?
481
+ - Edge cases identified?
482
+ - Test strategy defined?
483
+ - No unknowns remaining?
484
+ ```
485
+
486
+ If ANY question is unanswered → Stop and get clarification before continuing.
487
+
488
+ ### Step 1: Requirements Validation
489
+
490
+ After Q&A is complete, validate requirements:
491
+
492
+ ```bash
493
+ # Use requirements validation checklist:
494
+ cat .codex/skills/genesis-harness/checklists/requirements-validation.md
495
+
496
+ # Verify:
497
+ - All items are specific and measurable
498
+ - Scope is bounded
499
+ - Technical feasibility confirmed
500
+ - Acceptance criteria are testable
501
+ - Stakeholder alignment obtained
502
+ ```
503
+
504
+ If ANY validation fails → Do not continue. Fix before proceeding.
505
+
506
+ ### Step 2: Confirm Definition of Ready
507
+
508
+ Then read:
360
509
 
361
510
  ```txt
362
511
  .planning/SUMMARY.md
@@ -368,7 +517,27 @@ When adding a new feature, first read:
368
517
  .planning/STACK.md
369
518
  ```
370
519
 
371
- Then research local patterns and best practices. Create:
520
+ Verify ALL of these are TRUE:
521
+
522
+ ```
523
+ [ ] Q&A checklist completed and all questions answered
524
+ [ ] Requirements validation passed
525
+ [ ] Product intent is clear enough to avoid guessing
526
+ [ ] Required planning docs were read (7 docs above)
527
+ [ ] Relevant local codebase patterns were researched
528
+ [ ] Best-practice research is recorded or internet unavailability stated
529
+ [ ] Impact on API, database, UI, auth, integrations, config, docs, and tests is KNOWN
530
+ [ ] Test contract or verification contract will be created
531
+ [ ] Diagram or ADR impact is handled if architecture changes
532
+ [ ] Escalation concerns are resolved or explicitly recorded
533
+
534
+ If ANY checkbox is FALSE → Do not continue.
535
+ Ask user for clarification or update tracking to [!] blocked.
536
+ ```
537
+
538
+ ### Step 3: Research & Plan
539
+
540
+ Research local patterns and best practices. Create:
372
541
 
373
542
  ```txt
374
543
  .planning/features/NNN-feature-slug/
@@ -400,13 +569,100 @@ Docs impact:
400
569
 
401
570
  `TEST_CONTRACT.md` must include normal input/output, edge cases, invalid inputs, expected errors, acceptance tests, and manual verification if automated tests are unavailable.
402
571
 
403
- `TASKS.md` must include checkbox tasks for required doc reads, pitfalls, lessons, codebase research, best-practice research, diagram, spec, impact, plan, test contract, failing tests or verification, implementation, verification, docs, review, cleanup, state, feature index, spec changelog, and completion tracking.
572
+ `TASKS.md` must include checkbox tasks for:
573
+
574
+ **Phase 1: Confirmation & Research**
575
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/new-feature-qa.md`
576
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/requirements-validation.md`
577
+ - [ ] Read required `.planning/` docs (SUMMARY, STATE, PITFALLS, LESSONS, CONVENTIONS, ARCHITECTURE, STACK)
578
+ - [ ] Verify Definition of Ready (all 10 items confirmed YES)
579
+
580
+ **Phase 2: Planning & Contracts**
581
+ - [ ] Research codebase patterns for similar features
582
+ - [ ] Research best practices (external sources or mark unavailable)
583
+ - [ ] Complete SPEC.md with full acceptance criteria
584
+ - [ ] Complete IMPACT.md answering all 11 impact questions
585
+ - [ ] Complete PLAN.md with file changes, risks, rollback
586
+ - [ ] Create TEST_CONTRACT.md with test cases
587
+ - [ ] Create DIAGRAM.mmd if architecture affected
588
+ - [ ] Identify all docs that will need updates (API_DOCS? REQUIREMENTS? DESIGN? etc.)
589
+
590
+ **Phase 3: Implementation**
591
+ - [ ] Create failing test or verification
592
+ - [ ] Implement to pass test
593
+ - [ ] Run verification - all pass?
594
+ - [ ] Review code for quality
595
+
596
+ **Phase 4: Documentation & Sync**
597
+ - [ ] Check CHANGE_IMPACT_MATRIX.md → which docs must update?
598
+ - [ ] Update REQUIREMENTS.md (if behavior/feature added)
599
+ - [ ] Update API_DOCS.md (if API endpoints changed)
600
+ - [ ] Update ARCHITECTURE.md (if structure changed)
601
+ - [ ] Update DESIGN.md (if UI/UX changed)
602
+ - [ ] Update INTEGRATIONS.md (if external services changed)
603
+ - [ ] Update CONVENTIONS.md (if new patterns established)
604
+ - [ ] Update STACK.md (if new tech added)
605
+ - [ ] Update SPEC_CHANGELOG.md with: date, reason, impacted docs, impacted tests, migration notes
606
+ - [ ] Update .planning/STATE.md (current phase, active feature, next task)
607
+ - [ ] Update .planning/SUMMARY.md (recent changes, next recommended task)
608
+ - [ ] Update .planning/FEATURE_INDEX.md (add feature status)
609
+ - [ ] Update .planning/QUALITY_SCORE.md (recalculate scores)
610
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
611
+
612
+ **Phase 5: Review & Completion**
613
+ - [ ] Review changed files (remove debug logs, dead code, unrelated changes)
614
+ - [ ] Update feature REVIEW.md with findings
615
+ - [ ] Verify cleanup pass complete
616
+ - [ ] Create `.codebase/RECOVERY_POINTS.md` entry for resumption
617
+ - [ ] Create or update `.codebase/IMPLEMENTATION_HANDOFF.md`
618
+ - [ ] Mark TASKS checklist complete [x]
404
619
 
405
620
  Prefer `scripts/create-feature.sh` for the initial folder and file scaffold, then fill the generated files with task-specific content.
406
621
 
407
622
  ## `/fix-bug` Workflow
408
623
 
409
- Before fixing a bug, always read:
624
+ **IMPORTANT**: Always use `checklists/bug-fix-qa.md` BEFORE starting any bug fix work.
625
+
626
+ Before fixing a bug, always:
627
+
628
+ ### Step 0: Complete Bug Fix Q&A (MANDATORY)
629
+
630
+ ```bash
631
+ # Complete the bug fix questionnaire:
632
+ cat .codex/skills/genesis-harness/checklists/bug-fix-qa.md
633
+
634
+ # Answer all questions:
635
+ - Bug clearly reproduced?
636
+ - Root cause identified?
637
+ - Severity assessed?
638
+ - Affected versions known?
639
+ - Impact assessed?
640
+ - Fix approach decided?
641
+ - Regression prevention plan?
642
+ - Deployment strategy known?
643
+ ```
644
+
645
+ If ANY question is unanswered → Stop and get clarification before continuing.
646
+
647
+ ### Step 1: Requirements Validation
648
+
649
+ After bug Q&A is complete:
650
+
651
+ ```bash
652
+ # Use requirements validation checklist:
653
+ cat .codex/skills/genesis-harness/checklists/requirements-validation.md
654
+
655
+ # For bugs, verify:
656
+ - Root cause is clear
657
+ - Fix approach is feasible
658
+ - Test strategy is defined
659
+ - No scope creep
660
+ - Stakeholders aligned
661
+ ```
662
+
663
+ ### Step 2: Read Context
664
+
665
+ Then read:
410
666
 
411
667
  ```txt
412
668
  .planning/PITFALLS.md
@@ -429,11 +685,52 @@ Then reproduce and diagnose before changing code. Create:
429
685
  └── REVIEW.md
430
686
  ```
431
687
 
432
- Bug `TASKS.md` must include checkboxes for reading pitfalls and lessons, reproducing the bug, identifying root cause, writing regression test or verification, fixing, verification, updating lessons learned, updating docs if behavior changed, reviewing changed files, updating state, and updating spec changelog if needed.
433
-
434
- Prefer `scripts/create-bug.sh` for the initial folder and file scaffold, then fill the generated files with task-specific evidence.
435
-
436
- After fixing the bug, append to `.planning/LESSONS_LEARNED.md`:
688
+ ### Step 3: Bug Documentation
689
+
690
+ Create `TASKS.md` with checkboxes for:
691
+
692
+ **Phase 1: Understanding**
693
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/bug-fix-qa.md`
694
+ - [ ] Complete `.codex/skills/genesis-harness/checklists/requirements-validation.md`
695
+ - [ ] Read PITFALLS.md and LESSONS_LEARNED.md
696
+ - [ ] Reproduce bug with exact steps
697
+ - [ ] Identify root cause
698
+ - [ ] Check for similar bugs in LESSONS_LEARNED.md
699
+
700
+ **Phase 2: Planning**
701
+ - [ ] Complete REPORT.md (what is broken?)
702
+ - [ ] Complete ROOT_CAUSE.md (why is it broken?)
703
+ - [ ] Complete PLAN.md (how to fix it?)
704
+ - [ ] Create TEST_CONTRACT.md (regression test)
705
+ - [ ] Identify risk level (low/medium/high)
706
+ - [ ] Plan rollback strategy
707
+
708
+ **Phase 3: Implementation**
709
+ - [ ] Create regression test (should fail with current code)
710
+ - [ ] Fix with minimal change (don't refactor unrelated code)
711
+ - [ ] Verify regression test now passes
712
+ - [ ] Run full test suite - all pass?
713
+
714
+ **Phase 4: Documentation & Sync**
715
+ - [ ] Update LESSONS_LEARNED.md with bug finding
716
+ - [ ] Check which docs affected
717
+ - [ ] Update REQUIREMENTS.md (if behavior changed)
718
+ - [ ] Update API_DOCS.md (if API changed)
719
+ - [ ] Update .planning/STATE.md
720
+ - [ ] Update .planning/SUMMARY.md
721
+ - [ ] Update .planning/SPEC_CHANGELOG.md if needed
722
+ - [ ] Update .planning/QUALITY_SCORE.md
723
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
724
+
725
+ **Phase 5: Review & Completion**
726
+ - [ ] Review changed files (minimal change?)
727
+ - [ ] Update bug REVIEW.md
728
+ - [ ] Verify cleanup pass complete
729
+ - [ ] Create `.codebase/RECOVERY_POINTS.md` entry
730
+ - [ ] Create or update `.codebase/IMPLEMENTATION_HANDOFF.md`
731
+ - [ ] Mark TASKS checklist complete [x]
732
+
733
+ Append to `.planning/LESSONS_LEARNED.md`:
437
734
 
438
735
  ```md
439
736
  ## Bug: <name>
@@ -449,7 +746,305 @@ Verification:
449
746
 
450
747
  Never fix the same type of bug without checking `LESSONS_LEARNED.md`.
451
748
 
452
- ## `/plan` Workflow
749
+ Prefer `scripts/create-bug.sh` for the initial folder and file scaffold, then fill the generated files with task-specific evidence.
750
+
751
+ ## `/api-sync` Workflow
752
+
753
+ **NEW**: After implementing API-related features or changes, use the **api-sync-skill** to automatically sync contracts with implementation.
754
+
755
+ When API code is modified, invoke:
756
+
757
+ ```bash
758
+ invoke api-sync-skill
759
+
760
+ # Parameters:
761
+ - changed_files: [list of API files modified]
762
+ - contract_file: ".codebase/API_CONTRACTS.md"
763
+ - breaking_changes: true/false
764
+ - version_bump: "major/minor/patch"
765
+ ```
766
+
767
+ This workflow:
768
+
769
+ 1. Detects API endpoint changes (new, modified, deprecated)
770
+ 2. Extracts request/response schemas from code
771
+ 3. Updates API_CONTRACTS.md with all changes
772
+ 4. Identifies breaking changes
773
+ 5. Generates test contracts
774
+ 6. Creates migration guide if needed
775
+ 7. Documents version changes
776
+
777
+ See `.codex/skills/api-sync-skill/SKILL.md` for full workflow.
778
+
779
+ **Important**: Run before committing API changes.
780
+
781
+ ## `/spec-change` Workflow
782
+
783
+ **NEW**: When a specification document changes, use this to propagate changes to downstream phases.
784
+
785
+ When user calls `/spec-change <file>` or notifies you of spec changes:
786
+
787
+ ### Step 1: Detect the Change
788
+
789
+ ```bash
790
+ # User says: "I updated the API response format in API_DOCS.md"
791
+
792
+ Harness:
793
+ 1. Reads old vs new version of .planning/API_DOCS.md
794
+ 2. Identifies what changed (breaking vs additive)
795
+ 3. Classifies severity (high/medium/low)
796
+ 4. Extracts specific changes (what field changed, how)
797
+ ```
798
+
799
+ ### Step 2: Query Impact
800
+
801
+ ```bash
802
+ # Using PHASE_DEPENDENCY_MAP.md
803
+
804
+ Query: Which phases depend on the API_DOCS.md changes?
805
+
806
+ Example:
807
+ - Phase 1 changed: GET /api/users/:id response format
808
+ - PHASE_DEPENDENCY_MAP shows:
809
+ - Phase 2 imports user_api ← AFFECTED
810
+ - Phase 3 imports user_api ← AFFECTED
811
+ - Phase 4 imports user_api ← AFFECTED
812
+ ```
813
+
814
+ ### Step 3: Generate Impact Report
815
+
816
+ ```bash
817
+ # Create .codebase/IMPACT_REPORT_<timestamp>.md
818
+
819
+ Contains:
820
+ - What changed (before/after)
821
+ - Severity level
822
+ - All affected phases
823
+ - Estimated impact time (30 min? 2 hours?)
824
+ - Recommended fix order
825
+ - Rollback strategy
826
+ ```
827
+
828
+ ### Step 4: Auto-Update (Optional)
829
+
830
+ ```bash
831
+ # If user says: "Auto-update all affected phases"
832
+
833
+ For each affected phase:
834
+ 1. Auto-update SPEC.md (replace old API calls)
835
+ 2. Auto-update TEST_CONTRACT.md (update assertions)
836
+ 3. Auto-update PLAN.md (note breaking change)
837
+ 4. Run validation tests
838
+ 5. Flag for developer review if HIGH severity
839
+ ```
840
+
841
+ ### Step 5: Update Tracking
842
+
843
+ ```bash
844
+ 1. Add entry to SPEC_CHANGELOG.md
845
+ 2. Update STATE.md with status
846
+ 3. Create notification with impact details
847
+ 4. Suggest next steps
848
+ ```
849
+
850
+ ---
851
+
852
+ ## `/propagate-spec` Workflow
853
+
854
+ **NEW**: Automatically propagate all pending spec changes to downstream phases.
855
+
856
+ When user calls `/propagate-spec`:
857
+
858
+ ### Step 1: Find Pending Changes
859
+
860
+ ```bash
861
+ # Scan SPEC_CHANGELOG.md for entries marked "pending_propagation"
862
+
863
+ These are changes that were made but not yet pushed to dependent phases.
864
+ ```
865
+
866
+ ### Step 2: Identify Affected Phases
867
+
868
+ ```bash
869
+ # For each pending change:
870
+ # 1. Query PHASE_DEPENDENCY_MAP
871
+ # 2. Find phases that depend on the changed capability
872
+ # 3. Build execution order (upstream first)
873
+ ```
874
+
875
+ ### Step 3: Auto-Update All Phases
876
+
877
+ ```bash
878
+ # For each affected phase (in order):
879
+
880
+ 1. Update SPEC.md
881
+ - Replace old patterns with new ones
882
+ - Update examples
883
+ - Note breaking changes
884
+
885
+ 2. Update TEST_CONTRACT.md
886
+ - Update test expectations
887
+ - Add migration notes
888
+
889
+ 3. Update PLAN.md
890
+ - Note: "Depends on Phase N spec change"
891
+ - Estimate new work time
892
+
893
+ 4. Generate migration guide if breaking change
894
+
895
+ 5. Run tests
896
+ - If PASS: Mark phase as ready ✓
897
+ - If FAIL: Flag for manual review ⚠️
898
+ ```
899
+
900
+ ### Step 4: Update Timeline
901
+
902
+ ```bash
903
+ # If any phase specs changed significantly:
904
+
905
+ 1. Recalculate ROADMAP.md
906
+ - Update phase timelines
907
+ - Recalculate critical path
908
+ - Notify if project delay > 1 day
909
+
910
+ 2. Update STATE.md
911
+ - Note propagation completed
912
+ - Mark phases as ready to resume
913
+ ```
914
+
915
+ ### Step 5: Generate Summary
916
+
917
+ ```bash
918
+ # Create comprehensive report:
919
+
920
+ "Spec propagation complete
921
+
922
+ Updated phases:
923
+ - Phase 2: 1 spec, 3 tests (HIGH severity - requires review)
924
+ - Phase 3: 2 specs, 5 tests (MEDIUM - ready to resume)
925
+ - Phase 4: 0 changes (LOW severity, no impact)
926
+
927
+ Timeline impact: +2 hours estimated work
928
+ Critical path: No changes
929
+ Status: Ready to proceed
930
+
931
+ Next steps:
932
+ 1. Review Phase 2 changes
933
+ 2. Run tests in Phase 2
934
+ 3. Continue Phase 2 implementation"
935
+ ```
936
+
937
+ ---
938
+
939
+ ## `/validate-specs` Workflow
940
+
941
+ **NEW**: Check that all phases are aligned with their dependencies.
942
+
943
+ When user calls `/validate-specs`:
944
+
945
+ ### Step 1: Load Dependency Map
946
+
947
+ ```bash
948
+ # Read PHASE_DEPENDENCY_MAP.md
949
+
950
+ For each phase:
951
+ - What it provides
952
+ - What it requires
953
+ - Which phases it depends on
954
+ ```
955
+
956
+ ### Step 2: Validate Each Phase
957
+
958
+ ```bash
959
+ # For each phase N:
960
+
961
+ Check: Does phase N's SPEC.md match what upstream provides?
962
+
963
+ Example:
964
+ Phase 2 spec says: "Uses user_api with { name, email, role }"
965
+ Phase 1 API_DOCS says: "Returns { id, name, email, roles[] }"
966
+
967
+ Result: MISALIGNED ❌
968
+ Phase 2 spec is STALE (3 days old)
969
+
970
+ Action: Flag for update
971
+ ```
972
+
973
+ ### Step 3: Check for Drift
974
+
975
+ ```bash
976
+ # Detect stale specs:
977
+
978
+ For each phase:
979
+ 1. How old is SPEC.md?
980
+ 2. How old is TEST_CONTRACT.md?
981
+ 3. Have upstream phases changed since?
982
+ 4. If spec older than upstream change → DRIFT DETECTED
983
+
984
+ Report all drifted phases.
985
+ ```
986
+
987
+ ### Step 4: Identify Breaking Changes Not Propagated
988
+
989
+ ```bash
990
+ # Query: Are there HIGH severity changes in SPEC_CHANGELOG?
991
+ # That haven't been propagated to dependent phases?
992
+
993
+ If YES:
994
+ - Flag as blocker
995
+ - Cannot start downstream phase work until propagated
996
+ - Suggest running /propagate-spec
997
+ ```
998
+
999
+ ### Step 5: Generate Alignment Report
1000
+
1001
+ ```bash
1002
+ # Create report with:
1003
+
1004
+ ✓ Phases in alignment:
1005
+ - Phase 1, 3, 4
1006
+
1007
+ ❌ Phases with issues:
1008
+ - Phase 2: Spec STALE (3 days, Phase 1 changed 2 days ago)
1009
+ - Phase 5: Cannot start until Phase 4 propagation complete
1010
+
1011
+ ⚠️ Risky:
1012
+ - Phase 3 depends on Phase 2 which depends on Phase 1
1013
+ - Both Phase 1 and 2 have HIGH severity changes
1014
+ - Timeline risk: +4 hours if cascading changes needed
1015
+
1016
+ Recommendations:
1017
+ 1. Run /propagate-spec immediately
1018
+ 2. Re-validate after propagation
1019
+ 3. Run tests in all phases
1020
+ ```
1021
+
1022
+ ---
1023
+
1024
+ ## Spec Impact Integration into `/new-feature`
1025
+
1026
+ When a feature is completed and phases are affected:
1027
+
1028
+ ### Phase 4: Documentation & Sync (Updated)
1029
+
1030
+ - [ ] Check CHANGE_IMPACT_MATRIX.md → which docs must update?
1031
+ - [ ] Update REQUIREMENTS.md (if behavior/feature added)
1032
+ - [ ] Update API_DOCS.md (if API endpoints changed)
1033
+ - [ ] Update ARCHITECTURE.md (if structure changed)
1034
+ - [ ] Update DESIGN.md (if UI/UX changed)
1035
+ - [ ] Update INTEGRATIONS.md (if external services changed)
1036
+ - [ ] Update CONVENTIONS.md (if new patterns established)
1037
+ - [ ] Update STACK.md (if new tech added)
1038
+ - [ ] Update SPEC_CHANGELOG.md with: date, reason, impacted docs, impacted tests, migration notes
1039
+ - [ ] Update .planning/STATE.md (current phase, active feature, next task)
1040
+ - [ ] Update .planning/SUMMARY.md (recent changes, next recommended task)
1041
+ - [ ] Update .planning/FEATURE_INDEX.md (add feature status)
1042
+ - [ ] Update .planning/QUALITY_SCORE.md (recalculate scores)
1043
+ - [ ] **NEW**: Run `/spec-change <changed-file>` for each updated spec file
1044
+ - [ ] **NEW**: Review impact report from spec-impact-engine
1045
+ - [ ] **NEW**: Run `/propagate-spec` to auto-update downstream phases
1046
+ - [ ] **NEW**: Run `/validate-specs` to confirm all phases aligned
1047
+ - [ ] Run post-implementation state sync: `.codex/skills/genesis-harness/resources/post-implementation-guide.md`
453
1048
 
454
1049
  When the user asks for a plan:
455
1050
 
@@ -534,33 +1129,99 @@ If no test framework exists, create a minimal verification script, document manu
534
1129
 
535
1130
  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.
536
1131
 
1132
+ ## State Continuity & Resumption
1133
+
1134
+ **NEW**: After each implementation phase, document state for resumption:
1135
+
1136
+ ### Create `.codebase/IMPLEMENTATION_HANDOFF.md`
1137
+
1138
+ After successful implementation completion:
1139
+
1140
+ ```bash
1141
+ # Create handoff document with:
1142
+ - What was built (modules created/modified)
1143
+ - Current state (what's complete, known issues)
1144
+ - Files changed (detailed list)
1145
+ - Metrics and status
1146
+ - For continuation (resumption instructions)
1147
+ - Recovery points (where to resume if paused)
1148
+ - Architecture decisions (why this approach?)
1149
+ ```
1150
+
1151
+ See `.codebase/IMPLEMENTATION_HANDOFF.md` for template.
1152
+
1153
+ ### Create `.codebase/RECOVERY_POINTS.md`
1154
+
1155
+ Track where work can be safely paused:
1156
+
1157
+ ```bash
1158
+ # For each phase, document:
1159
+ - Phase status (complete, in-progress, paused)
1160
+ - What was completed
1161
+ - What remains
1162
+ - How to resume from this point
1163
+ - Rollback procedures
1164
+ ```
1165
+
1166
+ See `.codebase/RECOVERY_POINTS.md` for template and examples.
1167
+
1168
+ ### Use After Implementation
1169
+
1170
+ Run this workflow after implementation passes tests:
1171
+
1172
+ ```bash
1173
+ # 1. Verify all tests passing
1174
+ npm test
1175
+
1176
+ # 2. Auto-detect changes and sync docs
1177
+ ./scripts/detect-changes.sh
1178
+
1179
+ # 3. Follow post-implementation guide
1180
+ cat .codex/skills/genesis-harness/resources/post-implementation-guide.md
1181
+
1182
+ # 4. Update state tracking
1183
+ cat .codebase/IMPLEMENTATION_HANDOFF.md # Fill out
1184
+ cat .codebase/RECOVERY_POINTS.md # Fill out
1185
+
1186
+ # 5. Verify all docs in sync
1187
+ ./scripts/check-docs-sync.sh
1188
+ ```
1189
+
537
1190
  ## Docs Sync Rule
538
1191
 
539
- Whenever implementation changes behavior, API, data model, UI, integration, architecture, convention, config, environment variable, security behavior, or requirement, update all related docs.
540
-
541
- Possible docs include:
542
-
543
- - `.planning/REQUIREMENTS.md`
544
- - `.planning/API_DOCS.md`
545
- - `.planning/ARCHITECTURE.md`
546
- - `.planning/DESIGN.md`
547
- - `.planning/INTEGRATIONS.md`
548
- - `.planning/STACK.md`
549
- - `.planning/CONVENTIONS.md`
550
- - `.planning/ROADMAP.md`
551
- - `.planning/STATE.md`
552
- - `.planning/SPEC_CHANGELOG.md`
553
- - `.planning/QUALITY_SCORE.md`
554
- - `.planning/OBSERVABILITY.md`
555
- - `.planning/SMOKE_TESTS.md`
556
- - `.planning/JOURNEYS.md`
557
- - `.planning/diagrams/*.mmd`
558
- - `.planning/decisions/*.md`
559
- - `.planning/features/*/*.md`
560
- - `.planning/phases/*/*.md`
561
- - `.planning/bugs/*/*.md`
562
-
563
- If no docs need updating, explicitly explain why in the final report.
1192
+ **CRITICAL**: Whenever implementation changes behavior, API, data model, UI, integration, architecture, convention, config, environment variable, security behavior, or requirement, update ALL related docs.
1193
+
1194
+ Reference `.planning/CHANGE_IMPACT_MATRIX.md` to identify which docs must be updated based on change type.
1195
+
1196
+ Possible docs to update:
1197
+
1198
+ - `.planning/REQUIREMENTS.md` - If feature/behavior/requirement changed
1199
+ - `.planning/API_DOCS.md` - If endpoints/schemas/auth changed
1200
+ - `.planning/ARCHITECTURE.md` - If module boundaries/data flow changed
1201
+ - `.planning/DESIGN.md` - If UI/UX/screens/components changed
1202
+ - `.planning/INTEGRATIONS.md` - If external services/env vars changed
1203
+ - `.planning/STACK.md` - If tech stack/versions/commands changed
1204
+ - `.planning/CONVENTIONS.md` - If patterns/style/rules changed
1205
+ - `.planning/ROADMAP.md` - If timeline/phases/priorities changed
1206
+ - `.planning/STATE.md` - ALWAYS update (current phase, active work, next task)
1207
+ - `.planning/SPEC_CHANGELOG.md` - ALWAYS update (date, reason, impacted docs)
1208
+ - `.planning/QUALITY_SCORE.md` - Update with new metrics
1209
+ - `.planning/OBSERVABILITY.md` - If logging/metrics/traces changed
1210
+ - `.planning/SMOKE_TESTS.md` - If verification paths changed
1211
+ - `.planning/JOURNEYS.md` - If user flows changed
1212
+ - `.planning/diagrams/*.mmd` - If architecture/flow changed
1213
+ - `.planning/decisions/*.md` - If ADR-level changes made
1214
+ - `.planning/features/*/*.md` - Update feature folder docs
1215
+ - `.planning/FEATURE_INDEX.md` - Update feature table
1216
+
1217
+ **Docs Sync Checklist (from TASKS.md)**:
1218
+ - [ ] Check CHANGE_IMPACT_MATRIX.md for required updates
1219
+ - [ ] Update all applicable docs from list above
1220
+ - [ ] Add entry to SPEC_CHANGELOG.md with date and reason
1221
+ - [ ] Update STATE.md and SUMMARY.md
1222
+ - [ ] Recalculate QUALITY_SCORE.md
1223
+
1224
+ If no docs need updating, explicitly state why in the completion report (e.g., "Internal refactor, no behavior change").
564
1225
 
565
1226
  ## Decision Record Rule
566
1227