agentleFS
thenickzthenickz/opencode-notify/skills/notify/SKILL.md

notify

Skill0 starsChanged 3 months agoMITView on GitHub

Sets up, configures, and troubleshoots opencode notifications — Telegram bot and OS desktop notifications (WSL/Windows/Linux/macOS). Use when the user wants to be notified when opencode asks a question, asks for permission, or finishes a response; when setting up a Telegram bot (BotFather token, chat id); when configuring the opencode-notify plugin env vars; when the user asks to turn notifications off, enable or disable Telegram or OS notifications, or change a notification event (response finished / permission / question); when notifications are not arriving.

  • Reads credentials
  • Sends data out

13 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions13 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 13

    1. udecode/plate★ 17ksame name
    2. zjunlp/Mechanist★ 75same name
    3. jonhill90/skills★ 8same name
    4. yangwhale/CloseCrab★ 5same name
    5. jord0-cmd/jord0.skills★ 1same name
    6. vhmarquez/argo★ 1same name
    7. JordanHood/claude-skills★ 0same name
    8. microsoft/IssueLens★ 0same name
    9. Odonno/doc2skill★ 0same name
    10. possibilities/agentguidance★ 0same name

    3 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the plugin/script symlinks are missing, re-run ~/.opencode-notify/install.sh.

    line 44
  2. Very specific:

    Look for "message": { "chat": { "id": <your-id> } }.

    line 58
  3. Distinctive:

    No message in the chat? Fix token/chat id before continuing.

    line 67
  4. Very specific:

    Never commit the token; never store it in memory.md or AGENTS.md.

    line 82
  5. Distinctive:

    Every event toggle defaults to on — see the request→change map below.

    line 121
  6. Distinctive:

    When the user asks to turn notifications on/off, enable or disable a channel, or change an event, apply the request with this procedure:

    line 135
  7. Distinctive:

    If bash is auto-allowed (default in many setups), no permission.asked event is emitted — nothing to fix, it's expected silence.

    line 187
  8. Distinctive:

    Restart opencode: after any config edit.

    line 203
  9. Distinctive:

    Verify the channel independently: run the curl smoke test from section 3.

    line 210
  10. Distinctive:

    If curl works but opencode doesn't, it's a config problem (previous bullet).

    line 211
  11. Very specific:

    If the manual run works but opencode is still quiet, the plugin did not load: check ls -l the plugin symlink and restart opencode.

    line 218

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

notify — opencode notifications (OS + Telegram)

The opencode-notify plugin (installed by install.sh) sends a notification on three kinds of events:

EventNotification
session.idle (root session)"response finished"
permission.asked"asking permission"
question tool invoked (tool.execute.before)"question" (sent when asked, before the user answers)

Two channels, each independently togglable:

  • OS desktop — dispatched by scripts/notify.sh, auto-detects the platform (WSL → Windows toast, macOS → osascript, Linux → notify-send, Windows → BurntToast).
  • Telegram — optional; only active when a bot token + chat id are configured.

Repo: https://github.com/thenickz/opencode-notify

1. Install (first time)

git clone https://github.com/thenickz/opencode-notify.git ~/.opencode-notify
~/.opencode-notify/install.sh

This symlinks the plugin into ~/.config/opencode/plugins/, the dispatcher into ~/.config/opencode/notify.sh, the skill into the tools' skill paths, and creates a commented config template at ~/.config/opencode/opencode-notify.env (only if the file does not exist). Restart opencode afterwards — plugins load at startup.

2. Check current state

ls -l ~/.config/opencode/plugins/opencode-notify.js ~/.config/opencode/notify.sh 2>&1
env | grep -E '^OPENCODE_(NOTIFY|TELEGRAM)' || echo "no OPENCODE_NOTIFY/TELEGRAM env vars set"

If the plugin/script symlinks are missing, re-run ~/.opencode-notify/install.sh.

