opencode-metis 0.1.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.
- package/README.md +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# Drift Detection Reference
|
|
2
|
+
|
|
3
|
+
Techniques for detecting and managing divergence between specifications and implementation.
|
|
4
|
+
|
|
5
|
+
## Core Philosophy
|
|
6
|
+
|
|
7
|
+
**Drift is Information, Not Failure.**
|
|
8
|
+
|
|
9
|
+
Drift isn't inherently bad -- it's valuable feedback:
|
|
10
|
+
- **Scope creep** may indicate incomplete requirements
|
|
11
|
+
- **Missing items** may reveal unrealistic timelines
|
|
12
|
+
- **Contradictions** may surface spec ambiguities
|
|
13
|
+
- **Extra work** may be necessary improvements
|
|
14
|
+
|
|
15
|
+
The goal is **awareness and conscious decision-making**, not rigid compliance.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Drift Types
|
|
20
|
+
|
|
21
|
+
| Type | Description | Example |
|
|
22
|
+
|------|-------------|---------|
|
|
23
|
+
| **Scope Creep** | Implementation adds features not in spec | Added pagination not specified in PRD |
|
|
24
|
+
| **Missing** | Spec requires feature not implemented | Error handling specified but not done |
|
|
25
|
+
| **Contradicts** | Implementation conflicts with spec | Spec says REST, code uses GraphQL |
|
|
26
|
+
| **Extra** | Unplanned work that may be valuable | Added caching for performance |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Detection Strategies
|
|
31
|
+
|
|
32
|
+
### Strategy 1: Acceptance Criteria Mapping
|
|
33
|
+
|
|
34
|
+
Map PRD acceptance criteria to implementation evidence.
|
|
35
|
+
|
|
36
|
+
**Process:**
|
|
37
|
+
1. Extract acceptance criteria from PRD
|
|
38
|
+
2. Search implementation for matching behavior
|
|
39
|
+
3. Verify through test assertions
|
|
40
|
+
|
|
41
|
+
**Example PRD Criteria:**
|
|
42
|
+
```markdown
|
|
43
|
+
### AC-1: User Login
|
|
44
|
+
Given a registered user
|
|
45
|
+
When they enter valid credentials
|
|
46
|
+
Then they receive an access token
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Search Patterns:**
|
|
50
|
+
```bash
|
|
51
|
+
# Search for login implementation
|
|
52
|
+
grep -r "login\|authenticate\|access.token" src/
|
|
53
|
+
|
|
54
|
+
# Search for test coverage
|
|
55
|
+
grep -r "should.*login\|given.*registered.*user" tests/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Strategy 2: Interface Contract Validation
|
|
59
|
+
|
|
60
|
+
Compare SDD interfaces with actual implementation.
|
|
61
|
+
|
|
62
|
+
**SDD Interface:**
|
|
63
|
+
```typescript
|
|
64
|
+
// From SDD
|
|
65
|
+
interface UserService {
|
|
66
|
+
login(email: string, password: string): Promise<AuthToken>;
|
|
67
|
+
logout(token: string): Promise<void>;
|
|
68
|
+
resetPassword(email: string): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Validation:**
|
|
73
|
+
```bash
|
|
74
|
+
# Find actual interface
|
|
75
|
+
grep -A 20 "interface UserService\|class UserService" src/
|
|
76
|
+
|
|
77
|
+
# Compare method signatures
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Strategy 3: Architecture Pattern Verification
|
|
81
|
+
|
|
82
|
+
Verify SDD architectural decisions in code.
|
|
83
|
+
|
|
84
|
+
**SDD Decision:**
|
|
85
|
+
> ADR-3: Use repository pattern for data access
|
|
86
|
+
|
|
87
|
+
**Verification:**
|
|
88
|
+
1. Check for `*Repository` classes
|
|
89
|
+
2. Verify no direct database calls outside repositories
|
|
90
|
+
3. Confirm dependency injection of repositories
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Find repositories
|
|
94
|
+
find src -name "*Repository*"
|
|
95
|
+
|
|
96
|
+
# Check for direct DB calls outside repositories
|
|
97
|
+
grep -r "prisma\.\|db\.\|query(" src/ --include="*.ts" | grep -v Repository
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Strategy 4: PLAN Task Completion
|
|
101
|
+
|
|
102
|
+
Verify PLAN tasks against implementation.
|
|
103
|
+
|
|
104
|
+
**PLAN Task:**
|
|
105
|
+
```markdown
|
|
106
|
+
- [ ] Implement user registration endpoint
|
|
107
|
+
- Route: POST /api/users
|
|
108
|
+
- Validation: Email format, password strength
|
|
109
|
+
- Response: Created user object
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Verification:**
|
|
113
|
+
```bash
|
|
114
|
+
# Find route
|
|
115
|
+
grep -r "POST.*\/api\/users\|router.post.*users" src/
|
|
116
|
+
|
|
117
|
+
# Find validation
|
|
118
|
+
grep -r "email.*valid\|password.*strength" src/
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Code Annotations (Optional)
|
|
124
|
+
|
|
125
|
+
Developers can optionally annotate code to aid drift detection:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Implements: PRD-1.2 - User can reset password
|
|
129
|
+
async function resetPassword(email: string) {
|
|
130
|
+
// ...
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Implements: SDD-3.1 - Repository pattern for data access
|
|
134
|
+
class UserRepository {
|
|
135
|
+
// ...
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Extra: Performance optimization not in spec
|
|
139
|
+
const memoizedQuery = useMemo(() => {
|
|
140
|
+
// ...
|
|
141
|
+
}, [deps]);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Annotation Format:**
|
|
145
|
+
- `// Implements: [DOC]-[SECTION]` - Links to spec requirement
|
|
146
|
+
- `// Extra: [REASON]` - Acknowledges unspecified work
|
|
147
|
+
|
|
148
|
+
### Annotation Scanning
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Find all implementation references
|
|
152
|
+
grep -r "// Implements:" src/
|
|
153
|
+
|
|
154
|
+
# Find all extra work
|
|
155
|
+
grep -r "// Extra:" src/
|
|
156
|
+
|
|
157
|
+
# Find deferred items
|
|
158
|
+
grep -r "// Deferred:" src/
|
|
159
|
+
|
|
160
|
+
# Find spec-related TODOs
|
|
161
|
+
grep -r "// TODO:.*PRD\|SDD\|PLAN" src/
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Heuristic Detection
|
|
167
|
+
|
|
168
|
+
When annotations aren't present, use these heuristics:
|
|
169
|
+
|
|
170
|
+
### Naming Convention Analysis
|
|
171
|
+
|
|
172
|
+
| Naming Pattern | Likely Spec Source |
|
|
173
|
+
|----------------|-------------------|
|
|
174
|
+
| `handle[Action]` | PRD user action |
|
|
175
|
+
| `validate[Entity]` | PRD validation rule |
|
|
176
|
+
| `[Entity]Repository` | SDD repository pattern |
|
|
177
|
+
| `[Entity]Service` | SDD service layer |
|
|
178
|
+
| `use[Feature]` | SDD/PRD feature hook |
|
|
179
|
+
|
|
180
|
+
### Test Description Analysis
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// Test descriptions often reflect requirements
|
|
184
|
+
describe('Authentication', () => {
|
|
185
|
+
it('should return 401 for invalid credentials'); // Security requirement
|
|
186
|
+
it('should rate limit failed attempts'); // Security requirement
|
|
187
|
+
it('should issue JWT token on success'); // Token specification
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Import Analysis
|
|
192
|
+
|
|
193
|
+
Imports reveal architectural patterns:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Repository usage indicates data layer separation
|
|
197
|
+
import { UserRepository } from '@/repositories/user';
|
|
198
|
+
|
|
199
|
+
// Service usage indicates business layer
|
|
200
|
+
import { AuthService } from '@/services/auth';
|
|
201
|
+
|
|
202
|
+
// Direct ORM usage may indicate pattern violation
|
|
203
|
+
import { prisma } from '@/lib/prisma'; // Should only be in repositories
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Contradiction Detection
|
|
209
|
+
|
|
210
|
+
### Configuration Mismatches
|
|
211
|
+
|
|
212
|
+
**Common areas:**
|
|
213
|
+
- Timeout values
|
|
214
|
+
- Rate limits
|
|
215
|
+
- Pagination sizes
|
|
216
|
+
- Cache durations
|
|
217
|
+
- Retry counts
|
|
218
|
+
|
|
219
|
+
**Detection:**
|
|
220
|
+
```bash
|
|
221
|
+
# Find configuration values
|
|
222
|
+
grep -r "timeout\|limit\|size\|duration\|retry" src/config/
|
|
223
|
+
|
|
224
|
+
# Compare against spec values
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### API Contract Mismatches
|
|
228
|
+
|
|
229
|
+
**Check:**
|
|
230
|
+
- HTTP methods (GET vs POST)
|
|
231
|
+
- Route paths (/users vs /user)
|
|
232
|
+
- Request/response shapes
|
|
233
|
+
- Status codes
|
|
234
|
+
- Error formats
|
|
235
|
+
|
|
236
|
+
### Type Mismatches
|
|
237
|
+
|
|
238
|
+
**Compare:**
|
|
239
|
+
- Spec data types vs implementation types
|
|
240
|
+
- Optional vs required fields
|
|
241
|
+
- Enum values
|
|
242
|
+
- Validation constraints
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Drift Severity Assessment
|
|
247
|
+
|
|
248
|
+
### High Severity (Address Immediately)
|
|
249
|
+
|
|
250
|
+
- Security requirement missing
|
|
251
|
+
- Core functionality not implemented
|
|
252
|
+
- Breaking API contract change
|
|
253
|
+
- Data integrity issue
|
|
254
|
+
|
|
255
|
+
### Medium Severity (Address Before Release)
|
|
256
|
+
|
|
257
|
+
- Non-critical feature missing
|
|
258
|
+
- Performance requirement unmet
|
|
259
|
+
- Documentation mismatch
|
|
260
|
+
- Test coverage gap
|
|
261
|
+
|
|
262
|
+
### Low Severity (Track for Future)
|
|
263
|
+
|
|
264
|
+
- Style/preference differences
|
|
265
|
+
- Nice-to-have features
|
|
266
|
+
- Optimization opportunities
|
|
267
|
+
- Documentation improvements
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Drift Logging
|
|
272
|
+
|
|
273
|
+
All drift decisions should be logged to the spec README for traceability.
|
|
274
|
+
|
|
275
|
+
### Drift Log Format
|
|
276
|
+
|
|
277
|
+
Add to spec README under `## Drift Log` section:
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
## Drift Log
|
|
281
|
+
|
|
282
|
+
| Date | Phase | Drift Type | Status | Notes |
|
|
283
|
+
|------|-------|------------|--------|-------|
|
|
284
|
+
| 2026-01-04 | Phase 2 | Scope creep | Acknowledged | Added pagination not in spec |
|
|
285
|
+
| 2026-01-04 | Phase 2 | Missing | Updated | Added validation per spec |
|
|
286
|
+
| 2026-01-04 | Phase 3 | Contradicts | Deferred | Session timeout differs from spec |
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Status Values
|
|
290
|
+
|
|
291
|
+
| Status | Meaning | Action Taken |
|
|
292
|
+
|--------|---------|--------------|
|
|
293
|
+
| **Acknowledged** | Drift noted, proceeding anyway | Implementation continues as-is |
|
|
294
|
+
| **Updated** | Spec or implementation changed to align | Drift resolved |
|
|
295
|
+
| **Deferred** | Decision postponed | Will address in future phase |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## User Decision Workflow
|
|
300
|
+
|
|
301
|
+
When drift is detected, present options:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Drift Detected
|
|
305
|
+
|
|
306
|
+
Found [N] drift items:
|
|
307
|
+
|
|
308
|
+
1. Scope Creep: Added pagination (not in spec)
|
|
309
|
+
Location: src/api/users.ts:45
|
|
310
|
+
|
|
311
|
+
2. Missing: Email validation (PRD-2.3)
|
|
312
|
+
Expected: Input validation for email format
|
|
313
|
+
|
|
314
|
+
Options:
|
|
315
|
+
1. Acknowledge and continue (log drift, proceed)
|
|
316
|
+
2. Update implementation (implement missing, remove extra)
|
|
317
|
+
3. Update specification (modify spec to match reality)
|
|
318
|
+
4. Defer decision (mark for later review)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Report Format
|
|
324
|
+
|
|
325
|
+
### Phase Drift Report
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
Drift Analysis: Phase [N]
|
|
329
|
+
|
|
330
|
+
Spec: [NNN]-[name]
|
|
331
|
+
Phase: [Phase name]
|
|
332
|
+
Files Analyzed: [N]
|
|
333
|
+
|
|
334
|
+
ALIGNMENT SUMMARY
|
|
335
|
+
Aligned: [N] requirements
|
|
336
|
+
Missing: [N] requirements
|
|
337
|
+
Contradicts: [N] items
|
|
338
|
+
Extra: [N] items
|
|
339
|
+
|
|
340
|
+
DETAILS:
|
|
341
|
+
|
|
342
|
+
Missing Requirements:
|
|
343
|
+
1. [Requirement from spec]
|
|
344
|
+
Source: PRD Section [X]
|
|
345
|
+
Status: Not found in implementation
|
|
346
|
+
|
|
347
|
+
Contradictions:
|
|
348
|
+
1. [What differs]
|
|
349
|
+
Spec: [What spec says]
|
|
350
|
+
Implementation: [What code does]
|
|
351
|
+
Location: [file:line]
|
|
352
|
+
|
|
353
|
+
Extra Work:
|
|
354
|
+
1. [What was added]
|
|
355
|
+
Location: [file:line]
|
|
356
|
+
Justification: [Why it was added, if known]
|
|
357
|
+
|
|
358
|
+
RECOMMENDATIONS:
|
|
359
|
+
- [Priority action 1]
|
|
360
|
+
- [Priority action 2]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Troubleshooting
|
|
366
|
+
|
|
367
|
+
### False Positives (Detecting Drift That Isn't)
|
|
368
|
+
|
|
369
|
+
- **Naming mismatch**: Spec says "user" but code says "account"
|
|
370
|
+
- Solution: Build synonym mapping
|
|
371
|
+
- **Abstraction level**: Spec is high-level, code is detailed
|
|
372
|
+
- Solution: Consider implementation details as aligned
|
|
373
|
+
- **Reorganization**: Same feature in different location
|
|
374
|
+
- Solution: Search more broadly before flagging missing
|
|
375
|
+
|
|
376
|
+
### False Negatives (Missing Real Drift)
|
|
377
|
+
|
|
378
|
+
- **Subtle differences**: Close but not exact
|
|
379
|
+
- Solution: Fuzzy matching on requirements
|
|
380
|
+
- **Hidden in complexity**: Feature buried in large functions
|
|
381
|
+
- Solution: Deeper code analysis
|
|
382
|
+
- **Different terminology**: Spec and code use different terms
|
|
383
|
+
- Solution: Keyword expansion
|