opencode-plugin-otel: Instructions file for Codex

AGENTS.md

opencode-plugin-otel AGENTS.md is an instructions file for Codex, OpenCode from DEVtheOPS/opencode-plugin-otel. It costs 1,318 tokens per session, scanned A, original, MPL-2.0.

A set of repository instructions for AI coding agents working on an OpenTelemetry plugin. OpenTelemetry is a standard way to collect application logs, metrics, and traces.

In plain words
What is it for?
Use it when changing this TypeScript/Bun plugin, especially to run type checks and tests and to locate event handlers and shared files.
Why use it?
It gives agents the project’s required commands, file layout, testing rules, and coding conventions so their changes fit the repository.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions subagents; mentions Claude Code; mentions AGENTS.md.

This is DEVtheOPS/opencode-plugin-otel's own configuration. It tells Codex and OpenCode how to work on opencode-plugin-otel itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything opencode-plugin-otel configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/DEVtheOPS/opencode-plugin-otel/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/DEVtheOPS/opencode-plugin-otel

Made for: Codex, OpenCode.

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-plugin-otel AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/devtheops/opencode-plugin-otel/agents-md/github.svg)](https://agentmods.dev/instructions/devtheops/opencode-plugin-otel/agents-md)
Your own site
<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.

agentmods 80×15 button for opencode-plugin-otel AGENTS.md

Your own site · 80×15
<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>
Per session 1,318 This file is loaded in full into every session.
When invoked 1,318 The same file — it is already loaded in full.
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.01318 $0.01318
Opus 5.5 $0.00527 $0.00527
Sonnet 5.5 $0.00264 $0.00264
Haiku 4.5 $0.00132 $0.00132

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

Security

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.

AGENTS.md · 81 lines

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 use node, npx, jest, or vitest.
  • No comments unless explicitly requested.
  • No sdk-node — the OTel Node SDK meta-package is intentionally excluded; use individual packages.
  • @opencode/plugin is 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 a HandlerContext (defined in src/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 from session.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.id via markSeen so later events cannot overtake an asynchronous session lookup.
  • Session identity — retain the agent, subagent parent, and creation time across executions, and hydrate missed session.created events with ctx.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 bare OTEL_* names for plugin config. Headers are passed directly to exporters; loadConfig copies OPENCODE_RESOURCE_ATTRIBUTES → OTEL_RESOURCE_ATTRIBUTES before the SDK initializes.
  • OPENCODE_ENABLE_TELEMETRY — all OTel instrumentation is gated on this env var (or the enabled plugin option). The plugin always loads regardless.
  • OPENCODE_METRIC_PREFIX — defaults to opencode.; set to claude_code. for Claude Code dashboard compatibility.
  • Plugin options — read from ctx.options during setup. Precedence is option → OPENCODE_* env → default. Keep option keys 1:1 with PluginConfig field names.

Read the full file on GitHub · 81 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 Changed · +10 lines · +425 tokens per session 4777ecdf68cd
  2. 2mo ago First seen · 71 lines · 893 tokens per session scan A c85fe86ae44a

Subscribe to this mod's changes

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.

Related

opencode-plugin-otel AGENTS.md compared with instructions from other repositories

opencode-plugin-otel AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
opencode-plugin-otel AGENTS.mdDEVtheOPS/opencode-plugin-otelInstructions file1531mo agoMPL-2.0A1,318Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode