Offline coding assistant with codebase-aware debugging and a multilingual tutor mode in 8 African languages — no internet, <2GB RAM.
# AFRI-LLM-CODEX
**A fully offline, local coding assistant built for the hardware Africa actually has.**
No cloud calls, no API keys, no internet connection required at runtime. Everything — code generation, codebase-aware debugging, and multilingual explanations — runs on a single CPU-only laptop within an 8GB RAM budget.
Built for the Africa Deep Tech Challenge 2026 — Laptop LLM Challenge (`coding_assistants` domain).
---
## What it does
Three modes, one model, zero network calls:
| Mode | What it's for |
|---|---|
| **Debug / patch** (default) | Point it at real code, describe the bug, get a structured JSON patch back — grammar-constrained, not free-form prose. |
| **`--interactive`** | A persistent session: load the model once, keep asking follow-up questions, and llama.cpp's KV-cache reuse cuts response time from tens of seconds to well under one after the first call. |
| **`--pedagogical`** | Dual-language coding tutor: code + English explanation from the LLM, then a genuine translation into a regional African language from a dedicated translation model. |
## Why it's built this way
Every architectural choice here traces back to one constraint: this has to run on a laptop that may have no reliable power or internet, not a cloud GPU.
- **A small, quantized model, not a big one.** Qwen2.5-Coder-1.5B-Instruct, GGUF `Q5_K_M`, running through `llama.cpp`. Quantization compresses the model from ~7.1GB (fp32) down to ~1.2GB, at negligible accuracy cost.
- **A dependency graph, not a whole-file dump.** The DS-Code Graph (`src/semantica_context.py`) indexes a codebase into `IMPORT`/`CONTAIN`/`CALL` edges, then pulls only the function being debugged (full source) plus its direct dependencies (signature + docstring only) — keeping context focused and the token budget small.
- **A grammar, not a hope.** Output is constrained by a GBNF grammar (`grammars/json_patch.gbnf`), so the model is structurally incapable of returning anything but a valid `{"file_path", "ac …