All plugins

excubitor

Night sentry for Hermes turns: one per-turn ledger that dedups inbound replay, stops no-progress tool loops, enforces a spend cap, and alerts when a turn hangs without a reply. Disclosure — default notifier is log-only; optional ntfy.sh or webhook POSTs; one background watch thread; SQLite state in plugin-data/excubitor; no credentials or telemetry; fail-open on internal errors. Optional Desktop status-bar chip (desktop/plugin.js). Limitation — event.internal bypasses gateway hooks.

catalystberry842-altAutomationv0.1.0Updated 21 days ago

About

Night sentry for Hermes turns: one per-turn ledger that dedups inbound replay, stops no-progress tool loops, enforces a spend cap, and alerts when a turn hangs without a reply. Disclosure — default notifier is log-only; optional ntfy.sh or webhook POSTs; one background watch thread; SQLite state in plugin-data/excubitor; no credentials or telemetry; fail-open on internal errors. Optional Desktop status-bar chip (desktop/plugin.js). Limitation — event.internal bypasses gateway hooks.

Excubitor

Night sentry for Hermes Agent.

Agents waste money and attention in four familiar ways: platforms re-deliver the same message and a second billable turn starts; the model calls the same tool with the same args and gets nothing new; spend creeps past what you meant to allow; a turn wedges with no reply and nobody notices. Excubitor watches every turn through one SQLite ledger and handles each:

  • Intake — drop inbound replays before a second turn opens
  • Work — block no-progress tool loops mid-turn
  • Spend — hard-veto when the day/session USD cap is hit
  • Watch — one alert if a turn stays silent past the deadline
inbound → Intake → ledger → Work / Spend / Watch
                ↘ duplicate? skip
                ↘ loop?      block
                ↘ over cap?  veto
                ↘ hung?      alert (log / ntfy / webhook)

Fail-open on every hook — an internal error never takes Hermes down. Default notifier is log (offline). Optional ntfy / webhook only if you opt in. Requires Hermes >=0.21.0.

Test it in 2 minutes

Hermes must already be on your PATH (hermes --version).

git clone https://github.com/catalystberry842-alt/excubitor.git
cd excubitor
mkdir -p ~/.hermes/plugins
ln -sfn "$(pwd)" ~/.hermes/plugins/excubitor
hermes plugins enable excubitor
hermes plugins doctor excubitor --ci
hermes plugins validate .

Expected: doctor reports OK with 8 hooks, validate ends with Validation passed.

Or, when Hermes’s package manager can reach the network:

hermes plugins install catalystberry842-alt/excubitor
hermes plugins enable excubitor
hermes plugins doctor excubitor --ci

Use owner/repo or a full https://github.com/...git URL — not github:owner/repo (that resolves to the wrong host).

Unit tests (no live gateway needed):

pip install pytest ruff
pytest -q --ignore=tests/test_hermes_live.py
# expect: 94 passed (96 with a Hermes checkout and tests/test_hermes_live.py)
ruff check .

Then in any Hermes chat: /excubitor — you should see spend, duplicates, loops, alerts, and open turns.

Try each guard

Temporarily tighten knobs under plugins.entries.excubitor.settings in ~/.hermes/config.yaml, then reload/restart the gateway.

1. Intake — drop inbound replays

Enable a loopback webhook (secret below is intentionally insecure, local only):

platforms:
  webhook:
    enabled: true
    extra:
      host: "127.0.0.1"
      port: 18644
      secret: "INSECURE_NO_AUTH"
      routes:
        probe:
          secret: "INSECURE_NO_AUTH"
          prompt: "Say PONG. No tools. {{__raw__}}"
          deliver: log
hermes gateway run
# other terminal:
DELIVERY="test-$(date +%s)"
curl -sS -X POST "http://127.0.0.1:18644/webhooks/probe" \
  -H "Content-Type: application/json" \
  -H "X-GitHub-Delivery: $DELIVERY" \
  -H "X-GitHub-Event: ping" \
  -d '{"zen":"excubitor"}'
curl -sS -X POST "http://127.0.0.1:18644/webhooks/probe" \
  -H "Content-Type: application/json" \
  -H "X-GitHub-Delivery: $DELIVERY" \
  -H "X-GitHub-Event: ping" \
  -d '{"zen":"excubitor"}'

Expect: first POST accepted; second is duplicate / skipped. /excubitor → duplicates dropped ≥ 1. Key survives a gateway restart in ~/.hermes/plugin-data/excubitor/data.db.

2. Work — stop no-progress loops

Set loop_threshold: 3, loop_approve_first: false. In chat with tools on:

Call the terminal tool with exactly echo same-loop five times in a row, then say DONE.

Expect: a block like
excubitor: no-progress loop on terminal (stagnant=3, threshold=3, …)
and /excubitor → loops stopped ≥ 1.

3. Spend — USD day cap

Set day_budget_usd: 0.0001, reload, send any short message.

Expect:
excubitor: day budget exhausted ($… / $0.00)
Restore a normal budget after.

4. Watch — silent-hang alarm

