codex-genesis-harness 0.1.1 → 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 (180) hide show
  1. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -0
  2. package/.codebase/CURRENT_STATE.md +2 -0
  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/.codex/skills/genesis-api-sync/SKILL.md +354 -0
  15. package/.codex/skills/genesis-api-sync/agents/openai.yaml +7 -0
  16. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -0
  17. package/.codex/skills/genesis-api-sync/examples/example.md +68 -0
  18. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -0
  19. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -0
  20. package/.codex/skills/genesis-debug-guide/agents/openai.yaml +7 -0
  21. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -0
  22. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -0
  23. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -0
  24. package/.codex/skills/genesis-debug-guide/examples/example.md +48 -0
  25. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -0
  26. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -0
  27. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -0
  28. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -0
  29. package/.codex/skills/genesis-docs-automation/agents/openai.yaml +7 -0
  30. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -0
  31. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -0
  32. package/.codex/skills/genesis-docs-automation/examples/example.md +59 -0
  33. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -0
  34. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -0
  35. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -0
  36. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -0
  37. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -0
  38. package/.codex/skills/genesis-harness/SKILL.md +734 -82
  39. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -0
  40. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -0
  41. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -0
  42. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -0
  43. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -0
  44. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -0
  45. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -0
  46. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -0
  47. package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +23 -23
  48. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +24 -24
  49. package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +21 -21
  50. package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +46 -46
  51. package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +24 -24
  52. package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +25 -25
  53. package/.codex/skills/genesis-harness/scripts/compact-context.sh +54 -0
  54. package/.codex/skills/genesis-harness/scripts/create-adr.sh +74 -74
  55. package/.codex/skills/genesis-harness/scripts/create-bug.sh +160 -160
  56. package/.codex/skills/genesis-harness/scripts/create-feature.sh +217 -217
  57. package/.codex/skills/genesis-harness/scripts/detect-stack.sh +26 -26
  58. package/.codex/skills/genesis-harness/scripts/init-planning.sh +750 -719
  59. package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +12 -12
  60. package/.codex/skills/genesis-harness/scripts/offload-log.sh +72 -0
  61. package/.codex/skills/genesis-harness/scripts/run-verification.sh +47 -47
  62. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +75 -0
  63. package/.codex/skills/genesis-harness/scripts/update-state.sh +33 -33
  64. package/.codex/skills/genesis-harness-engineering/SKILL.md +159 -0
  65. package/.codex/skills/genesis-harness-engineering/checklists/checklist.md +48 -0
  66. package/.codex/skills/genesis-harness-engineering/examples/example.md +57 -0
  67. package/.codex/skills/genesis-harness-engineering/playbooks/harness-evolution.md +99 -0
  68. package/.codex/skills/genesis-harness-engineering/templates/harness-change-template.md +37 -0
  69. package/.codex/skills/genesis-observability-automation/SKILL.md +382 -0
  70. package/.codex/skills/genesis-observability-automation/agents/openai.yaml +7 -0
  71. package/.codex/skills/genesis-observability-automation/examples/example.md +86 -0
  72. package/.codex/skills/genesis-performance-profiling/SKILL.md +510 -0
  73. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +6 -0
  74. package/.codex/skills/genesis-performance-profiling/checklists/optimization-verification.md +199 -0
  75. package/.codex/skills/genesis-performance-profiling/checklists/performance-baseline.md +183 -0
  76. package/.codex/skills/genesis-performance-profiling/examples/example.md +234 -0
  77. package/.codex/skills/genesis-performance-profiling/observability/performance-tracking.md +202 -0
  78. package/.codex/skills/genesis-performance-profiling/playbooks/load-testing-orchestration.md +593 -0
  79. package/.codex/skills/genesis-performance-profiling/playbooks/profiling-playbook.md +601 -0
  80. package/.codex/skills/genesis-performance-profiling/templates/load-test-config-template.md +428 -0
  81. package/.codex/skills/genesis-performance-profiling/templates/performance-report-template.md +238 -0
  82. package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -0
  83. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +7 -0
  84. package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -0
  85. package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -0
  86. package/.codex/skills/genesis-release-orchestration/examples/example.md +78 -0
  87. package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -0
  88. package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -0
  89. package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -0
  90. package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -0
  91. package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -0
  92. package/.codex/skills/genesis-research-first/SKILL.md +237 -0
  93. package/.codex/skills/genesis-research-first/agents/openai.yaml +7 -0
  94. package/.codex/skills/genesis-research-first/examples/example.md +85 -0
  95. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -0
  96. package/.codex/skills/genesis-spec-propagation/agents/openai.yaml +7 -0
  97. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -0
  98. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -0
  99. package/.codex/skills/genesis-spec-propagation/examples/example.md +63 -0
  100. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -0
  101. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -0
  102. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -0
  103. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -0
  104. package/.codex/skills/spec-impact-engine/SKILL.md +504 -0
  105. package/.codex/skills/spec-impact-engine/agents/openai.yaml +7 -0
  106. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +262 -0
  107. package/.codex/skills/spec-impact-engine/examples/example.md +98 -0
  108. package/.codex/skills/spec-impact-engine/templates/impact-report.md +248 -0
  109. package/.codex/skills/spec-impact-engine/templates/migration-guide.md +223 -0
  110. package/.codex-plugin/plugin.json +1 -1
  111. package/README.EN.md +719 -0
  112. package/README.VI.md +712 -0
  113. package/README.md +261 -107
  114. package/VERSION +1 -1
  115. package/bin/genesis-harness.js +20 -11
  116. package/package.json +1 -1
  117. package/scripts/README.md +342 -0
  118. package/scripts/compact-context.sh +54 -0
  119. package/scripts/detect-changes.sh +152 -0
  120. package/scripts/install.sh +50 -41
  121. package/scripts/offload-log.sh +72 -0
  122. package/scripts/run-evals.sh +70 -43
  123. package/scripts/run-verify-loop.sh +75 -0
  124. package/scripts/uninstall.sh +52 -43
  125. package/scripts/verify.sh +165 -73
  126. package/.codex/skills/harness-engineering-skill/SKILL.md +0 -45
  127. package/.codex/skills/harness-engineering-skill/checklists/checklist.md +0 -8
  128. package/.codex/skills/harness-engineering-skill/examples/example.md +0 -4
  129. package/.codex/skills/harness-engineering-skill/templates/harness-change-template.md +0 -8
  130. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/SKILL.md +0 -0
  131. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/agents/openai.yaml +0 -0
  132. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/checklists/checklist.md +0 -0
  133. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/examples/example.md +0 -0
  134. /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/templates/provider-contract-template.md +0 -0
  135. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/SKILL.md +0 -0
  136. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/agents/openai.yaml +0 -0
  137. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/checklists/checklist.md +0 -0
  138. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/examples/example.md +0 -0
  139. /package/.codex/skills/{api-contract-skill → genesis-api-contract}/templates/api-contract-template.md +0 -0
  140. /package/.codex/skills/{architecture-skill → genesis-architecture}/SKILL.md +0 -0
  141. /package/.codex/skills/{architecture-skill → genesis-architecture}/agents/openai.yaml +0 -0
  142. /package/.codex/skills/{architecture-skill → genesis-architecture}/checklists/checklist.md +0 -0
  143. /package/.codex/skills/{architecture-skill → genesis-architecture}/examples/example.md +0 -0
  144. /package/.codex/skills/{architecture-skill → genesis-architecture}/templates/architecture-decision-template.md +0 -0
  145. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/SKILL.md +0 -0
  146. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/agents/openai.yaml +0 -0
  147. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/checklists/checklist.md +0 -0
  148. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/examples/example.md +0 -0
  149. /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/templates/map-update-template.md +0 -0
  150. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/SKILL.md +0 -0
  151. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/agents/openai.yaml +0 -0
  152. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/checklists/checklist.md +0 -0
  153. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/examples/example.md +0 -0
  154. /package/.codex/skills/{design-spec-skill → genesis-design-spec}/templates/design-spec-template.md +0 -0
  155. /package/.codex/skills/{docs-skill → genesis-docs}/SKILL.md +0 -0
  156. /package/.codex/skills/{docs-skill → genesis-docs}/agents/openai.yaml +0 -0
  157. /package/.codex/skills/{docs-skill → genesis-docs}/checklists/checklist.md +0 -0
  158. /package/.codex/skills/{docs-skill → genesis-docs}/examples/example.md +0 -0
  159. /package/.codex/skills/{docs-skill → genesis-docs}/templates/docs-update-template.md +0 -0
  160. /package/.codex/skills/{harness-engineering-skill → genesis-harness-engineering}/agents/openai.yaml +0 -0
  161. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/SKILL.md +0 -0
  162. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/agents/openai.yaml +0 -0
  163. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/checklists/checklist.md +0 -0
  164. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/examples/example.md +0 -0
  165. /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/templates/orchestration-template.md +0 -0
  166. /package/.codex/skills/{planning-skill → genesis-planning}/SKILL.md +0 -0
  167. /package/.codex/skills/{planning-skill → genesis-planning}/agents/openai.yaml +0 -0
  168. /package/.codex/skills/{planning-skill → genesis-planning}/checklists/checklist.md +0 -0
  169. /package/.codex/skills/{planning-skill → genesis-planning}/examples/example.md +0 -0
  170. /package/.codex/skills/{planning-skill → genesis-planning}/templates/plan-template.md +0 -0
  171. /package/.codex/skills/{release-skill → genesis-release}/SKILL.md +0 -0
  172. /package/.codex/skills/{release-skill → genesis-release}/agents/openai.yaml +0 -0
  173. /package/.codex/skills/{release-skill → genesis-release}/checklists/checklist.md +0 -0
  174. /package/.codex/skills/{release-skill → genesis-release}/examples/example.md +0 -0
  175. /package/.codex/skills/{release-skill → genesis-release}/templates/release-checklist-template.md +0 -0
  176. /package/.codex/skills/{research-skill → genesis-research}/SKILL.md +0 -0
  177. /package/.codex/skills/{research-skill → genesis-research}/agents/openai.yaml +0 -0
  178. /package/.codex/skills/{research-skill → genesis-research}/checklists/checklist.md +0 -0
  179. /package/.codex/skills/{research-skill → genesis-research}/examples/example.md +0 -0
  180. /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/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
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,22 @@ 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
+ - `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.
114
184
  - `detect-stack.sh`: inspects repository stack clues.
115
185
  - `list-changed-files.sh`: lists git changes when git is available.
116
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.
117
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.
118
190
 
119
191
  ## `/init` Workflow
120
192
 
121
193
  When the user types `/init`, initialize the project planning harness. Before creating files, inspect the current repository.
122
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
+
123
197
  Look for:
124
198
 
125
199
  - `README.md`
@@ -157,6 +231,9 @@ Out of scope:
157
231
  Assumptions:
158
232
 
159
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.
160
237
  ```
