codex-genesis-harness 0.1.7 → 0.1.9

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