Tag: harness

  • OpenCode 2.0 Migration – Ubuntu 24.04

    OpenCode 2.0 Migration – Ubuntu 24.04

    OpenCode is a free, open-source AI coding agent that runs locally on your machine and connects to over 75 different AI model providers. If you are like me you may use it as the agent/harness for local model inference.

    As of today (or yesterday) OpenCode has shipped version 2.0 (or v2 depending on where you look), which comes with a few nice improvements. Of particular interest to me is the rebuilt API, background sub-agents, and enhanced plugin system (plugins are no longer considered experimental). Lets take a look at what is new in 2.0.

    What’s new

    FeatureWhat’s changedWhy it matters
    Centralized background serviceOne persistent OpenCode service supports the terminal, desktop, web interface, and API clients.Sessions and automation can be managed across interfaces.
    Rebuilt APICompletely redesigned API with a new JavaScript client. Agents can manage sessions, worktrees, and other OpenCode operations.Better scripting and external orchestration.
    Code ModeAgents execute JavaScript to discover, combine, and call MCP tools.Potentially significant reductions in tool-call overhead and context consumption.
    Background subagentsAgents can delegate tasks to other agents, including those running different models.Parallel coding, testing, research, and code reviews.
    Background shell commandsLong-running commands execute asynchronously without blocking conversations.Builds and tests can run while the agent continues working.
    Enhanced plugin systemMore than 80 internal plugins, stable TUI plugins, and hot-reloading.Easier customization without restarting OpenCode.
    Embeddable SDKNew @opencode/sdk package exposes the engine as a library.Build customized agents and integrations using OpenCode’s underlying infrastructure.

    Personally I use switch back and forth between both OpenCode and PI for local LLM work. Both work well, and both can be a bit chatty. In particular PI, which even with Deepseek shares each and every though that is has with you – its a very chatty harness, OpenCode is much less chatty, but a bit less light weight than PI. So lets try OpenCode 2.0 and see how it performs.


    Updating NPM Installed Opencode to Opencode 2.0

    Note that if you installed OpenCode via npn the latest available version is 1.19.0, 2.0 is not available via npm at this time. Here are the steps to preserve your opencode configs (skills/MCPs) and seemlessly migrate to OpenCode 2.0

    Back up the config. Version 1 and version 2 read the same config files, so keep a copy until 2.0 is working

     cp -a ~/.config/opencode ~/.config/opencode.v1-backup
     cp -a ~/.local/share/opencode ~/.local/share/opencode.v1-backup
    
    
    

    Remove the npm opencode. This deletes only the program:

    sudo npm uninstall -g --prefix /usr opencode-ai
    hash -r && which opencode # should print nothing

    Install 2.0 with the official install script. It installs to ~/.opencode/bin/opencode, doesn’t need sudo, and adds that folder to your PATH in ~/.bashrc

    curl -fsSL https://opencode.ai/v2/install | bash
    exec $SHELL
    opencode --version # should report 2.x


    Things to look out for:

    Don’t reinstall opencode-ai from npm, or use the old install script. Both versions use the opencode command, and either one would put 1.x back or clash with 2.0.

    No config changes are needed. 2.0 reads your existing opencode.json and converts the old format in memory without rewriting the file. The guide says converting the file to the new format is optional (for example, mcp. becomes mcp.servers., agent becomes agents, command becomes commands).

    CLAUDE.md is no longer read. Your global AGENTS.md is still read. If any project relies on CLAUDE.md for opencode, copy that guidance into an AGENTS.md.

    Skills might not be picked up. The migration guide only lists .opencode/skills/ folders inside a project; it doesn’t mention ~/.claude/skills or ~/.agents/skills. If your skills don’t appear in step 4, point the skills array in opencode.json at those two folders.

    Plugins from 1.x don’t work in 2.0.

    Personally I did not run into any issues, and did not need to restore my backup configs. Skills loaded, MCPs loaded, no issues thus far.

    More info on OpenCode can be found here.