codex-workflows 0.3.1 → 0.4.0

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.
@@ -197,6 +197,22 @@ Invariants:
197
197
  - [Conditions that remain unchanged before and after processing]
198
198
  ```
199
199
 
200
+ ### Test Boundaries
201
+
202
+ #### Mock Boundary Decisions
203
+
204
+ | Dependency / Boundary | Test Level | Use Real Dependency | Isolation Method | Rationale |
205
+ |-----------------------|------------|---------------------|------------------|-----------|
206
+ | [Repository / API / queue / hook] | [integration / e2e] | [Yes / No] | [mock / fake / local test env / browser harness] | [Why this boundary should behave this way in tests] |
207
+
208
+ #### Data Layer Verification Strategy
209
+
210
+ - Data storage involved: [Yes / No]
211
+ - Schema or model references: [table / collection / model names or N/A]
212
+ - Real verification approach: [container DB / dedicated test DB / in-memory adapter / browser fixture / N/A]
213
+ - Query and repository coverage: [How repository, ORM, or query paths will be verified]
214
+ - Migration compatibility check: [How schema drift will be detected or why N/A]
215
+
200
216
  ### Field Propagation Map (When Fields Cross Boundaries)
201
217
 
202
218
  | Field | Boundary | Status | Detail |
@@ -60,10 +60,13 @@ Each test MUST include the following annotations:
60
60
  // Behavior: [Trigger] -> [Process] -> [Observable Result]
61
61
  // @category: core-functionality | integration | edge-case | e2e
62
62
  // @dependency: none | [component names] | full-system
63
+ // @real-dependency: [component names] (optional)
63
64
  // @complexity: low | medium | high
64
65
  // ROI: [score]
65
66
  ```
66
67
 
68
+ Adapt comment syntax to the project's language when generating or reviewing test skeletons.
69
+
67
70
  ### Verification Items (Optional)
68
71
 
69
72
  When verification points need explicit enumeration:
@@ -110,7 +113,7 @@ The test runner or framework in the project determines the appropriate file exte
110
113
  |-------|-------------------|
111
114
  | Behavior Verification | No assertion for "observable result" in skeleton |
112
115
  | Verification Item Coverage | Listed items not all covered by assertions |
113
- | Mock Boundary | Internal components mocked in integration test |
116
+ | Mock Boundary | Real dependencies from `@real-dependency` are isolated away or internal components are mocked without rationale |
114
117
 
115
118
  ### Implementation Quality
116
119
 
@@ -17,8 +17,10 @@ description: "Execute from requirement analysis to frontend design document crea
17
17
 
18
18
  **Execution Method**:
19
19
  - Requirement analysis -> performed by requirement-analyzer
20
+ - Codebase analysis -> performed by codebase-analyzer
20
21
  - UI Specification creation -> performed by ui-spec-designer
21
22
  - Design document creation -> performed by technical-designer-frontend
23
+ - Design verification -> performed by code-verifier
22
24
  - Document review -> performed by document-reviewer
23
25
 
24
26
  Orchestrator spawns agents and passes structured data between them.
@@ -68,8 +70,10 @@ Then create the UI Specification:
68
70
  ### Step 3: Design Document Creation Phase
69
71
  Create appropriate design documents according to scale determination:
70
72
  - For ADR: Spawn technical-designer-frontend agent: "Create ADR for [technical decision]"
71
- - For Design Doc: Spawn technical-designer-frontend agent: "Create Design Doc based on requirements. UI Spec is at [ui-spec path]. Inherit component structure and state design from UI Spec."
72
- - Spawn document-reviewer agent: "Review [document path] for consistency and completeness"
73
+ - For Design Doc: Spawn codebase-analyzer agent first: "Analyze the existing codebase to provide evidence for frontend Design Doc creation. Focus on existing implementations, state paths, API integrations, and constraints the design should respect. requirement_analysis: [JSON from requirement-analyzer]. requirements: [original user requirements]. layer: frontend. target_paths: [frontend affected files and directories from requirement-analyzer]. focus_areas: component hierarchy, state management, UI interactions, data fetching."
74
+ - For Design Doc: Spawn technical-designer-frontend agent: "Create Design Doc based on requirements. Codebase Analysis: [JSON from codebase-analyzer]. UI Spec is at [ui-spec path]. Inherit component structure and state design from UI Spec."
75
+ - Spawn code-verifier agent: "Verify Design Doc against code. doc_type: design-doc. document_path: [document path]. verbose: false."
76
+ - Spawn document-reviewer agent: "Review the Design Doc for consistency and completeness. doc_type: DesignDoc. target: [document path]. mode: composite. code_verification: [JSON from code-verifier]"
73
77
 
74
78
  **[STOP -- BLOCKING]** Present design alternatives and trade-offs, obtain user approval.
75
79
  **CANNOT proceed until user explicitly approves the design document.**
@@ -80,6 +84,7 @@ ENFORCEMENT: Every stop point MUST be respected. Skipping user approval invalida
80
84
 
81
85
  - [ ] Requirement analysis completed and approved
82
86
  - [ ] UI Specification created and approved
87
+ - [ ] Codebase analysis completed before frontend Design Doc creation
83
88
  - [ ] Design document created and approved
84
89
  - [ ] All document reviews passed
85
90
 
@@ -90,6 +90,8 @@ When user responds to questions:
90
90
  - [ ] Identified current progress position
91
91
  - [ ] Clarified next step
92
92
  - [ ] Recognized stopping points
93
+ - [ ] codebase-analyzer included before each Design Doc creation
94
+ - [ ] code-verifier included before each Design Doc review
93
95
  - [ ] **Environment check**: Can I execute per-task commit cycle?
94
96
  - If commit capability unavailable -> Escalate before autonomous mode
95
97
  - Other environments (tests, quality tools) -> Subagents will escalate
@@ -128,6 +128,8 @@ After acceptance-test-generator execution, when spawning work-planner, communica
128
128
  - [ ] Requirement analysis completed and user-confirmed
129
129
  - [ ] Layer routing determined (backend / frontend / fullstack)
130
130
  - [ ] Correct workflow followed per layer routing
131
+ - [ ] codebase-analyzer included before Design Doc creation for Medium/Large flows
132
+ - [ ] code-verifier included before document-reviewer for Design Doc review
131
133
  - [ ] All stopping points honored with user confirmation obtained
132
134
  - [ ] Quality-fixer spawned before every commit
133
135
  - [ ] All tasks committed or escalation completed
@@ -101,7 +101,7 @@ Spawn code-verifier agent: "Verify consistency between PRD and code implementati
101
101
 
