Autonomous AI coding agents promise to transform software development, yet existing CLI tools often introduce severe pain points: heavy runtimes, uncontrolled API token consumption leading to surprise bills, ungrounded code modifications that break existing tests, and constant telemetry harvesting developer code.
CACode is a full-lifecycle sovereign developer CLI and autonomous coding assistant written entirely in Rust. It is built from the core principle that developer privacy, tool safety, and financial transparency are non-negotiable.
The Deterministic ReAct Agent Loop
CACode executes a structured Reason + Act (ReAct) cycle. When given a complex coding prompt, it doesn't immediately blindly overwrite files. Instead, it systematically:
- Formulates an execution plan outlining architectural hypotheses and affected components.
- Uses read-only tools to inspect current implementations and test coverage.
- Applies surgical, minimal unified diffs rather than wholesale file rewrites.
- Executes local compiler checks and test suites, automatically parsing stderr/traceback logs to self-correct any errors before completing the session.
The 5 Sovereign Tools
To maximize token efficiency and eliminate context window bloat, CACode provides 5 purpose-built sovereign primitives:
read_file: Targeted line-window inspection with 100KB budget guards.patch_file: Fuzzy AST find-and-replace with 9 whitespace-tolerant matching strategies.search_files: Native ripgrep-powered regex and glob searching honoring.gitignore.execute_command: Sandboxed terminal execution with auto-truncation of excessive logs.inspect_symbols: Tree-sitter powered outline extractor for functions, structs, and methods.
Hyper Local Proxy (:8000) & Token Meter
CACode includes an embedded Hyper reverse proxy running at http://127.0.0.1:8000. It intercepts streaming SSE responses, optimizes prompt caching headers (saving up to 90% on input token costs with Anthropic and DeepSeek), and automatically handles network retries during rate limits.
SQLite Cost Detector & Creem Billing
Every single token consumed during an interactive or autonomous session is logged to an immutable local SQLite database (~/.cacode/costs.db). Enforce hard session budgets (e.g. abort if a task exceeds $0.50) and track monthly usage across models. CACode supports 100% BYOK commercial keys, fully offline Ollama/vLLM models, and managed pooled billing through Creem.