[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECJ4BXSCMS63Y6SRNWGXQQ":3,"skill-same:01M7ECJ4BXSCMS63Y6SRNWGXQQ":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":27,"updatedAt":28,"install":29,"resources":42},"01M7ECJ4BXSCMS63Y6SRNWGXQQ","hermes-production-operations",null,"jonahthan433\u002FCortexOS","jonahthan433","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211465495?v=4","01M7ECH9HPHGA89DCXHHJBTS3C","jonah.ai","01M7ECH9JCEM45DZMWPT7148S1",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fhermes-production-operations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# hermes-production-operations\n\n# Hermes Production Operations\n\n24\u002F7 hardening + incident response for the Hermes gateway on this host (headless Debian, user `hermes`, NO sudo, systemd **--user**). Gateway = `hermes-gateway.service` (user unit, ExecStart `python -m hermes_cli.main gateway run`); DB = `~\u002F.hermes\u002Fstate.db` (SQLite WAL). One surface per HERMES_HOME — a second Hermes surface (desktop\u002Fdashboard GUI) writing state.db while the gateway runs is the corruption trigger seen in production.\n\n## Inventory (already deployed — reuse, don't rebuild)\n- `~\u002F.hermes\u002Fscripts\u002Fhermes_health.py` — watchdog. Default\u002Fwatch: prints anomalies ONLY (empty = healthy). `--report`: RPM, api_calls, latency, db\u002Fwal MB, telegram, errors. Cron `hermes-health-watch` (every 15m, no_agent, deliver origin, silent when clean).\n- `~\u002F.hermes\u002Fscripts\u002Fhermes_maintain.py` — daily 4:10 cron `hermes-db-maintenance`: integrity_check → FTS rebuild on failure → wal_checkpoint(TRUNCATE) → VACUUM if freelist>15% & >100MB → `hermes backup --quick -l daily` (Hermes' own snapshots → state-snapshots\u002F, self-pruning) → stale git index.lock (>1h, no git proc) → archive debris (recovery-*, state.db.corrupt-*, state.db.malformed-* older than 1 day: tar.gz → verify → remove, NEVER delete). Log: `~\u002F.hermes\u002Flogs\u002Fmaintenance.log`.\n- `~\u002F.hermes\u002Fscripts\u002Fverify_gateway_restart.sh` — detached restart + self-verify (see safe restart).\n- Unit `\u002Fhome\u002Fhermes\u002F.config\u002Fsystemd\u002Fuser\u002Fhermes-gateway.service`: Restart=always, **StartLimitIntervalSec=600 + StartLimitBurst=8** (was 0 = unbounded loop), RestartForceExitStatus=75 (75 = deliberate TEMPFAIL), KillMode=mixed, TimeoutStopSec=60, ExecReload=SIGUSR1.\n\n## Quick recon (one batch)\n```\nsystemctl --user cat hermes-gateway.service; systemctl --user show hermes-gateway -p MainPID -p NRestarts\ncat ~\u002F.hermes\u002Fgateway.pid; pgrep -f \"hermes_cli.main gateway run\"   # pidfile pid must == MainPID and be alive\npython3 -c \"import sqlite3;c=sqlite3.connect('file:\u002Fhome\u002Fhermes\u002F.hermes\u002Fstate.db?mode=ro',uri=True);print(c.execute('PRAGMA integrity_check').fetchone()[0], c.execute('PRAGMA journal_mode').fetchone()[0], c.execute('PRAGMA busy_timeout').fetchone()[0])\"\ndu -sh ~\u002F.hermes\u002F* | sort -rh | head   # growth = recovery-*\u002Fstate.db.corrupt-*\u002Fstate-snapshots\u002F debris\n```\nFacts: state.db already WAL + busy_timeout=5000 + synchronous=FULL. `messages.token_count` is **never populated** → TPM from DB impossible; derive RPM\u002Fcalls\u002Flatency from gateway.log lines `response ready: platform=telegram ... time=Xs api_calls=N` (time-filter by line-prefix timestamp). `gateway-exit-diag.log` = JSONL, timestamps **UTC** (host is EAT, UTC+3) — parse with `calendar.timegm`. errors.log mixes WARNING + ERROR — count only lines containing ` ERROR `, exclude `homeassistant` (known broken DNS on homeassistant.local → permanent reconnect noise).\n\n## Token-cost knobs (hermes config set — verify with config get)\n- `agent.reasoning_effort` max→**medium** (biggest saver)\n- `model.rate_limit_delay 0.3` (client-side pacing; api_max_retries=3 + 1.5x backoff cap 5s already default)\n- `auxiliary.free_only true` (blocks the paid OpenRouter aux fallback lane — seen firing with gemini-3.6-flash) — **WARNING: this knob silently kills aux VISION.** With free_only=true and only a paid vision SKU available, `vision_analyze` fails `No LLM provider configured for task=vision`; repeated failures then gate the tool out of the session. If screenshots matter, set `auxiliary.free_only false` + explicit `auxiliary.vision.provider openrouter` + `auxiliary.vision.model google\u002Fgemini-3.6-flash` (verified at resolver level: `resolve_provider_client('openrouter', model=..., is_vision=True)` → client OK). Config\u002Ftoolset changes apply next session; mid-session fallback = direct OpenRouter vision call (base64 → chat completions).\n- `fallback_model.provider openrouter` + `fallback_model.model deepseek\u002Fdeepseek-chat` (429\u002F529\u002F503 failover; needs OPENROUTER_API_KEY)\n- `updates.pre_update_backup true`\n- No native auto model-escalation (`agent.service_tier` is a stub) — cheap default + manual \u002Fmodel switch is the ceiling.\n\n## Safe gateway restart (does NOT kill your own run)\nNever `systemctl --user restart` from inside a gateway-run agent — the agent's own process dies mid-turn, final reply lost. Schedule detached instead (escapes the gateway cgroup, survives SIGTERM\u002FSIGKILL):\n```\nsystemd-run --user --on-active=120s --unit=gw-restart-verify \u002Fbin\u002Fbash ~\u002F.hermes\u002Fscripts\u002Fverify_gateway_restart.sh\n```\nVerify script: restart → sleep 25 → pgrep count + MainPID + telegram getMe → sendMessage confirmation via bot token from `.env` (never print the token). Config changes (fallback_model etc.) apply on restart.\n\n## Pitfalls\n- **Unpinned agent cron + global model drift = scheduler refuses to run (guard #44585).** If the global inference config changed since a cron job was created (e.g. `provider gemini -> deepseek`, `model gemini-3.1-flash-lite -> deepseek-v4-flash`) and the job is NOT pinned, its run fails with `RuntimeError: Skipped to prevent unintended spend: global inference config drifted since this job was created ... To run on the new config, pin it explicitly`. The `cronjob` TOOL's update does NOT expose model\u002Fprovider (passing them yields `No updates provided`); pin via the CLI: `hermes cron edit \u003Cjob_id> --model \u003Cmodel> --provider \u003Cprovider>` — verify with `grep -A8 '\"\u003Cjob_id>\"' ~\u002F.hermes\u002Fcron\u002Fjobs.json` (fields `model`\u002F`provider`). Check `cronjob action=list` for `last_status: error` jobs and read the run output in `~\u002F.hermes\u002Fcron\u002Foutput\u002F\u003Cjob_id>\u002F\u003Crun>.md` for the exact error before touching anything.\n- **Cron agents HALLUCINATE completed side-effects (hit 2026-08-12).** A no_agent=false cron told to post to X returned success with a plausible \"tweet text\" and finished `status: ok` — but made ZERO tool calls (API calls: 0), posted nothing, and the claimed content was factually wrong. The final-response-is-the-deliverable pattern makes action crons self-report success without doing the work. Hardening for ANY cron whose job is a side-effect (post, send, write remote): the prompt must demand (a) the action via an actual terminal\u002Ffile tool call, (b) the returned artifact ID (tweet id \u002F message id \u002F file path) quoted from tool output, (c) explicit `FAILED: \u003Cerror>` reporting when the tool errors, and (d) a log append via file tools. Verify from the parent session: check the real system (e.g. `xurl \u002F2\u002Fusers\u002F\u003Cid>\u002Ftweets`) — a cron's `last_status: ok` proves only that the LLM finished, not that the side-effect happened. Add domain fact-rules to action-cron prompts when the model can invent plausible-but-wrong claims (e.g. \"n≤18 routes to classical; never claim quantum was chosen for a small problem\").\n- cronjob schedule `15m` = **one-shot**; recurring needs `every 15m`.\n- no_agent watchdog cron: script must print NOTHING when healthy (empty stdout = silent delivery), anomalies only.\n- FTS warning `Persisted transcript lagged live cached history ... (possible FTS write corruption)`: 1–2 events = benign async-flush lag; burst ≥3\u002F15m together with `file is not a database` \u002F `database disk image is malformed` = real corruption.\n- FTS rebuild (only on integrity failure): `INSERT INTO messages_fts(messages_fts) VALUES('rebuild')` and same for `messages_fts_trigram`.\n- **Google OAuth dies with `invalid_grant: Token has been expired or revoked`** → re-auth via google-workspace `setup.py` (`--auth-url` → user pastes the `localhost:8080\u002F?code=...` redirect URL → `--auth-code` → `--check-live`; `--check` alone only refreshes, it doesn't prove the client works). If re-auth passes but `--check-live` \u002F `google_api.py` fail with `module 'googleapiclient.discovery_cache' has no attribute 'autodetect'`, the installed google-api-python-client tree is half-installed (`discovery_cache\u002F` empty in the Google venv) — NOT a code bug, do not patch `cache_discovery=False`. Repair: `uv pip install --python \u002Fhome\u002Fhermes\u002F.hermes\u002Fgoogle-venv\u002Fbin\u002Fpython --force-reinstall google-api-python-client` (the venv is uv-managed, there is NO pip binary). Details: `references\u002Fgoogle-oauth-reauth-and-client-repair.md`.\n- `hermes config set` from scripts: export HERMES_HOME first; invoke as `~\u002F.hermes\u002Fhermes-agent\u002Fvenv\u002Fbin\u002Fpython -m hermes_cli.main config set K V`.\n- Latency stats are polluted by cron\u002Fbackground runs — filter `platform=telegram` lines.\n- Corruption debris: Hermes' recovery renames the bad db (`state.db.corrupt-*`, `state.db.malformed-*`) and writes `recovery-*\u002F` copies — archive (compress) rather than delete; they are the only copy of pre-recovery data.\n\n## References \u002F scripts\n- `references\u002Fcorruption-incident-2026-08-08.md` — full incident timeline + artifact anatomy.\n- `scripts\u002Fhermes_health.py`, `scripts\u002Fhermes_maintain.py`, `scripts\u002Fverify_gateway_restart.sh` — canonical copies to redeploy if `~\u002F.hermes\u002Fscripts\u002F` is lost.\n",{},"main","38b32c99e7ed0b8e215d638e92cfa452c1ec3079","skills\u002Fimported\u002F.archive\u002Fhermes-production-operations","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS","https:\u002F\u002Fgithub.com\u002Fjonahthan433","AI Consultant","2026-10-24 05:13:39",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add jonahthan433\u002FCortexOS --skill hermes-production-operations",{"tool":35,"command":36},"bunx","bunx skills add jonahthan433\u002FCortexOS --skill hermes-production-operations",{"tool":38,"command":39},"pnpm","pnpm dlx skills add jonahthan433\u002FCortexOS --skill hermes-production-operations","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fhermes-production-operations\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"skill.json","REFERENCE","参考文档",380,"https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fhermes-production-operations\u002Fskill.json",[50,56,62,68,74,80],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":18},"01M7EDQZDQX3Q8Y7GCQX6KN9V7","opportunity-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fsales\u002Fopportunity-brief\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M7EDQYA0V9Y99VKBREJJ3MRT","morning-intel","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fmorning-intel\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7EDQVX1JVY0B6PDHKKGM19G","decision-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fdecision-brief\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7EDQV1GENZAC2SZSD8KZ3GM","weekly-review","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fweekly-review\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7EDQT2KETJ1Y3CGVN9EKW2J","system-health","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fsystem-health\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M7EDQQN2JK3XPWMS1M4T0F3K","backup-restore","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fbackup-restore\u002FSKILL.md",[],[]]