Skip to main content

S.A.N.E. — Semantic Agent Navigation Engine

License Python MCP

A local, read-only progressive-disclosure code navigation engine and MCP server for AI coding agents.

S.A.N.E. turns your repository into a compact navigation graph and exposes a tiny set of Model Context Protocol (MCP) primitives that move an agent from concept → structure → symbol → implementation → usages & hierarchy without flooding the context window with raw files.


⚡ The Problem: Context Waste in AI Coding Agents

Most coding agents spend 60–80% of their token budget simply discovering where to look:

  1. grep across the whole repository (returns 200 matches).
  2. Read 1,200-line file A to inspect one method (2,500 tokens).
  3. Realize it's in file B; read 900-line file B (1,800 tokens).
  4. Run another search to find callers; read 3 more whole files (6,000 tokens).

Result: Over 10,000 tokens consumed before a single line of real reasoning takes place.

The S.A.N.E. Solution: Progressive Disclosure

What concept am I looking for?
        ↓ search_semantic("token refresh")
Which files/symbols implement it?
        ↓ get_skeleton("src/auth/service.py")
What does that file contain structurally?
        ↓ get_symbol_code("AuthService.rotate_refresh_token")
What is the exact implementation of this symbol?
        ↓ find_usages("AuthService.rotate_refresh_token")
Who calls it / what does it call?
        ↓ find_implementations("AuthService")
Who implements or extends this interface/class?

Token savings: ~85% reduction in navigation tokens with 100% precision.


🛠 Features

  • Multi-Language Structural Indexing: First-class support for Python, Java, Kotlin, and Markdown.
  • Redacted Source Skeletons: Preserves docstrings, decorators, annotations, and signatures byte-for-byte while redacting method bodies with minimal markers.
  • Hierarchical Documentation Fusion: Parses Markdown headings into navigation trees (Architecture > Auth > Refresh tokens) and deterministically bridges docs to code symbols.
  • Confidence-Aware Reference & Hierarchy Resolution: Distinguishes exact, import-scoped, class-scoped, and probable usages, and resolves direct and transitive class/interface implementations.
  • Output Budget Hard Limits: Every tool response is strictly bounded to prevent unexpected LLM context flooding.
  • Safe & Local: 100% local SQLite/WAL storage, no cloud API dependencies, zero repository modifications, strict repository containment.

🚀 Quick Start

Installation

# Using pip or uv
pip install sane-nav
# or
uv tool install sane-nav

CLI Usage

# Initialize S.A.N.E. in your repository
sane init

# Build index
sane index

# Run diagnostic check
sane doctor

# Search symbols and documentation
sane search "refresh token"

# View skeleton of a file
sane skeleton src/auth.py

# Extract exact symbol code
sane symbol "AuthService.rotate_refresh_token"

# Find call sites and references
sane usages "AuthService.rotate_refresh_token"

# Find classes implementing or extending an interface/class
sane implementations "AdContainer"

# Start MCP stdio server
sane serve

🔌 MCP Client Configuration

Claude Code

claude mcp add sane -- sane serve --repo .

Or in your project configuration:

{
  "mcpServers": {
    "sane": {
      "command": "sane",
      "args": ["serve", "--repo", "."]
    }
  }
}

Cursor (.cursor/mcp.json)

sane setup cursor --write
{
  "mcpServers": {
    "sane": {
      "command": "sane",
      "args": ["serve", "--repo", "."]
    }
  }
}

VS Code / Copilot (.vscode/mcp.json)

sane setup vscode --write
{
  "mcpServers": {
    "sane": {
      "type": "stdio",
      "command": "sane",
      "args": ["serve", "--repo", "."]
    }
  }
}

Add this prompt to your project's AGENTS.md or .cursorrules:

## Code Navigation Instructions
Use S.A.N.E. for exploring this repository:
1. `search_semantic` for a new concept or feature.
2. `get_context` when feature-level documentation is needed.
3. `get_skeleton` before reading an unfamiliar source file.
4. `get_symbol_code` to view exact implementations.
5. `find_usages` to trace call sites and references.
6. `find_implementations` to find direct and transitive subclasses or implementers of an interface/class.
7. `read_lines` only for non-code or configuration files.

Do NOT read entire source files merely to discover their structure.

🏛 Architecture

                  ┌──────────────────────────────┐
                  │  Claude / Cursor / Copilot   │
                  └──────────────┬───────────────┘
                                 │ stdio JSON-RPC
                         ┌───────▼────────┐
                         │   MCP Server   │ (Strict stdout/stderr separation)
                         └───────┬────────┘
                                 │
              ┌──────────────────▼──────────────────┐
              │          Core Application           │
              │ Search · Skeleton · Symbol · Usages │
              │      · Type Implementations         │
              └──────────────────┬──────────────────┘
                              │
                  ┌───────────▼───────────┐
                  │    SQLite (WAL)       │
                  │ Symbols · Docs · FTS5 │
                  │ Graph Edges & Subtypes│
                  └───────────▲───────────┘
                              │
              ┌───────────────┴─────────────────┐
              │    Multi-Language Adapters     │
              │ Python · Java · Kotlin · Docs  │
              └─────────────────────────────────┘

📄 License

Apache-2.0 © S.A.N.E. Contributors

Metadata

Release files for sane-nav 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sane-nav 0.2.1
File Size Uploaded Provenance Actions
sane_nav-0.2.1.tar.gz 46.7 kB Without provenance Details for sane_nav-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sane-nav 0.2.1
File Interpreter ABI Platform Actions
sane_nav-0.2.1-py3-none-any.whl Python 3 none any Details for sane_nav-0.2.1-py3-none-any.whl

Total release size: 99.4 kB

Release files / sane_nav-0.2.1.tar.gz

Download URL sane_nav-0.2.1.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e687528dc8322d2fc838744bbe1453acac74c032784ce37be6b55db3a490f0c9
BLAKE2b-256 checksum
How to use checksums
47a4abc2704f57c57c3d9b481abf1b8d035841ae62e4972ff698eeeec34e2b0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / sane_nav-0.2.1-py3-none-any.whl

Download URL sane_nav-0.2.1-py3-none-any.whl
Size 52.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8a07b6afba91204ddb816572ef363f8bd14c2aa46ae673f9022e17ae98f5fd4
BLAKE2b-256 checksum
How to use checksums
b74ce178b86cbf594181900fd94a53f576d252fa0f6eee5fbbea6d84abb499ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for sane-nav 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page