Skip to content

Repository files navigation

Relith

Release Stars Coverage Go License Platform


Relith is a local-first context engine for AI-assisted coding. It indexes your codebases and exposes them through a unified MCP interface - one index, any AI.

Instead of every AI tool building its own isolated context, Relith is a shared intelligence layer: Cursor, Claude Code, OpenCode, and any MCP client query it for code search, symbol lookup, reference tracking, dependency graphs - and now, git history.

Why Relith?

  • One index, every AI. Every AI tool asks the same questions of your codebase. Relith builds the context once and serves every MCP client from the same index - no per-tool re-indexing, no duplicated state.
  • Local-first by default. One self-contained download, no runtime or cloud account required. Docker is optional - a container image is included for those who want it. Your code never leaves your machine.
  • Beyond grep. Search only finds strings. Relith also answers where is this used, what calls this, how do these files relate, and when, why, and who changed this line - via symbols, references, a dependency graph, and git-aware tools.
  • Zero glue code. Speak the Model Context Protocol over stdio and your tools show up in any MCP-compatible agent automatically.

How it compares

ripgrep ast-grep Sourcegraph Relith
Search Regex over files Structural (AST) patterns Regex + keyword + semantic (hosted) Regex/FTS over a shared index
Multi-repo Per invocation Per directory Yes (hosted) Yes - one index
Symbols & references No Partial (structural) Yes (SCIP) Yes, 17 languages
Callers/callees & graph No No Yes (code navigation) Yes (knowledge graph)
Git-aware context No No Yes (hosted) Yes (commits, history, blame, diffs)
MCP-native No No Yes (Enterprise instance) Yes, local stdio
Data locality Local Local SaaS or self-host Local
Setup One binary One binary Instance + account Tarball + one-liner install

Features

  • MCP-native - 21 tools for AI assistants: search, symbols, references, definitions, callers/callees, file outline, dependency tracing, graph queries, architecture overview, commits, blame, and diffs
  • Git-aware context - ask when / why / who: recent commits, per-file history (follows renames), per-line blame, and full patches between any two refs
  • Cross-file reasoning - one trace_context bundle combining FTS search + symbol matches + references + graph neighbors
  • Knowledge graph - typed dependency graph (import edges for Go/JS/TS/Python/Rust, reference co-occurrence for all), visualized with an interactive D3.js force-directed graph
  • Symbol & reference extraction - functions, types, methods, interfaces, enums, macros across 17 languages
  • Multi-repo - index unlimited repos, search across all at once
  • Self-healing watcher - auto-reindexes changed files via fsnotify
  • Terminal UI - Bubble Tea progress bars, spinners, and a server dashboard
  • REST API - HTTP server for scripts, CI pipelines, and programmatic access
  • Local-first, zero runtime - static Go binaries in one download, no npm/pip/uv, no runtime, Docker optional, your code never leaves your machine

Performance

Linux kernel, 94,989 files, 1.7M chunks:

Phase Time
Walk + index 14m 40s
Graph build 1m 8s
Total 15m 48s

Reproduce it on your machine with bench/index-kernel.sh - see docs/benchmarks.md.

Quick Start

git clone https://github.com/cryskram/relith.git && cd relith
make build-all

# ...or install the latest release:
curl -fsSL https://raw.githubusercontent.com/cryskram/relith/main/install.sh | sh
# On Windows, run the same command from Git Bash / MSYS2.

# ...and to uninstall (add --purge to also delete the index database and config):
curl -fsSL https://raw.githubusercontent.com/cryskram/relith/main/uninstall.sh | sh

./bin/relith repo add /path/to/your/project
./bin/relith index
./bin/relith search "your query"

# Wire your AI agent (OpenCode, Cursor, Claude Code)
./bin/relith install

# Daemon: REST API + graph UI + file watcher
./bin/relith serve

macOS: If Gatekeeper blocks the downloaded binary, run xattr -d com.apple.quarantine /path/to/binary.

CLI

Interactive commands (index, remove, serve) render a Bubble Tea TUI automatically; otherwise they print plain text.

Command Description
relith repo add <path> Register a repository for indexing
relith repo list List all indexed repositories
relith repo remove <id-or-name> Remove a repository and all its data
relith index [path] Index a repo (or all pending)
relith search <query> Full-text search across all indexed code
relith status Show indexing status with file/chunk counts
relith serve Start the daemon (REST API + graph UI + file watcher)
relith install Auto-configure MCP for OpenCode, Cursor, Claude Code
relith uninstall Remove relith MCP configuration from agents
relith db vacuum Reclaim unused database space
relith version Print the version
relith search <query> --limit=N Limit search results

MCP Server

Relith speaks the Model Context Protocol over stdio. Point any MCP-compatible assistant at relithmcp, and the tools show up automatically - no glue code.

relith install                 # auto-detect installed agents
relith install --agent=cursor  # or target a specific one
relith install --agent=code    # Claude Code

Git-aware tools

On any repo that's a git worktree, the AI can also ask:

Tool Answer
get_recent_commits What's been done recently (hash, author, date, message)
get_file_history What has this file been through
get_blame Who owns each line of this file
get_diff Exactly what a commit / PR changed (stat + patch)

These shell out to your system git, so they always match the repo's real state.

Full tool list

Category Tools
Search search_code, find_symbol, find_references, find_callers, find_callees
Files get_file_content, get_file_outline, get_file_tree, get_repo_summary
Graph get_related_files, list_hub_files, query_graph, get_architecture, trace_dependency
Git get_recent_commits, get_file_history, get_blame, get_diff
Reasoning trace_context, get_symbol_definition, list_repositories

Manual setup

Agent Where
Cursor Settings → MCP Servers → Add: command /path/to/relithmcp
Claude Code ~/.config/claude/mcp.json{"mcpServers": {"relith": {"command": "/path/to/relithmcp"}}}

REST API

Via the daemon:

curl -s 127.0.0.1:9876/v1/health
curl -s "127.0.0.1:9876/v1/search?q=sqlite"
curl -s 127.0.0.1:9876/v1/graph          # interactive graph (browser)
curl -s 127.0.0.1:9876/v1/graph?repo=my-repo  # graph data (JSON)

Configuration

~/.config/relith/relith.yaml (or %LOCALAPPDATA%\Relith\relith.yaml). Any key overrides with a RELITH_ env var (RELITH_INDEXER_CONCURRENCY=8).

core:
  data_dir: ~/.local/share/relith
daemon: { tcp_host: 127.0.0.1, tcp_port: 9876 }
mcp:    { enabled: true, transport: stdio }
indexer: { concurrency: 4, max_file_size: 10485760 }
watcher: { enabled: true, debounce: 1s }
search: { max_results: 100, path_boosting: true }

How it works

Three binaries share one SQLite (FTS5 + WAL) database:

Binary Role
relith CLI + TUI
relithd REST API + graph UI + file watcher
relithmcp MCP server over stdio

Walk → chunk → extract symbols & refs → build dependency graph → serve via MCP, HTTP, or TUI.

See ARCHITECTURE.md for the full picture.

License

MIT - see LICENSE.

Contributing

See CONTRIBUTING.md for the dev setup and contribution workflow. Security issues: see SECURITY.md.

About

Local-first context engine for AI-assisted coding. One SQLite index powering MCP-native search, symbols, references, and a knowledge graph... for any AI agent.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages