Reflex
OfficialReflex is a local-first, offline code search engine providing sub-100ms search, symbol navigation, and dependency analysis for AI agents and CLI tools.
Search & Discovery
search_code— Full-text or symbol-only search with line numbers and code previewssearch_regex— Regex-based search for complex patternssearch_ast— Structure-aware search using Tree-sitter AST querieslist_locations— Fast file+line discovery returning minimal location data (no content)count_occurrences— Quick statistics on how many times a pattern appears and in how many filesfind_references— Find a symbol's definition and all usage sites in a single atomic call
Index Management
index_project— Build or incrementally update the search indexcheck_index_status— Check whether the index is fresh, stale, or missing
Dependency Analysis
get_dependencies— List all imports/dependencies of a specific fileget_dependents— Reverse lookup: find all files that import a given fileget_transitive_deps— Walk the full dependency tree up to a configurable depthfind_hotspots— Identify the most-imported files (critical dependencies)find_circular— Detect circular dependency chainsfind_unused— Find files with no incoming dependencies (potential dead code)find_islands— Identify disconnected components/subsystems in the dependency graphanalyze_summary— High-level health metrics: counts of circular deps, hotspots, unused files, and islands
Codebase Context
gather_context— Collect project structure, file type distribution, frameworks, entry points, test layout, and config files
Supports natural language code search and codebase analysis using OpenAI's models as the AI provider.
Reflex
Sub-100ms local code search — CLI, scripts, and AI agents
Reflex is a local-first, full-text code search engine. Use it from the command line, pipe it into scripts, or connect it to AI coding assistants (Claude Code, Cursor, and any MCP-compatible tool) for instant symbol lookup, dependency analysis, and codebase exploration — fully offline, fully deterministic, no cloud required.
Quick start
1. Install
# Via NPM
npm install -g reflex-search
# Or via Cargo
cargo install reflex-search2. Index and search
# From your project root
rfx index
# Full-text search
rfx query "extract_symbols"
# Symbol definitions only
rfx query "CacheManager" --symbols
# JSON output for scripting
rfx query "TODO" --json --limit 203. (Optional) Connect to an AI agent via MCP
Add this to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"reflex": {
"command": "rfx",
"args": ["mcp"]
}
}
}Your AI assistant can now call search_code, find_references, get_dependencies, and more.
See Claude Code + Reflex MCP Quickstart for MCP setup, key tools, and troubleshooting.
Related MCP server: codeix
Why Reflex vs. built-in search tools
Capability | grep / ripgrep | Built-in AI search | Sourcegraph | Reflex |
Full-text search | ✅ | ✅ | ✅ | ✅ |
Symbol-aware filtering | ❌ | Partial | ✅ | ✅ |
Dependency analysis | ❌ | ❌ | Partial | ✅ |
Deterministic results | ✅ | ❌ | ✅ | ✅ |
Local-first / offline | ✅ | ❌ | ❌ | ✅ |
MCP server built-in | ❌ | — | ❌ | ✅ |
JSON output for agents | Manual | ✅ | ✅ | ✅ |
MCP tools
When connected via MCP, your AI assistant gets these tools:
Tool | What it does |
| Full-text or symbol search with line numbers and context |
| Fast file+line discovery (minimal tokens) |
| Quick match statistics without full content |
| Regex pattern matching across the codebase |
| Structure-aware search via Tree-sitter AST queries |
| Symbol definition + all usage sites in a single call; the primary code-navigation tool for AI agents |
| Trigger or refresh the search index |
| Check whether the index is fresh, stale, or missing; call before any search session or after git operations |
| All imports for a specific file |
| All files that import a given file (reverse lookup) |
| Transitive dependency graph up to a configurable depth |
| Most-imported files (dependency hotspots) |
| Detect circular dependency chains |
| Files with no incoming dependencies |
| Disconnected components in the dependency graph |
| High-level dependency counts and metrics |
| Codebase structure and project-type summary |
Index not found error? If an MCP tool returns "Index not found. Run 'rfx index' to build the cache first", call index_project first, then retry the failed tool.
CLI usage
Reflex also works as a standalone CLI for humans and shell scripts.
# Full-text search (finds every occurrence)
rfx query "extract_symbols"
# Symbol definitions only (faster, uses tree-sitter)
rfx query "extract_symbols" --symbols
# Filter by language and symbol kind
rfx query "parse" --lang rust --kind function --symbols
# Regex search
rfx query "fn.*test" --regex
# JSON output for programmatic use
rfx query "unwrap" --json --limit 10
# Pipe file paths to other tools
vim $(rfx query "TODO" --paths)Interactive TUI mode — run rfx query with no pattern to launch live search with keyboard navigation.
Dependency analysis
rfx deps src/main.rs # Show direct imports
rfx deps src/config.rs --reverse # What imports this file
rfx deps src/api.rs --depth 3 # Transitive dependencies
rfx analyze --circular # Find circular dependency chains
rfx analyze --hotspots # Most-imported files
rfx analyze --unused # Files with no incoming dependenciesNatural language search
rfx ask "Find all TODOs in Rust files" # Translate to rfx query and run
rfx ask "How does authentication work?" --agentic # Multi-step codebase reasoning
rfx ask # Interactive chat modeRequires an AI provider configured via rfx llm config (OpenAI, Anthropic, OpenRouter, or any OpenAI-compatible endpoint).
Other commands
rfx index # Build / update the search index
rfx index status # Background indexing status
rfx watch # Auto-reindex on file changes
rfx stats # Index statistics
rfx pulse changelog # Codebase change digest
rfx pulse wiki # Per-module documentation
rfx pulse map # Architecture diagram (Mermaid / D2)
rfx serve --port 7878 # Local HTTP API serverRun rfx <command> --help for full options.
Installation
NPM (recommended)
npm install -g reflex-searchCargo
cargo install reflex-searchSetup note: run rfx commands from your project root directory. Add .reflex/ to your .gitignore to exclude the search index from version control.
Supported languages
Full symbol extraction (functions, classes, methods, types, etc.) for 15 languages:
Systems: Rust, C, C++, Zig
Backend: Python, Go, Java, C#, PHP, Ruby, Kotlin
Frontend: TypeScript, JavaScript, Vue, Svelte
Swift is temporarily disabled (tree-sitter-swift 0.7.x grammar incompatibility).
rfx query --lang swiftemits a warning; full-text search still works.
Full-text search works on all file types regardless of parser support.
Configuration
# .reflex/config.toml (project-level)
[index]
languages = [] # Empty = all supported languages
max_file_size = 10485760 # 10 MB
[search]
default_limit = 100
[performance]
parallel_threads = 0 # 0 = auto (80% of available cores)For AI provider configuration (rfx ask, rfx pulse), run rfx llm config.
Architecture
Reflex uses a trigram-based inverted index with runtime symbol detection:
Indexing: extracts 3-character trigrams from all files; stores full content in memory-mapped
content.bin; no tree-sitter parsing at index timeFull-text queries: intersect trigram posting lists → verify matches (instant)
Symbol queries: trigrams narrow candidates → parse only matching files with tree-sitter
.reflex/
meta.db # SQLite: file metadata, stats, config
trigrams.bin # Inverted index (memory-mapped)
content.bin # Full file contents (memory-mapped)
config.toml # Index settingsSecurity
rfx serve binds to 127.0.0.1:7878 by default — loopback only, no authentication. Do not expose it to the network. See CLAUDE.md for the full threat model.
Contributing
cargo build --release # Build
cargo test # Test
rfx index # Refresh index after code changesSee CONTRIBUTING.md for guidelines.
License
MIT — see LICENSE for details.
Fast code search for developers — works standalone, in scripts, and with AI coding agents
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/reflex-search/reflex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server