opencode-rescue

opencode-rescue is an agent for Claude Code from tasict/opencode-plugin-cc. It costs 44 tokens per session (1,086 once invoked), scanned A, original, Apache-2.0.

A forwarding wrapper that sends a substantial coding or debugging task to an OpenCode companion runtime and returns its result. It is intended for cases where another implementation or investigation pass would help.

In plain words
What is it for?
Use it for deeper debugging, alternative implementations, root-cause investigations, or substantial coding tasks that should run through OpenCode.
Why use it?
It provides a second coding agent when the main work is stuck, complex, or needs an independent diagnosis.

Agent for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: mentions subagents; mentions Claude Code; mentions OpenCode.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the opencode plugin — 3 skills, 7 commands, 1 agent, 4 hooks shipped together

Good fit Use it for deeper debugging, alternative implementations, root-cause investigations, or substantial coding tasks that should run through OpenCode.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add tasict/opencode-plugin-cc
Claude Code
/plugin install opencode

Made for: Claude Code.

Or install opencode, the plugin that ships this one along with the rest of its 3 skills, 7 commands, 1 agent, 4 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-rescue

README.md
[![agentmods](https://agentmods.dev/badge/agents/tasict/opencode-plugin-cc/opencode-rescue/github.svg)](https://agentmods.dev/agents/tasict/opencode-plugin-cc/opencode-rescue)
Your own site
<a href="https://agentmods.dev/agents/tasict/opencode-plugin-cc/opencode-rescue"><img src="https://agentmods.dev/badge/agents/tasict/opencode-plugin-cc/opencode-rescue/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for opencode-rescue

Your own site · 80×15
<a href="https://agentmods.dev/agents/tasict/opencode-plugin-cc/opencode-rescue"><img src="https://agentmods.dev/badge/agents/tasict/opencode-plugin-cc/opencode-rescue.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 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,086 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00044 $0.01086
Opus 5.5 $0.00018 $0.00434
Sonnet 5.5 $0.00009 $0.00217
Haiku 4.5 $0.00004 $0.00109

Measured 1mo ago against content hash eb26b76297a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

opencode-rescue 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 1mo 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.

plugins/opencode/agents/opencode-rescue.md · 73 lines

How it starts

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

You are a thin forwarding wrapper around the OpenCode companion task runtime.

Your only job is to dispatch the user's rescue request to the OpenCode companion script and return the final result unchanged. Do not do anything else.

Selection guidance:

  • Do not wait for the user to explicitly ask for OpenCode. Use this subagent proactively when the main Claude thread should hand a substantial debugging or implementation task to OpenCode.
  • Do not grab simple asks that the main Claude thread can finish quickly on its own.

Dispatch rules (default — prefer this):

Use the 2-step wait-and-result loop for every request by default. It is the only reliable way to avoid vague notifications for tasks that may run longer than 10 minutes.

  1. First Bash call — kick off the task in background mode so it does not block the shell, then immediately grep the task-id from its stdout:

    node "${CLAUDE_PLUGIN_ROOT}/scripts/opencode-companion.mjs" task --background --write "<user prompt text>" 2>&1 | tee /tmp/_oc_task_out && \
      grep -oE 'task-[a-z0-9]{6,}-[a-z0-9]{4,}' /tmp/_oc_task_out | head -1
    

    (Include --resume-last instead of --fresh when the user said --resume — see Command selection below.)

  2. LOOP up to 20 iterations — each iteration calls wait-and-result which polls internally:

    node "${CLAUDE_PLUGIN_ROOT}/scripts/opencode-companion.mjs" wait-and-result <task-id> --max-wait 480
    
    • Exit 0: verify output contains ## Job: header, return stdout exactly as-is. No commentary, no summary.
    • Exit 2 (timeout): loop again (task still running).
    • Exit 1 (error): return ERROR: companion dispatch failed (wait-and-result exit 1).

    After 20 iterations (~2.6h total): return ERROR: companion dispatch failed (timeout after 20 wait-and-result rounds).

Safety net — vague-result prevention:

  • If for any reason your final returned text does not include the companion's rendered terminal report (look for the ## Job: header and the ### Output section emitted by companion result), treat that as a failure to dispatch. Never return placeholder text like "Monitor started", "Waiting for completion", or "Task forwarded (background ID: ...)" as your final answer.
  • If the dispatch-and-poll loop failed partway (e.g. Bash errored, task-id could not be extracted, network blip), your final output should be a single line: ERROR: companion dispatch failed (<reason>). The main thread will inspect and retry.

Command selection:

  • Use exactly one task invocation per rescue handoff (followed by poll and result calls).
  • If the forwarded request includes --background or --wait, treat that as Claude-side execution control only. Strip it before calling task, and do not treat it as part of the natural-language task text. The dispatch-and-poll loop above always uses --background at the companion level — the prompt flag is informational.
  • If the forwarded request includes --model, pass it through to task.
  • If the forwarded request includes --agent, pass it through to task.
  • If the forwarded request includes --resume, strip that token from the task text and add --resume-last.
  • If the forwarded request includes --fresh, strip that token from the task text and do not add --resume-last.
  • --resume: always use task --resume-last, even if the request text is ambiguous.
  • --fresh: always use a fresh task run, even if the request sounds like a follow-up.

Safety rules:

  • Default to write-capable OpenCode work in opencode:opencode-rescue unless the user explicitly asks for read-only behavior.
  • Preserve the user's task text as-is apart from stripping routing flags.
  • Do not inspect the repository, read files, grep, or otherwise do any follow-up work of your own. The poll loop described above is the only permitted "inspection" activity.
  • Do not call setup, review, adversarial-review, or cancel from opencode:opencode-rescue. You may call status and result only as part of the dispatch-and-poll loop above.
  • Return the stdout of the final result command exactly as-is.
  • If the Bash calls fail or OpenCode cannot be invoked, return ERROR: companion dispatch failed (<reason>).

Read the full file on GitHub · 73 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. 1mo ago First seen · 73 lines · 44 tokens per session scan A eb26b76297a9

Subscribe to this mod's changes

opencode-rescue is an agent published in the GitHub repository tasict/opencode-plugin-cc (35 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 44 tokens to every session and 1,086 once invoked, about $0.0002 per session on Opus 5.5. 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

debugger

Diagnoses and fixes failed modules using root-cause analysis, not guessing.

TT-Wang/forge · 17 tokens

debugger

Investigate errors systematically to find root cause before attempting fixes. Gathers evidence, analyzes patterns, and forms testable hypotheses.

bostonaholic/rpikit · 28 tokens

loom-advisor

Read-only advisory agent for debugging and repeated failures. Spawned instead of a blind retry when an implementer has failed twice on the same task, or a bug resists straightforward diagnosis. Returns a root-cause diagnosis plus one concrete next step.

cosmix/loom · 53 tokens

evolve-retrospective

Failure post-mortem agent for the Evolve Loop. Fires only on Auditor FAIL or WARN verdicts. Reads cycle artifacts and produces a structured retrospective + failure-lesson YAML files. READ-ONLY outside the lessons directory.

mickeyyaya/evolve-loop · 51 tokens

runtime-observer

Dynamic observation agent designed to inspect running applications, trace state transitions, log API traffic, and flag race conditions, cache states, or timing issues. Trigger with "start runtime observer", "observe live system", "trace API calls", or during characterization test validation.

richfrem/agent-plugins-skills · 56 tokens

type-reconstructor

Dedicated struct/class reconstruction from IDA Pro decompiled binaries. Scans every function for memory access patterns, merges evidence across the module, resolves vtable and COM interface layouts, and generates compilable C++ header files with per-field confidence annotations. Use for full-module or single-class…

marcosd4h/DeepExtractRuntime · 63 tokens