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
|
+
---
|
|
2
|
+
name: drift-detection
|
|
3
|
+
description: "Detect and manage divergence between specifications and implementation during development phases"
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
category: analysis
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Drift Detection
|
|
12
|
+
|
|
13
|
+
Roleplay as a specification alignment specialist that monitors for drift between specifications and implementation during development.
|
|
14
|
+
|
|
15
|
+
DriftDetection {
|
|
16
|
+
Activation {
|
|
17
|
+
When to use this skill:
|
|
18
|
+
- Monitor implementation phases for spec alignment
|
|
19
|
+
- Detect scope creep (implementing more than specified)
|
|
20
|
+
- Identify missing features (specified but not implemented)
|
|
21
|
+
- Flag contradictions (implementation conflicts with spec)
|
|
22
|
+
- Log drift decisions to spec README for traceability
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
CorePhilosophy {
|
|
26
|
+
Principle: Drift is Information, Not Failure
|
|
27
|
+
|
|
28
|
+
Insights {
|
|
29
|
+
Drift isn't inherently bad -- it's valuable feedback:
|
|
30
|
+
- **Scope creep** may indicate incomplete requirements
|
|
31
|
+
- **Missing items** may reveal unrealistic timelines
|
|
32
|
+
- **Contradictions** may surface spec ambiguities
|
|
33
|
+
- **Extra work** may be necessary improvements
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Goal: Awareness and conscious decision-making, not rigid compliance
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
DriftTypes {
|
|
40
|
+
| Type | Description | Example |
|
|
41
|
+
| --------------- | ---------------------------------------- | ------------------------------------- |
|
|
42
|
+
| **Scope Creep** | Implementation adds features not in spec | Added pagination not specified in PRD |
|
|
43
|
+
| **Missing** | Spec requires feature not implemented | Error handling specified but not done |
|
|
44
|
+
| **Contradicts** | Implementation conflicts with spec | Spec says REST, code uses GraphQL |
|
|
45
|
+
| **Extra** | Unplanned work that may be valuable | Added caching for performance |
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
DetectionProcess {
|
|
49
|
+
Step1_LoadSpecificationContext {
|
|
50
|
+
Read the spec documents to understand requirements
|
|
51
|
+
|
|
52
|
+
Extract from documents:
|
|
53
|
+
- **PRD**: Acceptance criteria, user stories, requirements
|
|
54
|
+
- **SDD**: Components, interfaces, architecture decisions
|
|
55
|
+
- **PLAN**: Phase deliverables, task objectives
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Step2_AnalyzeImplementation {
|
|
59
|
+
For the current implementation phase, examine:
|
|
60
|
+
1. Files modified in this phase
|
|
61
|
+
2. Functions/components added
|
|
62
|
+
3. Tests written (what do they verify?)
|
|
63
|
+
4. Optional annotations in code (`// Implements: PRD-1.2`)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Step3_CompareAndCategorize {
|
|
67
|
+
ForEachSpecRequirement {
|
|
68
|
+
| Requirement | Implementation | Status |
|
|
69
|
+
| --------------- | ---------------------------- | -------------- |
|
|
70
|
+
| User login | `src/auth/login.ts` | Aligned |
|
|
71
|
+
| Password reset | Not found | Missing |
|
|
72
|
+
| Session timeout | Different value (30m vs 15m) | Contradicts |
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ForEachImplementationArtifact {
|
|
76
|
+
| Implementation | Spec Reference | Status |
|
|
77
|
+
| -------------- | -------------- | -------------- |
|
|
78
|
+
| Rate limiting | Not in spec | Extra |
|
|
79
|
+
| Pagination | Not in spec | Scope Creep |
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Step4_ReportFindings {
|
|
84
|
+
Present drift findings to user with clear categorization
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
DetectionStrategies {
|
|
89
|
+
Strategy1_AcceptanceCriteriaMapping {
|
|
90
|
+
Purpose: Map PRD acceptance criteria to implementation evidence
|
|
91
|
+
|
|
92
|
+
Process {
|
|
93
|
+
1. Extract acceptance criteria from PRD
|
|
94
|
+
2. Search implementation for matching behavior
|
|
95
|
+
3. Verify through test assertions
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
SearchPatterns {
|
|
99
|
+
```bash
|
|
100
|
+
# Search for login implementation
|
|
101
|
+
grep -r "login\|authenticate\|access.token" src/
|
|
102
|
+
|
|
103
|
+
# Search for test coverage
|
|
104
|
+
grep -r "should.*login\|given.*registered.*user" tests/
|
|
105
|
+
```
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Strategy2_InterfaceContractValidation {
|
|
110
|
+
Purpose: Compare SDD interfaces with actual implementation
|
|
111
|
+
|
|
112
|
+
Commands {
|
|
113
|
+
```bash
|
|
114
|
+
# Find actual interface
|
|
115
|
+
grep -A 20 "interface UserService\|class UserService" src/
|
|
116
|
+
|
|
117
|
+
# Compare method signatures
|
|
118
|
+
```
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
Strategy3_ArchitecturePatternVerification {
|
|
123
|
+
Purpose: Verify SDD architectural decisions in code
|
|
124
|
+
|
|
125
|
+
Process {
|
|
126
|
+
1. Check for expected classes/patterns
|
|
127
|
+
2. Verify no violations of architectural boundaries
|
|
128
|
+
3. Confirm dependency injection and layering
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
Commands {
|
|
132
|
+
```bash
|
|
133
|
+
# Find repositories
|
|
134
|
+
find src -name "*Repository*"
|
|
135
|
+
|
|
136
|
+
# Check for direct DB calls outside repositories
|
|
137
|
+
grep -r "prisma\.\|db\.\|query(" src/ --include="*.ts" | grep -v Repository
|
|
138
|
+
```
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Strategy4_PLANTaskCompletion {
|
|
143
|
+
Purpose: Verify PLAN tasks against implementation
|
|
144
|
+
|
|
145
|
+
Commands {
|
|
146
|
+
```bash
|
|
147
|
+
# Find route
|
|
148
|
+
grep -r "POST.*\/api\/users\|router.post.*users" src/
|
|
149
|
+
|
|
150
|
+
# Find validation
|
|
151
|
+
grep -r "email.*valid\|password.*strength" src/
|
|
152
|
+
```
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
CodeAnnotations {
|
|
158
|
+
Note: Optional -- aids drift detection but not required
|
|
159
|
+
|
|
160
|
+
Examples {
|
|
161
|
+
```typescript
|
|
162
|
+
// Implements: PRD-1.2 - User can reset password
|
|
163
|
+
async function resetPassword(email: string) {
|
|
164
|
+
// ...
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Implements: SDD-3.1 - Repository pattern for data access
|
|
168
|
+
class UserRepository {
|
|
169
|
+
// ...
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Extra: Performance optimization not in spec
|
|
173
|
+
const memoizedQuery = useMemo(() => {
|
|
174
|
+
// ...
|
|
175
|
+
}, [deps]);
|
|
176
|
+
```
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
AnnotationFormat {
|
|
180
|
+
- `// Implements: [DOC]-[SECTION]` - Links to spec requirement
|
|
181
|
+
- `// Extra: [REASON]` - Acknowledges unspecified work
|
|
182
|
+
|
|
183
|
+
Annotations are **optional** -- drift detection works through heuristics when not present.
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
HeuristicDetection {
|
|
188
|
+
FindingImplementedRequirements {
|
|
189
|
+
1. **Test file analysis**: Test descriptions often mention requirements
|
|
190
|
+
```typescript
|
|
191
|
+
describe("User Authentication", () => {
|
|
192
|
+
it("should allow password reset via email", () => {
|
|
193
|
+
// This likely implements the password reset requirement
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
2. **Function/class naming**: Names often reflect requirements
|
|
199
|
+
- `handlePasswordReset` --> Password reset feature
|
|
200
|
+
- `UserRepository` --> Repository pattern from SDD
|
|
201
|
+
|
|
202
|
+
3. **Comment scanning**: Look for references to tickets, specs
|
|
203
|
+
- `// JIRA-1234`, `// Per spec section 3.2`
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
FindingMissingRequirements {
|
|
207
|
+
1. Search for requirement keywords in implementation
|
|
208
|
+
2. Check test coverage for spec acceptance criteria
|
|
209
|
+
3. Verify API endpoints match spec interfaces
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
FindingContradictions {
|
|
213
|
+
1. Compare configuration values (timeouts, limits, flags)
|
|
214
|
+
2. Verify API contracts (method names, parameters, responses)
|
|
215
|
+
3. Check architecture patterns (layers, dependencies)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
DriftLogging {
|
|
220
|
+
Principle: All drift decisions are logged to the spec README for traceability
|
|
221
|
+
|
|
222
|
+
DriftLogFormat {
|
|
223
|
+
Add to spec README under `## Drift Log` section:
|
|
224
|
+
```markdown
|
|
225
|
+
## Drift Log
|
|
226
|
+
|
|
227
|
+
| Date | Phase | Drift Type | Status | Notes |
|
|
228
|
+
| ---------- | ------- | ----------- | ------------ | --------------------------------- |
|
|
229
|
+
| 2026-01-04 | Phase 2 | Scope creep | Acknowledged | Added pagination not in spec |
|
|
230
|
+
| 2026-01-04 | Phase 2 | Missing | Updated | Added validation per spec |
|
|
231
|
+
| 2026-01-04 | Phase 3 | Contradicts | Deferred | Session timeout differs from spec |
|
|
232
|
+
```
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
StatusValues {
|
|
236
|
+
| Status | Meaning | Action Taken |
|
|
237
|
+
| ---------------- | --------------------------------------- | ------------------------------ |
|
|
238
|
+
| **Acknowledged** | Drift noted, proceeding anyway | Implementation continues as-is |
|
|
239
|
+
| **Updated** | Spec or implementation changed to align | Drift resolved |
|
|
240
|
+
| **Deferred** | Decision postponed | Will address in future phase |
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
UserInteraction {
|
|
245
|
+
AtPhaseCompletion {
|
|
246
|
+
When drift is detected, present options:
|
|
247
|
+
```
|
|
248
|
+
Drift Detected in Phase [N]
|
|
249
|
+
|
|
250
|
+
Found [N] drift items:
|
|
251
|
+
|
|
252
|
+
1. Scope Creep: Added pagination (not in spec)
|
|
253
|
+
Location: src/api/users.ts:45
|
|
254
|
+
|
|
255
|
+
2. Missing: Email validation (PRD-2.3)
|
|
256
|
+
Expected: Input validation for email format
|
|
257
|
+
|
|
258
|
+
Options:
|
|
259
|
+
1. Acknowledge and continue (log drift, proceed)
|
|
260
|
+
2. Update implementation (implement missing, remove extra)
|
|
261
|
+
3. Update specification (modify spec to match reality)
|
|
262
|
+
4. Defer decision (mark for later review)
|
|
263
|
+
```
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
LoggingDecision {
|
|
267
|
+
After user decision, update the drift log in the spec README
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
DriftSeverityAssessment {
|
|
272
|
+
HighSeverity {
|
|
273
|
+
Definition: Address Immediately
|
|
274
|
+
- Security requirement missing
|
|
275
|
+
- Core functionality not implemented
|
|
276
|
+
- Breaking API contract change
|
|
277
|
+
- Data integrity issue
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
MediumSeverity {
|
|
281
|
+
Definition: Address Before Release
|
|
282
|
+
- Non-critical feature missing
|
|
283
|
+
- Performance requirement unmet
|
|
284
|
+
- Documentation mismatch
|
|
285
|
+
- Test coverage gap
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
LowSeverity {
|
|
289
|
+
Definition: Track for Future
|
|
290
|
+
- Style/preference differences
|
|
291
|
+
- Nice-to-have features
|
|
292
|
+
- Optimization opportunities
|
|
293
|
+
- Documentation improvements
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
IntegrationPoints {
|
|
298
|
+
CalledBy {
|
|
299
|
+
- `/implement` -- At end of each phase for alignment check
|
|
300
|
+
- `/validate` (Mode C) -- For comparison validation
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
WorksAlongside {
|
|
304
|
+
- `skill({ name: "specification-validation" })` -- Comprehensive spec quality checks
|
|
305
|
+
- `skill({ name: "implementation-verification" })` -- Technical correctness of implementation
|
|
306
|
+
- `skill({ name: "constitution-validation" })` -- Governance compliance for drifted code
|
|
307
|
+
- `skill({ name: "specification-management" })` -- Read spec metadata and locate documents
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
ReportFormats {
|
|
312
|
+
PhaseDriftReport {
|
|
313
|
+
```
|
|
314
|
+
Drift Analysis: Phase [N]
|
|
315
|
+
|
|
316
|
+
Spec: [NNN]-[name]
|
|
317
|
+
Phase: [Phase name]
|
|
318
|
+
Files Analyzed: [N]
|
|
319
|
+
|
|
320
|
+
ALIGNMENT SUMMARY
|
|
321
|
+
Aligned: [N] requirements
|
|
322
|
+
Missing: [N] requirements
|
|
323
|
+
Contradicts: [N] items
|
|
324
|
+
Extra: [N] items
|
|
325
|
+
|
|
326
|
+
DETAILS:
|
|
327
|
+
|
|
328
|
+
Missing Requirements:
|
|
329
|
+
1. [Requirement from spec]
|
|
330
|
+
Source: PRD Section [X]
|
|
331
|
+
Status: Not found in implementation
|
|
332
|
+
|
|
333
|
+
Contradictions:
|
|
334
|
+
1. [What differs]
|
|
335
|
+
Spec: [What spec says]
|
|
336
|
+
Implementation: [What code does]
|
|
337
|
+
Location: [file:line]
|
|
338
|
+
|
|
339
|
+
Extra Work:
|
|
340
|
+
1. [What was added]
|
|
341
|
+
Location: [file:line]
|
|
342
|
+
Justification: [Why it was added, if known]
|
|
343
|
+
|
|
344
|
+
RECOMMENDATIONS:
|
|
345
|
+
- [Priority action 1]
|
|
346
|
+
- [Priority action 2]
|
|
347
|
+
```
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
SummaryReport_MultiPhase {
|
|
351
|
+
```
|
|
352
|
+
Drift Summary: [NNN]-[name]
|
|
353
|
+
|
|
354
|
+
Overall Alignment: [X]%
|
|
355
|
+
|
|
356
|
+
| Phase | Aligned | Missing | Contradicts | Extra |
|
|
357
|
+
|-------|---------|---------|-------------|-------|
|
|
358
|
+
| 1 | 5 | 0 | 0 | 1 |
|
|
359
|
+
| 2 | 8 | 2 | 1 | 0 |
|
|
360
|
+
| 3 | 3 | 0 | 0 | 2 |
|
|
361
|
+
|
|
362
|
+
Drift Decisions Made: [N]
|
|
363
|
+
- Acknowledged: [N]
|
|
364
|
+
- Updated: [N]
|
|
365
|
+
- Deferred: [N]
|
|
366
|
+
|
|
367
|
+
Outstanding Items:
|
|
368
|
+
- [Item 1]
|
|
369
|
+
- [Item 2]
|
|
370
|
+
```
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
ValidationChecklist {
|
|
375
|
+
Before completing drift detection:
|
|
376
|
+
- [ ] Loaded all spec documents (PRD, SDD, PLAN)
|
|
377
|
+
- [ ] Analyzed all files modified in phase
|
|
378
|
+
- [ ] Categorized all drift items by type
|
|
379
|
+
- [ ] Presented findings to user
|
|
380
|
+
- [ ] Logged decision to spec README
|
|
381
|
+
- [ ] Updated drift log with status
|
|
382
|
+
}
|
|
383
|
+
}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# Drift Detection Reference
|
|
2
|
+
|
|
3
|
+
Advanced techniques for detecting and managing specification drift.
|
|
4
|
+
|
|
5
|
+
## Detection Strategies
|
|
6
|
+
|
|
7
|
+
### Strategy 1: Acceptance Criteria Mapping
|
|
8
|
+
|
|
9
|
+
Map PRD acceptance criteria to implementation evidence.
|
|
10
|
+
|
|
11
|
+
**Process:**
|
|
12
|
+
1. Extract acceptance criteria from PRD
|
|
13
|
+
2. Search implementation for matching behavior
|
|
14
|
+
3. Verify through test assertions
|
|
15
|
+
|
|
16
|
+
**Example PRD Criteria:**
|
|
17
|
+
```markdown
|
|
18
|
+
### AC-1: User Login
|
|
19
|
+
Given a registered user
|
|
20
|
+
When they enter valid credentials
|
|
21
|
+
Then they receive an access token
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Search Patterns:**
|
|
25
|
+
```bash
|
|
26
|
+
# Search for login implementation
|
|
27
|
+
grep -r "login\|authenticate\|access.token" src/
|
|
28
|
+
|
|
29
|
+
# Search for test coverage
|
|
30
|
+
grep -r "should.*login\|given.*registered.*user" tests/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Strategy 2: Interface Contract Validation
|
|
34
|
+
|
|
35
|
+
Compare SDD interfaces with actual implementation.
|
|
36
|
+
|
|
37
|
+
**SDD Interface:**
|
|
38
|
+
```typescript
|
|
39
|
+
// From SDD
|
|
40
|
+
interface UserService {
|
|
41
|
+
login(email: string, password: string): Promise<AuthToken>;
|
|
42
|
+
logout(token: string): Promise<void>;
|
|
43
|
+
resetPassword(email: string): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Validation:**
|
|
48
|
+
```bash
|
|
49
|
+
# Find actual interface
|
|
50
|
+
grep -A 20 "interface UserService\|class UserService" src/
|
|
51
|
+
|
|
52
|
+
# Compare method signatures
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Strategy 3: Architecture Pattern Verification
|
|
56
|
+
|
|
57
|
+
Verify SDD architectural decisions in code.
|
|
58
|
+
|
|
59
|
+
**SDD Decision:**
|
|
60
|
+
> ADR-3: Use repository pattern for data access
|
|
61
|
+
|
|
62
|
+
**Verification:**
|
|
63
|
+
1. Check for `*Repository` classes
|
|
64
|
+
2. Verify no direct database calls outside repositories
|
|
65
|
+
3. Confirm dependency injection of repositories
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Find repositories
|
|
69
|
+
find src -name "*Repository*"
|
|
70
|
+
|
|
71
|
+
# Check for direct DB calls outside repositories
|
|
72
|
+
grep -r "prisma\.\|db\.\|query(" src/ --include="*.ts" | grep -v Repository
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Strategy 4: PLAN Task Completion
|
|
76
|
+
|
|
77
|
+
Verify PLAN tasks against implementation.
|
|
78
|
+
|
|
79
|
+
**PLAN Task:**
|
|
80
|
+
```markdown
|
|
81
|
+
- [ ] Implement user registration endpoint
|
|
82
|
+
- Route: POST /api/users
|
|
83
|
+
- Validation: Email format, password strength
|
|
84
|
+
- Response: Created user object
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Verification:**
|
|
88
|
+
```bash
|
|
89
|
+
# Find route
|
|
90
|
+
grep -r "POST.*\/api\/users\|router.post.*users" src/
|
|
91
|
+
|
|
92
|
+
# Find validation
|
|
93
|
+
grep -r "email.*valid\|password.*strength" src/
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Annotation Formats
|
|
97
|
+
|
|
98
|
+
### Standard Annotations
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// Implements: [Document]-[Section/ID]
|
|
102
|
+
// Implements: PRD-AC-1 - User login acceptance criteria
|
|
103
|
+
// Implements: SDD-3.2 - Repository pattern
|
|
104
|
+
// Implements: PLAN-2.1 - Registration endpoint
|
|
105
|
+
|
|
106
|
+
// Extra: [Brief justification]
|
|
107
|
+
// Extra: Added rate limiting for security
|
|
108
|
+
// Extra: Caching layer for performance
|
|
109
|
+
|
|
110
|
+
// Deferred: [What and why]
|
|
111
|
+
// Deferred: Admin dashboard - moved to Phase 3
|
|
112
|
+
|
|
113
|
+
// TODO: [Spec reference if applicable]
|
|
114
|
+
// TODO: PRD-4.2 - Email notifications not yet implemented
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Annotation Scanning
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Find all implementation references
|
|
121
|
+
grep -r "// Implements:" src/
|
|
122
|
+
|
|
123
|
+
# Find all extra work
|
|
124
|
+
grep -r "// Extra:" src/
|
|
125
|
+
|
|
126
|
+
# Find deferred items
|
|
127
|
+
grep -r "// Deferred:" src/
|
|
128
|
+
|
|
129
|
+
# Find spec-related TODOs
|
|
130
|
+
grep -r "// TODO:.*PRD\|SDD\|PLAN" src/
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Heuristic Patterns
|
|
134
|
+
|
|
135
|
+
### Naming Convention Analysis
|
|
136
|
+
|
|
137
|
+
| Naming Pattern | Likely Spec Source |
|
|
138
|
+
|----------------|-------------------|
|
|
139
|
+
| `handle[Action]` | PRD user action |
|
|
140
|
+
| `validate[Entity]` | PRD validation rule |
|
|
141
|
+
| `[Entity]Repository` | SDD repository pattern |
|
|
142
|
+
| `[Entity]Service` | SDD service layer |
|
|
143
|
+
| `use[Feature]` | SDD/PRD feature hook |
|
|
144
|
+
|
|
145
|
+
### Test Description Analysis
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
// Test descriptions often reflect requirements
|
|
149
|
+
describe('Authentication', () => {
|
|
150
|
+
it('should return 401 for invalid credentials'); // Security requirement
|
|
151
|
+
it('should rate limit failed attempts'); // Security requirement
|
|
152
|
+
it('should issue JWT token on success'); // Token specification
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Extraction:**
|
|
157
|
+
```bash
|
|
158
|
+
# Extract test descriptions
|
|
159
|
+
grep -r "describe\|it\|test(" tests/ --include="*.test.ts"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Import Analysis
|
|
163
|
+
|
|
164
|
+
Imports reveal architectural patterns:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// Repository usage indicates data layer separation
|
|
168
|
+
import { UserRepository } from '@/repositories/user';
|
|
169
|
+
|
|
170
|
+
// Service usage indicates business layer
|
|
171
|
+
import { AuthService } from '@/services/auth';
|
|
172
|
+
|
|
173
|
+
// Direct ORM usage may indicate pattern violation
|
|
174
|
+
import { prisma } from '@/lib/prisma'; // Should only be in repositories
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Contradiction Detection
|
|
178
|
+
|
|
179
|
+
### Configuration Mismatches
|
|
180
|
+
|
|
181
|
+
**Common areas:**
|
|
182
|
+
- Timeout values
|
|
183
|
+
- Rate limits
|
|
184
|
+
- Pagination sizes
|
|
185
|
+
- Cache durations
|
|
186
|
+
- Retry counts
|
|
187
|
+
|
|
188
|
+
**Detection:**
|
|
189
|
+
```bash
|
|
190
|
+
# Find configuration values
|
|
191
|
+
grep -r "timeout\|limit\|size\|duration\|retry" src/config/
|
|
192
|
+
|
|
193
|
+
# Compare against spec values
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### API Contract Mismatches
|
|
197
|
+
|
|
198
|
+
**Check:**
|
|
199
|
+
- HTTP methods (GET vs POST)
|
|
200
|
+
- Route paths (/users vs /user)
|
|
201
|
+
- Request/response shapes
|
|
202
|
+
- Status codes
|
|
203
|
+
- Error formats
|
|
204
|
+
|
|
205
|
+
### Type Mismatches
|
|
206
|
+
|
|
207
|
+
**Compare:**
|
|
208
|
+
- Spec data types vs implementation types
|
|
209
|
+
- Optional vs required fields
|
|
210
|
+
- Enum values
|
|
211
|
+
- Validation constraints
|
|
212
|
+
|
|
213
|
+
## Drift Severity Assessment
|
|
214
|
+
|
|
215
|
+
### High Severity (Address Immediately)
|
|
216
|
+
|
|
217
|
+
- Security requirement missing
|
|
218
|
+
- Core functionality not implemented
|
|
219
|
+
- Breaking API contract change
|
|
220
|
+
- Data integrity issue
|
|
221
|
+
|
|
222
|
+
### Medium Severity (Address Before Release)
|
|
223
|
+
|
|
224
|
+
- Non-critical feature missing
|
|
225
|
+
- Performance requirement unmet
|
|
226
|
+
- Documentation mismatch
|
|
227
|
+
- Test coverage gap
|
|
228
|
+
|
|
229
|
+
### Low Severity (Track for Future)
|
|
230
|
+
|
|
231
|
+
- Style/preference differences
|
|
232
|
+
- Nice-to-have features
|
|
233
|
+
- Optimization opportunities
|
|
234
|
+
- Documentation improvements
|
|
235
|
+
|
|
236
|
+
## README Drift Log Examples
|
|
237
|
+
|
|
238
|
+
### Initial Log Entry
|
|
239
|
+
|
|
240
|
+
```markdown
|
|
241
|
+
## Drift Log
|
|
242
|
+
|
|
243
|
+
| Date | Phase | Drift Type | Status | Notes |
|
|
244
|
+
|------|-------|------------|--------|-------|
|
|
245
|
+
| 2026-01-04 | Phase 1 | Extra | Acknowledged | Added health check endpoint |
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### After Multiple Phases
|
|
249
|
+
|
|
250
|
+
```markdown
|
|
251
|
+
## Drift Log
|
|
252
|
+
|
|
253
|
+
| Date | Phase | Drift Type | Status | Notes |
|
|
254
|
+
|------|-------|------------|--------|-------|
|
|
255
|
+
| 2026-01-04 | Phase 1 | Extra | Acknowledged | Added health check endpoint |
|
|
256
|
+
| 2026-01-04 | Phase 2 | Scope creep | Acknowledged | Added pagination to user list |
|
|
257
|
+
| 2026-01-04 | Phase 2 | Missing | Updated | Added email validation per PRD-2.3 |
|
|
258
|
+
| 2026-01-04 | Phase 3 | Contradicts | Deferred | Session timeout 30m vs spec 15m |
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### With Resolution Notes
|
|
262
|
+
|
|
263
|
+
```markdown
|
|
264
|
+
## Drift Log
|
|
265
|
+
|
|
266
|
+
| Date | Phase | Drift Type | Status | Notes |
|
|
267
|
+
|------|-------|------------|--------|-------|
|
|
268
|
+
| 2026-01-04 | Phase 2 | Missing | Updated | Added email validation per PRD-2.3 |
|
|
269
|
+
| 2026-01-05 | Phase 3 | Contradicts | Updated | Changed timeout to 15m per spec |
|
|
270
|
+
| 2026-01-05 | Phase 3 | Scope creep | Updated | Spec updated to include pagination |
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Integration with Other Skills
|
|
274
|
+
|
|
275
|
+
### With constitution-validation
|
|
276
|
+
|
|
277
|
+
After drift detection, check if drifted code complies with constitution:
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
1. Detect drift
|
|
281
|
+
2. If new code added (scope creep, extra)
|
|
282
|
+
3. Validate new code against constitution
|
|
283
|
+
4. Report both drift AND constitution findings
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### With specification-management
|
|
287
|
+
|
|
288
|
+
Use spec.py to:
|
|
289
|
+
- Read spec metadata
|
|
290
|
+
- Locate spec documents
|
|
291
|
+
- Understand spec structure
|
|
292
|
+
|
|
293
|
+
### With implementation-verification
|
|
294
|
+
|
|
295
|
+
Combine with verification for comprehensive check:
|
|
296
|
+
- Drift detection: Is it aligned with spec?
|
|
297
|
+
- Implementation verification: Is it technically correct?
|
|
298
|
+
|
|
299
|
+
## Performance Considerations
|
|
300
|
+
|
|
301
|
+
### Efficient Searching
|
|
302
|
+
|
|
303
|
+
1. **Narrow search scope** to modified files
|
|
304
|
+
2. **Use ripgrep** for faster text search
|
|
305
|
+
3. **Cache spec parsing** across phases
|
|
306
|
+
4. **Batch file reads** when possible
|
|
307
|
+
|
|
308
|
+
### Incremental Detection
|
|
309
|
+
|
|
310
|
+
Track what was already verified:
|
|
311
|
+
- Store verification state between phases
|
|
312
|
+
- Only re-verify modified areas
|
|
313
|
+
- Mark files as "verified" after check
|
|
314
|
+
|
|
315
|
+
## Troubleshooting
|
|
316
|
+
|
|
317
|
+
### False Positives (Detecting Drift That Isn't)
|
|
318
|
+
|
|
319
|
+
- **Naming mismatch**: Spec says "user" but code says "account"
|
|
320
|
+
- Solution: Build synonym mapping
|
|
321
|
+
- **Abstraction level**: Spec is high-level, code is detailed
|
|
322
|
+
- Solution: Consider implementation details as aligned
|
|
323
|
+
- **Reorganization**: Same feature in different location
|
|
324
|
+
- Solution: Search more broadly before flagging missing
|
|
325
|
+
|
|
326
|
+
### False Negatives (Missing Real Drift)
|
|
327
|
+
|
|
328
|
+
- **Subtle differences**: Close but not exact
|
|
329
|
+
- Solution: Fuzzy matching on requirements
|
|
330
|
+
- **Hidden in complexity**: Feature buried in large functions
|
|
331
|
+
- Solution: Deeper code analysis
|
|
332
|
+
- **Different terminology**: Spec and code use different terms
|
|
333
|
+
- Solution: Keyword expansion
|
|
334
|
+
|
|
335
|
+
### Large Codebases
|
|
336
|
+
|
|
337
|
+
- Use targeted searching based on PLAN tasks
|
|
338
|
+
- Focus on recently modified files
|
|
339
|
+
- Sample verification for comprehensive requirements
|
|
340
|
+
- Prioritize high-severity requirements
|