Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

feat(pocket): config-driven notifications dispatcher + interactive setup; release 2.13.0 (#376)

Aurora Capital8ee903e8aa37
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index a3d24a8d..bc06fbe3 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -11,7 +11,7 @@
"name": "ops",
"description": "Business operations command center for Claude Code — 37 skills, 19 agents, smart background daemon. Manage communications (WhatsApp/Email/Slack/Telegram), projects, infrastructure (AWS), revenue (Stripe+RevenueCat), e-commerce, marketing, monitoring (Datadog/New Relic/OTEL), voice, and smart home (Homey Pro). Includes /gtm go-to-market planner, /ops:projects portfolio dashboard, /ops:ops-home control surface, and YOLO autonomous mode with 4 parallel C-suite agents.",
"source": "./claude-ops",
- "version": "2.12.0",
+ "version": "2.13.0",
"category": "productivity",
"keywords": [
"ops",
diff --git a/claude-ops/.claude-plugin/plugin.json b/claude-ops/.claude-plugin/plugin.json
index 6a954583..6c723680 100644
--- a/claude-ops/.claude-plugin/plugin.json
+++ b/claude-ops/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "ops",
- "version": "2.12.0",
+ "version": "2.13.0",
"description": "Business operations command center for Claude Code — 37 skills, 19 agents, and a smart background daemon that manage communications (WhatsApp/Email/Slack/Telegram), projects, infrastructure (all AWS services), revenue (Stripe + RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4/GSC), monitoring (Datadog/New Relic/OTEL), and voice (Bland AI/ElevenLabs/Whisper). Includes /gtm go-to-market planner, /ops:projects portfolio dashboard, YOLO mode for autonomous operation with 4 parallel C-suite agents, and /ops:ops-home smart home control via Homey Pro.",
"author": {
"name": "Lifecycle Innovations Limited",
diff --git a/claude-ops/CHANGELOG.md b/claude-ops/CHANGELOG.md
index 2486c660..978ea218 100644
--- a/claude-ops/CHANGELOG.md
+++ b/claude-ops/CHANGELOG.md
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+## [2.13.0] — 2026-05-29
+
+### Added
+
+- **Config-driven pocket notifications (`ops-pocket-notify`) — interactive setup of which events, which channels, when.** Pocket components emit an *event id*; the new `bin/ops-pocket-notify` dispatcher decides routing from `preferences.json → pocket.notifications`: per-event channels (telegram/email/whatsapp/slack via the existing senders + out-queue), plus a **full per-event schedule** — cooldown, quiet-hours, active-days, and severity escalation (high bypasses windows). New events are **off by default**. `/ops:ops-settings → Configure notifications` walks each event interactively (channels + schedule + dry-run test-send) and writes the prefs; `docs/pocket-notifications.md` documents the schema + event taxonomy. The executor emits `worker.spawned` / `worker.failed`, and the env-broker's notify hook points at the dispatcher. `--dry-run --json` resolves routing without sending (used by setup + tests).
+
+
## [2.12.0] — 2026-05-29
### Added
diff --git a/claude-ops/bin/ops-pocket-notify b/claude-ops/bin/ops-pocket-notify
new file mode 100755
index 00000000..459082d8
--- /dev/null
+++ b/claude-ops/bin/ops-pocket-notify
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Thin wrapper so `ops-pocket-notify` is on PATH; the implementation is Python.
+exec python3 "$(dirname "$0")/../scripts/ops-pocket-notify.py" "$@"
diff --git a/claude-ops/docs/pocket-notifications.md b/claude-ops/docs/pocket-notifications.md
new file mode 100644
index 00000000..1d1c253c
--- /dev/null
+++ b/claude-ops/docs/pocket-notifications.md
@@ -0,0 +1,101 @@
+# Pocket notifications
+
+Config-driven notifications for the whole pocket module: pocket components emit an
+**event id**; the `ops-pocket-notify` dispatcher decides — from
+`preferences.json → pocket.notifications` — **which channels** to send on, and
+**when** (per-event schedule + cooldown + severity escalation). The operator picks
+all of this **interactively** via `/ops:setup` / `/ops:ops-settings`; emitters
+never hardcode channels or timing.
+
+## Flow
+
+```
+component ──ops-pocket-notify <event> <msg> [--severity]──▶ dispatcher
+ │ reads preferences.json
+ │ pocket.notifications.events[<event>]
+ │ schedule + cooldown + severity gate
+ ▼
+ channels: telegram | email | whatsapp | slack
+ (via ops-telegram-bot-send / out-queue drain)
+```
+
+## Event taxonomy (whole module)
+
+| Event | Emitted by | When |
+|-------|-----------|------|
+| `env-broker.uid-rejected` | pocket-env-broker | a non-worker uid tried to pull a secret (probing signal) |
+| `env-broker.denied` | pocket-env-broker | a worker requested a non-allowlisted secret |
+| `worker.spawned` | executor | a worker started |
+| `worker.completed` | executor | a worker finished successfully |
+| `worker.failed` | executor | a worker exited non-zero / timed out |
+| `queue.stuck` | watcher | the task queue stopped draining |
+| `daemon.down` | daemon manager | a pocket daemon is not running |
+
+New events are **off by default** (no channels) until opted in.
+
+## preferences.json schema
+
+```json
+{
+ "pocket": {
+ "notifications": {
+ "tz": "Europe/Amsterdam",
+ "default_cooldown": 300,
+ "defaults": { "channels": [], "severity": "medium" },
+ "events": {
+ "env-broker.uid-rejected": {
+ "channels": ["telegram"], "severity": "high",
+ "schedule": { "cooldown": 60 }
+ },
+ "env-broker.denied": {
+ "channels": ["telegram"], "severity": "medium",
+ "schedule": { "cooldown": 300, "quiet_hours": { "start": "22:00", "end": "08:00" } }
+ },
+ "worker.failed": { "channels": ["email"], "severity": "medium" },
+ "worker.completed": { "channels": [] },
+ "queue.stuck": { "channels": ["telegram", "email"], "severity": "high" },
+ "daemon.down": { "channels": ["telegram", "email"], "severity": "high" }
+ }
+ }
+ }
+}
+```
+
+### Per-event `schedule`
+
+| Key | Meaning |
+|-----|---------|
+| `cooldown` | seconds between sends for the same event (rate-limit) |
+| `quiet_hours` | `{start,end}` `HH:MM` window where the event is suppressed |
+| `active_days` | weekday ints `0=Mon..6=Sun`; absent/empty = every day |
+| `escalate_severities` | severities that BYPASS quiet_hours/active_days (default `["high"]`) |
+
+So a `high`-severity probe always pages you, even at 3am; a `medium` "worker
+completed" respects quiet hours and active days.
+
+## Channels
+
+| Channel | Sent via |
+|---------|----------|
+| `telegram` | `ops-telegram-bot-send` (operator self-chat — outbound-gate exempt) |
+| `email` | enqueued to `supervisor-out-queue.jsonl` (drained by `ops-pocket-out-queue`) |
+| `whatsapp` | enqueued to the out-queue |
+| `slack` | enqueued to the out-queue |
+
+## Usage / testing
+
+```bash
+ops-pocket-notify worker.failed "task X failed" --severity medium
+ops-pocket-notify env-broker.uid-rejected "uid 1001 probed GOG_ACCOUNT" --severity high --dry-run --json
+```
+
+`--dry-run --json` resolves the event against preferences and prints which
+channels *would* fire (and any suppression reason) without sending — used by the
+setup flow's **test-send** and by the test suite.
+
+## Interactive setup
+
+`/ops:setup` → *pocket notifications* (and `/ops:ops-settings`) walks each event:
+pick channels (≤4 per prompt, paginated), set the schedule (cooldown, quiet
+hours, active days, escalation), and fire a `--dry-run` preview. Writes
+`pocket.notifications` into `preferences.json`.
diff --git a/claude-ops/package.json b/claude-ops/package.json
index 3ccddef5..f524f30e 100644
--- a/claude-ops/package.json
+++ b/claude-ops/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-ops-bin",
- "version": "2.12.0",
+ "version": "2.13.0",
"private": true,
"description": "Runtime dependencies for claude-ops bin scripts (ops-telegram-autolink.mjs, ops-slack-autolink.mjs). Installed separately from telegram-server/ so the .mjs scripts resolve modules from claude-ops/node_modules regardless of invocation cwd.",
"type": "module",
diff --git a/claude-ops/scripts/ops-cron-pocket-executor.py b/claude-ops/scripts/ops-cron-pocket-executor.py
index e72a83be..ed8d0632 100755
--- a/claude-ops/scripts/ops-cron-pocket-executor.py
+++ b/claude-ops/scripts/ops-cron-pocket-executor.py
@@ -327,6 +327,18 @@ def build_worker_prompt(task: dict) -> str:
)
+def _pocket_notify(event: str, message: str, severity: str = "medium") -> None:
+ """Emit a pocket notification event (best-effort, never blocks the tick).
+ Routing/channels/timing are decided by ops-pocket-notify from preferences."""
+ try:
+ subprocess.run(
+ ["ops-pocket-notify", event, message, "--severity", severity],
+ stdin=subprocess.DEVNULL, capture_output=True, timeout=20, check=False,
+ )
+ except (OSError, subprocess.SubprocessError):
+ pass
+
+
def spawn_worker(task: dict) -> dict | None:
"""Spawn a `claude -p` subprocess for the task. Returns in-flight
record on success, None on failure."""
@@ -430,6 +442,7 @@ def spawn_worker(task: dict) -> dict | None:
"spawn_mode": "claude-bg",
})
log(f"spawned {worker_id} pid={proc.pid} task={task_id} bg_session={bg_session_id or 'unknown'}")
+ _pocket_notify("worker.spawned", f"worker started for {task_id}: {(task.get('title') or '')[:80]}")
return record
@@ -489,6 +502,7 @@ def reap_workers(in_flight: dict[str, dict]) -> tuple[int, int]:
if not bg_session_id:
if now > rec.get("deadline_epoch", now + 1):
log(f"worker {worker_id} claude-bg missing session id — timed out")
+ _pocket_notify("worker.failed", f"worker {worker_id} timed out (no session id)", "high")
killed += 1
del in_flight[worker_id]
continue
@@ -500,6 +514,7 @@ def reap_workers(in_flight: dict[str, dict]) -> tuple[int, int]:
# Still in-flight or daemon unreachable. Apply deadline timeout.
if now > rec.get("deadline_epoch", now + 1):
log(f"worker {worker_id} bg={bg_session_id} timed out — stopping session")
+ _pocket_notify("worker.failed", f"worker {worker_id} timed out and was stopped", "high")
try:
subprocess.run([CLAUDE_BIN, "stop", bg_session_id],
stdin=subprocess.DEVNULL, capture_output=True, timeout=10)
diff --git a/claude-ops/scripts/ops-pocket-notify.py b/claude-ops/scripts/ops-pocket-notify.py
new file mode 100755
index 00000000..8ddc0835
--- /dev/null
+++ b/claude-ops/scripts/ops-pocket-notify.py
@@ -0,0 +1,234 @@
+#!/usr/bin/env python3
+"""ops-pocket-notify — config-driven notification dispatcher for the pocket module.
+
+Pocket components (env-broker, executor, watcher, daemon) emit an EVENT id; this
+dispatcher decides — from `preferences.json → pocket.notifications` — which
+channels to notify, applies the per-event schedule (active/quiet windows) +
+cooldown + severity escalation, and sends via the existing channel helpers. The
+emitters never know about channels or timing; all routing lives in preferences,
+which the interactive /ops:setup flow writes.
+
+Usage:
+ ops-pocket-notify <event-id> <message> [--severity low|medium|high]
+ [--dry-run] [--json]
+
+Resolution order for an event's config:
+ pocket.notifications.events[<event-id>] → pocket.notifications.defaults
+Channels default to [] (off) when unconfigured, so a brand-new event is silent
+until the operator opts it in.
+
+Schedule (per event, under "schedule"):
+ cooldown seconds between sends for the same event (rate-limit)
+ quiet_hours {"start":"HH:MM","end":"HH:MM"} — suppressed window
+ active_days list of weekday ints (0=Mon..6=Sun); empty/absent = all
+ escalate_severities severities that BYPASS quiet_hours/active_days (default ["high"])
+
+Exit: 0 if dispatched or intentionally suppressed; 2 on bad usage.
+
+Env:
+ PREFS_PATH preferences.json (default plugin data dir)
+ POCKET_STATE_DIR cooldown-state + log dir (default /var/lib/pocket-pipeline)
+ POCKET_NOTIFY_TZ IANA tz for schedule (default from prefs, else system)
+ OPS_NOTIFY_DRY_RUN=1 force dry-run
+"""
+from __future__ import annotations
+
+import json
+import os
+import subprocess
+import sys
+from datetime import datetime, time as dtime
+from pathlib import Path
+
+try:
+ from zoneinfo import ZoneInfo
+except ImportError: # pragma: no cover
+ ZoneInfo = None # type: ignore
+
+PLUGIN_DATA = os.environ.get(
+ "CLAUDE_PLUGIN_DATA_DIR",
+ os.path.expanduser("~/.claude/plugins/data/ops-ops-marketplace"),
+)
+PREFS_PATH = Path(os.environ.get("PREFS_PATH", os.path.join(PLUGIN_DATA, "preferences.json")))
+STATE_DIR = Path(os.environ.get("POCKET_STATE_DIR", "/var/lib/pocket-pipeline"))
+COOLDOWN_STATE = STATE_DIR / ".notify-cooldown.json"
+NOTIFY_LOG = STATE_DIR / "notify-dispatch.log"
+OUT_QUEUE = STATE_DIR / "supervisor-out-queue.jsonl"
+
+DEFAULT_ESCALATE = ["high"]
+
+
+def _log(msg: str) -> None:
+ line = f"{datetime.now().astimezone().isoformat(timespec='seconds')} [ops-pocket-notify] {msg}"
+ print(line, file=sys.stderr)
+ try:
+ STATE_DIR.mkdir(parents=True, exist_ok=True)
+ with NOTIFY_LOG.open("a") as f:
+ f.write(line + "\n")
+ except OSError:
+ pass
+
+
+def _load_prefs_notifications() -> dict:
+ try:
+ d = json.loads(PREFS_PATH.read_text())
+ return d.get("pocket", {}).get("notifications", {}) or {}
+ except (OSError, json.JSONDecodeError):
+ return {}
+
+
+def _event_config(notif: dict, event: str) -> dict:
+ defaults = notif.get("defaults", {}) or {}
+ ev = (notif.get("events", {}) or {}).get(event, {}) or {}
+ # merged: event overrides defaults; schedule merged shallowly
+ merged = {**defaults, **ev}
+ sched = {**(defaults.get("schedule", {}) or {}), **(ev.get("schedule", {}) or {})}
+ if sched:
+ merged["schedule"] = sched
+ return merged
+
+
+def _tz(notif: dict):
+ name = os.environ.get("POCKET_NOTIFY_TZ") or notif.get("tz")
+ if name and ZoneInfo is not None:
+ try:
+ return ZoneInfo(name)
+ except Exception:
+ return None
+ return None
+
+
+def _parse_hhmm(s: str) -> dtime | None:
+ try:
+ h, m = s.split(":")
+ return dtime(int(h), int(m))
+ except (ValueError, AttributeError):
+ return None
+
+
+def _in_quiet_hours(now: datetime, qh: dict) -> bool:
+ start = _parse_hhmm(qh.get("start", ""))
+ end = _parse_hhmm(qh.get("end", ""))
+ if not start or not end:
+ return False
+ t = now.timetz().replace(tzinfo=None)
+ if start <= end:
+ return start <= t < end
+ # window wraps midnight (e.g. 22:00→08:00)
+ return t >= start or t < end
+
+
+def _schedule_suppresses(cfg: dict, severity: str, now: datetime) -> str | None:
+ sched = cfg.get("schedule", {}) or {}
+ escalate = sched.get("escalate_severities", DEFAULT_ESCALATE)
+ if severity in escalate:
+ return None # high-severity always pages, ignores windows
+ active_days = sched.get("active_days")
+ if active_days and now.weekday() not in active_days:
+ return "inactive_day"
+ qh = sched.get("quiet_hours", {}) or {}
+ if qh and _in_quiet_hours(now, qh):
+ return "quiet_hours"
+ return None
+
+
+def _cooldown_suppresses(event: str, cooldown: int, now_ts: float) -> bool:
+ if cooldown <= 0:
+ return False
+ try:
+ state = json.loads(COOLDOWN_STATE.read_text())
+ except (OSError, json.JSONDecodeError):
+ state = {}
+ last = state.get(event, 0)
+ if now_ts - last < cooldown:
+ return True
+ state[event] = now_ts
+ try:
+ COOLDOWN_STATE.parent.mkdir(parents=True, exist_ok=True)
+ tmp = COOLDOWN_STATE.with_suffix(".json.tmp")
+ tmp.write_text(json.dumps(state))
+ tmp.replace(COOLDOWN_STATE)
+ except OSError:
+ pass
+ return False
+
+
+def _enqueue(kind: str, payload: dict) -> None:
+ rec = {"kind": kind, **payload}
+ OUT_QUEUE.parent.mkdir(parents=True, exist_ok=True)
+ with OUT_QUEUE.open("a") as f:
+ f.write(json.dumps(rec) + "\n")
+
+
+def _send(channel: str, message: str, event: str, severity: str) -> bool:
+ """Best-effort send to one channel via the existing helpers. Returns True on
+ dispatch (queued counts as dispatched)."""
+ subject = f"[pocket:{severity}] {event}"
+ if channel == "telegram":
+ r = subprocess.run(["ops-telegram-bot-send", message], capture_output=True, timeout=20)
+ return r.returncode == 0
+ if channel == "email":
+ _enqueue("email", {"subject": subject, "body": message})
+ return True
+ if channel == "whatsapp":
+ _enqueue("whatsapp", {"message": message})
+ return True
+ if channel == "slack":
+ _enqueue("slack", {"text": f"{subject}: {message}"})
+ return True
+ _log(f"unknown channel {channel!r} — skipped")
+ return False
+
+
+def main(argv: list[str]) -> int:
+ args = [a for a in argv[1:] if not a.startswith("--")]
+ flags = {a for a in argv[1:] if a.startswith("--")}
+ severity = "medium"
+ if "--severity" in argv:
+ i = argv.index("--severity")
+ if i + 1 < len(argv):
+ severity = argv[i + 1]
+ args = [a for a in args if a != severity]
+ if len(args) < 2:
+ print("usage: ops-pocket-notify <event-id> <message> [--severity low|medium|high] [--dry-run] [--json]", file=sys.stderr)
+ return 2
+ event, message = args[0], args[1]
+ dry = "--dry-run" in flags or os.environ.get("OPS_NOTIFY_DRY_RUN") == "1"
+
+ notif = _load_prefs_notifications()
+ cfg = _event_config(notif, event)
+ channels = cfg.get("channels", []) or []
+ severity = severity if "--severity" in argv else cfg.get("severity", severity)
+ cooldown = int(cfg.get("schedule", {}).get("cooldown", cfg.get("cooldown", notif.get("default_cooldown", 0))) or 0)
+
+ result = {"event": event, "severity": severity, "configured_channels": channels,
+ "fired": [], "suppressed": None}
+
+ if not channels:
+ result["suppressed"] = "no_channels_configured"
+ else:
+ now = datetime.now(_tz(notif))
+ sup = _schedule_suppresses(cfg, severity, now)
+ if sup:
+ result["suppressed"] = sup
+ elif not dry and _cooldown_suppresses(event, cooldown, now.timestamp()):
+ result["suppressed"] = "cooldown"
+ elif dry:
+ result["fired"] = channels # would-fire
+ else:
+ for ch in channels:
+ try:
+ if _send(ch, message, event, severity):
+ result["fired"].append(ch)
+ except (OSError, subprocess.SubprocessError) as e:
+ _log(f"send {ch} failed: {e}")
+
+ if not dry:
+ _log(f"event={event} severity={severity} fired={result['fired']} suppressed={result['suppressed']}")
+ if "--json" in flags:
+ print(json.dumps(result))
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/claude-ops/skills/ops-settings/SKILL.md b/claude-ops/skills/ops-settings/SKILL.md
index 51bd9b1d..0a20427b 100644
--- a/claude-ops/skills/ops-settings/SKILL.md
+++ b/claude-ops/skills/ops-settings/SKILL.md
@@ -256,6 +256,60 @@ F="$HOME/.claude/state/pocket/email-config.json"
jq --arg v "$NEW_ADDR" '.self_address = $v | .from_account = $v' "$F" > "${F}.tmp" && mv "${F}.tmp" "$F"
```
+### Configure notifications (per-event)
+
+Fine-grained, per-event routing for the whole pocket module, dispatched by
+`ops-pocket-notify` and stored in `preferences.json → pocket.notifications`
+(schema + event list: `docs/pocket-notifications.md`). This is the interactive
+"which notifications, which channels, when" surface.
+
+1. **Pick the event to configure.** The event list can exceed 4, so paginate per
+ Rule 1 (`AskUserQuestion`, ≤4 options, `[More events…]` to advance):
+
+ ```
+ Which pocket event?
+ [env-broker.uid-rejected (security)] [env-broker.denied] [worker.failed] [More events…]
+ ```
+ Page 2: `[worker.completed] [worker.spawned] [queue.stuck] [More events…]`,
+ page 3: `[daemon.down] [Done]`.
+
+2. **Pick channels for that event** (multi-select, ≤4 — only offer channels that
+ are configured per `View status` above):
+
+ ```
+ Notify on <event> via: (multi-select)
+ [Telegram] [Email] [WhatsApp] [Slack]
+ ```
+
+3. **Set the schedule** for that event (one `AskUserQuestion` each, as needed):
+ - Severity: `[low] [medium] [high]` (high bypasses quiet hours).
+ - Cooldown: `[60s] [5 min] [30 min] [No limit]`.
+ - Quiet hours: `[22:00–08:00] [None] [Custom…]`.
+ - Active days: `[Every day] [Weekdays] [Custom…]`.
+
+4. **Write it** to `preferences.json` (create the path if absent):
+
+ ```bash
+ PREFS="${CLAUDE_PLUGIN_DATA_DIR:-$HOME/.claude/plugins/data/ops-ops-marketplace}/preferences.json"
+ tmp="$(mktemp)"
+ jq --arg ev "$EVENT" --argjson chans "$CHANNELS_JSON" --arg sev "$SEVERITY" \
+ --argjson cooldown "$COOLDOWN" \
+ '.pocket.notifications.events[$ev] = {channels: $chans, severity: $sev, schedule: {cooldown: $cooldown}}' \
+ "$PREFS" > "$tmp" && mv "$tmp" "$PREFS"
+ ```
+ (Merge `quiet_hours` / `active_days` into `.schedule` the same way when set.)
+
+5. **Test-send** the event so the operator confirms routing without waiting for a
+ real trigger:
+
+ ```bash
+ ops-pocket-notify "$EVENT" "test notification from /ops:setup" --severity "$SEVERITY" --dry-run --json
+ ```
+ Show the `fired` channels (or the `suppressed` reason). Offer a real send
+ (drop `--dry-run`) for the chosen event so they see it land on the device.
+
+Repeat from step 1 for the next event, or `[Done]`.
+
### Force a fresh Pocket pull
Run the watcher directly (picks up POCKET_API_KEY from keychain/env):
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index 551dedb7..f798b5ab 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -42,6 +42,7 @@ run_suite "$TESTS_DIR/test-claude-md.sh"
run_suite "$TESTS_DIR/test-no-secrets.sh"
run_suite "$TESTS_DIR/test-agent-teams.sh"
run_suite "$TESTS_DIR/test-pocket-env-broker.sh"
+run_suite "$TESTS_DIR/test-ops-pocket-notify.sh"
run_suite "$TESTS_DIR/test-ops-daemon-manager.sh"
run_suite "$TESTS_DIR/test-ops-package.sh"
run_suite "$TESTS_DIR/test-safety-hooks.sh"
diff --git a/claude-ops/tests/test-ops-pocket-notify.sh b/claude-ops/tests/test-ops-pocket-notify.sh
new file mode 100644
index 00000000..398c18f8
--- /dev/null
+++ b/claude-ops/tests/test-ops-pocket-notify.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+# test-ops-pocket-notify.sh — config-driven notification dispatcher: channel
+# resolution, off-by-default, per-event schedule (inactive-day), severity
+# escalation past the schedule, and cooldown rate-limiting. No external channels:
+# uses the 'email' channel which enqueues to a local out-queue file.
+set -uo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+NOTIFY="$PLUGIN_ROOT/scripts/ops-pocket-notify.py"
+PY="$(command -v python3 || true)"
+
+pass=0
+fail=0
+ok() { echo " PASS: $1"; pass=$((pass + 1)); }
+err() {
+ echo " FAIL: $1 — $2"
+ fail=$((fail + 1))
+}
+
+echo "Testing ops-pocket-notify"
+echo ""
+if [[ -z "$PY" ]]; then
+ echo " SKIP: python3 unavailable"
+ echo "test-ops-pocket-notify.sh: 0 passed, 0 failed (skipped)"
+ exit 0
+fi
+
+TMP="$(mktemp -d)"
+trap 'rm -rf "$TMP"' EXIT
+NOT_TODAY="$("$PY" -c 'import datetime;print((datetime.date.today().weekday()+1)%7)')"
+cat >"$TMP/prefs.json" <<JSON
+{"pocket":{"notifications":{"default_cooldown":300,"events":{
+ "t.on":{"channels":["email"],"severity":"medium"},
+ "t.off":{"channels":[]},
+ "t.sched":{"channels":["email"],"severity":"medium","schedule":{"active_days":[$NOT_TODAY]}},
+ "t.high":{"channels":["email"],"severity":"high","schedule":{"active_days":[$NOT_TODAY]}},
+ "t.cool":{"channels":["email"],"severity":"medium","schedule":{"cooldown":300}}
+}}}}
+JSON
+
+dry() { PREFS_PATH="$TMP/prefs.json" POCKET_STATE_DIR="$TMP" "$PY" "$NOTIFY" "$1" msg --dry-run --json 2>/dev/null; }
+live() { PREFS_PATH="$TMP/prefs.json" POCKET_STATE_DIR="$TMP" "$PY" "$NOTIFY" "$1" msg --json 2>/dev/null; }
+
+echo "$(dry t.on)" | grep -q '"fired": \["email"\]' && ok "configured event resolves to its channels" || err "t.on" "$(dry t.on)"
+echo "$(dry t.off)" | grep -q '"suppressed": "no_channels_configured"' && ok "unconfigured event is off by default" || err "t.off" "$(dry t.off)"
+echo "$(dry t.sched)" | grep -q '"suppressed": "inactive_day"' && ok "schedule suppresses medium outside active days" || err "t.sched" "$(dry t.sched)"
+HI="$(dry t.high)"
+if echo "$HI" | grep -q '"fired": \["email"\]'; then ok "high severity escalates past the schedule"; else err "t.high" "$HI"; fi
+
+# cooldown: first live send fires (enqueues email), second within window is suppressed
+R1="$(live t.cool)"
+R2="$(live t.cool)"
+if echo "$R1" | grep -q '"fired": \["email"\]' && echo "$R2" | grep -q '"suppressed": "cooldown"'; then
+ ok "cooldown suppresses a repeat within the window"
+else
+ err "cooldown" "first=$R1 second=$R2"
+fi
+# the first live send should have enqueued an email to the out-queue
+if [[ -f "$TMP/supervisor-out-queue.jsonl" ]] && grep -q '"kind": "email"' "$TMP/supervisor-out-queue.jsonl"; then
+ ok "email channel enqueues to the out-queue"
+else
+ err "out-queue" "no email record: $(cat "$TMP/supervisor-out-queue.jsonl" 2>/dev/null)"
+fi
+
+echo ""
+echo "test-ops-pocket-notify.sh: $pass passed, $fail failed"
+[[ $fail -eq 0 ]]