adapter_opencode

An adapter that connects OpenCode, a coding-agent tool, to the RimZ agent-management system. It translates OpenCode events into a shared format and handles permission and question responses.

In plain words
What is it for?
Use it to connect OpenCode lifecycle events, prompts, and compatibility hooks to RimZ’s agent tracking and status reporting.
Why use it?
It lets RimZ track OpenCode sessions and their waiting states without replacing OpenCode’s own user interface.

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/rimio-ai/rimz/adapter_opencode
Clone the repo
git clone --depth 1 https://github.com/rimio-ai/rimz
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 4,352 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.04352
Opus 5 $0.00000 $0.02176
Sonnet 5 $0.00000 $0.00870
Haiku 4.5 $0.00000 $0.00435

Measured 2d ago against content hash 00c0a83e68f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

adapter_opencode scanned grade A with 0 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/internals/agents/adapter_opencode.md · 91 lines

How it starts

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

OpenCode adapter

Read model.md for the provider-neutral agent model and adapter.md for the integration layer every adapter implements. Accounts, balances, and spend are in providers.md; the raw upstream protocol is in opencode-reference.md.

This doc is the single home for everything OpenCode-specific. OpenCode's integration surface is an in-process TypeScript plugin, so the adapter ships plugin.ts, embedded at compile time and installed as ~/.config/opencode/plugin/rimz.ts. The plugin subscribes to OpenCode hooks and bus events, flattens them into a RimZ-authored snake-case envelope, and spawns rimz hooks feed --source opencode with RIMZ_AGENT_PID set to the OpenCode process. OpenCode 1.18.23 publishes native permission and question prompts as permission.asked and question.asked; their *.replied/question.rejected outcomes clear waiting and record the native answer while OpenCode's UI remains responsible for collecting it. The published permission.ask compatibility hook remains wired for older releases and reads RimZ's stdout to set OpenCode's output.status.

Hooks and lifecycle

Native surface → internal mapping; the upstream hooks, bus payloads, SQLite schema, and auth shape are in opencode-reference.md.

Native surface Plugin emits Channel decode_hookLifecycleSignal Normalized fields
session.created without parentID session_created lifecycle Registered worktree from directory/cwd
chat.message chat_message lifecycle TurnStarted sanitized prompt, model, effort
session.idle root after a plan-agent turn session_idle + plan_proposed: true awaiting-user (PlanApproval) AwaitingInput { PlanApproval }waiting latest token gauge; the native TUI owns review and mode switching
session.idle root session_idle lifecycle TurnEnded { errored: false, parked_on_background: false } latest token gauge stamped from message.updated
session.error root session_error lifecycle TurnEnded { errored: true, parked_on_background: false } error_class, error_message
tool.execute.after root mutating tool tool_after lifecycle ToolUsed { mutates: true, edits } edit/write/apply_patch/patch edit files; bash mutates only
session.created with parentID; first child gauge update per model SubagentStart lifecycle SubagentStarted child session_id, parent_session_id, sanitized title as task at creation; resolved model and tokens on gauge re-emit
session.idle / session.error child SubagentStop lifecycle SubagentStopped { errored } child session_id, parent_session_id
experimental.session.compacting session_compacting lifecycle Compacting leading compaction head
session.compacted session_compacted lifecycle CompactionEnded { auto: None } clears the compaction head
session.deleted root session_ended lifecycle Ended → stamps ended_at; runtime hides the retained row (ends_session) reason: "deleted"
dispose root sweep session_ended lifecycle Ended → stamps ended_at; runtime hides the retained row (ends_session) reason: "dispose"; all tracked roots, bounded to 1.5 seconds overall
permission.asked bus event; legacy permission.ask hook permission_ask awaiting-user (Permission) AwaitingInput { Permission }waiting permission name and matched patterns; the native prompt owns the answer
question.asked question_ask awaiting-user (Question) AwaitingInput { Question }waiting full questions, headers, options, multi-select/custom flags, joined title, and request id
permission.replied permission_replied lifecycle ToolUsed { mutates: false, edits: false } → clears waiting request id and once/always/reject answer recorded
question.replied question_replied lifecycle ToolUsed { mutates: false, edits: false } → clears waiting request id and per-question choices recorded
question.rejected question_rejected lifecycle ToolUsed { mutates: false, edits: false } → clears waiting request id and rejected outcome recorded

Read the full file on GitHub · 91 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. 2d ago First seen · 91 lines · 0 tokens per session scan A 00c0a83e68f4

Subscribe to this mod's changes

adapter_opencode is an agent published in the GitHub repository rimio-ai/rimz (23 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,352 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

maintaining-agent-docs

Agent "maintaining-agent-docs" from martin-francois/symphony-trello, covering maintaining agent docs, progressive disclosure contract, what may be added to agents.md (allowlist), what must not be added to agents.md (denylist) and where to put new guidance (decision tree).

martin-francois/symphony-trello · 0 tokens

progressive-disclosure-source

This file is the source of truth for the structure and maintenance approach.

martin-francois/symphony-trello · 0 tokens

system-architect

Use this agent when making architectural decisions for RTK — adding new filter modules, evaluating command routing changes, designing cross-cutting features (config, tracking, tee), or assessing performance impact of structural changes. Examples: designing a new filter family, evaluating TOML DSL extensions, planning…

rtk-ai/rtk · 0 tokens

documentation-analyst-writer

Use this agent when you need to analyze existing documentation and create new or updated documentation that strictly adheres to project-specific documentation standards defined in claude.md. This agent excels at maintaining consistency with established documentation patterns, ensuring technical accuracy, and producing…

shanraisshan/claude-code-best-practice · 62 tokens

qwen

@qwen-code/qwen-code is Alibaba's coding CLI built on top of Gemini CLI, tuned for the Qwen3-Coder family of models. adapters drives it via the qwen binary.

a5c-ai/babysitter · 0 tokens

cursor

Adapter for the Cursor editor's agent CLI.

a5c-ai/babysitter · 0 tokens