codex-workflows 0.6.8 → 0.6.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 (28) hide show
  1. package/.agents/skills/ai-development-guide/SKILL.md +5 -3
  2. package/.agents/skills/ai-development-guide/references/frontend.md +11 -19
  3. package/.agents/skills/coding-rules/references/typescript.md +17 -12
  4. package/.agents/skills/documentation-criteria/references/plan-template.md +1 -1
  5. package/.agents/skills/documentation-criteria/references/task-template.md +8 -0
  6. package/.agents/skills/testing/SKILL.md +5 -5
  7. package/.agents/skills/testing/references/typescript.md +2 -6
  8. package/.codex/agents/acceptance-test-generator.toml +2 -44
  9. package/.codex/agents/code-reviewer.toml +4 -57
  10. package/.codex/agents/code-verifier.toml +1 -47
  11. package/.codex/agents/codebase-analyzer.toml +1 -106
  12. package/.codex/agents/design-sync.toml +2 -64
  13. package/.codex/agents/document-reviewer.toml +3 -78
  14. package/.codex/agents/integration-test-reviewer.toml +1 -26
  15. package/.codex/agents/investigator.toml +1 -73
  16. package/.codex/agents/quality-fixer-frontend.toml +4 -105
  17. package/.codex/agents/quality-fixer.toml +4 -122
  18. package/.codex/agents/requirement-analyzer.toml +1 -29
  19. package/.codex/agents/rule-advisor.toml +1 -79
  20. package/.codex/agents/scope-discoverer.toml +1 -70
  21. package/.codex/agents/security-reviewer.toml +1 -19
  22. package/.codex/agents/solver.toml +5 -54
  23. package/.codex/agents/task-decomposer.toml +18 -0
  24. package/.codex/agents/task-executor-frontend.toml +16 -142
  25. package/.codex/agents/task-executor.toml +16 -142
  26. package/.codex/agents/ui-analyzer.toml +1 -157
  27. package/.codex/agents/verifier.toml +2 -65
  28. package/package.json +1 -1
@@ -165,7 +165,9 @@ To isolate problems, attempt reproduction with minimal code:
165
165
  - Replace external dependencies with mocks
166
166
  - Create minimal configuration that reproduces problem
167
167
 