102
102
  **Required Input**: $STEP_3_OUTPUT (verification data from Step 3)
103
103
 
104
- Spawn document-reviewer agent: "Review the following PRD considering code verification findings. doc_type: PRD. target: $STEP_2_OUTPUT. mode: composite. Code Verification Results: $STEP_3_OUTPUT. Additional Review Focus: Alignment between PRD claims and verification evidence, resolution recommendations for each discrepancy, completeness of undocumented feature coverage."
104
+ Spawn document-reviewer agent: "Review the following PRD considering code verification findings. doc_type: PRD. target: $STEP_2_OUTPUT. mode: composite. code_verification: $STEP_3_OUTPUT. Additional Review Focus: Alignment between PRD claims and verification evidence, resolution recommendations for each discrepancy, completeness of undocumented feature coverage."
105
105
 
106
106
  **Store output as**: `$STEP_4_OUTPUT`
107
107
 
@@ -208,7 +208,7 @@ Spawn code-verifier agent: "Verify consistency between Design Doc and code imple
208
208
 
209
209
  **Required Input**: $STEP_8_OUTPUT (verification data from Step 8)
210
210
 
211
- Spawn document-reviewer agent: "Review the following Design Doc considering code verification findings. doc_type: DesignDoc. target: $STEP_7_OUTPUT. mode: composite. Code Verification Results: $STEP_8_OUTPUT. Parent PRD: $APPROVED_PRD_PATH. Additional Review Focus: Technical accuracy of documented interfaces, consistency with parent PRD scope, completeness of unit boundary definitions."
211
+ Spawn document-reviewer agent: "Review the following Design Doc considering code verification findings. doc_type: DesignDoc. target: $STEP_7_OUTPUT. mode: composite. code_verification: $STEP_8_OUTPUT. Parent PRD: $APPROVED_PRD_PATH. Additional Review Focus: Technical accuracy of documented interfaces, consistency with parent PRD scope, completeness of unit boundary definitions."
212
212
 
213
213
  **Store output as**: `$STEP_9_OUTPUT`
214
214
 
@@ -32,8 +32,8 @@ ENFORCEMENT: Skipping document-reviewer risks propagating inconsistencies to dow
32
32
  Target document -> [Stop: Confirm changes]
33
33
  |
34
34
  technical-designer / technical-designer-frontend / prd-creator (update mode)
35
- |
36
- document-reviewer -> [Stop: Review approval]
35
+ | (Design Doc only)
36
+ code-verifier -> document-reviewer -> [Stop: Review approval]
37
37
  | (Design Doc only)
38
38
  design-sync -> [Stop: Final approval]
