Skip to main content

Drift capture

When implementation diverges from specification, the difference is captured as a drift document rather than silently ignoring the gap. This prevents silent spec rot — where specs and code gradually diverge until the specs become unreliable.

Drift lifecycle

PhaseWhoWhat happens
DetectionAgent or engineerNotices spec says X but implementation does Y
DocumentationDetectorCreates .context/drift/drift-{topic}.md
ResolutionHuman (always)Decides: update spec, fix code, or accept with rationale
ArchivalPR authorMoves resolved doc to .context/drift/archive/

Drift document format

# Drift: {topic}

**Detected**: 2026-04-07
**Detected by**: Vega (agent) / Vivek (human)
**Severity**: low | medium | high

## Spec says
What the specification describes.

## Implementation does
What actually exists.

## Impact
What breaks or is incorrect because of this drift.

## Recommended resolution
Update spec / fix code / accept drift with rationale.

Common drift patterns

PatternExampleTypical resolution
Spec optimismSpec describes Phase 2 feature as if builtUpdate spec to mark as "planned"
Silent evolutionCode was refactored but spec wasn't updatedUpdate spec to match new code structure
Name driftSpec says TestResult, code says TestRunResultAlign on one name across both
Removed featureSpec describes feature that was cutRemove from spec, add to "deferred" section

CI enforcement

When a drift doc is archived, the archival PR must also include:

  • Updated spec (if spec was wrong)
  • Updated context files (if architecture changed)
  • Updated docs (if docs/ content needs updating)
warning

Drift docs should not accumulate. If .context/drift/ has more than 5 unresolved documents, prioritize resolution before starting new feature work.

What's next