168
- ### 4. Debug Log Output
168
+ ### 4. Debug Log Output (temporary)
169
+ Add structured debug logs to isolate the issue, then remove them before commit.
170
+
169
171
  ```
170
172
  Pattern: Structured logging with context
171
173
  {
@@ -204,7 +206,7 @@ Universal quality assurance phases applicable to all languages:
204
206
  ### Phase 3: Testing
205
207
  1. **Unit Tests**: Run all unit tests
206
208
  2. **Integration Tests**: Run integration tests
207
- 3. **Test Coverage**: Measure and verify coverage meets standards
209
+ 3. **Test Coverage**: Measure coverage when configured and use it to find gaps
208
210
  4. **E2E Tests**: Run end-to-end tests
209
211
 
210
212
  ### Phase 4: Final Quality Gate [MANDATORY]
@@ -212,7 +214,7 @@ All checks MUST pass before proceeding:
212
214
  - Zero static analysis errors
213
215
  - Build succeeds
214
216
  - All tests pass
215
- - Coverage meets threshold
217
+ - Coverage threshold passes when the project, task file, work plan, or Design Doc defines one. When no threshold is configured, use coverage output only to identify untested critical paths.
216
218
 
217
219
  **ENFORCEMENT**: Cannot proceed with ANY quality check failures — fix ALL errors before marking task complete
218
220
 
@@ -75,28 +75,19 @@ console.log('DEBUG:', {
75
75
 
76
76
  ## Frontend Quality Check Workflow
77
77
 
78
- Use the appropriate run command based on the `packageManager` field in package.json.
78
+ Read `package.json` scripts and run them with the project's package manager from the `packageManager` field. Map the phases below using the script names declared in `package.json`.
79
79
 
80
- ### Common Commands
81
- - `dev` - Development server
82
- - `build` - Production build
83
- - `preview` - Preview production build
84
- - `type-check` - Type check (no emit)
85
-
86
- ### Quality Check Phases
87
- **Phase 1-3: Basic Checks**
88
- - `check` - Linter + formatter (Biome, ESLint, Prettier, etc.)
89
- - `build` - TypeScript build
90
-
91
- **Phase 4-5: Tests and Final Confirmation**
92
- - `test` - Test execution
93
- - `test:coverage:fresh` - Coverage measurement (fresh cache)
94
- - `check:all` - Overall integrated check
80
+ ### Phases
81
+ 1. **Lint/format** - the project's formatter and linter, such as Biome or ESLint plus Prettier
82
+ 2. **Type check** - type check without emit when the project has a dedicated command
83
+ 3. **Build** - production build
84
+ 4. **Test** - unit and integration tests
85
+ 5. **Coverage** - coverage run when configured or when the task added or changed behavior
95
86
 
96
87
  ### Troubleshooting
97
- - **Port in use error**: Run `cleanup:processes` script if available
98
- - **Cache issues**: Run tests with fresh cache option
99
- - **Dependency errors**: Clean reinstall dependencies
88
+ - **Port already in use**: stop the stale dev, preview, or test process holding the port
89
+ - **Stale cache**: re-run with the project's fresh or clean-cache option
90
+ - **Dependency errors**: clean reinstall dependencies
100
91
 
101
92
  ## Frontend Technical Decisions
102
93
 
@@ -108,6 +99,7 @@ Use the appropriate run command based on the `packageManager` field in package.j
108
99
  ### Performance vs Readability
109
100
  - Prioritize readability unless clear bottleneck exists
110
101
  - Measure before optimizing (use React DevTools Profiler, not guesses)
102
+ - When React Compiler is enabled, routine memoization is automatic. Use manual memoization only for a measured bottleneck or stable reference identity required by third-party APIs or effect dependencies.
111
103
  - Document reason with comments when optimizing
112
104
 
113
105
  ## Frontend Impact Analysis
@@ -62,6 +62,11 @@ function isUser(value: unknown): value is User {
62
62
  - **Component Hierarchy**: Follow the project's existing component architecture. Use Atoms > Molecules > Organisms > Templates > Pages only when the project adopts Atomic Design.
63
63
  - **Co-location**: Place tests, styles, and related files alongside components
64
64
 
65
+ **Server/Client Boundary (RSC frameworks only, such as Next.js App Router)**
66
+ - Default to server components for data fetching and rendering. Isolate interactivity behind a `"use client"` boundary at the smallest scope that needs it.
67
+ - Keep browser-only APIs such as `window`, `localStorage`, and event handlers inside client components.
68
+ - Skip this section for client-only SPAs with no server-component runtime.
69
+
65
70
  **State Management Patterns**
66
71
  - **Local State**: `useState` for component-specific state
67
72
  - **Context API**: For sharing state across component tree (theme, auth, etc.)
@@ -95,19 +100,18 @@ setUsers(users)
95
100
  - Type-safe: Always define Props type explicitly
96
101
 
97
102
  **Environment Variables**
98
- - **Use build tool's environment variable system**: `process.env` does not work in browsers
99
- - Centrally manage environment variables through configuration layer
100
- - Implement proper type safety and default value handling
103
+ - **Use the build tool's env accessor**: read client-side env through the bundler's exposed accessor, such as Vite `import.meta.env` or Next.js/CRA prefixed `process.env`.
104
+ - **Only prefixed vars reach the client**: build tools expose only vars carrying their public prefix. Match the project's bundler, such as Vite `VITE_`, Next.js `NEXT_PUBLIC_`, or CRA `REACT_APP_`.
105
+ - Centrally manage environment variables through a typed configuration layer with defaults.
101
106
 
102
107
  ```typescript
103
- // Build tool environment variables (public values only)
108
+ // Client-exposed env must carry the bundler's public prefix, or it is undefined in the browser.
109
+ // Vite: import.meta.env.VITE_API_URL
110
+ // Next.js: process.env.NEXT_PUBLIC_API_URL
104
111
  const config = {
105
- apiUrl: import.meta.env.API_URL || 'http://localhost:3000',
106
- appName: import.meta.env.APP_NAME || 'My App'
112
+ apiUrl: import.meta.env.VITE_API_URL || 'http://localhost:3000',
113
+ appName: import.meta.env.VITE_APP_NAME || 'My App'
107
114
  }
108
-
109
- // Does not work in frontend
110
- // const apiUrl = process.env.API_URL
111
115
  ```
112
116
 
113
117
  **Security (Client-side Constraints)**
@@ -118,7 +122,7 @@ const config = {
118
122
 
119
123
  ```typescript
120
124
  // Bad: API key exposed in browser
121
- // const apiKey = import.meta.env.API_KEY
125
+ // const apiKey = import.meta.env.VITE_API_KEY
122
126
  // const response = await fetch(`https://api.example.com/data?key=${apiKey}`)
123
127
 
124
128
  // Good: Backend manages secrets, frontend accesses via proxy
@@ -132,6 +136,7 @@ const response = await fetch('/api/data') // Backend handles API key authenticat
132
136
  - Promise Handling: Always use `async/await`
133
137
  - Error Handling: Always handle with `try-catch` or Error Boundary
134
138
  - Type Definition: Explicitly define return value types (e.g., `Promise<Result>`)
139
+ - Effect race/cleanup: guard `useEffect` data fetches against out-of-order responses and post-unmount state updates with `AbortController`, a mounted/stale flag, or a server-state library such as React Query or SWR.
135
140
 
