Skip to main content

Lightweight semantic code search and distillation utility for AI coding agents. It solves the API knowledge gap via real-time local signature extraction and intent analysis without PyTorch. Optimized for token efficiency, it compresses codebase context into compact semantic summaries stored in a local DuckDB vector similarity index.

Project description

Agent-CodeRAG

Agent-CodeRAG Banner

Fast. Local. Agent-First. Token-Efficient. Bridge the gap between AI coding agents and your local environment.

Python 3.10+ License: MIT PyPI Version Downloads Tests Coverage


Table of Contents


Why Agent-CodeRAG?

AI coding agents often hallucinate when calling library APIs because their training data is static. This leads to a "Fail-Fix-Fail" cycle — broken code, token waste, and frustration.

The Problem: Your agent knows Pydantic v1 (model.dict()), but your environment uses v2 (model.model_dump()). Result: 5000+ wasted tokens trying to "fix" something it doesn't understand.

The Solution: Agent-CodeRAG extracts actual API signatures from your installed libraries and provides the LLM with real-time, environment-specific context — saving up to 80% of context window tokens.

🔝 Back to top


Quick Start

# 1. Install
pip install agent-coderag

# 2. Setup (download ONNX model)
agent-coderag setup

# 3. Configure LLM (optional, for AI distillation)
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"

# 4. Index your project
agent-coderag sync --all

# 5. Search
agent-coderag search "how to handle errors"

Docker:

docker build -t agent-coderag .
docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup

🔝 Back to top


✨ Features

  • ⚡ No PyTorch — Uses onnxruntime and tokenizers (Rust) for instant startup
  • 💾 DuckDB VSS — High-performance vector search in a single local file
  • 🏗️ Multi-Language — Native indexing for Python (AST) and Java (javalang)
  • 🔄 Delta-Sync — SHA-256 hashing re-distills only changed code
  • 🔌 Hybrid Intelligence — Works offline; adds AI-distilled reasoning when LLM is connected
  • 📡 API Discovery — Extract live API signatures from Python modules or Java JARs

🔝 Back to top


🛠 How It Works

graph TD
    A[Local Python Code] --> B[AST Parser]
    B --> C{Delta-Sync}
    C -- Changed/New --> D[LLM Distiller]
    C -- Unchanged --> E[Local Cache]
    D --> F[Semantic Summary]
    E --> F
    F --> G[ONNX Embedder]
    G --> H[(DuckDB VSS)]
    H --> I[Semantic Search / JSON API]
  1. AST Parser — Parses your Python code
  2. Delta-Sync — Uses SHA-256 to detect changes
  3. LLM Distiller — Generates semantic summaries (optional)
  4. ONNX Embedder — Creates embeddings locally
  5. DuckDB VSS — Stores vectors for fast similarity search

🔝 Back to top


📡 API Discovery

agent-coderag api pydantic

Returns the live public API, methods, and signatures for any installed library.

🔝 Back to top


🤖 For AI Agents

Agent-CodeRAG is built for programmatic consumption:

  1. Search First: agent-coderag --json search "topic" --limit 1
  2. Use Intent: The summary field provides technical intent — skip reading unnecessary files

🔝 Back to top


🔧 Development

# Run tests
pytest tests/
pytest e2e_tests/

# Setup pre-commit hooks
pip install pre-commit
pre-commit install

🔝 Back to top


🤝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/agent-coderag.git
  3. Create a branch: git checkout -b feature/your-feature
  4. Make changes and commit with Conventional Commits
  5. Run tests: pytest tests/
  6. Push to your fork and create a Pull Request

See CONTRIBUTING.md for detailed guidelines.

🔝 Back to top


📄 License

MIT © 2026 Igor Boloban

🔝 Back to top

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

agent_coderag-1.2.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

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

agent_coderag-1.2.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_coderag-1.2.0.tar.gz.

File metadata

  • Download URL: agent_coderag-1.2.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_coderag-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e7359f1a0fa430d1af7a2796b73ba066e7ba2944c3dbdc0426b4ceea53f55321
MD5 351c2004c8d0772cc5c0c76b1ad3fe19
BLAKE2b-256 7678c921913ae4e7c1ee9c64602035959b0ca18e534304902d1a8e29c3dde26d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.2.0.tar.gz:

Publisher: release.yml on naranor/agent-coderag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_coderag-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: agent_coderag-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_coderag-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcac7078916790d8a3a3407da19eed5ccac24c08795fa7645e5c5217e889200b
MD5 68942cbbe0736c5b110d957aaca2ffbb
BLAKE2b-256 b19901c03e151ec5a1b7384e9eb9886f52afcacce6e85d8b9edfbaad922dbb54

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.2.0-py3-none-any.whl:

Publisher: release.yml on naranor/agent-coderag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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