@lux-tech/opencode-ai
v2.3.32
Published
opencodev2 — AI-powered development tool. Community fork of opencode (MCP auto-reconnect, hot reload, eval pipeline, memory consolidation, unified prompt); installs the opencodev2 CLI alongside the official opencode.
Maintainers
Readme
Fork notice — this repository (
menoxz/opencode) is a community fork of the official opencode with additional features (MCP auto-reconnect, hot reload, eval pipeline, memory consolidation, unified prompt). It is not affiliated with the official opencode team. See fork differences →
Installation (fork)
The fork is published on npm under the scope @lux-tech and installs its command as
opencodev2 — a distinct binary that coexists with the official opencode
(installed from opencode-ai). It also keeps its own data/config directories
(~/.local/share/opencodev2, ~/.config/opencodev2), so both products can run side
by side without touching each other's data. On the first interactive launch, the fork
offers to import your existing opencode configuration, API keys and session history —
the original installation is left untouched. See
coexistence with the official opencode.
Recommended: npm
npm install -g @lux-tech/opencode-aiVerify:
opencodev2 --version
# 1.18.59 (or the latest published version)The meta-package @lux-tech/opencode-ai automatically downloads the correct platform
binary from one of its 12 optional dependencies (see the
platform binaries table) and exposes it as the opencodev2 command.
Alternative: GitHub Releases (manual)
Release archives are published on
the releases page as .tar.gz (Linux)
and .zip (macOS / Windows). Each archive contains the compiled CLI binary at its
root — rename it to opencodev2 when installing manually so it never clashes with the
official opencode binary.
# Example: Linux x64
VERSION=v1.18.59
curl -fsSL -o opencode.tar.gz "https://github.com/menoxz/opencode/releases/download/$VERSION/opencode-linux-x64.tar.gz"
tar -xzf opencode.tar.gz
sudo mv opencode /usr/local/bin/opencodev2 # distinct name, no clash with the official binary# Example: Windows x64 (PowerShell)
$VERSION = "v1.18.59"
Invoke-WebRequest -Uri "https://github.com/menoxz/opencode/releases/download/$VERSION/opencode-windows-x64.zip" -OutFile opencode.zip
Expand-Archive -Path opencode.zip -DestinationPath . -Force
Move-Item .\opencode.exe "$env:LOCALAPPDATA\Microsoft\WindowsApps\opencodev2.exe" -ForceBinary location
| Install method | Binary path |
|---|---|
| npm (Windows) | %APPDATA%\npm\opencodev2.exe |
| npm (Linux / macOS) | $(npm prefix -g)/bin/opencodev2 |
| GitHub release (manual) | wherever you placed it |
Update
# Built-in updater (fetches the latest @lux-tech/opencode-ai release)
opencodev2 upgrade
# Or via npm
npm update -g @lux-tech/opencode-aiUninstall
npm uninstall -g @lux-tech/opencode-aiOn Windows, also remove the stale shim if npm left one behind:
Remove-Item "$env:APPDATA\npm\opencodev2*" -Force -ErrorAction SilentlyContinueCoexistence with the official opencode
The fork (@lux-tech/opencode-ai) installs its command as opencodev2, while the
official opencode (opencode-ai) installs opencode. The two names never clash, and
the fork uses its own data directories
(~/.local/share/opencodev2, ~/.config/opencodev2, ~/.local/state/opencodev2,
~/.cache/opencodev2), so both can be installed and used at the same time.
First-run migration wizard
On the first interactive launch, opencodev2 detects whether a previous opencode
installation exists (config, API keys, sessions) and asks what to do:
- Import (recommended) — copies your config, credentials (
auth.json) and session history (opencode.db) from the original opencode directories into the opencodev2 directories. The original data is left untouched. - Later — starts fresh and asks again at the next launch.
- Never — starts with empty opencodev2 data (a marker file prevents further prompts).
Headless environments (CI, scripts) can force the behaviour:
OPENCODEV2_MIGRATE=copy opencodev2 ... # import non-interactively
OPENCODEV2_MIGRATE=skip opencodev2 ... # skip and mark as decidedThe wizard runs only once per data directory (a .migrate-state marker records the
decision). After an import, the copied database belongs to opencodev2 — subsequent
opencodev2 database migrations never touch the original opencode installation.
Which one should you use?
| Need | Use |
|---|---|
| MCP auto-reconnect, hot reload, eval pipeline, memory consolidation, unified prompt | This fork (opencodev2) |
| The official, widely-validated release | official opencode (opencode) |
Both stay up to date independently:
opencodev2 upgrade # updates the fork (@lux-tech/opencode-ai)
opencode upgrade # updates the official opencode (opencode-ai)Platform binaries
@lux-tech/opencode-ai ships as a meta-package with 12 optional platform binaries
(all published at the same version):
| Package | Platform / CPU | Notes |
|---|---|---|
| @lux-tech/opencode-ai-darwin-arm64 | macOS arm64 | Apple Silicon |
| @lux-tech/opencode-ai-darwin-x64 | macOS x64 | Intel |
| @lux-tech/opencode-ai-darwin-x64-baseline | macOS x64 | CPUs without AVX2 |
| @lux-tech/opencode-ai-linux-arm64 | Linux arm64 | |
| @lux-tech/opencode-ai-linux-arm64-musl | Linux arm64 | Alpine / musl |
| @lux-tech/opencode-ai-linux-x64 | Linux x64 | |
| @lux-tech/opencode-ai-linux-x64-baseline | Linux x64 | CPUs without AVX2 |
| @lux-tech/opencode-ai-linux-x64-baseline-musl | Linux x64 | musl, no AVX2 |
| @lux-tech/opencode-ai-linux-x64-musl | Linux x64 | Alpine / musl |
| @lux-tech/opencode-ai-windows-arm64 | Windows arm64 | |
| @lux-tech/opencode-ai-windows-x64 | Windows x64 | |
| @lux-tech/opencode-ai-windows-x64-baseline | Windows x64 | CPUs without AVX2 |
Server mode: run headless, attach with the TUI
opencodev2 normally runs the TUI and the harness in one process. To keep a
session alive without a TUI — or to watch a running harness from a second
terminal — split the two:
opencodev2 serve --port 4096 # headless harness; prints the bound URL
opencodev2 attach http://localhost:4096serve exposes the harness over HTTP (its API and event stream) and owns the
sessions, so it is independent of any client. attach points a full TUI at that
server instead of spawning its own: the session you see is the one the server
holds, so it outlives the TUI and can be inspected from anywhere the server is
reachable.
| Flag (serve) | Effect |
|---|---|
| --port | port to bind (0 = OS-assigned) |
| --hostname | interface to bind (default 127.0.0.1) |
| --mdns / --mdns-domain | advertise the server on the local network |
| --cors | allowed origins for browser clients |
Serving beyond loopback requires a password (OPENCODE_SERVER_PASSWORD), and
serve refuses to start without one.
attach <url> accepts --dir (working directory; a path on the remote server
when attaching), --session / --continue / --fork, and
--password / --username (Basic auth; default to OPENCODE_SERVER_PASSWORD
and OPENCODE_SERVER_USERNAME, or opencode). When nothing is listening on a
local URL, attach starts serve on that port for you.
Both commands start the background daemon if it is not already running. For
non-interactive or CI use, opencodev2 run --headless drives the same harness as
a batch subprocess, and run --attach <url> is its counterpart when the batch
client should talk to a server you started yourself.
Agents
OpenCode includes two built-in agents you can switch between with the Tab key.
- build - Default, full-access agent for development work
- plan - Read-only agent for analysis and code exploration
- Denies file edits by default
- Asks permission before running bash commands
- Ideal for exploring unfamiliar codebases or planning changes
Also included is a general subagent for complex searches and multistep tasks.
This is used internally and can be invoked using @general in messages.
The fork additionally ships a planner agent that auto-decomposes tasks before execution. Learn more about agents in the official docs — behavior is compatible with upstream.
Documentation
- Fork-specific docs live in this repository:
docs/(architecture, ADRs, hot reload & MCP design) andCHANGELOG.md. - General configuration docs are compatible with the official documentation: opencode.ai/docs.
Fork Differences
This fork (menoxz/opencode) adds the following features on top of upstream:
| Feature | Description |
|---------|-------------|
| MCP Auto-reconnect | MCP servers whose connection dies are detected (transport events + health ping) and reconnected automatically with exponential backoff — no more stale "connected" status or dead sessions |
| Hot Reload | Agents, plugins, and MCP servers reload automatically on file change — no restart needed |
| Eval Pipeline | SQLite-backed evaluation with regression detection, trend analysis, and compare CLI commands |
| Memory Consolidation | Cross-session memory with auto-decay, pattern detection, and post-mortem analysis |
| Unified Prompt | Single core.txt replaces 10 model-specific prompts — cleaner, smaller, easier to maintain |
| Continuous Improvement | Methods are living documents — update existing skills with changelog instead of creating duplicates |
| Planner Integration | Built-in planner agent auto-decomposes tasks before execution |
| opencodev2 identity + migration | Installs as opencodev2 with its own data directories, so it coexists with the official opencode; a first-run wizard imports your config, API keys and session history on request |
New features are versioned in CHANGELOG.md.
Contributing
If you're interested in contributing to this fork, please read our
contributing docs before submitting a pull request.
Pull requests target the dev branch.
Building on OpenCode
If you are working on a project that's related to OpenCode and is using "opencode" as part of its name, for example "opencode-dashboard" or "opencode-mobile", please add a note to your README to clarify that it is not built by the OpenCode team and is not affiliated with us in any way.
Report issues on GitHub Issues · Source github.com/menoxz/opencode

