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.
- package/.codebase/COMPRESSED_CONTEXT.md +80 -0
- package/.codebase/CURRENT_STATE.md +10 -10
- package/.codebase/DEPENDENCY_GRAPH.md +14 -1
- package/.codebase/IMPLEMENTATION_HANDOFF.md +34 -336
- package/.codebase/KNOWN_PROBLEMS.md +73 -3
- package/.codebase/MODULE_INDEX.md +23 -2
- package/.codebase/PIPELINE_FLOW.md +16 -6
- package/.codebase/RECOVERY_POINTS.md +80 -78
- package/.codebase/TECH_DEBT.md +6 -0
- package/.codebase/TEST_MATRIX.md +8 -3
- package/.codebase/VISUAL_GRAPH.md +127 -0
- package/.codebase/context-policy.json +68 -0
- package/.codebase/memories/lessons_learned.md +63 -0
- package/.codebase/memories/preferences.md +17 -0
- package/.codebase/state.json +156 -17
- package/.codex/skills/genesis-architecture/SKILL.md +5 -0
- package/.codex/skills/genesis-debug-guide/SKILL.md +10 -4
- package/.codex/skills/genesis-docs-automation/SKILL.md +52 -973
- package/.codex/skills/genesis-executing-plans/SKILL.md +54 -0
- package/.codex/skills/genesis-executing-plans/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-executing-plans/checklists/.gitkeep +0 -0
- package/.codex/skills/genesis-executing-plans/examples/.gitkeep +0 -0
- package/.codex/skills/genesis-executing-plans/templates/.gitkeep +0 -0
- package/.codex/skills/genesis-harness/SKILL.md +73 -1385
- package/.codex/skills/genesis-harness/agents/openai.yaml +1 -2
- package/.codex/skills/genesis-harness/references/state-machine.md +4 -1
- package/.codex/skills/genesis-harness/references/workflows.md +7 -1
- package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +3 -3
- package/.codex/skills/genesis-harness/scripts/init-planning.sh +246 -14
- package/.codex/skills/genesis-new-design/SKILL.md +4 -1
- package/.codex/skills/genesis-new-design/agents/openai.yaml +2 -0
- package/.codex/skills/genesis-observability-automation/SKILL.md +69 -303
- package/.codex/skills/genesis-observability-automation/references/common-mistakes-and-recovery.md +84 -0
- package/.codex/skills/genesis-observability-automation/references/workflow-phases.md +78 -0
- package/.codex/skills/genesis-performance-profiling/SKILL.md +1 -22
- package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +1 -1
- package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +15 -3
- package/.codex/skills/genesis-planning/SKILL.md +6 -1
- package/.codex/skills/genesis-release/SKILL.md +5 -0
- package/.codex/skills/genesis-research-first/SKILL.md +6 -0
- package/.codex/skills/genesis-spec-propagation/SKILL.md +52 -504
- package/.codex/skills/genesis-test-driven-development/SKILL.md +55 -0
- package/.codex/skills/genesis-test-driven-development/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-test-driven-development/checklists/.gitkeep +0 -0
- package/.codex/skills/genesis-test-driven-development/examples/.gitkeep +0 -0
- package/.codex/skills/genesis-test-driven-development/templates/.gitkeep +0 -0
- package/.codex/skills/genesis-upgrade-design/SKILL.md +4 -2
- package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +2 -0
- package/.codex/skills/genesis-using-git-worktrees/SKILL.md +54 -0
- package/.codex/skills/genesis-using-git-worktrees/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-using-git-worktrees/checklists/.gitkeep +0 -0
- package/.codex/skills/genesis-using-git-worktrees/examples/.gitkeep +0 -0
- package/.codex/skills/genesis-using-git-worktrees/templates/.gitkeep +0 -0
- package/.codex/skills/genesis-verification-before-completion/SKILL.md +53 -0
- package/.codex/skills/genesis-verification-before-completion/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-verification-before-completion/checklists/.gitkeep +0 -0
- package/.codex/skills/genesis-verification-before-completion/examples/.gitkeep +0 -0
- package/.codex/skills/genesis-verification-before-completion/templates/.gitkeep +0 -0
- package/.codex/skills/spec-impact-engine/SKILL.md +77 -500
- package/.codex/skills/spec-impact-engine/checklists/checklist.md +10 -0
- package/.codex-plugin/plugin.json +6 -5
- package/CHANGELOG.md +25 -1
- package/README.EN.md +74 -17
- package/README.VI.md +77 -19
- package/README.md +126 -10
- package/VERSION +1 -2
- package/bin/genesis-harness.js +2979 -149
- package/contracts/features/project-registry-schema.json +37 -0
- package/contracts/features/registry-schema.json +15 -0
- package/contracts/observability/agent-run-schema.json +39 -0
- package/contracts/observability/failure-schema.json +35 -0
- package/contracts/ui/auth/login-screen-contract.json +43 -0
- package/features/REGISTRY.md +65 -0
- package/features/SCOPE-template.md +65 -0
- package/fixtures/pipeline/end-to-end-project-lifecycle-fixture.md +39 -0
- package/fixtures/pipeline/feature-completion-fixture.md +26 -0
- package/fixtures/pipeline/run-to-feature-execution-fixture.md +20 -0
- package/fixtures/planning/MOCKUP_PROMPT_TEMPLATE.md +16 -0
- package/observability/agent-runs/sample-run.json +13 -0
- package/observability/decision-logs/sample-decision.md +43 -0
- package/observability/failures/sample-failure.json +12 -0
- package/package.json +15 -4
- package/playwright/e2e/app-template.spec.js +37 -0
- package/playwright/e2e/auth/login-screen.spec.js +65 -0
- package/playwright/e2e/web-template.spec.js +28 -0
- package/scripts/check-repository-hygiene.js +48 -0
- package/scripts/check-scope.sh +100 -0
- package/scripts/cold-start-check.js +133 -0
- package/scripts/install.sh +4 -0
- package/scripts/prompt_sentinel.js +35 -4
- package/scripts/run-evals.sh +152 -3
- package/scripts/schema/001-init.sql +129 -0
- package/scripts/schema/002-story-verify.sql +9 -0
- package/scripts/schema/003-tool-registry.sql +15 -0
- package/scripts/schema/004-intervention.sql +15 -0
- package/scripts/scratch_parser.js +49 -0
- package/scripts/spec_visual_sync.js +1 -1
- package/scripts/test_generator.js +2 -2
- package/scripts/transition_state.sh +32 -8
- package/scripts/uninstall.sh +4 -0
- package/scripts/validation_gates.sh +2 -80
- package/scripts/verify.sh +19 -2
- package/tests/fixtures/fixture-index.md +5 -0
- package/tests/integration/cli-smoke.test.js +506 -0
- package/tests/unit/feature_registry.test.js +152 -0
- package/tests/unit/prompt_sentinel.test.js +1 -1
- package/tests/unit/repository_hygiene.test.js +17 -0
- package/tests/unit/spec_visual_sync.test.js +1 -1
- package/tests/unit/state_metadata.test.js +76 -0
- package/tests/unit/test_generator.test.js +1 -1
- package/tests/unit/verify_gate.test.js +25 -0
- package/tests/unit/workflow_contracts.test.js +90 -0
- package/fixtures/tts/tts-fixture-template.md +0 -14
- package/fixtures/videos/video-fixture-template.md +0 -14
- package/playwright/e2e/e2e-template.md +0 -4
|
@@ -3,4 +3,4 @@ interface:
|
|
|
3
3
|
short_description: "Automate performance baseline, profiling, and load testing"
|
|
4
4
|
default_prompt: "Use $genesis-performance-profiling to establish baseline and identify bottlenecks."
|
|
5
5
|
policy:
|
|
6
|
-
allow_implicit_invocation:
|
|
6
|
+
allow_implicit_invocation: true
|
|
@@ -18,7 +18,20 @@ Do not use for small read-only questions.
|
|
|
18
18
|
Goal, current state, module index, test matrix, contracts, fixtures, and acceptance criteria.
|
|
19
19
|
|
|
20
20
|
## Outputs required
|
|
21
|
-
Phase logs, tests, fixtures, implementation, contracts, memory updates, docs updates, and change summary.
|
|
21
|
+
Phase logs, a machine-readable feature queue, tests, fixtures, implementation, contracts, project verification evidence, a final handoff, memory updates, docs updates, and change summary.
|
|
22
|
+
|
|
23
|
+
## Runtime lifecycle
|
|
24
|
+
Use the CLI as the durable control plane:
|
|
25
|
+
|
|
26
|
+
1. `genesis-harness run --idea ...` creates the first execution-ready feature.
|
|
27
|
+
2. `genesis-harness add-feature ...` appends additional planned features.
|
|
28
|
+
3. `genesis-harness next` resolves the single active feature.
|
|
29
|
+
4. `genesis-harness complete-feature ...` verifies that feature and promotes the next queued feature.
|
|
30
|
+
5. After the final feature, `genesis-harness verify-project ...` reruns every feature proof plus the project proof and creates the handoff.
|
|
31
|
+
6. `genesis-harness complete-project ...` moves `RELEASE_READY` to `COMPLETED`.
|
|
32
|
+
7. `genesis-harness pipeline-audit` checks queue, state, proof, handoff, and event-history consistency.
|
|
33
|
+
|
|
34
|
+
Do not treat feature completion as project completion.
|
|
22
35
|
|
|
23
36
|
## Required tests
|
|
24
37
|
Create failing tests in Phase 1 before implementation.
|
|
@@ -42,5 +55,4 @@ No phase is skipped and the final report includes verification evidence.
|
|
|
42
55
|
Combining phases, implementing before fixtures, and leaving state non-resumable.
|
|
43
56
|
|
|
44
57
|
## Recovery workflow
|
|
45
|
-
If interrupted, resume from
|
|
46
|
-
|
|
58
|
+
If interrupted, resume from `.runs/<session-id>/STATE.json`, `RESUME.md`, and append-only `EVENTS.jsonl`, then rerun the relevant verification before continuing.
|
|
@@ -44,6 +44,11 @@ Planning implementation before tests, omitting fixtures, and leaving verificatio
|
|
|
44
44
|
## Recovery workflow
|
|
45
45
|
If a plan becomes invalid, update the failing test and fixture first, then revise phases.
|
|
46
46
|
|
|
47
|
+
## MCP Automation Requirements
|
|
48
|
+
|
|
49
|
+
To ensure plans are grounded in long-term project context and not just short-term conversation history, you **MUST** use the following MCP server:
|
|
50
|
+
1. **`@modelcontextprotocol/server-memory`**: Use this MCP tool to automatically query the Knowledge Graph for past bugs, developer preferences, and architectural rules *before* drafting the implementation phases. Any new plan must respect the persistent memory graph.
|
|
51
|
+
|
|
47
52
|
---
|
|
48
53
|
|
|
49
54
|
## 🏗️ 5-Phase MVP Roadmap Standards
|
|
@@ -58,7 +63,7 @@ When decomposing large-scale features or initializing new project modules, you m
|
|
|
58
63
|
- Auto-generate test skeletons in `tests/integration/` (RED state).
|
|
59
64
|
3. **Phase 3: Logic Implementation & Self-Healing** (Template: `phase-3-features.md`)
|
|
60
65
|
- Implement minimal code handlers, controllers, or service endpoints.
|
|
61
|
-
- Execute closed-loop Verify-Fix cycles autonomously until all tests turn GREEN.
|
|
66
|
+
- Execute closed-loop Verify-Fix cycles autonomously until all tests turn GREEN. **CRITICAL**: Do NOT just run `npm test`. You MUST run `npx genesis-harness heal "<test-command>"`. If the test fails, this command will output an `[AGENT_DIRECTIVE]`. You must read the directive and automatically fix the code until it passes without stopping.
|
|
62
67
|
4. **Phase 4: Multi-Agent & External Integrations** (Template: `phase-4-integrations.md`)
|
|
63
68
|
- Wire up external components, API sync triggers, or media providers.
|
|
64
69
|
5. **Phase 5: E2E Visual QA & Release Readiness** (Template: `phase-5-readiness.md`)
|
|
@@ -44,6 +44,11 @@ Publishing cache files, missing executable scripts, and omitting npm 2FA/token r
|
|
|
44
44
|
## Recovery workflow
|
|
45
45
|
If publish fails, capture error, update known problems, do not change version until root cause is fixed.
|
|
46
46
|
|
|
47
|
+
## MCP Automation Requirements
|
|
48
|
+
|
|
49
|
+
To ensure zero human error in releases and tags, you **MUST** use the following MCP server:
|
|
50
|
+
1. **`@modelcontextprotocol/server-github`**: Use this MCP tool to automatically retrieve the list of closed Pull Requests since the last release tag to draft the `CHANGELOG.md` and Release Notes. You must also use it to automatically create the Git Tag and GitHub Release via the API. Do NOT ask the user to do this manually in the browser.
|
|
51
|
+
|
|
47
52
|
---
|
|
48
53
|
|
|
49
54
|
## 🚀 Automated Release & Deployment Orchestration
|
|
@@ -84,6 +84,12 @@ Format:
|
|
|
84
84
|
- Next Steps: What to verify?
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
## MCP Automation Requirements
|
|
88
|
+
|
|
89
|
+
To prevent hallucinations and avoid manual terminal scraping, you **MUST** use the following MCP servers during research:
|
|
90
|
+
1. **`@modelcontextprotocol/server-fetch`**: Use this MCP tool to natively fetch and read the contents of external documentation URLs or Stack Overflow threads. Do NOT guess the API structure.
|
|
91
|
+
2. **`@modelcontextprotocol/server-github`**: Use this MCP tool to search for existing issues, pull requests, or trending repositories related to the task.
|
|
92
|
+
|
|
87
93
|
## Output
|
|
88
94
|
|
|
89
95
|
Each research produces:
|
|
@@ -1,534 +1,82 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: genesis-spec-propagation
|
|
3
|
-
description: "Automated specification propagation across project phases.
|
|
3
|
+
description: "Automated specification propagation across project phases. Use after spec changes to update affected tests, contracts, client expectations, E2E scenarios, docs, and migration guidance."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Genesis Spec Propagation
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
|
-
|
|
10
|
-
Automate cascade propagation of spec changes across all project phases. When Phase 1 API changes, automatically detect affected phases (2-5), update downstream tests, contracts, client SDK types, and E2E scenarios, and generate migration guides for breaking changes. Reduces 45+ min manual update work to 5 min automated propagation.
|
|
9
|
+
Prevent downstream phase drift after a spec change by identifying affected phases, updating dependent artifacts, and validating alignment.
|
|
11
10
|
|
|
12
11
|
## When to use
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
✅ After SPEC_CHANGELOG.md entry created → Identifies affected phases (from notes)
|
|
18
|
-
✅ Before release/deployment → Validates all phases still aligned
|
|
12
|
+
- After `/spec-change` or a contract/spec edit.
|
|
13
|
+
- When API, database, UI, auth, config, or integration shape changes.
|
|
14
|
+
- Before starting downstream work that depends on an updated upstream phase.
|
|
15
|
+
- When `spec-impact-engine` reports affected phases.
|
|
19
16
|
|
|
20
17
|
## When NOT to use
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- For internal refactoring that preserves all public contracts
|
|
18
|
+
- Pure prose edits that do not alter behavior, schemas, routes, or phase dependencies.
|
|
19
|
+
- One-off implementation bugs where no public or phase contract changed.
|
|
20
|
+
- Cosmetic docs edits with no downstream dependency.
|
|
25
21
|
|
|
26
22
|
## Inputs required
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- Current
|
|
31
|
-
- Old vs new spec content (for diff analysis)
|
|
23
|
+
- Changed spec or contract files.
|
|
24
|
+
- Impact report from `spec-impact-engine` when available.
|
|
25
|
+
- `.codebase/PHASE_DEPENDENCY_MAP.md` or equivalent dependency notes.
|
|
26
|
+
- Current tests, fixtures, and docs for affected phases.
|
|
32
27
|
|
|
33
28
|
## Outputs required
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
- `
|
|
37
|
-
-
|
|
38
|
-
- Migration guide (for breaking changes only)
|
|
39
|
-
- Cross-phase validation report
|
|
29
|
+
- Updated downstream phase specs, mocks, tests, contracts, and E2E scenarios.
|
|
30
|
+
- Migration guide for breaking changes.
|
|
31
|
+
- Propagation summary in `.codebase` or observability logs.
|
|
32
|
+
- Verification evidence for affected phases.
|
|
40
33
|
|
|
41
34
|
## Required tests
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- Syntax validation of all updated files (JSON, TS, MD)
|
|
46
|
-
- Contract alignment test (Phase 3 response schema ⊂ Phase 4 type definitions)
|
|
35
|
+
- Run affected unit/integration/E2E checks where executable tests exist.
|
|
36
|
+
- Run `scripts/run-evals.sh` after changing propagation skill behavior.
|
|
37
|
+
- Validate all updated contracts and fixtures.
|
|
47
38
|
|
|
48
39
|
## Required fixtures
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
- Sample `SPEC_CHANGE_PROPAGATION.md` showing format
|
|
52
|
-
- Sample migration guide for a breaking field removal
|
|
40
|
+
- Update affected request/response, UI, agent, pipeline, or render fixtures.
|
|
41
|
+
- Add expected-output fixtures for generated migration or impact reports.
|
|
53
42
|
|
|
54
43
|
## Required contract updates
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- Update `SPEC_CHANGELOG.md` with propagation result
|
|
44
|
+
- Update `contracts/` before dependent tests or implementation.
|
|
45
|
+
- Mark breaking changes explicitly and include migration instructions.
|
|
46
|
+
- Keep `.codebase/API_CONTRACTS.md` and phase docs aligned.
|
|
59
47
|
|
|
60
48
|
## Required codebase map updates
|
|
61
|
-
|
|
62
|
-
- `.codebase/
|
|
63
|
-
- `.codebase/
|
|
64
|
-
- `.codebase/KNOWN_PROBLEMS.md`: Document any propagation failures
|
|
49
|
+
- Update `.codebase/CURRENT_STATE.md` with propagation status.
|
|
50
|
+
- Update `.codebase/TEST_MATRIX.md` if validation coverage changes.
|
|
51
|
+
- Update `.codebase/RECOVERY_POINTS.md` for unresolved propagation risks.
|
|
65
52
|
|
|
66
53
|
## Token saving rules
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- Report "Phase 2,3,4,5 affected" summary, not full impact text
|
|
71
|
-
- When validating: report only failing checks, not passing ones
|
|
72
|
-
- Reuse dependency graph across multiple operations in same session
|
|
54
|
+
- Read the impact report and phase dependency map before full specs.
|
|
55
|
+
- Load only affected phase files.
|
|
56
|
+
- Report failing or changed checks, not all passing detail.
|
|
73
57
|
|
|
74
58
|
## Acceptance criteria
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
- Cross-phase validation passes
|
|
80
|
-
- SPEC_CHANGELOG.md entry created
|
|
81
|
-
- Migration guide present for all breaking changes
|
|
82
|
-
- Pre-commit gate passes
|
|
59
|
+
- Every impacted downstream artifact is updated or explicitly marked non-applicable.
|
|
60
|
+
- Breaking changes have migration guidance.
|
|
61
|
+
- Affected verification passes.
|
|
62
|
+
- `.codebase` records propagation status and remaining risks.
|
|
83
63
|
|
|
84
64
|
## Common mistakes
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
- Treating non-breaking changes as breaking (causes unnecessary migration guides)
|
|
90
|
-
- Committing breaking changes without human approval
|
|
65
|
+
- Updating Phase 1 contracts without Phase 2-5 dependent tests.
|
|
66
|
+
- Auto-updating E2E expectations without semantic review.
|
|
67
|
+
- Omitting migration notes for breaking changes.
|
|
68
|
+
- Treating low severity as no-op without documenting why.
|
|
91
69
|
|
|
92
70
|
## Recovery workflow
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Phase 1: Change Detection (5 min)
|
|
107
|
-
|
|
108
|
-
**Input**: Spec change location (e.g., `contracts/api/response.json`)
|
|
109
|
-
|
|
110
|
-
**Process**:
|
|
111
|
-
1. **Identify Change Type**
|
|
112
|
-
- Breaking change? (field removed, type changed, required added)
|
|
113
|
-
- Feature change? (new field, new endpoint, new validation rule)
|
|
114
|
-
- Non-impact change? (doc update, example update, no structural change)
|
|
115
|
-
|
|
116
|
-
2. **Parse Change Impact**
|
|
117
|
-
- Old spec vs new spec comparison
|
|
118
|
-
- Breaking: List removed/changed fields, endpoints, validations
|
|
119
|
-
- Feature: List added fields, endpoints, optional extensions
|
|
120
|
-
|
|
121
|
-
3. **Identify Affected Phases** (using PHASE_DEPENDENCY_MAP.md)
|
|
122
|
-
```
|
|
123
|
-
Phase 1 API spec change →
|
|
124
|
-
Phase 2 tests need API response type updates
|
|
125
|
-
Phase 3 backend implementation affected
|
|
126
|
-
Phase 4 client SDK needs updates
|
|
127
|
-
Phase 5 integration tests need new scenarios
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
4. **Record in SPEC_CHANGELOG.md** (auto-append if not done)
|
|
131
|
-
```
|
|
132
|
-
- 2026-05-31T14:32:00Z | BREAKING | API response field 'user.avatar' removed
|
|
133
|
-
Affected: Phase 2 (test mocks), Phase 3 (API contract), Phase 4 (client SDK), Phase 5 (e2e tests)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**Output**: Change detection report (type, impact, affected phases)
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
### Phase 2: Downstream Impact Analysis (10 min)
|
|
141
|
-
|
|
142
|
-
**Input**: Change detection report + PHASE_DEPENDENCY_MAP.md
|
|
143
|
-
|
|
144
|
-
**Process**:
|
|
145
|
-
|
|
146
|
-
1. **Build Dependency Graph**
|
|
147
|
-
```
|
|
148
|
-
Phase 1 (API Contract)
|
|
149
|
-
├─→ Phase 2 (Tests)
|
|
150
|
-
├─→ Phase 3 (Backend Implementation)
|
|
151
|
-
└─→ Phase 4 (Client SDK)
|
|
152
|
-
|
|
153
|
-
Phase 2 (Tests)
|
|
154
|
-
├─→ Phase 3 (Implementation must pass tests)
|
|
155
|
-
└─→ Phase 5 (E2E tests)
|
|
156
|
-
|
|
157
|
-
Phase 3 (Backend Implementation)
|
|
158
|
-
├─→ Phase 4 (Client SDK)
|
|
159
|
-
└─→ Phase 5 (E2E tests)
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
2. **Trace Propagation Path** (DFS from change point)
|
|
163
|
-
- Direct dependents: Phase 2, 3, 4
|
|
164
|
-
- Transitive dependents: Phase 5
|
|
165
|
-
- List order of updates needed (topological sort)
|
|
166
|
-
|
|
167
|
-
3. **Identify Update Type Per Phase**
|
|
168
|
-
- Phase 2: Update mocks, test data, assertions
|
|
169
|
-
- Phase 3: Update API handler, response builder, validation
|
|
170
|
-
- Phase 4: Update client method signatures, serialization
|
|
171
|
-
- Phase 5: Add new scenarios, update expectations
|
|
172
|
-
|
|
173
|
-
4. **Check for Conflicts**
|
|
174
|
-
- Does this breaking change conflict with Phase 3 implementation?
|
|
175
|
-
- Does Phase 4 client have workarounds we need to update?
|
|
176
|
-
- Are there Phase 5 tests that would break?
|
|
177
|
-
|
|
178
|
-
5. **Estimate Manual Work**
|
|
179
|
-
- Breaking change: 2-4 hours (requires design decisions)
|
|
180
|
-
- Feature change: 30-60 minutes
|
|
181
|
-
- Non-impact: 5-10 minutes
|
|
182
|
-
|
|
183
|
-
**Output**: Impact analysis (affected phases, update type per phase, conflict flags, time estimate)
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
### Phase 3: Automatic Phase Updates (15 min)
|
|
188
|
-
|
|
189
|
-
**Input**: Impact analysis + affected contract files
|
|
190
|
-
|
|
191
|
-
**Process**:
|
|
192
|
-
|
|
193
|
-
1. **Update Phase 2 (Tests)**
|
|
194
|
-
- Read current test files (e.g., `tests/api-mocks.test.js`)
|
|
195
|
-
- Update mock data to match new API spec
|
|
196
|
-
- Update assertions to match new field types/presence
|
|
197
|
-
- Update test descriptions for new scenarios
|
|
198
|
-
- Output: Updated test file + change summary
|
|
199
|
-
|
|
200
|
-
2. **Update Phase 3 (Backend Implementation)**
|
|
201
|
-
- Read current API contract (`contracts/api/response.json`)
|
|
202
|
-
- Update response schema to match API spec
|
|
203
|
-
- Add migration notes (if breaking change)
|
|
204
|
-
- Update backend handler docstring
|
|
205
|
-
- Output: Updated contract + handler docs
|
|
206
|
-
|
|
207
|
-
3. **Update Phase 4 (Client SDK)**
|
|
208
|
-
- Read current client types (`types/api.ts`)
|
|
209
|
-
- Update interface definitions
|
|
210
|
-
- Update serialization logic if needed
|
|
211
|
-
- Add deprecation warnings for removed fields
|
|
212
|
-
- Output: Updated types + deprecation notice
|
|
213
|
-
|
|
214
|
-
4. **Update Phase 5 (E2E Tests)**
|
|
215
|
-
- Read current e2e scenarios (`playwright/e2e/scenarios.md`)
|
|
216
|
-
- Add new test scenarios for new fields
|
|
217
|
-
- Update assertions for changed fields
|
|
218
|
-
- Output: Updated scenarios + new test cases
|
|
219
|
-
|
|
220
|
-
5. **Generate Migration Guide** (for breaking changes only)
|
|
221
|
-
- What changed & why
|
|
222
|
-
- Migration steps for downstream consumers
|
|
223
|
-
- Backward compatibility period (if any)
|
|
224
|
-
- Rollback procedure
|
|
225
|
-
|
|
226
|
-
**Automatic Updates**: Use text replacement templates to update files systematically
|
|
227
|
-
**Manual Review Point**: Breaking changes require human approval before commit
|
|
228
|
-
|
|
229
|
-
**Output**: Updated phase files + migration guide (if needed)
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Implementation Strategy
|
|
234
|
-
|
|
235
|
-
### Change Detection Logic
|
|
236
|
-
|
|
237
|
-
```javascript
|
|
238
|
-
// Pseudocode: Detect spec change type
|
|
239
|
-
function analyzeSpecChange(oldSpec, newSpec) {
|
|
240
|
-
const changes = {
|
|
241
|
-
breaking: [],
|
|
242
|
-
feature: [],
|
|
243
|
-
nonImpact: []
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
// Check for removed/modified fields (BREAKING)
|
|
247
|
-
for (const field in oldSpec.properties) {
|
|
248
|
-
if (!newSpec.properties[field]) {
|
|
249
|
-
changes.breaking.push(`Removed field: ${field}`);
|
|
250
|
-
} else if (oldSpec.properties[field].type !== newSpec.properties[field].type) {
|
|
251
|
-
changes.breaking.push(`Changed type: ${field}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Check for new fields (FEATURE)
|
|
256
|
-
for (const field in newSpec.properties) {
|
|
257
|
-
if (!oldSpec.properties[field]) {
|
|
258
|
-
changes.feature.push(`Added field: ${field}`);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// Check for non-structural changes (NON-IMPACT)
|
|
263
|
-
if (oldSpec.description !== newSpec.description) {
|
|
264
|
-
changes.nonImpact.push(`Updated description`);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return changes;
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Phase Dependency Mapping
|
|
272
|
-
|
|
273
|
-
**File**: `.codebase/PHASE_DEPENDENCY_MAP.md`
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
# Phase Dependency Map
|
|
277
|
-
|
|
278
|
-
## Direct Dependencies
|
|
279
|
-
- Phase 1 (Contracts) → Phase 2, 3, 4
|
|
280
|
-
- Phase 2 (Tests) → Phase 3, 5
|
|
281
|
-
- Phase 3 (Implementation) → Phase 4, 5
|
|
282
|
-
- Phase 4 (SDK) → Phase 5
|
|
283
|
-
- Phase 5 (E2E) → Release
|
|
284
|
-
|
|
285
|
-
## Change Impact Rules
|
|
286
|
-
- API contract change → Tests, Backend, Client, E2E
|
|
287
|
-
- DB schema change → Backend, Migrations, Tests
|
|
288
|
-
- UI spec change → Frontend, E2E tests
|
|
289
|
-
- Breaking change → Higher priority, requires review
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Auto-Update Templates
|
|
293
|
-
|
|
294
|
-
**Pattern 1: Mock Data Update**
|
|
295
|
-
```javascript
|
|
296
|
-
// OLD
|
|
297
|
-
const mockUser = { id: 1, name: 'John', avatar: '/avatar.png' };
|
|
298
|
-
|
|
299
|
-
// AUTO-UPDATED (after avatar field removed)
|
|
300
|
-
const mockUser = { id: 1, name: 'John' };
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
**Pattern 2: Type Definition Update**
|
|
304
|
-
```typescript
|
|
305
|
-
// OLD
|
|
306
|
-
interface User {
|
|
307
|
-
id: number;
|
|
308
|
-
name: string;
|
|
309
|
-
avatar: string; // URL to user avatar
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// AUTO-UPDATED
|
|
313
|
-
interface User {
|
|
314
|
-
id: number;
|
|
315
|
-
name: string;
|
|
316
|
-
// avatar field removed in API v2
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Pattern 3: Assertion Update**
|
|
321
|
-
```javascript
|
|
322
|
-
// OLD
|
|
323
|
-
expect(response.avatar).toBeDefined();
|
|
324
|
-
|
|
325
|
-
// AUTO-UPDATED (if field removed)
|
|
326
|
-
expect(response).not.toHaveProperty('avatar');
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Validation Workflow (After Auto-Update)
|
|
332
|
-
|
|
333
|
-
### Pre-Commit Validation (MANDATORY)
|
|
334
|
-
|
|
335
|
-
1. **Syntax Check**: All updated files are valid JSON/JS/TS
|
|
336
|
-
2. **Contract Alignment**: Updated contracts match actual changes
|
|
337
|
-
3. **Test Consistency**: Updated tests still make sense semantically
|
|
338
|
-
4. **Type Safety**: Types defined in Phase 4 match Phase 3 API contract
|
|
339
|
-
5. **Cross-Phase Validation**:
|
|
340
|
-
- Phase 3 types ⊆ Phase 4 client types ✓
|
|
341
|
-
- Phase 2 test data matches Phase 3 API contract ✓
|
|
342
|
-
- Phase 5 tests reference existing Phase 4 client methods ✓
|
|
343
|
-
|
|
344
|
-
### Validation Checklist
|
|
345
|
-
|
|
346
|
-
```markdown
|
|
347
|
-
## Spec Propagation Validation
|
|
348
|
-
|
|
349
|
-
- [ ] Change detection correct? (type identified)
|
|
350
|
-
- [ ] Affected phases identified? (no missing phases)
|
|
351
|
-
- [ ] Phase 2 tests updated?
|
|
352
|
-
- [ ] Mocks match new spec
|
|
353
|
-
- [ ] Assertions updated
|
|
354
|
-
- [ ] No broken assertions
|
|
355
|
-
- [ ] Phase 3 contract updated?
|
|
356
|
-
- [ ] Schema matches API spec
|
|
357
|
-
- [ ] Docstrings accurate
|
|
358
|
-
- [ ] Phase 4 SDK updated?
|
|
359
|
-
- [ ] Types match API contract
|
|
360
|
-
- [ ] No type mismatches
|
|
361
|
-
- [ ] Phase 5 E2E updated?
|
|
362
|
-
- [ ] Scenarios reference updated SDK
|
|
363
|
-
- [ ] No broken references
|
|
364
|
-
- [ ] Cross-phase validation passes?
|
|
365
|
-
- [ ] All files are syntactically valid
|
|
366
|
-
- [ ] No circular dependencies
|
|
367
|
-
- [ ] Migration guide complete (if breaking)
|
|
368
|
-
- [ ] SPEC_CHANGELOG.md entry added?
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
373
|
-
## Auto-Trigger Integration
|
|
374
|
-
|
|
375
|
-
### Hook: PreToolUse for `/spec-change`
|
|
376
|
-
|
|
377
|
-
**Location**: `.instructions.md` (PreToolUse Hook #5)
|
|
378
|
-
|
|
379
|
-
```yaml
|
|
380
|
-
BEFORE /spec-change executes:
|
|
381
|
-
1. Verify change is documented
|
|
382
|
-
2. Confirm change type (breaking/feature/non-impact)
|
|
383
|
-
3. Preview affected phases
|
|
384
|
-
|
|
385
|
-
AFTER /spec-change completes successfully:
|
|
386
|
-
→ Activate genesis-spec-propagation skill
|
|
387
|
-
|
|
388
|
-
1. Change Detection (5 min)
|
|
389
|
-
- Analyze spec difference
|
|
390
|
-
- Identify breaking vs feature
|
|
391
|
-
- Map affected phases
|
|
392
|
-
- Record in SPEC_CHANGELOG.md
|
|
393
|
-
|
|
394
|
-
2. Impact Analysis (10 min)
|
|
395
|
-
- Build dependency graph
|
|
396
|
-
- Trace propagation paths
|
|
397
|
-
- Identify update types
|
|
398
|
-
- Estimate effort
|
|
399
|
-
|
|
400
|
-
3. Auto-Update (15 min)
|
|
401
|
-
- Update Phase 2 tests
|
|
402
|
-
- Update Phase 3 backend contract
|
|
403
|
-
- Update Phase 4 client SDK
|
|
404
|
-
- Update Phase 5 E2E tests
|
|
405
|
-
- Generate migration guide
|
|
406
|
-
|
|
407
|
-
4. Validation (5 min)
|
|
408
|
-
- Syntax check all files
|
|
409
|
-
- Cross-phase validation
|
|
410
|
-
- Run affected test suites
|
|
411
|
-
- Confirm all phases aligned
|
|
412
|
-
|
|
413
|
-
5. Completion (2 min)
|
|
414
|
-
- Create SPEC_CHANGE_PROPAGATION.md log
|
|
415
|
-
- Update CURRENT_STATE.md
|
|
416
|
-
- Ready for commit
|
|
417
|
-
|
|
418
|
-
**CRITICAL**: No breaking change commits without review
|
|
419
|
-
**CRITICAL**: All downstream phases must be updated
|
|
420
|
-
**Non-optional**: Part of /spec-change completion criteria
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
## Integration with Other Skills
|
|
426
|
-
|
|
427
|
-
| Skill | Integration Point |
|
|
428
|
-
|-------|-------------------|
|
|
429
|
-
| **genesis-research** | Research best practices for API changes |
|
|
430
|
-
| **genesis-api-contract** | Generate new API contracts after change |
|
|
431
|
-
| **genesis-ui-ux-test** | Update test scenarios based on spec |
|
|
432
|
-
| **genesis-harness-engineering** | Orchestrate multi-phase updates |
|
|
433
|
-
| **genesis-docs** | Auto-update API docs after propagation |
|
|
434
|
-
| **genesis-release** | Use SPEC_CHANGELOG for release notes |
|
|
435
|
-
| **spec-impact-engine** | Base dependency tracking |
|
|
436
|
-
|
|
437
|
-
---
|
|
438
|
-
|
|
439
|
-
## Token Efficiency Rules
|
|
440
|
-
|
|
441
|
-
### Cache Aggressively
|
|
442
|
-
- Cache PHASE_DEPENDENCY_MAP.md (rarely changes)
|
|
443
|
-
- Cache contract templates (reusable)
|
|
444
|
-
- Cache update patterns (pattern matching)
|
|
445
|
-
|
|
446
|
-
### Summarize, Don't Repeat
|
|
447
|
-
- When reporting changes: "Phase 2,3,4,5 affected" not full text
|
|
448
|
-
- When proposing updates: Show before/after, not full file
|
|
449
|
-
- When validating: Report issues only, not passing checks
|
|
450
|
-
|
|
451
|
-
### Reuse Analysis
|
|
452
|
-
- Store dependency graph in session memory (use across operations)
|
|
453
|
-
- Reuse contract analysis within same session
|
|
454
|
-
- Link to previous propagation logs (avoid re-analyzing)
|
|
455
|
-
|
|
456
|
-
**Target**: 40-50 min for medium change with caching (vs 45+ min manual)
|
|
457
|
-
|
|
458
|
-
---
|
|
459
|
-
|
|
460
|
-
## Success Criteria
|
|
461
|
-
|
|
462
|
-
✅ **Automated**: /spec-change auto-triggers propagation (zero manual steps)
|
|
463
|
-
✅ **Complete**: All affected phases updated (2-5 scanned)
|
|
464
|
-
✅ **Validated**: Cross-phase consistency verified before commit
|
|
465
|
-
✅ **Documented**: SPEC_CHANGELOG.md + migration guides complete
|
|
466
|
-
✅ **Reversible**: Rollback procedure documented for breaking changes
|
|
467
|
-
✅ **Efficient**: 25-30 min execution vs 45+ min manual (40% time savings)
|
|
468
|
-
✅ **Enforced**: Pre-commit gate prevents misaligned phases
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
## Output Artifacts
|
|
473
|
-
|
|
474
|
-
### Per Spec Change
|
|
475
|
-
|
|
476
|
-
1. **SPEC_CHANGE_PROPAGATION.md** (Investigation log)
|
|
477
|
-
- Change detected
|
|
478
|
-
- Affected phases
|
|
479
|
-
- Updates applied
|
|
480
|
-
- Validation results
|
|
481
|
-
- Migration guide (if breaking)
|
|
482
|
-
|
|
483
|
-
2. **Updated Contract Files**
|
|
484
|
-
- Phase 2: `tests/api-mocks.test.js` (updated mocks)
|
|
485
|
-
- Phase 3: `contracts/api/response.json` (updated schema)
|
|
486
|
-
- Phase 4: `types/api.ts` (updated types)
|
|
487
|
-
- Phase 5: `playwright/e2e/scenarios.md` (updated scenarios)
|
|
488
|
-
|
|
489
|
-
3. **SPEC_CHANGELOG.md Entry** (auto-append)
|
|
490
|
-
```
|
|
491
|
-
- 2026-05-31T14:32:00Z | BREAKING | API field change
|
|
492
|
-
Auto-updated phases: 2, 3, 4, 5 | Migration guide: /docs/migration-v2-to-v3.md
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
4. **Migration Guide** (for breaking changes)
|
|
496
|
-
- What changed & why
|
|
497
|
-
- Impact for consumers
|
|
498
|
-
- Migration steps
|
|
499
|
-
- Timeline & deadlines
|
|
500
|
-
- Rollback procedure
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
|
-
## Recovery & Rollback
|
|
505
|
-
|
|
506
|
-
### If Propagation Breaks Tests
|
|
507
|
-
|
|
508
|
-
1. **Identify Breaking Phase**: Which phase fails?
|
|
509
|
-
2. **Root Cause**: Is it auto-update error or actual incompatibility?
|
|
510
|
-
3. **Recover**:
|
|
511
|
-
- If auto-update error: Revert change, fix pattern, re-run propagation
|
|
512
|
-
- If incompatibility: Manual review + design decision needed
|
|
513
|
-
4. **Document**: Add to RECOVERY_POINTS.md with solution
|
|
514
|
-
|
|
515
|
-
### Rollback to Previous Spec State
|
|
516
|
-
|
|
517
|
-
```bash
|
|
518
|
-
# If propagation introduced bugs:
|
|
519
|
-
git revert <propagation-commit>
|
|
520
|
-
|
|
521
|
-
# Verify all phases revert correctly
|
|
522
|
-
npm test
|
|
523
|
-
|
|
524
|
-
# Then manually review the spec change requirement
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
---
|
|
528
|
-
|
|
529
|
-
## Related Documentation
|
|
530
|
-
|
|
531
|
-
- [PHASE_DEPENDENCY_MAP.md](.codebase/PHASE_DEPENDENCY_MAP.md) - Phase dependencies
|
|
532
|
-
- [SPEC_CHANGELOG.md](.codebase/SPEC_CHANGELOG.md) - Change history
|
|
533
|
-
- [Contract Management](contracts/README.md) - Contract structures
|
|
534
|
-
- [Database Schema Evolution](docs/schema-evolution.md) - Migration patterns
|
|
71
|
+
1. Re-read the impact report and dependency map.
|
|
72
|
+
2. Restore the last known aligned contracts/fixtures if propagation fails.
|
|
73
|
+
3. Re-apply changes one affected phase at a time.
|
|
74
|
+
4. Record unresolved risk in `.codebase/RECOVERY_POINTS.md`.
|
|
75
|
+
|
|
76
|
+
## Workflow references
|
|
77
|
+
- `checklists/spec-change-detection.md`: impact classification checklist.
|
|
78
|
+
- `checklists/phase-update-verification.md`: downstream update checklist.
|
|
79
|
+
- `playbooks/feature-change-propagation.md`: additive change workflow.
|
|
80
|
+
- `playbooks/breaking-change-propagation.md`: breaking change workflow.
|
|
81
|
+
- `templates/migration-guide-template.md`: migration guide shape.
|
|
82
|
+
- `observability/propagation-tracking.md`: tracking and metrics format.
|