Skip to content
sphinxidPublic

About

opencode v2 rewritten in Rust: a drop-in replacement with the same CLI, TUI, HTTP API, config and data, in one self-contained binary that starts faster and uses a fraction of the memory.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

ocd

ocd is opencode v2, the terminal AI coding agent, rewritten in Rust. It has the same CLI, TUI, HTTP API, config files and data folders, and it starts faster and uses far less memory.

  • Drop-in: it reads your opencode.json, .opencode/, ~/.config/opencode, sessions, credentials, plugins and OPENCODE_* variables. Only the program is renamed: the binary is ocd and the logo reads opencode-d.
  • Up to date: it tracks opencode 2.3.1 (tag v2.3.1, commit c769de8) and is compared against it side by side (how).
  • One self-contained binary: TUI, server and web UI. It upgrades itself from its own releases with ocd upgrade.

Warning

ocd uses the same data folder as opencode: your real sessions and credentials, with the v2 database migrations applied. To try it without touching them, use the sandbox.

Install

curl -fsSL https://raw.githubusercontent.com/sphinxid/ocd/main/scripts/install.sh | bash

No curl? Use wget -qO- https://raw.githubusercontent.com/sphinxid/ocd/main/scripts/install.sh | bash.

The script installs the latest release for your system as ~/.local/bin/ocd (no root needed), checks it against the release checksums and adds ~/.local/bin to your PATH if it isn't there. Run it again to update; if ocd was already installed, it also restarts the background service.

Platform Supported
Linux x86_64 and ARM64 glibc 2.17 or newer: RHEL/CentOS 7+, Ubuntu 14.04+, Debian 8+ (not Alpine/musl)
macOS Apple silicon
Windows x86_64 Download the .zip from Releases

Installer options, manual installs and upgrading: docs/INSTALL.md.

Quick start

ocd auth login                            # sign in to a provider (or use /connect in the TUI)
ocd                                       # open the TUI in the current project
ocd run "explain this repo" -m provider/model
ocd serve                                 # HTTP API and web UI in the foreground
ocd upgrade                               # install the latest release
ocd --help

The TUI starts a background server that keeps running after you quit, like upstream's, so later runs connect instantly. Manage it with ocd service status|stop|restart, or run ocd --standalone to skip it. More in docs/USAGE.md.

Speed and size

Linux x86_64, the official opencode 2.2.7 release binary and an ocd release build (mimalloc and whole-program optimisation, after v0.3.4), the same mock model and isolated folders; medians of 9 runs (5 server starts), measured 2026-11-17:

Measure opencode 2.2.7 ocd
run with one tool call 1.92 s 0.73 s
Server ready after start 284 ms 50 ms
Idle server memory 147 MB 29 MB
Peak memory during run 313 MB 228 MB
Binary size (web UI included) 259 MB 103 MB

Compatibility at a glance

Status Areas
✅ Same as upstream Sessions and history, the agent loop, permissions, built-in tools, Code Mode, agents/commands/skills, config and policies, all chat providers and sign-in methods (API keys, OAuth, ChatGPT, GitHub Copilot, Azure, AWS and Google cloud credentials, the Claude Agent provider), MCP servers, server plugins and AI SDK packages, the editor integration (ACP), the full TUI and ocd mini, web UI, HTTP API (173 endpoints), /goal, background compaction, background service, git and worktrees, Mercurial, the desktop browser attachment, --wizard, v1 history import
🟡 Small differences Plugins run in a Bun helper that is downloaded on first use; a few error texts; code-block colours in ocd mini
⛔ Not yet TUI plugins, speech and video models, image previews in the terminal, a few other experimental features
✨ Different on purpose A working status line in the TUI, ocd upgrade from ocd's own releases, ocd --version shows ocd's own version

257 of 263 side-by-side scenarios produce identical output against opencode 2.3.1; the other six differ only by the renames, the test build's file name, two upstream timing races and the order of instantly failing tool calls. Details: docs/COMPATIBILITY.md.

CI runs the whole test suite on macOS, Windows and Linux ARM on every push to main; the side-by-side comparison with upstream runs on Linux x86_64.

Build from source

git clone https://github.com/sphinxid/ocd.git && cd ocd
cargo build --release -p ocd          # needs Rust 1.88+ and a C compiler
./target/release/ocd --version        # ocd v0.4.1+1a2b3c4 (opencode 2.3.1)

Web UI, version stamping, tests and releases: docs/BUILDING.md.

Documentation

Guide What's in it
Install and upgrade Installer options, release files, manual install, ocd upgrade and update checks
Using ocd Commands, the background service, sandbox, environment variables, certificates, troubleshooting
Compatibility What matches upstream, what differs and what's missing, and how it's compared
Building and contributing Building, web UI, testing, releases, repository layout
Parity results The side-by-side comparison with upstream, scenario by scenario
Porting rules and state How the port is done, and where it stands

License

MIT, see LICENSE. ocd is a derivative of opencode, which is also MIT-licensed (copyright opencode), see LICENSE-opencode.

About

opencode v2 rewritten in Rust: a drop-in replacement with the same CLI, TUI, HTTP API, config and data, in one self-contained binary that starts faster and uses a fraction of the memory.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages