AGENT SKILL

hermes-model-config

Use when sessions run the wrong model or config regresses.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 4
Forks
1

01 前言 Front Matter

name
hermes-model-config
author
Titus
license
MIT
version
1.0.0
category
devops
platforms
[ "linux", "macos" ]
description
Use when sessions run the wrong model or config regresses.

03 SKILL.md 正文

Hermes Model & Provider Config

Trigger: "sessions use the wrong model", "model is X but should be Y", deepseek-chat/deepseek-flash questions, ⚠ Deprecated .env settings detected warning, cron model overrides, model.default regressions after hermes update.

Fleet model convention (verified on the fleet owner's host, 2026-08-18)

  • Regular sessions = deepseek-v4-flash — set in config.yaml model.default (provider deepseek, base_url https://api.deepseek.com/v1). This is operator-owned config — set it with hermes config set model.default <model>; no fleet installer writes it (the env-driven install-model-default.sh writer was removed 2026-09-09).
  • deepseek-chat is LLM-cron-ONLY. It must never be the session default. Crons pin it per-job: "model": "deepseek-chat" in ~/.hermes/cron/jobs.json (see LLM_CRON_MODEL=deepseek-chat in ops/scripts/install-crons.sh and ops/install/cron-manifest.yaml). A config.yaml default of deepseek-chat is the regression symptom.

Diagnose (in order)

  1. Truth for NEW sessions = config.yaml, not the banner. Run hermes config get model.default (+ model.provider, model.base_url). The session banner snapshots the model at session START — a mid-session hermes update changes config underneath it (observed 2026-08-18: banner showed deepseek-v4-flash while config already said deepseek-chat).
  2. If config changed unexpectedly, check stat -f '%Sm %N' ~/.hermes/config.yaml and tail ~/.hermes/logs/update.log — hermes update rewrites config.yaml AND ~/.hermes/.env in the same second. To rule out a migration, grep the key in ~/.hermes/hermes-agent/hermes_cli/config_migrations.py (model.default had NO migration — it was a stale manual setting).
  3. Cron overrides: grep -n '"model"' ~/.hermes/cron/jobs.json — per-job model field; model_snapshot records what it actually ran as. no_agent jobs (script-based) ignore model entirely.
  4. Check the whole repo for the convention: grep -rn '<model-id>' ~/steadfaste-fleet --include='*.sh' --include='*.yaml' --include='*.py' — install scripts/manifests show the intended per-role model split.

Fix

  • hermes config set model.default <model-id> — NEVER hand-edit config.yaml (stray indent breaks the live gateway; hermes-agent hard invariant). Agent file-write tools refuse the file outright (Refusing to write to Hermes config file: … security-sensitive configuration), so the CLI is not just preferred — it is the ONLY path from an agent. Verify by reading back BOTH the resolved value (hermes config get model.default) and the file on disk; the change applies to NEW sessions (the running session keeps its start-of-session model).
  • provider / base_url are untouched by this command.
  • No gateway restart needed: _resolve_gateway_model (gateway/run.py) reads model.default fresh per session from raw YAML.
  • Re-anchor the Jev router when the default moves. If the Jev layer is live, its pricing-list baseline is the anchor every multiplier and every "cheaper than" claim is measured against, and the doctor's cost guard compares pool heads to the host's actual model. model.default change → update the baseline to the same model, swap the medium pools' in-pool fallback (a cheaper baseline can leave the old fallback above the 1x ceiling), and express hard-tier budget caps in absolute $/M rather than multiples of the baseline so a cheaper baseline cannot evict whitelisted models (see the pricing-list-policy reference of the system-one-judgment skill). The selftest checks EVERY model in a pool and catches the stranded fallback the tests miss.

Verify end-to-end (mandatory)

  1. Spawn a real one-shot: hermes chat -q "Reply with exactly: OK" — note the Session: id in output.
  2. Confirm the recorded model: sqlite3 ~/.hermes/state.db "SELECT id, model, billing_provider, billing_base_url FROM sessions WHERE id='<session-id>';" ⚠️ sessions table has model + billing_provider — there is NO provider column; billing_provider is the provider.
  3. Re-check the cron overrides still pin the cron-only model where intended.

Provider latency / "why is it slow, what should we switch to" triage

When the complaint is model SLOWNESS or a request for better models (not a wrong-model regression), separate the THREE layers before concluding anything:

  1. Platform health — check the provider's status page first. OpenRouter: https://status.openrouter.ai/ (Datadog). "All Systems Operational" + no incidents in the recent window means the platform is not the failure; per-endpoint load on the specific model's provider is then the prime suspect. Status pages cover gateway + chat completions, not per-model hosts.
  2. Network latency to the gateway — BOTH the platform and your config could be fine while the box is far or congested.
    curl -s -o /dev/null -w "ttfb=%{time_starttransfer}s total=%{time_total}s http=%{http_code}\n" \
      --max-time 60 https://openrouter.ai/api/v1/models
    
    A TTFB around 60–100ms is normal for OpenRouter from a home/cloud box; that rules out a routing problem and isolates model-side throughput.
  3. Model-side comparison — for prices/context across candidates, hit the public model catalog (no auth needed): curl -s https://openrouter.ai/api/v1/models → jq '.data[] | select(.id=="<id>") | [.id, (.context_length|tostring), .pricing.prompt, .pricing.completion]'. ⚠️ The catalog does NOT expose throughput/latency for these models — top_provider.throughput / .latency come back null for many ids, so you CANNOT rank candidates by measured speed from that feed. Real per-token latency needs an AUTHENTICATED probe against the live endpoint; do not author a "switch to X it's faster" claim from the catalog alone.

Measuring live latency requires the API key — and it is NOT in config.yaml. ~/.hermes/config.yaml carries provider: openrouter + base_url but references the key only as the env var OPENROUTER_API_KEY in a comment; it is not inline and not in the gateway's systemd env file. The actual key lives in ~/.hermes/auth.json (Hermes auth store). Reading a credential file to fire live probes is a consent-gated action — ask the operator before pulling it, and report the status/network/catalog findings (all unauth'd) while that's pending decision.

Deprecated .env settings warning

  • The runtime warning comes from warn_deprecated_cwd_env_vars (hermes_cli/config.py) and checks process env for MESSAGING_CWD / TERMINAL_CWD — it can false-positive on Hermes's own launch-dir bridge (the message says "found in .env" even when the var came from Hermes).
  • Authoritative check = hermes doctor, which scans the .env file (hermes_cli/doctor.py _DEPRECATED_ENV_VARS): TERMINAL_CWD → terminal.cwd, MESSAGING_CWD → terminal.cwd, HERMES_TOOL_PROGRESS / HERMES_TOOL_PROGRESS_MODE → display.tool_progress, QQ_HOME_CHANNEL / QQ_HOME_CHANNEL_NAME → QQBOT_HOME_CHANNEL[_NAME].
  • hermes update auto-comments deprecated .env entries. Check for ACTIVE leftovers with: grep -nE '^(TERMINAL_CWD|MESSAGING_CWD|HERMES_TOOL_PROGRESS|HERMES_TOOL_PROGRESS_MODE|QQ_HOME_CHANNEL|QQ_HOME_CHANNEL_NAME)=' ~/.hermes/.env
  • Migration target terminal.cwd is PER-PROJECT: keep terminal.cwd: . (launch dir) on multi-project hosts. Do NOT set a global project path just to silence the warning.

Pitfalls

  • state.db sessions table: billing_provider, not provider (query error).

  • The .env deprecated entry may already be commented by a recent hermes update — verify before "removing" anything; an empty grep result means the warning is already neutralized.

  • model ids evolve: verify the exact id against grep -n '"model"' ~/.hermes/cron/jobs.json and ~/steadfaste-fleet/.env before assuming a shorthand ("deepseek-flash" = deepseek-v4-flash).

    2026-08-18 deepseek-chat regression: investigation trail + verification output.

04 同仓库更多 Skills