opencode

An integration that runs OpenCode's server inside an isolated agentkernel sandbox. You connect to that server with OpenCode's interface through agentkernel.

In plain words
What is it for?
Use it to start OpenCode through the attach command, create its sandbox automatically, and send sessions, messages, and events through the proxy.
Why use it?
It keeps OpenCode's work in a sandbox while allowing the normal OpenCode interface to communicate with it.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/thrashr888/agentkernel/opencode
Clone the repo
git clone --depth 1 https://github.com/thrashr888/agentkernel
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,012 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01012
Opus 5 $0.00000 $0.00506
Sonnet 5 $0.00000 $0.00202
Haiku 4.5 $0.00000 $0.00101

Measured yesterday against content hash bf60b44f35ea, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

opencode scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

# Or: curl -fsSL https://raw.githubusercontent.com/thrashr888/agentkernel/main/install.sh | sh

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

# Or: curl -fsSL https://raw.githubusercontent.com/thrashr888/agentkernel/main/install.sh | sh
docs/agents/opencode.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenCode

Run OpenCode with agentkernel for isolated code execution.

The fastest way to use OpenCode with agentkernel. OpenCode's full server runs inside an isolated sandbox, and you connect to it with attach:

# 1. Start agentkernel
agentkernel serve

# 2. Connect OpenCode TUI — sandbox is created automatically
opencode attach http://localhost:18888/opencode

On first connect, agentkernel creates a sandbox from the opencode-sandbox template, installs OpenCode inside it, and starts opencode serve. All subsequent requests proxy through to the OpenCode server in the sandbox. First connect takes ~8s; after that it's instant.

How It Works

  1. opencode attach connects to agentkernel's /opencode proxy
  2. agentkernel provisions a sandbox using the built-in opencode-sandbox template
  3. OpenCode's own server (opencode serve) runs inside the sandbox on port 3000
  4. All OpenCode protocol requests (sessions, messages, SSE events) proxy through to it
  5. You get the full OpenCode TUI experience with sandbox isolation

Alternative: Plugin Integration

For users who prefer plugin-based integration, agentkernel also provides an OpenCode plugin that adds sandbox tools to OpenCode:

# Install the plugin into your project
agentkernel plugin install opencode

# Launch OpenCode — the plugin loads automatically
opencode

The plugin adds tools to OpenCode:

Tool Description
sandbox_run One-shot command in a fresh sandbox
sandbox_exec Run in the session's persistent sandbox (state persists)
sandbox_list List all active sandboxes

Alternative: Manual Sandbox

You can also create an OpenCode sandbox manually using the template or Dockerfile:

# Using the built-in template
agentkernel sandbox create opencode-dev --template opencode-sandbox

# Or using the example Dockerfile (pre-built image)
docker build -t agentkernel/opencode examples/agents/opencode/
agentkernel sandbox create opencode-dev --config examples/agents/opencode/agentkernel.toml

# Attach to the sandbox and run OpenCode directly
agentkernel attach opencode-dev
# Inside the sandbox:
opencode

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 146 lines · 0 tokens per session scan C bf60b44f35ea

Subscribe to this mod's changes

opencode is an agent published in the GitHub repository thrashr888/agentkernel (58 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,012 tokens. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.