DEV Community

Gowri shankar
Gowri shankar

Posted on

I built a local AI coding system that actually understands your codebase — here's what I learned

I'm Gowri Shankar, a DevOps engineer from Hyderabad. I just open-sourced a project I've been building for the past few weeks, and I want to share it honestly — what it does, how I built it, and what I learned.
🔗 GitHub: github.com/gowrishankar-infra/leanai

🤔 The Problem
Every AI coding tool I've used has the same frustration: it sees my code for the first time, every time.
I paste a snippet, explain the context, get an answer, close the tab — and next session, start from zero. Claude doesn't know my project structure. GPT doesn't remember what we discussed yesterday. Copilot suggests function names that don't exist in my codebase.
I wanted an AI that permanently understands my project. So I built one.

🧠 What LeanAI Does
LeanAI is a fully local AI coding assistant. It runs Qwen2.5 Coder (7B and 32B) on your machine. No cloud, no API keys, no subscriptions, no data leaving your computer.
Here's what makes it different from existing tools:
📂 It knows your entire codebase
Run /brain . and LeanAI scans your project with full AST analysis:
[Brain] Scanned 91 files in 5674ms
Functions: 1,689
Classes: 320
Dependency edges: 9,775
When I ask "what does the engine file do?", it describes MY actual engine with MY real classes — not a generic example about what an engine file might look like.
⚡ Sub-2ms autocomplete from your project
Type /complete gen and in 0.8ms, it returns completions from YOUR codebase:
◆ GenerationConfig core/engine.py
ƒ generate() core/engine_v3.py
ƒ generate_changelog() brain/git_intel.py
ƒ generate_batch() core/engine_v3.py
No model call needed. It searches the brain's index of 2,899 functions directly.
🔍 Semantic git bisect

This one doesn't exist anywhere else.

Instead of binary search for bugs, LeanAI reads each commit semantically and predicts which one introduced a bug:
/bisect authentication stopped working

Most likely culprit:
b7b3f51 — VS Code extension + path separator fix
Suspicion: 45%
Reasoning: includes path changes that could affect auth flow
It analyzed 20 commits, scored each one, and explained its reasoning.
🛡️ Adversarial code verification
Instead of just running tests, LeanAI generates edge-case inputs designed to break your code:
/fuzz def sort(arr): return sorted(arr)

Tested: 12 | Passed: 9 | Failed: 3

Failures:
✗ None → TypeError
✗ [1, 'a', 2.0] → TypeError
✗ [1, None, 3] → TypeError

Suggested fixes:
→ Add None check
→ Add type validation
Found 3 bugs in under 1 second.
💾 It never forgets
Every conversation is stored in persistent session memory. Session 1's decisions are searchable in session 10. It tracks how your understanding evolves across sessions — from "setting up a database" to "optimizing cache invalidation" — and predicts what you'll need next.
📈 It gets smarter from your code
Every interaction auto-collects training data. When you have enough examples, QLoRA fine-tuning makes the model learn YOUR coding patterns. No other tool does this.

🤝 The Honest Part
I built this using Claude. Claude wrote most of the code. I made every architectural decision, debugged every Windows/CUDA issue, tested everything on my machine, and directed every phase of development.
I think this is how software gets built in 2026. 92% of developers use AI coding tools. The value isn't in typing code — it's in knowing what to build, how to architect it, and when something is wrong. I'm not hiding Claude's involvement because I don't think it diminishes the work.

⚠️ What It's NOT
I want to be upfront about the limitations:
LimitationDetails🐢 It's slow25-90 seconds per response on CPU. Cloud AI gives you 2-5 seconds.🧠 Not as smart as GPT-4/ClaudeNever will be at this model size. The value is project awareness.🔧 It's roughThis is v1. There are bugs. The UI is basic.

📊 The Numbers
MetricValueIntegrated systems29Tests (all passing)500+Lines of Python27,000+CLI commands45+API endpoints32Interfaces3 (CLI, Web UI, VS Code)Models2 (7B fast, 32B quality)Monthly cost$0

🏆 Features No Competitor Has
I searched the internet and compared with every major open-source AI coding tool — Aider (39K stars), Continue (20K stars), Tabby (20K stars), Forge, OpenClaw (70K stars). None of them have ALL of these:

FeatureUnique?1Sub-2ms autocomplete from AST brain index✅2Semantic git bisect with AI suspicion scoring✅3Adversarial code fuzzing with fix suggestions✅4Cross-session evolution tracking✅5Predictive pre-generation✅6Continuous fine-tuning pipeline✅7Full AST dependency graph (9,775 edges)✅8TDD auto-fix loop✅93-pass reasoning engine✅104-pass writing engine✅11Multi-model auto-switching by complexity✅
Individual features exist in other tools. Nobody has integrated them all in one offline system.

🛠️ Tech Stack
Models: Qwen2.5 Coder 7B + 32B (GGUF, via llama-cpp-python)
Memory: ChromaDB + sentence-transformers
Server: FastAPI + uvicorn
Brain: Custom AST parser with dependency graph
Language: Python
License: AGPL-3.0
Hardware: i7-11800H, 32GB RAM, RTX 3050 Ti

💡 What I Learned

  1. AI is a coding partner, not a replacement. Claude wrote the code, but it couldn't have built LeanAI without me deciding what to build, in what order, and catching when things broke.
  2. Local AI is viable on consumer hardware. My laptop runs a 32B parameter model. It's slow, but it works. When Qwen3 and Llama 4 drop, the infrastructure I built is ready.
  3. Project awareness is an unsolved problem. Every AI tool treats your codebase as a stranger. Building a "brain" that maps functions, tracks dependencies, and remembers conversations is the hard part — not the model inference.
  4. Testing everything matters. 500+ tests across 18 files. Every system tested independently. This saved me dozens of times when one change broke something else.

🚀 Try It
bashgit clone https://github.com/gowrishankar-infra/leanai.git
cd leanai
pip install -r requirements.txt
python main.py
Then run /brain . to scan your project and start asking questions.
🔗 GitHub: github.com/gowrishankar-infra/leanai
⭐ Star it if you think local AI that understands your codebase is worth building.

I'd love feedback, bug reports, or honest criticism. I know it's not perfect — that's why I'm sharing it.
— Gowri Shankar

Top comments (0)