Hermes Runtime Operations
Class-level runbook for keeping Hermes healthy and recoverable.
Update safety on gateway hosts
When planning or performing a Hermes update on a live gateway host, use the preflight, backup, stash, validation, and rollback pattern in references/safe-hermes-update-from-gateway-host.md. Important pitfall: a Telegram/gateway-triggered tool shell may run inside the hermes-gateway.service systemd namespace. If the service has ProtectSystem=full, /usr can be read-only in that namespace and git fetch/hermes update --check may fail on .git/FETCH_HEAD; run the real update from a normal SSH shell or stop/restart the gateway around the update.
Use this skill when the task is either:
- Routine maintenance (preventive checks and low-risk cleanup), or
- Auth troubleshooting (provider auth failures, token refresh breakage, re-auth flows).
Operating model
- Read before write: gather evidence first.
- Minimal-risk changes only: perform only clearly safe actions; escalate risky actions as recommendations.
- No secret exposure: never output tokens/keys/raw env secrets.
- Verify after change: restart/recheck services when applicable.
Workflow A - Routine maintenance (daily/periodic)
- Validate gateway health from state + process + logs (avoid judging by stale historical errors alone).
- Validate scheduler/cron health, job definitions, and most recent per-job failures.
- Check disk usage and hotspot directories (
~/.hermes/logs, caches, temp/work dirs).
- Check workspace integrity (git status) without mutating unrelated work.
- Confirm canonical required assets/job files exist.
- Apply only obvious low-risk cleanup; otherwise report recommendations.
Output shape:
- Summary
- Issues found
- Actions taken
- Recommended next step
Workflow B - Auth incident response
- Inspect auth state (
hermes auth list) and recent auth/provider failures in logs.
- Confirm active provider/model config and identify failing credential source.
- Validate auth store layers (
providers.* and credential_pool.*) and stale entries.
- For headless OAuth/device-code failures, run manual device-code flow and persist refreshed credentials.
- Restart gateway and verify the provider path is healthy.
Common patterns:
401/403, silent empty provider output, refresh loops, invalid_grant, reused refresh tokens.
- Device-code polling on headless systems should run in background with completion notification.
Absorbed modules (labeled)
From appie-environment-maintenance
- Daily healthcheck flow for gateway + cron + disk + workspace integrity.
- Root-cron/systemd user-bus caveat (
systemctl --user false negatives in root cron contexts).
- Distinction between historical log noise and live outages.
- Conservative cleanup policy for temp media and caches.
From hermes-auth-troubleshooting
- Cross-provider auth failure triage (OAuth and API-key paths).
- Dual-layer auth store model (
providers.* + credential_pool.*).
- Headless device-code recovery workflow and gateway restart requirement.
- Refresh-token reuse and stale credential-pool reseeding pitfalls.
Workflow C - Safe Hermes update with local adjustments
- Inspect install method, version, git branch/remotes, dirty source files, stashes, profiles, and cron jobs before updating.
- For a self-scan/audit request, clone the current upstream repo into a separate audit directory and compare it to the live checkout before mutating production.
- Back up user-owned runtime state under the active Hermes home (
config.yaml, .env, auth.json, cron/jobs.json, scripts/, skills/, memories/, state.db, sessions/) while excluding bulky caches/logs.
- If the Hermes source checkout is dirty, save
git diff as a patch and separately copy important untracked files before running the updater.
- Prefer
hermes update --backup from SSH for production gateways instead of casual chat /update when local source changes exist.
- If the updater auto-stashes local source changes and asks whether to restore, default to not restoring old workarounds immediately when the install is far behind or the modified file is likely to have changed upstream. Update cleanly, then inspect and port the patch deliberately if still needed.
- Verify post-update with version, doctor, gateway status, cron list, git status, and stash list.
Detailed commands: references/hermes-safe-update-preserve-local-adjustments.md
Workflow D - Legacy bridge decommission and fleet recovery
Use references/legacy-bridge-decommission-and-fleet-recovery.md when old OpenClaw/ccgram/tmux bridges compete with Hermes gateway ownership or when multiple Appie agents go down at once. Inspect first, stop launchers before killing child tmux processes, verify no bot-token conflicts, and prefer separate VPS boxes for operationally distinct agents.
Playbooks and deep references
- Environment maintenance references:
references/maintenance/
- Remote host watchdog pattern:
references/maintenance/remote-host-watchdog.md
- Auth troubleshooting references/scripts:
references/auth/
- Safe update preserving local adjustments:
references/hermes-safe-update-preserve-local-adjustments.md
- Safe update preserving local adjustments:
references/hermes-safe-update-preserve-local-adjustments.md
- Safe update preserving local adjustments:
references/hermes-safe-update-preserve-local-adjustments.md
- Secret ingestion + local scrub pattern:
references/secret-ingestion-and-local-scrub.md
- Mac Hermes profile gateway + Codex OAuth recovery:
references/mac-profile-gateway-codex-oauth.md
- Legacy source skill snapshots (for historical context):
references/legacy/
Profile gateway recovery pattern
When a named Hermes profile is configured correctly but appears offline, verify the profile service itself before editing scripts or credentials:
- Check the profile:
hermes profile show <profile>.
- Check profile gateway status:
hermes -p <profile> gateway status.
- If stopped, install/start the profile-scoped launchd/system service:
hermes -p <profile> gateway install then hermes -p <profile> gateway start.
- Verify fleet state:
hermes gateway list and profile logs under the profile home, for example ~/.hermes/profiles/<profile>/logs/gateway.log.
- Confirm provider path with a non-secret smoke test:
hermes -p <profile> chat -Q -q 'Reply exactly: OK'.
For OpenAI Codex OAuth on Hermes, model.provider: openai-codex, model.default: gpt-5.5, model.base_url: https://chatgpt.com/backend-api/codex, and model.openai_runtime: auto are a known-good profile configuration when using Hermes-managed OAuth credentials.
Pitfalls
- Ambiguous skill names can break automation; use fully qualified skill paths in cron/automation contexts.
- Historical Telegram/gateway warnings are not proof of current outage; verify live state.
- Stale supervisor or script logs can mislead incident response; reproduce current syntax/status (
bash -n, service status, live process list) before patching files.
- A default Hermes gateway and a named-profile gateway are separate services;
hermes gateway status may show default stopped while hermes -p <profile> gateway status is healthy.
- Token changes typically require gateway restart to become effective.
- Single-use refresh/device tokens can be invalidated by concurrent consumers.
1---2name: hermes-runtime-operations3description: Operate and troubleshoot Hermes runtime health in production-like environments. Use for routine environment maintenance (gateway/cron/disk/workspace checks) and auth incident response (OAuth/API-key failures, refresh-token issues, headless device-code recovery).4---56# Hermes Runtime Operations78Class-level runbook for keeping Hermes healthy and recoverable.910## Update safety on gateway hosts1112When planning or performing a Hermes update on a live gateway host, use the preflight, backup, stash, validation, and rollback pattern in `references/safe-hermes-update-from-gateway-host.md`. Important pitfall: a Telegram/gateway-triggered tool shell may run inside the `hermes-gateway.service` systemd namespace. If the service has `ProtectSystem=full`, `/usr` can be read-only in that namespace and `git fetch`/`hermes update --check` may fail on `.git/FETCH_HEAD`; run the real update from a normal SSH shell or stop/restart the gateway around the update.1314Use this skill when the task is either:151. **Routine maintenance** (preventive checks and low-risk cleanup), or162. **Auth troubleshooting** (provider auth failures, token refresh breakage, re-auth flows).1718## Operating model1920- **Read before write**: gather evidence first.21- **Minimal-risk changes only**: perform only clearly safe actions; escalate risky actions as recommendations.22- **No secret exposure**: never output tokens/keys/raw env secrets.23- **Verify after change**: restart/recheck services when applicable.2425## Workflow A - Routine maintenance (daily/periodic)26271. Validate gateway health from state + process + logs (avoid judging by stale historical errors alone).282. Validate scheduler/cron health, job definitions, and most recent per-job failures.293. Check disk usage and hotspot directories (`~/.hermes/logs`, caches, temp/work dirs).304. Check workspace integrity (git status) without mutating unrelated work.315. Confirm canonical required assets/job files exist.326. Apply only obvious low-risk cleanup; otherwise report recommendations.3334Output shape:35- Summary36- Issues found37- Actions taken38- Recommended next step3940## Workflow B - Auth incident response41421. Inspect auth state (`hermes auth list`) and recent auth/provider failures in logs.432. Confirm active provider/model config and identify failing credential source.443. Validate auth store layers (`providers.*` and `credential_pool.*`) and stale entries.454. For headless OAuth/device-code failures, run manual device-code flow and persist refreshed credentials.465. Restart gateway and verify the provider path is healthy.4748Common patterns:49- `401/403`, silent empty provider output, refresh loops, `invalid_grant`, reused refresh tokens.50- Device-code polling on headless systems should run in background with completion notification.5152## Absorbed modules (labeled)5354### From `appie-environment-maintenance`55- Daily healthcheck flow for gateway + cron + disk + workspace integrity.56- Root-cron/systemd user-bus caveat (`systemctl --user` false negatives in root cron contexts).57- Distinction between historical log noise and live outages.58- Conservative cleanup policy for temp media and caches.5960### From `hermes-auth-troubleshooting`61- Cross-provider auth failure triage (OAuth and API-key paths).62- Dual-layer auth store model (`providers.*` + `credential_pool.*`).63- Headless device-code recovery workflow and gateway restart requirement.64- Refresh-token reuse and stale credential-pool reseeding pitfalls.6566## Workflow C - Safe Hermes update with local adjustments67681. Inspect install method, version, git branch/remotes, dirty source files, stashes, profiles, and cron jobs before updating.692. For a self-scan/audit request, clone the current upstream repo into a separate audit directory and compare it to the live checkout before mutating production.703. Back up user-owned runtime state under the active Hermes home (`config.yaml`, `.env`, `auth.json`, `cron/jobs.json`, `scripts/`, `skills/`, `memories/`, `state.db`, `sessions/`) while excluding bulky caches/logs.714. If the Hermes source checkout is dirty, save `git diff` as a patch and separately copy important untracked files before running the updater.725. Prefer `hermes update --backup` from SSH for production gateways instead of casual chat `/update` when local source changes exist.736. If the updater auto-stashes local source changes and asks whether to restore, default to *not* restoring old workarounds immediately when the install is far behind or the modified file is likely to have changed upstream. Update cleanly, then inspect and port the patch deliberately if still needed.747. Verify post-update with version, doctor, gateway status, cron list, git status, and stash list.7576Detailed commands: `references/hermes-safe-update-preserve-local-adjustments.md`7778## Workflow D - Legacy bridge decommission and fleet recovery7980Use `references/legacy-bridge-decommission-and-fleet-recovery.md` when old OpenClaw/ccgram/tmux bridges compete with Hermes gateway ownership or when multiple Appie agents go down at once. Inspect first, stop launchers before killing child tmux processes, verify no bot-token conflicts, and prefer separate VPS boxes for operationally distinct agents.8182## Playbooks and deep references8384- Environment maintenance references: `references/maintenance/`85- Remote host watchdog pattern: `references/maintenance/remote-host-watchdog.md`86- Auth troubleshooting references/scripts: `references/auth/`87- Safe update preserving local adjustments: `references/hermes-safe-update-preserve-local-adjustments.md`88- Safe update preserving local adjustments: `references/hermes-safe-update-preserve-local-adjustments.md`89- Safe update preserving local adjustments: `references/hermes-safe-update-preserve-local-adjustments.md`90- Secret ingestion + local scrub pattern: `references/secret-ingestion-and-local-scrub.md`91- Mac Hermes profile gateway + Codex OAuth recovery: `references/mac-profile-gateway-codex-oauth.md`92- Legacy source skill snapshots (for historical context): `references/legacy/`9394## Profile gateway recovery pattern9596When a named Hermes profile is configured correctly but appears offline, verify the profile service itself before editing scripts or credentials:97981. Check the profile: `hermes profile show <profile>`.992. Check profile gateway status: `hermes -p <profile> gateway status`.1003. If stopped, install/start the profile-scoped launchd/system service: `hermes -p <profile> gateway install` then `hermes -p <profile> gateway start`.1014. Verify fleet state: `hermes gateway list` and profile logs under the profile home, for example `~/.hermes/profiles/<profile>/logs/gateway.log`.1025. Confirm provider path with a non-secret smoke test: `hermes -p <profile> chat -Q -q 'Reply exactly: OK'`.103104For OpenAI Codex OAuth on Hermes, `model.provider: openai-codex`, `model.default: gpt-5.5`, `model.base_url: https://chatgpt.com/backend-api/codex`, and `model.openai_runtime: auto` are a known-good profile configuration when using Hermes-managed OAuth credentials.105106## Pitfalls107108- Ambiguous skill names can break automation; use fully qualified skill paths in cron/automation contexts.109- Historical Telegram/gateway warnings are not proof of current outage; verify live state.110- Stale supervisor or script logs can mislead incident response; reproduce current syntax/status (`bash -n`, service status, live process list) before patching files.111- A default Hermes gateway and a named-profile gateway are separate services; `hermes gateway status` may show default stopped while `hermes -p <profile> gateway status` is healthy.112- Token changes typically require gateway restart to become effective.113- Single-use refresh/device tokens can be invalidated by concurrent consumers.