Agent tools

Sonar

Find relevant files, symbols, and line ranges in a codebase, with local search and JSON results for coding agents.

Get started View on crates.io Available on crates.ioLinux tested

Sonar helps me and my coding agents find where to start reading a repository. It indexes Rust, Python, TypeScript, TSX, and Markdown, then returns relevant files, declarations, and line ranges. Basic search runs locally without a model or API key.

Find your way through the code.

Start with a question

Investigate how something works or request a short navigation brief. Results point to files, symbols, and suggested line ranges to inspect.

Explore the relationships

Inspect declarations and narrow searches by directory. Optional preparation adds Rust and TypeScript caller and reference navigation using their language tools.

Give agents a local map

Use JSON output in the terminal or expose a prepared repository through MCP. Add local embeddings when you want hybrid search.

Install

Run from any directory with Rust 1.88+ and native build tools installed. Cargo builds the published sonar-code package and installs the sonar executable.

Install Sonar with Cargo
cargo install sonar-code --locked

Next step

After installation, run these commands from the repository you want to explore. Basic indexing and search need no model download. Replace the question with something relevant to your project.

Index your repository
sonar index .
sonar investigate "Where are incoming requests authenticated?"
Read the guide
Before you start

Rust 1.88+ · C/C++ compiler and linker

Linux is the validated platform. Each index belongs to one repository and defaults to .sonar/index.sqlite. Refresh it after source changes. Rust and TypeScript relationships need separate preparation and dependencies; search results are starting points to verify in the source.

What it looks like to use
find a place to start reading
# From the repository directory, after indexing
sonar brief "How are failed requests retried?"
sonar investigate "How are requests routed?" --scope src
sonar outline src/main.rs