Skip to main content

A production-grade Python library for RAG on local codebases with multi-provider AI support and MCP (Model Context Protocol) server integration

Project description

DeepRepo Core

A production-grade Python library for RAG on local codebases — code knowledge graph, hierarchical wiki engine, smart query routing, and branch isolation.

See the main README.md for complete documentation.

Quick Install

pip install deeprepo

# With MCP server support
pip install deeprepo[mcp]

Quick Start (CLI)

# Ingest current directory (Ollama, free and local)
deeprepo ingest .

# Browse the auto-generated wiki with in-page chat
deeprepo serve                     # → http://localhost:8080

# Ask questions directly
deeprepo query "how does authentication work?"
deeprepo query "what breaks if I change router.py?"

Quick Start (Python API)

from deeprepo import DeepRepoClient

# Initialize (defaults to Ollama if running, else OpenAI)
client = DeepRepoClient(provider_name="ollama")

# Ingest your code (incremental — unchanged files are skipped)
result = client.ingest("/path/to/your/code")
print(f"Indexed {result['files_scanned']} files, {result['wiki_generated']} wiki pages")

# Query with smart routing
response = client.query("How does authentication work?")
print(response['answer'])
print(f"Intent: {response['intent']}, Strategy: {response['strategy']}")
print(f"Sources: {response['sources']}")    # list of file paths

# Browse the wiki
print(f"Wiki at: {client.get_wiki_dir()}")

CLI Commands

Command Description
deeprepo init Detect provider setup, print the ingest command
deeprepo ingest [PATH] Build graph + wiki + embeddings
deeprepo wiki [PATH] Regenerate wiki pages only
deeprepo serve Launch wiki viewer + chat at port 8080
deeprepo query "…" Ask a question, get an AI answer
deeprepo status Show branch isolation & cache freshness

What's Inside

Module Purpose
client.py Main facade — branch isolation, freshness, provider wiring
graph.py SQLite store: graph nodes/edges, embeddings, wiki index, state
graph_builder.py Tree-sitter AST parser → code knowledge graph
wiki.py Hierarchical wiki engine — bottom-up LLM synthesis
router.py Intent classifier + 6 context strategy selectors
ingestion.py File scanner, chunker, language detection
ui.py Wiki viewer (HTTP + mermaid renderer + chat)
mcp/server.py 7 focused MCP tools for AI assistants

MCP Tools (7 tools)

Connect to Cursor / Claude Desktop as an MCP server:

deeprepo-mcp     # starts the MCP server on stdio
Tool Purpose
ingest_codebase Index a repo directory
find_symbol Locate a class/function (~50 tokens)
get_file_structure File API without reading source (~150 tokens)
explain_file Plain-English file explanation (~300 tokens)
find_change_impact Blast-radius analysis (~300 tokens)
ask_codebase Open-ended question about the code
get_project_overview Whole-repo narrative overview

Design Diagrams

Open with excalidraw.com or the VS Code Excalidraw extension.

License

MIT License — see LICENSE file for details.

Project details


Download files

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

Source Distribution

deeprepo-1.1.1.tar.gz (78.2 kB view details)

Uploaded Source

Built Distribution

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

deeprepo-1.1.1-py3-none-any.whl (84.9 kB view details)

Uploaded Python 3

File details

Details for the file deeprepo-1.1.1.tar.gz.

File metadata

  • Download URL: deeprepo-1.1.1.tar.gz
  • Upload date:
  • Size: 78.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for deeprepo-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d13378057ac31cd7f86b3b5ddeb1799badc4fff1a9fe1e3669684f4fd6803194
MD5 7d8d168357d7bb3b60ecc5dca6abd4c3
BLAKE2b-256 0444f5bafce886dcbf8cfc4ac0fc4b6111739eda1ca40f6c24a33a2d3466f75c

See more details on using hashes here.

File details

Details for the file deeprepo-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: deeprepo-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 84.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for deeprepo-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f214ab6a93ed831a78299ad39db242350145ee2e38ce058c16a68d55209689a5
MD5 93a03389fbc707a5f3b0bd7c057bd0ab
BLAKE2b-256 70a93e87ea532d454f594bda8f0fa85b9aeec727bf48c65d53d0e4a9fc705d75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page