3. Set up Telegram (guided)

  1. Create a bot with @BotFather: send /newbot, pick a name and a username ending in bot. Copy the token (123456789:AA...).
  2. Start the chat: open the bot and press Start (send /start). A bot cannot message you until you do this.
  3. Get your chat id: open in a browser, replacing <BOT_TOKEN>:

    https://api.telegram.org/bot<BOT_TOKEN>/getUpdates

    Look for "message": { "chat": { "id": <your-id> } }. Group chats use a negative id. If empty, send another message to the bot and refresh.

  4. Smoke test (from any shell):

    curl -sS -X POST "https://api.telegram.org/bot<BOT_TOKEN>/sendMessage" \
      -d "chat_id=<CHAT_ID>" --data-urlencode "text=opencode notify smoke test"

    No message in the chat? Fix token/chat id before continuing.

  5. Persist the config (recommended: the plugin's env file — survives stale shells, no source needed):

    tee -a ~/.config/opencode/opencode-notify.env >/dev/null <<'EOF'
    OPENCODE_TELEGRAM_BOT_TOKEN="<BOT_TOKEN>"
    OPENCODE_TELEGRAM_CHAT_ID="<CHAT_ID>"
    EOF
    chmod 600 ~/.config/opencode/opencode-notify.env

    (Alternative, legacy: add the two export ... lines to ~/.bashrc and source ~/.bashrc.)

    Never commit the token; never store it in memory.md or AGENTS.md.

  6. Restart opencode so the plugin picks up the new environment.

4. Set up OS notifications on WSL (optional, recommended)

On WSL the Linux notify-send does not surface on Windows. The dispatcher prefers PowerShell + BurntToast (it fails loudly when a toast cannot be created), then wsl-notify-send.exe, then notify-send.

  1. Install the BurntToast module (per-user, no admin): powershell.exe -NoProfile -NonInteractive -Command "Install-Module -Name BurntToast -Scope CurrentUser -Force -AllowClobber"
  2. (Alternative) wsl-notify-send.exe from https://github.com/stuartleeks/wsl-notify-send/releases, placed somewhere in the Windows PATH. Caveat: it exits 0 even when Windows silently drops the toast (missing Start Menu shortcut for its app id) — BurntToast is more reliable.
  3. Test:

    OPENCODE_NOTIFY_DEBUG=1 ~/.config/opencode/notify.sh "opencode" "OS toast test" done

    You should see a Windows toast. If no channel is available, the dispatcher prints the failure only with OPENCODE_NOTIFY_DEBUG=1.

5. Configuration

Config comes from two sources, merged at plugin load — the config file wins over the environment:

  • Config file (canonical): ~/.config/opencode/opencode-notify.env — one KEY=value per line, # comments, optional export prefix and surrounding single/double quotes allowed; no inline comments. install.sh creates a commented template if the file is missing. Because the plugin reads the file directly, edits apply even when opencode was launched from a shell whose environment predates the change — no source ~/.bashrc or new terminal needed. Keep it private (chmod 600; it may hold the Telegram token).
  • Environment variables: any OPENCODE_* var in the shell (e.g. from ~/.bashrc) — used as a fallback for keys not present in the file.

Every event toggle defaults to on — see the request→change map below.

VarMeaning
OPENCODE_NOTIFY_DISABLED=1master switch (disables both channels)
OPENCODE_NOTIFY_OS=autoauto | darwin | linux | wsl | windows | none
OPENCODE_NOTIFY_ON_DONE / _ON_PERMISSION / _ON_QUESTION=0disable an OS event
OPENCODE_NOTIFY_DEBUG=1print dispatcher errors
OPENCODE_TELEGRAM_BOT_TOKENenables Telegram
OPENCODE_TELEGRAM_CHAT_IDtarget chat
OPENCODE_TELEGRAM_ON_DONE / _ON_PERMISSION / _ON_QUESTION=0disable a Telegram event

Changing config when the user asks

When the user asks to turn notifications on/off, enable or disable a channel, or change an event, apply the request with this procedure:

  1. Find the current values: grep -n OPENCODE ~/.config/opencode/opencode-notify.env (if the file is missing, create it: re-run install.sh or copy the template from the repo).
  2. Edit/add the matching OPENCODE_* line(s) in that file. A key present in the file overrides the environment — remove the line to fall back to the env.
  3. Tell the user to restart opencode so the plugin re-reads the file (no source needed).

If the user has an existing ~/.bashrc setup (no env file yet), you may keep editing ~/.bashrc — but prefer creating the env file so future edits do not depend on the launching shell. (See issue #1: stale parent shell.)

Request → change map (defaults = all events on, both channels):

User asksChange
"turn off notifications"add export OPENCODE_NOTIFY_DISABLED=1
"turn notifications back on"remove/comment that line
"only Telegram"export OPENCODE_NOTIFY_OS=none
"turn OS back on"set OPENCODE_NOTIFY_OS=auto (or delete the line)
"turn off Telegram"comment out OPENCODE_TELEGRAM_BOT_TOKEN and OPENCODE_TELEGRAM_CHAT_ID (channel becomes inactive)
"turn Telegram back on"uncomment / restore the two OPENCODE_TELEGRAM_* lines
"stop notifying when a response ends"OPENCODE_NOTIFY_ON_DONE=0 and/or OPENCODE_TELEGRAM_ON_DONE=0
"stop notifying on permission"OPENCODE_NOTIFY_ON_PERMISSION=0 and/or OPENCODE_TELEGRAM_ON_PERMISSION=0
"stop notifying on questions"OPENCODE_NOTIFY_ON_QUESTION=0 and/or OPENCODE_TELEGRAM_ON_QUESTION=0
"turn that event back on"delete the =0 (or set to 1)
"send to another chat / user"change OPENCODE_TELEGRAM_CHAT_ID

Note: the plugin reads the config file (and snapshots env) at startup, so a running opencode ignores edits until it restarts — always end with the restart reminder.

6. Testing all three notifications

Restart opencode, then send this prompt in a session with the plugin loaded:

Test notifications: first ask me a question with the question tool, then request
permission to run a harmless command like `pwd` (set permission to ask for bash
if needed), then finish your response.

Expected, in order: OS/Telegram "question", "asking permission", then "response finished". If a channel is quiet, follow the diagnosis in section 7.

Notes:

  • "response finished" (session.idle) can fire twice for the same session in a few ms; the plugin dedupes duplicates within a 3s window.
  • The "permission" event only fires when opencode actually asks for permission. If bash is auto-allowed (default in many setups), no permission.asked event is emitted — nothing to fix, it's expected silence.
  • For tracing, run opencode with OPENCODE_NOTIFY_DEBUG=1 (plugin writes /tmp/opencode/notify-debug.log); remove the var for normal use.

7. Troubleshooting (self-diagnosis)

Diagnose in this order. Stop at the first section that explains the symptom.

  1. Nothing arrives at all — check in order:
    • grep OPENCODE_NOTIFY_DISABLED ~/.config/opencode/opencode-notify.env and env | grep OPENCODE_NOTIFY_DISABLED → neither must be 1.
    • ls -l ~/.config/opencode/plugins/opencode-notify.js → must exist (re-run ~/.opencode-notify/install.sh if missing).
    • The plugin reads config (file, then env) at startup — a terminal that predates an export change won't see it, but the env file works regardless. Restart opencode after any config edit.
  2. Telegram silent — one of:
    • /start was never sent to the bot (mandatory first step).
    • Token and chat id swapped or mistyped.
    • The opencode process never received the env vars (add them to ~/.config/opencode/opencode-notify.env, or export in the same shell that starts opencode / add to ~/.bashrc).
    • Verify the channel independently: run the curl smoke test from section 3. If curl works but opencode doesn't, it's a config problem (previous bullet).
  3. OS silent — run the dispatcher by hand to isolate the plugin: OPENCODE_NOTIFY_DEBUG=1 ~/.config/opencode/notify.sh "opencode" "test" done
    • WSL: install BurntToast (section 4). wsl-notify-send.exe may exit 0 without showing a toast if its app id has no Start Menu shortcut.
    • Linux: install notify-send (package libnotify-bin/libnotify) and check there is a display (Wayland/x11 session).
    • If the manual run works but opencode is still quiet, the plugin did not load: check ls -l the plugin symlink and restart opencode.
  4. Plugin loads but still silent — run opencode with OPENCODE_NOTIFY_DEBUG=1; the plugin appends a trace to /tmp/opencode/notify-debug.log. Look at the final lines: does it log osNotify: kind=... enabled / tgNotify: kind=... sending? If neither appears, the event never reached the plugin (dedupe? wrong session?).
  5. Only one channel missing — that channel is off. Check the per-channel and per-event toggles in the table in section 5, and OPENCODE_NOTIFY_OS.
  6. Still broken after all of the above — create an issue at https://github.com/thenickz/opencode-notify/issues with:
    • opencode --version
    • output of env | grep '^OPENCODE_'
    • the tail of /tmp/opencode/notify-debug.log (if any)
    • the OS/WSL distribution

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.