agent-coderag 1.2.0__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_coderag-1.3.0/PKG-INFO +233 -0
- agent_coderag-1.3.0/README.md +188 -0
- agent_coderag-1.3.0/agent_coderag.egg-info/PKG-INFO +233 -0
- agent_coderag-1.3.0/agent_coderag.egg-info/SOURCES.txt +64 -0
- agent_coderag-1.3.0/agent_coderag.egg-info/requires.txt +20 -0
- agent_coderag-1.3.0/code_rag/core/constants.py +18 -0
- agent_coderag-1.3.0/code_rag/core/exceptions.py +27 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/core/interfaces.py +29 -3
- agent_coderag-1.3.0/code_rag/core/manager.py +272 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/core/models.py +14 -7
- agent_coderag-1.3.0/code_rag/core/utils.py +92 -0
- agent_coderag-1.3.0/code_rag/discovery/dependency.py +15 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/discovery/java_discovery.py +71 -27
- agent_coderag-1.3.0/code_rag/discovery/manager.py +59 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/base.py +9 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/csharp.py +64 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/go.py +53 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/java.py +53 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/javascript.py +196 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/python.py +141 -0
- agent_coderag-1.3.0/code_rag/discovery/providers/rust.py +198 -0
- agent_coderag-1.3.0/code_rag/entry/cli.py +338 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/intelligence/distiller.py +13 -9
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/intelligence/embedder.py +64 -32
- agent_coderag-1.3.0/code_rag/parsers/languages.py +505 -0
- agent_coderag-1.3.0/code_rag/parsers/multi_parser.py +31 -0
- agent_coderag-1.3.0/code_rag/parsers/tree_sitter.py +225 -0
- agent_coderag-1.3.0/code_rag/storage/__init__.py +0 -0
- agent_coderag-1.3.0/code_rag/storage/duckdb_impl.py +311 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/pyproject.toml +15 -2
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/tests/test_cli.py +147 -111
- agent_coderag-1.3.0/tests/test_cli_detailed.py +199 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/tests/test_code_rag_simple.py +13 -6
- agent_coderag-1.3.0/tests/test_csharp_discovery_detailed.py +54 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/tests/test_dependency_discovery.py +14 -9
- agent_coderag-1.3.0/tests/test_discovery_manager_detailed.py +35 -0
- agent_coderag-1.3.0/tests/test_discovery_providers_extra.py +61 -0
- agent_coderag-1.3.0/tests/test_discovery_python.py +80 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/tests/test_distiller.py +26 -19
- agent_coderag-1.3.0/tests/test_distiller_extra.py +27 -0
- agent_coderag-1.3.0/tests/test_embedder.py +65 -0
- agent_coderag-1.3.0/tests/test_embedder_detailed.py +111 -0
- agent_coderag-1.3.0/tests/test_interfaces.py +97 -0
- agent_coderag-1.3.0/tests/test_js_discovery_detailed.py +151 -0
- agent_coderag-1.3.0/tests/test_languages.py +63 -0
- agent_coderag-1.3.0/tests/test_manager_detailed.py +170 -0
- agent_coderag-1.3.0/tests/test_manager_extra.py +82 -0
- agent_coderag-1.3.0/tests/test_models.py +47 -0
- agent_coderag-1.3.0/tests/test_multi_parser.py +32 -0
- agent_coderag-1.3.0/tests/test_rust_discovery_detailed.py +146 -0
- agent_coderag-1.3.0/tests/test_storage_detailed.py +72 -0
- agent_coderag-1.3.0/tests/test_tree_sitter_parser.py +131 -0
- agent_coderag-1.3.0/tests/test_utils_detailed.py +78 -0
- agent_coderag-1.2.0/PKG-INFO +0 -206
- agent_coderag-1.2.0/README.md +0 -171
- agent_coderag-1.2.0/agent_coderag.egg-info/PKG-INFO +0 -206
- agent_coderag-1.2.0/agent_coderag.egg-info/SOURCES.txt +0 -39
- agent_coderag-1.2.0/agent_coderag.egg-info/requires.txt +0 -9
- agent_coderag-1.2.0/code_rag/core/manager.py +0 -72
- agent_coderag-1.2.0/code_rag/discovery/dependency.py +0 -49
- agent_coderag-1.2.0/code_rag/entry/cli.py +0 -249
- agent_coderag-1.2.0/code_rag/parsers/ast_index.py +0 -121
- agent_coderag-1.2.0/code_rag/parsers/java_parser.py +0 -144
- agent_coderag-1.2.0/code_rag/parsers/multi_parser.py +0 -39
- agent_coderag-1.2.0/code_rag/storage/duckdb_impl.py +0 -155
- agent_coderag-1.2.0/tests/test_ast_parser.py +0 -69
- agent_coderag-1.2.0/tests/test_embedder.py +0 -59
- agent_coderag-1.2.0/tests/test_interfaces.py +0 -83
- agent_coderag-1.2.0/tests/test_java_parser.py +0 -60
- agent_coderag-1.2.0/tests/test_multi_parser.py +0 -30
- agent_coderag-1.2.0/tests/test_parsers.py +0 -42
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/LICENSE +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/NOTICE +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/agent_coderag.egg-info/dependency_links.txt +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/agent_coderag.egg-info/entry_points.txt +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/agent_coderag.egg-info/top_level.txt +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/__init__.py +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/core/__init__.py +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/code_rag/discovery/__init__.py +0 -0
- {agent_coderag-1.2.0/code_rag/entry → agent_coderag-1.3.0/code_rag/discovery/providers}/__init__.py +0 -0
- {agent_coderag-1.2.0/code_rag/intelligence → agent_coderag-1.3.0/code_rag/entry}/__init__.py +0 -0
- {agent_coderag-1.2.0/code_rag/parsers → agent_coderag-1.3.0/code_rag/intelligence}/__init__.py +0 -0
- {agent_coderag-1.2.0/code_rag/storage → agent_coderag-1.3.0/code_rag/parsers}/__init__.py +0 -0
- {agent_coderag-1.2.0 → agent_coderag-1.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-coderag
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: 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.
|
|
5
|
+
Author-email: Igor Boloban <naranor@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/naranor/agent-coderag
|
|
8
|
+
Project-URL: Repository, https://github.com/naranor/agent-coderag
|
|
9
|
+
Project-URL: Issues, https://github.com/naranor/agent-coderag/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/naranor/agent-coderag/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: rag,ai-agents,semantic-search,code-analysis,context-compression,onnx,local-embeddings
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: NOTICE
|
|
25
|
+
Requires-Dist: duckdb
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: litellm
|
|
28
|
+
Requires-Dist: onnxruntime
|
|
29
|
+
Requires-Dist: tokenizers
|
|
30
|
+
Requires-Dist: pydantic
|
|
31
|
+
Requires-Dist: httpx
|
|
32
|
+
Requires-Dist: aiofiles
|
|
33
|
+
Requires-Dist: pathspec
|
|
34
|
+
Requires-Dist: tree-sitter
|
|
35
|
+
Requires-Dist: dnfile
|
|
36
|
+
Requires-Dist: defusedxml
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
41
|
+
Requires-Dist: prospector[with_bandit,with_mypy,with_vulture]; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff; extra == "dev"
|
|
43
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# agent-coderag
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="assets/banner.svg" alt="agent-coderag Logo" width="100%">
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<b>The API Knowledge Bridge for AI Coding Agents.</b><br>
|
|
54
|
+
Local, fast, and token-efficient semantic search that eliminates LLM hallucinations by providing real-time local context.
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<a href="https://github.com/naranor/agent-coderag/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/naranor/agent-coderag/ci.yml?branch=main&style=for-the-badge&logo=github&label=CI" alt="Build Status"></a>
|
|
59
|
+
<a href="https://pypi.org/project/agent-coderag/"><img src="https://img.shields.io/pypi/v/agent-coderag?style=for-the-badge&logo=python&color=blue" alt="PyPI Version"></a>
|
|
60
|
+
<a href="https://github.com/naranor/agent-coderag/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-orange?style=for-the-badge" alt="License"></a>
|
|
61
|
+
<a href="https://codecov.io/gh/naranor/agent-coderag"><img src="https://img.shields.io/codecov/c/github/naranor/agent-coderag?style=for-the-badge&logo=codecov" alt="Test Coverage"></a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<a href="#key-features">Features</a> •
|
|
66
|
+
<a href="#quick-start">Quick Start</a> •
|
|
67
|
+
<a href="#how-it-works">Architecture</a> •
|
|
68
|
+
<a href="#agent-native-usage">AI Agent Guide</a> •
|
|
69
|
+
<a href="#contributing">Contributing</a>
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Why agent-coderag?
|
|
75
|
+
|
|
76
|
+
In 2026, AI coding agents are limited by stale training data. They hallucinate library calls because they don't know your specific environment.
|
|
77
|
+
|
|
78
|
+
* **The Pain:** Your agent writes code for Pydantic v1 while you have v2 installed. You waste 5000+ tokens in a "Fail-Fix-Fail" loop.
|
|
79
|
+
* **The Cure:** agent-coderag extracts live API signatures and technical intent from your local environment. It feeds the LLM exactly what it needs to see—no more, no less.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Key Features
|
|
84
|
+
|
|
85
|
+
- **Instant Startup:** Built on onnxruntime and Rust-based tokenizers. Zero PyTorch overhead.
|
|
86
|
+
- **Context Compression:** Replace 10,000 lines of raw code with a 200-token semantic summary.
|
|
87
|
+
- **Universal Tree-Sitter Parser:** Supports 25+ languages (Python, JS/TS, Rust, Java, C++, Go, Ruby, etc.) with high precision.
|
|
88
|
+
- **API Discovery:** On-the-fly extraction of public signatures for 6 core ecosystems (Python, Java, Go, TypeScript, Rust, C#) with build-system awareness.
|
|
89
|
+
- **Local First:** All embeddings and data stay on your machine in a high-performance DuckDB VSS index.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
### Installation
|
|
96
|
+
```bash
|
|
97
|
+
pip install agent-coderag
|
|
98
|
+
# Install tree-sitter grammars for your languages on-demand
|
|
99
|
+
pip install tree-sitter-python tree-sitter-javascript
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Initial Setup
|
|
103
|
+
```bash
|
|
104
|
+
# Download pre-trained multilingual embedding models (~130MB)
|
|
105
|
+
agent-coderag setup
|
|
106
|
+
|
|
107
|
+
# (Optional) Connect your preferred LLM for semantic distillation
|
|
108
|
+
# Using Ollama (Local)
|
|
109
|
+
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder"
|
|
110
|
+
|
|
111
|
+
# Using OpenAI-compatible API (e.g. Groq, OpenRouter, DeepSeek)
|
|
112
|
+
agent-coderag config --url "https://api.deepseek.com" --key "your-api-key" --model "deepseek-chat"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Offline Mode (No Provider)
|
|
116
|
+
If you don't configure an LLM provider, agent-coderag works in **100% Offline Mode**:
|
|
117
|
+
- **Parsing & API Discovery:** Still works perfectly using local Tree-Sitter grammars and javap.
|
|
118
|
+
- **Search:** Remains fast and accurate.
|
|
119
|
+
- **Distillation:** Instead of AI-generated summaries, the system uses code signatures and entity names as fallback metadata. No data ever leaves your machine.
|
|
120
|
+
|
|
121
|
+
### First Sync & Search
|
|
122
|
+
```bash
|
|
123
|
+
# Index your entire project (respects .gitignore automatically)
|
|
124
|
+
agent-coderag sync --all
|
|
125
|
+
|
|
126
|
+
# Perform a semantic search
|
|
127
|
+
agent-coderag search "how does the authentication middleware work?"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### API Discovery
|
|
131
|
+
Verify external library signatures without leaving the CLI:
|
|
132
|
+
```bash
|
|
133
|
+
# Explicit language selection (Recommended for multi-language repos)
|
|
134
|
+
agent-coderag api requests --lang python
|
|
135
|
+
agent-coderag api lodash --lang typescript
|
|
136
|
+
agent-coderag api serde --lang rust
|
|
137
|
+
|
|
138
|
+
# Built-in auto-detection for common project types (Cargo.toml, package.json, etc.)
|
|
139
|
+
agent-coderag api fmt
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Supported Ecosystems (Discovery)
|
|
145
|
+
|
|
146
|
+
| Language | Method | Discovery Source |
|
|
147
|
+
| :--- | :--- | :--- |
|
|
148
|
+
| **Python** | 3-Stage Probe | `.pyi` stubs, static source, or runtime `inspect` |
|
|
149
|
+
| **Java** | Bytecode Reflection | JARs resolved via Maven (`pom.xml`) or Gradle |
|
|
150
|
+
| **Go** | Standard Tooling | Native `go doc -all` integration |
|
|
151
|
+
| **TypeScript/JS** | Declaration Maps | `.d.ts` files from `node_modules` or `@types` |
|
|
152
|
+
| **Rust** | Registry Analysis | Source code from Cargo registry via `cargo metadata` |
|
|
153
|
+
| **C#** | Assembly Metadata | DLL metadata via `dnfile` and XML documentation |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## How It Works
|
|
158
|
+
|
|
159
|
+
agent-coderag creates a semantic map of your codebase using a multi-stage pipeline:
|
|
160
|
+
|
|
161
|
+
```mermaid
|
|
162
|
+
graph LR
|
|
163
|
+
Code[Local Codebase] --> Parser[Multi-Language Parser]
|
|
164
|
+
Parser --> Delta[Delta-Sync SHA-256]
|
|
165
|
+
Delta -- New/Changed --> Distill[LLM Distiller]
|
|
166
|
+
Delta -- Unchanged --> Cache[Local Cache]
|
|
167
|
+
Distill --> Embed[ONNX Embedder]
|
|
168
|
+
Cache --> Embed
|
|
169
|
+
Embed --> DuckDB[(DuckDB VSS)]
|
|
170
|
+
DuckDB --> Agent[AI Agent Response]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
1. **Structural Parsing:** Identifies classes, methods, and relations (imports).
|
|
174
|
+
2. **Technical Distillation:** Generates a concise "intent summary" of each code unit.
|
|
175
|
+
3. **Vectorization:** Local ONNX model creates 384-dimensional embeddings.
|
|
176
|
+
4. **VSS Storage:** DuckDB enables sub-millisecond similarity search.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Agent-Native Usage
|
|
181
|
+
|
|
182
|
+
agent-coderag is designed to be the primary tool for your AI agents.
|
|
183
|
+
|
|
184
|
+
### The Protocol:
|
|
185
|
+
1. **Search First:** Instead of reading files, the agent runs agent-coderag --json search.
|
|
186
|
+
2. **Verify Signatures:** The agent runs agent-coderag api <lib> to get real signatures.
|
|
187
|
+
3. **Read Summaries:** The agent uses the summary field to decide which files are actually relevant.
|
|
188
|
+
|
|
189
|
+
**Programmatic Output:**
|
|
190
|
+
```bash
|
|
191
|
+
agent-coderag --json search "database init" --limit 1
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Development & Testing
|
|
197
|
+
|
|
198
|
+
We maintain a strict quality bar.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Install development dependencies
|
|
202
|
+
make install
|
|
203
|
+
|
|
204
|
+
# Run full test suite with coverage
|
|
205
|
+
make test
|
|
206
|
+
|
|
207
|
+
# Run linters (Prospector, MyPy, Bandit)
|
|
208
|
+
make lint
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
Contributions make the open source community an amazing place to learn, inspire, and create.
|
|
216
|
+
|
|
217
|
+
1. Fork the Project
|
|
218
|
+
2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
|
|
219
|
+
3. Commit your Changes (git commit -m 'feat: add AmazingFeature')
|
|
220
|
+
4. Push to the Branch (git push origin feature/AmazingFeature)
|
|
221
|
+
5. Open a Pull Request
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
Distributed under the MIT License. See LICENSE for more information.
|
|
228
|
+
|
|
229
|
+
[🔝 Back to top](#table-of-contents)
|
|
230
|
+
|
|
231
|
+
<p align="center">
|
|
232
|
+
<i>Built for agents. Driven by humans.</i>
|
|
233
|
+
</p>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# agent-coderag
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="assets/banner.svg" alt="agent-coderag Logo" width="100%">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>The API Knowledge Bridge for AI Coding Agents.</b><br>
|
|
9
|
+
Local, fast, and token-efficient semantic search that eliminates LLM hallucinations by providing real-time local context.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/naranor/agent-coderag/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/naranor/agent-coderag/ci.yml?branch=main&style=for-the-badge&logo=github&label=CI" alt="Build Status"></a>
|
|
14
|
+
<a href="https://pypi.org/project/agent-coderag/"><img src="https://img.shields.io/pypi/v/agent-coderag?style=for-the-badge&logo=python&color=blue" alt="PyPI Version"></a>
|
|
15
|
+
<a href="https://github.com/naranor/agent-coderag/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-orange?style=for-the-badge" alt="License"></a>
|
|
16
|
+
<a href="https://codecov.io/gh/naranor/agent-coderag"><img src="https://img.shields.io/codecov/c/github/naranor/agent-coderag?style=for-the-badge&logo=codecov" alt="Test Coverage"></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="#key-features">Features</a> •
|
|
21
|
+
<a href="#quick-start">Quick Start</a> •
|
|
22
|
+
<a href="#how-it-works">Architecture</a> •
|
|
23
|
+
<a href="#agent-native-usage">AI Agent Guide</a> •
|
|
24
|
+
<a href="#contributing">Contributing</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Why agent-coderag?
|
|
30
|
+
|
|
31
|
+
In 2026, AI coding agents are limited by stale training data. They hallucinate library calls because they don't know your specific environment.
|
|
32
|
+
|
|
33
|
+
* **The Pain:** Your agent writes code for Pydantic v1 while you have v2 installed. You waste 5000+ tokens in a "Fail-Fix-Fail" loop.
|
|
34
|
+
* **The Cure:** agent-coderag extracts live API signatures and technical intent from your local environment. It feeds the LLM exactly what it needs to see—no more, no less.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Key Features
|
|
39
|
+
|
|
40
|
+
- **Instant Startup:** Built on onnxruntime and Rust-based tokenizers. Zero PyTorch overhead.
|
|
41
|
+
- **Context Compression:** Replace 10,000 lines of raw code with a 200-token semantic summary.
|
|
42
|
+
- **Universal Tree-Sitter Parser:** Supports 25+ languages (Python, JS/TS, Rust, Java, C++, Go, Ruby, etc.) with high precision.
|
|
43
|
+
- **API Discovery:** On-the-fly extraction of public signatures for 6 core ecosystems (Python, Java, Go, TypeScript, Rust, C#) with build-system awareness.
|
|
44
|
+
- **Local First:** All embeddings and data stay on your machine in a high-performance DuckDB VSS index.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### Installation
|
|
51
|
+
```bash
|
|
52
|
+
pip install agent-coderag
|
|
53
|
+
# Install tree-sitter grammars for your languages on-demand
|
|
54
|
+
pip install tree-sitter-python tree-sitter-javascript
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Initial Setup
|
|
58
|
+
```bash
|
|
59
|
+
# Download pre-trained multilingual embedding models (~130MB)
|
|
60
|
+
agent-coderag setup
|
|
61
|
+
|
|
62
|
+
# (Optional) Connect your preferred LLM for semantic distillation
|
|
63
|
+
# Using Ollama (Local)
|
|
64
|
+
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder"
|
|
65
|
+
|
|
66
|
+
# Using OpenAI-compatible API (e.g. Groq, OpenRouter, DeepSeek)
|
|
67
|
+
agent-coderag config --url "https://api.deepseek.com" --key "your-api-key" --model "deepseek-chat"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Offline Mode (No Provider)
|
|
71
|
+
If you don't configure an LLM provider, agent-coderag works in **100% Offline Mode**:
|
|
72
|
+
- **Parsing & API Discovery:** Still works perfectly using local Tree-Sitter grammars and javap.
|
|
73
|
+
- **Search:** Remains fast and accurate.
|
|
74
|
+
- **Distillation:** Instead of AI-generated summaries, the system uses code signatures and entity names as fallback metadata. No data ever leaves your machine.
|
|
75
|
+
|
|
76
|
+
### First Sync & Search
|
|
77
|
+
```bash
|
|
78
|
+
# Index your entire project (respects .gitignore automatically)
|
|
79
|
+
agent-coderag sync --all
|
|
80
|
+
|
|
81
|
+
# Perform a semantic search
|
|
82
|
+
agent-coderag search "how does the authentication middleware work?"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### API Discovery
|
|
86
|
+
Verify external library signatures without leaving the CLI:
|
|
87
|
+
```bash
|
|
88
|
+
# Explicit language selection (Recommended for multi-language repos)
|
|
89
|
+
agent-coderag api requests --lang python
|
|
90
|
+
agent-coderag api lodash --lang typescript
|
|
91
|
+
agent-coderag api serde --lang rust
|
|
92
|
+
|
|
93
|
+
# Built-in auto-detection for common project types (Cargo.toml, package.json, etc.)
|
|
94
|
+
agent-coderag api fmt
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Supported Ecosystems (Discovery)
|
|
100
|
+
|
|
101
|
+
| Language | Method | Discovery Source |
|
|
102
|
+
| :--- | :--- | :--- |
|
|
103
|
+
| **Python** | 3-Stage Probe | `.pyi` stubs, static source, or runtime `inspect` |
|
|
104
|
+
| **Java** | Bytecode Reflection | JARs resolved via Maven (`pom.xml`) or Gradle |
|
|
105
|
+
| **Go** | Standard Tooling | Native `go doc -all` integration |
|
|
106
|
+
| **TypeScript/JS** | Declaration Maps | `.d.ts` files from `node_modules` or `@types` |
|
|
107
|
+
| **Rust** | Registry Analysis | Source code from Cargo registry via `cargo metadata` |
|
|
108
|
+
| **C#** | Assembly Metadata | DLL metadata via `dnfile` and XML documentation |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## How It Works
|
|
113
|
+
|
|
114
|
+
agent-coderag creates a semantic map of your codebase using a multi-stage pipeline:
|
|
115
|
+
|
|
116
|
+
```mermaid
|
|
117
|
+
graph LR
|
|
118
|
+
Code[Local Codebase] --> Parser[Multi-Language Parser]
|
|
119
|
+
Parser --> Delta[Delta-Sync SHA-256]
|
|
120
|
+
Delta -- New/Changed --> Distill[LLM Distiller]
|
|
121
|
+
Delta -- Unchanged --> Cache[Local Cache]
|
|
122
|
+
Distill --> Embed[ONNX Embedder]
|
|
123
|
+
Cache --> Embed
|
|
124
|
+
Embed --> DuckDB[(DuckDB VSS)]
|
|
125
|
+
DuckDB --> Agent[AI Agent Response]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
1. **Structural Parsing:** Identifies classes, methods, and relations (imports).
|
|
129
|
+
2. **Technical Distillation:** Generates a concise "intent summary" of each code unit.
|
|
130
|
+
3. **Vectorization:** Local ONNX model creates 384-dimensional embeddings.
|
|
131
|
+
4. **VSS Storage:** DuckDB enables sub-millisecond similarity search.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Agent-Native Usage
|
|
136
|
+
|
|
137
|
+
agent-coderag is designed to be the primary tool for your AI agents.
|
|
138
|
+
|
|
139
|
+
### The Protocol:
|
|
140
|
+
1. **Search First:** Instead of reading files, the agent runs agent-coderag --json search.
|
|
141
|
+
2. **Verify Signatures:** The agent runs agent-coderag api <lib> to get real signatures.
|
|
142
|
+
3. **Read Summaries:** The agent uses the summary field to decide which files are actually relevant.
|
|
143
|
+
|
|
144
|
+
**Programmatic Output:**
|
|
145
|
+
```bash
|
|
146
|
+
agent-coderag --json search "database init" --limit 1
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Development & Testing
|
|
152
|
+
|
|
153
|
+
We maintain a strict quality bar.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Install development dependencies
|
|
157
|
+
make install
|
|
158
|
+
|
|
159
|
+
# Run full test suite with coverage
|
|
160
|
+
make test
|
|
161
|
+
|
|
162
|
+
# Run linters (Prospector, MyPy, Bandit)
|
|
163
|
+
make lint
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Contributions make the open source community an amazing place to learn, inspire, and create.
|
|
171
|
+
|
|
172
|
+
1. Fork the Project
|
|
173
|
+
2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
|
|
174
|
+
3. Commit your Changes (git commit -m 'feat: add AmazingFeature')
|
|
175
|
+
4. Push to the Branch (git push origin feature/AmazingFeature)
|
|
176
|
+
5. Open a Pull Request
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
Distributed under the MIT License. See LICENSE for more information.
|
|
183
|
+
|
|
184
|
+
[🔝 Back to top](#table-of-contents)
|
|
185
|
+
|
|
186
|
+
<p align="center">
|
|
187
|
+
<i>Built for agents. Driven by humans.</i>
|
|
188
|
+
</p>
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-coderag
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: 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.
|
|
5
|
+
Author-email: Igor Boloban <naranor@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/naranor/agent-coderag
|
|
8
|
+
Project-URL: Repository, https://github.com/naranor/agent-coderag
|
|
9
|
+
Project-URL: Issues, https://github.com/naranor/agent-coderag/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/naranor/agent-coderag/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: rag,ai-agents,semantic-search,code-analysis,context-compression,onnx,local-embeddings
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: NOTICE
|
|
25
|
+
Requires-Dist: duckdb
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: litellm
|
|
28
|
+
Requires-Dist: onnxruntime
|
|
29
|
+
Requires-Dist: tokenizers
|
|
30
|
+
Requires-Dist: pydantic
|
|
31
|
+
Requires-Dist: httpx
|
|
32
|
+
Requires-Dist: aiofiles
|
|
33
|
+
Requires-Dist: pathspec
|
|
34
|
+
Requires-Dist: tree-sitter
|
|
35
|
+
Requires-Dist: dnfile
|
|
36
|
+
Requires-Dist: defusedxml
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
41
|
+
Requires-Dist: prospector[with_bandit,with_mypy,with_vulture]; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff; extra == "dev"
|
|
43
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# agent-coderag
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="assets/banner.svg" alt="agent-coderag Logo" width="100%">
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<b>The API Knowledge Bridge for AI Coding Agents.</b><br>
|
|
54
|
+
Local, fast, and token-efficient semantic search that eliminates LLM hallucinations by providing real-time local context.
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<a href="https://github.com/naranor/agent-coderag/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/naranor/agent-coderag/ci.yml?branch=main&style=for-the-badge&logo=github&label=CI" alt="Build Status"></a>
|
|
59
|
+
<a href="https://pypi.org/project/agent-coderag/"><img src="https://img.shields.io/pypi/v/agent-coderag?style=for-the-badge&logo=python&color=blue" alt="PyPI Version"></a>
|
|
60
|
+
<a href="https://github.com/naranor/agent-coderag/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-orange?style=for-the-badge" alt="License"></a>
|
|
61
|
+
<a href="https://codecov.io/gh/naranor/agent-coderag"><img src="https://img.shields.io/codecov/c/github/naranor/agent-coderag?style=for-the-badge&logo=codecov" alt="Test Coverage"></a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<a href="#key-features">Features</a> •
|
|
66
|
+
<a href="#quick-start">Quick Start</a> •
|
|
67
|
+
<a href="#how-it-works">Architecture</a> •
|
|
68
|
+
<a href="#agent-native-usage">AI Agent Guide</a> •
|
|
69
|
+
<a href="#contributing">Contributing</a>
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Why agent-coderag?
|
|
75
|
+
|
|
76
|
+
In 2026, AI coding agents are limited by stale training data. They hallucinate library calls because they don't know your specific environment.
|
|
77
|
+
|
|
78
|
+
* **The Pain:** Your agent writes code for Pydantic v1 while you have v2 installed. You waste 5000+ tokens in a "Fail-Fix-Fail" loop.
|
|
79
|
+
* **The Cure:** agent-coderag extracts live API signatures and technical intent from your local environment. It feeds the LLM exactly what it needs to see—no more, no less.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Key Features
|
|
84
|
+
|
|
85
|
+
- **Instant Startup:** Built on onnxruntime and Rust-based tokenizers. Zero PyTorch overhead.
|
|
86
|
+
- **Context Compression:** Replace 10,000 lines of raw code with a 200-token semantic summary.
|
|
87
|
+
- **Universal Tree-Sitter Parser:** Supports 25+ languages (Python, JS/TS, Rust, Java, C++, Go, Ruby, etc.) with high precision.
|
|
88
|
+
- **API Discovery:** On-the-fly extraction of public signatures for 6 core ecosystems (Python, Java, Go, TypeScript, Rust, C#) with build-system awareness.
|
|
89
|
+
- **Local First:** All embeddings and data stay on your machine in a high-performance DuckDB VSS index.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
### Installation
|
|
96
|
+
```bash
|
|
97
|
+
pip install agent-coderag
|
|
98
|
+
# Install tree-sitter grammars for your languages on-demand
|
|
99
|
+
pip install tree-sitter-python tree-sitter-javascript
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Initial Setup
|
|
103
|
+
```bash
|
|
104
|
+
# Download pre-trained multilingual embedding models (~130MB)
|
|
105
|
+
agent-coderag setup
|
|
106
|
+
|
|
107
|
+
# (Optional) Connect your preferred LLM for semantic distillation
|
|
108
|
+
# Using Ollama (Local)
|
|
109
|
+
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder"
|
|
110
|
+
|
|
111
|
+
# Using OpenAI-compatible API (e.g. Groq, OpenRouter, DeepSeek)
|
|
112
|
+
agent-coderag config --url "https://api.deepseek.com" --key "your-api-key" --model "deepseek-chat"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Offline Mode (No Provider)
|
|
116
|
+
If you don't configure an LLM provider, agent-coderag works in **100% Offline Mode**:
|
|
117
|
+
- **Parsing & API Discovery:** Still works perfectly using local Tree-Sitter grammars and javap.
|
|
118
|
+
- **Search:** Remains fast and accurate.
|
|
119
|
+
- **Distillation:** Instead of AI-generated summaries, the system uses code signatures and entity names as fallback metadata. No data ever leaves your machine.
|
|
120
|
+
|
|
121
|
+
### First Sync & Search
|
|
122
|
+
```bash
|
|
123
|
+
# Index your entire project (respects .gitignore automatically)
|
|
124
|
+
agent-coderag sync --all
|
|
125
|
+
|
|
126
|
+
# Perform a semantic search
|
|
127
|
+
agent-coderag search "how does the authentication middleware work?"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### API Discovery
|
|
131
|
+
Verify external library signatures without leaving the CLI:
|
|
132
|
+
```bash
|
|
133
|
+
# Explicit language selection (Recommended for multi-language repos)
|
|
134
|
+
agent-coderag api requests --lang python
|
|
135
|
+
agent-coderag api lodash --lang typescript
|
|
136
|
+
agent-coderag api serde --lang rust
|
|
137
|
+
|
|
138
|
+
# Built-in auto-detection for common project types (Cargo.toml, package.json, etc.)
|
|
139
|
+
agent-coderag api fmt
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Supported Ecosystems (Discovery)
|
|
145
|
+
|
|
146
|
+
| Language | Method | Discovery Source |
|
|
147
|
+
| :--- | :--- | :--- |
|
|
148
|
+
| **Python** | 3-Stage Probe | `.pyi` stubs, static source, or runtime `inspect` |
|
|
149
|
+
| **Java** | Bytecode Reflection | JARs resolved via Maven (`pom.xml`) or Gradle |
|
|
150
|
+
| **Go** | Standard Tooling | Native `go doc -all` integration |
|
|
151
|
+
| **TypeScript/JS** | Declaration Maps | `.d.ts` files from `node_modules` or `@types` |
|
|
152
|
+
| **Rust** | Registry Analysis | Source code from Cargo registry via `cargo metadata` |
|
|
153
|
+
| **C#** | Assembly Metadata | DLL metadata via `dnfile` and XML documentation |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## How It Works
|
|
158
|
+
|
|
159
|
+
agent-coderag creates a semantic map of your codebase using a multi-stage pipeline:
|
|
160
|
+
|
|
161
|
+
```mermaid
|
|
162
|
+
graph LR
|
|
163
|
+
Code[Local Codebase] --> Parser[Multi-Language Parser]
|
|
164
|
+
Parser --> Delta[Delta-Sync SHA-256]
|
|
165
|
+
Delta -- New/Changed --> Distill[LLM Distiller]
|
|
166
|
+
Delta -- Unchanged --> Cache[Local Cache]
|
|
167
|
+
Distill --> Embed[ONNX Embedder]
|
|
168
|
+
Cache --> Embed
|
|
169
|
+
Embed --> DuckDB[(DuckDB VSS)]
|
|
170
|
+
DuckDB --> Agent[AI Agent Response]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
1. **Structural Parsing:** Identifies classes, methods, and relations (imports).
|
|
174
|
+
2. **Technical Distillation:** Generates a concise "intent summary" of each code unit.
|
|
175
|
+
3. **Vectorization:** Local ONNX model creates 384-dimensional embeddings.
|
|
176
|
+
4. **VSS Storage:** DuckDB enables sub-millisecond similarity search.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Agent-Native Usage
|
|
181
|
+
|
|
182
|
+
agent-coderag is designed to be the primary tool for your AI agents.
|
|
183
|
+
|
|
184
|
+
### The Protocol:
|
|
185
|
+
1. **Search First:** Instead of reading files, the agent runs agent-coderag --json search.
|
|
186
|
+
2. **Verify Signatures:** The agent runs agent-coderag api <lib> to get real signatures.
|
|
187
|
+
3. **Read Summaries:** The agent uses the summary field to decide which files are actually relevant.
|
|
188
|
+
|
|
189
|
+
**Programmatic Output:**
|
|
190
|
+
```bash
|
|
191
|
+
agent-coderag --json search "database init" --limit 1
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Development & Testing
|
|
197
|
+
|
|
198
|
+
We maintain a strict quality bar.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Install development dependencies
|
|
202
|
+
make install
|
|
203
|
+
|
|
204
|
+
# Run full test suite with coverage
|
|
205
|
+
make test
|
|
206
|
+
|
|
207
|
+
# Run linters (Prospector, MyPy, Bandit)
|
|
208
|
+
make lint
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
Contributions make the open source community an amazing place to learn, inspire, and create.
|
|
216
|
+
|
|
217
|
+
1. Fork the Project
|
|
218
|
+
2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
|
|
219
|
+
3. Commit your Changes (git commit -m 'feat: add AmazingFeature')
|
|
220
|
+
4. Push to the Branch (git push origin feature/AmazingFeature)
|
|
221
|
+
5. Open a Pull Request
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
Distributed under the MIT License. See LICENSE for more information.
|
|
228
|
+
|
|
229
|
+
[🔝 Back to top](#table-of-contents)
|
|
230
|
+
|
|
231
|
+
<p align="center">
|
|
232
|
+
<i>Built for agents. Driven by humans.</i>
|
|
233
|
+
</p>
|