neurocode-ai 0.1.0__tar.gz → 1.2.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.
- {neurocode_ai-0.1.0/neurocode_ai.egg-info → neurocode_ai-1.2.0}/PKG-INFO +43 -19
- neurocode_ai-0.1.0/PKG-INFO → neurocode_ai-1.2.0/README.md +39 -34
- neurocode_ai-0.1.0/README.md → neurocode_ai-1.2.0/neurocode_ai.egg-info/PKG-INFO +58 -17
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/neurocode_ai.egg-info/SOURCES.txt +5 -1
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/neurocode_ai.egg-info/requires.txt +2 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/pyproject.toml +4 -2
- neurocode_ai-1.2.0/src/agent/graft.py +241 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/cli.py +139 -12
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/graph/builder.py +9 -7
- neurocode_ai-1.2.0/src/graph/parser.py +339 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/graph/slicer.py +2 -0
- neurocode_ai-1.2.0/src/mcp_server.py +652 -0
- neurocode_ai-1.2.0/tests/test_graft.py +98 -0
- neurocode_ai-1.2.0/tests/test_mcp.py +73 -0
- neurocode_ai-1.2.0/tests/test_ts_js.py +58 -0
- neurocode_ai-0.1.0/src/graph/parser.py +0 -175
- neurocode_ai-0.1.0/src/mcp_server.py +0 -370
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/LICENSE +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/neurocode_ai.egg-info/dependency_links.txt +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/neurocode_ai.egg-info/entry_points.txt +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/neurocode_ai.egg-info/top_level.txt +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/setup.cfg +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/__init__.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/agent/llm_interface.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/agent/patcher.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/create_thumbnail.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/end_to_end_benchmark.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/evaluator.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/generate_4x3_figures.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/mlsys_microbenchmarks.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/plot_ablation.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/plot_architecture.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/plot_empirical_fig1.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_ablation_study.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_code_benchmarks.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_comprehensive_10_tests.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_dense_vector_rag_benchmark.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_ephemeral_swebench.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/run_hardware_cliff_test.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/benchmark/swebench_evaluator.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/src/graph/__init__.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/tests/test_graph.py +0 -0
- {neurocode_ai-0.1.0 → neurocode_ai-1.2.0}/tests/test_multi_hop.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: neurocode-ai
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Heterogeneous Code-Graph Slicing for On-Device Autonomous SWE Agents
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Heterogeneous Code-Graph Slicing & AST Subtree Grafting for On-Device Autonomous SWE Agents
|
|
5
5
|
Author: Deepak R.
|
|
6
6
|
License: MIT
|
|
7
7
|
Requires-Python: >=3.10
|
|
@@ -9,6 +9,8 @@ Description-Content-Type: text/markdown
|
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Dist: tree-sitter>=0.22.0
|
|
11
11
|
Requires-Dist: tree-sitter-python>=0.21.0
|
|
12
|
+
Requires-Dist: tree-sitter-javascript>=0.21.0
|
|
13
|
+
Requires-Dist: tree-sitter-typescript>=0.21.0
|
|
12
14
|
Requires-Dist: networkx>=3.0
|
|
13
15
|
Requires-Dist: datasets>=2.18.0
|
|
14
16
|
Requires-Dist: matplotlib>=3.8.0
|
|
@@ -17,12 +19,14 @@ Dynamic: license-file
|
|
|
17
19
|
|
|
18
20
|
# NeuroCode: Heterogeneous Code-Graph Slicing for On-Device Autonomous Software Engineering
|
|
19
21
|
|
|
22
|
+
[](https://pypi.org/project/neurocode-ai/)
|
|
23
|
+
[](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai)
|
|
24
|
+
[](https://glama.ai/mcp/servers/Arkz-Deepak/neurocode)
|
|
25
|
+
[](https://github.com/punkpeye/awesome-mcp-servers)
|
|
26
|
+
[](https://conf.researchr.org/home/icpc-2027)
|
|
20
27
|
[](https://opensource.org/licenses/MIT)
|
|
21
28
|
[](https://www.python.org/downloads/)
|
|
22
29
|
[]()
|
|
23
|
-
[](https://modelcontextprotocol.io)
|
|
24
|
-
[](https://ollama.ai)
|
|
25
|
-
[](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
26
30
|
|
|
27
31
|
**NeuroCode** is a lightweight, heterogeneous neuro-symbolic framework and **Model Context Protocol (MCP)** server that enables small, local language models (1.5B–14B parameters) to fix multi-file software engineering bugs on consumer laptops (e.g., 4GB–8GB VRAM) without cloud API dependency or Out-of-Memory (OOM) crashes.
|
|
28
32
|
|
|
@@ -51,11 +55,11 @@ NeuroCode was evaluated across 5 comprehensive benchmark tracks spanning real-wo
|
|
|
51
55
|
|
|
52
56
|
| Benchmark Suite | Metric | Baseline / BM25 | NeuroCode (Ours) | Advantage |
|
|
53
57
|
| :--- | :--- | :--- | :--- | :--- |
|
|
54
|
-
| **SWE-bench Lite** ($N=
|
|
55
|
-
| **HumanEval** ($N=164$) | Pass@1 | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
56
|
-
| **MBPP** ($N=100$) | Pass@1 | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
58
|
+
| **SWE-bench Lite** ($N=292$) | Valid Diff Apply / Resolved | 0.0% (OOM on 4GB) / 0.0% | **41.4% apply / 9.5% resolved** | Prevents OOM cliff; +23.9% apply over BM25 |
|
|
59
|
+
| **HumanEval** ($N=164$) | Pass@1 (Unit Test) | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
60
|
+
| **MBPP** ($N=100$) | Pass@1 (Unit Test) | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
57
61
|
| **RepoBench-R** ($N=150$) | Recall@1 / Token Budget | 18.0% (745 tokens) | **100.0%** (**428 tokens**) | **-42.6% tokens**, perfect cross-file retrieval |
|
|
58
|
-
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **
|
|
62
|
+
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **0.62 ms** | **93.2% VRAM reduction**, 0 OOMs |
|
|
59
63
|
|
|
60
64
|
### 💻 Physical Laptop Edge Validation (NVIDIA RTX 3050 Laptop GPU)
|
|
61
65
|
Tested live on an everyday developer laptop (AMD Ryzen 7 7435HS + NVIDIA RTX 3050 Laptop GPU, 4.0 GB VRAM):
|
|
@@ -124,16 +128,31 @@ Add to your `~/.continue/config.json`:
|
|
|
124
128
|
|
|
125
129
|
---
|
|
126
130
|
|
|
131
|
+
## 💻 Visual Studio Code Extension
|
|
132
|
+
|
|
133
|
+
Install directly from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
code --install-extension DeepakR.neurocode-ai
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
*(Or download the `.vsix` binary from the [v0.1.0 Release](https://github.com/Arkz-Deepak/neurocode/releases/tag/v0.1.0))*
|
|
140
|
+
|
|
141
|
+
### Extension Features:
|
|
142
|
+
- **Status Bar Telemetry**: Live VRAM headroom and `/dev/shm` RAM health indicators.
|
|
143
|
+
- **Context Slicing**: Right-click any active file or code block to extract sub-1,200 token reachability closure in $<100$ ms.
|
|
144
|
+
- **1-Click Prompt Copy**: Instant paste into Cursor, Claude, or Copilot without context overflow.
|
|
145
|
+
- **Autonomous Diff Viewer**: Direct side-by-side patch inspection powered by local Ollama backbones.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
127
149
|
## 🚀 Quickstart & CLI Usage
|
|
128
150
|
|
|
129
|
-
### 1. Installation
|
|
151
|
+
### 1. Installation via PyPI
|
|
130
152
|
```bash
|
|
131
|
-
|
|
132
|
-
cd neurocode
|
|
133
|
-
python3 -m venv .venv
|
|
134
|
-
source .venv/bin/activate
|
|
135
|
-
pip install -e .
|
|
153
|
+
pip install neurocode-ai
|
|
136
154
|
```
|
|
155
|
+
*(Or install locally from source: `git clone https://github.com/Arkz-Deepak/neurocode.git && cd neurocode && pip install -e .`)*
|
|
137
156
|
|
|
138
157
|
### 2. Extract Token-Bounded Slice for Any Issue
|
|
139
158
|
```bash
|
|
@@ -170,10 +189,15 @@ neurocode-copilot
|
|
|
170
189
|
|
|
171
190
|
## 📄 Publications & Preprints
|
|
172
191
|
|
|
173
|
-
- **IEEE
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
192
|
+
- **35th IEEE/ACM International Conference on Program Comprehension (ICPC 2027)**:
|
|
193
|
+
- *Track*: Tool Demonstration Track (Submission #63)
|
|
194
|
+
- *Title*: *NeuroCode: In-Memory Code Property Graph Slicing and Edge SWE Agent for Resource-Constrained Environments*
|
|
195
|
+
- *Source*: [`paper_icpc_tool_demo/neurocode_icpc_demo.tex`](paper_icpc_tool_demo/neurocode_icpc_demo.tex)
|
|
196
|
+
- **Journal of Systems and Software (Elsevier)**:
|
|
197
|
+
- *Track*: Full Research Article (Traditional Subscription, ₹0 APC)
|
|
198
|
+
- *Title*: *On-Device Autonomous Software Engineering: In-Memory Code Property Graph Reachability Slicing under Edge VRAM Constraints*
|
|
199
|
+
- *Source*: [`paper_elsevier_jss/neurocode_jss.tex`](paper_elsevier_jss/neurocode_jss.tex)
|
|
200
|
+
- **Kaggle Empirical Reproduction**: [Kaggle Notebook Live](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
177
201
|
|
|
178
202
|
### Citation
|
|
179
203
|
```bibtex
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: neurocode-ai
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Heterogeneous Code-Graph Slicing for On-Device Autonomous SWE Agents
|
|
5
|
-
Author: Deepak R.
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=3.10
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Requires-Dist: tree-sitter>=0.22.0
|
|
11
|
-
Requires-Dist: tree-sitter-python>=0.21.0
|
|
12
|
-
Requires-Dist: networkx>=3.0
|
|
13
|
-
Requires-Dist: datasets>=2.18.0
|
|
14
|
-
Requires-Dist: matplotlib>=3.8.0
|
|
15
|
-
Requires-Dist: transformers>=4.40.0
|
|
16
|
-
Dynamic: license-file
|
|
17
|
-
|
|
18
1
|
# NeuroCode: Heterogeneous Code-Graph Slicing for On-Device Autonomous Software Engineering
|
|
19
2
|
|
|
3
|
+
[](https://pypi.org/project/neurocode-ai/)
|
|
4
|
+
[](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai)
|
|
5
|
+
[](https://glama.ai/mcp/servers/Arkz-Deepak/neurocode)
|
|
6
|
+
[](https://github.com/punkpeye/awesome-mcp-servers)
|
|
7
|
+
[](https://conf.researchr.org/home/icpc-2027)
|
|
20
8
|
[](https://opensource.org/licenses/MIT)
|
|
21
9
|
[](https://www.python.org/downloads/)
|
|
22
10
|
[]()
|
|
23
|
-
[](https://modelcontextprotocol.io)
|
|
24
|
-
[](https://ollama.ai)
|
|
25
|
-
[](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
26
11
|
|
|
27
12
|
**NeuroCode** is a lightweight, heterogeneous neuro-symbolic framework and **Model Context Protocol (MCP)** server that enables small, local language models (1.5B–14B parameters) to fix multi-file software engineering bugs on consumer laptops (e.g., 4GB–8GB VRAM) without cloud API dependency or Out-of-Memory (OOM) crashes.
|
|
28
13
|
|
|
@@ -51,11 +36,11 @@ NeuroCode was evaluated across 5 comprehensive benchmark tracks spanning real-wo
|
|
|
51
36
|
|
|
52
37
|
| Benchmark Suite | Metric | Baseline / BM25 | NeuroCode (Ours) | Advantage |
|
|
53
38
|
| :--- | :--- | :--- | :--- | :--- |
|
|
54
|
-
| **SWE-bench Lite** ($N=
|
|
55
|
-
| **HumanEval** ($N=164$) | Pass@1 | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
56
|
-
| **MBPP** ($N=100$) | Pass@1 | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
39
|
+
| **SWE-bench Lite** ($N=292$) | Valid Diff Apply / Resolved | 0.0% (OOM on 4GB) / 0.0% | **41.4% apply / 9.5% resolved** | Prevents OOM cliff; +23.9% apply over BM25 |
|
|
40
|
+
| **HumanEval** ($N=164$) | Pass@1 (Unit Test) | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
41
|
+
| **MBPP** ($N=100$) | Pass@1 (Unit Test) | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
57
42
|
| **RepoBench-R** ($N=150$) | Recall@1 / Token Budget | 18.0% (745 tokens) | **100.0%** (**428 tokens**) | **-42.6% tokens**, perfect cross-file retrieval |
|
|
58
|
-
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **
|
|
43
|
+
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **0.62 ms** | **93.2% VRAM reduction**, 0 OOMs |
|
|
59
44
|
|
|
60
45
|
### 💻 Physical Laptop Edge Validation (NVIDIA RTX 3050 Laptop GPU)
|
|
61
46
|
Tested live on an everyday developer laptop (AMD Ryzen 7 7435HS + NVIDIA RTX 3050 Laptop GPU, 4.0 GB VRAM):
|
|
@@ -124,16 +109,31 @@ Add to your `~/.continue/config.json`:
|
|
|
124
109
|
|
|
125
110
|
---
|
|
126
111
|
|
|
112
|
+
## 💻 Visual Studio Code Extension
|
|
113
|
+
|
|
114
|
+
Install directly from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai):
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
code --install-extension DeepakR.neurocode-ai
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
*(Or download the `.vsix` binary from the [v0.1.0 Release](https://github.com/Arkz-Deepak/neurocode/releases/tag/v0.1.0))*
|
|
121
|
+
|
|
122
|
+
### Extension Features:
|
|
123
|
+
- **Status Bar Telemetry**: Live VRAM headroom and `/dev/shm` RAM health indicators.
|
|
124
|
+
- **Context Slicing**: Right-click any active file or code block to extract sub-1,200 token reachability closure in $<100$ ms.
|
|
125
|
+
- **1-Click Prompt Copy**: Instant paste into Cursor, Claude, or Copilot without context overflow.
|
|
126
|
+
- **Autonomous Diff Viewer**: Direct side-by-side patch inspection powered by local Ollama backbones.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
127
130
|
## 🚀 Quickstart & CLI Usage
|
|
128
131
|
|
|
129
|
-
### 1. Installation
|
|
132
|
+
### 1. Installation via PyPI
|
|
130
133
|
```bash
|
|
131
|
-
|
|
132
|
-
cd neurocode
|
|
133
|
-
python3 -m venv .venv
|
|
134
|
-
source .venv/bin/activate
|
|
135
|
-
pip install -e .
|
|
134
|
+
pip install neurocode-ai
|
|
136
135
|
```
|
|
136
|
+
*(Or install locally from source: `git clone https://github.com/Arkz-Deepak/neurocode.git && cd neurocode && pip install -e .`)*
|
|
137
137
|
|
|
138
138
|
### 2. Extract Token-Bounded Slice for Any Issue
|
|
139
139
|
```bash
|
|
@@ -170,10 +170,15 @@ neurocode-copilot
|
|
|
170
170
|
|
|
171
171
|
## 📄 Publications & Preprints
|
|
172
172
|
|
|
173
|
-
- **IEEE
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
173
|
+
- **35th IEEE/ACM International Conference on Program Comprehension (ICPC 2027)**:
|
|
174
|
+
- *Track*: Tool Demonstration Track (Submission #63)
|
|
175
|
+
- *Title*: *NeuroCode: In-Memory Code Property Graph Slicing and Edge SWE Agent for Resource-Constrained Environments*
|
|
176
|
+
- *Source*: [`paper_icpc_tool_demo/neurocode_icpc_demo.tex`](paper_icpc_tool_demo/neurocode_icpc_demo.tex)
|
|
177
|
+
- **Journal of Systems and Software (Elsevier)**:
|
|
178
|
+
- *Track*: Full Research Article (Traditional Subscription, ₹0 APC)
|
|
179
|
+
- *Title*: *On-Device Autonomous Software Engineering: In-Memory Code Property Graph Reachability Slicing under Edge VRAM Constraints*
|
|
180
|
+
- *Source*: [`paper_elsevier_jss/neurocode_jss.tex`](paper_elsevier_jss/neurocode_jss.tex)
|
|
181
|
+
- **Kaggle Empirical Reproduction**: [Kaggle Notebook Live](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
177
182
|
|
|
178
183
|
### Citation
|
|
179
184
|
```bibtex
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neurocode-ai
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Heterogeneous Code-Graph Slicing & AST Subtree Grafting for On-Device Autonomous SWE Agents
|
|
5
|
+
Author: Deepak R.
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: tree-sitter>=0.22.0
|
|
11
|
+
Requires-Dist: tree-sitter-python>=0.21.0
|
|
12
|
+
Requires-Dist: tree-sitter-javascript>=0.21.0
|
|
13
|
+
Requires-Dist: tree-sitter-typescript>=0.21.0
|
|
14
|
+
Requires-Dist: networkx>=3.0
|
|
15
|
+
Requires-Dist: datasets>=2.18.0
|
|
16
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
17
|
+
Requires-Dist: transformers>=4.40.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
1
20
|
# NeuroCode: Heterogeneous Code-Graph Slicing for On-Device Autonomous Software Engineering
|
|
2
21
|
|
|
22
|
+
[](https://pypi.org/project/neurocode-ai/)
|
|
23
|
+
[](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai)
|
|
24
|
+
[](https://glama.ai/mcp/servers/Arkz-Deepak/neurocode)
|
|
25
|
+
[](https://github.com/punkpeye/awesome-mcp-servers)
|
|
26
|
+
[](https://conf.researchr.org/home/icpc-2027)
|
|
3
27
|
[](https://opensource.org/licenses/MIT)
|
|
4
28
|
[](https://www.python.org/downloads/)
|
|
5
29
|
[]()
|
|
6
|
-
[](https://modelcontextprotocol.io)
|
|
7
|
-
[](https://ollama.ai)
|
|
8
|
-
[](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
9
30
|
|
|
10
31
|
**NeuroCode** is a lightweight, heterogeneous neuro-symbolic framework and **Model Context Protocol (MCP)** server that enables small, local language models (1.5B–14B parameters) to fix multi-file software engineering bugs on consumer laptops (e.g., 4GB–8GB VRAM) without cloud API dependency or Out-of-Memory (OOM) crashes.
|
|
11
32
|
|
|
@@ -34,11 +55,11 @@ NeuroCode was evaluated across 5 comprehensive benchmark tracks spanning real-wo
|
|
|
34
55
|
|
|
35
56
|
| Benchmark Suite | Metric | Baseline / BM25 | NeuroCode (Ours) | Advantage |
|
|
36
57
|
| :--- | :--- | :--- | :--- | :--- |
|
|
37
|
-
| **SWE-bench Lite** ($N=
|
|
38
|
-
| **HumanEval** ($N=164$) | Pass@1 | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
39
|
-
| **MBPP** ($N=100$) | Pass@1 | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
58
|
+
| **SWE-bench Lite** ($N=292$) | Valid Diff Apply / Resolved | 0.0% (OOM on 4GB) / 0.0% | **41.4% apply / 9.5% resolved** | Prevents OOM cliff; +23.9% apply over BM25 |
|
|
59
|
+
| **HumanEval** ($N=164$) | Pass@1 (Unit Test) | 80.5% | **86.0%** (141/164) | +5.5% via syntax-aware graph repair |
|
|
60
|
+
| **MBPP** ($N=100$) | Pass@1 (Unit Test) | 81.0% | **87.0%** (87/100) | +6.0% algorithmic verification |
|
|
40
61
|
| **RepoBench-R** ($N=150$) | Recall@1 / Token Budget | 18.0% (745 tokens) | **100.0%** (**428 tokens**) | **-42.6% tokens**, perfect cross-file retrieval |
|
|
41
|
-
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **
|
|
62
|
+
| **Host Systems Telemetry** | Active VRAM / Slice Latency | 14.2 GB (OOM) | **961.2 MB** / **0.62 ms** | **93.2% VRAM reduction**, 0 OOMs |
|
|
42
63
|
|
|
43
64
|
### 💻 Physical Laptop Edge Validation (NVIDIA RTX 3050 Laptop GPU)
|
|
44
65
|
Tested live on an everyday developer laptop (AMD Ryzen 7 7435HS + NVIDIA RTX 3050 Laptop GPU, 4.0 GB VRAM):
|
|
@@ -107,16 +128,31 @@ Add to your `~/.continue/config.json`:
|
|
|
107
128
|
|
|
108
129
|
---
|
|
109
130
|
|
|
131
|
+
## 💻 Visual Studio Code Extension
|
|
132
|
+
|
|
133
|
+
Install directly from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=DeepakR.neurocode-ai):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
code --install-extension DeepakR.neurocode-ai
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
*(Or download the `.vsix` binary from the [v0.1.0 Release](https://github.com/Arkz-Deepak/neurocode/releases/tag/v0.1.0))*
|
|
140
|
+
|
|
141
|
+
### Extension Features:
|
|
142
|
+
- **Status Bar Telemetry**: Live VRAM headroom and `/dev/shm` RAM health indicators.
|
|
143
|
+
- **Context Slicing**: Right-click any active file or code block to extract sub-1,200 token reachability closure in $<100$ ms.
|
|
144
|
+
- **1-Click Prompt Copy**: Instant paste into Cursor, Claude, or Copilot without context overflow.
|
|
145
|
+
- **Autonomous Diff Viewer**: Direct side-by-side patch inspection powered by local Ollama backbones.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
110
149
|
## 🚀 Quickstart & CLI Usage
|
|
111
150
|
|
|
112
|
-
### 1. Installation
|
|
151
|
+
### 1. Installation via PyPI
|
|
113
152
|
```bash
|
|
114
|
-
|
|
115
|
-
cd neurocode
|
|
116
|
-
python3 -m venv .venv
|
|
117
|
-
source .venv/bin/activate
|
|
118
|
-
pip install -e .
|
|
153
|
+
pip install neurocode-ai
|
|
119
154
|
```
|
|
155
|
+
*(Or install locally from source: `git clone https://github.com/Arkz-Deepak/neurocode.git && cd neurocode && pip install -e .`)*
|
|
120
156
|
|
|
121
157
|
### 2. Extract Token-Bounded Slice for Any Issue
|
|
122
158
|
```bash
|
|
@@ -153,10 +189,15 @@ neurocode-copilot
|
|
|
153
189
|
|
|
154
190
|
## 📄 Publications & Preprints
|
|
155
191
|
|
|
156
|
-
- **IEEE
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
192
|
+
- **35th IEEE/ACM International Conference on Program Comprehension (ICPC 2027)**:
|
|
193
|
+
- *Track*: Tool Demonstration Track (Submission #63)
|
|
194
|
+
- *Title*: *NeuroCode: In-Memory Code Property Graph Slicing and Edge SWE Agent for Resource-Constrained Environments*
|
|
195
|
+
- *Source*: [`paper_icpc_tool_demo/neurocode_icpc_demo.tex`](paper_icpc_tool_demo/neurocode_icpc_demo.tex)
|
|
196
|
+
- **Journal of Systems and Software (Elsevier)**:
|
|
197
|
+
- *Track*: Full Research Article (Traditional Subscription, ₹0 APC)
|
|
198
|
+
- *Title*: *On-Device Autonomous Software Engineering: In-Memory Code Property Graph Reachability Slicing under Edge VRAM Constraints*
|
|
199
|
+
- *Source*: [`paper_elsevier_jss/neurocode_jss.tex`](paper_elsevier_jss/neurocode_jss.tex)
|
|
200
|
+
- **Kaggle Empirical Reproduction**: [Kaggle Notebook Live](https://www.kaggle.com/code/deepark121/neurocode-heterogeneous-graph-sliced-swe-agent)
|
|
160
201
|
|
|
161
202
|
### Citation
|
|
162
203
|
```bibtex
|
|
@@ -10,6 +10,7 @@ neurocode_ai.egg-info/top_level.txt
|
|
|
10
10
|
src/__init__.py
|
|
11
11
|
src/cli.py
|
|
12
12
|
src/mcp_server.py
|
|
13
|
+
src/agent/graft.py
|
|
13
14
|
src/agent/llm_interface.py
|
|
14
15
|
src/agent/patcher.py
|
|
15
16
|
src/benchmark/create_thumbnail.py
|
|
@@ -31,5 +32,8 @@ src/graph/__init__.py
|
|
|
31
32
|
src/graph/builder.py
|
|
32
33
|
src/graph/parser.py
|
|
33
34
|
src/graph/slicer.py
|
|
35
|
+
tests/test_graft.py
|
|
34
36
|
tests/test_graph.py
|
|
35
|
-
tests/
|
|
37
|
+
tests/test_mcp.py
|
|
38
|
+
tests/test_multi_hop.py
|
|
39
|
+
tests/test_ts_js.py
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "neurocode-ai"
|
|
7
|
-
version = "
|
|
8
|
-
description = "Heterogeneous Code-Graph Slicing for On-Device Autonomous SWE Agents"
|
|
7
|
+
version = "1.2.0"
|
|
8
|
+
description = "Heterogeneous Code-Graph Slicing & AST Subtree Grafting for On-Device Autonomous SWE Agents"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Deepak R." }]
|
|
11
11
|
license = { text = "MIT" }
|
|
@@ -13,6 +13,8 @@ requires-python = ">=3.10"
|
|
|
13
13
|
dependencies = [
|
|
14
14
|
"tree-sitter>=0.22.0",
|
|
15
15
|
"tree-sitter-python>=0.21.0",
|
|
16
|
+
"tree-sitter-javascript>=0.21.0",
|
|
17
|
+
"tree-sitter-typescript>=0.21.0",
|
|
16
18
|
"networkx>=3.0",
|
|
17
19
|
"datasets>=2.18.0",
|
|
18
20
|
"matplotlib>=3.8.0",
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AST Subtree Grafting Engine for Autonomous SWE Agents.
|
|
3
|
+
Performs deterministic, syntax-verified AST node replacements in-memory,
|
|
4
|
+
completely eliminating fragile multi-line whitespace and indentation diff failures.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import ast
|
|
8
|
+
import difflib
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Dict, Any, Optional, Tuple
|
|
12
|
+
from tree_sitter import Node, Parser, Language
|
|
13
|
+
import tree_sitter_python as tspython
|
|
14
|
+
|
|
15
|
+
_PY_LANG = Language(tspython.language())
|
|
16
|
+
_PY_PARSER = Parser(_PY_LANG)
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
import tree_sitter_javascript as tsjs
|
|
20
|
+
_JS_LANG = Language(tsjs.language())
|
|
21
|
+
_JS_PARSER = Parser(_JS_LANG)
|
|
22
|
+
except Exception:
|
|
23
|
+
_JS_LANG = None
|
|
24
|
+
_JS_PARSER = None
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import tree_sitter_typescript as tsts
|
|
28
|
+
_TS_LANG = Language(tsts.language_typescript())
|
|
29
|
+
_TS_PARSER = Parser(_TS_LANG)
|
|
30
|
+
_TSX_LANG = Language(tsts.language_tsx())
|
|
31
|
+
_TSX_PARSER = Parser(_TSX_LANG)
|
|
32
|
+
except Exception:
|
|
33
|
+
_TS_LANG = None
|
|
34
|
+
_TS_PARSER = None
|
|
35
|
+
_TSX_LANG = None
|
|
36
|
+
_TSX_PARSER = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_parser_for_file(file_path: str) -> Parser:
|
|
40
|
+
"""Returns the appropriate Tree-sitter parser based on file extension."""
|
|
41
|
+
ext = Path(file_path).suffix.lower()
|
|
42
|
+
if ext == ".tsx" and _TSX_PARSER:
|
|
43
|
+
return _TSX_PARSER
|
|
44
|
+
elif ext == ".ts" and _TS_PARSER:
|
|
45
|
+
return _TS_PARSER
|
|
46
|
+
elif ext in (".js", ".jsx", ".mjs", ".cjs") and _JS_PARSER:
|
|
47
|
+
return _JS_PARSER
|
|
48
|
+
return _PY_PARSER
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def find_target_node(root: Node, symbol: str, code_bytes: bytes) -> Optional[Node]:
|
|
52
|
+
"""
|
|
53
|
+
Locates the AST node corresponding to the given symbol name or 'ClassName.methodName'.
|
|
54
|
+
"""
|
|
55
|
+
def get_text(node: Optional[Node]) -> str:
|
|
56
|
+
if not node:
|
|
57
|
+
return ""
|
|
58
|
+
return code_bytes[node.start_byte:node.end_byte].decode("utf-8", errors="replace")
|
|
59
|
+
|
|
60
|
+
target_class = None
|
|
61
|
+
target_name = symbol
|
|
62
|
+
if "." in symbol:
|
|
63
|
+
target_class, target_name = symbol.split(".", 1)
|
|
64
|
+
|
|
65
|
+
stack = [root]
|
|
66
|
+
while stack:
|
|
67
|
+
curr = stack.pop()
|
|
68
|
+
|
|
69
|
+
# Check Python Function
|
|
70
|
+
if curr.type in ("function_definition", "function_declaration", "method_definition"):
|
|
71
|
+
name_node = curr.child_by_field_name("name")
|
|
72
|
+
if name_node and get_text(name_node) == target_name:
|
|
73
|
+
if target_class:
|
|
74
|
+
# Verify parent class
|
|
75
|
+
parent = curr.parent
|
|
76
|
+
while parent and parent.type not in ("class_definition", "class_declaration"):
|
|
77
|
+
parent = parent.parent
|
|
78
|
+
if parent:
|
|
79
|
+
p_name_node = parent.child_by_field_name("name")
|
|
80
|
+
if p_name_node and get_text(p_name_node) == target_class:
|
|
81
|
+
return curr
|
|
82
|
+
else:
|
|
83
|
+
return curr
|
|
84
|
+
|
|
85
|
+
# Check Python or JS/TS Class
|
|
86
|
+
elif curr.type in ("class_definition", "class_declaration"):
|
|
87
|
+
name_node = curr.child_by_field_name("name")
|
|
88
|
+
if not target_class and name_node and get_text(name_node) == target_name:
|
|
89
|
+
return curr
|
|
90
|
+
|
|
91
|
+
# Check JS/TS Arrow Function or Variable
|
|
92
|
+
elif curr.type == "variable_declarator":
|
|
93
|
+
name_node = curr.child_by_field_name("name")
|
|
94
|
+
val_node = curr.child_by_field_name("value")
|
|
95
|
+
if name_node and get_text(name_node) == target_name:
|
|
96
|
+
# Return the declarator's parent lexical_declaration if possible
|
|
97
|
+
if curr.parent and curr.parent.type in ("lexical_declaration", "variable_declaration"):
|
|
98
|
+
return curr.parent
|
|
99
|
+
return curr
|
|
100
|
+
|
|
101
|
+
for child in reversed(curr.children):
|
|
102
|
+
stack.append(child)
|
|
103
|
+
|
|
104
|
+
return None
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def align_indentation(replacement_code: str, target_indent_spaces: int) -> str:
|
|
108
|
+
"""
|
|
109
|
+
Normalizes and re-indents replacement code so it seamlessly matches the AST target scope.
|
|
110
|
+
"""
|
|
111
|
+
lines = replacement_code.strip("\r\n").splitlines()
|
|
112
|
+
if not lines:
|
|
113
|
+
return ""
|
|
114
|
+
|
|
115
|
+
# Determine common leading whitespace in replacement lines (excluding empty lines)
|
|
116
|
+
non_empty = [l for l in lines if l.strip()]
|
|
117
|
+
if not non_empty:
|
|
118
|
+
return replacement_code
|
|
119
|
+
|
|
120
|
+
min_leading = min(len(l) - len(l.lstrip()) for l in non_empty)
|
|
121
|
+
unindented_lines = [(l[min_leading:] if len(l) >= min_leading else l) for l in lines]
|
|
122
|
+
|
|
123
|
+
target_indent = " " * target_indent_spaces
|
|
124
|
+
reindented = []
|
|
125
|
+
for idx, line in enumerate(unindented_lines):
|
|
126
|
+
if not line.strip():
|
|
127
|
+
reindented.append("")
|
|
128
|
+
elif idx == 0:
|
|
129
|
+
reindented.append(line.lstrip())
|
|
130
|
+
else:
|
|
131
|
+
leading_len = len(line) - len(line.lstrip())
|
|
132
|
+
reindented.append(target_indent + (" " * leading_len) + line.lstrip())
|
|
133
|
+
|
|
134
|
+
return "\n".join(reindented)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def graft_symbol(
|
|
138
|
+
repo_path: str,
|
|
139
|
+
file_path: str,
|
|
140
|
+
symbol: str,
|
|
141
|
+
replacement_code: str,
|
|
142
|
+
apply: bool = False
|
|
143
|
+
) -> Dict[str, Any]:
|
|
144
|
+
"""
|
|
145
|
+
Performs deterministic AST subtree grafting for a target symbol.
|
|
146
|
+
"""
|
|
147
|
+
base_dir = Path(repo_path).resolve()
|
|
148
|
+
target_file = (base_dir / file_path).resolve()
|
|
149
|
+
|
|
150
|
+
if not target_file.exists():
|
|
151
|
+
return {
|
|
152
|
+
"success": False,
|
|
153
|
+
"error": f"File does not exist: {file_path}",
|
|
154
|
+
"file_path": file_path
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
try:
|
|
158
|
+
original_source = target_file.read_text(encoding="utf-8", errors="replace")
|
|
159
|
+
except Exception as e:
|
|
160
|
+
return {"success": False, "error": f"Failed to read file: {e}", "file_path": file_path}
|
|
161
|
+
|
|
162
|
+
parser = get_parser_for_file(str(target_file))
|
|
163
|
+
code_bytes = original_source.encode("utf-8")
|
|
164
|
+
tree = parser.parse(code_bytes)
|
|
165
|
+
|
|
166
|
+
# 1. Locate Target AST Node
|
|
167
|
+
target_node = find_target_node(tree.root_node, symbol, code_bytes)
|
|
168
|
+
if not target_node:
|
|
169
|
+
return {
|
|
170
|
+
"success": False,
|
|
171
|
+
"error": f"Symbol '{symbol}' was not found in the AST of {file_path}.",
|
|
172
|
+
"file_path": file_path
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
# 2. Indentation alignment
|
|
176
|
+
target_indent_cols = target_node.start_point[1]
|
|
177
|
+
formatted_replacement = align_indentation(replacement_code, target_indent_cols)
|
|
178
|
+
|
|
179
|
+
# 3. Perform byte slice replacement
|
|
180
|
+
new_bytes = (
|
|
181
|
+
code_bytes[:target_node.start_byte]
|
|
182
|
+
+ formatted_replacement.encode("utf-8")
|
|
183
|
+
+ code_bytes[target_node.end_byte:]
|
|
184
|
+
)
|
|
185
|
+
new_source = new_bytes.decode("utf-8", errors="replace")
|
|
186
|
+
|
|
187
|
+
# 4. AST Integrity Verification
|
|
188
|
+
new_tree = parser.parse(new_bytes)
|
|
189
|
+
if new_tree.root_node.has_error:
|
|
190
|
+
return {
|
|
191
|
+
"success": False,
|
|
192
|
+
"error": "SyntaxError: Grafted code resulted in invalid AST grammar.",
|
|
193
|
+
"file_path": file_path,
|
|
194
|
+
"syntax_valid": False
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# Python-specific AST check
|
|
198
|
+
if target_file.suffix == ".py":
|
|
199
|
+
try:
|
|
200
|
+
ast.parse(new_source, filename=str(target_file))
|
|
201
|
+
except SyntaxError as se:
|
|
202
|
+
return {
|
|
203
|
+
"success": False,
|
|
204
|
+
"error": f"Python SyntaxError at line {se.lineno}: {se.msg}",
|
|
205
|
+
"file_path": file_path,
|
|
206
|
+
"syntax_valid": False
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
# 5. Generate Diff
|
|
210
|
+
diff_lines = list(difflib.unified_diff(
|
|
211
|
+
original_source.splitlines(keepends=True),
|
|
212
|
+
new_source.splitlines(keepends=True),
|
|
213
|
+
fromfile=f"a/{file_path}",
|
|
214
|
+
tofile=f"b/{file_path}",
|
|
215
|
+
lineterm=""
|
|
216
|
+
))
|
|
217
|
+
diff_str = "\n".join(diff_lines)
|
|
218
|
+
|
|
219
|
+
# 6. Apply to disk if requested
|
|
220
|
+
if apply:
|
|
221
|
+
try:
|
|
222
|
+
target_file.write_text(new_source, encoding="utf-8")
|
|
223
|
+
except Exception as e:
|
|
224
|
+
return {
|
|
225
|
+
"success": False,
|
|
226
|
+
"error": f"Failed to write changes to disk: {e}",
|
|
227
|
+
"file_path": file_path
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
"success": True,
|
|
232
|
+
"file_path": file_path,
|
|
233
|
+
"symbol": symbol,
|
|
234
|
+
"entity_type": target_node.type,
|
|
235
|
+
"start_line": target_node.start_point[0] + 1,
|
|
236
|
+
"end_line": target_node.end_point[0] + 1,
|
|
237
|
+
"syntax_valid": True,
|
|
238
|
+
"applied": apply,
|
|
239
|
+
"diff": diff_str,
|
|
240
|
+
"message": "Subtree successfully grafted with 100% verified syntax."
|
|
241
|
+
}
|