39
39
  ```
@@ -107,13 +107,23 @@ Spawn [Update Agent from Step 2] agent: "Operation Mode: update. Existing Docume
107
107
 
108
108
  ### Step 5: Document Review [Stop]
109
109
 
110
- **[STOP BLOCKING]** Present review results to user for approval.
111
- **CANNOT proceed until user explicitly confirms.**
110
+ For Design Doc updates, first verify the updated document against code:
111
+
112
+ Spawn code-verifier agent: "Verify the updated Design Doc against current code. doc_type: design-doc. document_path: [path from Step 1]. verbose: false."
112
113
 
113
- Spawn document-reviewer agent: "Review the following updated document. doc_type: [Design Doc / PRD / ADR]. target: [path from Step 1]. mode: standard. Focus on: Consistency of updated sections with rest of document, no contradictions introduced by changes, completeness of change history."
114
+ **Store output as**: `$CODE_VERIFICATION_OUTPUT`
115
+
116
+ For Design Doc updates:
117
+ Spawn document-reviewer agent: "Review the following updated document. doc_type: DesignDoc. target: [path from Step 1]. mode: composite. code_verification: $CODE_VERIFICATION_OUTPUT. Focus on: Consistency of updated sections with rest of document, no contradictions introduced by changes, completeness of change history."
118
+
119
+ For PRD or ADR updates:
120
+ Spawn document-reviewer agent: "Review the following updated document. doc_type: [PRD or ADR]. target: [path from Step 1]. mode: composite. Focus on: Consistency of updated sections with rest of document, no contradictions introduced by changes, completeness of change history."
114
121
 
115
122
  **Store output as**: `$STEP_5_OUTPUT`
116
123
 
124
+ **[STOP — BLOCKING]** Present review results to user for approval.
125
+ **CANNOT proceed until user explicitly confirms.**
126
+
117
127
  **On review result**:
118
128
  - Approved -> Proceed to Step 6
119
129
  - Needs revision -> Return to Step 4 with review feedback (max 2 iterations):
@@ -151,6 +161,7 @@ For Design Doc, spawn design-sync agent: "Verify consistency of the updated Desi
151
161
  - [ ] Identified target document
152
162
  - [ ] Clarified change content with user
153
163
  - [ ] Updated document via appropriate agent (update mode)
164
+ - [ ] Ran code-verifier before document-reviewer for Design Doc updates
154
165
  - [ ] Spawned document-reviewer and addressed feedback
155
166
  - [ ] Spawned design-sync for consistency verification (Design Doc only)
156
167
  - [ ] Obtained user approval for updated document
@@ -65,13 +65,15 @@ The following subagents are available:
65
65
 
66
66
  ### Document Creation Agents
67
67
  6. **requirement-analyzer**: Requirement analysis and work scale determination
68
- 7. **prd-creator**: Product Requirements Document creation
69
- 8. **ui-spec-designer**: UI Specification creation from PRD and optional prototype code (frontend/fullstack features)
70
- 9. **technical-designer**: ADR/Design Doc creation
71
- 10. **work-planner**: Work plan creation from Design Doc and test skeletons
72
- 11. **document-reviewer**: Single document quality and rule compliance check
73
- 12. **design-sync**: Design Doc consistency verification across multiple documents
74
- 13. **acceptance-test-generator**: Generate integration and E2E test skeletons from Design Doc ACs
68
+ 7. **codebase-analyzer**: Existing codebase analysis before Design Doc creation
69
+ 8. **prd-creator**: Product Requirements Document creation
70
+ 9. **ui-spec-designer**: UI Specification creation from PRD and optional prototype code (frontend/fullstack features)
71
+ 10. **technical-designer**: ADR/Design Doc creation
72
+ 11. **work-planner**: Work plan creation from Design Doc and test skeletons
73
+ 12. **document-reviewer**: Single document quality and rule compliance check
74
+ 13. **code-verifier**: Document-code consistency verification for review inputs
75
+ 14. **design-sync**: Design Doc consistency verification across multiple documents
76
+ 15. **acceptance-test-generator**: Generate integration and E2E test skeletons from Design Doc ACs
75
77
 
76
78
  ## Orchestration Principles
77
79
 
@@ -105,6 +107,9 @@ Spawn agents using natural language prompts. Provide clear context about what th
105
107
  **requirement-analyzer**:
106
108
  > "Analyze the following requirements and determine the work scale: [user requirements]. Perform requirement analysis and scale determination."
107
109
 
110
+ **codebase-analyzer**:
111
+ > "Analyze the existing codebase to provide evidence for Design Doc creation. Focus on existing implementations, data model elements, and constraints the design should respect. requirement_analysis: [JSON]. prd_path: [path if available]. requirements: [original user requirements]. layer: [target layer if applicable]. target_paths: [paths if narrowed]. Return codebase facts and focus areas."
112
+
108
113
  **task-executor**:
109
114
  > "Execute the implementation task defined in docs/plans/tasks/[filename].md. Complete the implementation following TDD Red-Green-Refactor."
110
115
 
@@ -175,9 +180,11 @@ All agents MUST use this vocabulary consistently:
175
180
 
176
181
  Subagents respond in JSON format. The final response from each JSON-returning subagent must be the JSON payload itself, with no trailing prose. Key fields for orchestrator decisions:
177
182
  - **requirement-analyzer**: scale, confidence, affectedLayers, adrRequired, scopeDependencies, questions
183
+ - **codebase-analyzer**: analysisScope, existingElements, dataModel, focusAreas, limitations
178
184
  - **task-executor**: status (escalation_needed/completed), escalation_type (design_compliance_violation/similar_function_found/similar_component_found/investigation_target_not_found/out_of_scope_file/test_environment_not_ready), testsAdded, requiresTestReview
179
185
  - **quality-fixer**: status (approved/blocked). For blocked responses, discriminate by `reason`: specification conflicts use `blockingIssues[]`; execution prerequisites use `missingPrerequisites[]`, and each item provides its own `resolutionSteps`
180
186
  - **document-reviewer**: verdict.decision (approved/approved_with_conditions/needs_revision/rejected)
187
+ - **code-verifier**: summary, discrepancies, reverseCoverage
181
188
  - **design-sync**: sync_status (CONFLICTS_FOUND/NO_CONFLICTS) — text format with [SUMMARY] block
182
189
  - **integration-test-reviewer**: status (approved/needs_revision/blocked), requiredFixes
183
190
  - **security-reviewer**: status (approved/approved_with_notes/needs_revision/blocked), findings, notes, requiredFixes
@@ -212,7 +219,7 @@ Document generation agents (work-planner, technical-designer, prd-creator) can u
212
219
 
213
220
  When receiving new features or change requests, start with requirement-analyzer.
214
221
 
215
- ### Large Scale (6+ Files) - 11 Steps (backend) / 13 Steps (frontend/fullstack)
222
+ ### Large Scale (6+ Files) - 13 Steps (backend) / 15 Steps (frontend/fullstack)
216
223
 
217
224
  1. requirement-analyzer: Requirement analysis + Check existing PRD **[Stop]**
218
225
  2. prd-creator: PRD creation
@@ -221,24 +228,35 @@ When receiving new features or change requests, start with requirement-analyzer.
221
228
  5. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
222
229
  6. technical-designer: ADR creation (if architecture/technology/data flow changes)
223
230
  7. document-reviewer: ADR review (if ADR created) **[Stop: ADR Approval]**
224
- 8. technical-designer: Design Doc creation
225
- 9. document-reviewer: Design Doc review
226
- 10. design-sync: Consistency verification **[Stop: Design Doc Approval]**
227
- 11. acceptance-test-generator: Test skeleton generation, pass to work-planner
228
- 12. work-planner: Work plan creation **[Stop: Batch approval]**
229
- 13. task-decomposer: Autonomous execution to Completion report
231
+ 8. codebase-analyzer: Codebase analysis (pass requirement-analyzer output and PRD path when available)
232
+ 9. technical-designer: Design Doc creation
233
+ 10. code-verifier: Design Doc verification against code
234
+ 11. document-reviewer: Design Doc review with code verification evidence
235
+ 12. design-sync: Consistency verification **[Stop: Design Doc Approval]**
236
+ 13. acceptance-test-generator: Test skeleton generation, pass to work-planner
237
+ 14. work-planner: Work plan creation **[Stop: Batch approval]**
238
+ 15. task-decomposer: Autonomous execution to Completion report
230
239
 
231
- ### Medium Scale (3-5 Files) - 7 Steps (backend) / 9 Steps (frontend/fullstack)
240
+ ### Medium Scale (3-5 Files) - 9 Steps (backend) / 11 Steps (frontend/fullstack)
232
241
 
233
242
  1. requirement-analyzer: Requirement analysis **[Stop]**
234
- 2. **(frontend/fullstack only)** Ask user for prototype code; ui-spec-designer: UI Spec creation
235
- 3. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
236
- 4. technical-designer: Design Doc creation
237
- 5. document-reviewer: Design Doc review
238
- 6. design-sync: Consistency verification **[Stop: Design Doc Approval]**
239
- 7. acceptance-test-generator: Test skeleton generation, pass to work-planner
240
- 8. work-planner: Work plan creation **[Stop: Batch approval]**
241
- 9. task-decomposer: Autonomous execution to Completion report
243
+ 2. codebase-analyzer: Codebase analysis
244
+ 3. **(frontend/fullstack only)** Ask user for prototype code; ui-spec-designer: UI Spec creation
245
+ 4. **(frontend/fullstack only)** document-reviewer: UI Spec review **[Stop: UI Spec Approval]**
246
+ 5. technical-designer: Design Doc creation
247
+ 6. code-verifier: Design Doc verification against code
248
+ 7. document-reviewer: Design Doc review with code verification evidence
249
+ 8. design-sync: Consistency verification **[Stop: Design Doc Approval]**
250
+ 9. acceptance-test-generator: Test skeleton generation, pass to work-planner
251
+ 10. work-planner: Work plan creation **[Stop: Batch approval]**
252
+ 11. task-decomposer: Autonomous execution to Completion report
253
+
254
+ ### Design Flow Data Passing
255
+
256
+ - Pass requirement-analyzer output and original requirements to codebase-analyzer
257
+ - Pass codebase-analyzer JSON to technical-designer or technical-designer-frontend as `Codebase Analysis`
258
+ - Pass Design Doc path to code-verifier
259
+ - Pass code-verifier JSON to document-reviewer as `code_verification`
242
260
 
243
261
  ### Small Scale (1-2 Files) - 2 Steps
244
262
 
@@ -10,7 +10,7 @@ This reference defines the orchestration flow for projects spanning multiple lay
10
10
 
11
11
  ## Design Phase
12
12
 
13
- ### Large Scale Fullstack (6+ Files) - 12 Steps
13
+ ### Large Scale Fullstack (6+ Files) - 14 Steps
14
14
 
15
15
  | Step | Agent | Purpose | Output |
16
16
  |------|-------|---------|--------|
@@ -20,27 +20,35 @@ This reference defines the orchestration flow for projects spanning multiple lay
20
20
  | 4 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
21
21
  | 5 | ui-spec-designer | UI Spec from PRD + optional prototype | UI Spec |
22
22
  | 6 | document-reviewer | UI Spec review **[Stop]** | Approval |
23
- | 7 | technical-designer | **Backend** Design Doc | Backend Design Doc |
24
- | 8 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
25
- | 9 | document-reviewer x2 | Review each Design Doc (one invocation per doc) | Reviews |
26
- | 10 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
27
- | 11 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
28
- | 12 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
23
+ | 7 | codebase-analyzer x2 | Per-layer codebase analysis before Design Doc creation | Analysis JSON |
24
+ | 8 | technical-designer | **Backend** Design Doc | Backend Design Doc |
25
+ | 9 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
26
+ | 10 | code-verifier x2 | Verify each Design Doc against code | Verification JSON |
27
+ | 11 | document-reviewer x2 | Review each Design Doc with verification evidence | Reviews |
28
+ | 12 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
29
+ | 13 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
30
+ | 14 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
29
31
 
30
- ### Medium Scale Fullstack (3-5 Files) - 10 Steps
32
+ ### Medium Scale Fullstack (3-5 Files) - 12 Steps
31
33
 
32
34
  | Step | Agent | Purpose | Output |
33
35
  |------|-------|---------|--------|
34
36
  | 1 | requirement-analyzer | Requirement analysis + scale determination **[Stop]** | Requirements + scale |
35
- | 2 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
36
- | 3 | ui-spec-designer | UI Spec from requirements + optional prototype | UI Spec |
37
- | 4 | document-reviewer | UI Spec review **[Stop]** | Approval |
38
- | 5 | technical-designer | **Backend** Design Doc | Backend Design Doc |
39
- | 6 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
40
- | 7 | document-reviewer x2 | Review each Design Doc (one invocation per doc) | Reviews |
41
- | 8 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
42
- | 9 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
43
- | 10 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
37
+ | 2 | codebase-analyzer x2 | Per-layer codebase analysis before Design Doc creation | Analysis JSON |
38
+ | 3 | (orchestrator) | Ask user for prototype code **[Stop]** | Prototype path or none |
39
+ | 4 | ui-spec-designer | UI Spec from requirements + optional prototype | UI Spec |
40
+ | 5 | document-reviewer | UI Spec review **[Stop]** | Approval |
41
+ | 6 | technical-designer | **Backend** Design Doc | Backend Design Doc |
42
+ | 7 | technical-designer-frontend | **Frontend** Design Doc (references backend Integration Points + UI Spec) | Frontend Design Doc |
43
+ | 8 | code-verifier x2 | Verify each Design Doc against code | Verification JSON |
44
+ | 9 | document-reviewer x2 | Review each Design Doc with verification evidence | Reviews |
45
+ | 10 | design-sync | Cross-layer consistency verification (source: frontend Design Doc) **[Stop]** | Sync status |
46
+ | 11 | acceptance-test-generator | Integration/E2E test skeleton from cross-layer contracts | Test skeletons |
47
+ | 12 | work-planner | Work plan from all Design Docs **[Stop: Batch approval]** | Work plan |
48
+
49
+ ### Parallelization in Multi-Agent Steps
50
+
51
+ Steps marked `x2` run independently per layer and can execute in parallel when supported.
44
52
 
45
53
  ### Layer Context in Design Doc Creation
46
54
 
@@ -48,19 +56,35 @@ When spawning Design Doc creation for each layer, pass explicit context:
48
56
 
49
57
  **Large Scale (PRD available) -- Backend Design Doc**:
50
58
  **Agent**: Spawn technical-designer
51
- > "Create a backend Design Doc from PRD at [path]. Focus on: API contracts, data layer, business logic, service architecture."
59
+ > "Create a backend Design Doc from PRD at [path]. Codebase analysis: [backend analysis JSON]. Focus on: API contracts, data layer, business logic, service architecture."
60
+
61
+ **Large Scale (PRD available) -- Backend Codebase Analysis**:
62
+ **Agent**: Spawn codebase-analyzer
63
+ > "Analyze the existing codebase to provide evidence for backend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to backend files]. prd_path: [path]. requirements: [original user requirements]. layer: backend. target_paths: [backend file and directory scope]. focus_areas: API contracts, data layer, business logic, service architecture."
52
64
 
53
65
  **Large Scale (PRD available) -- Frontend Design Doc**:
54
66
  **Agent**: Spawn technical-designer-frontend
55
- > "Create a frontend Design Doc from PRD at [path]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
67
+ > "Create a frontend Design Doc from PRD at [path]. Codebase analysis: [frontend analysis JSON]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
68
+
69
+ **Large Scale (PRD available) -- Frontend Codebase Analysis**:
70
+ **Agent**: Spawn codebase-analyzer
71
+ > "Analyze the existing codebase to provide evidence for frontend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to frontend files]. prd_path: [path]. requirements: [original user requirements]. layer: frontend. target_paths: [frontend file and directory scope]. focus_areas: component hierarchy, state management, UI interactions, data fetching."
56
72
 
57
73
  **Medium Scale (no PRD) -- Backend Design Doc**:
58
74
  **Agent**: Spawn technical-designer
59
- > "Create a backend Design Doc based on the following requirements: [requirement-analyzer output]. Focus on: API contracts, data layer, business logic, service architecture."
75
+ > "Create a backend Design Doc based on the following requirements: [requirement-analyzer output]. Codebase analysis: [backend analysis JSON]. Focus on: API contracts, data layer, business logic, service architecture."
76
+
77
+ **Medium Scale (no PRD) -- Backend Codebase Analysis**:
78
+ **Agent**: Spawn codebase-analyzer
79
+ > "Analyze the existing codebase to provide evidence for backend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to backend files]. requirements: [original user requirements]. layer: backend. target_paths: [backend file and directory scope]. focus_areas: API contracts, data layer, business logic, service architecture."
60
80
 
61
81
  **Medium Scale (no PRD) -- Frontend Design Doc**:
62
82
  **Agent**: Spawn technical-designer-frontend
63
- > "Create a frontend Design Doc based on the following requirements: [requirement-analyzer output]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
83
+ > "Create a frontend Design Doc based on the following requirements: [requirement-analyzer output]. Codebase analysis: [frontend analysis JSON]. Reference backend Design Doc at [path] for API contracts and Integration Points. Reference UI Spec at [path] for component structure and state design. Focus on: component hierarchy, state management, UI interactions, data fetching."
84
+
85
+ **Medium Scale (no PRD) -- Frontend Codebase Analysis**:
86
+ **Agent**: Spawn codebase-analyzer
87
+ > "Analyze the existing codebase to provide evidence for frontend Design Doc creation. requirement_analysis: [requirement-analyzer output filtered to frontend files]. requirements: [original user requirements]. layer: frontend. target_paths: [frontend file and directory scope]. focus_areas: component hierarchy, state management, UI interactions, data fetching."
64
88
 
65
89
  ### design-sync for Cross-Layer Verification
66
90
 
@@ -189,6 +189,37 @@ Test names should clearly describe:
189
189
  - **Fake**: Simplified working implementation
190
190
  - **Dummy**: Passed but never used
191
191
 
192
+ ## Data Layer Testing
193
+
194
+ ### Mock Limitations for Data Access
195
+
196
+ Mocks validate call patterns but do not validate schema correctness, query correctness, or storage constraints.
197
+ Examples of issues that mocks can miss:
198
+ - schema drift
199
+ - column or field mismatches
200
+ - incorrect joins, filters, or aggregations
201
+ - migration incompatibility
202
+
203
+ ### When Real Data Layer Verification Adds Value
204
+
205
+ Use real or production-like data access verification when testing:
206
+ - repository or DAO implementations
207
+ - ORM mappings
208
+ - query builders or raw SQL
209
+ - persistence behavior that depends on constraints or schema shape
210
+
211
+ ### Environment Options
212
+
213
+ Choose the most practical option for the project environment:
214
+ - containerized database
215
+ - dedicated test database
216
+ - in-memory database with documented limitations
217
+ - adapter-backed local test harness
218
+
219
+ ### Design Alignment
220
+
221
+ When a Design Doc includes `Test Boundaries`, follow it as the baseline for deciding which dependencies stay real and which boundaries are isolated.
222
+
192
223
  ## Test Quality Practices [MANDATORY]
193
224
 
194
225
  ### Keep Tests Active
@@ -40,7 +40,7 @@ Skill Status:
40
40
 
41
41
  ## Required Information
42
42
 
43
- - **Design Doc**: Required. Source of acceptance criteria for test skeleton generation.
43
+ - **Design Doc**: Required. Source of acceptance criteria for test skeleton generation. When the Design Doc includes a `Test Boundaries` section, use it to decide which dependencies should stay real in integration coverage and which can be isolated.
44
44
  - **UI Spec**: Optional. When provided, use screen transitions, state x display matrix, and interaction definitions as additional E2E test candidate sources. See `references/e2e-design.md` in integration-e2e-testing skill for mapping methodology.
45
45
 
46
46
  ## Core Principle: Maximum Coverage, Minimum Tests
@@ -96,7 +96,11 @@ Key points:
96
96
 
97
97
  **Principle**: AC = User-observable behavior verifiable in isolated CI environment
98
98
 
99
- **Output**: Filtered AC list
99
+ When `Test Boundaries` exists:
100
+ - Read mock boundary decisions and reflect them in generated skeleton metadata
101
+ - Mark dependencies that should stay real in integration coverage with a project-appropriate annotation such as `@real-dependency: [component]`
102
+
103
+ **Output**: Filtered AC list with boundary annotations when available
100
104
 
101
105
  ### Phase 2: Candidate Enumeration (Two-Pass #1)
102
106
 
@@ -161,6 +165,8 @@ ROI calculation formula and cost table are defined in **integration-e2e-testing
161
165
 
162
166
  ### Integration Test File
163
167
 
168
+ Adapt comment syntax to the project's language when generating annotations.
169
+
164
170
  ```
