Skip to content

CodeRAGSemantic Code Search

Lightning-fast hybrid search with AST chunking - RAG-ready for AI assistants

CodeRAG

Quick Example

typescript
import { CodebaseIndexer, PersistentStorage } from '@sylphx/coderag'

// Create persistent storage (SQLite)
const storage = new PersistentStorage({ codebaseRoot: './my-project' })

// Initialize indexer
const indexer = new CodebaseIndexer({
  codebaseRoot: './my-project',
  storage,
})

// Index codebase with file watching
await indexer.index({ watch: true })

// Search for code
const results = await indexer.search('authentication logic', {
  limit: 10,
  includeContent: true,
})

console.log(results)
// [{ path: 'src/auth.ts', score: 0.85, snippet: '...', chunkType: 'FunctionDeclaration' }]

Why CodeRAG?

Performance First

Built with performance in mind from day one:

  • Fast Indexing: 1000-2000 files/second
  • Instant Startup: <100ms with cached index
  • Low Memory: SQL-based search mode available
  • Incremental Updates: Only reindex changed files

Returns semantic chunks, not entire files:

  • Functions: Find specific function implementations
  • Classes: Locate class definitions
  • Methods: Search within class methods
  • Imports: Track dependencies

Production Ready

  • 400+ tests passing
  • Full TypeScript support
  • Comprehensive documentation
  • MCP server included

Installation

bash
npm install @sylphx/coderag
bash
pnpm add @sylphx/coderag
bash
bun add @sylphx/coderag

MCP Server (for AI Assistants)

Use CodeRAG with Claude, Cursor, or any MCP-compatible AI assistant:

bash
npx @sylphx/coderag-mcp --root=/path/to/project

Or add to your claude_desktop_config.json:

json
{
  "mcpServers": {
    "coderag": {
      "command": "npx",
      "args": ["-y", "@sylphx/coderag-mcp", "--root=/path/to/project"]
    }
  }
}

Ready to get started? Check out the Quick Start Guide or learn about the MCP Server.

Released under the MIT License.