136
141
  **Format Rules**
137
142
  - Semicolon omission (follow project formatter settings)
@@ -209,10 +214,10 @@ Never include sensitive information (password, token, apiKey, secret, creditCard
209
214
 
210
215
  ## Performance Optimization
211
216
 
212
- - Component Memoization: Use React.memo for expensive components
217
+ - Automatic memoization: when React Compiler is enabled, rely on it. Use manual `React.memo`, `useMemo`, or `useCallback` only for a profiler-confirmed bottleneck or stable reference identity required by third-party APIs or effect dependencies.
213
218
  - State Optimization: Minimize re-renders with proper state structure
214
219
  - Lazy Loading: Use React.lazy and Suspense for code splitting
215
- - Bundle Size: Monitor with the `build` script and keep under 500KB
220
+ - Bundle Size: Monitor with the build script against the project's budget
216
221
 
217
222
  ## Non-functional Requirements
218
223
 
@@ -243,7 +243,7 @@ This phase is required for all implementation approaches.
243
243
  - [ ] Security review: Verify security considerations from Design Doc are implemented
244
244
  - [ ] Quality checks (types, lint, format)
245
245
  - [ ] Execute all tests (including integration/E2E from test skeletons, when provided)
246
- - [ ] Coverage 70%+
246
+ - [ ] Coverage threshold passes when configured
247
247
  - [ ] Document updates
248
248
 
249
249
  ### Quality Assurance
@@ -17,6 +17,13 @@ Metadata:
17
17
  Files to read before starting implementation. Use concrete file paths, optionally with a section/function hint:
18
18
  - [e.g., src/orders/checkout.ts (processOrder function)]
19
19
 
20
+ ## Change Category
21
+ (Include this field only when the task is a bug fix, regression, state-change, or boundary-change. Omit otherwise.)
22
+
23
+ `Change Category: <one or more of bug-fix, regression, state-change, boundary-change, comma-separated>`
24
+
25
+ When present, sweep cases sharing the same path, contract, persisted state, or external boundary for the same class of defect during the Red Phase.
26
+
20
27
  ## Binding Decisions
21
28
  (Include this section when the work plan's ADR Bindings table covers this task. Omit otherwise.)
22
29
 
@@ -34,6 +41,7 @@ Brief observations recorded after reading Investigation Targets:
34
41
  ## Implementation Steps (TDD: Red-Green-Refactor)
35
42
  ### 1. Red Phase
36
43
  - [ ] Read all Investigation Targets and update Investigation Notes
44
+ - [ ] (When Change Category is set) Sweep adjacent cases sharing the same path, contract, persisted state, or external boundary for the same class of defect; fold any in-scope residual into failing tests
37
45
  - [ ] Review dependency deliverables (if any)
38
46
  - [ ] Verify/create contract definitions
39
47
  - [ ] Write failing tests
@@ -52,11 +52,11 @@ For language-specific testing patterns, also read:
52
52
 
53
53
  ## Quality Requirements [MANDATORY]
54
54
 
55
- ### Coverage Standards
55
+ ### Coverage
56
56
 
57
- - **Minimum 80% code coverage** for production code
58
- - Prioritize critical paths and business logic
59
- - Use coverage as a guide, not a goal
57
+ - Treat coverage as a diagnostic signal for finding untested areas, not a target. Targets get gamed into trivial tests.
58
+ - Concentrate tests on critical paths, business logic, and behavior whose regression would matter.
59
+ - Prioritize meaningful assertions over the coverage number. Any required threshold comes from the project's CI, task file, work plan, or Design Doc.
60
60
 
61
61
  ### Test Characteristics
62
62
 
@@ -279,7 +279,7 @@ Always test:
279
279
  ☐ All tests pass
280
280
  ☐ No tests skipped or commented
281
281
  ☐ No debug code left in tests
282
- Test coverage meets standards (≥ 80%)
282
+ Coverage threshold passes when the project, task file, work plan, or Design Doc defines one
283
283
  ☐ Tests run in reasonable time
284
284
 
285
285
  ### Zero Tolerance Policy
@@ -10,13 +10,9 @@ import { render, screen } from '@testing-library/react'
10
10
  import userEvent from '@testing-library/user-event'
11
11
  ```
12
12
 
13
- ### Coverage Requirements
13
+ ### Where to Concentrate Test Rigor
14
14
 
15
- - **Overall minimum**: 60%
16
- - **Atomic Design projects**: Atoms 70%+, Molecules 65%+, Organisms 60%+
17
- - **Other component architectures**: Keep 60% as the baseline and raise foundational or highly reused components to 70%+
18
- - **Custom Hooks**: 65%+
19
- - **Utils**: 70%+
15
+ Test foundational, high-reuse units the hardest: shared components, custom hooks, utilities, and business rules reused across features carry the widest blast radius. Higher-composition surfaces such as pages and organisms lean more on integration or E2E coverage. Any numeric threshold is the project's CI, task file, work plan, or Design Doc config.
20
16
 
21
17
  ### Test Types
22
18
 
@@ -265,53 +265,11 @@ A skeleton is committed before its implementation exists, so its committed form
265
265
  ### Generation Report
266
266
 
267
267
  ```json
268
- {
269
- "status": "completed",
270
- "feature": "[feature name]",
271
- "generatedFiles": {
272
- "integration": "[path]/[feature].int.test.[ext]",
273
- "fixtureE2e": null,
274
- "serviceE2e": null
275
- },
276
- "budgetUsage": {
277
- "integration": "2/3",
278
- "fixtureE2e": "0/3",
279
- "serviceE2e": "0/2"
280
- },
281
- "e2eAbsenceReason": {
282
- "fixtureE2e": "all_e2e_candidates_below_threshold",
283
- "serviceE2e": "no_real_service_dependency"
284
- },
285
- "boundaryProofGaps": []
286
- }
268
+ {"status":"completed","feature":"[feature name]","generatedFiles":{"integration":"[path]/[feature].int.test.[ext]","fixtureE2e":null,"serviceE2e":null},"budgetUsage":{"integration":"2/3","fixtureE2e":"0/3","serviceE2e":"0/2"},"e2eAbsenceReason":{"fixtureE2e":"all_e2e_candidates_below_threshold","serviceE2e":"no_real_service_dependency"},"boundaryProofGaps":[]}
287
269
  ```
288
270
 
289
271
  ```json
290
- {
291
- "status": "completed",
292
- "feature": "[feature name]",
293
- "generatedFiles": {
294
- "integration": "[path]/[feature].int.test.[ext]",
295
- "fixtureE2e": "[path]/[feature].fixture.e2e.test.[ext]",
296
- "serviceE2e": "[path]/[feature].service.e2e.test.[ext]"
297
- },
298
- "budgetUsage": {
299
- "integration": "2/3",
300
- "fixtureE2e": "1/3",
301
- "serviceE2e": "1/2"
302
- },
303
- "e2eAbsenceReason": {
304
- "fixtureE2e": null,
305
- "serviceE2e": null
306
- },
307
- "boundaryProofGaps": [
308
- {
309
- "acId": "[AC-XXX]",
310
- "boundaryPath": "[branch/state/input/lifecycle/fallback/visibility path]",
311
- "reason": "budget_insufficient_for_boundary_proof"
312
- }
313
- ]
314
- }
272
+ {"status":"completed","feature":"[feature name]","generatedFiles":{"integration":"[path]/[feature].int.test.[ext]","fixtureE2e":"[path]/[feature].fixture.e2e.test.[ext]","serviceE2e":"[path]/[feature].service.e2e.test.[ext]"},"budgetUsage":{"integration":"2/3","fixtureE2e":"1/3","serviceE2e":"1/2"},"e2eAbsenceReason":{"fixtureE2e":null,"serviceE2e":null},"boundaryProofGaps":[{"acId":"[AC-XXX]","boundaryPath":"[branch/state/input/lifecycle/fallback/visibility path]","reason":"budget_insufficient_for_boundary_proof"}]}
315
273
  ```
316
274
 
317
275
  ## Test Meta Information Assignment
@@ -78,6 +78,7 @@ For each acceptance criterion extracted in Step 1:
78
78
  - For behavior-changing ACs, confirm the evidence covers main and boundary paths. Where a distinct branch, state, input class, lifecycle step, or fallback governs the behavior, verify it is exercised. Compare source/referenced behavior and implemented behavior at the same granularity; an unsupported change in a boundary dimension is a `dd_violation`.
79
79
  - Confirm the implementation keeps the core mechanism the AC, Design Doc, or referenced materials require. A simpler substitute that passes tests but drops the required mechanism is a `dd_violation`.
80
80
  - For changes to persisted, shared, or externally observable state, identify the publication boundary where the new state becomes observable to another process, component, user, or later step. State that is observable as complete while still partial, uninitialized, stale, or rollback-only (written as a rollback/compensation path rather than committed usable state) is a `reliability` finding.
81
+ - When the reviewed task has `Change Category` set to `bug-fix`, `regression`, `state-change`, or `boundary-change`, check cases sharing its path, contract, persisted state, or external boundary. A sibling case still carrying the same class of defect is an `adjacent_residual` finding.
81
82
 
82
83
  #### 2-2. Identifier Verification
83
84
  For each identifier specification extracted in Step 1:
@@ -134,12 +135,14 @@ Classify each quality finding into one of:
134
135
  - `maintainability`: code structure impedes change or comprehension
135
136
  - `reliability`: missing safeguards could cause runtime failure
136
137
  - `coverage_gap`: acceptance criteria lack meaningful test verification
138
+ - `adjacent_residual`: a case sharing the change's path, contract, persisted state, or external boundary still carries the same class of defect
137
139
 
138
140
  Each finding MUST include a rationale:
139
141
  - `dd_violation`: what the Design Doc says vs what code does
140
142
  - `maintainability`: the concrete maintenance or comprehension risk
141
143
  - `reliability`: the failure scenario and triggering conditions
142
144
  - `coverage_gap`: the untested AC and why coverage matters
145
+ - `adjacent_residual`: which adjacent case shares the path, contract, persisted state, or external boundary and how it still exhibits the defect class
143
146
 
144
147
  ### 4. Check Architecture Compliance
145
148
  Verify against the Design Doc architecture:
@@ -161,63 +164,7 @@ Return the JSON result as the final response. See Output Format for the schema.
161
164
  ## Output Format
162
165
 
163
166
  ```json
164
- {
165
- "complianceRate": "[X]%",
166
- "identifierMatchRate": "[X]%",
167
- "verdict": "[pass/needs-improvement/needs-redesign]",
168
-
169
- "acceptanceCriteria": [
170
- {
171
- "item": "[acceptance criteria name]",
172
- "status": "fulfilled|partially_fulfilled|unfulfilled",
173
- "confidence": "high|medium|low",
174
- "location": "[file:line, if implemented]",
175
- "evidence": ["[source1: file:line]", "[source2: test file:line]"],
176
- "gap": "[what is missing or deviating, if not fully fulfilled]",
177
- "suggestion": "[specific fix, if not fully fulfilled]"
178
- }
179
- ],
180
-
181
- "identifierVerification": [
182
- {
183
- "identifier": "[identifier name]",
184
- "designDocValue": "[value specified in Design Doc]",
185
- "codeValue": "[value found in code, or 'not found']",
186
- "location": "[file:line]",
187
- "confidence": "high|medium|low",
188
- "evidence": ["[source1: file:line]", "[source2: config file:line]"],
189
- "match": false
190
- }
191
- ],
192
-
193
- "qualityFindings": [
194
- {
195
- "category": "dd_violation|maintainability|reliability|coverage_gap",
196
- "location": "[filename:function or file:line]",
197
- "description": "[specific issue]",
198
- "rationale": "[why this matters]",
199
- "suggestion": "[specific improvement]"
200
- }
201
- ],
202
-
203
- "summary": {
204
- "acsTotal": 0,
205
- "acsFulfilled": 0,
206
- "acsPartial": 0,
207
- "acsUnfulfilled": 0,
208
- "identifiersTotal": 0,
209
- "identifiersMatched": 0,
210
- "lowConfidenceItems": 0,
211
- "findingsByCategory": {
212
- "dd_violation": 0,
213
- "maintainability": 0,
214
- "reliability": 0,
215
- "coverage_gap": 0
216
- }
217
- },
218
-
219
- "nextAction": "[highest priority action needed]"
220
- }
167
+ {"complianceRate":"[X]%","identifierMatchRate":"[X]%","verdict":"[pass/needs-improvement/needs-redesign]","acceptanceCriteria":[{"item":"[acceptance criteria name]","status":"fulfilled|partially_fulfilled|unfulfilled","confidence":"high|medium|low","location":"[file:line, if implemented]","evidence":["[source1: file:line]","[source2: test file:line]"],"gap":"[what is missing or deviating, if not fully fulfilled]","suggestion":"[specific fix, if not fully fulfilled]"}],"identifierVerification":[{"identifier":"[identifier name]","designDocValue":"[value specified in Design Doc]","codeValue":"[value found in code, or 'not found']","location":"[file:line]","confidence":"high|medium|low","evidence":["[source1: file:line]","[source2: config file:line]"],"match":false}],"qualityFindings":[{"category":"dd_violation|maintainability|reliability|coverage_gap|adjacent_residual","location":"[filename:function or file:line]","description":"[specific issue]","rationale":"[why this matters]","suggestion":"[specific improvement]"}],"summary":{"acsTotal":0,"acsFulfilled":0,"acsPartial":0,"acsUnfulfilled":0,"identifiersTotal":0,"identifiersMatched":0,"lowConfidenceItems":0,"findingsByCategory":{"dd_violation":0,"maintainability":0,"reliability":0,"coverage_gap":0,"adjacent_residual":0}},"nextAction":"[highest priority action needed]"}
221
168
  ```
222
169
 
223
170
  `identifierVerification` MUST include mismatches only. Use `summary.identifiersTotal` and `summary.identifiersMatched` for overall counts.
@@ -158,53 +158,7 @@ Return the JSON result as the final response. See Output Format for the schema.
158
158
  ### Essential Output (default)
159
159
 
160
160
  ```json
161
- {
162
- "summary": {
163
- "docType": "prd|design-doc",
164
- "documentPath": "/path/to/document.md",
165
- "verifiableClaimCount": 24,
166
- "matchCount": 20,
167
- "consistencyScore": 85,
168
- "status": "consistent|mostly_consistent|needs_review|inconsistent"
169
- },
170
- "claimCoverage": {
171
- "sectionsAnalyzed": 8,
172
- "sectionsWithClaims": 7,
173
- "sectionsWithZeroClaims": ["Appendix"]
174
- },
175
- "discrepancies": [
176
- {
177
- "id": "D001",
178
- "status": "drift|gap|conflict",
179
- "severity": "critical|major|minor",
180
- "claim": "Brief claim description",
181
- "documentLocation": "PRD.md:45",
182
- "codeLocation": "src/auth.ts:120",
183
- "evidence": "Observed implementation or enumeration result",
184
- "classification": "What was found"
185
- }
186
- ],
187
- "reverseCoverage": {
188
- "routesInCode": 6,
189
- "routesDocumented": 5,
190
- "undocumentedRoutes": ["POST /admin/reindex (src/routes/admin.ts:42)"],
191
- "testFilesFound": 4,
192
- "testFilesDocumented": 2,
193
- "exportsInCode": 12,
194
- "exportsDocumented": 10,
195
- "undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"],
196
- "dataOperationsInCode": 3,
197
- "dataOperationsDocumented": 2,
198
- "undocumentedDataOperations": ["userRepository.saveUser (src/user/repository.ts:41)"],
199
- "testBoundariesSectionPresent": true
200
- },
201
- "coverage": {
202
- "documented": ["Feature areas with documentation"],
203
- "undocumented": ["Code features lacking documentation"],
204
- "unimplemented": ["Documented specs not yet implemented"]
205
- },
206
- "limitations": ["What could not be verified and why"]
207
- }
161
+ {"summary":{"docType":"prd|design-doc","documentPath":"/path/to/document.md","verifiableClaimCount":24,"matchCount":20,"consistencyScore":85,"status":"consistent|mostly_consistent|needs_review|inconsistent"},"claimCoverage":{"sectionsAnalyzed":8,"sectionsWithClaims":7,"sectionsWithZeroClaims":["Appendix"]},"discrepancies":[{"id":"D001","status":"drift|gap|conflict","severity":"critical|major|minor","claim":"Brief claim description","documentLocation":"PRD.md:45","codeLocation":"src/auth.ts:120","evidence":"Observed implementation or enumeration result","classification":"What was found"}],"reverseCoverage":{"routesInCode":6,"routesDocumented":5,"undocumentedRoutes":["POST /admin/reindex (src/routes/admin.ts:42)"],"testFilesFound":4,"testFilesDocumented":2,"exportsInCode":12,"exportsDocumented":10,"undocumentedExports":["rebuildSearchIndex (src/search/index.ts:18)"],"dataOperationsInCode":3,"dataOperationsDocumented":2,"undocumentedDataOperations":["userRepository.saveUser (src/user/repository.ts:41)"],"testBoundariesSectionPresent":true},"coverage":{"documented":["Feature areas with documentation"],"undocumented":["Code features lacking documentation"],"unimplemented":["Documented specs not yet implemented"]},"limitations":["What could not be verified and why"]}
208
162
  ```
209
163
 
210
164
  ### Extended Output (verbose: true)
@@ -129,112 +129,7 @@ Return the JSON result as the final response.
129
129
  ## Output Format
130
130
 
131
131
  ```json
132
- {
133
- "analysisScope": {
134
- "filesAnalyzed": ["path/to/file"],
135
- "tracedDependencies": ["path/to/dependency"],
136
- "categoriesDetected": ["data_layer", "validation"]
137
- },
138
- "existingElements": [
139
- {
140
- "category": "function|class|type|interface|component|hook|configuration|constant",
141
- "name": "ElementName",
142
- "filePath": "path/to/file:line",
143
- "signature": "Exact or brief signature",
144
- "usedBy": ["path/to/consumer"]
145
- }
146
- ],
147
- "dataModel": {
148
- "detected": true,
149
- "schemas": [
150
- {
151
- "name": "table_or_model",
152
- "definitionPath": "path/to/file:line",
153
- "fields": [
154
- {
155
- "name": "field_name",
156
- "type": "field_type",
157
- "constraints": ["NOT NULL", "UNIQUE"]
158
- }
159
- ],
160
- "relationships": ["references other_table via foreign_key"]
161
- }
162
- ],
163
- "accessPatterns": [
164
- {
165
- "operation": "read|write|aggregate|join|delete",
166
- "location": "path/to/file:line",
167
- "targetSchema": "table_or_model",
168
- "description": "Observed access pattern"
169
- }
170
- ],
171
- "migrationFiles": ["path/to/migration"]
172
- },
173
- "dataTransformationPipelines": [
174
- {
175
- "entryPoint": "functionOrMethodName (path/to/file:line)",
176
- "steps": [
177
- {
178
- "order": 1,
179
- "method": "functionOrMethodName (path/to/file:line)",
180
- "input": "Input data or format at this step",
181
- "output": "Output data or format at this step",
182
- "externalLookups": ["Config.KEY lookup", "Reference table mapping"],
183
- "transformation": "What changed and why it matters"
184
- }
185
- ],
186
- "intermediateFormats": ["Intermediate representation if applicable"],
187
- "finalOutput": "Final output shape or observable value"
188
- }
189
- ],
190
- "entryPointInventory": [
191
- {
192
- "entryPoint": "functionOrMethodName (path/to/file:line)",
193
- "classification": "change-relevant|non-relevant",
194
- "inputShape": "Input type or shape",
195
- "outputShape": "Output type or shape"
196
- }
197
- ],
198
- "constraints": [
199
- {
200
- "type": "validation|business_rule|configuration|assumption",
201
- "description": "Observed constraint",
202
- "location": "path/to/file:line",
203
- "impact": "Why design should respect it"
204
- }
205
- ],
206
- "qualityAssurance": {
207
- "mechanisms": [
208
- {
209
- "tool": "Tool or check name",
210
- "enforces": "What quality aspect it enforces",
211
- "configLocation": "path/to/config:line",
212
- "coveredFiles": ["affected files or directories covered by this mechanism"],
213
- "type": "linter|static_analysis|schema_validator|domain_specific|ci_check"
214
- }
215
- ],
216
- "domainConstraints": [
217
- {
218
- "constraint": "Description of the domain-specific constraint",
219
- "source": "path/to/config-or-ci:line",
220
- "affectedFiles": ["files subject to this constraint"]
221
- }
222
- ]
223
- },
224
- "focusAreas": [
225
- {
226
- "area": "Area name",
227
- "reason": "Why this area deserves attention",
228
- "relatedFiles": ["path/to/file"],
229
- "risk": "What could break if the design overlooks it"
230
- }
231
- ],
232
- "testCoverage": {
233
- "testedElements": ["element name"],
234
- "untestedElements": ["element name"]
235
- },
236
- "limitations": ["What could not be fully traced and why"]
237
- }
132
+ {"analysisScope":{"filesAnalyzed":["path/to/file"],"tracedDependencies":["path/to/dependency"],"categoriesDetected":["data_layer","validation"]},"existingElements":[{"category":"function|class|type|interface|component|hook|configuration|constant","name":"ElementName","filePath":"path/to/file:line","signature":"Exact or brief signature","usedBy":["path/to/consumer"]}],"dataModel":{"detected":true,"schemas":[{"name":"table_or_model","definitionPath":"path/to/file:line","fields":[{"name":"field_name","type":"field_type","constraints":["NOT NULL","UNIQUE"]}],"relationships":["references other_table via foreign_key"]}],"accessPatterns":[{"operation":"read|write|aggregate|join|delete","location":"path/to/file:line","targetSchema":"table_or_model","description":"Observed access pattern"}],"migrationFiles":["path/to/migration"]},"dataTransformationPipelines":[{"entryPoint":"functionOrMethodName (path/to/file:line)","steps":[{"order":1,"method":"functionOrMethodName (path/to/file:line)","input":"Input data or format at this step","output":"Output data or format at this step","externalLookups":["Config.KEY lookup","Reference table mapping"],"transformation":"What changed and why it matters"}],"intermediateFormats":["Intermediate representation if applicable"],"finalOutput":"Final output shape or observable value"}],"entryPointInventory":[{"entryPoint":"functionOrMethodName (path/to/file:line)","classification":"change-relevant|non-relevant","inputShape":"Input type or shape","outputShape":"Output type or shape"}],"constraints":[{"type":"validation|business_rule|configuration|assumption","description":"Observed constraint","location":"path/to/file:line","impact":"Why design should respect it"}],"qualityAssurance":{"mechanisms":[{"tool":"Tool or check name","enforces":"What quality aspect it enforces","configLocation":"path/to/config:line","coveredFiles":["affected files or directories covered by this mechanism"],"type":"linter|static_analysis|schema_validator|domain_specific|ci_check"}],"domainConstraints":[{"constraint":"Description of the domain-specific constraint","source":"path/to/config-or-ci:line","affectedFiles":["files subject to this constraint"]}]},"focusAreas":[{"area":"Area name","reason":"Why this area deserves attention","relatedFiles":["path/to/file"],"risk":"What could break if the design overlooks it"}],"testCoverage":{"testedElements":["element name"],"untestedElements":["element name"]},"limitations":["What could not be fully traced and why"]}
238
133
  ```
239
134
 
240
135
  ## Completion Criteria
@@ -228,57 +228,7 @@ Severity Assessment:
228
228
  ### Output Format [JSON MANDATORY]
229
229
 
230
230
  ```json
231
- {
232
- "metadata": {
233
- "review_type": "design-sync",
234
- "source_design": "[source Design Doc path]",
235
- "analyzed_docs": 3,
236
- "analysis_date": "[execution datetime]"
237
- },
238
- "summary": {
239
- "total_conflicts": 2,
240
- "critical": 1,
241
- "high": 1,
242
- "medium": 0,
243
- "confirmed_conflicts": 1,
244
- "candidate_conflicts": 1,
245
- "sync_status": "CONFLICTS_FOUND"
246
- },
247
- "confirmed_conflicts": [
248
- {
249
- "id": "CONFLICT-001",
250
- "severity": "critical",
251
- "confidence": "high",
252
- "match_basis": "exact_string",
253
- "type": "Type definition mismatch",
254
- "source_file": "[source file]",
255
- "source_location": "[section/line]",
256
- "source_value": "[content in source file]",
257
- "target_file": "[file with conflict]",
258
- "target_location": "[section/line]",
259
- "target_value": "[conflicting content]",
260
- "recommendation": "[Recommend unifying to source file's value]"
261
- }
262
- ],
263
- "candidate_conflicts": [
264
- {
265
- "id": "CANDIDATE-001",
266
- "severity": "high",
267
- "confidence": "medium",
268
- "match_basis": "same_ac_slot",
269
- "type": "Acceptance criteria conflict",
270
- "source_file": "[source file]",
271
- "source_location": "[section/line]",
272
- "source_value": "[content in source file]",
273
- "target_file": "[file with conflict]",
274
- "target_location": "[section/line]",
275
- "target_value": "[conflicting content]",
276
- "reason": "[structural evidence linking the items]",
277
- "recommendation": "[Recommend reviewing whether these describe the same design slot]"
278
- }
279
- ],
280
- "no_conflicts_docs": ["[filename1]", "[filename2]"]
281
- }
231
+ {"metadata":{"review_type":"design-sync","source_design":"[source Design Doc path]","analyzed_docs":3,"analysis_date":"[execution datetime]"},"summary":{"total_conflicts":2,"critical":1,"high":1,"medium":0,"confirmed_conflicts":1,"candidate_conflicts":1,"sync_status":"CONFLICTS_FOUND"},"confirmed_conflicts":[{"id":"CONFLICT-001","severity":"critical","confidence":"high","match_basis":"exact_string","type":"Type definition mismatch","source_file":"[source file]","source_location":"[section/line]","source_value":"[content in source file]","target_file":"[file with conflict]","target_location":"[section/line]","target_value":"[conflicting content]","recommendation":"[Recommend unifying to source file's value]"}],"candidate_conflicts":[{"id":"CANDIDATE-001","severity":"high","confidence":"medium","match_basis":"same_ac_slot","type":"Acceptance criteria conflict","source_file":"[source file]","source_location":"[section/line]","source_value":"[content in source file]","target_file":"[file with conflict]","target_location":"[section/line]","target_value":"[conflicting content]","reason":"[structural evidence linking the items]","recommendation":"[Recommend reviewing whether these describe the same design slot]"}],"no_conflicts_docs":["[filename1]","[filename2]"]}
282
232
  ```
283
233
 
284
234
  `total_conflicts` MUST equal `confirmed_conflicts + candidate_conflicts`.
@@ -290,19 +240,7 @@ When no conflicts: `"sync_status": "NO_CONFLICTS"`, `"confirmed_conflicts": []`,
290
240
  When fewer than 2 Design Docs exist, return immediately:
291
241
 
292
242
  ```json
293
- {
294
- "metadata": {
295
- "review_type": "design-sync",
296
- "source_design": "[provided path]",
297
- "analyzed_docs": 1
298
- },
299
- "summary": {
300
- "sync_status": "SKIPPED",
301
- "reason": "fewer_than_2_design_docs"
302
- },
303
- "confirmed_conflicts": [],
304
- "candidate_conflicts": []
305
- }
243
+ {"metadata":{"review_type":"design-sync","source_design":"[provided path]","analyzed_docs":1},"summary":{"sync_status":"SKIPPED","reason":"fewer_than_2_design_docs"},"confirmed_conflicts":[],"candidate_conflicts":[]}
306
244
  ```
307
245
 
308
246
  ENFORCEMENT: sync_status MUST be one of: CONFLICTS_FOUND | NO_CONFLICTS | SKIPPED. These three values are the complete vocabulary.