agent-coderag 1.1.0__tar.gz → 1.2.1__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.
Files changed (46) hide show
  1. agent_coderag-1.2.1/PKG-INFO +207 -0
  2. agent_coderag-1.2.1/README.md +171 -0
  3. agent_coderag-1.2.1/agent_coderag.egg-info/PKG-INFO +207 -0
  4. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/SOURCES.txt +11 -1
  5. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/requires.txt +2 -0
  6. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/core/interfaces.py +9 -1
  7. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/core/manager.py +10 -8
  8. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/core/models.py +7 -6
  9. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/discovery/dependency.py +12 -3
  10. agent_coderag-1.2.1/code_rag/discovery/java_discovery.py +100 -0
  11. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/entry/cli.py +49 -17
  12. agent_coderag-1.2.1/code_rag/parsers/ast_index.py +121 -0
  13. agent_coderag-1.2.1/code_rag/parsers/java_parser.py +144 -0
  14. agent_coderag-1.2.1/code_rag/parsers/multi_parser.py +39 -0
  15. agent_coderag-1.2.1/code_rag/storage/duckdb_impl.py +155 -0
  16. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/pyproject.toml +3 -1
  17. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/tests/test_ast_parser.py +0 -1
  18. agent_coderag-1.2.1/tests/test_cli.py +285 -0
  19. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/tests/test_code_rag_simple.py +2 -5
  20. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/tests/test_dependency_discovery.py +6 -9
  21. agent_coderag-1.2.1/tests/test_distiller.py +95 -0
  22. agent_coderag-1.2.1/tests/test_embedder.py +59 -0
  23. agent_coderag-1.2.1/tests/test_interfaces.py +83 -0
  24. agent_coderag-1.2.1/tests/test_java_parser.py +60 -0
  25. agent_coderag-1.2.1/tests/test_multi_parser.py +30 -0
  26. agent_coderag-1.2.1/tests/test_parsers.py +42 -0
  27. agent_coderag-1.1.0/PKG-INFO +0 -188
  28. agent_coderag-1.1.0/README.md +0 -154
  29. agent_coderag-1.1.0/agent_coderag.egg-info/PKG-INFO +0 -188
  30. agent_coderag-1.1.0/code_rag/parsers/ast_index.py +0 -81
  31. agent_coderag-1.1.0/code_rag/storage/duckdb_impl.py +0 -111
  32. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/LICENSE +0 -0
  33. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/NOTICE +0 -0
  34. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/dependency_links.txt +0 -0
  35. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/entry_points.txt +0 -0
  36. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/agent_coderag.egg-info/top_level.txt +0 -0
  37. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/__init__.py +0 -0
  38. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/core/__init__.py +0 -0
  39. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/discovery/__init__.py +0 -0
  40. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/entry/__init__.py +0 -0
  41. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/intelligence/__init__.py +0 -0
  42. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/intelligence/distiller.py +0 -0
  43. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/intelligence/embedder.py +0 -0
  44. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/parsers/__init__.py +0 -0
  45. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/code_rag/storage/__init__.py +0 -0
  46. {agent_coderag-1.1.0 → agent_coderag-1.2.1}/setup.cfg +0 -0
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-coderag
3
+ Version: 1.2.1
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: javalang
34
+ Requires-Dist: pathspec
35
+ Dynamic: license-file
36
+
37
+ # Agent-CodeRAG
38
+
39
+ <p align="center">
40
+ <img src="https://raw.githubusercontent.com/naranor/agent-coderag/main/assets/banner.svg" alt="Agent-CodeRAG Banner" width="400">
41
+ </p>
42
+
43
+ > **Fast. Local. Agent-First. Token-Efficient.** Bridge the gap between AI coding agents and your local environment.
44
+
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
47
+ [![PyPI Version](https://img.shields.io/pypi/v/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
48
+ [![Downloads](https://img.shields.io/pypi/dm/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
49
+ [![Tests](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml/badge.svg)](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml)
50
+ [![Coverage](https://img.shields.io/badge/coverage-81%25-green)](https://github.com/naranor/agent-coderag/actions)
51
+
52
+ ---
53
+
54
+ ## Table of Contents
55
+
56
+ - [Why Agent-CodeRAG?](#why-agent-coderag)
57
+ - [Quick Start](#quick-start)
58
+ - [Features](#-features)
59
+ - [How It Works](#-how-it-works)
60
+ - [API Discovery](#-api-discovery)
61
+ - [For AI Agents](#-for-ai-agents)
62
+ - [Development](#-development)
63
+ - [Contributing](#-contributing)
64
+ - [License](#-license)
65
+
66
+ ---
67
+
68
+ ## Why Agent-CodeRAG?
69
+
70
+ 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.
71
+
72
+ **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.
73
+
74
+ **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**.
75
+
76
+ [🔝 Back to top](#table-of-contents)
77
+
78
+ ---
79
+
80
+ ## Quick Start
81
+
82
+ ```bash
83
+ # 1. Install
84
+ pip install agent-coderag
85
+
86
+ # 2. Setup (download ONNX model)
87
+ agent-coderag setup
88
+
89
+ # 3. Configure LLM (optional, for AI distillation)
90
+ agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"
91
+
92
+ # 4. Index your project
93
+ agent-coderag sync --all
94
+
95
+ # 5. Search
96
+ agent-coderag search "how to handle errors"
97
+ ```
98
+
99
+ **Docker:**
100
+ ```bash
101
+ docker build -t agent-coderag .
102
+ docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup
103
+ ```
104
+
105
+ [🔝 Back to top](#table-of-contents)
106
+
107
+ ---
108
+
109
+ ## ✨ Features
110
+
111
+ - **⚡ No PyTorch** — Uses `onnxruntime` and `tokenizers` (Rust) for instant startup
112
+ - **💾 DuckDB VSS** — High-performance vector search in a single local file
113
+ - **🏗️ Multi-Language** — Native indexing for Python (AST) and Java (javalang)
114
+ - **🔄 Delta-Sync** — SHA-256 hashing re-distills only changed code
115
+ - **🔌 Hybrid Intelligence** — Works offline; adds AI-distilled reasoning when LLM is connected
116
+ - **📡 API Discovery** — Extract live API signatures from Python modules or Java JARs
117
+
118
+ [🔝 Back to top](#table-of-contents)
119
+
120
+ ---
121
+
122
+ ## 🛠 How It Works
123
+
124
+ ```mermaid
125
+ graph TD
126
+ A[Local Python Code] --> B[AST Parser]
127
+ B --> C{Delta-Sync}
128
+ C -- Changed/New --> D[LLM Distiller]
129
+ C -- Unchanged --> E[Local Cache]
130
+ D --> F[Semantic Summary]
131
+ E --> F
132
+ F --> G[ONNX Embedder]
133
+ G --> H[(DuckDB VSS)]
134
+ H --> I[Semantic Search / JSON API]
135
+ ```
136
+
137
+ 1. **AST Parser** — Parses your Python code
138
+ 2. **Delta-Sync** — Uses SHA-256 to detect changes
139
+ 3. **LLM Distiller** — Generates semantic summaries (optional)
140
+ 4. **ONNX Embedder** — Creates embeddings locally
141
+ 5. **DuckDB VSS** — Stores vectors for fast similarity search
142
+
143
+ [🔝 Back to top](#table-of-contents)
144
+
145
+ ---
146
+
147
+ ## 📡 API Discovery
148
+
149
+ ```bash
150
+ agent-coderag api pydantic
151
+ ```
152
+
153
+ Returns the *live* public API, methods, and signatures for any installed library.
154
+
155
+ [🔝 Back to top](#table-of-contents)
156
+
157
+ ---
158
+
159
+ ## 🤖 For AI Agents
160
+
161
+ Agent-CodeRAG is built for programmatic consumption:
162
+
163
+ 1. **Search First**: `agent-coderag --json search "topic" --limit 1`
164
+ 2. **Use Intent**: The `summary` field provides technical intent — skip reading unnecessary files
165
+
166
+ [🔝 Back to top](#table-of-contents)
167
+
168
+ ---
169
+
170
+ ## 🔧 Development
171
+
172
+ ```bash
173
+ # Run tests
174
+ pytest tests/
175
+ pytest e2e_tests/
176
+
177
+ # Setup pre-commit hooks
178
+ pip install pre-commit
179
+ pre-commit install
180
+ ```
181
+
182
+ [🔝 Back to top](#table-of-contents)
183
+
184
+ ---
185
+
186
+ ## 🤝 Contributing
187
+
188
+ Contributions are welcome! Here's how to get started:
189
+
190
+ 1. **Fork** the repository
191
+ 2. **Clone** your fork: `git clone https://github.com/YOUR_USERNAME/agent-coderag.git`
192
+ 3. **Create a branch**: `git checkout -b feature/your-feature`
193
+ 4. **Make changes** and commit with [Conventional Commits](https://www.conventionalcommits.org/)
194
+ 5. **Run tests**: `pytest tests/`
195
+ 6. **Push** to your fork and create a **Pull Request**
196
+
197
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
198
+
199
+ [🔝 Back to top](#table-of-contents)
200
+
201
+ ---
202
+
203
+ ## 📄 License
204
+
205
+ MIT © 2026 [Igor Boloban](https://github.com/naranor)
206
+
207
+ [🔝 Back to top](#table-of-contents)
@@ -0,0 +1,171 @@
1
+ # Agent-CodeRAG
2
+
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/naranor/agent-coderag/main/assets/banner.svg" alt="Agent-CodeRAG Banner" width="400">
5
+ </p>
6
+
7
+ > **Fast. Local. Agent-First. Token-Efficient.** Bridge the gap between AI coding agents and your local environment.
8
+
9
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
11
+ [![PyPI Version](https://img.shields.io/pypi/v/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
12
+ [![Downloads](https://img.shields.io/pypi/dm/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
13
+ [![Tests](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml/badge.svg)](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml)
14
+ [![Coverage](https://img.shields.io/badge/coverage-81%25-green)](https://github.com/naranor/agent-coderag/actions)
15
+
16
+ ---
17
+
18
+ ## Table of Contents
19
+
20
+ - [Why Agent-CodeRAG?](#why-agent-coderag)
21
+ - [Quick Start](#quick-start)
22
+ - [Features](#-features)
23
+ - [How It Works](#-how-it-works)
24
+ - [API Discovery](#-api-discovery)
25
+ - [For AI Agents](#-for-ai-agents)
26
+ - [Development](#-development)
27
+ - [Contributing](#-contributing)
28
+ - [License](#-license)
29
+
30
+ ---
31
+
32
+ ## Why Agent-CodeRAG?
33
+
34
+ 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.
35
+
36
+ **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.
37
+
38
+ **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**.
39
+
40
+ [🔝 Back to top](#table-of-contents)
41
+
42
+ ---
43
+
44
+ ## Quick Start
45
+
46
+ ```bash
47
+ # 1. Install
48
+ pip install agent-coderag
49
+
50
+ # 2. Setup (download ONNX model)
51
+ agent-coderag setup
52
+
53
+ # 3. Configure LLM (optional, for AI distillation)
54
+ agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"
55
+
56
+ # 4. Index your project
57
+ agent-coderag sync --all
58
+
59
+ # 5. Search
60
+ agent-coderag search "how to handle errors"
61
+ ```
62
+
63
+ **Docker:**
64
+ ```bash
65
+ docker build -t agent-coderag .
66
+ docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup
67
+ ```
68
+
69
+ [🔝 Back to top](#table-of-contents)
70
+
71
+ ---
72
+
73
+ ## ✨ Features
74
+
75
+ - **⚡ No PyTorch** — Uses `onnxruntime` and `tokenizers` (Rust) for instant startup
76
+ - **💾 DuckDB VSS** — High-performance vector search in a single local file
77
+ - **🏗️ Multi-Language** — Native indexing for Python (AST) and Java (javalang)
78
+ - **🔄 Delta-Sync** — SHA-256 hashing re-distills only changed code
79
+ - **🔌 Hybrid Intelligence** — Works offline; adds AI-distilled reasoning when LLM is connected
80
+ - **📡 API Discovery** — Extract live API signatures from Python modules or Java JARs
81
+
82
+ [🔝 Back to top](#table-of-contents)
83
+
84
+ ---
85
+
86
+ ## 🛠 How It Works
87
+
88
+ ```mermaid
89
+ graph TD
90
+ A[Local Python Code] --> B[AST Parser]
91
+ B --> C{Delta-Sync}
92
+ C -- Changed/New --> D[LLM Distiller]
93
+ C -- Unchanged --> E[Local Cache]
94
+ D --> F[Semantic Summary]
95
+ E --> F
96
+ F --> G[ONNX Embedder]
97
+ G --> H[(DuckDB VSS)]
98
+ H --> I[Semantic Search / JSON API]
99
+ ```
100
+
101
+ 1. **AST Parser** — Parses your Python code
102
+ 2. **Delta-Sync** — Uses SHA-256 to detect changes
103
+ 3. **LLM Distiller** — Generates semantic summaries (optional)
104
+ 4. **ONNX Embedder** — Creates embeddings locally
105
+ 5. **DuckDB VSS** — Stores vectors for fast similarity search
106
+
107
+ [🔝 Back to top](#table-of-contents)
108
+
109
+ ---
110
+
111
+ ## 📡 API Discovery
112
+
113
+ ```bash
114
+ agent-coderag api pydantic
115
+ ```
116
+
117
+ Returns the *live* public API, methods, and signatures for any installed library.
118
+
119
+ [🔝 Back to top](#table-of-contents)
120
+
121
+ ---
122
+
123
+ ## 🤖 For AI Agents
124
+
125
+ Agent-CodeRAG is built for programmatic consumption:
126
+
127
+ 1. **Search First**: `agent-coderag --json search "topic" --limit 1`
128
+ 2. **Use Intent**: The `summary` field provides technical intent — skip reading unnecessary files
129
+
130
+ [🔝 Back to top](#table-of-contents)
131
+
132
+ ---
133
+
134
+ ## 🔧 Development
135
+
136
+ ```bash
137
+ # Run tests
138
+ pytest tests/
139
+ pytest e2e_tests/
140
+
141
+ # Setup pre-commit hooks
142
+ pip install pre-commit
143
+ pre-commit install
144
+ ```
145
+
146
+ [🔝 Back to top](#table-of-contents)
147
+
148
+ ---
149
+
150
+ ## 🤝 Contributing
151
+
152
+ Contributions are welcome! Here's how to get started:
153
+
154
+ 1. **Fork** the repository
155
+ 2. **Clone** your fork: `git clone https://github.com/YOUR_USERNAME/agent-coderag.git`
156
+ 3. **Create a branch**: `git checkout -b feature/your-feature`
157
+ 4. **Make changes** and commit with [Conventional Commits](https://www.conventionalcommits.org/)
158
+ 5. **Run tests**: `pytest tests/`
159
+ 6. **Push** to your fork and create a **Pull Request**
160
+
161
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
162
+
163
+ [🔝 Back to top](#table-of-contents)
164
+
165
+ ---
166
+
167
+ ## 📄 License
168
+
169
+ MIT © 2026 [Igor Boloban](https://github.com/naranor)
170
+
171
+ [🔝 Back to top](#table-of-contents)
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-coderag
3
+ Version: 1.2.1
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: javalang
34
+ Requires-Dist: pathspec
35
+ Dynamic: license-file
36
+
37
+ # Agent-CodeRAG
38
+
39
+ <p align="center">
40
+ <img src="https://raw.githubusercontent.com/naranor/agent-coderag/main/assets/banner.svg" alt="Agent-CodeRAG Banner" width="400">
41
+ </p>
42
+
43
+ > **Fast. Local. Agent-First. Token-Efficient.** Bridge the gap between AI coding agents and your local environment.
44
+
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
47
+ [![PyPI Version](https://img.shields.io/pypi/v/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
48
+ [![Downloads](https://img.shields.io/pypi/dm/agent-coderag.svg)](https://pypi.org/project/agent-coderag/)
49
+ [![Tests](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml/badge.svg)](https://github.com/naranor/agent-coderag/actions/workflows/ci.yml)
50
+ [![Coverage](https://img.shields.io/badge/coverage-81%25-green)](https://github.com/naranor/agent-coderag/actions)
51
+
52
+ ---
53
+
54
+ ## Table of Contents
55
+
56
+ - [Why Agent-CodeRAG?](#why-agent-coderag)
57
+ - [Quick Start](#quick-start)
58
+ - [Features](#-features)
59
+ - [How It Works](#-how-it-works)
60
+ - [API Discovery](#-api-discovery)
61
+ - [For AI Agents](#-for-ai-agents)
62
+ - [Development](#-development)
63
+ - [Contributing](#-contributing)
64
+ - [License](#-license)
65
+
66
+ ---
67
+
68
+ ## Why Agent-CodeRAG?
69
+
70
+ 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.
71
+
72
+ **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.
73
+
74
+ **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**.
75
+
76
+ [🔝 Back to top](#table-of-contents)
77
+
78
+ ---
79
+
80
+ ## Quick Start
81
+
82
+ ```bash
83
+ # 1. Install
84
+ pip install agent-coderag
85
+
86
+ # 2. Setup (download ONNX model)
87
+ agent-coderag setup
88
+
89
+ # 3. Configure LLM (optional, for AI distillation)
90
+ agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"
91
+
92
+ # 4. Index your project
93
+ agent-coderag sync --all
94
+
95
+ # 5. Search
96
+ agent-coderag search "how to handle errors"
97
+ ```
98
+
99
+ **Docker:**
100
+ ```bash
101
+ docker build -t agent-coderag .
102
+ docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup
103
+ ```
104
+
105
+ [🔝 Back to top](#table-of-contents)
106
+
107
+ ---
108
+
109
+ ## ✨ Features
110
+
111
+ - **⚡ No PyTorch** — Uses `onnxruntime` and `tokenizers` (Rust) for instant startup
112
+ - **💾 DuckDB VSS** — High-performance vector search in a single local file
113
+ - **🏗️ Multi-Language** — Native indexing for Python (AST) and Java (javalang)
114
+ - **🔄 Delta-Sync** — SHA-256 hashing re-distills only changed code
115
+ - **🔌 Hybrid Intelligence** — Works offline; adds AI-distilled reasoning when LLM is connected
116
+ - **📡 API Discovery** — Extract live API signatures from Python modules or Java JARs
117
+
118
+ [🔝 Back to top](#table-of-contents)
119
+
120
+ ---
121
+
122
+ ## 🛠 How It Works
123
+
124
+ ```mermaid
125
+ graph TD
126
+ A[Local Python Code] --> B[AST Parser]
127
+ B --> C{Delta-Sync}
128
+ C -- Changed/New --> D[LLM Distiller]
129
+ C -- Unchanged --> E[Local Cache]
130
+ D --> F[Semantic Summary]
131
+ E --> F
132
+ F --> G[ONNX Embedder]
133
+ G --> H[(DuckDB VSS)]
134
+ H --> I[Semantic Search / JSON API]
135
+ ```
136
+
137
+ 1. **AST Parser** — Parses your Python code
138
+ 2. **Delta-Sync** — Uses SHA-256 to detect changes
139
+ 3. **LLM Distiller** — Generates semantic summaries (optional)
140
+ 4. **ONNX Embedder** — Creates embeddings locally
141
+ 5. **DuckDB VSS** — Stores vectors for fast similarity search
142
+
143
+ [🔝 Back to top](#table-of-contents)
144
+
145
+ ---
146
+
147
+ ## 📡 API Discovery
148
+
149
+ ```bash
150
+ agent-coderag api pydantic
151
+ ```
152
+
153
+ Returns the *live* public API, methods, and signatures for any installed library.
154
+
155
+ [🔝 Back to top](#table-of-contents)
156
+
157
+ ---
158
+
159
+ ## 🤖 For AI Agents
160
+
161
+ Agent-CodeRAG is built for programmatic consumption:
162
+
163
+ 1. **Search First**: `agent-coderag --json search "topic" --limit 1`
164
+ 2. **Use Intent**: The `summary` field provides technical intent — skip reading unnecessary files
165
+
166
+ [🔝 Back to top](#table-of-contents)
167
+
168
+ ---
169
+
170
+ ## 🔧 Development
171
+
172
+ ```bash
173
+ # Run tests
174
+ pytest tests/
175
+ pytest e2e_tests/
176
+
177
+ # Setup pre-commit hooks
178
+ pip install pre-commit
179
+ pre-commit install
180
+ ```
181
+
182
+ [🔝 Back to top](#table-of-contents)
183
+
184
+ ---
185
+
186
+ ## 🤝 Contributing
187
+
188
+ Contributions are welcome! Here's how to get started:
189
+
190
+ 1. **Fork** the repository
191
+ 2. **Clone** your fork: `git clone https://github.com/YOUR_USERNAME/agent-coderag.git`
192
+ 3. **Create a branch**: `git checkout -b feature/your-feature`
193
+ 4. **Make changes** and commit with [Conventional Commits](https://www.conventionalcommits.org/)
194
+ 5. **Run tests**: `pytest tests/`
195
+ 6. **Push** to your fork and create a **Pull Request**
196
+
197
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
198
+
199
+ [🔝 Back to top](#table-of-contents)
200
+
201
+ ---
202
+
203
+ ## 📄 License
204
+
205
+ MIT © 2026 [Igor Boloban](https://github.com/naranor)
206
+
207
+ [🔝 Back to top](#table-of-contents)
@@ -15,6 +15,7 @@ code_rag/core/manager.py
15
15
  code_rag/core/models.py
16
16
  code_rag/discovery/__init__.py
17
17
  code_rag/discovery/dependency.py
18
+ code_rag/discovery/java_discovery.py
18
19
  code_rag/entry/__init__.py
19
20
  code_rag/entry/cli.py
20
21
  code_rag/intelligence/__init__.py
@@ -22,8 +23,17 @@ code_rag/intelligence/distiller.py
22
23
  code_rag/intelligence/embedder.py
23
24
  code_rag/parsers/__init__.py
24
25
  code_rag/parsers/ast_index.py
26
+ code_rag/parsers/java_parser.py
27
+ code_rag/parsers/multi_parser.py
25
28
  code_rag/storage/__init__.py
26
29
  code_rag/storage/duckdb_impl.py
27
30
  tests/test_ast_parser.py
31
+ tests/test_cli.py
28
32
  tests/test_code_rag_simple.py
29
- tests/test_dependency_discovery.py
33
+ tests/test_dependency_discovery.py
34
+ tests/test_distiller.py
35
+ tests/test_embedder.py
36
+ tests/test_interfaces.py
37
+ tests/test_java_parser.py
38
+ tests/test_multi_parser.py
39
+ tests/test_parsers.py
@@ -6,3 +6,5 @@ tokenizers
6
6
  pydantic
7
7
  httpx
8
8
  aiofiles
9
+ javalang
10
+ pathspec
@@ -1,6 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from typing import List, Optional
3
- from .models import KnowledgeUnit
3
+ from .models import KnowledgeUnit, Relation
4
4
 
5
5
  class IParser(ABC):
6
6
  """Interface for extracting structure from code."""
@@ -22,6 +22,14 @@ class IStorage(ABC):
22
22
  async def search_units(self, query: str, limit: int = 5) -> List[KnowledgeUnit]:
23
23
  pass
24
24
 
25
+ @abstractmethod
26
+ async def upsert_relation(self, relation: Relation):
27
+ pass
28
+
29
+ @abstractmethod
30
+ async def get_relations(self, unit_id: str, direction: str = "out") -> List[Relation]:
31
+ pass
32
+
25
33
  class IIntelligence(ABC):
26
34
  """Interface for LLM-based analysis (distillation, embeddings)."""
27
35
  @abstractmethod
@@ -11,10 +11,11 @@ class CodeRAGManager:
11
11
  Orchestrates the RAG workflow: parsing, distillation, and storage.
12
12
  """
13
13
 
14
- def __init__(self, storage: IStorage, parser: IParser, intelligence: IIntelligence):
14
+ def __init__(self, storage: IStorage, parser: IParser, intelligence: IIntelligence, max_concurrency: int = 10):
15
15
  self.storage = storage
16
16
  self.parser = parser
17
17
  self.intelligence = intelligence
18
+ self.semaphore = asyncio.Semaphore(max_concurrency)
18
19
 
19
20
  async def sync_file(self, file_path: str, force_distill: bool = False):
20
21
  """
@@ -42,13 +43,14 @@ class CodeRAGManager:
42
43
  logger.info("Summary missing for %s", unit.name)
43
44
 
44
45
  if should_distill:
45
- logger.info("Distilling summary for %s...", unit.id)
46
- try:
47
- unit.summary = await self.intelligence.summarize(raw_code, unit.name)
48
- except Exception as e:
49
- logger.error("Failed to distill %s: %s", unit.name, e)
50
- # Keep old summary if available, otherwise stay None
51
- unit.summary = existing_unit.summary if existing_unit else None
46
+ async with self.semaphore:
47
+ logger.info("Distilling summary for %s...", unit.id)
48
+ try:
49
+ unit.summary = await self.intelligence.summarize(raw_code, unit.name)
50
+ except Exception as e:
51
+ logger.error("Failed to distill %s: %s", unit.name, e)
52
+ # Keep old summary if available, otherwise stay None
53
+ unit.summary = existing_unit.summary if existing_unit else None
52
54
  else:
53
55
  # Reuse existing summary if code hasn't changed
54
56
  unit.summary = existing_unit.summary if existing_unit else None