A Rust implementation of OpenCode
OpenCodeRust is the Rust implementation and evolution of OpenCode. It provides a full CLI/TUI/Server workflow for local AI coding agents, session management, tool invocation, MCP/LSP integration, and plugin extensions.
- Project name:
OpenCodeRust - Executable:
opencode(kept for backward compatibility)
- Interaction modes: TUI (default), CLI single run, HTTP server, Web/ACP mode
- Sessions: Create, continue, fork sessions; import/export
- Tool system: Built-in read/write/edit, shell, patch, and related tools
- Model support: Multiple providers, agent mode switching
- Extensibility: Plugin bridge (including TS plugins), MCP, LSP
- Terminal: Improved layout, collapsible sidebar, syntax highlighting, path completion
- Rust stable
- Cargo
- Git (recommended)
cargo build -p opencode-cliTo avoid running another OpenCode (e.g. npm/global) on your PATH when using OpenCodeRust, run from the repo root:
./target/debug/opencodeaftercargo build -p opencode-clicargo run -p opencode-cli --to always use this repo's version
./target/debug/opencode --helpor
cargo run -p opencode-cli -- --help- Default: start TUI:
cargo run -p opencode-cli --- Start TUI explicitly:
cargo run -p opencode-cli -- tui- Single non-interactive run:
cargo run -p opencode-cli -- run "Check this repo for risks"- Start HTTP server:
cargo run -p opencode-cli -- serve --port 3000 --hostname 127.0.0.1From the repo root use ./target/debug/opencode or cargo run -p opencode-cli --. These commands match the current ./target/debug/opencode --help:
tui– Start interactive terminal UIattach– Attach to a running serverrun– Run a single messageserve– Start HTTP serverweb– Start headless server and open web UIacp– Start ACP servermodels– List available modelssession– Session managementstats– Token/cost statisticsdb– Database toolsconfig– Show configurationauth– Credential managementagent– Agent managementdebug– Debugging and troubleshootingmcp– MCP managementexport/import– Export/import sessionsgithub/pr– GitHub-related featuresupgrade/uninstall– Upgrade and uninstallgenerate– Generate OpenAPI specversion– Show version
Subcommand help:
./target/debug/opencode tui --help
./target/debug/opencode run --help
./target/debug/opencode serve --help
./target/debug/opencode session --helpConfiguration is merged from the following paths in priority order (searched upward):
opencode.jsoncopencode.json.opencode/opencode.jsonc.opencode/opencode.json
Global config default path:
- Linux/macOS:
~/.config/opencode/opencode.jsonc(or.json)
See: docs/opencode-config.md
crates/opencode-cli– CLI entrypoint (binary:opencode)crates/opencode-server– HTTP/SSE/WebSocket servercrates/opencode-tui– Terminal UIcrates/opencode-session– Sessions and messagescrates/opencode-tool– Tool registration and executioncrates/opencode-provider– Model provider adapterscrates/opencode-plugin– Plugin system and subprocess bridgecrates/opencode-mcp– MCP client and registrationcrates/opencode-lsp– LSP supportcrates/opencode-storage– SQLite storage
cargo fmt
cargo check
cargo clippy --workspace --all-targetsMinimal check (typical):
cargo check -p opencode-cli
cargo check -p opencode-tui- User guide:
USER_GUIDE.md - Docs index:
docs/README.md - CLI:
docs/opencode-cli.md - TUI:
docs/opencode-tui.md - Server:
docs/opencode-server.md - Tools:
docs/opencode-tool.md - Provider:
docs/opencode-provider.md - Config:
docs/opencode-config.md
- The executable name remains
opencodefor backward compatibility. OpenCodeRust is the project name.