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 3mo 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 3mo 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. 3mo 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 (40 stars, last pushed 3mo 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

opencode-rescue compared with agents from other repositories

opencode-rescue next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
opencode-rescuetasict/opencode-plugin-ccAgent403mo agoApache-2.0A44Claude Code
review-obsidian-guidelinesuphy/obsidian-reminderAgent6683d agoMITA63Claude Code
debuggerTT-Wang/forgeAgent353d agoMITA17Claude Code
type-reconstructormarcosd4h/DeepExtractRuntimeAgent21yesterdayMITA63Claude Code
loom-advisorcosmix/loomAgent663d agoMITA51Claude Code
debuggerNickCrew/Claude-CortexAgent7714d agoMITA38Claude Code
evolve-retrospectivemickeyyaya/evolve-loopAgent84d agoApache-2.0A51Claude Code