drift  by dadbodgeoff

AI code generation that understands your codebase

Created 4 weeks ago

New!

708 stars

Top 48.5% on SourcePulse

GitHubView on GitHub
Project Summary

Codebase pattern detection for AI agents. Scans your code, learns conventions, feeds context to Claude/Cursor or any IDE MCP. Also works fully offline with CLI. Drift addresses the challenge of AI agents producing code that deviates from established project conventions, leading to inconsistency and increased manual correction. By analyzing a codebase, learning its unique patterns, and providing this context to AI tools, Drift enables AI to generate code that aligns with existing styles, logic, and architectural choices, thereby improving developer efficiency and code quality.

How It Works

Drift employs Tree-sitter parsing to deeply analyze source code, identifying and learning project-specific conventions such as API patterns, error handling strategies, and authentication middleware. It constructs call graphs, maps security boundaries, and assesses test coverage. This learned intelligence is then exposed via an MCP (Model-Centric Programming) server, allowing AI agents to query for context relevant to a task, such as adding a new endpoint, ensuring the generated code adheres to the discovered patterns.

Quick Start & Requirements

  • Primary install: npm install -g driftdetect (global install recommended for MCP integration). Docker deployment is also available.
  • Prerequisites: Node.js and npm. Runs locally; no external services are required for core analysis.
  • Setup: Initialize with drift init and scan with drift scan. Configure AI clients (e.g., Claude Desktop, Cursor) by updating their respective JSON configuration files with the driftdetect-mcp command.
  • Links: Documentation Wiki, MCP Tools Reference, MCP Architecture, Getting Started, FAQ.

Highlighted Details

  • Pattern Learning: Discovers, visualizes, and allows approval of project-specific conventions across various code elements.
  • Codebase Intelligence: Offers tools for comprehensive call graph analysis, security boundary mapping, test topology analysis, module coupling assessment, and error handling gap detection.
  • AI Contextualization: Acts as an MCP server, providing curated context to AI agents to generate fitting code.
  • CI Integration: Supports automated checks (drift check --ci) with configurable output formats for build pipelines.

Maintenance & Community

The provided README does not detail specific contributors, sponsorships, or community channels (e.g., Discord, Slack). The project indicates active development with recent updates in version 0.9.28.

Licensing & Compatibility

Drift utilizes an "Open Core" model. Core packages are licensed under Apache 2.0, while enterprise features are under BSL 1.1, which converts to Apache 2.0 after 4 years. Individual developers and small teams can use Drift free of charge. The Apache 2.0 core is generally compatible with commercial use and closed-source linking.

Limitations & Caveats

Enterprise features are subject to the BSL 1.1 license, and the distinction between "core" and "enterprise" features may require clarification. Telemetry is enabled by default and must be explicitly disabled if desired. The Docker deployment offers enhanced isolation for sensitive environments.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
31
Issues (30d)
24
Star History
712 stars in the last 29 days

Explore Similar Projects

Feedback? Help us improve.