Skip to main content

Live codebase debugging with vector search and Claude

Project description

🔍 Git Debug Oracle

Instant error diagnosis for Python codebases. Paste a stacktrace into Claude. Get a fix with reasoning in seconds.

This MCP server indexes your Git history, finds the exact code that caused an error, and uses Claude to propose fixes with full root cause analysis. Optimized for Python. No manual detective work.


⚡ 60-Second Start

# 1. Clone
git clone https://github.com/ayeshakhalid192007-dev/LIVE-CODE-BASE-DEBUGGING-ORACLE.git
cd LIVE-CODE-BASE-DEBUGGING-ORACLE

# 2. Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 3. Install dependencies
uv sync

# 4. Set up environment
cp .env.example .env
# Edit .env with your API keys and repo path

# 5. Start Qdrant
docker-compose up qdrant -d

# 6. Start MCP server
uv run git-debug-oracle

# 7. Register with Claude Code
claude mcp add --scope user live-code-oracle -- /path/to/uv --directory /path/to/repo run git-debug-oracle

# 8. Done! Tools appear in Claude Code

🎯 What This Does

Your code breaks → Error in logs → Paste into Claude → Oracle finds it → Claude proposes fix

What Benefit
Incremental indexing Only changed files re-indexed—fast even on large repos
Vector search Finds relevant code in top 3 results 90% of the time
Root cause analysis Claude reasons over diffs + code to explain why it broke
Webhook support Accepts errors from Sentry, Datadog, CloudWatch, etc.
Recency weighting Recent commits rank higher (bugs usually come from recent changes)
Fully local Your code stays on your machine
Python-focused Optimized for Python stacktraces and error patterns

📱 Platform Guides

Claude Code (Recommended)

Setup (one-time):

# After running uv run git-debug-oracle
claude mcp add --scope user live-code-oracle -- \
  /path/to/uv --directory /path/to/repo run git-debug-oracle

Use:

  1. In Claude Code, tools appear in MCP tools list
  2. Index repo: Call index_repo with your repo path
  3. On errors: Call debug_error with stacktrace
  4. Get fix: Claude returns FixProposal with reasoning

See docs/INTEGRATIONS.md for detailed setup.

Claude Desktop

Setup (one-time):

  1. Get server path: which uv and repo path
  2. Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or equivalent:
{
  "mcpServers": {
    "live-code-oracle": {
      "command": "/path/to/uv",
      "args": ["--directory", "/path/to/repo", "run", "git-debug-oracle"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-...",
        "EMBEDDING_API_KEY": "...",
        "REPO_PATH": "/path/to/your/repo"
      }
    }
  }
}
  1. Restart Claude Desktop
  2. Tools appear in tools list

See docs/INTEGRATIONS.md for detailed platform guides.


🚀 Usage

Step 1: Index Your Repository

In Claude Code, call:

Tool: index_repo
Parameters:
  repo_path: /path/to/your/repository
  branch: main
  force_full: true  (first time only)

Oracle scans all files, chunks code at function level, generates embeddings, stores in Qdrant.

Step 2: Send an Error

When you hit an error:

Tool: debug_error
Parameters:
  file_path: src/api.py
  line_number: 105
  error_message: ConnectionError: failed to connect
  stacktrace: (paste full stacktrace)

Step 3: Get Fix Proposal

Oracle returns:

  • root_cause — What went wrong and why
  • affected_file — Location of bug
  • code_patch — The fix
  • confidence — 0.0-1.0 score
  • explanation — Full reasoning chain
  • reasoning_trace — Step-by-step analysis

🔄 Example Workflow

You: "I got this error, help me fix it"
(paste stacktrace from src/parser.py line 87)

Claude: "Let me search your codebase..."
Claude calls: debug_error(...)

Oracle finds:
- Recent commit that added .split() without null check
- Previous version that handled None
- All diffs since then

