The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(wake): select a supported engine by default
ethernet410ac37a0b20
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 4d3509793ec..b4cdb60076a 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -1144,9 +1144,9 @@ DEFAULT_CONFIG = {"surface": "auto", # eligible surface: "auto" (first claimant) | "cli" | "tui" | "gui""input_device": None, # PortAudio input device index/name; null = process default"capture": "auto", # auto | local | client (desktop streams mic via wake.feed)- # "openwakeword" (free, local) | "sherpa" (free, ANY phrase, no training) | "porcupine"- # (premium; needs PORCUPINE_ACCESS_KEY)- "provider": "openwakeword",+ # auto: first platform-supported engine (openwakeword, sherpa, porcupine).+ # Explicit choices stay pinned. Porcupine needs PORCUPINE_ACCESS_KEY.+ "provider": "auto",# sherpa: this IS the detected phrase; other engines: cosmetic label (detection is keyed by# the model/keyword below)"phrase": "hey hermes",diff --git a/hermes_cli/web_server_config.py b/hermes_cli/web_server_config.pyindex dedbcccc79c..a27820b467c 100644--- a/hermes_cli/web_server_config.py+++ b/hermes_cli/web_server_config.py@@ -16,6 +16,7 @@ from hermes_cli.config import (resolve_cron_model_drift_defaults,)from hermes_cli.web_server_memory import _normalize_memory_provider_name+from tools.wake_word import _PROVIDER_PREFERENCE# Same logger the code used before extraction (record parity)._log = logging.getLogger("hermes_cli.web_server")@@ -65,6 +66,10 @@ _SCHEMA_OVERRIDES: Dict[str, Dict[str, Any]] = {*_timezone_options(), searchable=True, clearable=True,),"memory.provider": _select("Memory provider plugin", *_memory_provider_options()),+ "wake_word.provider": _select(+ "Wake engine. Auto selects a platform-supported engine; Porcupine requires PORCUPINE_ACCESS_KEY.",+ "auto", *_PROVIDER_PREFERENCE,+ ),"model": {"type": "string","description": "Default model (e.g. anthropic/claude-sonnet-4.6)",diff --git a/pm/extras.py b/pm/extras.pyindex ae69950f0aa..4d94af15921 100644--- a/pm/extras.py+++ b/pm/extras.py@@ -9,6 +9,7 @@ true; pm owns HOW (uv sync inside the venv package).from __future__ import annotationsimport importlib.util+from typing import Callable# extra name -> module that proves it is installed@@ -118,13 +119,14 @@ def _platform_gates() -> dict[str, str]:_PLATFORM_GATES: dict[str, str] | None = None-def extra_supported(extra: str) -> bool:+def extra_supported(extra: str, *, environment: dict[str, str] | None = None,+ importable: Callable[[str], bool] | None = None) -> bool:"""Is this extra installable on THIS platform? True when the extracarries no gate, or its marker matches the running platform. Anextra that IS present on this machine (anchors importable) is alwayssupported — an installed override beats the table (dev machines,hand-synced venvs)."""- if all(_importable(a) for a in _anchors(extra)):+ if all((importable or _importable)(a) for a in _anchors(extra)):return Truemarker = _platform_gates().get(extra)if marker is None:@@ -135,12 +137,13 @@ def extra_supported(extra: str) -> bool:from packaging.markers import Marker- environment = {- "sys_platform": sys.platform,- "platform_system": platform.system(),- "platform_machine": platform.machine(),- "os_name": os.name,- }+ if environment is None:+ environment = {+ "sys_platform": sys.platform,+ "platform_system": platform.system(),+ "platform_machine": platform.machine(),+ "os_name": os.name,+ }try:return bool(Marker(marker).evaluate(environment=environment))except Exception:diff --git a/tests/hermes_cli/test_wake_word_config_schema.py b/tests/hermes_cli/test_wake_word_config_schema.pynew file mode 100644index 00000000000..24dc6c18760--- /dev/null+++ b/tests/hermes_cli/test_wake_word_config_schema.py@@ -0,0 +1,16 @@+"""The config UI offers the same wake providers the runtime resolves."""++from hermes_cli.config import load_config+from hermes_cli.web_server_config import _schema_with_dynamic_provider_options+from tools.wake_word import _PROVIDERS, _provider+++def test_wake_provider_schema_accepts_default_and_resolves_all_options():+ cfg = load_config()["wake_word"]+ field = _schema_with_dynamic_provider_options()["wake_word.provider"]+ assert field["type"] == "select"+ assert cfg["provider"] in field["options"]+ assert "auto" in field["options"]+ assert {_PROVIDERS[_provider({"provider": choice})][1] for choice in field["options"]} == {+ entry[1] for entry in _PROVIDERS.values()+ }diff --git a/tests/tools/test_wake_word.py b/tests/tools/test_wake_word.pyindex b4773b732b2..9ca523a68ba 100644--- a/tests/tools/test_wake_word.py+++ b/tests/tools/test_wake_word.py@@ -27,7 +27,7 @@ import tools.wake_word as wwdef test_config_defaults_and_clamping():- assert ww._provider({}) == "openwakeword"+ assert ww._provider({}) == ww._provider(ww.load_wake_word_config())assert ww._provider({"provider": "Porcupine"}) == "porcupine"assert ww._input_device({}) is Noneassert ww._input_device({"input_device": 7}) == 7@@ -65,12 +65,35 @@ def test_looks_like_path():assert not _looks_like_path("hey_jarvis")-def test_load_wake_word_config_is_a_dict_with_defaults():- # Wired into DEFAULT_CONFIG, so a real load returns the section shape.[email protected]("system,machine,expected", [+ ("win32", "ARM64", "porcupine"),+ ("win32", "AMD64", "openwakeword"),+ ("darwin", "x86_64", "sherpa"),+ ("darwin", "arm64", "openwakeword"),+ ("linux", "x86_64", "openwakeword"),+ ("linux", "aarch64", "openwakeword"),+])[email protected]("saved", [None, "wake_word: {}\n", "wake_word:\n provider: auto\n"])+def test_loaded_wake_defaults_resolve_supported_provider(tmp_path, monkeypatch, system, machine, expected, saved):+ from functools import partial++ from pm.extras import extra_supported++ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ path = tmp_path / "config.yaml"+ if saved is not None:+ path.write_text(saved, encoding="utf-8")cfg = ww.load_wake_word_config()- assert isinstance(cfg, dict)- assert cfg.get("enabled") is False- assert cfg.get("provider") == "openwakeword"+ assert cfg["provider"] == "auto"+ supported = partial(extra_supported, environment={"sys_platform": system, "platform_machine": machine},+ importable=lambda _: False)+ assert ww._provider(cfg, supported=supported) == expected+ assert ww._provider({}, supported=supported) == expected+ assert supported(ww._PROVIDERS[expected][1])+ assert not ww.wake_surface_enabled("gui", cfg)+ assert cfg["provider"] == "auto"+ if saved is not None:+ assert path.read_text(encoding="utf-8") == saveddef test_load_wake_word_config_guards_non_dict(monkeypatch):@@ -86,6 +109,10 @@ def test_load_wake_word_config_guards_non_dict(monkeypatch):def test_build_engine_dispatch(monkeypatch):monkeypatch.setattr(ww, "_OpenWakeWordEngine", lambda cfg: "oww")monkeypatch.setattr(ww, "_PorcupineEngine", lambda cfg: "pv")+ monkeypatch.setattr(ww, "_SherpaKwsEngine", lambda cfg: "sherpa")+ expected = {"openwakeword": "oww", "porcupine": "pv", "sherpa": "sherpa"}[ww._provider({})]+ assert ww._build_engine(ww.load_wake_word_config()) == expected+ assert ww._build_engine({"provider": "auto"}) == expectedassert ww._build_engine({"provider": "openwakeword"}) == "oww"assert ww._build_engine({"provider": "porcupine"}) == "pv"with pytest.raises(ValueError):@@ -196,6 +223,46 @@ def _voice_loop_ready(monkeypatch, stt=True, tts=True):monkeypatch.setattr("pm.extras._PLATFORM_GATES", {})[email protected]("system,machine", [("win32", "ARM64"), ("darwin", "x86_64")])[email protected]("provider", ["auto", *ww._PROVIDERS])+def test_loaded_provider_requirements_preserve_choices_and_require_keys(tmp_path, monkeypatch, system, machine, provider):+ from functools import partial++ from pm.extras import extra_supported++ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ monkeypatch.delenv("PORCUPINE_ACCESS_KEY", raising=False)+ saved = f"wake_word:\n provider: {provider}\n capture: client\n"+ path = tmp_path / "config.yaml"+ path.write_text(saved, encoding="utf-8")+ cfg = ww.load_wake_word_config()+ supported = partial(extra_supported, environment={"sys_platform": system, "platform_machine": machine},+ importable=lambda _: False)+ monkeypatch.setattr(pm, "available", lambda _: False)+ monkeypatch.setattr(pm_ensure, "lazy_installs_allowed", lambda: True)+ monkeypatch.setattr(ww, "_stt_ready", lambda: True)+ monkeypatch.setattr(ww, "_tts_ready", lambda: True)+ result = ww.check_wake_word_requirements(cfg, supported=supported)+ selected = ww._provider(cfg, supported=supported)+ assert result["provider"] == selected+ if provider != "auto":+ assert selected == provider+ if not supported(ww._PROVIDERS[selected][1]):+ assert not result["available"]+ assert "not supported on this platform" in result["hint"]+ elif selected == "porcupine":+ assert not result["available"]+ assert not result["access_key_set"]+ assert "PORCUPINE_ACCESS_KEY" in result["hint"]+ monkeypatch.setenv("PORCUPINE_ACCESS_KEY", "test-key")+ assert ww.check_wake_word_requirements(cfg, supported=supported)["available"]+ else:+ assert result["available"]+ assert not ww.wake_surface_enabled("gui", cfg)+ assert cfg["provider"] == provider+ assert path.read_text(encoding="utf-8") == saved++def test_requirements_openwakeword_available(monkeypatch):_voice_loop_ready(monkeypatch)monkeypatch.setattr(ww, "_audio_available", lambda: True)diff --git a/tools/wake_word.py b/tools/wake_word.pyindex 6ce39bccae3..cf1bcdc2853 100644--- a/tools/wake_word.py+++ b/tools/wake_word.py@@ -55,6 +55,7 @@ _PROVIDERS: Dict[str, tuple[str, str]] = {**{k: ("_SherpaKwsEngine", "wake-sherpa") for k in ("sherpa", "sherpa-onnx", "kws", "open")},**{k: ("_OpenWakeWordEngine", "wake-openwakeword") for k in ("openwakeword", "oww", "local")},}+_PROVIDER_PREFERENCE = ("openwakeword", "sherpa", "porcupine")class WakeWordInUse(RuntimeError):@@ -67,7 +68,7 @@ class WakeWordInUse(RuntimeError):# frames via wake.feed), or "auto" (local when a device exists, else client)._DEFAULTS: Dict[str, Any] = {"enabled": False, "surface": "auto", "input_device": None, "capture": "auto",- "provider": "openwakeword", "phrase": "hey hermes", "sensitivity": 0.6,+ "provider": "auto", "phrase": "hey hermes", "sensitivity": 0.6,"confirmation_frames": _DEFAULT_CONFIRMATION_FRAMES, "start_new_session": True,}@@ -105,8 +106,14 @@ def _clamped(cfg: Dict[str, Any], key: str, cast, lo, hi):return min(max(n, lo), hi)-def _provider(cfg: Dict[str, Any]) -> str:- return str(_get(cfg, "provider")).strip().lower() or "openwakeword"+def _provider(cfg: Dict[str, Any], *, supported: Callable[[str], bool] | None = None) -> str:+ provider = str(_get(cfg, "provider")).strip().lower() or "auto"+ if provider != "auto":+ return provider+ if supported is None:+ from pm.extras import extra_supported+ supported = extra_supported+ return next((name for name in _PROVIDER_PREFERENCE if supported(_PROVIDERS[name][1])), "porcupine")def _input_device(cfg: Dict[str, Any]) -> int | str | None:@@ -337,14 +344,16 @@ def _tts_ready() -> bool:return False-def check_wake_word_requirements(cfg: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:+def check_wake_word_requirements(cfg: Optional[Dict[str, Any]] = None, *,+ supported: Callable[[str], bool] | None = None) -> Dict[str, Any]:"""Report whether wake-word detection can run, with a remediation hint."""cfg = cfg if cfg is not None else load_wake_word_config()- provider = _provider(cfg)import pmfrom pm.ensure import lazy_installs_allowedfrom pm.extras import extra_supported+ supported = supported or extra_supported+ provider = _provider(cfg, supported=supported)if provider == "porcupine":feature = "wake-porcupine"elif provider in ("sherpa", "sherpa-onnx", "kws", "open"):@@ -352,7 +361,7 @@ def check_wake_word_requirements(cfg: Optional[Dict[str, Any]] = None) -> Dict[selse:feature = "wake-openwakeword"deps_ok = pm.available(feature)- supported = deps_ok or extra_supported(feature)+ platform_ok = deps_ok or supported(feature)lazy_ok = lazy_installs_allowed()# The audio probe imports sounddevice + numpy — two of the very packages# the lazy installer would fetch — so it can only be trusted once the@@ -370,9 +379,9 @@ def check_wake_word_requirements(cfg: Optional[Dict[str, Any]] = None) -> Dict[stts_ok = _tts_ready()hint = ""- if not supported:+ if not platform_ok:alternatives = [name for name in ("sherpa", "porcupine")- if extra_supported(_PROVIDERS[name][1])]+ if supported(_PROVIDERS[name][1])]hint = f"The {provider} wake engine is not supported on this platform."if alternatives:hint += f" Set wake_word.provider to {' or '.join(alternatives)}."@@ -403,7 +412,7 @@ def check_wake_word_requirements(cfg: Optional[Dict[str, Any]] = None) -> Dict[s"build with client-capture wake support.")return {- "available": supported and key_ok and stt_ok and tts_ok and mic_ok, "provider": provider,+ "available": platform_ok and key_ok and stt_ok and tts_ok and mic_ok, "provider": provider,"deps_available": deps_ok, "audio_available": audio_ok,"local_input_available": _local_input_device_ready() if deps_ok else False,"capture": capture_mode, "access_key_set": key_ok, "stt_available": stt_ok, "tts_available": tts_ok,diff --git a/website/docs/reference/environment-variables.md b/website/docs/reference/environment-variables.mdindex 104d782b008..743f712ca25 100644--- a/website/docs/reference/environment-variables.md+++ b/website/docs/reference/environment-variables.md@@ -177,7 +177,7 @@ For native Anthropic auth, Hermes prefers Claude Code's own credential files whe| `KREA_API_KEY` | Krea API key for Krea 2 image generation ([krea.ai](https://krea.ai/)) || `GROQ_API_KEY` | Groq Whisper STT API key ([groq.com](https://groq.com/)) || `ELEVENLABS_API_KEY` | ElevenLabs premium TTS voices ([elevenlabs.io](https://elevenlabs.io/)) |-| `PORCUPINE_ACCESS_KEY` | Picovoice Porcupine wake-word engine ([console.picovoice.ai](https://console.picovoice.ai/)) — only for `wake_word.provider: porcupine`; the default openWakeWord and sherpa engines need no key |+| `PORCUPINE_ACCESS_KEY` | Picovoice Porcupine wake-word engine ([console.picovoice.ai](https://console.picovoice.ai/)) — required when Porcupine is selected explicitly or by `wake_word.provider: auto` (native Windows ARM64); openWakeWord and sherpa need no key || `STT_GROQ_MODEL` | Override the Groq STT model (default: `whisper-large-v3-turbo`) || `GROQ_BASE_URL` | Override the Groq OpenAI-compatible STT endpoint || `STT_OPENAI_MODEL` | Override the OpenAI STT model (default: `whisper-1`) |diff --git a/website/docs/user-guide/features/wake-word.md b/website/docs/user-guide/features/wake-word.mdindex 1a0caa1129f..042d5a7ab90 100644--- a/website/docs/user-guide/features/wake-word.md+++ b/website/docs/user-guide/features/wake-word.md@@ -48,7 +48,7 @@ Hermes supports **client capture** for that case:1. The desktop arms wake with `capture: client` (automatic for the GUI when thebackend has no local input device, or set explicitly below).-2. openWakeWord still runs **on the backend** (same engines, same models).+2. The selected wake engine still runs **on the backend** (same engines, same models).3. The desktop opens the **local Mac/PC microphone**, resamples to 16 kHz monoint16, and streams short frames via the `wake.feed` RPC.4. On detection the backend emits `wake.detected` as usual; the desktop starts@@ -76,11 +76,28 @@ backend process.| Engine | Cost | API key | Notes ||--------|------|---------|-------|-| **openWakeWord** (default) | Free | None | TFLite through `pyopen-wakeword`. Includes the **"hey hermes"** model. Custom models require a `.tflite` file. Not available on Intel macOS or native Windows ARM64. |+| **openWakeWord** | Free | None | TFLite through `pyopen-wakeword`. Includes the **"hey hermes"** model. Custom models require a `.tflite` file. Not available on Intel macOS or native Windows ARM64. || **sherpa** | Free | None | Open-vocabulary detection for typed phrases. Downloads an English model on first use. Not available on native Windows ARM64. || **Porcupine** | Free tier / paid | `PORCUPINE_ACCESS_KEY` | Picovoice engine; built-in keywords + custom `.ppn` files |-The default phrase is **"hey hermes"**. Hermes includes its trained TFLite model.+The default provider is **`auto`**. It selects the first platform-supported+engine in this order: **openWakeWord → sherpa → Porcupine**. The platform is+that of the Python backend, not a remote desktop client:++- **Native Windows ARM64:** Porcupine. You must set `PORCUPINE_ACCESS_KEY`+ before enabling wake detection; auto does not remove that requirement.+- **Intel macOS:** sherpa (free, no key).+- **Windows x64, Apple Silicon, and supported Linux targets:** openWakeWord+ (free, no key).++An explicit provider stays selected, even if this platform does not support it.+Hermes reports the requirement error instead of silently switching engines.+Existing explicit settings are not migrated. To opt into automatic selection,+run `hermes config set wake_word.provider auto`. Wake detection stays **off**+until you enable it.++The default phrase label is **"hey hermes"**. For openWakeWord, Hermes includes+its trained TFLite model.The `pyopen-wakeword` package includes the shared feature-extraction models, sothis engine does not download models when it starts.@@ -89,14 +106,16 @@ wake-word detection. `security.allow_lazy_installs` controls this installation.A new dependency environment can require a Hermes restart before the engine loads.Packaged builds include the engine dependencies supported by their target.-On Intel macOS, select sherpa with `hermes config set wake_word.provider sherpa`,-or select Porcupine and configure its access key. The `pyopen-wakeword` macOS+The `pyopen-wakeword` macOSwheel contains an ARM64-only library despite its `universal2` label. Hermes-excludes that engine on Intel Macs and does not change your selected provider-automatically.+excludes that engine on Intel Macs. Native Windows ARM64 excludes both+openWakeWord and sherpa.-On native Windows ARM64, use Porcupine with an access key. The default-openWakeWord engine and sherpa are excluded from that target.+Porcupine's default keyword is **"jarvis"**, not "hey hermes". Its `phrase`+setting is only a display label; choose a built-in keyword or supply a custom+`.ppn` model to change what it detects. Get an access key at+[console.picovoice.ai](https://console.picovoice.ai) and store+`PORCUPINE_ACCESS_KEY` in your profile's `.env`, not `config.yaml`.The supported `pyopen-wakeword` wheels target Apple Silicon with macOS 15 orlater, glibc Linux 2.35 or later, and Windows x64. These requirements apply to@@ -131,7 +150,7 @@ wake_word:surface: auto # eligible surface: "auto" | "cli" | "tui" | "gui"input_device: null # PortAudio input index or device-name substring; null = process defaultcapture: auto # auto | local | client — where PCM is captured (see Remote desktop)- provider: openwakeword # "openwakeword" (free, local) | "sherpa" (free, any phrase) | "porcupine"+ provider: auto # auto | openwakeword | sherpa | porcupine (requires an access key)phrase: "hey hermes" # cosmetic label only — detection is keyed by the model/keyword belowsensitivity: 0.6 # 0.0-1.0 — higher = stricter (fewer false triggers), consistent across all enginesconfirmation_frames: 3 # openWakeWord only — consecutive over-threshold frames required to fire@@ -205,9 +224,10 @@ command records.## Using a different phrase-"Hey Hermes" works out of the box — the bundled openWakeWord model-(`model: hey_hermes`) is the default. To wake on something else, the easiest-path is the open-vocabulary engine:+"Hey Hermes" is the default detection phrase with openWakeWord and sherpa.+Porcupine uses its configured keyword instead ("jarvis" by default).+To wake on something else, the easiest path on supported platforms is the+open-vocabulary engine:### Option A — sherpa (any phrase, zero training)