@raindrop-ai/opencode-plugin) instruments OpenCode so that every LLM response and tool call is sent to Raindrop. You don’t need to add any per-call instrumentation.
Installation
Add the plugin to your OpenCode config. Config file locations:opencode.json in your project, or ~/.config/opencode/opencode.json for a global config.
Add this to the config file:
Quick Start
- Add the plugin to your OpenCode config (see above).
-
Set your write key in the environment where OpenCode runs:
- Start OpenCode. Sessions are automatically traced to Raindrop.
Configuration
Required: set your Raindrop write key in the environment where OpenCode runs:System Prompt Capture
To include the system prompt in trace spans (visible in the Trace tab when you click an LLM span), enable thecaptureSystemPrompt option:
~/.config/opencode/raindrop.json or .opencode/raindrop.json):
gen_ai.prompt.0.* span attribute and rendered as a “system” labeled section in the span detail view. This is useful for tracking which system prompt version was used in a given conversation.
Defaults to false — no system prompt data is captured unless explicitly enabled. System prompts longer than 32KB are automatically truncated.
Projects
If your org has multiple projects, route this plugin’s events to a specific one by setting its slug viaRAINDROP_PROJECT_ID or the project_id config-file key:
~/.config/opencode/raindrop.json or .opencode/raindrop.json):
X-Raindrop-Project-Id header on every event. Omit it (or pass default) to use your org’s default Production project, which is the existing behavior. Single-project orgs need nothing new.
Context & Metadata
Per-Call Context Override
You can override the environment-set metadata on a per-prompt basis by passing ametadata field on any text part when calling
session.prompt():
Merge behavior:
- Prompt-level values override
RAINDROP_EVENT_METADATAfor that turn propertiesare shallow-merged (prompt-level wins on conflicts)convoIdis always the OpenCode session ID
Identifying Users
To associate traits with a user, use our TypeScript SDK:Tool catalog capture (ai.prompt.tools)
OpenCode’s step events carry no tool list, so the plugin cannot see the exact tools each model request was given. Instead it records the host’s tool catalog for the step’s model: the v1 plugin calls client.tool.list({ query: { provider, model } }) once per session and model (2s timeout, cached, never surfaces errors); the v2 plugin reads the registered tool list (ctx.tool.list()). Because this is OpenCode’s catalog rather than the exact per-request set, those spans also carry ai.prompt.tools.source = "opencode.tool.list". A tools array in raindrop.json (user- or project-level) replaces the catalog entirely, skips the lookup and carries no source; tools: [] records an empty catalog. See Tool catalog capture for the attribute format, the absent / [] semantics and the override shapes accepted.
Troubleshooting
Events not appearing in the dashboard
- Check your write key — Make sure
RAINDROP_WRITE_KEYis set in the environment where OpenCode runs. Use the Raindrop dashboard to confirm events and traces after your first session.
Application Git identity
OpenCode does not use the edited project or plugin process as the application-under-test revision. In~/.config/opencode/raindrop.json or .opencode/raindrop.json, set app_git to an object with
commit_sha, commit_dirty, optional branch, or a source_directory that explicitly identifies
the AUT checkout; set it to false to opt out. See the
TypeScript Git reference.