nelli-ocode — chat‑first coding agent with plan/completion guardrails, multi‑provider support, and Bun‑native tools.
This fork stays close to upstream opencode and adds:
- Chat‑first entry (TUI by default via
ocode) - Plan and completion guards enabled by default
- Full local edit permissions by default, with
--safeto require approvals - Prompt optimizer for user messages (can be disabled)
- Multi‑provider wrapper for OpenRouter, local OpenAI‑compatible servers (e.g. llama.cpp), and CBORG
You can use nelli‑ocode anywhere opencode is used.
- Install the upstream CLI (one‑time):
curl -fsSL https://opencode.ai/install | bash- Install the wrapper from this repo:
make ocode-install- Start chat with your provider:
# OpenRouter (requires OPENROUTER_API_KEY)
ocode openrouter --model x-ai/grok-4-fast:free
# Local llama.cpp (OpenAI‑compatible server)
ocode local --url http://localhost:8080/v1 --model default
# CBORG (requires CBORG_API_KEY)
ocode cborg --model lbl/cborg-coder:latestRequirements
- Bun (>= 1.2) and Go (>= 1.24)
Build and install the CLI from this repo (no opencode.ai installer):
# from repo root
make cli-install # builds and installs /usr/local/bin/opencode
make ocode-install # installs /usr/local/bin/ocode (chat-first wrapper)
# optional helpers
make ocode-links # installs ocode-openrouter, ocode-local, ocode-cborgUpgrade/remove
make cli-install # re-builds and overwrites /usr/local/bin/opencode
make cli-uninstall # removes /usr/local/bin/opencode
make ocode-uninstall # removes wrapper and helpersIf you prefer the upstream installer instead, see below.
# YOLO
curl -fsSL https://opencode.ai/install | bash
# Package managers
npm i -g opencode-ai@latest # or bun/pnpm/yarn
brew install sst/tap/opencode # macOS and Linux
paru -S opencode-bin # Arch LinuxTip
Remove versions older than 0.1.x before installing.
The install script respects the following priority order for the installation path:
$OPENCODE_INSTALL_DIR- Custom installation directory$XDG_BIN_DIR- XDG Base Directory Specification compliant path$HOME/bin- Standard user binary directory (if exists or can be created)$HOME/.opencode/bin- Default fallback
# Examples
OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash
XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash- Guardrails (enabled): plan guard (fresh plan required for complex edits) and completion guard (typecheck/tests + revert on failure). See
docs/nelli.md. - Prompt optimizer (enabled): rewrites your message to be execution‑ready. Disable with
OCODE_PROMPT_OPTIMIZER_DISABLE=true. - Providers: configure via the
ocodewrapper or~/.config/opencode/opencode.json. Upstream docs: https://opencode.ai/docs
Chat vs one‑shot
- Chat (default):
ocode <provider> [--model ...] [--url ...] - One‑shot:
ocode run <provider> [flags] "your task"
Safety model
- Default: plan+completion guards ON; full edit/bash/webfetch allowed (no per‑edit prompts)
- Safer mode: add
--safeto require approvals (sets agent permissions toask)
Install helper:
make ocode-install(wrapper) and optionallymake ocode-links(shortcuts)
Run chat by default:
- OpenRouter:
ocode openrouter --model x-ai/grok-4-fast:free(needsOPENROUTER_API_KEY) - Local server:
ocode local --url http://localhost:8080/v1 --model default - CBORG:
ocode cborg --model lbl/cborg-coder:latest(setCBORG_API_KEY;--url https://api-local.cborg.lbl.govon LBL network)
One‑shot runs:
ocode run <provider> [flags] "your task"
Per‑user config (avoid flags):
- OpenRouter default:
make ocode-user-config-default-openrouterthenopencode run "Task" - Local sample:
make ocode-user-config-local - CBORG sample:
make ocode-user-config-cborg
opencode is an opinionated tool so any fundamental feature needs to go through a design process with the core team. This fork welcomes PRs that improve local workflows (planning, guards, Claude integration) while staying close to upstream.
Important
We do not accept PRs for core features.
However we still merge a ton of PRs - you can contribute:
- Bug fixes
- Improvements to LLM performance
- Support for new providers
- Fixes for env specific quirks
- Missing standard behavior
- Documentation
Take a look at the git history to see what kind of PRs we end up merging.
Note
If you do not follow the above guidelines we might close your PR.
To run locally you need.
- Bun
- Golang 1.24.x
And run.
bun install
bun devAPI Client: After changes to TypeScript API endpoints in packages/opencode/src/server/server.ts, the opencode team must generate a new stainless SDK for clients.
Prompt optimizer
- Enabled by default; disable with
OCODE_PROMPT_OPTIMIZER_DISABLE=true. Guardrails - See
docs/nelli.mdfor plan/completion guard policies and toggles.
It's very similar to Claude Code in terms of capability. Here are the key differences:
- 100% open source
- Not coupled to any provider. Although Anthropic is recommended, opencode can be used with OpenAI, Google or even local models. As models evolve the gaps between them will close and pricing will drop so being provider-agnostic is important.
- A focus on TUI. opencode is built by neovim users and the creators of terminal.shop; we are going to push the limits of what's possible in the terminal.
- A client/server architecture. This for example can allow opencode to run on your computer, while you can drive it remotely from a mobile app. Meaning that the TUI frontend is just one of the possible clients.
The other confusingly named repo has no relation to this one. You can read the story behind it here.