161
238
 
162
239
  If the app idea is missing or ambiguous, stop and ask:
@@ -172,7 +249,21 @@ If the app idea is missing or ambiguous, stop and ask:
172
249
 
173
250
  Do not create implementation code until the project idea is confirmed.
174
251
 
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.
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.
176
267
 
177
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.
178
269
 
@@ -286,14 +377,20 @@ Work is done only when:
286
377
 
287
378
  - [x] implementation is complete and scoped to the plan
288
379
  - [x] automated tests or documented verification passed
289
- - [x] docs were synchronized, or no-docs-needed was justified
380
+ - [x] docs were synchronized (see Docs Sync Rule below)
290
381
  - [x] task tracking moved from `[ ]` or `[~]` to `[x]`
291
- - [x] `STATE.md`, `SUMMARY.md`, and feature/bug/phase tracking are current
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
292
387
  - [x] changed files were reviewed
293
388
  - [x] debug logs, dead code, unrelated edits, and unnecessary files were removed
294
389
  - [x] risks and follow-up tasks are recorded
295
390
 
296
- Never use completion language until the Definition of Done is satisfied.
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.
297
394
 
298
395
  ## Research Rule
299
396
 
@@ -356,7 +453,50 @@ A feature must also have `.planning/features/NNN-feature-name/DIAGRAM.mmd`. Do n
356
453
 
