A minimal agentic coding assistant in a single Python file
Project description
🐦 WrenCode
A minimal agentic coding assistant in a single Python file.
Named after Harold Wren - the alias of a genius who built a superintelligent AI and operated quietly in the background.
What it is
WrenCode is a lightweight alternative to Claude Code. It runs a tool-calling agent loop locally or via API, giving an LLM the ability to read, write, and edit files, search codebases, and run shell commands - enough to autonomously navigate and modify a real project.
Where Claude Code is the batteries-included tool, WrenCode is the "understand and own your agent" tool: the entire agent loop fits in one readable file, runs against local or hosted models, and is yours to hack.
Backends
On first run WrenCode asks you to pick a backend and saves the choice to
~/.wrencode/config.json. Run wrencode --configure any time to change it.
Set BACKEND (and the matching API key) in the environment to override the
saved choice, e.g. for CI.
| Backend | Description | Availability |
|---|---|---|
anthropic |
Claude via Anthropic API | binary + source |
openai |
GPT models via OpenAI API | binary + source |
openrouter |
Any model via OpenRouter | binary + source |
ollama |
Local models via a running ollama serve |
binary + source |
local |
Local proxy via Anthropic-compatible API | binary + source |
transformers |
HuggingFace Transformers (CPU/MPS/GPU) | source install only |
mlx |
Apple Silicon via MLX | source install, macOS |
The standalone binary can't bundle the heavy ML stack, so the local-weights
backends (mlx, transformers) are only offered when running from source.
The default local models are
deburky/gpt-oss-claude-code
(transformers) and
deburky/gpt-oss-claude-mlx
(MLX) — override either with MODEL=....
Tools
The agent has access to seven tools:
- read - read a file with line numbers, or list a directory
- write - write content to a file
- edit - replace a unique string in a file
- glob - find files by pattern, sorted by modification time
- grep - search files for a regex pattern using
rgwhen available, falling back togrep - bash - run a shell command with timeout and streaming output
- task - delegate a self-contained subtask to a fresh subagent (its own context, same tools) that returns only its final result
All file operations are sandboxed to the workspace root by default.
Subagents
The task tool runs a nested agent loop on a fresh message history, so the
parent's context only grows by the returned summary — useful for context-heavy
subtasks. Recursion is capped by WRENCODE_MAX_SUBAGENT_DEPTH (default 2), and
each subagent round is bounded. For autonomous subagent runs, enable
--yes / WRENCODE_AUTO_APPROVE so sub-tool calls don't block on confirmation.
Installation
Option 1: Standalone binary (recommended)
Run the guided installer:
curl -fsSL https://raw.githubusercontent.com/almostly/wrencode/main/install.sh | sh
It detects your OS/arch, downloads the matching binary from the latest GitHub
Release, and installs it to ~/.local/bin (no sudo). Override the location with
WRENCODE_INSTALL_DIR, or pin a release with WRENCODE_VERSION:
curl -fsSL https://raw.githubusercontent.com/almostly/wrencode/main/install.sh \
| WRENCODE_INSTALL_DIR=/usr/local/bin WRENCODE_VERSION=0.1.3 sh
Or download and run it locally:
curl -fsSL https://raw.githubusercontent.com/almostly/wrencode/main/install.sh -o install.sh
chmod +x install.sh
./install.sh
Manual install (fallback): download the right binary from GitHub Releases, make it executable, and move it into your PATH.
macOS Apple Silicon:
curl -L https://github.com/almostly/wrencode/releases/latest/download/wrencode-macos-arm64 -o wrencode
chmod +x wrencode
sudo mv wrencode /usr/local/bin/wrencode
macOS Intel:
curl -L https://github.com/almostly/wrencode/releases/latest/download/wrencode-macos-x64 -o wrencode
chmod +x wrencode
sudo mv wrencode /usr/local/bin/wrencode
Linux x64:
curl -L https://github.com/almostly/wrencode/releases/latest/download/wrencode-linux-x64 -o wrencode
chmod +x wrencode
sudo mv wrencode /usr/local/bin/wrencode
Option 2: Run from source
Single file, standard library only (except the backend you choose).
git clone https://github.com/almostly/wrencode
cd wrencode
For MLX (Mac Silicon):
pip install mlx-lm
For Anthropic:
pip install anthropic # not required - uses urllib directly
export ANTHROPIC_API_KEY=your_key
For OpenAI:
export OPENAI_API_KEY=your_key
For OpenRouter:
export OPENROUTER_API_KEY=your_key
For HuggingFace Transformers:
pip install transformers torch
Usage
# Standalone binary — prompts for a backend on first run
wrencode
# Re-pick the backend at any time
wrencode --configure
# Or from source — also prompts on first run
python3 wrencode.py
# Anthropic Claude
BACKEND=anthropic python3 wrencode.py
# OpenAI
BACKEND=openai MODEL=gpt-4o python3 wrencode.py
# OpenRouter
BACKEND=openrouter MODEL=anthropic/claude-3-haiku python3 wrencode.py
# Ollama (needs `ollama serve` running and the model pulled)
BACKEND=ollama MODEL=llama3.2 python3 wrencode.py
# HuggingFace model
BACKEND=transformers MODEL=deburky/gpt-oss-claude-code python3 wrencode.py
# Local proxy
BACKEND=local LOCAL_PORT=8082 python3 wrencode.py
Releasing binaries
Binaries are built automatically by GitHub Actions when you push a version tag:
git tag v0.1.0
git push origin v0.1.0
This publishes release assets:
wrencode-linux-x64wrencode-macos-x64wrencode-macos-arm64
Slash Commands
| Command | Description |
|---|---|
/help |
Show available commands |
/c |
Clear conversation history |
/compact |
Summarize history to reduce context (mlx only) |
/q or exit |
Quit |
Environment Variables
| Variable | Default | Description |
|---|---|---|
BACKEND |
chooser/saved config | Override the saved inference backend |
MODEL |
backend-dependent | Model path or ID |
WRENCODE_CONFIG_DIR |
~/.wrencode |
Dir for config.json (saved backend/key) |
WRENCODE_WORKSPACE |
cwd | Root directory for file operations |
WRENCODE_HISTORY_FILE |
~/.wrencode/history.json |
Conversation history file path |
WRENCODE_UNRESTRICTED_PATHS |
0 |
Allow paths outside workspace |
WRENCODE_AUTO_APPROVE |
0 |
Skip y/N confirmation for writes/commands (headless; also --yes) |
WRENCODE_MAX_SUBAGENT_DEPTH |
2 |
Max nested subagent recursion depth (task tool) |
MAX_TOKENS |
4096 |
Max tokens per response |
MAX_READ_BYTES |
4MB |
Max file size to read |
MAX_READ_LINES |
800 |
Max lines returned per read |
GREP_MAX_MATCHES |
80 |
Max grep results |
BASH_TIMEOUT |
120 |
Shell command timeout in seconds |
MAX_TOOL_OUTPUT_CHARS |
48000 |
Max tool output before truncation |
GLOB_SKIP_DIRS |
.git,node_modules,... |
Directories to skip in glob |
OPENROUTER_API_KEY |
- | OpenRouter API key |
OPENAI_API_KEY |
- | OpenAI API key |
ANTHROPIC_API_KEY |
- | Anthropic API key |
LOCAL_API_KEY |
local |
Local proxy API key |
LOCAL_PORT |
8082 |
Local proxy port |
OLLAMA_HOST |
http://localhost:11434 |
Ollama server base URL |
History
Conversation history is persisted to ~/.wrencode/history.json by default. It is restored automatically on next launch.
To override the history file location, set WRENCODE_HISTORY_FILE to a custom path.
To clear history: use /c in the session, or delete ~/.wrencode/history.json (or your override path).
License
MIT - Copyright 2026 Almostly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wrencode-0.1.4.7.tar.gz.
File metadata
- Download URL: wrencode-0.1.4.7.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
407d05d1b9e216cea2bb0109e377a0332fe92bcb87ccfe71b3b8600906c12573
|
|
| MD5 |
6eebfcf28a90231b88353a018ac6917e
|
|
| BLAKE2b-256 |
10e3bf70145dc2c5b83e8149ac1b188fb786d3208103d76c00f9f9e52ffc5baf
|
File details
Details for the file wrencode-0.1.4.7-py3-none-any.whl.
File metadata
- Download URL: wrencode-0.1.4.7-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
573bf7b67936bd8f669a7d3f16b818b3a7a9e56160c7f14cabef160797b622b6
|
|
| MD5 |
d7fface0ac195bd1f6460cf0c3b711f4
|
|
| BLAKE2b-256 |
253f1e2faa2e5f0dea15b39693aae2b4434cd7c4300b6cd44330857bb76fa25e
|