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(ops-inbox): WhatsApp voice-note transcription + freshness gate (2.18.3)

Aurora Capital1ad524a97909
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index f1363da6..5c331648 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.18.2",
+ "version": "2.18.3",
"category": "productivity",
"keywords": [
"ops",
diff --git a/claude-ops/.claude-plugin/plugin.json b/claude-ops/.claude-plugin/plugin.json
index 30f1b914..eb66f500 100644
--- a/claude-ops/.claude-plugin/plugin.json
+++ b/claude-ops/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "ops",
- "version": "2.18.2",
+ "version": "2.18.3",
"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 9aec177d..5e582a99 100644
--- a/claude-ops/CHANGELOG.md
+++ b/claude-ops/CHANGELOG.md
@@ -1,5 +1,38 @@
# Changelog
+## 2.18.3 — 2026-05-31
+
+### Added
+- **WhatsApp voice-note auto-transcription.** New `scripts/whatsapp/transcribe_voice_notes.py`
+ finds incoming voice notes (`media_type='audio'`, empty `content`), downloads them via the
+ bridge `/api/download`, transcribes with OpenAI `whisper-1`, and writes `[voice] <text>`
+ back into `messages.content` — **only** where content is still empty, so it never clobbers
+ real text and is fully idempotent. Run by a new `whatsapp-transcribe.{service,timer}`
+ (systemd-user, every 10 min + 2 min after boot), so voice notes appear in `ops-inbox`
+ scans exactly like text. Cost-safe: `mkdir`-based single-instance lock, `--max` per-run
+ cap on the metered Whisper API, and idempotent updates (never re-bills a row).
+- **Pre-scan freshness gate** `bin/wa-inbox-fresh.sh`, installed to `~/bin`. `ops-inbox` runs
+ it FIRST in every WhatsApp scan: it connection-probes the bridge with **curl** (not
+ `ss | grep :8080`, which mis-resolves 8080 to the service name `webcache` and would bounce
+ a healthy bridge), forces a backfill, triggers transcription, waits (bounded ~32s) for the
+ store to settle, and prints a freshness report — only restarting the bridge if the curl
+ probe genuinely fails twice. Exit 2 signals an unrecoverable bridge so callers never
+ classify against a stale store.
+
+### Changed
+- `scripts/install-whatsapp-bridge-linux.sh` now also ships the voice-note transcriber and
+ the freshness gate, drops + enables the `whatsapp-transcribe.{service,timer}` units (reading
+ `OPENAI_API_KEY` from `~/.config/systemd/env/mcp-secrets.env`), and adds a
+ `--no-transcribe-timer` opt-out.
+- `skills/ops-inbox/SKILL.md` step-0 documents the freshness gate (run first) and that voice
+ notes are first-class (`[voice] …` bodies), alongside the existing backfill + contacts-link
+ auto-sync.
+
+> Folds in the bridge-side fixes already on `main` as of 2.18.x — outbound `/api/send`
+> persistence, the `resync_app_state` endpoint, MCP dict serialisation (#404), and the
+> WhatsApp autosync + LID contacts-link (#403) — and layers voice transcription + the
+> freshness gate on top.
+
## 2.18.1 — 2026-05-31
### Added
diff --git a/claude-ops/bin/wa-inbox-fresh.sh b/claude-ops/bin/wa-inbox-fresh.sh
new file mode 100755
index 00000000..535600cd
--- /dev/null
+++ b/claude-ops/bin/wa-inbox-fresh.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+# wa-inbox-fresh.sh — guarantee the WhatsApp bridge store is current BEFORE any
+# ops-inbox triage. Run this FIRST in every WhatsApp scan.
+#
+# 1. ensure the whatsmeow bridge is up + connected (restart if :8080 is dead)
+# 2. force a history backfill (POST /api/backfill)
+# 3. fill any new voice notes with transcripts (whatsapp-transcribe.service)
+# 4. wait (bounded) for the store's newest message to settle
+# 5. print a FRESHNESS report so the caller never classifies blind
+#
+# Exit 0 = store is as-fresh-as-this-bridge-can-be (report printed).
+# Exit 2 = bridge unreachable and could not be recovered (do NOT trust the store).
+#
+# HARD LIMIT (state it, don't hide it): messages YOU send from your PHONE may not
+# replicate to a companion bridge — WhatsApp's multi-device protocol does not
+# guarantee it (WhatsApp Web has the same gap). So for "did I already reply?",
+# the human's word is authoritative over this store.
+set -u
+DB="${WHATSAPP_BRIDGE_DB:-$HOME/.local/share/whatsapp-mcp/whatsapp-bridge/store/messages.db}"
+BRIDGE="http://127.0.0.1:8080"
+WAIT_TICKS="${WA_FRESH_WAIT_TICKS:-8}" # ×4s ≈ 32s max wait
+
+log() { printf '%s\n' "$*"; }
+
+# 1. bridge up? Liveness = a real TCP/HTTP connection to :8080 (curl exit 7 =
+# connection refused). Do NOT use `ss | grep :8080` — ss resolves 8080 to the
+# service name "webcache", so the grep never matches and we'd bounce a healthy
+# bridge. Only restart when the connection probe genuinely fails twice.
+alive() { curl -s -o /dev/null -m 4 "$BRIDGE/" >/dev/null 2>&1; } # exit 0 even on 404; nonzero only if not listening
+if ! { alive || { sleep 2; alive; }; }; then
+ log "wa-fresh: bridge :8080 not responding — restarting…"
+ systemctl --user restart whatsapp-bridge.service 2>/dev/null
+ for i in $(seq 1 10); do sleep 2; alive && break; done
+fi
+if ! alive; then
+ log "wa-fresh: ERROR bridge still down after restart — store is STALE, do not trust it"
+ exit 2
+fi
+
+# connection sanity from the journal (best-effort)
+if journalctl --user -u whatsapp-bridge.service -n 40 --no-pager 2>/dev/null \
+ | grep -q "Connected to WhatsApp"; then
+ log "wa-fresh: bridge connected ✓"
+fi
+
+before=$(sqlite3 "$DB" "SELECT COALESCE(datetime(MAX(timestamp)),'1970-01-01') FROM messages;" 2>/dev/null)
+
+# 2. force backfill
+code=$(curl -fsS -m 20 -X POST -o /dev/null -w "%{http_code}" "$BRIDGE/api/backfill" 2>/dev/null || echo "ERR")
+log "wa-fresh: backfill → HTTP ${code}"
+
+# 3. transcribe any freshly-synced voice notes (idempotent, lock-guarded)
+systemctl --user start whatsapp-transcribe.service 2>/dev/null && log "wa-fresh: voice transcription triggered"
+
+# 4. bounded wait for the store to settle
+new=0
+for i in $(seq 1 "$WAIT_TICKS"); do
+ sleep 4
+ cnt=$(sqlite3 "$DB" "SELECT COUNT(*) FROM messages WHERE datetime(timestamp) > datetime('$before');" 2>/dev/null || echo 0)
+ [ "${cnt:-0}" -gt 0 ] && { new=$cnt; break; }
+done
+
+# 5. freshness report
+after=$(sqlite3 "$DB" "SELECT COALESCE(datetime(MAX(timestamp)),'?') FROM messages;" 2>/dev/null)
+age_min=$(sqlite3 "$DB" "SELECT CAST((julianday('now')-julianday(MAX(timestamp)))*1440 AS INT) FROM messages;" 2>/dev/null)
+log "wa-fresh: newest message = ${after} (${age_min:-?} min old) | new rows this cycle = ${new}"
+if [ "${age_min:-9999}" -gt 120 ]; then
+ log "wa-fresh: WARNING newest message is >2h old — store may be lagging; treat 'last-sender' classification with caution"
+fi
+log "wa-fresh: NOTE phone-sent messages may be absent — confirm 'did I reply?' with the human, not this store"
+exit 0
diff --git a/claude-ops/scripts/install-whatsapp-bridge-linux.sh b/claude-ops/scripts/install-whatsapp-bridge-linux.sh
index 2467a6b8..21110fd4 100755
--- a/claude-ops/scripts/install-whatsapp-bridge-linux.sh
+++ b/claude-ops/scripts/install-whatsapp-bridge-linux.sh
@@ -20,6 +20,8 @@
# --reset-session Delete whatsapp.db so a fresh pair code is
# generated (you'll need to scan with the phone)
# --no-backfill-timer Drop only the bridge unit, skip the 2h timer
+# --no-transcribe-timer Skip the 10-min voice-note transcription timer
+# (voice notes won't be auto-transcribed into content)
set -euo pipefail
@@ -32,6 +34,7 @@ INSTALL_DIR="$INSTALL_DIR_DEFAULT"
SKIP_BUILD=0
RESET_SESSION=0
WITH_BACKFILL_TIMER=1
+WITH_TRANSCRIBE_TIMER=1
# Source-tree dir (where this script lives in claude-ops checkout)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -49,6 +52,7 @@ while (("$#")); do
--skip-build) SKIP_BUILD=1; shift ;;
--reset-session) RESET_SESSION=1; shift ;;
--no-backfill-timer) WITH_BACKFILL_TIMER=0; shift ;;
+ --no-transcribe-timer) WITH_TRANSCRIBE_TIMER=0; shift ;;
-h|--help) usage 0 ;;
*) echo "unknown flag: $1" >&2; usage 1 ;;
esac
@@ -76,6 +80,7 @@ echo "▶ claude-ops WhatsApp bridge install"
echo " install dir: $INSTALL_DIR"
echo " wa-phone: $WA_PHONE"
echo " backfill timer: $([ "$WITH_BACKFILL_TIMER" -eq 1 ] && echo on || echo off)"
+echo " transcribe timer: $([ "$WITH_TRANSCRIBE_TIMER" -eq 1 ] && echo on || echo off)"
# ─── Clone / refresh upstream ────────────────────────────────────────────────
mkdir -p "$(dirname "$INSTALL_DIR")"
@@ -96,6 +101,18 @@ echo "▶ Installing link_contacts.py (contacts link: phone + LID aliases)"
cp "$WA_ASSETS/link_contacts.py" "$INSTALL_DIR/whatsapp-bridge/link_contacts.py"
chmod +x "$INSTALL_DIR/whatsapp-bridge/link_contacts.py"
+# ─── Ship voice-note transcriber (whatsapp-transcribe.timer runs it) ──────────
+echo "▶ Installing transcribe_voice_notes.py (Whisper voice-note → content)"
+mkdir -p "$INSTALL_DIR/transcriber"
+cp "$WA_ASSETS/transcribe_voice_notes.py" "$INSTALL_DIR/transcriber/transcribe_voice_notes.py"
+chmod +x "$INSTALL_DIR/transcriber/transcribe_voice_notes.py"
+
+# ─── Ship wa-inbox-fresh.sh (pre-scan freshness gate, run FIRST by ops-inbox) ─
+echo "▶ Installing wa-inbox-fresh.sh → ~/bin (pre-scan freshness gate)"
+mkdir -p "$HOME/bin"
+cp "$SCRIPT_DIR/../bin/wa-inbox-fresh.sh" "$HOME/bin/wa-inbox-fresh.sh"
+chmod +x "$HOME/bin/wa-inbox-fresh.sh"
+
# ─── Bump Go deps + build ────────────────────────────────────────────────────
if [ "$SKIP_BUILD" -ne 1 ]; then
echo "▶ Bumping Go deps + building bridge"
@@ -133,6 +150,16 @@ if [ "$WITH_BACKFILL_TIMER" -eq 1 ]; then
cp "$WA_ASSETS/systemd/whatsapp-backfill.timer" "$SYSTEMD_DIR/"
fi
+if [ "$WITH_TRANSCRIBE_TIMER" -eq 1 ]; then
+ cp "$WA_ASSETS/systemd/whatsapp-transcribe.service" "$SYSTEMD_DIR/"
+ cp "$WA_ASSETS/systemd/whatsapp-transcribe.timer" "$SYSTEMD_DIR/"
+ # The transcribe service reads OPENAI_API_KEY from this EnvironmentFile.
+ if [ ! -f "$HOME/.config/systemd/env/mcp-secrets.env" ]; then
+ echo " NOTE: ~/.config/systemd/env/mcp-secrets.env not found — the transcribe"
+ echo " service needs OPENAI_API_KEY there (KEY=value lines) to run."
+ fi
+fi
+
# ─── Disable deprecated wacli daemon if present ──────────────────────────────
if systemctl --user list-unit-files claude-ops-wacli-keepalive.service 2>/dev/null | grep -q wacli-keepalive; then
echo "▶ Disabling deprecated claude-ops-wacli-keepalive.service (replaced by systemd-managed bridge)"
@@ -154,6 +181,9 @@ systemctl --user enable --now whatsapp-bridge.service
if [ "$WITH_BACKFILL_TIMER" -eq 1 ]; then
systemctl --user enable --now whatsapp-backfill.timer
fi
+if [ "$WITH_TRANSCRIBE_TIMER" -eq 1 ]; then
+ systemctl --user enable --now whatsapp-transcribe.timer
+fi
# ─── Surface the pairing code if present ─────────────────────────────────────
echo "▶ Waiting briefly for the bridge to come up"
@@ -182,5 +212,7 @@ fi
echo ""
echo "▶ Status reference:"
echo " systemctl --user status whatsapp-bridge.service"
-echo " systemctl --user list-timers whatsapp-backfill.timer"
-echo " curl -fsS -X POST http://127.0.0.1:8080/api/backfill # on-demand"
+echo " systemctl --user list-timers whatsapp-backfill.timer whatsapp-transcribe.timer"
+echo " curl -fsS -X POST http://127.0.0.1:8080/api/backfill # on-demand backfill"
+echo " systemctl --user start whatsapp-transcribe.service # on-demand transcribe"
+echo " ~/bin/wa-inbox-fresh.sh # pre-scan freshness gate"
diff --git a/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service
new file mode 100644
index 00000000..206d5551
--- /dev/null
+++ b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=WhatsApp voice-note transcriber — fills empty audio rows with Whisper transcripts (oneshot)
+Documentation=https://github.com/lharries/whatsapp-mcp
+After=whatsapp-bridge.service
+Requires=whatsapp-bridge.service
+PartOf=whatsapp-bridge.service
+
+[Service]
+Type=oneshot
+# OPENAI_API_KEY (and other secrets) for the metered Whisper API.
+EnvironmentFile=%h/.config/systemd/env/mcp-secrets.env
+# Wait up to 10s for the bridge :8080 before downloading media.
+ExecStartPre=/bin/sh -c 'for i in 1 2 3 4 5; do ss -ltn 2>/dev/null | grep -q ":8080" && exit 0; sleep 2; done; exit 0'
+ExecStart=/usr/bin/python3 %h/.local/share/whatsapp-mcp/transcriber/transcribe_voice_notes.py --days 2 --max 80
+StandardOutput=journal
+StandardError=journal
+SyslogIdentifier=whatsapp-transcribe
diff --git a/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.timer b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.timer
new file mode 100644
index 00000000..b96a85fb
--- /dev/null
+++ b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.timer
@@ -0,0 +1,14 @@
+[Unit]
+Description=Transcribe new WhatsApp voice notes every 10 min + on boot (ops-inbox integration)
+Documentation=https://github.com/lharries/whatsapp-mcp
+
+[Timer]
+# First fire 2 min after boot/session start (after the bridge connects), then every 10 min.
+OnBootSec=2min
+OnUnitActiveSec=10min
+AccuracySec=30s
+Persistent=true
+Unit=whatsapp-transcribe.service
+
+[Install]
+WantedBy=timers.target
diff --git a/claude-ops/scripts/whatsapp/transcribe_voice_notes.py b/claude-ops/scripts/whatsapp/transcribe_voice_notes.py
new file mode 100755
index 00000000..7859f442
--- /dev/null
+++ b/claude-ops/scripts/whatsapp/transcribe_voice_notes.py
@@ -0,0 +1,145 @@
+#!/usr/bin/env python3
+"""WhatsApp voice-note transcriber — makes voice notes first-class in ops-inbox.
+
+Finds WhatsApp messages with media_type='audio' and empty content, downloads
+them via the bridge /api/download endpoint, transcribes with OpenAI whisper-1,
+and writes '[voice] <text>' back into messages.content — but ONLY where content
+is still empty, so it never clobbers real text and is fully idempotent.
+
+Run by the whatsapp-transcribe.timer (systemd --user) every few minutes so new
+voice notes are transcribed automatically before any inbox scan reads them.
+
+Guards (per global cost-leak + no-stacking rules):
+ * mkdir-based single-instance lock (defense-in-depth on top of systemd oneshot)
+ * --max cap per run (rate-floor on the metered Whisper API)
+ * idempotent: only ever touches empty-content audio rows
+
+Env: OPENAI_API_KEY (from ~/.config/systemd/env/mcp-secrets.env).
+Args: --days N (lookback window, default 2) --max N (cap per run, default 80)
+"""
+
+import argparse, json, os, shutil, sqlite3, subprocess, sys, time, urllib.request
+
+DB = os.path.expanduser("~/.local/share/whatsapp-mcp/whatsapp-bridge/store/messages.db")
+BRIDGE = "http://127.0.0.1:8080/api/download"
+LOCKDIR = "/tmp/.wa-transcribe.lock"
+
+
+def acquire_lock():
+ try:
+ os.mkdir(LOCKDIR) # atomic; fails if another run holds it
+ return True
+ except FileExistsError:
+ # stale lock older than 30 min → reclaim
+ try:
+ if time.time() - os.path.getmtime(LOCKDIR) > 1800:
+ shutil.rmtree(LOCKDIR, ignore_errors=True)
+ os.mkdir(LOCKDIR)
+ return True
+ except FileNotFoundError:
+ pass
+ return False
+
+
+def download(msg_id, chat_jid):
+ body = json.dumps({"message_id": msg_id, "chat_jid": chat_jid}).encode()
+ req = urllib.request.Request(
+ BRIDGE, data=body, headers={"Content-Type": "application/json"}
+ )
+ with urllib.request.urlopen(req, timeout=60) as r:
+ d = json.load(r)
+ return d.get("path") if d.get("success") else None
+
+
+def transcribe(path, key):
+ out = subprocess.run(
+ [
+ "curl",
+ "-s",
+ "-m",
+ "180",
+ "https://api.openai.com/v1/audio/transcriptions",
+ "-H",
+ f"Authorization: Bearer {key}",
+ "-F",
+ f"file=@{path}",
+ "-F",
+ "model=whisper-1",
+ ],
+ capture_output=True,
+ text=True,
+ timeout=200,
+ )
+ try:
+ return json.loads(out.stdout).get("text", "").strip()
+ except Exception:
+ return None
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--days", type=int, default=2)
+ ap.add_argument("--max", type=int, default=80)
+ args = ap.parse_args()
+
+ key = os.environ.get("OPENAI_API_KEY")
+ if not key:
+ print("transcriber: OPENAI_API_KEY not set — abort", flush=True)
+ sys.exit(1)
+ if not os.path.exists(DB):
+ print(f"transcriber: db not found {DB} — abort", flush=True)
+ sys.exit(0)
+ if not acquire_lock():
+ print("transcriber: another run holds the lock — exit", flush=True)
+ sys.exit(0)
+
+ try:
+ con = sqlite3.connect(DB, timeout=15)
+ con.execute("PRAGMA busy_timeout=8000;")
+ rows = con.execute(
+ "SELECT id, chat_jid, is_from_me FROM messages "
+ "WHERE media_type='audio' AND (content='' OR content IS NULL) "
+ "AND timestamp >= datetime('now', ?) "
+ "ORDER BY timestamp DESC LIMIT ?",
+ (f"-{args.days} days", args.max),
+ ).fetchall()
+ if not rows:
+ print(f"transcriber: nothing to do (last {args.days}d)", flush=True)
+ return
+ print(
+ f"transcriber: {len(rows)} voice note(s) to transcribe (last {args.days}d, cap {args.max})",
+ flush=True,
+ )
+ ok = fail = 0
+ for i, (mid, jid, mine) in enumerate(rows, 1):
+ try:
+ path = download(mid, jid)
+ if not path or not os.path.exists(path):
+ fail += 1
+ print(f" [{i}] {mid[:8]} download-fail", flush=True)
+ continue
+ text = transcribe(path, key)
+ if not text:
+ fail += 1
+ print(f" [{i}] {mid[:8]} transcribe-fail", flush=True)
+ continue
+ con.execute(
+ "UPDATE messages SET content=? WHERE id=? AND chat_jid=? "
+ "AND (content='' OR content IS NULL)",
+ (f"[voice] {text}", mid, jid),
+ )
+ con.commit()
+ ok += 1
+ print(f" [{i}] {mid[:8]} ({'me' if mine else 'them'}) ok", flush=True)
+ except Exception as e:
+ fail += 1
+ print(f" [{i}] {mid[:8]} err {e}", flush=True)
+ time.sleep(0.2)
+ con.close()
+ print(f"transcriber: done — {ok} transcribed, {fail} failed", flush=True)
+ finally:
+ shutil.rmtree(LOCKDIR, ignore_errors=True)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/claude-ops/skills/ops-inbox/SKILL.md b/claude-ops/skills/ops-inbox/SKILL.md
index 3da0e90d..3b9b0a42 100644
--- a/claude-ops/skills/ops-inbox/SKILL.md
+++ b/claude-ops/skills/ops-inbox/SKILL.md
@@ -79,16 +79,22 @@ If you find yourself reaching for any `wacli ...` shell command, stop and use th
Before executing, load available context:
-0. **Auto-sync WhatsApp in the background (DEFAULT — every invocation)** — the FIRST thing this skill does, before any scan or menu, is fire a recent-conversation history backfill **and** a contacts-link in the background, non-blocking. The backfill pulls recent messages for the 50 most-active chats; the link populates `messages.db.contacts` from the whatsmeow session store so both `<pn>@s.whatsapp.net` and `<lid>@lid` chat JIDs resolve to names (without it the `contacts` table is empty and LID-format chats show raw phone numbers). Both are idempotent and safe to run every time:
+0. **Auto-sync WhatsApp in the background (DEFAULT — every invocation)** — the FIRST thing this skill does, before any scan or menu, is guarantee the store is fresh, then fire a recent-conversation history backfill **and** a contacts-link in the background, non-blocking.
+
+ **0a. Freshness gate (run FIRST, blocking, bounded).** Before classifying anything, run `~/bin/wa-inbox-fresh.sh` (shipped by `scripts/install-whatsapp-bridge-linux.sh`). It probes the bridge with a real **curl connection probe** (`curl -s -m4 http://127.0.0.1:8080/`), forces a backfill, triggers voice-note transcription, and waits (bounded ~32s) for the newest message to settle, then prints a FRESHNESS report (`newest message = … (N min old)`). It **only restarts the bridge if the curl probe genuinely fails twice** — do NOT gate liveness on `ss | grep :8080`, because `ss` renders port 8080 as the service name `webcache`, so the grep never matches and you'd needlessly bounce a healthy bridge. Exit 2 means the bridge is down and unrecoverable → the store is STALE, do not trust last-sender classification.
+
+ **0b. Background backfill + contacts-link** (idempotent, safe every time). The backfill pulls recent messages for the 50 most-active chats; the link populates `messages.db.contacts` from the whatsmeow session store so both `<pn>@s.whatsapp.net` and `<lid>@lid` chat JIDs resolve to names (without it the `contacts` table is empty and LID-format chats show raw phone numbers):
```bash
BR="${WHATSAPP_BRIDGE_DIR:-$HOME/.local/share/whatsapp-mcp/whatsapp-bridge}"
- if lsof -i :8080 2>/dev/null | grep -q LISTEN; then
+ if curl -s -o /dev/null -m 4 http://127.0.0.1:8080/ 2>/dev/null; then
curl -fsS -m 10 -X POST http://127.0.0.1:8080/api/backfill >/dev/null 2>&1 & # recent-conversation backfill
[ -f "$BR/link_contacts.py" ] && python3 "$BR/link_contacts.py" >/dev/null 2>&1 & # contacts link (phone + LID aliases)
fi
```
Kick this off, then continue with the steps below while it runs — give the link ~2s before name-resolving chats. `link_contacts.py` resolves names via `whatsmeow_contacts` + `whatsmeow_lid_map` (name preference: full_name → first_name → push_name → business_name). It ships via `scripts/install-whatsapp-bridge-linux.sh` into the bridge dir; recreate it from `whatsmeow_contacts`/`whatsmeow_lid_map` if absent.
+ **0c. Voice notes are first-class.** Incoming voice notes (`media_type='audio'`, empty `content`) are auto-transcribed into `content` as `[voice] <text>` by the `whatsapp-transcribe.timer` (systemd-user, every 10 min, OpenAI `whisper-1`) — and `wa-inbox-fresh.sh` triggers a transcribe pass on every scan. So a voice note shows up in NEEDS_REPLY / thread scans exactly like a text message; treat a `[voice] …` body as the sender's words. Transcription is idempotent (only ever fills empty audio rows, never clobbers real text) and capped per run, so it never re-bills or stacks.
+
1. **Self-heal plugin version pin** — if any `${CLAUDE_PLUGIN_DATA_DIR}` file or `~/.claude/plugins/installed_plugins.json` references a `cache/ops-marketplace/ops/X.Y.Z/` path that no longer exists on disk, downstream hooks (`stop-all.sh`, `ops-post-session-cleanup`) emit `Plugin directory does not exist`. Resolve before scanning:
```bash
INSTALLED="$HOME/.claude/plugins/installed_plugins.json"
@@ -181,7 +187,7 @@ lsof -i :8080 | grep -q LISTEN && echo "bridge up" || journalctl --user -u whats
```bash
bash "$CLAUDE_PLUGIN_ROOT/scripts/install-whatsapp-bridge-linux.sh" --wa-phone <E.164>
```
-This clones lharries/whatsapp-mcp into `~/.local/share/whatsapp-mcp`, applies the in-repo claude-ops patches (Fix A/B pair-phone hardening, auto-backfill on Connected, `POST /api/backfill` REST endpoint, crash-safe `requestHistorySync`, Python LID↔phone↔contact resolver), drops three systemd-user units (`whatsapp-bridge.service`, `whatsapp-backfill.service`, `whatsapp-backfill.timer`), enables linger, and emits the pairing code via `journalctl --user -u whatsapp-bridge -f`. Idempotent: re-running is safe and updates patches in place.
+This clones lharries/whatsapp-mcp into `~/.local/share/whatsapp-mcp`, applies the in-repo claude-ops patches (Fix A/B pair-phone hardening, auto-backfill on Connected, `POST /api/backfill` REST endpoint, crash-safe `requestHistorySync`, Python LID↔phone↔contact resolver), drops the systemd-user units (`whatsapp-bridge.service`, `whatsapp-backfill.{service,timer}`, `whatsapp-transcribe.{service,timer}`), installs the voice-note transcriber (`transcriber/transcribe_voice_notes.py`) and the pre-scan freshness gate (`~/bin/wa-inbox-fresh.sh`), enables linger, and emits the pairing code via `journalctl --user -u whatsapp-bridge -f`. Idempotent: re-running is safe and updates patches in place. Pass `--no-transcribe-timer` to skip voice-note transcription. The transcribe service reads `OPENAI_API_KEY` from `~/.config/systemd/env/mcp-secrets.env`.
**MCP tools** (use these instead of any wacli CLI command):