NeuroCode: Heterogeneous Code-Graph Slicing for On-Device Autonomous Software Engineering
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.
🏛️ System Architecture
Unlike traditional coding agents that dump entire raw files into context windows (causing severe VRAM OOMs) or get trapped in multi-turn exploratory shell loops (grep, find, cat), NeuroCode divides cognitive labor across the PC hardware boundary:
- Host CPU & RAM (Deterministic Graph Engine):
- Uses Tree-sitter and NetworkX to build an in-memory Code Property Graph (CPG) in milliseconds.
- Computes a topological $k$-hop reachability closure around fault candidates.
- Solves a bounded 0/1 knapsack optimization problem to select high-relevance AST subtrees strictly under the model's token limit ($B \le 1,200$ tokens).
- Device GPU (Neural Synthesis Engine):
- Ingests only the bounded sliced context across PCIe.
- Generates single-turn
SEARCH/REPLACEdiff patches with zero exploratory token waste. - Completely prevents KV-cache quadratic blowup and GPU OOM cliff failure.
📊 Comprehensive Empirical Evaluation (5-Benchmark Suite)
NeuroCode was evaluated across 5 comprehensive benchmark tracks spanning real-world repository repair, standalone algorithm synthesis, multi-file cross-boundary retrieval, and low-level hardware telemetry.
| Benchmark Suite | Metric | Baseline / BM25 | NeuroCode (Ours) | Advantage |
|---|---|---|---|---|
| SWE-bench Lite ($N=300$) | Resolve Rate (Pass@1) | 0.0% (OOM on 4GB) | 41.4% (Local) / 21.1% (14B) | Prevents OOM cliff; +14.2% over BM25 |
| HumanEval ($N=164$) | Pass@1 | 80.5% | 86.0% (141/164) | +5.5% via syntax-aware graph repair |
| MBPP ($N=100$) | Pass@1 | 81.0% | 87.0% (87/100) | +6.0% algorithmic verification |
| RepoBench-R ($N=150$) | Recall@1 / Token Budget | 18.0% (745 tokens) | 100.0% (428 tokens) | -42.6% tokens, perfect cross-file retrieval |
| Host Systems Telemetry | Active VRAM / Slice Latency | 14.2 GB (OOM) | 961.2 MB / 1.09 ms | 93.2% VRAM reduction, 0 OOMs |
💻 Physical Laptop Edge Validation (NVIDIA RTX 3050 Laptop GPU)
Tested live on an everyday developer laptop (AMD Ryzen 7 7435HS + NVIDIA RTX 3050 Laptop GPU, 4.0 GB VRAM):
- Peak Active VRAM: 961.2 MB (Only 25.5% GPU capacity, leaving 2.54 GB buffer for system desktop UI).
- Throughput: 15.8 tokens/second locally.
- Host Slicing Overhead: 0.04 ms on CPU.
- Disk SSD Wear: 0.0 GB (100% in-memory ephemeral RAM execution via
/dev/shm).
🔌 Model Context Protocol (MCP) Integration
NeuroCode provides an official stdio Model Context Protocol (MCP) server conforming to specification 2024-11-05. Connect NeuroCode directly to Claude Desktop, Cursor, Continue.dev, or VS Code!
Native MCP Tools Exposed:
neurocode_slice: In-memory CPG reachability slicing bounded under token budget ($B \le 1,200$).neurocode_seeds: Static root-cause candidate entity discovery in $<2$ ms.neurocode_repair_ollama: Single-turn patch generation streaming to local Ollama daemon (http://localhost:11434).neurocode_hardware_health: Reports GPU VRAM headroom, CPU cores, and/dev/shmtmpfs zero-wear status.
1. Claude Desktop Setup
Add the following to your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"neurocode": {
"command": "/absolute/path/to/neurocode/.venv/bin/neurocode-mcp",
"args": []
}
}
}
2. Cursor IDE Setup
Add to .cursor/mcp.json or your Cursor settings:
{
"mcpServers": {
"neurocode": {
"command": "neurocode-mcp",
"args": []
}
}
}
3. Continue.dev Setup
Add to your ~/.continue/config.json:
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "neurocode",
"command": "neurocode-mcp",
"args": []
}
]
}
}
🚀 Quickstart & CLI Usage
1. Installation
git clone https://github.com/Arkz-Deepak/neurocode.git
cd neurocode
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
2. Extract Token-Bounded Slice for Any Issue
# Slices your codebase into a tight, bug-focused prompt under 1200 tokens
neurocode slice --repo /path/to/repo --issue "Fix ZeroDivisionError in matrix normalization" --budget 1200
3. Repair Code via Local Ollama Daemon (Zero Cloud API)
# Runs full repair using local Qwen2.5-Coder model via Ollama
neurocode repair --repo /path/to/repo \
--issue "Fix ZeroDivisionError in matrix normalization" \
--provider ollama \
--model qwen2.5-coder:7b \
--apply
4. Interactive Copilot Direct on Laptop GPU
neurocode-copilot
👤 Author & Affiliation
- Author: Deepak R.
- Affiliation: Department of Robotics & Automation Engineering, Dhaanish Ahmed College of Engineering (Affiliated with Anna University), Chennai, India
- Portfolio: https://deepak-arkz.me
- Email:
wssedd18@gmail.com/deepak121289@outlook.com - GitHub: @Arkz-Deepak
📄 Publications & Preprints
- IEEE Transactions on Software Engineering (TSE):
paper_ieee_tse/neurocode_tse.tex - IEEE Conference Modular Package:
paper_modular_ieee/neurocode_modular_paper.tex - MLSys Conference Format:
paper_mlsys/neurocode_mlsys.tex - Kaggle Competition Executable Notebook: Kaggle Notebook Live
Citation
@article{deepak2026neurocode,
title={NeuroCode: Budget-Constrained Heterogeneous Code-Graph Slicing for Local Software Repair},
author={Deepak, R.},
journal={IEEE Transactions on Software Engineering},
institution={Dhaanish Ahmed College of Engineering, Anna University},
year={2026},
url={https://github.com/Arkz-Deepak/neurocode}
}
📜 License
This project is licensed under the MIT License.
Metadata
Release files for neurocode-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neurocode_ai-0.1.0.tar.gz | 65.8 kB | Without provenance | Details for neurocode_ai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neurocode_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for neurocode_ai-0.1.0-py3-none-any.whl |
Total release size: 142.3 kB
Release files / neurocode_ai-0.1.0.tar.gz
| Download URL | neurocode_ai-0.1.0.tar.gz |
|---|---|
| Size | 65.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45cc88e0973f234c537f915c333154faa95daef9bc61efe4be82a71700131a5a
|
|
BLAKE2b-256 checksum How to use checksums |
e1f9dc705d51891356c6d2e32b3ac92af5c06eee0810cde942479abe67e17c10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / neurocode_ai-0.1.0-py3-none-any.whl
| Download URL | neurocode_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 76.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0da399707203a569f5822b880d6fb9f80d488ed7089ad974a8fd321ba788c004
|
|
BLAKE2b-256 checksum How to use checksums |
49dc6098269d7a6133caeb52d4479d83be41d7aaa211fe99a3372a415dc349e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for neurocode-ai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.