opencode

opencode is a command for coding agents from pwdev-solucoes/pwdev-claude-marketplace. It costs 21 tokens per session (941 once invoked), scanned C, original, Apache-2.0.

A command that sends a coding task to the OpenCode command-line tool, which can route work to different AI providers or models, then reviews the resulting code changes.

In plain words
What is it for?
Use it to delegate a task to OpenCode, choose a configured model, run it in read-only or write mode, and inspect the resulting diff.
Why use it?
It lets a project use a selected external model for a task while keeping a required review step for its changes.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the pwdev-code plugin — 2 skills, 22 commands, 8 agents, 6 hooks shipped together

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 commands/pwdev-solucoes/pwdev-claude-marketplace/opencode
Clone the repo
git clone --depth 1 https://github.com/pwdev-solucoes/pwdev-claude-marketplace

Or install pwdev-code, the plugin that ships this one along with the rest of its 2 skills, 22 commands, 8 agents, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for opencode

README.md
[![agentmods](https://agentmods.dev/badge/commands/pwdev-solucoes/pwdev-claude-marketplace/opencode.svg)](https://agentmods.dev/commands/pwdev-solucoes/pwdev-claude-marketplace/opencode)
Your own site
<a href="https://agentmods.dev/commands/pwdev-solucoes/pwdev-claude-marketplace/opencode"><img src="https://agentmods.dev/badge/commands/pwdev-solucoes/pwdev-claude-marketplace/opencode.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 941 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.00021 $0.00941
Opus 5 $0.00010 $0.00470
Sonnet 5 $0.00004 $0.00188
Haiku 4.5 $0.00002 $0.00094

Measured 4d ago against content hash a1483e07707d, 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 4d ago.

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.

(`curl -fsSL https://opencode.ai/install | bash` or `npm i -g opencode-ai`,

Makes network callslowCapability

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

(`curl -fsSL https://opencode.ai/install | bash` or `npm i -g opencode-ai`,
plugins/pwdev-code/commands/opencode.md · 86 lines

How it starts

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

/pwdev-code:opencode — Delegate to OpenCode

Role

Orchestrator: sends the task to the external OpenCode CLI via the standardized delegation script, then performs a MANDATORY critical review. Best for: tasks that need a specific model/provider or provider flexibility. Protocol details: ${CLAUDE_PLUGIN_ROOT}/references/delegation.md

Model selection

Precedence: .planning/config.jsonexternal_models.opencode.model (passed as --model) > env OPENCODE_MODEL (respected natively by the CLI)

OpenCode's configured default. List available models: opencode models.

Input

$ARGUMENTS: the task description. --read-only → MODE=read (default: write).

Flow

STEP 0 — Language

Follow ${CLAUDE_PLUGIN_ROOT}/references/language.md (resolve lang from .planning/config.json; ask only if unset).

STEP 1 — Preflight

  • Parse $ARGUMENTS: strip --read-only (→ MODE=read); the remainder is the task. Empty task → show usage and STOP.
  • git status --porcelain — if the tree is dirty in write mode, warn the user that delegation results will be hard to attribute; offer to continue or abort.
  • Record baseline: git rev-parse HEAD and git status --short.

STEP 2 — Human Confirmation (same rule as review.md STEP 3.5)

Show the EXACT command that will run:

"${CLAUDE_PLUGIN_ROOT}/scripts/run-agent.sh" opencode <write|read> "<task>"

If this is the FIRST external CLI run in this session → require explicit confirmation before executing. Never proceed silently.

STEP 3 — Run

Execute the command via Bash with a tool timeout ≥ the script timeout + 60s (default 600s; override via external_models.opencode.timeout_s).

  • exit 127 → OpenCode not installed (curl -fsSL https://opencode.ai/install | bash or npm i -g opencode-ai, then run opencode once to configure the provider); STOP.
  • exit 124 → report the timeout; suggest raising external_models.opencode.timeout_s.
  • exit 4 → another write delegation is running; wait for it.
  • Output copy (when .planning/ exists): .planning/delegation/<ts>-opencode.md

Read the full file on GitHub · 86 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. 4d ago First seen · 86 lines · 21 tokens per session scan C a1483e07707d

Subscribe to this mod's changes

opencode is a command published in the GitHub repository pwdev-solucoes/pwdev-claude-marketplace (2 stars, last pushed 15d ago), licensed Apache-2.0. It adds 21 tokens to every session and 941 once invoked, about $0.0001 per session on Opus 5. 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-31.