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.1.tar.gz (306.9 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.1-py3-none-any.whl (396.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: batho-1.3.1.tar.gz
  • Upload date:
  • Size: 306.9 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.1.tar.gz
Algorithm Hash digest
SHA256 9dc713de0fcb82899203a6893157bbccd6241b59ff38bfc0cd460abcf136e785
MD5 4713f176d952bdf1e9bfdff63957f63f
BLAKE2b-256 2e7cf6fc1028687437254aac83353e1f1688595278c1e44cbc9ebc615d2e01d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: batho-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 396.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c13b5d498fbe5ba38653242a9ce98d81595c757376b2d579bf3d1ef402b4c9
MD5 a5ca317a8451e4ad95b17d850d00f473
BLAKE2b-256 67c32e956763c53b1be9f8159d652419deeebf87ecf042cef724a2cbfdcb8e87

See more details on using hashes here.

Release history Release notifications | RSS feed

1.4.1

2 files

1.4.0

2 files

1.3.2

2 files

This release

1.3.1 This release

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