-
Notifications
You must be signed in to change notification settings - Fork 59
CLI Reference
Complete reference for all Drift CLI commands.
TypeScript/JavaScript language analysis.
drift ts <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Express, NestJS, Next.js, Fastify)
components List React components
hooks Analyze React hooks usage
errors Analyze error handling patterns
data-access Analyze database patterns (Prisma, TypeORM, Drizzle, Sequelize, Mongoose)
decorators Analyze decorator usage (NestJS, TypeORM)
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputPython language analysis.
drift py <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Flask, FastAPI, Django, Starlette)
errors Analyze error handling patterns
data-access Analyze database patterns (Django ORM, SQLAlchemy, Tortoise, Peewee)
decorators Analyze decorator usage
async Analyze async patterns
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputJava language analysis.
drift java <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Spring MVC, JAX-RS, Micronaut, Quarkus)
errors Analyze error handling patterns
data-access Analyze database patterns (Spring Data JPA, Hibernate, JDBC, MyBatis)
annotations Analyze annotation usage
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputPHP language analysis.
drift php <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Laravel, Symfony, Slim, Lumen)
errors Analyze error handling patterns
data-access Analyze database patterns (Eloquent, Doctrine, PDO)
traits Analyze trait definitions and usage
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputGo language analysis.
drift go <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Gin, Echo, Chi, Fiber, net/http)
errors Analyze error handling patterns
interfaces List interfaces and implementations
data-access Analyze database patterns (GORM, sqlx, database/sql, Ent, Bun)
goroutines Analyze concurrency patterns
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputRust language analysis.
drift rust <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
routes List HTTP routes (Actix, Axum, Rocket, Warp)
errors Analyze error handling (Result, thiserror, anyhow)
traits List traits and implementations
data-access Analyze database patterns (SQLx, Diesel, SeaORM)
async Analyze async patterns and runtime usage
Options:
--framework <fw> Filter by framework
--limit <n> Limit results (default: 50)
--json JSON outputC++ language analysis.
drift cpp <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
classes List classes/structs with inheritance
memory Analyze memory management (smart pointers, RAII)
templates List template classes and functions
virtual Analyze virtual functions and polymorphism
Options:
--framework <fw> Filter by framework (Qt, Boost, Unreal)
--limit <n> Limit results (default: 50)
--json JSON outputWPF (C#) framework analysis.
drift wpf <subcommand> [path] [options]
Subcommands:
status Show project analysis summary
bindings List XAML data bindings
mvvm Check MVVM compliance
datacontext Analyze DataContext resolution
commands List ICommand implementations
Options:
--limit <n> Limit results (default: 50)
--json JSON outputGenerate package-scoped AI context for monorepos.
drift context [package] [options]
Options:
-l, --list List all detected packages
-f, --format <format> Output format: json, markdown, ai (default: json)
-o, --output <file> Output file (stdout if not specified)
--snippets Include code snippets in context
--deps Include internal dependency patterns
-c, --categories <cats> Categories to include (comma-separated)
--min-confidence <n> Minimum pattern confidence (0.0-1.0)
--max-tokens <n> Maximum tokens for AI context (default: 8000)
--compact Compact output (fewer details)Examples:
# List all packages in monorepo
drift context --list
# Generate context for a package
drift context @drift/core
# AI-optimized format with snippets
drift context @drift/core --format ai --snippets
# Export to file
drift context @drift/core -o context.jsonManage Cortex V2 memories - institutional knowledge, procedures, patterns, and more.
drift memory <subcommand> [options]
Subcommands:
init Initialize the memory system
status Show memory system status and health
add <type> <text> Add a new memory
list List memories
show <id> Show memory details
search <query> Search memories
update <id> Update a memory
delete <id> Delete a memory (soft delete)
learn Learn from a correction
feedback <id> Provide feedback on a memory
validate Validate memories and heal issues
consolidate Consolidate episodic memories
warnings Show active warnings
why <focus> Get context for a task
export <output> Export memories to JSON
import <input> Import memories from JSON
health Get comprehensive health report
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Enable verbose outputMemory Types:
-
tribalβ Institutional knowledge, gotchas, warnings -
proceduralβ How-to knowledge, step-by-step procedures -
semanticβ Consolidated knowledge -
pattern_rationaleβ Why patterns exist -
code_smellβ Patterns to avoid -
decision_contextβ Human context for decisions -
constraint_overrideβ Approved exceptions
Examples:
# Initialize memory system
drift memory init
# Add tribal knowledge
drift memory add tribal "Always use bcrypt for passwords" --topic Security --importance high
# List all memories
drift memory list
# Search memories
drift memory search "authentication"
# Learn from a correction (simplified syntax)
drift memory learn "Always use bcrypt with cost factor 12"
# Learn with context about what was wrong
drift memory learn "Use bcrypt instead" --original "Used MD5 for hashing"
# Get context for a task
drift memory why "authentication" --intent add_feature
# Check health
drift memory health
# Export memories
drift memory export backup.jsonInitialize Drift in a project.
drift init [options]
Options:
--from-scaffold Initialize from scaffold config
--yes, -y Skip confirmation promptsScan codebase for patterns.
drift scan [path] [options]
Options:
--manifest Generate manifest file
--incremental Only scan changed files
--contracts Detect API contracts
--boundaries Scan data access boundaries
--project <name> Target specific project
--timeout <ms> Scan timeout in millisecondsCheck for violations against approved patterns.
drift check [options]
Options:
--staged Only check staged files
--ci CI mode (exit code on violations)
--format <type> Output format: text, json, github, gitlab
--fail-on <level> Fail on: error, warning, infoShow current drift status.
drift status [options]
Options:
--detailed Show detailed breakdown
--format <type> Output format: text, jsonApprove discovered patterns.
drift approve <pattern-id> [options]
Options:
--category <cat> Approve all in category
--yes, -y Skip confirmationIgnore patterns.
drift ignore <pattern-id> [options]
Options:
--yes, -y Skip confirmationGenerate reports.
drift report [options]
Options:
--format <type> Format: html, json, markdown
--output <path> Output file path
--categories Filter by categoriesFind pattern locations.
drift where <pattern-id> [options]
Options:
--category <cat> Filter by category
--status <status> Filter by status
--json JSON outputShow patterns in specific files.
drift files <path> [options]
Options:
--category <cat> Filter by category
--json JSON outputExport manifest.
drift export [options]
Options:
--format <type> Format: json, ai-context, summary, markdown
--max-tokens <n> Token limit for ai-context format
--snippets Include code snippetsReal-time file watching.
drift watch [options]
Options:
--context Show context for changes
--debounce <ms> Debounce delay
--persist Persist changes to diskLaunch web dashboard.
drift dashboard [options]
Options:
--port <port> Server port (default: 3000)
--no-browser Don't open browserView pattern trends over time.
drift trends [options]
Options:
--period <period> Time period: 7d, 30d, 90d
--verbose Show detailed changesData access boundary analysis.
drift boundaries <subcommand>
Subcommands:
overview Show boundary overview
tables List tables and access patterns
file <path> Show boundaries for a file
sensitive List sensitive data access
check Check boundary violations
init-rules Initialize boundary rulesCall graph analysis.
drift callgraph <subcommand>
Subcommands:
build Build call graph
status Show call graph status
reach <location> What data can this code reach?
inverse <target> Who can access this data?
function <name> Show function detailsTest coverage analysis.
drift test-topology <subcommand>
Subcommands:
build Build test topology
status Show test coverage status
uncovered Find uncovered code
mocks Analyze mock usage
affected <files> Minimum tests for changed filesModule coupling analysis.
drift coupling <subcommand>
Subcommands:
build Build coupling graph
status Show coupling metrics
cycles Find dependency cycles
hotspots High-coupling modules
analyze <module> Analyze specific module
refactor-impact Impact of refactoring
unused-exports Find dead exportsError handling analysis.
drift error-handling <subcommand>
Subcommands:
build Build error handling map
status Show error handling status
gaps Find error handling gaps
boundaries Show error boundaries
unhandled Find unhandled errors
analyze <func> Analyze specific functionRun quality gates on code changes.
drift gate [files...] [options]
Options:
-p, --policy <policy> Policy to use: default, strict, relaxed, ci-fast, or custom ID
-g, --gates <gates> Specific gates to run (comma-separated)
-f, --format <format> Output format: text, json, github, gitlab, sarif
--ci Run in CI mode (implies --format json)
-v, --verbose Verbose output with details
--dry-run Show what would be checked without running
--staged Check only staged files
-o, --output <file> Write report to file
--fail-on <level> Fail threshold: error (default), warning, or noneAvailable Gates:
-
pattern-compliance- Check if code follows established patterns -
constraint-verification- Verify architectural constraints -
regression-detection- Detect pattern regressions -
impact-simulation- Analyze blast radius of changes -
security-boundary- Validate data access boundaries -
custom-rules- Run user-defined rules
Available Policies:
-
default- Balanced settings for most projects -
strict- Strict settings for main/release branches -
relaxed- Relaxed settings for feature branches -
ci-fast- Minimal checks for fast CI feedback
Examples:
# Run with default policy
drift gate
# Run on specific files
drift gate src/routes/users.ts src/services/user-service.ts
# Run with strict policy
drift gate --policy strict
# Run specific gates only
drift gate --gates pattern-compliance,security-boundary
# CI mode with GitHub annotations
drift gate --ci --format github
# Generate SARIF report for security tools
drift gate --format sarif --output report.sarif
# Check only staged files before commit
drift gate --staged --fail-on warningFramework wrapper detection.
drift wrappers [options]
Options:
--min-confidence <n> Minimum confidence (0-1)
--category <cat> Filter by category
--include-tests Include test filesAnalyze constants, enums, and exported values.
drift constants [subcommand] [options]
Subcommands:
(default) Show constants overview
list List all constants
get <name> Show constant details
secrets Show potential hardcoded secrets
inconsistent Show constants with inconsistent values
dead Show potentially unused constants
export <output> Export constants to file
Options:
--format <type> Output format: text, json, csv
--category <cat> Filter by category
--language <lang> Filter by language
--file <path> Filter by file path
--search <query> Search by name
--exported Show only exported constants
--severity <level> Min severity for secrets
--limit <n> Limit resultsExamples:
# Show overview
drift constants
# List API constants
drift constants list --category api
# Find hardcoded secrets
drift constants secrets --severity high
# Export to JSON
drift constants export constants.jsonStyling DNA analysis.
drift dna <subcommand>
Subcommands:
scan Scan for styling patterns
status Show DNA profile
gene <name> Show specific gene
mutations Find style inconsistencies
playbook Generate style playbook
export Export DNA profileMine architectural decisions from git history.
drift decisions <subcommand> [options]
Subcommands:
mine Mine decisions from git history
status Show decision mining summary
list List all decisions
show <id> Show decision details
export Export decisions as markdown ADRs
confirm <id> Confirm a draft decision
for-file <file> Find decisions affecting a file
timeline Show decisions timeline
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Enable verbose outputMine Options:
drift decisions mine [options]
Options:
-s, --since <date> Start date (ISO format)
-u, --until <date> End date (ISO format)
-c, --min-confidence <n> Minimum confidence (0-1, default: 0.5)List Options:
drift decisions list [options]
Options:
-l, --limit <n> Maximum results (default: 20)
--category <category> Filter by category
--status <status> Filter by status (draft, confirmed, superseded, rejected)Categories:
-
technology-adoptionβ New technology introduced -
technology-removalβ Technology removed -
pattern-introductionβ New pattern introduced -
pattern-migrationβ Pattern changed/migrated -
architecture-changeβ Architectural changes -
api-changeβ API modifications -
security-enhancementβ Security improvements -
performance-optimizationβ Performance work -
refactoringβ Code refactoring -
testing-strategyβ Testing changes -
infrastructureβ Infrastructure changes -
otherβ Other decisions
Examples:
# Mine decisions from git history
drift decisions mine
# Mine with date range
drift decisions mine --since 2024-01-01 --until 2024-06-30
# List all decisions
drift decisions list
# List high-confidence architecture decisions
drift decisions list --category architecture-change --status confirmed
# Show decision details
drift decisions show ADR-001
# Export as markdown ADRs
drift decisions export
# Find decisions affecting a file
drift decisions for-file src/auth/middleware.ts
# View timeline
drift decisions timelineSpeculative Execution Engine: Simulates implementation approaches BEFORE coding.
drift simulate <description> [options]
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Show detailed analysis
-n, --max-approaches <n> Maximum approaches to simulate (default: 5)
-c, --category <category> Task category (rate-limiting, authentication, etc.)
-t, --target <target> Target file or function
--constraint <constraint> Constraints (can be repeated)Examples:
# Simulate adding rate limiting
drift simulate "add rate limiting to API"
# With constraints
drift simulate "add authentication" --constraint "must work with existing auth"
# Verbose output
drift simulate "refactor user service" -vManage architectural constraints learned from the codebase.
drift constraints <subcommand> [options]
Subcommands:
extract Extract constraints from codebase
list List all constraints
show <id> Show constraint details
approve <id> Approve a discovered constraint
ignore <id> Ignore a constraint
verify <file> Verify a file against constraints
check Check all files against constraints
export <output> Export constraints to JSON file
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Enable verbose output
-c, --category <cat> Filter by category
-s, --status <status> Filter by status
-l, --limit <n> Maximum results
--min-confidence <n> Minimum confidence thresholdExamples:
# Extract constraints from codebase
drift constraints extract
# List all constraints
drift constraints list
# Verify a file
drift constraints verify src/api/users.ts
# Check entire codebase
drift constraints checkManage multiple projects.
drift projects <subcommand>
Subcommands:
list List registered projects
switch <name> Switch active project
add <path> Register a project
remove <name> Unregister a project
info <name> Show project details
cleanup Remove stale projectsManage Agent Skills.
drift skills <subcommand>
Subcommands:
list List available skills
install <name> Install a skill
info <name> Show skill details
search <query> Search for skillsShow parser status.
drift parser [options]
Options:
--test Test parser functionality
--format <type> Output formatShow environment variable access patterns.
drift env <subcommand> [options]
Subcommands:
(default) Show overview
scan Scan codebase for environment variable access
list List all discovered environment variables
var <name> Show details for a specific variable
secrets Show all secret and credential variables
required Show required variables without defaults
file <pattern> Show what env vars a file or pattern accesses
Options:
-f, --format <format> Output format (text, json)
-s, --sensitivity <type> Filter by sensitivity (secret, credential, config)
--verbose Enable verbose outputExamples:
# Scan for environment variables
drift env scan
# List all variables
drift env list
# Show secrets
drift env secrets
# Check what a file accesses
drift env file src/config.tsDisplay license status and available features.
drift license [options]
Options:
-f, --format <format> Output format (text, json)Manage telemetry settings (opt-in, privacy-first).
drift telemetry <subcommand> [options]
Subcommands:
(default) Show telemetry status
enable Enable telemetry
disable Disable telemetry and clear queued data
setup Interactive telemetry configuration
flush Manually flush queued telemetry events
Options:
--all Enable all telemetry options (enable only)
-y, --yes Skip confirmation promptsGet personalized recommendations for what to do next.
drift next-steps [options]
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Show all recommendations with detailed reasonsAnalyzes your project state and recommends:
- High priority actions (initialize, scan, review patterns)
- Language-specific commands based on detected languages
- Analysis data to build (call graph, test topology, coupling)
- MCP setup suggestions
Diagnose common issues and get targeted fixes.
drift troubleshoot [options]
Options:
-f, --format <format> Output format (text, json)
-v, --verbose Show all issues including info-level
--fix Attempt to auto-fix issues where possibleChecks for:
- Initialization issues
- Invalid configuration
- Missing patterns (needs scan)
- .driftignore problems
- Large directories slowing scans
- Stale cache
- Node.js version compatibility
- MCP configuration
Migrate to unified storage format.
drift migrate-storage [options]
Options:
--status Show migration status onlyEnterprise-grade backup and restore for .drift directory.
drift backup <subcommand> [options]
Subcommands:
create Create a new backup
list List all backups
restore <id> Restore from a backup
info <id> Show backup details
delete <id> Delete a backup (requires confirmation)
prune Remove old backups based on retention policyCreate a new backup of the .drift directory.
drift backup create [options]
Options:
-r, --reason <reason> Reason for backup (default: user_requested)
-f, --format <format> Output format: text, json (default: text)Reasons:
-
user_requestedβ Manual backup -
pre_migrationβ Before schema migration -
pre_scanβ Before major scan -
scheduledβ Automated scheduled backup
Examples:
# Create a backup
drift backup create
# Create with reason
drift backup create --reason pre_migration
# JSON output for scripting
drift backup create --format jsonList all available backups.
drift backup list [options]
Options:
-l, --limit <n> Maximum backups to show (default: 10)
-f, --format <format> Output format: text, json (default: text)Examples:
# List recent backups
drift backup list
# List more backups
drift backup list --limit 20
# JSON output
drift backup list --format jsonRestore from a backup.
drift backup restore <id> [options]
Arguments:
id Backup ID (from drift backup list)
Options:
-y, --yes Skip confirmation promptExample:
# Restore from backup
drift backup restore backup-2026-01-31T10-30-00-000Z-user_requested
# Skip confirmation
drift backup restore backup-2026-01-31T10-30-00-000Z-user_requested --yesShow detailed information about a backup.
drift backup info <id> [options]
Arguments:
id Backup ID
Options:
-f, --format <format> Output format: text, json (default: text)Example:
drift backup info backup-2026-01-31T10-30-00-000Z-user_requestedDelete a backup. Requires typing DELETE to confirm.
drift backup delete <id>
Arguments:
id Backup ID to deleteExample:
drift backup delete backup-2026-01-31T10-30-00-000Z-user_requested
# Prompts: Type DELETE to confirmRemove old backups based on retention policy.
drift backup prune [options]
Options:
--keep <n> Number of backups to keep (default: 5)
--older-than <d> Delete backups older than N days
-y, --yes Skip confirmation promptExamples:
# Keep only 5 most recent
drift backup prune --keep 5
# Delete backups older than 30 days
drift backup prune --older-than 30
# Skip confirmation
drift backup prune --keep 3 --yesThese options work with all commands:
--help, -h Show help
--version, -v Show version
--verbose Verbose output
--quiet, -q Suppress output
--no-color Disable colors- Cortex V2 Overview
- Memory Setup Wizard
- Memory CLI
- Universal Memory Types
- Learning System
- Token Efficiency
- Causal Graphs
- Code Generation
- Predictive Retrieval
- Architecture
- Call Graph Analysis
- Impact Analysis
- Security Analysis
- Data Boundaries
- Test Topology
- Coupling Analysis
- Error Handling Analysis
- Wrappers Detection
- Environment Variables
- Constants Analysis
- Styling DNA
- Constraints
- Contracts
- Decision Mining
- Speculative Execution
- Watch Mode
- Trends Analysis
- Projects Management
- Package Context
- Monorepo Support
- Reports & Export
- Dashboard
- 10 Languages
- 21 Frameworks
- 16 ORMs
- 400+ Detectors
- 50+ MCP Tools
- 60+ CLI Commands
- 23 Memory Types