Skip to content

vapordude/semble-rs

 
 

Repository files navigation

semble logo
Fast and Accurate Code Search for Agents
Uses ~98% fewer tokens than grep+read

Semble is a code search library built for agents, now 100% ported to Rust for maximum performance and a sub-millisecond local retrieval experience. It returns the exact code snippets agents need instantly, using ~98% fewer tokens than grep+read and cutting latency on every step. Everything runs completely locally with no external API dependencies.

Architecture

The project has been rebuilt in Rust and is structured as a multi-crate workspace in semble-rs, divided into modular components:

  • parser-ast: Handles tree-sitter based code chunking, recursively splitting AST nodes to find optimal context boundaries.
  • core-index: A hybrid retrieval engine utilizing BM25 (sparse) and high-performance vector operations for dense embeddings, implemented directly on arrays.
  • cli-mcp: The core executable providing an async MCP server built on tokio and axum, capable of running completely detached and exposing standard HTTP endpoints.

Zero-Dependency Philosophy

We believe in maximum stability and minimum bloat. Semble follows a strict zero-dependency philosophy where possible, relying entirely on the Rust standard library and a carefully curated list of high-performance primitives:

  • rayon for parallelization
  • tree-sitter for AST parsing
  • ndarray for dense vector operations
  • memmap2 for zero-copy memory mapping
  • safetensors for model loading
  • tokio / axum for async networking and the MCP server.

We never include heavy, monolithic libraries or network dependencies for external inference. Memory sizes are always documented in bytes, and latency in ns/ms, strictly adhering to our metric compliance.

MCP Server & OpenAI API

Semble exposes an OpenAI API-compatible endpoint out of the box so that any tool that can query chat/completions can seamlessly fetch relevant context chunks directly from your repository.

Run the server via:

cd semble-rs
cargo run -p cli-mcp

This starts an Axum server on port 3000. You can query it via standard HTTP requests:

curl http://localhost:3000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "semble-search",
    "messages": [{"role": "user", "content": "How is authentication handled?"}]
  }'

The response provides mocked model completions mapped internally to high-fidelity BM25 and dense retrieval results from your codebase.

About

Fast and Accurate Code Search for Agents. Uses ~98% fewer tokens than grep+read

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 93.8%
  • Makefile 6.2%