/drift — Codebase Drift Detection
Run python3 scripts/detect-drift.py and report results to the user.
What It Checks
- •Golden rule violations — file size, function length, magic numbers, print(), TODO without issue, import boundaries (reuses pre-commit hook scripts on the full repo)
- •Stale worktrees — git worktrees with no commits in >7 days
- •Stuck state files —
tasks/*/state.jsonstuck in a stage for >24 hours - •Orphaned task directories —
tasks/*/dirs with no matchingtask/*branch
Steps
- •Run:
python3 scripts/detect-drift.py - •Parse the stdout output (format:
filepath:line: message) - •Report to the user:
- •Summary count by category
- •Each violation with file path and line number
- •Path to the markdown report in
tasks/_drift/
- •Suggest fixes but do NOT auto-fix without user approval
Suppression
- •Inline:
# drift:ignoreon a line skips it - •File-level:
.drift-ignoreat repo root with gitignore-style patterns
Exit Codes
- •
0= clean, no violations - •
1= violations found - •
2= configuration error