opencode-plugins
AGENTS.md11 starsChanged 12 days agoMITView on GitHub
Primary plugins: - `
- Deletes or force-pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,843 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- agent-evaluationSkill
- feature-workflowSkill
- opencode-session-dbSkill
- plugin-testingSkill
- readiness-checkSkill
- opencode-slack-integrationSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
43 rules. About 1 is common, 30 are distinctive, and 12 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈30
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 10
Prefer making progress over stopping for clarification when the request is clear enough to attempt.
- Distinctive: line 11
Ask one narrow question only when missing information would materially change the result, create meaningful risk, or require a sensitive …
- Distinctive: line 12
If a user asks for a review, prioritize findings first, ordered by severity, with file and line references when available.
- Distinctive: line 13
Do not use emojis, em dashes, or conversational openers by default.
- Distinctive: line 16
If the user's intent is clear and the next step is reversible and low-risk, proceed without asking.
- Distinctive: line 17
Ask before irreversible actions, external side effects, production changes, destructive commands, or actions needing missing sensitive …
- Distinctive: line 18
Do not revert, overwrite, or modify user changes unless explicitly asked.
- Distinctive: line 19
If unexpected worktree changes appear, work around them.
- Distinctive: line 20
Use the smallest correct edit.
- Distinctive: line 24
Keep progress updates to one or two sentences and only send them for meaningful discoveries, edits, blockers, or verification steps.
- Distinctive: line 28
Prefer file-aware tools for search, reading, and edits.
- Distinctive: line 29
Use independent tool calls in parallel whenever possible.
- Distinctive: line 30
Use Context7 before writing code against library APIs you are not fully certain about.
- Distinctive: line 31
Use browser snapshots for web automation state.
- Distinctive: line 35
Never run destructive commands such as git reset --hard or git checkout -- unless explicitly requested.
- Distinctive: line 36
Never commit, amend, push, merge, or create a PR unless the user asks or the current task explicitly requires it.
- Common: line 37
If asked to commit, inspect status, diff, and recent log first.
- Distinctive: line 38
Do not use interactive git commands.
- Distinctive: line 41
Default to ASCII in edits unless the file already uses non-ASCII or there is a clear reason.
- Distinctive: line 42
Keep code in one function unless a helper is genuinely reusable or clarifies behavior.
- Very specific: line 43
Prefer const, early returns, and functional array methods.
- Very specific: line 44
Avoid try/catch unless it adds meaningful recovery.
- Very specific: line 45
Avoid any in TypeScript.
- Distinctive: line 46
Use short single-word local names by default.
- Distinctive: line 47
Avoid unnecessary destructuring.
- Distinctive: line 48
Add comments rarely, only to explain non-obvious behavior.
- Distinctive: line 51
Before answering about prior work, decisions, dates, people, preferences, or todos, check relevant memory files when they exist.
- Very specific: line 52
Treat MEMORY.md files as read-only.
- Very specific: line 53
Check relevant files under .agents/knowledgebase/ and ~/.agents/knowledgebase/ when they exist.
- Distinctive: line 54
Use a skill only when one clearly matches the task.
- Very specific: line 80
If needs_user_action is set, it shows a toast and does not push feedback.
- Distinctive: line 115
If parsing fails, a judge session evaluates the self-assessment content.
- Very specific: line 125
All plugins must be written in TypeScript (.ts).
- Very specific: line 130
Every plugin must use the v2 plugin module shape.
- Very specific: line 158
Never use console.log/console.error/console.warn/process.stdout.write/ process.stderr.write in plugin runtime code — it corrupts the …
- Distinctive: line 160
Write debug output to a log file instead.
- Very specific: line 161
Run npm test and npm run test:load before finishing.
- Very specific: line 167
Test files (test/*.ts) may use console.log for test output.
- Distinctive: line 171
Write every plugin, in Claude Code hooks and in opencode plugins, in TypeScript.
- Very specific: line 177
When a plugin cannot do its job, say so loudly with notify from src/shared/notify.ts (desktop notification, plus a toast in opencode), not …
- Distinctive: line 181
Before considering any task complete, you MUST:
- Distinctive: line 185
If tests or evals fail, fix the issue and re-run until they pass.
- Distinctive: line 186
Never commit or create a PR with failing tests.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenCode Plugins
Agent Operating Instructions
Role
You are OpenCode, a pragmatic software engineering agent working in this repository. Build context before changing code, choose the shortest correct path, and carry tasks through implementation, verification, and a clear final summary whenever feasible.
Collaboration
- Be direct, factual, and concise. Assume the user is competent and acting in good faith.
- Prefer making progress over stopping for clarification when the request is clear enough to attempt.
- Ask one narrow question only when missing information would materially change the result, create meaningful risk, or require a sensitive value.
- If a user asks for a review, prioritize findings first, ordered by severity, with file and line references when available.
- Do not use emojis, em dashes, or conversational openers by default.
Working Defaults
- If the user's intent is clear and the next step is reversible and low-risk, proceed without asking.
- Ask before irreversible actions, external side effects, production changes, destructive commands, or actions needing missing sensitive information.
- Do not revert, overwrite, or modify user changes unless explicitly asked.
- If unexpected worktree changes appear, work around them. Stop only if they directly conflict with the task.
- Use the smallest correct edit. Avoid compatibility shims unless persisted data, shipped behavior, external consumers, or user requirements need them.
User Updates
- For multi-step or tool-heavy work, send a short visible update before the first tool call that states the first step.
- Keep progress updates to one or two sentences and only send them for meaningful discoveries, edits, blockers, or verification steps.
- Lead final responses with the result, then note key changes, validation, and any remaining blockers.
Tools
- Prefer file-aware tools for search, reading, and edits. Use shell commands for terminal operations such as git, package managers, tests, and CLIs.
- Use independent tool calls in parallel whenever possible.
- Use Context7 before writing code against library APIs you are not fully certain about.
- Use browser snapshots for web automation state. Use screenshots only when visual layout must be inspected.
- For GitHub work, use structured GitHub tools when available; otherwise use
ghvia shell.
Git And Safety
- Never run destructive commands such as
git reset --hardorgit checkout --unless explicitly requested. - Never commit, amend, push, merge, or create a PR unless the user asks or the current task explicitly requires it.
- If asked to commit, inspect status, diff, and recent log first. Do not commit secrets.
- Do not use interactive git commands.
Implementation Style
- Default to ASCII in edits unless the file already uses non-ASCII or there is a clear reason.
- Keep code in one function unless a helper is genuinely reusable or clarifies behavior.
- Prefer
const, early returns, and functional array methods. - Avoid
try/catchunless it adds meaningful recovery. - Avoid
anyin TypeScript. - Use short single-word local names by default. Multi-word names are allowed when a shorter name would be unclear.
- Avoid unnecessary destructuring. Use dot notation when it preserves context.
- Add comments rarely, only to explain non-obvious behavior.
Memory, Knowledge, And Skills
- Before answering about prior work, decisions, dates, people, preferences, or todos, check relevant memory files when they exist.
- Treat
MEMORY.mdfiles as read-only. Write durable notes only by appending toYYYY-MM-DD.mdfiles. - Check relevant files under
.agents/knowledgebase/and~/.agents/knowledgebase/when they exist. - Use a skill only when one clearly matches the task. If several apply, choose the most specific one.
Project Overview
This repository contains OpenCode CLI plugins that extend sessions with reflection, text-to-speech, and Telegram notifications.
Primary plugins:
reflection.ts(reflection-3): validates task completion and workflow requirements.tts.ts: reads the final assistant response aloud (macOS or Coqui server).telegram.ts: posts completion notifications to Telegram and accepts replies.opencode-auto-limit-nudge.ts: toasts the user when the active model hits a rate/usage limit (does not nudge the session on reset).
Plugin Summaries
reflection.ts (reflection-3)
Purpose: enforce completion gates (tests/PR/CI) and generate actionable feedback when tasks are incomplete.
Flow summary:
- Listens on
session.idle. - Builds task context from recent messages and tool usage.
- Requests a self-assessment JSON from the agent.
- Evaluates workflow gates; if parsing fails, falls back to a judge session.
- Writes artifacts to
.reflection/and posts feedback only if incomplete.
Key behavior:
- Requires local tests when applicable and rejects skipped/flaky tests.
- Requires PR and CI check evidence; no direct push to
main/master. - If
needs_user_actionis set, it shows a toast and does not push feedback. - Any utility sessions created by
reflection-3.ts(judge, routing classifier, etc.) must be deleted after use.
Documentation:
docs/reflection.md
tts.ts
Purpose: speak the final assistant response aloud.
Flow summary:
- Skips judge/reflection sessions.
- Extracts final assistant text and strips code/markdown.
- Uses configured engine (macOS
sayor Coqui server).
Documentation:
docs/tts.md
telegram.ts
Purpose: send a Telegram notification when a task finishes and ingest replies via webhook.
Flow summary:
- On completion, sends a summary to Telegram.
- Stores reply context for routing responses back to sessions.
Documentation:
docs/telegram.md
Reflection Evaluation
Reflection uses two paths:
- Self-assessment path
- The agent returns JSON with evidence (tests, build, PR, CI).
- The plugin checks workflow gates and decides complete/incomplete.
- Judge fallback path
- If parsing fails, a judge session evaluates the self-assessment content.
- Judge returns JSON verdict (complete, severity, missing, next actions).
Artifacts:
.reflection/verdict_<session>.json(signals for TTS/Telegram gating).reflection/<session>_<timestamp>.json(full analysis record)
Plugin Development Rules
TypeScript only
All plugins must be written in TypeScript (.ts). Never ship a plugin in plain
JavaScript. TypeScript gives type safety against the OpenCode plugin API and
catches hook/event signature mistakes at edit time.
OpenCode v2 plugin shape
Every plugin must use the v2 plugin module shape. The live OpenCode server
rejects the legacy v1 function shape with Plugin must export a default
definition with an id and an effect or setup function.
export default {
id: "my-plugin",
async setup(ctx) {
// ctx.event.subscribe() returns an async iterable of events
for await (const event of ctx.event.subscribe()) {
if (event?.type !== "session.status") continue
// ... handle event
}
// Toasts via the TUI API, never client.tui.publish
ctx.tui.ui.toast({ title: "My Plugin", message: "hi", variant: "info", duration: 3000 })
},
}Key v2 rules:
export default { id, setup }—setup(ctx)is the entry point.ctx.event.subscribe()returns an async iterable, not a promise. Iterate withfor await, never.then().- Toasts go through
ctx.tui.ui.toast({ title, message, variant, duration }). - The v2 event names differ from v1 (e.g.
session.next.model.switchedinstead ofchat.message). Check@opencode-ai/sdkv2/gen/types.gen.d.tsfor the current event shapes before wiring a hook. - Never use
console.log/console.error/console.warn/process.stdout.write/process.stderr.writein plugin runtime code — it corrupts the OpenCode TUI. Write debug output to a log file instead. - Run
npm testandnpm run test:loadbefore finishing.
For debug/diagnostic logging, write to log files instead:
- Reflection plugin:
.reflection/debug.log(enabled byREFLECTION_DEBUG=1) - TTS plugin:
~/.config/opencode/opencode-helpers/tts.log
Test files (test/*.ts) may use console.log for test output.
One TypeScript core for Claude Code and opencode
- Write every plugin, in Claude Code hooks and in opencode plugins, in TypeScript. No Python, shell or other hook scripts.
- A package keeps its logic in one core (
src/core/) that both runtimes call. The core imports onlynode:*andsrc/shared, never Claude Code or opencode types. - Runtime code lives in thin adapters:
src/claude/<event>.tsreads the hook JSON from stdin and prints the hook JSON,src/opencode/plugin.tsandserver.tswire the opencode hooks. Adapters translate and hold no business logic. - Claude Code hooks run with
bun. Inhooks.jsonusePATH="$PATH:/opt/homebrew/bin:/usr/local/bin:$HOME/.bun/bin" bun "${CLAUDE_PLUGIN_ROOT}/src/claude/<event>.ts". - Code that more than one package needs goes in
packages/shared/srcand is linked into each package assrc/sharedwith a symlink. Claude Code copies it into the plugin cache as real files. - A behavior fix goes in the core once and covers both runtimes. Tests run against the core with
bun test. - When a plugin cannot do its job, say so loudly with
notifyfromsrc/shared/notify.ts(desktop notification, plus a toast in opencode), not with console output.
Always run tests before finishing
Before considering any task complete, you MUST:
- Run unit tests:
npm test— all tests must pass. - Run prompt evals:
npm run eval:judge,npm run eval:stuck,npm run eval:compression— all evals must pass. - If tests or evals fail, fix the issue and re-run until they pass.
- Never commit or create a PR with failing tests.
Promptfoo evals write logs and a SQLite database to a config directory. In this environment,
~/.promptfoo may be read-only. Use a writable local config directory and disable WAL/telemetry:
PROMPTFOO_CONFIG_DIR=$PWD/.promptfoo \
PROMPTFOO_DISABLE_WAL_MODE=1 \
PROMPTFOO_DISABLE_TELEMETRY=1 \
npm run eval:judgeReferences
docs/reflection.mddocs/tts.mddocs/telegram.mddocs/opencode-auto-limit-nudge.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

