offcode-0.1.2 is not a library.
offcode
╭──────────╮
│ ◉ ◉ │ offcode model:gemma4:e4b
│ ╰──╯ │ offline coding assistant
╰──────────╯ powered by ollama · type a prompt to begin

What is this?
This is a commandline based coding agent that it's really 100% offline, it just connect to ollama locally. I created this this because projects like opencode makes tcp connections even using offline mode. Use your favourite Ollama model for coding your private projects. No cloud. No API keys. No telemetry. Just you and your model.
Works like Claude Code or OpenCode but talks only to a local Ollama instance but keeping your privacy.
Features
- Full TUI — scrollable chat interface with live streaming output
- Tool use — reads/writes files, runs shell commands, searches code
- Agentic loop — chains multiple tool calls autonomously until the task is done
- Think support — shows or hides Qwen3/Deepseek reasoning tokens
- Config file — persistent settings at
~/.config/offcode/config.toml - Pure Rust — minimal dependencies, static Linux binaries, no runtime deps
- Single-shot mode — pipe-friendly for scripting
Requirements
-
Ollama running locally (
ollama serve) -
download a good model: ollama pull gemma4:e4b
Install
From cargo
cargo install offcode
From source
# or
Usage
# recommended way: Interactive TUI
# Single prompt (non-interactive, pipe-friendly)
# Different model
# Show thinking tokens (Qwen3, DeepSeek-R1, etc.)
# Plain terminal mode (no TUI)
TUI key bindings
| Key | Action |
|---|---|
Enter |
Send message |
↑ / ↓ |
Scroll messages |
PgUp / PgDn |
Scroll faster |
← / → |
Move cursor in input |
Home / End |
Jump to start/end of input |
Backspace |
Delete char before cursor |
Ctrl+C |
Quit |
REPL commands (TUI and --no-tui)
| Command | Action |
|---|---|
/help |
Show help |
/clear |
Clear conversation history |
/tools |
List available tools |
/model <name> |
Switch Ollama model |
/think |
Toggle thinking token display |
/exit |
Quit |
Available tools
| Tool | Description |
|---|---|
read_file |
Read file contents (with line numbers for code) |
write_file |
Write or overwrite a file |
run_command |
Execute shell commands |
list_dir |
List directory contents |
search_files |
Search for patterns recursively |
create_dir |
Create directories |
delete_path |
Delete a file or empty directory |
path_info |
File/directory metadata |
Configuration
Config file is created automatically at first run:
macOS: ~/Library/Application Support/offcode/config.toml
Linux: ~/.config/offcode/config.toml
= "gemma4:e4b"
= "http://localhost:11434"
= 0.6
= 16384
= false
= 30
= "You are offcode..."
View current config:
Cross-compilation
# Install cross (needs Docker)
# Build for all platforms
# Outputs to dist/:
# offcode-<ver>-linux-x86_64 (static, runs on any Linux)
# offcode-<ver>-linux-arm64 (static, Raspberry Pi / Graviton)
# offcode-<ver>-macos-x86_64 (Intel Mac)
# offcode-<ver>-macos-arm64 (Apple Silicon)
# offcode-<ver>-macos-universal (fat binary, both)
Dependencies
| Crate | Purpose |
|---|---|
ureq |
HTTP client for Ollama API (pure Rust, no tokio) |
serde + serde_json |
JSON serialization |
toml |
Config file parsing |
dirs |
XDG config directory |
ratatui |
Terminal UI |
No async runtime. No OpenSSL. Fully offline after model is pulled.
License
MIT