██████╗ ██████╗ ██████╗ ███████╗██╗ ██╗
██╔════╝██╔═══██╗██╔══██╗██╔════╝╚██╗ ██╔╝
██║ ██║ ██║██║ ██║█████╗ ╚████╔╝
██║ ██║ ██║██║ ██║██╔══╝ ╚██╔╝
╚██████╗╚██████╔╝██████╔╝███████╗ ██║
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ─ V2
v2.0.0 · Local AI Coding Assistant · Termux

A persistent, daemon-based AI coding agent that runs entirely on your Android device. Codey-v2 maintains state across sessions, manages a background task queue, and uses three purpose-built models — a 7B primary agent, a 0.5B planner and summarizer, and a dedicated embedding encoder — all served locally via llama.cpp.
Security notice: Codey executes shell commands and writes files based on model output. Read the security guide before use.
./install.sh # Install everything (models, llama.cpp, PATH)
codeyd2 start # Start all three model servers and the daemon
codey2 "your task" # Send a task
codeyd2 status # Check daemon health at any time
See docs/installation.md for manual setup and model download links.
The end-to-end path for delegating work to Claude, Gemini, or Qwen is now reliable:
main.py bypasses the planner so the original request reaches the agent intact.**\filename.py`**` + fenced code blocks). Codey extracts and writes these files automatically.The hard block on shell metacharacters (&&, |, ;, 2>&1, etc.) has been removed. All commands now flow through a user confirmation prompt instead. Dangerous commands (rm, curl, wget, etc.) get an explicit warning before the prompt. YOLO mode (--yolo) skips all confirmations.
max_steps raised from 6 → 10 to handle multi-file tasks without hitting the step cap.Long sessions no longer degrade. Context compression has been completely reworked:
| Before | After | |
|---|---|---|
| Trigger threshold | 75% of context window | 55% — fires before things get tight |
| After compression | Left wherever it landed | Drops to 40% — real headroom restored |
| Message truncation | content[:300] before summarizing |
Removed — full content passed to summarizer |
| Summarizer model | 7B (same model doing your work) | 0.5B on port 8081 — fast, independent |
| What gets summarized | Everything old, one flat pass | Only dropped turns — pinned messages survive |
| Re-summarization | Could summarize a summary | Blocked — existing summaries are pinned |
Pinned messages (never dropped): file writes, patches, errors, shell results, and existing summaries. The 0.5B call is best-effort — if port 8081 is unreachable, the drop still happens and the agent keeps working.
The planning call timeout has been raised from 45 s → 180 s, with the HTTP timeout set to 165 s so the network call always resolves cleanly before the outer timeout fires.
| Model | Port | Role |
|---|---|---|
| Qwen2.5-Coder-7B Q4_K_M | 8080 | Primary agent — coding, reasoning, tool use |
| Qwen2.5-0.5B Q8_0 | 8081 | Task planning and conversation summarization |
| nomic-embed-text-v1.5 Q4 | 8082 | RAG retrieval encoder |
All three run as independent llama-server processes, managed and watchdog-monitored by codeyd2.
/review command for on-demand scans| Guide | Contents |
|---|---|
| Installation | Requirements, one-line install, manual step-by-step |
| Commands | Full reference: codeyd2, codey2, slash commands, flags, env vars |
| Configuration | Config JSON, model tuning, context management, thermal settings |
| Architecture | System diagram, memory tiers, project structure, Python API |
| Knowledge Base | Setting up RAG, indexing docs, skill repos |
| Fine-tuning | Export data, Colab training, import adapter, rollback |
| Pipeline | Training data pipeline — build fine-tuning datasets from HuggingFace + synthetic data |
| Security | Risks, mitigations, hardening summary, reporting vulnerabilities |
| Troubleshooting | Common issues, performance reference, known limitations |
| Version History | Full changelog from v1.0.0 through v2.7.0 |
| Platform | Termux on Android, or any Linux system |
| RAM | 6 GB+ available |
| Storage | ~6 GB base (7B model ~4.2 GB, 0.5B ~500 MB, embed ~80 MB, toolchain ~1 GB); ~8 GB with training pipeline |
| Python | 3.12+ |
pytest tests/ -v)Bug reports, security disclosures, and hardening contributions are especially welcome.
MIT License
$ claude mcp add Codey-v2 \
-- python -m otcore.mcp_server <graph>