Borrowing it
Nothing to install: this file belongs to DEVtheOPS/opencode-plugin-otel. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/DEVtheOPS/opencode-plugin-otel/main/AGENTS.mdgit clone --depth 1 https://github.com/DEVtheOPS/opencode-plugin-otelWrote 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.
[](https://agentmods.dev/instructions/devtheops/opencode-plugin-otel/agents-md)<a href="https://agentmods.dev/instructions/devtheops/opencode-plugin-otel/agents-md"><img src="https://agentmods.dev/badge/instructions/devtheops/opencode-plugin-otel/agents-md/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.
<a href="https://agentmods.dev/instructions/devtheops/opencode-plugin-otel/agents-md"><img src="https://agentmods.dev/badge/instructions/devtheops/opencode-plugin-otel/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01318 | $0.01318 |
| Opus 5.5 | $0.00527 | $0.00527 |
| Sonnet 5.5 | $0.00264 | $0.00264 |
| Haiku 4.5 | $0.00132 | $0.00132 |
Grade A, and why
opencode-plugin-otel AGENTS.md 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.
How it starts
The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Instructions for AI agents working in this repository.
Build & typecheck
Always run after making changes:
bun run typecheck
There is no build step during local development. TypeScript source files are loaded natively by Bun; the published package is bundled by prepack.
Testing
bun test
Target runtime
main targets OpenCode V2 (>=2) and exports a Plugin.define-style default export
(id: "devtheops.otel", setup). The OpenCode V1 plugin lives on the v1 branch and is
released from the 1.x line; do not add V1 compatibility shims to main.
Project layout
src/
├── index.ts — V2 plugin default export (id + setup)
├── plugin.ts — setup(): config, model.request hook, event subscription, dispatch
├── state.ts — per-process shared OTel SDK + tracing state (globalThis)
├── types.ts — Shared types (OpenCodeEvent, HandlerContext, TracingState, etc.)
├── config.ts — Env/option config loading and log level resolution
├── otel.ts — OTel SDK setup and instruments
├── probe.ts — OTLP endpoint TCP probe
├── headers.ts — Dynamic OTLP headers / refreshing exporters
├── trace-context.ts — W3C trace-context inject/extract
├── util.ts — errorSummary, setBoundedMap, context resolution, attrs
└── handlers/
├── session.ts — session.created, session.inbox.enqueued, session.execution.*, retry/idle/usage
├── step.ts — session.step.*, session.text.ended (LLM spans + token/cost/cache metrics)
├── tool.ts — session.tool.* (tool spans, subagent correlation, duration, commit detection)
├── permission.ts — permission.asked/replied
└── chat-headers.ts — context preview and model.request / WebSocket trace propagation
Key conventions
- Bun over Node — use
bun,bun test,bun run. Never usenode,npx,jest, orvitest. - No comments unless explicitly requested.
- No
sdk-node— the OTel Node SDK meta-package is intentionally excluded; use individual packages. @opencode/pluginis type-only — import types from it (import type { Plugin } from "@opencode/plugin"); the plugin never imports it at runtime, so it stays a dev/optional peer dependency.HandlerContext— all event handlers receive aHandlerContext(defined insrc/types.ts). Do not import OTel globals directly inside handlers; thread them through the context.setBoundedMap/markSeen— always use these for correlation maps (toolMeta,stepMeta,pendingPrompts,pendingPermissions,seenEvents) to prevent unbounded growth.- Single source of truth for tokens/cost — token and cost counters are incremented once per
session.step.ended/failed; session totals come fromsession.usage.updated(cumulative) with a per-step fallback. - Event de-duplication — V2 may deliver the same event to multiple plugin instances; serialize shared dispatch before deduping by
event.idviamarkSeenso later events cannot overtake an asynchronous session lookup. - Session identity — retain the agent, subagent parent, and creation time across executions, and hydrate missed
session.createdevents withctx.session.get. - Subagent correlation — only parent a child run under a dispatch tool span when a child session ID in tool progress/result metadata or one unambiguous live candidate identifies it; otherwise use the parent run.
- Model context capture — opt-in only, text parts only, bounded; never serialize full media or structured tool payloads into span attributes.
- Multi-location configuration — process-wide exporters require identical telemetry configuration; reject a conflicting setup and derive project attributes from the observed session, not the loading location.
- Shutdown — providers are flushed (never shut down) on plugin cleanup and once per process on
beforeExit. Shutting down the global OTel providers poisons them for the rest of the process. - All env vars are
OPENCODE_prefixed —OPENCODE_ENABLE_TELEMETRY,OPENCODE_OTLP_ENDPOINT,OPENCODE_OTLP_METRICS_INTERVAL,OPENCODE_OTLP_LOGS_INTERVAL,OPENCODE_METRIC_PREFIX,OPENCODE_CAPTURE_PROMPT_IN_LOGS,OPENCODE_OTLP_HEADERS,OPENCODE_RESOURCE_ATTRIBUTES,OPENCODE_SPAN_ATTRIBUTES. Never use bareOTEL_*names for plugin config. Headers are passed directly to exporters;loadConfigcopiesOPENCODE_RESOURCE_ATTRIBUTES→OTEL_RESOURCE_ATTRIBUTESbefore the SDK initializes. OPENCODE_ENABLE_TELEMETRY— all OTel instrumentation is gated on this env var (or theenabledplugin option). The plugin always loads regardless.OPENCODE_METRIC_PREFIX— defaults toopencode.; set toclaude_code.for Claude Code dashboard compatibility.- Plugin options — read from
ctx.optionsduringsetup. Precedence is option →OPENCODE_*env → default. Keep option keys 1:1 withPluginConfigfield names.
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.
- 1mo ago Changed · +10 lines · +425 tokens per session 4777ecdf68cd
- 2mo ago First seen · 71 lines · 893 tokens per session scan A c85fe86ae44a
opencode-plugin-otel AGENTS.md is an instructions file published in the GitHub repository DEVtheOPS/opencode-plugin-otel (153 stars, last pushed 1mo ago), licensed MPL-2.0. It adds 1,318 tokens to every session, about $0.0053 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.
opencode-plugin-otel AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| opencode-plugin-otel AGENTS.mdDEVtheOPS/opencode-plugin-otel | Instructions file | 153 | 1mo ago | MPL-2.0 | A | 1,318 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |