Skip to content

NeLLi-team/nelli-ocode

 
 

Repository files navigation

nelli-ocode (opencode fork) logo

nelli-ocode — chat‑first coding agent with plan/completion guardrails, multi‑provider support, and Bun‑native tools.

Discord npm Build status

nelli-ocode Terminal UI


About this fork: nelli-ocode

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 --safe to 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.

Quick Start (chat)

  1. Install the upstream CLI (one‑time):
curl -fsSL https://opencode.ai/install | bash
  1. Install the wrapper from this repo:
make ocode-install
  1. 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:latest

Installation (self‑contained)

Requirements

  • 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-cborg

Upgrade/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 helpers

If you prefer the upstream installer instead, see below.

Installation (upstream CLI)

# 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 Linux

Tip

Remove versions older than 0.1.x before installing.

Installation Directory

The install script respects the following priority order for the installation path:

  1. $OPENCODE_INSTALL_DIR - Custom installation directory
  2. $XDG_BIN_DIR - XDG Base Directory Specification compliant path
  3. $HOME/bin - Standard user binary directory (if exists or can be created)
  4. $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

Documentation & Features

  • 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 ocode wrapper 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 --safe to require approvals (sets agent permissions to ask)

ocode wrapper (multi‑provider)

Install helper:

  • make ocode-install (wrapper) and optionally make ocode-links (shortcuts)

Run chat by default:

  • OpenRouter: ocode openrouter --model x-ai/grok-4-fast:free (needs OPENROUTER_API_KEY)
  • Local server: ocode local --url http://localhost:8080/v1 --model default
  • CBORG: ocode cborg --model lbl/cborg-coder:latest (set CBORG_API_KEY; --url https://api-local.cborg.lbl.gov on LBL network)

One‑shot runs:

  • ocode run <provider> [flags] "your task"

Per‑user config (avoid flags):

  • OpenRouter default: make ocode-user-config-default-openrouter then opencode run "Task"
  • Local sample: make ocode-user-config-local
  • CBORG sample: make ocode-user-config-cborg

Contributing

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 dev

Development Notes

API 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.md for plan/completion guard policies and toggles.

FAQ

How is this different than Claude Code?

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.

What's the other repo?

The other confusingly named repo has no relation to this one. You can read the story behind it here.


Join our community Discord | X.com

About

AI coding agent, built for the terminal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 48.6%
  • Go 40.6%
  • MDX 5.9%
  • CSS 3.0%
  • Astro 0.8%
  • Shell 0.4%
  • Other 0.7%