Portable, 100% offline competitive programming AI assistant powered by local LLMs (llama.cpp + GGUF models with automatic Vulkan GPU / CPU acceleration), automated sample-test extraction, sandboxed code execution, and an iterative self-repair & rethink loop for Python and JavaScript.
Every generated solution is strictly syntax-checked and executed against the problem's sample inputs inside the bundled portable runtime — a solution is never marked PASS unless it passes the extracted examples.
flowchart TD
A["Problem Statement (Codeforces / UVa / LeetCode)"] --> B["Example Extractor (Regex + LLM Fallback)"]
B --> C["Local LLM Inference (llama.cpp GGUF · Qwen3.5 4B/9B)"]
C --> D["Code Extraction & Syntax Validation"]
D --> E["Sandboxed Runner (Portable Python 3.12 / Node 24 + Timeout)"]
E -->|"All Samples Match"| F["PASS — Verified Solution Ready to Copy"]
E -->|"Mismatch / Runtime Error"| G{"Attempts < max_repair_attempts?"}
G -->|"Yes"| H["Repair Prompt (Input, Expected, Actual, Stderr)"]
H --> C
G -->|"No"| I["Rethink Prompt (Alternative Algorithm Approach)"]
I --> C
- 100% Offline & Zero-Install Portability — Runs directly from a local folder or USB drive with embedded Python 3.12, Node 24, and
llama.cppbinaries (no admin privileges or Internet required). - Hardware-Aware Profile Auto-Selection — Automatically detects available free RAM and Vulkan GPU support to select between
MEDIUM(4B model, ~5 GB RAM) andHIGH(9B model, ~10 GB RAM). - Zero-Framework Architecture — Backend written purely with the Python Standard Library (
app/) and a lightweight Vanilla HTML/JS web UI (web/) served onhttp://127.0.0.1:8765/. - Web UI + CLI Fallback — Paste statements into the browser UI or invoke headless solving straight from the terminal.
- Automated Unit Tests — Includes 17 offline unit tests (
tests/test_units.py) validating example parsing, output comparison, runners, and code extraction without requiring a loaded LLM.
| Directory / File | Purpose |
|---|---|
app/ |
Zero-dependency Python backend (server, example parser, solver loop, sandboxed runners) |
web/ |
Lightweight local web interface (Vanilla HTML/CSS/JS) |
prompts/ |
Structured prompts (solve, repair, rethink, extract_examples) |
config/config.json |
Hardware profiles, timeouts, ports, and sampling configuration |
tests/ |
Offline unit test suite (test_units.py) and benchmark problems |
tools/ |
Developer utilities (fetch_deps.py to bundle llama.cpp, runtimes & GGUF models; bench.py) |
CodeSolver.bat / CodeSolver.sh |
Cross-platform one-click launchers |
# Download llama.cpp, portable Python/Node runtimes, and Qwen3.5 9B/4B GGUF models
python tools/fetch_deps.py
# Optional extra models
python tools/fetch_deps.py --only coder7b,model2b
# Run the offline unit test suite (no LLM required)
python -X utf8 tests/test_units.py -v- Web UI: Run
CodeSolver.bat(Windows) or./CodeSolver.sh(Linux/macOS), openhttp://127.0.0.1:8765/, paste a statement, pick Python or JavaScript, and press Solve (Ctrl + Enter). - CLI Mode:
CodeSolver.bat solve problem.txt --lang python --out solution.pyThis tool does not hide processes or bypass system/proctoring restrictions. Always verify that offline assistants are permitted under the rules of your event or practice environment before use.
See also CodeSolver_Plan_Maestro.md and docs/TROUBLESHOOTING.md.
Released under the MIT License.