localvibecode
# localVibeCode
<p align="center">
<strong>Enterprise Local Vibe Coding Engine β 100% Offline & Air-Gapped</strong><br>
<em>Turn your local laptop into an autonomous, hallucination-resistant AI coding node without internet access.</em>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Environment-100%25%20Offline%20%2F%20Air--Gapped-success" alt="Offline">
<img src="https://img.shields.io/badge/Inference-Ollama%20Local-blue" alt="Ollama">
<img src="https://img.shields.io/badge/Context%20Engine-Graphify%20AST%20(0--Token)-orange" alt="AST Graph">
<img src="https://img.shields.io/badge/Architecture-Deterministic%20PEV-purple" alt="PEV Loop">
<img src="https://img.shields.io/badge/License-Apache%202.0-green" alt="License">
</p>
---
## π― What is localVibeCode?
In high-security enterprise environments (banking, financial services, telecom, defense, healthcare), developers face a strict constraint: **no public internet access or high network bottlenecks**. At the same time, traditional AI coding tools rely on frontier cloud LLMs with 200k+ token context windows by dumping dozens of files into the prompt.
When running local models (7B β 14B) on laptops (16GB β 32GB RAM):
1. **Dumping multiple files causes severe "Lost in the Middle"** hallucination and memory blowup.
2. **Running multiple models (Planner + Coder + Reviewer) causes VRAM thrashing** and 10β20 second swapping freezes.
3. **Unchecked edits cause breaking contract changes** across dependent modules.
**localVibeCode** solves this by shifting structural discovery and verification to the CPU (0 LLM Tokens), feeding your local model only **surgical, high-precision context (< 4,000 tokens)** under a deterministic state machine.
---
## β‘ The 3 Architectural Breakthroughs
```
[Developer Requirement]
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 0: Graphify AST Indexer (CPU β’ 0 LLM Tokens) β
β - Parses AST across codebase in < 0.1s β
β - Identifies Architectural God Nodes & Leiden subsystem clusters β
β - Extracts 1-Hop Inbound Callers & Outbound Signatures β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 1: PLAN (Fresh Context #1 β’ Constrained JSON Schema) β
β - Analyzes Requirement + GRAPH_REPORT.md + Enterprise Guardrails β
β - Generates minimal ordered Atomic Tasks (Model -> Service -> Test) β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β (Context Reset)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 2: EXECUTE (Fresh Context #2 per file β’ Surgical Slice) β
β - Blast-Radius Slicer feeds ONLY: Target File + 1-Hop Signatures β
β - Single Pinned Base Model generates surgical patch β
β - Immediate Zero-Token Verifier (AST check + SAST + Unit Tests) β
β - Self-Healing loop with error traceback if verification fails β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β (Context Reset)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 3: VERIFY (Fresh Context #3 β’ Spec Critic) β
β - Evaluates unified git diff against original requirements β
β - Produces pass/replan scorecard and compliance score (0-100) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
1. **Deterministic AST Knowledge Graph (Graphify Style):**
- 0 LLM tokens consumed.
- Maps classes, functions, and import/call dependencies deterministically using AST parsing.
- Ranks **Architectural God Nodes** so AI knows which core interfaces cannot be broken.
2. **Blast-Radius Slicer (< 4,000 Tokens Surgical Context):**
- Extracts only: Target file + 1-Hop Outbound Signatures (function bodies stripped) + 1-Hop Inbound Callers.
- Allows a 7B or 14B model to make multi-file modifications with the precision of a 200B cloud model.
3. **Single Pinned Base Model & Deterministic PEV:**
- Keeps **only 1 model** pinned in Unified Memory/VRAM (`keep_alive: -1m`), eliminating model swapping.
- Resets context at every phase (**Plan $\rightarrow$ Execute $\rightarrow$ Verify**) to keep the model in its **Peak Reasoning Zone**.
- Zero-token verification (AST, Security SAST, Test Suite) before displaying changes.
---
## π Quickstart
### 1. Prerequisites
- **OS:** macOS (Apple Silicon M-series recommended) or Linux.
- **RAM:** 16GB+ Unified Memory / RAM recommended.
- **Python:** Python >= 3.9.
- **Inference Engine:** [Ollama](https://ollama.com/) running locally.
- **Recommended Model:** `qwen2.5-coder:7b` (fast) or `qwen2.5-coder:14b` (deep reasoning).
```bash
# Pull your preferred local coding model
ollama pull qwen2.5-coder:7b
```
### 2. Installation
Clone the repository:
```bash
git clone https://github.com/dhluong90/localVibeCode.git
cd localVibeCode
# Make the CLI launcher executable (or add to your PATH)
chmod +x ./localvibecode
```
### 3. Run Preflight Health Check
Verify your local environment, RAM budget, Ollama daemon, and models:
```bash
./localvibecode doctor
```
```text
ββββββββββββββββββββ SYSTEM PREFLIGHT DIAGNOSTICS ββββββββββββββββββββ
[PASS] Python Version (Runtime)
β³ Python 3.9.6 (/usr/bin/python3)
[PASS] System Memory (Hardware)
β³ 24.0 GB RAM / Unified Memory detected (Darwin arm64)
[PASS] Git CLI (Toolchain)
β³ Found at /usr/bin/git
[PASS] Ollama Binary (Inference)
β³ Found at /usr/local/bin/ollama
[PASS] Ollama Daemon Service (Inference)
β³ Responding at http://localhost:11434 (2 model(s) installed)
[PASS] Coding LLM Models (Inference)
β³ Available: ['qwen2.5:7b', 'gemma4:latest']
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[SUCCESS] All environment checks passed! localVibeCode is 100% ready to run offline.
```
### 4. Test on the Included Enterprise Demo Repo
```bash
./localvibecode pev "Add 20% discount for ENTERPRISE tier in order service and add unit test verifying 500.0 USD charges 400.0."
```
---
## π οΈ Onboarding an Existing Project
You can apply localVibeCode to any existing repository in one command:
```bash
./localvibecode init /path/to/your/existing/project
```
What `init` does automatically in 1 second:
1. Detects project test suite (`pytest`, `npm test`, `go test`).
2. Generates `localvibecode.json` config.
3. Configures OpenCode CLI integration (`opencode.json`).
4. Configures VS Code / Cursor MCP integration (`.vscode/mcp.json`).
5. Generates starter `enterprise_rules/` folder.
6. Builds the initial Graphify AST map in `graphify-out/GRAPH_REPORT.md`.
---
## π» IDE & Tool Integrations
### 1. OpenCode CLI (Terminal Agent)
Run OpenCode in any onboarded repository:
```bash
cd /path/to/your/project
opencode
```
Use custom slash commands:
- `/graph` β Inspect architectural God Nodes and repository skeleton (0 tokens).
- `/impact path/to/file.py` β View 1-hop blast-radius surgical slice.
- `/pev <requirement>` β Trigger autonomous offline Plan-Execute-Verify cycle.
### 2. VS Code & Cursor (MCP Integration)
The onboarded project includes `.vscode/mcp.json`. Any MCP client (VS Code Cline, Roo Code, Continue.dev, Claude Code) connects directly to:
```json
{
"servers": {
"localvibecode": {
"type": "stdio",
"command": "python3",
"args": ["-m", "localvibecode.mcp_server"],
"env": {
"PYTHONPATH": "/path/to/localVibeCode/src"
}
}
}
}
```
Exposed MCP Tools:
- `localvibecode_build_graph`
- `localvibecode_blast_radius`
- `localvibecode_verify`
- `localvibecode_pev_run`
---
## π CLI Reference
| Command | Description |
| :--- | :--- |
| `localvibecode doctor` | Run environment diagnostics (Python, RAM, Ollama, Models) |
| `localvibecode init <path>` | Onboard an existing codebase for CLI, OpenCode, and VS Code |
| `localvibecode pev "<req>"` | Run end-to-end Plan $\rightarrow$ Execute $\rightarrow$ Verify with 1 local pinned model |
| `localvibecode graph` | Generate & display Graphify AST structural report & God Nodes (0 tokens) |
| `localvibecode slice <file>` | Extract 1-hop surgical context (< 4K tokens) for a specific file |
| `localvibecode verify` | Run zero-token AST check, offline security SAST, and unit tests |
| `localvibecode mcp` | Launch stdio MCP server for IDE agents |
Options:
- `--repo <path>`: Specify target project path (overrides config).
- `--model <name>`: Override Ollama model (e.g. `--model qwen2.5-coder:14b`).
- `--no-banner`: Hide ASCII logo.
---
## π»π³ DΓ nh Cho Kα»Ή SΖ° Viα»t Nam (Vietnamese Summary)
**localVibeCode** Δược thiαΊΏt kαΊΏ ΔαΊ·c thΓΉ cho cΓ‘c mΓ΄i trΖ°α»ng doanh nghiα»p Viα»t Nam (ngΓ’n hΓ ng, tΓ i chΓnh, viα»
n thΓ΄ng, cΖ‘ quan nhΓ nΖ°α»c):
- **100% KhΓ΄ng cαΊ§n Internet:** Source code, tΓ i liα»u vΓ logic nghiα»p vα»₯ khΓ΄ng bao giα» rα»i khα»i laptop.
- **KhαΊ―c phα»₯c triα»t Δα» giα»i hαΊ‘n cα»§a Local LLM (7B - 14B):**
- KhΓ΄ng nhα»i bα»«a bΓ£i hΓ ng chα»₯c file vΓ o context lΓ m AI "lΓΊ" (Lost in the Middle).
- DΓΉng **Graphify AST (0 token)** Δα» trΓch xuαΊ₯t ΔΓΊng vΓΉng αΊ£nh hΖ°α»ng (Blast-Radius < 4,000 tokens).
- Ghim cα» Δα»nh **1 model duy nhαΊ₯t trong VRAM**, chia nhα» quy trΓ¬nh thΓ nh vΓ²ng lαΊ·p **Plan $\rightarrow$ Execute $\rightarrow$ Verify** vα»i context sαΊ‘ch α» mα»i bΖ°α»c.
- Tα»± Δα»ng chαΊ‘y **AST Check + Security SAST + Unit Test** Δα» tα»± sα»a lα»i (Self-Healing) trΖ°α»c khi giao code cho dev.
---
## π License
Licensed under the [Apache License 2.0](LICENSE).
TDQS
Scored across 8 tools
The four localvibecode_ tools are distinct in purpose (graph build, context extraction, verification, pipeline run), but each has an exact aisdlc_ duplicate. Descriptions explicitly mark these as aliases, which mitigates but does not eliminate misselection risk.
Within each prefix, names follow a clear verb_noun pattern (build_graph, blast_radius, verify, pev_run), but the set mixes two different namespace prefixes (localvibecode_ vs aisdlc_), which is inconsistent across the surface.
The server registers 8 tools, but 4 are pure legacy aliases, so the real functional surface is only 4. The count is inflated by duplication rather than reflecting genuine capability.
The four real tools cover the core workflowβgraph construction, surgical context extraction, deterministic verification, and the PEV execution pipeline. Minor gaps like graph inspection/reset or model management exist but are workable around.