Claude proposes:
- Root cause: Commit abc123 added split() without null check
- Fix: Add None check before calling .split()
- Confidence: 0.95
- Reasoning: Shows exact line, why it broke, how to fix

You: "Looks good, apply it"

Time: ~25 seconds instead of 25 minutes.


📚 Detailed Guides


🛠️ All MCP Tools

Tool Purpose Inputs Returns
index_repo Index/re-index repository repo_path, branch, force_full IndexStatus
debug_error Find fix for error file_path, line_number, error_message, stacktrace FixProposal
search_codebase Search code by query query, top_k List[RetrievalResult]
get_index_status Check indexing progress repo_path IndexStatus
get_recent_diffs Get recent commits repo_path, days List[CommitDiff]

Full API docs: docs/MCP_TOOLS.md


⚙️ Configuration

Required (in .env):

  • ANTHROPIC_API_KEY — Claude API key (get from https://console.anthropic.com)
  • EMBEDDING_API_KEY — Voyage AI or OpenAI key
  • REPO_PATH — Your Git repository path

Qdrant (defaults work):

  • QDRANT_HOST — localhost (default)
  • QDRANT_PORT — 6333 (default)
  • QDRANT_COLLECTION — git_debug_oracle (default)

Tuning (optional):

  • CHUNK_SIZE — 1000 (default)
  • CHUNK_OVERLAP — 200 (default)
  • TOP_K — 5 (default)
  • EMBEDDING_MODEL — voyage-code-2 (default) or text-embedding-3-small

See docs/CONFIGURATION.md for complete reference.


🧪 Development

# Run tests
uv run pytest tests/ -v

# Coverage report
uv run pytest tests/ --cov=src/git_debug_oracle --cov-report=html

# Type check
uv run mypy src/

# Lint
uv run ruff check src/

# Format
uv run ruff format src/

# Install git hooks
pre-commit install

📊 Performance

  • Indexing: < 2 seconds per 1000 lines of changed code
  • Retrieval: < 500ms from error to results
  • Fix generation: < 30 seconds end-to-end
  • Accuracy: 90%+ top-3 hit rate

❓ FAQ

Q: Does my code leave my machine? A: No. Repository and chunks stay local. Only API calls to Claude and embedding provider go out.

Q: What languages does it support? A: Designed for Python. Optimized for Python stacktraces and code patterns. Any language's code can be indexed.

Q: How big a repository can it handle? A: Any size. Incremental indexing means only changed files are processed.

Q: Can I use it offline? A: Indexing and search work offline. Fix generation requires Claude API, embedding requires embedding API.

Q: Can I index multiple repositories? A: Yes. Run separate server instances with different REPO_PATH values.


📄 License

MIT License — See LICENSE file.


🤝 Contributing

See CONTRIBUTING.md for:

  • Development setup
  • Git workflow
  • Testing requirements
  • Code standards

🔗 Resources


Made for developers who want instant answers, not manual archaeology.

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

git_debug_oracle-0.1.0.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

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

git_debug_oracle-0.1.0-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file git_debug_oracle-0.1.0.tar.gz.

File metadata

  • Download URL: git_debug_oracle-0.1.0.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for git_debug_oracle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61adff7447b385bba72ec51e81c8095c3961413d8e83c22790470a4aa04e1b9f
MD5 e32b370cebd304ab0c15c22fb2560cf8
BLAKE2b-256 19961a9e7b3ea8deb703380e0c7b2a7eb58feca88a1be9e844df889043e285c4

See more details on using hashes here.

File details

Details for the file git_debug_oracle-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_debug_oracle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 723dbb274a0df0ebca690d6889ff7d59a517dffd00bae06d33605416d1474051
MD5 ac3d134ea1a0651116ec68575471ed90
BLAKE2b-256 77335425e4bf860b92a7abce40ec9aa9fed34e9954769bdd2ebcd2bc5eec5854

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