-
Notifications
You must be signed in to change notification settings - Fork 59
Home
Make AI write code that actually fits your codebase.
Drift scans your code, learns your patterns, and gives AI agents deep understanding of your conventions. 50+ MCP tools. 60+ CLI commands. 10 languages. Native Rust core.
That static AGENTS.md file you wrote once and forgot about? It's stale. Replace it with Cortex β a living memory system:
drift memory init
drift memory add tribal "Always use bcrypt for passwords" --importance critical
drift memory add tribal "Services should not call controllers" --topic Architecture
# AI gets context dynamically, learns from corrections, confidence decays on stale knowledgeβ Learn about Cortex Memory | Memory CLI Reference
# Install
npm install -g driftdetect
# Scan your project
cd your-project
drift init
drift scan
# See what Drift found
drift statusThat's it. Drift now understands your codebase.
β Full Getting Started Guide
# Install MCP server
npm install -g driftdetect-mcpAdd to your AI tool's config:
{
"mcpServers": {
"drift": {
"command": "driftdetect-mcp"
}
}
}| Package | Version | npm |
|---|---|---|
CLI (driftdetect) |
0.9.40 | npm |
MCP Server (driftdetect-mcp) |
0.9.39 | npm |
Core (driftdetect-core) |
0.9.39 | npm |
Native (driftdetect-native) |
0.9.39 | npm |
Upgrade: npm install -g driftdetect@latest driftdetect-mcp@latest
AI writes code that works but doesn't fit. It ignores your conventions, misses your patterns, and creates inconsistency. You spend more time fixing AI output than you saved.
Drift fixes this.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR CODEBASE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. DRIFT SCAN β
β $ drift init && drift scan β
β Analyzes code with Tree-sitter parsing: β
β β’ Discovers patterns (how YOU write code) β
β β’ Builds call graph (who calls what, data flow) β
β β’ Maps security boundaries (sensitive data access) β
β β’ Tracks test coverage (which code is tested) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. PATTERN LEARNING β
β Drift discovers YOUR conventions: β
β β’ API patterns (routes, middleware, response format) β
β β’ Auth patterns (decorators, guards, middleware) β
β β’ Error patterns (try/catch, Result types, boundaries) β
β You approve what matters: $ drift approve <pattern-id> β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. AI GETS CONTEXT β
β drift_context({ intent: "add_feature", focus: "auth" }) β
β Returns: β
β β’ Your patterns with examples β
β β’ Similar code in your codebase β
β β’ Files to modify β
β β’ Security warnings β
β β’ Constraints to satisfy β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 4. AI WRITES FITTING CODE β
β Generated code matches YOUR patterns automatically β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Category | Count | Details |
|---|---|---|
| Languages | 10 | TypeScript, JavaScript, Python, Java, C#, PHP, Go, Rust, C, C++ |
| Web Frameworks | 21 | Express, NestJS, Next.js, Spring Boot, ASP.NET, Laravel, FastAPI, Gin, Echo, Actix, Axum, and more |
| ORMs | 16 | Prisma, TypeORM, Sequelize, Django ORM, Entity Framework, Eloquent, SQLAlchemy, and more |
| Pattern Detectors | 400+ | API, Auth, Security, Errors, Logging, Testing, Data Access, and more |
| MCP Tools | 50 | Organized in 7 layers for efficient AI interaction |
| CLI Commands | 45+ | Full analysis and management capabilities |
| Feature | Description | Learn More |
|---|---|---|
| Pattern Detection | Discovers how YOU write code across 15 categories | Pattern Categories |
| Cortex Memory | AI memory system that learns from your codebase | Cortex V2 Overview |
| Call Graph | Maps function calls and data flow | Call Graph Analysis |
| Security Analysis | Tracks sensitive data access | Security Analysis |
| Test Topology | Maps tests to code | Test Topology |
| Coupling Analysis | Finds dependency cycles | Coupling Analysis |
| Error Handling | Detects unhandled errors | Error Handling Analysis |
| Quality Gates | CI/CD integration | Quality Gates |
| MCP Server | 50+ tools for AI agents | MCP Tools Reference |
- Getting Started β Installation and first scan
- Configuration β Project configuration options
- MCP Setup β Connect to Claude, Cursor, Windsurf, Kiro
- Dashboard β Web visualization
- Architecture β How Drift works under the hood
- Pattern Categories β The 15 pattern categories
- Detectors Deep Dive β 400+ detectors explained
- Language Support β 10 languages, 21 frameworks, 16 ORMs
- Skills β 72 implementation guides for AI agents
- Cortex V2 Overview β AI memory system overview
- Memory CLI β CLI commands for memory management
- Learning System β How Cortex learns from corrections
- Token Efficiency β Compression and deduplication
- Causal Graphs β Memory relationships and "why" explanations
- Code Generation β Context for AI code generation
- Predictive Retrieval β Anticipating memory needs
- Call Graph Analysis β Data flow and reachability
- Impact Analysis β Understand blast radius of changes
- Security Analysis β Sensitive data tracking
- Data Boundaries β Data access enforcement
- Test Topology β Test coverage mapping
- Coupling Analysis β Dependency analysis
- Error Handling Analysis β Error handling gaps
- Wrappers Detection β Framework wrapper patterns
- Environment Variables β Env var analysis
- Constants Analysis β Constants and magic numbers
- Styling DNA β Component styling patterns
- Code Examples β Get real code snippets
- Similar Code β Find semantically similar code
- Explain Tool β Comprehensive code explanation
- Suggest Changes β AI-guided fix suggestions
- Validate Change β Pre-commit validation
- AI Navigation Guide β Tool selection decision tree
- Constraints β Architectural invariants
- Contracts β API contract verification
- Decision Mining β ADRs from git history
- Speculative Execution β Simulate before coding
- Watch Mode β Real-time pattern detection
- Trends Analysis β Pattern regressions
- Projects Management β Multi-project registry
- Package Context β Monorepo package context
- Monorepo Support β Working with monorepos
- Reports & Export β Generate reports
- CLI Reference β All 45+ CLI commands
- MCP Tools Reference β All 50 MCP tools
- MCP Architecture β The 7-layer tool design
- Quality Gates β CI/CD integration
- Incremental Scans β Efficient re-scanning
- CI Integration β GitHub/GitLab setup
- Git Hooks β Pre-commit integration
- Audit System β Pattern audit and auto-approval
- Contributing β How to contribute
- Troubleshooting β Common issues and fixes
- FAQ β Frequently asked questions
Drift is a monorepo with a Rust core and TypeScript packages:
| Crate | Purpose |
|---|---|
drift-core |
12 native analysis modules |
drift-napi |
Node.js bindings via NAPI |
| Package | npm Name | Purpose |
|---|---|---|
| Core | driftdetect-core |
Analysis orchestration + native bindings |
| Detectors | driftdetect-detectors |
400+ pattern detectors |
| CLI | driftdetect |
Command-line interface |
| MCP | driftdetect-mcp |
MCP server for AI agents |
| LSP | driftdetect-lsp |
Language Server Protocol |
| Dashboard | driftdetect-dashboard |
Web dashboard |
| Galaxy | driftdetect-galaxy |
3D visualization |
Drift runs 100% locally. Your code never leaves your machine.
| Aspect | Details |
|---|---|
| Reads | Source files in your project directory |
| Writes |
.drift/ directory only |
| Network | No outbound calls for analysis |
| Telemetry | Anonymous usage stats, opt-out with drift telemetry disable
|
Open Core model:
- Core packages: Apache 2.0 (fully open source)
- Enterprise features: BSL 1.1 (converts to Apache 2.0 after 4 years)
Individual developers and small teams use Drift completely free.
See licenses/LICENSING.md for details.
- 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