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: Semantic Intelligence for AI Coding Agents
Fast. Local. Agent-First. Token-Efficient.
📖 Table of Contents
- 🧠 The Problem: The API Knowledge Gap
- 🚀 The Solution: Real-Time Contextual Truth
- 🛠 How it Works
- 📡 API Discovery
- 🏃 Quick Start
- 🤖 For AI Agents
- 🔧 Development
- 📄 License
🧠 The Problem: The API Knowledge Gap
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: Agents use deprecated parameters or non-existent methods from outdated versions.
- Token Waste: You provide the error, the agent tries to fix it using more outdated data, consuming thousands of tokens in a loop.
- Environment Mismatch: The agent knows the API for version 1.0, but your environment has 2.0.
Real-world Example (The Pydantic Gap)
- Agent's Knowledge: Knows Pydantic v1 (
model.dict()). - Your Environment: Uses Pydantic v2 (
model.model_dump()). - The Result: The agent writes
dict(), the code fails, and it wastes 5000+ tokens trying to "fix" a problem it doesn't understand.
🚀 The Solution: Real-Time Contextual Truth
Agent-CodeRAG acts as a lightweight semantic bridge between your local environment and the LLM.
- API Discovery: Extracts actual signatures from your installed libraries.
- Semantic Retrieval: Provides the LLM with the exact Intent of your code units, indexed locally via ONNX.
- Token Efficiency: Instead of sending whole files, Agent-CodeRAG distills code into compact semantic summaries, saving up to 80% of context window tokens.
🛠 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]
✨ Key Features
- ⚡ No PyTorch: Uses
onnxruntimeandtokenizers(Rust) for a tiny footprint and instant startup. - 💾 DuckDB VSS: High-performance vector similarity search stored in a single local file.
- 🔄 Delta-Sync: Uses SHA-256 hashing to only re-distill changed code, saving your API budget.
- 🔌 Hybrid Intelligence: Works offline using name-based embeddings; adds AI-distilled reasoning when an LLM is connected.
📡 API Discovery
To help your agent understand a specific library version installed in your environment:
agent-coderag api pydantic
Returns the live public API, methods, and signatures.
🏃 Quick Start
1. Install
pip install agent-coderag
2. Setup AI Models
Download the lightweight paraphrase-multilingual-MiniLM ONNX model to your global cache:
agent-coderag setup
3. Configure your LLM (For Distillation)
Option A: Cloud (OpenAI)
agent-coderag config --url "https://api.openai.com/v1" --model "gpt-4o-mini" --key "sk-..."
Option B: Local (Ollama) - Recommended
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"
We recommend using qwen2.5-coder or llama3.2 for fast and private local distillation.
4. Index your Project
agent-coderag sync --all
5. Search
- Human Mode (Compact):
agent-coderag search "how to handle errors" - Agent Mode (JSON):
agent-coderag --json search "data storage" --limit 1
🐳 Docker (Alternative)
docker build -t agent-coderag .
docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup
🤖 For AI Agents
Agent-CodeRAG is built specifically for programmatic consumption.
Agent Strategy
- Search First: Use
agent-coderag --json search "topic"to find relevant code units before reading files. - Use Intent: The
summaryfield provides technical intent, allowing you to skip reading complex implementation details.
🔧 Development
Running Tests
pytest tests/
pytest e2e_tests/
Pre-commit Hooks
We use pre-commit to maintain high code standards:
pip install pre-commit
pre-commit install
📄 License
MIT © 2026 Igor Boloban
🙏 Acknowledgments
This project stands on the shoulders of giants. See THIRD_PARTY_LICENSES.md for a full list of open-source libraries used in Agent-CodeRAG.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_coderag-1.1.0.tar.gz.
File metadata
- Download URL: agent_coderag-1.1.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc715c957c21f7403a74d6704a52d645cdca7469f6e90d03e467c9466203e562
|
|
| MD5 |
116b455e4035b49ed29cdfadd84294af
|
|
| BLAKE2b-256 |
5590c2732e2daa8a02d284b5b135762b9273befbcebed6f9b3070c3f9c4f374b
|
Provenance
The following attestation bundles were made for agent_coderag-1.1.0.tar.gz:
Publisher:
release.yml on naranor/agent-coderag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_coderag-1.1.0.tar.gz -
Subject digest:
fc715c957c21f7403a74d6704a52d645cdca7469f6e90d03e467c9466203e562 - Sigstore transparency entry: 1297089428
- Sigstore integration time:
-
Permalink:
naranor/agent-coderag@521b000e1d7eecbe8c055944458efe48a6229e78 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/naranor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@521b000e1d7eecbe8c055944458efe48a6229e78 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_coderag-1.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_coderag-1.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3235487d5b20d314a25b997636e2a9c76c86f6bfcba729e2f67881da836dab2e
|
|
| MD5 |
25f3741796e417ab6663571be748906f
|
|
| BLAKE2b-256 |
7c3dae9ec472d88153122bf64906bc83ef3d96c7e5b9e915aa1213cc1f2c67f4
|
Provenance
The following attestation bundles were made for agent_coderag-1.1.0-py3-none-any.whl:
Publisher:
release.yml on naranor/agent-coderag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_coderag-1.1.0-py3-none-any.whl -
Subject digest:
3235487d5b20d314a25b997636e2a9c76c86f6bfcba729e2f67881da836dab2e - Sigstore transparency entry: 1297089497
- Sigstore integration time:
-
Permalink:
naranor/agent-coderag@521b000e1d7eecbe8c055944458efe48a6229e78 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/naranor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@521b000e1d7eecbe8c055944458efe48a6229e78 -
Trigger Event:
push
-
Statement type: