Gate & Drift Detection
Phase Gates: Checkpoints between development phases
Drift Detection: Catch unauthorized code changes
Phase Gates
What Are Phase Gates?
Phase gates validate your project is ready to move between phases:
Requirements → Design → Implementation → Review → Maintenance
↑ ↑ ↑ ↑
Gate 1 Gate 2 Gate 3 Gate 4
Each gate checks:
- Requirements complete before design
- Design approved before implementation
- Tests pass before review
- Review complete before maintenance
Check Gate Status
ranex gate status
Output:
Phase Gates Status
────────────────────────────────────────────────────
Requirements → Design
ID: gate1
Checks: 4
Auto-approve: Yes
Design → Implementation
ID: gate2
Checks: 4
Auto-approve: Yes
Implementation → Review
ID: gate3
Checks: 4
Auto-approve: Yes
Total gates: 4
Validate a Gate
ranex gate check gate2
Drift Detection
What Is Drift?
Drift detection monitors your code for unauthorized changes that deviate from approved specifications:
- Code changes that don't match the design spec
- Unauthorized modifications during implementation
- Scope creep beyond approved requirements
Create a Baseline Snapshot
ranex drift snapshot
Output:
📸 Drift Snapshot Created
══════════════════════════════════════════════
Snapshot ID: snap_20251129_143022
Files tracked: 142
Hash: a7b3c4d5e6f7...
══════════════════════════════════════════════
Check for Drift
ranex drift check
Output (no drift):
✅ No Drift Detected
Baseline: snap_20251129_143022
Files checked: 142
Changes: 0
Output (drift detected):
⚠️ Drift Detected
════════════════════════════════════════════════
Baseline: snap_20251129_143022
Files changed: 3
Modified:
- app/features/auth/routes.py (+15, -3)
- app/features/auth/service.py (+8, -0)
Added:
- app/features/auth/helpers.py (NEW)
Action: Review changes or update baseline
════════════════════════════════════════════════
Start a Drift Session
Track changes over a work session:
# Start tracking
ranex drift session start
# ... make changes ...
# Check what changed
ranex drift session status
# End session
ranex drift session end
Commands Reference
Gate Commands
| Command | Description |
|---|---|
ranex gate status | Show all gates |
ranex gate check [ID] | Validate specific gate |
ranex gate list | List gate configurations |
Drift Commands
| Command | Description |
|---|---|
ranex drift snapshot | Create baseline snapshot |
ranex drift check | Check for drift |
ranex drift session start | Start tracking session |
ranex drift session status | Check session changes |
ranex drift session end | End tracking session |
Best Practices
- Create snapshots at phase transitions - After completing Requirements, Design, etc.
- Use sessions for focused work - Track changes during a feature
- Review drift before commits - Catch accidental changes
- Update baselines intentionally - Only after review
Next Steps
- Workflow Management - The 5 phases
- Governance & Audit - Full governance checks