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.

fix(update): propagate an update to Hermes, and stop rsync skipping it (#991)

Aurora Capital5118868e1d17
diff --git a/claude-ops/scripts/sync-companion-clis.sh b/claude-ops/scripts/sync-companion-clis.sh
index 3bdc5cea..8d2c6447 100755
--- a/claude-ops/scripts/sync-companion-clis.sh
+++ b/claude-ops/scripts/sync-companion-clis.sh
@@ -22,6 +22,14 @@
# - Codex: needs nothing here. Its ops-* skills are symlinks straight into
# Claude Code's own cache/.../ops/current/ directory, which
# ops-post-update-migrate already keeps current.
+# - Hermes: added 2026-09-16. Hermes was the one harness with a real ops
+# plugin in this repo (hermes-plugin/) and NO path here, so
+# `ops-update` — including the auto-update that #986 now fires on
+# any skill call — left every Hermes install pinned at whatever
+# version it was first installed with, silently and forever.
+# Hermes plugins are per-home, so the target is
+# $HERMES_HOME/plugins/ops (default ~/.hermes), and HERMES_HOME
+# genuinely differs per machine, so it is never assumed.
#
# Every step below is best-effort and non-fatal: a CLI that isn't installed,
# or whose update fails, is logged and skipped — this must never block or
@@ -50,6 +58,12 @@ say() { printf ' %s\n' "$*"; }
MARKETPLACE_GIT_URL="https://github.com/Lifecycle-Innovations-Limited/claude-ops"
+# scripts/ -> the plugin root. pwd -P, not pwd: ops-update runs this out of a
+# versioned cache directory that is often reached through a `current` symlink,
+# and a logical path would resolve hermes-plugin/ to whatever `current` pointed
+# at when the shell started rather than to this script's own version.
+PLUGIN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
+
# ── Grok ─────────────────────────────────────────────────────────────────
sync_grok() {
command -v grok >/dev/null 2>&1 || {
@@ -125,7 +139,12 @@ sync_cursor() {
mkdir -p "$cache_root"
dst="$cache_root/$hash"
mkdir -p "$dst"
- if rsync -a --delete --exclude=".git" "$src/" "$dst/" 2>/dev/null; then
+ # --checksum for the same reason as the Hermes sync below: rsync's default
+ # size+mtime quick check silently skips a same-size file written in the
+ # same second, and exits 0 while doing it. Cursor's cache is keyed by
+ # commit hash so this bites less often, but a same-size edit between two
+ # commits would still land as a no-op that reports success.
+ if rsync -a --delete --checksum --exclude=".git" "$src/" "$dst/" 2>/dev/null; then
ok "cursor: content cache synced -> $hash"
else
warn "cursor: rsync to $dst failed (non-fatal)"
@@ -157,6 +176,67 @@ report_codex() {
fi
}
+# ── Hermes ───────────────────────────────────────────────────────────────
+# Hermes has no plugin-manager command to call, so this copies the freshly
+# updated hermes-plugin/ out of THIS script's own plugin root. That root is
+# already the new version: ops-update swaps the cache and then runs the new
+# copy of this script, so $PLUGIN_ROOT/hermes-plugin is what we just installed.
+sync_hermes() {
+ local hermes_home="${HERMES_HOME:-$HOME/.hermes}"
+ local src="$PLUGIN_ROOT/hermes-plugin"
+ local dst="$hermes_home/plugins/ops"
+
+ [[ -d "$hermes_home/plugins" ]] || {
+ say "${c_dim}hermes: no $hermes_home/plugins (skipped)${c_rst}"
+ return 0
+ }
+ [[ -d "$src" ]] || {
+ warn "hermes: no hermes-plugin/ in $PLUGIN_ROOT (skipped)"
+ return 0
+ }
+
+ # A SYMLINK is a developer pointing Hermes at a live checkout. rsyncing
+ # over it would either clobber their working tree or replace the link with
+ # a stale copy — and in both cases they would stop getting their own edits.
+ # Same reasoning as Codex: something else already keeps it current.
+ if [[ -L "$dst" ]]; then
+ say "${c_dim}hermes: ops is a symlink to a live checkout (no action needed)${c_rst}"
+ return 0
+ fi
+
+ if [[ "$DRY" -eq 1 ]]; then
+ say "${c_dim}[dry-run] rsync $src/ -> $dst/${c_rst}"
+ return 0
+ fi
+
+ mkdir -p "$dst" 2>/dev/null || {
+ warn "hermes: cannot create $dst (skipped)"
+ return 0
+ }
+ # --delete so a file dropped upstream does not linger and keep being
+ # loaded. __pycache__ is excluded: it is build output, and a stale .pyc
+ # next to a newer .py is exactly how an "updated" plugin runs old code.
+ #
+ # --checksum is NOT optional here, and this is not paranoia. rsync's
+ # default quick check is size + mtime, and macOS ships openrsync, which
+ # applies it strictly: a file whose size is unchanged and whose mtime lands
+ # in the same second is skipped, and rsync still exits 0. A version bump
+ # from x.y.19 to x.y.20 is byte-identical in LENGTH, so the single most
+ # likely real-world change to plugin.yaml is exactly the one the quick
+ # check cannot see — the sync would report success and copy nothing.
+ # Proven against /usr/bin/rsync (openrsync protocol 29). These directories
+ # are a handful of small files, so hashing them costs nothing.
+ if rsync -a --delete --checksum --exclude '__pycache__' "$src/" "$dst/" 2>/dev/null; then
+ local v
+ v="$(sed -n 's/^version:[[:space:]]*"\{0,1\}\([^"]*\)"\{0,1\}.*/\1/p' \
+ "$dst/plugin.yaml" 2>/dev/null | head -1)"
+ ok "hermes: ops plugin synced${v:+ (v$v)}"
+ else
+ warn "hermes: rsync into $dst failed (skipped)"
+ fi
+}
+
sync_grok
sync_cursor
report_codex
+sync_hermes
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index 5ea027df..bb5ed0d5 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -44,6 +44,7 @@ run_suite "$TESTS_DIR/test-ops-speedup.sh"
run_suite "$TESTS_DIR/test-ops-update-stale-clone.sh"
run_suite "$TESTS_DIR/test-ops-update-downgrade-guard.sh"
run_suite "$TESTS_DIR/test-skill-update-gate.sh"
+run_suite "$TESTS_DIR/test-companion-cli-sync.sh"
run_suite "$TESTS_DIR/test-ops-status.sh"
run_suite "$TESTS_DIR/test-pid-performance-monitor.sh"
run_suite "$TESTS_DIR/test-run-pressure-monitor-if-needed.sh"
diff --git a/claude-ops/tests/test-companion-cli-sync.sh b/claude-ops/tests/test-companion-cli-sync.sh
new file mode 100755
index 00000000..852a1e98
--- /dev/null
+++ b/claude-ops/tests/test-companion-cli-sync.sh
@@ -0,0 +1,215 @@
+#!/usr/bin/env bash
+# test-companion-cli-sync.sh — coverage for scripts/sync-companion-clis.sh.
+#
+# WHY THIS FILE EXISTS
+#
+# PR #986 made `ops-update` fire automatically on any skill call. That made
+# `sync-companion-clis.sh` an automatic path for the first time — it used to
+# only run when somebody typed the update command — and it had NO tests at all.
+# A regression in it (a renamed plugin id, a drifted marketplace slug, a home
+# that is not where we guessed) would have silently stopped propagating updates
+# to every non-Claude harness, with the update itself still reporting success.
+#
+# Hermes is the case that was actually broken: it has a real ops plugin in this
+# repo (hermes-plugin/) and the sync script had no Hermes path, so every Hermes
+# install stayed pinned at whatever version it was first installed with.
+#
+# WHAT IS ASSERTED
+#
+# - a harness that is not installed is skipped, never a failure
+# - a Hermes install with a real plugin directory is refreshed in place
+# - the version actually lands (not just "rsync returned 0"). This is the
+# load-bearing case and it went RED before the fix: both plugin.yaml files
+# are the same LENGTH (a bump from x.y.19 to x.y.20 does not change size)
+# and are written in the same second, so rsync's default size+mtime quick
+# check skipped the file and still exited 0. Asserting the exit code would
+# have passed; asserting the version on disk is what caught it.
+# - a file dropped upstream is removed from the target, so stale code cannot
+# keep being loaded
+# - __pycache__ is NOT copied — a stale .pyc beside a newer .py is exactly
+# how an "updated" plugin keeps running old code
+# - a Hermes install that is a SYMLINK to a live checkout is left untouched
+# - HERMES_HOME is honoured, because it genuinely differs per machine
+# - the script exits 0 even when a harness is broken: it is called from the
+# middle of an upgrade and must never fail the upgrade it is part of
+#
+# NOTE: every path here is under a throwaway HOME. The suite must never read or
+# write the real ~/.hermes, and no real personal value appears in this file.
+
+set -uo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
+SCRIPT="$PLUGIN_ROOT/scripts/sync-companion-clis.sh"
+
+PASS=0
+FAIL=0
+ok() { echo " PASS: $1"; PASS=$((PASS + 1)); }
+err() { echo " FAIL: $1"; echo " $2"; FAIL=$((FAIL + 1)); }
+
+echo "=== companion CLI sync ==="
+
+if [[ ! -f "$SCRIPT" ]]; then
+ err "sync script present" "missing $SCRIPT"
+ echo "Results: $PASS passed, $FAIL failed"
+ exit 1
+fi
+
+command -v rsync >/dev/null 2>&1 || {
+ echo " SKIP: rsync not available — the Hermes path cannot be exercised"
+ echo "Results: $PASS passed, $FAIL failed"
+ exit 0
+}
+
+WORK="$(mktemp -d -t ops-companion-sync.XXXXXX)"
+trap 'rm -rf "$WORK"' EXIT
+
+# A fake plugin root holding a fake hermes-plugin/, so the test never depends on
+# the real one's current contents.
+FAKE_ROOT="$WORK/plugin"
+mkdir -p "$FAKE_ROOT/scripts" "$FAKE_ROOT/hermes-plugin/__pycache__"
+cp "$SCRIPT" "$FAKE_ROOT/scripts/sync-companion-clis.sh"
+chmod +x "$FAKE_ROOT/scripts/sync-companion-clis.sh"
+printf 'name: ops\nversion: "9.9.9"\n' > "$FAKE_ROOT/hermes-plugin/plugin.yaml"
+printf 'new\n' > "$FAKE_ROOT/hermes-plugin/__init__.py"
+printf 'stale bytecode\n' > "$FAKE_ROOT/hermes-plugin/__pycache__/old.pyc"
+
+# Run with a throwaway HOME and no companion CLIs on PATH, so only the Hermes
+# branch does any work and the others take their not-installed path.
+run_sync() {
+ local home="$1" hermes_home="${2:-}"
+ if [[ -n "$hermes_home" ]]; then
+ env -i PATH="/usr/bin:/bin:/usr/sbin:/sbin" HOME="$home" HERMES_HOME="$hermes_home" \
+ bash "$FAKE_ROOT/scripts/sync-companion-clis.sh" 2>&1
+ else
+ env -i PATH="/usr/bin:/bin:/usr/sbin:/sbin" HOME="$home" \
+ bash "$FAKE_ROOT/scripts/sync-companion-clis.sh" 2>&1
+ fi
+}
+
+# --- 1. Nothing installed: skipped, never a failure ---------------------------
+HOME1="$WORK/home-empty"
+mkdir -p "$HOME1"
+out="$(run_sync "$HOME1")"; rc=$?
+if [[ $rc -eq 0 ]] && printf '%s' "$out" | grep -q "hermes: no .*plugins (skipped)"; then
+ ok "a harness that is not installed is skipped, exit 0"
+else
+ err "a harness that is not installed is skipped, exit 0" \
+ "rc=$rc: $(printf '%s' "$out" | tr '\n' ' ')"
+fi
+
+# --- 2. A real Hermes plugin dir is refreshed in place ------------------------
+HOME2="$WORK/home-hermes"
+mkdir -p "$HOME2/.hermes/plugins/ops"
+printf 'name: ops\nversion: "1.0.0"\n' > "$HOME2/.hermes/plugins/ops/plugin.yaml"
+# A file that no longer exists upstream. It must not survive the sync.
+printf 'removed upstream\n' > "$HOME2/.hermes/plugins/ops/gone.py"
+out="$(run_sync "$HOME2")"; rc=$?
+got="$(grep -m1 version "$HOME2/.hermes/plugins/ops/plugin.yaml" 2>/dev/null)"
+if [[ $rc -eq 0 ]] && printf '%s' "$got" | grep -q '9\.9\.9'; then
+ ok "an installed Hermes ops plugin is refreshed to the new version"
+else
+ err "an installed Hermes ops plugin is refreshed to the new version" \
+ "rc=$rc, plugin.yaml now: $got"
+fi
+
+if [[ ! -e "$HOME2/.hermes/plugins/ops/gone.py" ]]; then
+ ok "a file dropped upstream is removed from the target"
+else
+ err "a file dropped upstream is removed from the target" \
+ "gone.py survived the sync, so stale code stays loadable"
+fi
+
+if [[ ! -e "$HOME2/.hermes/plugins/ops/__pycache__/old.pyc" ]]; then
+ ok "__pycache__ is not copied into the target"
+else
+ err "__pycache__ is not copied into the target" \
+ "a stale .pyc beside a newer .py makes an updated plugin run old code"
+fi
+
+if printf '%s' "$out" | grep -q "hermes: ops plugin synced"; then
+ ok "the sync reports what it did"
+else
+ err "the sync reports what it did" "$(printf '%s' "$out" | tr '\n' ' ')"
+fi
+
+# --- 3. A symlinked install is left alone -------------------------------------
+# This is a developer pointing Hermes at their own checkout. Overwriting it
+# would either clobber their working tree or replace the link with a stale copy.
+HOME3="$WORK/home-symlink"
+mkdir -p "$HOME3/.hermes/plugins" "$WORK/live-checkout"
+printf 'name: ops\nversion: "0.0.1-local"\n' > "$WORK/live-checkout/plugin.yaml"
+ln -s "$WORK/live-checkout" "$HOME3/.hermes/plugins/ops"
+out="$(run_sync "$HOME3")"; rc=$?
+still_link=0
+[[ -L "$HOME3/.hermes/plugins/ops" ]] && still_link=1
+local_intact="$(grep -m1 version "$WORK/live-checkout/plugin.yaml" 2>/dev/null)"
+if [[ $rc -eq 0 && $still_link -eq 1 ]] && printf '%s' "$local_intact" | grep -q '0\.0\.1-local'; then
+ ok "a symlinked Hermes install is not clobbered"
+else
+ err "a symlinked Hermes install is not clobbered" \
+ "rc=$rc, still_link=$still_link, live checkout now: $local_intact"
+fi
+
+# --- 4. HERMES_HOME is honoured -----------------------------------------------
+# The default is ~/.hermes, but it is genuinely different on other machines, so
+# guessing it would silently sync the wrong install — or none.
+HOME4="$WORK/home-nondefault"
+ALT="$WORK/hermes-primary"
+mkdir -p "$HOME4" "$ALT/plugins/ops"
+printf 'name: ops\nversion: "1.0.0"\n' > "$ALT/plugins/ops/plugin.yaml"
+out="$(run_sync "$HOME4" "$ALT")"; rc=$?
+got4="$(grep -m1 version "$ALT/plugins/ops/plugin.yaml" 2>/dev/null)"
+if [[ $rc -eq 0 ]] && printf '%s' "$got4" | grep -q '9\.9\.9'; then
+ ok "HERMES_HOME is honoured instead of assuming ~/.hermes"
+else
+ err "HERMES_HOME is honoured instead of assuming ~/.hermes" \
+ "rc=$rc, plugin.yaml at HERMES_HOME now: $got4"
+fi
+
+# --- 5. --dry-run changes nothing ---------------------------------------------
+HOME5="$WORK/home-dry"
+mkdir -p "$HOME5/.hermes/plugins/ops"
+printf 'name: ops\nversion: "1.0.0"\n' > "$HOME5/.hermes/plugins/ops/plugin.yaml"
+env -i PATH="/usr/bin:/bin:/usr/sbin:/sbin" HOME="$HOME5" \
+ bash "$FAKE_ROOT/scripts/sync-companion-clis.sh" --dry-run >/dev/null 2>&1
+got5="$(grep -m1 version "$HOME5/.hermes/plugins/ops/plugin.yaml" 2>/dev/null)"
+if printf '%s' "$got5" | grep -q '1\.0\.0'; then
+ ok "--dry-run leaves the target untouched"
+else
+ err "--dry-run leaves the target untouched" "plugin.yaml now: $got5"
+fi
+
+# --- 6. A broken target never fails the upgrade -------------------------------
+# This script runs in the middle of ops-update. If it can exit non-zero it can
+# abort an upgrade that has already swapped files, which is far worse than a
+# companion staying one version behind.
+HOME6="$WORK/home-broken"
+mkdir -p "$HOME6/.hermes/plugins"
+# A plain FILE where the plugin directory should be: mkdir -p will fail on it.
+printf 'not a directory\n' > "$HOME6/.hermes/plugins/ops"
+out="$(run_sync "$HOME6")"; rc=$?
+if [[ $rc -eq 0 ]]; then
+ ok "a broken companion target still exits 0"
+else
+ err "a broken companion target still exits 0" \
+ "rc=$rc — this can abort a half-applied upgrade"
+fi
+
+# --- 7. The missing-source case is reported, not silently skipped -------------
+NOSRC="$WORK/plugin-nosrc"
+mkdir -p "$NOSRC/scripts"
+cp "$SCRIPT" "$NOSRC/scripts/sync-companion-clis.sh"
+HOME7="$WORK/home-nosrc"
+mkdir -p "$HOME7/.hermes/plugins/ops"
+out="$(env -i PATH="/usr/bin:/bin:/usr/sbin:/sbin" HOME="$HOME7" \
+ bash "$NOSRC/scripts/sync-companion-clis.sh" 2>&1)"; rc=$?
+if [[ $rc -eq 0 ]] && printf '%s' "$out" | grep -q "hermes: no hermes-plugin/"; then
+ ok "a missing hermes-plugin/ source is reported, not silently skipped"
+else
+ err "a missing hermes-plugin/ source is reported, not silently skipped" \
+ "rc=$rc: $(printf '%s' "$out" | tr '\n' ' ')"
+fi
+
+echo ""
+echo "Results: $PASS passed, $FAIL failed"
+[[ $FAIL -eq 0 ]]