165
171
  // [Feature Name] Integration Test - Design Doc: [filename]
166
172
  // Generated: [date] | Budget Used: 2/3 integration, 0/2 E2E
@@ -173,6 +179,7 @@ ROI calculation formula and cost table are defined in **integration-e2e-testing
173
179
  // Behavior: User completes payment → Order created in DB + Payment recorded
174
180
  // @category: core-functionality
175
181
  // @dependency: PaymentService, OrderRepository, Database
182
+ // @real-dependency: OrderRepository, Database
176
183
  // @complexity: high
177
184
  [Test: 'AC1: Successful payment creates persisted order with correct status']
178
185
 
@@ -140,8 +140,10 @@ Perform this step with actual tool-backed enumeration, not memory:
140
140
  1. Enumerate routes/endpoints in scope and record whether each is documented
141
141
  2. Enumerate test files in scope and record whether their existence is documented
142
142
  3. Enumerate public exports/interfaces in primary source files and record whether each is documented
143
- 4. Compile undocumented code items from the enumerations
144
- 5. Compile unimplemented document items from earlier claim verification
143
+ 4. Enumerate data operations in scope and record whether the associated schema, repository, model, or data contract appears in the document
144
+ 5. Record whether a Design Doc contains a `Test Boundaries` section when persistence or data operations are part of scope
145
+ 6. Compile undocumented code items from the enumerations
146
+ 7. Compile unimplemented document items from earlier claim verification
145
147
 
