Skip to main content

Batho

B.A.T.H.O

Give your AI coding agent a map of your codebase — not the whole territory.
Reduce token spend 10x, eliminate hallucinations, and ship faster with graph-powered code intelligence.

PyPI License Documentation Stars DOI

Works with: Claude Code · Cursor · Windsurf · Antigravity · Gemini CLI · Cline · OpenCode · Aider


Quick Setup

The fastest way to set up Batho: give the skill file to your AI agent and let it do everything for you.

1. Download the skill file

curl -O https://raw.githubusercontent.com/sageoz/batho/main/SKILL.md

2. Give it to your AI agent

Paste this into your agent's chat (Claude Code, Cursor, Windsurf, or any agent that supports skills):

Read SKILL.md and set up Batho for this repo

3. Your agent handles the rest

  • Installs Batho globally (pip / uv / pipx)
  • Builds the code graph for your repository
  • Auto-detects all installed AI clients (Claude Desktop, Cursor, Windsurf, VS Code)
  • Configures MCP for each client
  • Verifies the setup works end-to-end

No manual JSON editing. No config file hunting. Your agent does it all.

Multi-repo? Your agent can register multiple repos via the MCP registry — one config serves all. See the Multi-Repo Guide.

Manual Setup (CLI)

Prefer the terminal? Batho works with zero config:

# Install
pip install batho

# Build the code graph
batho build --root . --verbose

# Start the MCP server
batho mcp

Then add to your agent's MCP config:

{
  "mcpServers": {
    "batho": { "command": "batho", "args": ["mcp"] }
  }
}

Full setup guide: docs


Why Batho?

AI coding agents are powerful — but they burn tokens reading files and hallucinate when context is thin. Batho gives your agent a structured code graph so it works smarter, not harder.

  • Slash token costs — Your agent queries a graph instead of reading entire files. 10x fewer tokens per task — no more dumping your repo into the LLM.
  • Eliminate hallucinations — Deterministic, tree-sitter-parsed relationships. Your agent gets facts, not guesses — zero hallucinations on structural queries.
  • Agent superpowers — Bug tracking, security audits, refactoring, code review — your agent handles more, accurately. When cost and quality are solved, automation widens with imagination.

MCP Tools

Batho exposes 10 MCP tools your AI agent can call:

Tool Purpose
graph_overview High-level codebase summary: entities, relationships, communities
graph_query Filtered graph query by file, type, or name pattern
get_entity Detailed info for a single entity + relationships
trace_path Shortest path between two entities (BFS)
get_file_graph All entities and relationships in a file
search_entities Substring/regex search across entity names
get_delta Incremental changes from the latest patch
list_repos List all registered repos with status
add_repo Register a repository in the MCP registry
remove_repo Remove a repository from the registry

Full reference: docs


Features

  • 40+ languages — Python, TypeScript, Rust, Go, Java, C/C++ and more via tree-sitter
  • 10x token compression — your agent uses a fraction of the context window
  • Zero hallucinations — deterministic AST-parsed relationships, not embeddings or guesses
  • Fast incremental updates — hash-based change detection re-parses only modified files
  • Cross-file symbol resolution — your agent sees how functions, classes, and dependencies connect
  • 38 built-in analysis plugins — security, quality, and optimization rules with custom rule support
  • Time-machine — node-level diff history across every indexed run
  • Zero code execution — safe to run in CI or on untrusted repositories
  • MCP-native — works with 8 AI coding agents out of the box

CI/CD

Batho's CI/CD strategy is incremental: download the previous artifact → batho loadbatho patchbatho export → upload.

GitHub Actions composite action:

- uses: sageoz/batho@v1.2.0
  with:
    root: "."
    artifact-name: "batho-index"

Full CI/CD guides (GitHub Actions, GitLab CI, reusable workflows): docs


Configuration

Batho runs with zero config. To customize, copy batho.yaml.example to ./batho.yaml.

Full configuration reference: docs


Developer Setup

git clone https://github.com/sageoz/batho.git
cd batho
uv sync --all-groups --all-extras
uv run pytest
uv run python batho_cli.py --help

Documentation


Acknowledgments

Co-authored with Devin — autonomous AI software engineer by Cognition.


Citation

If you use Batho in your research, please cite it as:

@misc{Sharma_Batho_2026,
  author = {Sharma, Rishiraj},
  doi = {10.5281/zenodo.21407508},
  month = {7},
  title = {Batho: Deterministic Code Intelligence Engine},
  url = {https://pypi.org/project/batho/},
  year = {2026}
}

You can also find the citation metadata in CITATION.cff or use GitHub's "Cite this repository" button.


License

Apache License 2.0 — see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

batho-1.3.2.tar.gz (308.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

batho-1.3.2-py3-none-any.whl (398.6 kB view details)

Uploaded Python 3

File details

Details for the file batho-1.3.2.tar.gz.

File metadata

  • Download URL: batho-1.3.2.tar.gz
  • Upload date:
  • Size: 308.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for batho-1.3.2.tar.gz
Algorithm Hash digest
SHA256 69d6b96fc73443c42f66dda5d08ce2bd443837288939afd6dc5051e1b9c572ed
MD5 b9605efc82ef636f81c41be5cb577e31
BLAKE2b-256 247de1cbf923fd4487227b00e4a96a2727b86dd5adeb7bccf85c0549b27b51e9

See more details on using hashes here.

File details

Details for the file batho-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: batho-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 398.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for batho-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8be863ab806968c30bb9e0fbd2c7605ef2abec2624bf942f4f930bfc34524a53
MD5 c907e564ba1e8aca8a0f278808f49224
BLAKE2b-256 d5dde806fd19caf3684c28542945a970864fbf07af068b6b8809f676f667d11b

See more details on using hashes here.

Release history Release notifications | RSS feed

1.4.1

2 files

1.4.0

2 files

This release

1.3.2 This release

2 files

1.3.1

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.1.4

2 files

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