357
454
  ## `/new-feature` Workflow
358
455
 
359
- When adding a new feature, first read:
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:
360
500
 
361
501
  ```txt
362
502
  .planning/SUMMARY.md
@@ -368,7 +508,27 @@ When adding a new feature, first read:
368
508
  .planning/STACK.md
369
509
  ```
370
510
 
371
- Then research local patterns and best practices. Create:
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:
372
532
 
373
533
  ```txt
374
534
  .planning/features/NNN-feature-slug/
@@ -400,13 +560,100 @@ Docs impact:
400
560
 
401
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.
402
562
 
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.
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]
404
610
 
405
611
  Prefer `scripts/create-feature.sh` for the initial folder and file scaffold, then fill the generated files with task-specific content.
406
612
 
407
613
  ## `/fix-bug` Workflow
408
614
 
409
- Before fixing a bug, always read:
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:
410
657
 
411
658
  ```txt
412
659
  .planning/PITFALLS.md
@@ -429,11 +676,52 @@ Then reproduce and diagnose before changing code. Create:
429
676
  └── REVIEW.md
430
677
  ```
431
678
 
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`:
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`:
437
725
 
438
726
  ```md
439
727
  ## Bug: <name>
@@ -449,7 +737,305 @@ Verification:
449
737
 
450
738
  Never fix the same type of bug without checking `LESSONS_LEARNED.md`.
451
739
 
452
- ## `/plan` Workflow
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`
453
1039
 
454
1040
  When the user asks for a plan:
455
1041
 
@@ -534,33 +1120,99 @@ If no test framework exists, create a minimal verification script, document manu
534
1120
 
535
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.
536
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
+
537
1181
  ## Docs Sync Rule
538
1182
 
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.
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").
564
1216
 
565
1217
  ## Decision Record Rule
566
1218