146
148
  ### Step 6: Return JSON Result
147
149
 
@@ -188,7 +190,11 @@ Return the JSON result as the final response. See Output Format for the schema.
188
190
  "testFilesDocumented": 2,
189
191
  "exportsInCode": 12,
190
192
  "exportsDocumented": 10,
191
- "undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"]
193
+ "undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"],
194
+ "dataOperationsInCode": 3,
195
+ "dataOperationsDocumented": 2,
196
+ "undocumentedDataOperations": ["userRepository.saveUser (src/user/repository.ts:41)"],
197
+ "testBoundariesSectionPresent": true
192
198
  },
193
199
  "coverage": {
194
200
  "documented": ["Feature areas with documentation"],
@@ -230,7 +236,7 @@ If `verifiableClaimCount < 20`, treat the score as unstable and return to Step 1
230
236
  - [ ] `verifiableClaimCount >= 20`
231
237
  - [ ] Collected evidence from multiple sources for each claim
232
238
  - [ ] Classified each claim (match/drift/gap/conflict)
233
- - [ ] Performed reverse coverage with route, test file, and public export enumeration
239
+ - [ ] Performed reverse coverage with route, test file, public export, and data operation enumeration
234
240
  - [ ] Identified undocumented features in code
235
241
  - [ ] Identified unimplemented specifications
236
242
  - [ ] Calculated consistency score
@@ -245,6 +251,7 @@ If `verifiableClaimCount < 20`, treat the score as unstable and return to Step 1
245
251
  - [ ] Low-confidence classifications are explicitly noted
246
252
  - [ ] Contradicting evidence is documented, not ignored
247
253
  - [ ] `reverseCoverage` includes concrete counts from tool-backed enumeration
254
+ - [ ] Data operation coverage is recorded when persistence-related code is in scope
248
255
 
249
256
  ## Completion Gate [BLOCKING]
250
257
 
@@ -0,0 +1,193 @@
1
+ name = "codebase-analyzer"
2
+ description = "Analyzes existing codebase facts before design work, with emphasis on dependencies, data layer elements, and risk areas."
3
+ sandbox_mode = "read-only"
4
+
5
+ developer_instructions = """
6
+ You are an AI assistant specializing in objective codebase analysis for design preparation.
7
+
8
+ ## Phase Entry Gate [BLOCKING — HALT IF ANY UNCHECKED]
9
+
10
+ ☐ [VERIFIED] This agent definition has been READ and is active
11
+ ☐ [VERIFIED] All required skills from [[skills.config]] are LOADED
12
+ ☐ [VERIFIED] Input parameters received and validated
13
+ ☐ [VERIFIED] Task scope understood
14
+ ☐ [VERIFIED] Requirements analysis or PRD context available
15
+
16
+ ## Required Skills [LOADING PROTOCOL]
17
+
18
+ **STEP 1**: VERIFY skills from [[skills.config]] are active
19
+ **STEP 2**: For each skill NOT active -> Execute BLOCKING READ of SKILL.md
20
+ **STEP 3**: CONFIRM all skills active before proceeding
21
+
22
+ ## Required Initial Tasks
23
+
24
+ **Progress Tracking**: Track your work steps. Always include "Confirm skill constraints" first and "Verify skill fidelity" last. Update progress upon each completion.
25
+
26
+ ## Responsibilities
27
+
28
+ 1. Analyze existing implementation facts before design work starts
29
+ 2. Enumerate existing code elements, direct dependencies, and integration boundaries
30
+ 3. Trace data layer structures when repositories, ORM code, queries, or migrations are involved
31
+ 4. Surface constraints, focus areas, and evidence-backed risks for downstream design agents
32
+ 5. Report findings in JSON for orchestrator handoff
33
+
34
+ ## Input Parameters
35
+
36
+ - **requirement_analysis**: JSON output from requirement-analyzer (required)
37
+ - **requirements**: Original user requirements text (required)
38
+ - **prd_path**: Path to PRD (optional)
39
+ - **layer**: Scope filter for multi-layer projects, such as `backend`, `frontend`, or `shared` (optional)
40
+ - **target_paths**: Explicit file or directory scope to prioritize when provided (optional)
41
+ - **focus_areas**: Additional analysis focus from orchestrator or user (optional)
42
+
43
+ ## Output Scope
44
+
45
+ Report analysis facts and design-guidance inputs for the requested scope.
46
+ Identify what exists, what appears missing, and what deserves close attention in design.
47
+
48
+ ## Execution Steps
49
+
50
+ ### Step 1: Requirement Context Parsing
51
+
52
+ 1. Read `requirement_analysis` and extract:
53
+ - `affectedFiles`
54
+ - `affectedLayers`
55
+ - `scale`
56
+ - `purpose`
57
+ - `technicalConsiderations`
58
+ 2. Read PRD when `prd_path` is provided and extract relevant scope boundaries
59
+ 3. When `layer` is provided, narrow the candidate scope to that layer first
60
+ 4. When `target_paths` are provided, prioritize them over inferred paths and treat them as the primary analysis scope
61
+ 5. If the resulting scope is still broad, prioritize the files most directly tied to `affectedFiles`, `purpose`, and `focus_areas`. Record lower-priority files in `limitations` when they were not fully analyzed.
62
+ 6. Derive analysis categories from affected files and requirement context:
63
+ - data_layer
64
+ - external_integration
65
+ - validation
66
+ - authentication
67
+ - state_management
68
+ - ui_component
69
+
70
+ ### Step 2: Existing Code Element Discovery
71
+
72
+ For each affected file or inferred target file in the selected scope:
73
+ 1. Read the file and record public interfaces, key functions, classes, types, constants, and configuration use
74
+ 2. Trace one level of direct dependencies through imports or equivalent declarations
75
+ 3. Search for patterns related to:
76
+ - data access: repository usage, ORM calls, query builders, raw SQL, migration references
77
+ - external service calls: HTTP clients, SDK clients, queue producers or consumers, webhook handlers
78
+ - validation logic: validator functions, schema parsers, assertions, guard clauses, constraint checks
79
+ - user-visible state handling: state stores, reducers, hooks, loading or error states, view-model shaping
80
+ 4. Record each discovered element with exact file path and line number
81
+
82
+ ### Step 3: Data Model Discovery
83
+
84
+ When data access patterns appear in the analysis scope:
85
+ 1. Trace repository, ORM, query, or migration references to schema-bearing files
86
+ 2. Search for schema definitions, model definitions, migration files, or query builders
87
+ 3. Record:
88
+ - schema or model names
89
+ - fields and constraints when directly observable
90
+ - relationships when directly observable
91
+ - access patterns mapped to target schema/model
92
+ 4. If the chain cannot be fully resolved, record that limitation explicitly
93
+
94
+ ### Step 4: Constraint and Coverage Extraction
95
+
96
+ 1. Extract validation rules, business rules, configuration dependencies, and assumptions explicitly observable from code, comments, or configuration references
97
+ 2. Search for existing tests covering discovered elements
98
+ 3. Identify focus areas where design work should be careful, especially around:
99
+ - shared dependencies
100
+ - boundary contracts
101
+ - data integrity or persistence behavior
102
+ - partially covered or untested code paths
103
+
104
+ ### Step 5: Return JSON Result
105
+
106
+ Return the JSON result as the final response.
107
+
108
+ ## Output Format
109
+
110
+ ```json
111
+ {
112
+ "analysisScope": {
113
+ "filesAnalyzed": ["path/to/file"],
114
+ "tracedDependencies": ["path/to/dependency"],
115
+ "categoriesDetected": ["data_layer", "validation"]
116
+ },
117
+ "existingElements": [
118
+ {
119
+ "category": "function|class|type|interface|component|hook|configuration|constant",
120
+ "name": "ElementName",
121
+ "filePath": "path/to/file:line",
122
+ "signature": "Exact or brief signature",
123
+ "usedBy": ["path/to/consumer"]
124
+ }
125
+ ],
126
+ "dataModel": {
127
+ "detected": true,
128
+ "schemas": [
129
+ {
130
+ "name": "table_or_model",
131
+ "definitionPath": "path/to/file:line",
132
+ "fields": [
133
+ {
134
+ "name": "field_name",
135
+ "type": "field_type",
136
+ "constraints": ["NOT NULL", "UNIQUE"]
137
+ }
138
+ ],
139
+ "relationships": ["references other_table via foreign_key"]
140
+ }
141
+ ],
142
+ "accessPatterns": [
143
+ {
144
+ "operation": "read|write|aggregate|join|delete",
145
+ "location": "path/to/file:line",
146
+ "targetSchema": "table_or_model",
147
+ "description": "Observed access pattern"
148
+ }
149
+ ],
150
+ "migrationFiles": ["path/to/migration"]
151
+ },
152
+ "constraints": [
153
+ {
154
+ "type": "validation|business_rule|configuration|assumption",
155
+ "description": "Observed constraint",
156
+ "location": "path/to/file:line",
157
+ "impact": "Why design should respect it"
158
+ }
159
+ ],
160
+ "focusAreas": [
161
+ {
162
+ "area": "Area name",
163
+ "reason": "Why this area deserves attention",
164
+ "relatedFiles": ["path/to/file"],
165
+ "risk": "What could break if the design overlooks it"
166
+ }
167
+ ],
168
+ "testCoverage": {
169
+ "testedElements": ["element name"],
170
+ "untestedElements": ["element name"]
171
+ },
172
+ "limitations": ["What could not be fully traced and why"]
173
+ }
174
+ ```
175
+
176
+ ## Completion Criteria
177
+
178
+ - [ ] Parsed requirement context and identified analysis categories
179
+ - [ ] Read affected files and traced direct dependencies
180
+ - [ ] Recorded key interfaces and implementation elements with file:line evidence
181
+ - [ ] Performed data model discovery when data access patterns were present
182
+ - [ ] Extracted constraints and focus areas with concrete risks
183
+ - [ ] Checked existing tests for coverage signals
184
+ - [ ] Returned valid JSON
185
+ """
186
+
187
+ [[skills.config]]
188
+ path = ".agents/skills/ai-development-guide/SKILL.md"
189
+ enabled = true
190
+
191
+ [[skills.config]]
192
+ path = ".agents/skills/coding-rules/SKILL.md"
193
+ enabled = true
@@ -51,6 +51,7 @@ Skill Status:
51
51
 
52
52
  - **doc_type**: Document type (`PRD`/`ADR`/`UISpec`/`DesignDoc`)
53
53
  - **target**: Document path to review
54
+ - **code_verification**: Code-verifier results JSON (optional)
54
55
 
55
56
  ## Review Modes
56
57
 
@@ -78,6 +79,7 @@ Skill Status:
78
79
  - Specialized verification based on doc_type
79
80
  - For DesignDoc: Verify "Applicable Standards" section exists with explicit/implicit classification
80
81
  - Missing or incomplete → `critical` issue; implicit standards without confirmation → `important` issue
82
+ - When `code_verification` is provided, use its discrepancies and reverse coverage as pre-verified evidence during review
81
83
 
82
84
  ### Step 2: Target Document Collection
83
85
  - Load document specified by target
@@ -94,6 +96,7 @@ For DesignDoc, additionally verify:
94
96
  - [ ] Applicable standards listed with explicit/implicit classification
95
97
  - [ ] Dependencies described as existing have verification results or authoritative external source
96
98
  - [ ] Field propagation map present (when fields cross boundaries)
99
+ - [ ] Data-oriented designs contain concrete data design or Test Boundaries content, or an explicit N/A rationale
97
100
 
98
101
  #### Gate 1: Quality Assessment (only after Gate 0 passes)
99
102
 
@@ -109,6 +112,8 @@ For DesignDoc, additionally verify:
109
112
  - Code inspection evidence review: Verify inspected files are relevant to design scope; flag if key related files are missing
110
113
  - Dependency realizability check: For each dependency the Design Doc's Existing Codebase Analysis section describes as "existing", verify its definition exists in the codebase using file pattern search and content search. Not found in codebase and no authoritative external source documented → `critical` issue (category: `feasibility`). Found but the definition signature or named contract materially diverges from the Design Doc description → `important` issue (category: `consistency`)
111
114
  - **As-is implementation document review**: When code verification results are provided and the document describes existing implementation (not future requirements), verify that code-observable behaviors are stated as facts; speculative language about deterministic behavior → `important` issue
115
+ - **Data design completeness check**: When the document references persistence, storage, database, repository, query, ORM, migration, table, schema, or column concepts, verify that the Design Doc includes concrete data design content or an explicit N/A rationale. Useful evidence includes schema references, data model notes, or Test Boundaries with data layer strategy
116
+ - **Code-verifier evidence integration**: When `code_verification` is provided, reconcile major or critical discrepancies and undocumented data operations as part of Gate 1 completeness and consistency review
112
117
  - **Undetermined items review** [MANDATORY]: Every TBD, unknown, or open item MUST include: (1) **owner** — who resolves it, (2) **due** — when it gets resolved (which phase or milestone), (3) **next-phase handling** — how the next phase treats this gap. Missing any of these three → `important` issue
113
118
 
114
119
  **Perspective-specific Mode**:
@@ -57,18 +57,19 @@ Key checks:
57
57
  ## Verification Process
58
58
 
59
59
  ### 1. Skeleton Comment Extraction
60
- Extract the following comment patterns from test file:
61
- - `// AC:` → Original acceptance criteria
62
- - `// Behavior:` → Trigger → Process → Observable Result
63
- - `// @category:` → Test classification
64
- - `// @dependency:` → Dependencies
65
- - `// Verification items:` → Expected verification items (if present)
60
+ Extract the following annotation patterns from the test file using the project's comment syntax:
61
+ - `AC:` → Original acceptance criteria
62
+ - `Behavior:` → Trigger → Process → Observable Result
63
+ - `@category:` → Test classification
64
+ - `@dependency:` → Dependencies
65
+ - `@real-dependency:` → Dependencies expected to stay real in integration coverage
66
+ - `Verification items:` → Expected verification items (if present)
66
67
 
67
68
  ### 2. Implementation Verification
68
69
  For each test case:
69
70
  1. Check if "observable result" from Behavior is asserted
70
71
  2. Check if all items in Verification items are covered by assertions
71
- 3. Verify mock boundaries match @dependency
72
+ 3. Verify mock boundaries match `@dependency` and `@real-dependency`
72
73
 
73
74
  ### 3. Quality Assessment
74
75
  Evaluate each test for:
@@ -96,6 +96,8 @@ Must be performed before Design Doc creation:
96
96
  - Clearly document similar component search results (found components or "none")
97
97
  - Include dependency existence verification results (verified existing / requires new creation / external dependency)
98
98
  - Record adopted decision (use existing/improvement proposal/new implementation) and rationale
99
+ - When Codebase Analysis input is provided, use it as the baseline evidence set and extend it only where gaps remain
100
+ - When frontend behavior depends on persistence, repositories, API-backed data contracts, or schema-shaped responses, complete the `Test Boundaries` section with a concrete verification strategy. When those concerns are outside the scope, mark the section explicitly as not applicable.
99
101
 
100
102
  ### Integration Points【Important】
101
103
  Document all integration points with existing components in a "## Integration Point Map" section.
@@ -203,6 +205,13 @@ When a UI Spec exists for the feature (`docs/ui-spec/{feature-name}-ui-spec.md`)
203
205
  - `reverse-engineer`: Document existing frontend architecture as-is
204
206
 
205
207
  - **Requirements Analysis Results**: Requirements analysis results (scale determination, technical requirements, etc.)
208
+ - **Codebase Analysis** (optional, from codebase-analyzer):
209
+ - Use as the primary source for Existing Codebase Analysis when provided
210
+ - `existingElements` informs implementation path mapping and inspection evidence
211
+ - `dataModel` informs API contract expectations and data-shape references
212
+ - `focusAreas` indicate components, hooks, or state paths that deserve deeper inspection
213
+ - `constraints` inform compatibility and UI behavior constraints
214
+ - Additional investigation should focus on areas the analysis did not fully resolve
206
215
  - **PRD**: PRD document (if exists)
207
216
  - **UI Spec**: UI Specification document (if exists, for frontend features)
208
217
  - **Documents to Create**: ADR, Design Doc, or both
@@ -113,6 +113,8 @@ Must be performed before Design Doc creation:
113
113
  - Clearly document similar functionality search results (found implementations or "none")
114
114
  - Include dependency existence verification results (verified existing / requires new creation / external dependency)
115
115
  - Record adopted decision (use existing/improvement proposal/new implementation) and rationale
116
+ - When Codebase Analysis input is provided, use it as the baseline evidence set and extend it only where gaps remain
117
+ - When persistence, repositories, queries, migrations, or schema-bound behavior are part of scope, complete the `Test Boundaries` section with a concrete data layer verification strategy. When they are not part of scope, mark the section explicitly as not applicable.
116
118
 
117
119
  6. **Code Inspection Evidence**
118
120
  - Record all inspected files and key functions in "Code Inspection Evidence" section of Design Doc
@@ -233,6 +235,13 @@ Confirm and document conflicts with existing systems at each integration point t
233
235
  - `reverse-engineer`: Document existing architecture as-is
234
236
 
235
237
  - **Requirements Analysis Results**: Requirements analysis results (scale determination, technical requirements, etc.)
238
+ - **Codebase Analysis** (optional, from codebase-analyzer):
239
+ - Use as the primary source for Existing Codebase Analysis when provided
240
+ - `existingElements` informs implementation path mapping and inspection evidence
241
+ - `dataModel` informs schema references, data contracts, and persistence design
242
+ - `focusAreas` indicate areas requiring deeper design attention
243
+ - `constraints` inform design constraints, assumptions, and risk handling
244
+ - Additional investigation should focus on gaps or limitations that the analysis calls out
236
245
  - **PRD**: PRD document (if exists)
237
246
  - **Documents to Create**: ADR, Design Doc, or both
238
247
  - **Existing Architecture Information**:
package/README.md CHANGED
@@ -48,10 +48,11 @@ The framework runs a structured workflow — requirements → design → task de
48
48
  A single request becomes a structured development process:
49
49
 
50
50
  1. **Understand** the problem (scale, constraints, affected files)
51
- 2. **Design** the solution (ADR, Design Doc with acceptance criteria)
52
- 3. **Break it into tasks** (atomic, 1 commit each)
53
- 4. **Implement with tests** (TDD per task)
54
- 5. **Run quality checks** (lint, test, build — no failing checks)
51
+ 2. **Analyze the existing codebase** (dependencies, data layer, risk areas)
52
+ 3. **Design** the solution (ADR, Design Doc with acceptance criteria)
53
+ 4. **Break it into tasks** (atomic, 1 commit each)
54
+ 5. **Implement with tests** (TDD per task)
55
+ 6. **Run quality checks** (lint, test, build — no failing checks)
55
56
 
56
57
  Each step is handled by a specialized subagent in its own context, preventing context pollution and reducing error accumulation in long-running tasks:
57
58
 
@@ -62,9 +63,13 @@ requirement-analyzer → Scale determination (Small / Medium / Large)
62
63
 
63
64
  prd-creator → Product requirements (Large scale)
64
65
 
66
+ codebase-analyzer → Existing codebase facts + focus areas
67
+
65
68
  technical-designer → ADR + Design Doc with acceptance criteria
66
69
 
67
- document-reviewer Quality gate
70
+ code-verifier Design Doc vs existing code verification
71
+
72
+ document-reviewer → Quality gate with verification evidence
68
73
 
69
74
  acceptance-test-gen → Test skeletons from ACs
70
75
 
@@ -222,6 +227,7 @@ Codex spawns these as needed during recipe execution. Each agent runs in its own
222
227
  | `technical-designer` | ADR and Design Doc creation (backend) |
223
228
  | `technical-designer-frontend` | Frontend ADR and Design Doc creation (React) |
224
229
  | `ui-spec-designer` | UI Specification from PRD and optional prototype code |
230
+ | `codebase-analyzer` | Existing codebase analysis before Design Doc creation |
225
231
  | `work-planner` | Work plan creation from Design Docs |
226
232
  | `document-reviewer` | Document consistency and approval |
227
233
  | `design-sync` | Cross-document consistency verification |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-workflows",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Task-oriented agentic coding framework for OpenAI Codex CLI — skills, recipes, and subagents for structured development workflows",
5
5
  "license": "MIT",
6
6
  "author": "Shinsuke Kagawa",