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

CommandDescription
ranex gate statusShow all gates
ranex gate check [ID]Validate specific gate
ranex gate listList gate configurations

Drift Commands

CommandDescription
ranex drift snapshotCreate baseline snapshot
ranex drift checkCheck for drift
ranex drift session startStart tracking session
ranex drift session statusCheck session changes
ranex drift session endEnd tracking session

Best Practices

  1. Create snapshots at phase transitions - After completing Requirements, Design, etc.
  2. Use sessions for focused work - Track changes during a feature
  3. Review drift before commits - Catch accidental changes
  4. Update baselines intentionally - Only after review

Next Steps