Skip to content

wrencode

wrencode is a minimal agentic coding assistant in a single Python file. A lightweight, hackable alternative to Claude Code: the whole tool-calling agent loop fits in one readable file, runs against local or hosted models, and is yours to hack.

Named after Harold Wren, the alias of a genius who built a superintelligent AI and operated quietly in the background.

wrencode on GitHub →

The guided installer detects your OS and architecture, downloads the matching binary from the latest GitHub Release, and installs it to ~/.local/bin (no sudo).

Terminal window
curl -LsSf https://almostly.ai/wrencode/install.sh | sh

Pin a version or change the install location:

Terminal window
curl -fsSL https://almostly.ai/wrencode/install.sh \
| WRENCODE_INSTALL_DIR=/usr/local/bin WRENCODE_VERSION=0.1.3 sh

Grab the binary for your platform from the latest GitHub Release:

  • macOS Apple Silicon: wrencode-macos-arm64
  • macOS Intel: wrencode-macos-x64
  • Linux x64: wrencode-linux-x64

Make it executable and move it onto your PATH:

Terminal window
chmod +x wrencode-macos-arm64
sudo mv wrencode-macos-arm64 /usr/local/bin/wrencode

Single file, standard library only (except the backend you choose).

Terminal window
git clone https://github.com/almostly/wrencode
cd wrencode
python3 wrencode.py

Backend-specific dependencies, if you need them:

Terminal window
pip install mlx-lm # MLX on Apple Silicon
pip install transformers torch # HuggingFace Transformers

First launch prompts for a backend and saves it to ~/.wrencode/config.json. Re-pick at any time:

Terminal window
wrencode --configure

Override the saved choice for a single session (useful in CI):

Terminal window
BACKEND=anthropic wrencode
BACKEND=openai MODEL=gpt-4o wrencode
BACKEND=openrouter MODEL=anthropic/claude-3-haiku wrencode
BACKEND=ollama MODEL=llama3.2 wrencode
BACKEND=transformers MODEL=deburky/gpt-oss-claude-code python3 wrencode.py
BACKEND=local LOCAL_PORT=8082 wrencode

For headless runs, skip the y/N confirmation on writes and shell commands:

Terminal window
wrencode --yes
BackendDescriptionAvailability
anthropicClaude via the Anthropic APIbinary + source
openaiGPT models via the OpenAI APIbinary + source
openrouterAny model via OpenRouterbinary + source
ollamaLocal models via a running ollama servebinary + source
localLocal proxy via an Anthropic-compatible APIbinary + source
transformersHuggingFace Transformers (CPU / MPS / GPU)source install only
mlxApple Silicon via MLXsource install, macOS

The standalone binary can’t bundle the heavy ML stack, so mlx and transformers are only offered when running from source.

Default local models: deburky/gpt-oss-claude-code (transformers) and deburky/gpt-oss-claude-mlx (MLX). Override either with MODEL=....

The agent has seven tools available in the loop:

  • 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 using rg when available, falling back to grep
  • 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. Set WRENCODE_UNRESTRICTED_PATHS=1 to allow paths outside the workspace.

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). For autonomous runs, enable --yes or WRENCODE_AUTO_APPROVE=1 so sub-tool calls don’t block on confirmation.

CommandDescription
/helpShow available commands
/cClear conversation history
/compactSummarize history to reduce context (mlx only)
/q or exitQuit
VariableDefaultDescription
BACKENDchooser / saved configOverride the saved inference backend
MODELbackend-dependentModel path or ID
WRENCODE_CONFIG_DIR~/.wrencodeDir for config.json (saved backend / key)
WRENCODE_WORKSPACEcwdRoot directory for file operations
WRENCODE_HISTORY_FILE~/.wrencode/history.jsonConversation history file path
WRENCODE_UNRESTRICTED_PATHS0Allow paths outside the workspace
WRENCODE_AUTO_APPROVE0Skip y/N confirmation for writes / shell (headless; also --yes)
WRENCODE_MAX_SUBAGENT_DEPTH2Max nested subagent recursion depth (task tool)
MAX_TOKENS4096Max tokens per response
MAX_READ_BYTES4MBMax file size to read
MAX_READ_LINES800Max lines returned per read
GREP_MAX_MATCHES80Max grep results
BASH_TIMEOUT120Shell command timeout in seconds
MAX_TOOL_OUTPUT_CHARS48000Max tool output before truncation
GLOB_SKIP_DIRS.git,node_modules,...Directories to skip in glob
ANTHROPIC_API_KEYAnthropic API key
OPENAI_API_KEYOpenAI API key
OPENROUTER_API_KEYOpenRouter API key
LOCAL_API_KEYlocalLocal proxy API key
LOCAL_PORT8082Local proxy port
OLLAMA_HOSThttp://localhost:11434Ollama server base URL

Conversation history is persisted to ~/.wrencode/history.json by default and restored on the next launch. Override the path with WRENCODE_HISTORY_FILE. Clear it with /c in-session, or delete the file.

MIT. Copyright 2026 Almostly.