Set reply_deadline_minutes: 0.5, watch_interval_seconds: 10, notifier: log (or ntfy + a random topic). Start a turn that never replies; wait ~1 minute.

Expect: one alert titled Excubitor: turn hung (log line, or a single ntfy push). /excubitor → alerts fired ≥ 1.

Turn receipts

When a turn ends, Excubitor writes a one-line receipt from its ledger: tool calls, duplicates dropped, loops and what was blocked, spend against the day cap, any cap veto, and idle or hang time. A receipt from the test suite:

Turn t_ab12 · telegram · 6 tool calls · looped 6× on web_search, blocked at #6 · spent $0.42 of $5 day cap · replied 21:09 (0s)
  • /excubitor receipt shows the latest receipt. /excubitor receipt <turn_id> shows one turn (a prefix of the id works).
  • The dashboard status API includes it as last_receipt.
  • Only turns where something happened (a dedup, loop block, cap veto, or hang) go through your notifier. Clean turns are stored but stay quiet. A hang already sends its own alert, so its receipt is stored without a second ping.
  • Turn it off with receipts_enabled: false.

Config

Under plugins.entries.excubitor.settings (also drives Desktop → Settings → Plugins via config_schema):

KeyDefaultMeaning
enabledtrueMaster kill switch
day_budget_usd5.0Day spend cap (hard veto)
session_budget_usd2.0Lifetime session cap (does not reset at UTC midnight)
reply_deadline_minutes5.0Hang-alert deadline
loop_threshold6Base no-progress count (tightens with spend)
loop_approve_firsttrueFirst detection per tool per turn → approve; later → block
receipts_enabledtrueStore a receipt per turn; notify only notable turns
notifierloglog | ntfy | webhook
ntfy_topic""Topic when notifier=ntfy
webhook_url""HTTPS URL when notifier=webhook
watch_interval_seconds30Background scan period
price_table{}Model → input/output USD per million token overrides; longest model match wins
text_dedup_seconds120Short replay window when no platform message ID exists
seen_ttl_hours168Retention of admitted message IDs
turn_ttl_hours72Retention of closed turns and their receipts/history
max_tool_rows_per_turn500Bound retained tool history per turn
prune_every_n_ops50Retention sweep frequency
allow_private_webhooksfalseOpt in to private HTTPS destinations (HTTP only on loopback); no redirects/proxies

Kill switch: enabled: false or hermes plugins disable excubitor.
A malformed setting falls back independently with a warning; it cannot reset other settings.
Budget 0 is a hard stop, not an unset value. Day budgets reset at UTC midnight; session budgets last for the session.

Webhook URLs require HTTPS, except http://localhost / loopback IPs for local tests.
Non-public literal and resolved addresses are rejected unless allow_private_webhooks is true;
transport pins the validated address while preserving TLS certificate verification. Redirects and proxies are disabled.

Desktop status chip (optional)

Unified package: desktop/plugin.js + dashboard/plugin_api.py.

  • Status-bar chip: day spend vs cap, open-turn count, color by level (ok / warning / alert)
  • Click → ledger pane: duplicates, loops, vetoes, alerts
  • Enable the Desktop half under Capabilities → Plugins (keep the agent plugin enabled so /api/plugins/excubitor/status mounts)

CLI/gateway alone still get hooks + /excubitor — Desktop is optional polish.

Authentication: GET /api/plugins/excubitor/status (the plugin's /status route)
returns session IDs, turn metadata and spend. It relies entirely on the Hermes host's
authentication and access controls; Excubitor adds no separate API credential.
Do not expose this route publicly without host authentication.

Limitations

  • event.internal bypasses gateway hooks — Excubitor never sees those paths.
  • Detects hangs; does not unwedge them — you still restart / clear the stuck turn.
  • Cost is estimated unless the hook payload carries an explicit per-call USD figure. Cache tokens are included at the input rate (no provider-specific cache discounts/write premiums). total_cost alone is treated as a running session total and only its delta is charged; a decrease starts a new counter. Providers with different semantics should supply cost_usd instead.
  • Pre-dispatch duplicates use a separate atomic 30-second reservation, not an admitted ledger row. If auth rejects a message or a process dies, the reservation expires; retries during that lease can be skipped. Durable dedup/turns begin only after admission.
  • Receipt and hang claims happen before sending: at most one notification attempt per turn, not guaranteed delivery across a crash/transport failure.
  • Gateway association requires the host's task-local route key (published gateway.session_context.get_session_env("HERMES_SESSION_KEY")) or explicit source identity. Without it Excubitor does not guess across chats; an unbound gateway row may remain open.
  • Current Hermes fires post_llm_call once after the tool loop, so it closes a turn. Explicit intermediate tool_calls / is_final=false signals are ignored; other hook semantics need a host adapter.
  • Without plugin_db, fallback state is shared between threads within this process, but is neither durable nor shared across processes.
  • CLI/TUI may not fire pre_gateway_dispatch; those turns open the ledger later (no inbound dedup there).
  • Public ntfy topics are world-readable — use a long random topic.

License

MIT

README from the reviewed commit eb61121; it updates when the author re-pins.

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section