Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(name): derive the assistant name from the wake word
Ruben Lütke46be4b23e1a0
diff --git a/jarvis/brain/app_control.py b/jarvis/brain/app_control.pyindex 23800a2d01..81a84f7da4 100644--- a/jarvis/brain/app_control.py+++ b/jarvis/brain/app_control.py@@ -236,7 +236,6 @@ def build_settings_snapshot(cfg: Any) -> dict[str, Any]:stt = getattr(cfg, "stt", None)ui = getattr(cfg, "ui", None)profile = getattr(cfg, "profile", None)- persona = getattr(cfg, "persona", None)wake = getattr(cfg, "wake", None) or getattr(cfg, "wakeword", None)autostart = getattr(cfg, "autostart", None)computer_use = getattr(cfg, "computer_use", None)@@ -265,9 +264,14 @@ def build_settings_snapshot(cfg: Any) -> dict[str, Any]:},}+ # Resolved name (the wake phrase is now the single source — there is no+ # separate [persona].name; resolve_assistant_name derives it and is fully+ # defensive, so it is safe inside the read-only snapshot).+ from jarvis.brain.assistant_name import resolve_assistant_name+settings = {"reply_language": _safe(lambda: brain.reply_language),- "assistant_name": _safe(lambda: persona.name),+ "assistant_name": _safe(lambda: resolve_assistant_name(cfg)),"wake_phrase": _safe(lambda: wake.phrase),"wake_engine": _safe(lambda: wake.engine),"autostart_enabled": _safe(lambda: autostart.enabled),diff --git a/jarvis/brain/assistant_name.py b/jarvis/brain/assistant_name.pyindex 4b7c619420..5f9aa6651b 100644--- a/jarvis/brain/assistant_name.py+++ b/jarvis/brain/assistant_name.py@@ -1,14 +1,14 @@"""Resolve the assistant's own name (how it refers to itself).-Resolution order (first non-empty wins):- 1. ``[persona].name`` — an explicit override, for when the spoken identity- should differ from the wake word (wake "Hey Computer", identity "Friday").- 2. The wake phrase with its prefix stripped — "Hey Jarvis" -> "Jarvis",- "Micron" -> "Micron", "Hey Athena" -> "Athena".- 3. ``DEFAULT_ASSISTANT_NAME`` — the neutral shipped fallback when no wake- phrase and no persona name is set (pre-onboarding state). A user who types- "Hey Jarvis" gets "Jarvis" via path 2; this constant is not "Jarvis" so- the product does not silently impose a name.+The name is a pure function of the wake phrase — there is no separate name+setting. Resolution order (first non-empty wins):+ 1. The wake phrase with its trigger prefix stripped — "Hey Jarvis" -> "Jarvis",+ "Micron" -> "Micron", "Hey Athena" -> "Athena", "Hey Computer" -> "Computer".+ 2. ``DEFAULT_ASSISTANT_NAME`` — the neutral shipped fallback when no wake phrase+ is set (pre-onboarding state). Not "Jarvis", so the product imposes no name.++A legacy ``[persona].name`` key in an old jarvis.toml is intentionally ignored:+the wake word is the single control (see the 2026-06-20 coupling design).Capitalisation: the derived name is title-cased token-by-token so a lowercasewake phrase ("micron") still yields a proper name ("Micron").@@ -19,16 +19,17 @@ from typing import AnyDEFAULT_ASSISTANT_NAME = "Assistant"+# The name baked into the static persona files (SOUL.md / JARVIS_PERSONA.md).+# When the resolved name equals this, the system prompt needs no identity-override+# directive — the persona files already say "Jarvis". Used by+# ``BrainManager._build_system_prompt`` so it never emits the self-contradictory+# "Du heisst Jarvis — nicht Jarvis" for the default wake word.+PERSONA_BASELINE_NAME = "Jarvis"+def resolve_assistant_name(config: Any) -> str:"""Return the assistant's display name from ``config`` (see module docstring)."""- # 1. Explicit [persona].name override.- persona = getattr(config, "persona", None)- explicit = (getattr(persona, "name", "") or "").strip() if persona is not None else ""- if explicit:- return explicit-- # 2. Derive from the wake phrase (prefix stripped).+ # 1. Derive from the wake phrase (prefix stripped, title-cased).trigger = getattr(config, "trigger", None)wake_word = getattr(trigger, "wake_word", None) if trigger is not None else Nonephrase = (getattr(wake_word, "phrase", "") or "") if wake_word is not None else ""@@ -42,5 +43,5 @@ def resolve_assistant_name(config: Any) -> str:if core:return " ".join(tok.capitalize() for tok in core)- # 3. Historical default / safety fallback.+ # 2. Historical default / safety fallback.return DEFAULT_ASSISTANT_NAMEdiff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex 7e3b7bf7a9..7900694636 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -77,7 +77,11 @@ from .local_action_gate import ()from .local_action_gate import _normalize as _gate_normalizefrom .mission_command_gate import match_mission_command-from .assistant_name import DEFAULT_ASSISTANT_NAME, resolve_assistant_name+from .assistant_name import (+ DEFAULT_ASSISTANT_NAME,+ PERSONA_BASELINE_NAME,+ resolve_assistant_name,+)from .persona_loader import load_effective_persona_promptfrom .provider_registry import BrainProviderRegistryfrom .rate_limit_tracker import RateLimitTracker@@ -1767,14 +1771,15 @@ class BrainManager:"""parts: list[str] = []- # Configurable assistant identity. Derived from the wake phrase (so a- # custom wake word "Micron" makes the assistant call itself Micron) or- # an explicit [persona].name. When it is NOT the historical "Jarvis", a- # prominent identity directive overrides the "Jarvis" mentions baked- # into the persona files (SOUL.md / JARVIS_PERSONA.md), which are static- # and cannot be parameterised. Placed first so it frames everything.+ # Configurable assistant identity. Derived solely from the wake phrase+ # (so a custom wake word "Micron" makes the assistant call itself+ # Micron). When the name is neither the neutral fallback nor the+ # historical "Jarvis" baseline, a prominent identity directive overrides+ # the "Jarvis" mentions baked into the persona files (SOUL.md /+ # JARVIS_PERSONA.md), which are static and cannot be parameterised.+ # Placed first so it frames everything.name = resolve_assistant_name(getattr(self, "_config", None))- if name != DEFAULT_ASSISTANT_NAME:+ if name not in (DEFAULT_ASSISTANT_NAME, PERSONA_BASELINE_NAME):parts.append(f"DEIN NAME IST {name.upper()}. Du heisst {name} — nicht Jarvis. "f"Wo die folgende Persona-Beschreibung 'Jarvis' sagt, gilt {name}. "diff --git a/jarvis/core/config.py b/jarvis/core/config.pyindex e0238a7bd2..4935c27249 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -101,17 +101,16 @@ class ProfileConfig(BaseModel):class PersonaConfig(BaseModel):- """The assistant's own identity — how it refers to itself.-- ``name`` is the spoken/written name the assistant uses ("Du bist <name>").- Empty (default) means "derive it from the wake phrase" — so setting the wake- word to "Micron" makes the assistant call itself Micron, with no second- field to fill in. Set a value here to decouple the name from the wake word- (e.g. wake "Hey Computer" but identity "Friday"). Resolved by- ``jarvis.brain.assistant_name.resolve_assistant_name``.+ """Reserved ``[persona]`` table. The assistant's name is no longer stored+ here — it derives solely from the wake phrase (see+ ``jarvis.brain.assistant_name.resolve_assistant_name`` and the 2026-06-20+ coupling design). A legacy ``[persona] name`` key in an existing jarvis.toml+ is ignored (Pydantic ``extra="ignore"``); the next wake-word save strips it."""- name: str = ""+ # Explicit so the "legacy name key is ignored" contract above cannot be+ # silently broken by a future base-class / project-wide model_config change.+ model_config = ConfigDict(extra="ignore")class WakeWordConfig(BaseModel):diff --git a/jarvis/core/config_writer.py b/jarvis/core/config_writer.pyindex c715b827c6..5bcdfd5822 100644--- a/jarvis/core/config_writer.py+++ b/jarvis/core/config_writer.py@@ -296,6 +296,10 @@ def set_wake_word(if fuzzy_match_ratio is not None:values["fuzzy_match_ratio"] = float(fuzzy_match_ratio)_patch_wake_word_toml(path, values)+ try:+ _strip_persona_name(path)+ except Exception as exc: # noqa: BLE001 — cleanup is best-effort, never breaks the save+ log.debug("persona-name strip skipped: %s", exc)def set_autostart(enabled: bool, *, path: Path = DEFAULT_CONFIG_FILE) -> None:@@ -1013,6 +1017,33 @@ def _patch_wake_word_toml(path: Path, values: dict[str, object]) -> None:_atomic_write(path, out)+def _strip_persona_name(path: Path) -> None:+ """Remove a stale ``[persona] name`` entry (the legacy assistant-name override).++ The wake word is now the single name source, so a leftover ``[persona] name``+ from before the 2026-06-20 coupling must not linger. Best-effort: a missing+ file/table/key is a no-op. Preserves comments and the optional BOM, exactly+ like :func:`_patch_table`.+ """+ if not path.exists():+ return++ with _WRITE_LOCK:+ raw = path.read_text(encoding="utf-8")+ had_bom = raw.startswith(_BOM)+ if had_bom:+ raw = raw[len(_BOM):]+ doc: TOMLDocument = tomlkit.parse(raw)+ persona = doc.get("persona")+ if persona is None or "name" not in persona:+ return+ del persona["name"]+ out = tomlkit.dumps(doc)+ if had_bom:+ out = _BOM + out+ _atomic_write(path, out)++def _atomic_write(path: Path, content: str) -> None:"""Atomic tempfile + replace, read-only-aware.diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsxindex f5ba44e3ff..7a3d2e21a1 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx@@ -11,6 +11,15 @@ const onb = {acknowledgeWakeWord: vi.fn().mockResolvedValue(undefined),} as never;+it("shows the derived-name preview only after a valid word is typed", () => {+ render(<WakeWordStep onb={onb} goNext={vi.fn()} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);+ // No preview before typing.+ expect(screen.queryByText("onboarding.wake_word.derived_name")).toBeNull();+ // A valid word (>= 2 chars) surfaces the hint line.+ fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });+ expect(screen.queryByText("onboarding.wake_word.derived_name")).not.toBeNull();+});+it("requires word + acknowledgment, then saves 'Hey <word>' and advances", async () => {const goNext = vi.fn();render(<WakeWordStep onb={onb} goNext={goNext} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsxindex 37a4614f3d..e2787a7255 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx@@ -2,6 +2,7 @@ import { useState } from "react";import { Button } from "@/components/ui/button";import { useWakeWord } from "@/hooks/useWakeWord";import { useT } from "@/i18n";+import { deriveAssistantName } from "@/lib/deriveAssistantName";import type { StepProps } from "../OnboardingFlow";export function WakeWordStep({ onb, goNext }: StepProps) {@@ -14,6 +15,7 @@ export function WakeWordStep({ onb, goNext }: StepProps) {const trimmed = word.trim();const canSave = trimmed.length >= 2 && ack && !busy;+ const derivedName = deriveAssistantName(`Hey ${trimmed}`);const refs = onb.state?.legal_references ?? [];async function onSave() {@@ -48,10 +50,16 @@ export function WakeWordStep({ onb, goNext }: StepProps) {autoFocusonChange={(e) => setWord(e.target.value)}placeholder={t("onboarding.wake_word.placeholder")}- className="w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary"+ className="w-full rounded-md border border-muted-foreground/25 bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/40"/></div>+ {trimmed.length >= 2 && derivedName ? (+ <p className="text-xs text-muted-foreground">+ {t("onboarding.wake_word.derived_name").replace("{0}", derivedName)}+ </p>+ ) : null}+<p className="text-xs text-muted-foreground">{t("onboarding.wake_word.notice")}</p><div className="text-xs"><div className="font-medium">{t("onboarding.wake_word.references_title")}</div>diff --git a/jarvis/ui/web/frontend/src/hooks/useAssistantName.ts b/jarvis/ui/web/frontend/src/hooks/useAssistantName.tsdeleted file mode 100644index b406dabc27..0000000000--- a/jarvis/ui/web/frontend/src/hooks/useAssistantName.ts+++ /dev/null@@ -1,74 +0,0 @@-import { useCallback, useEffect, useState } from "react";--/**- * Assistant-name config from GET /api/settings/assistant-name.- * `name` is the explicit override ("" = derive from wake phrase); `resolved`- * is what the assistant actually calls itself right now.- */-export interface AssistantNameConfig {- name: string;- resolved: string;- default: string;-}--export interface AssistantNameSaveResult {- ok: boolean;- name: string;- resolved: string;- persisted: boolean;- restart_required: boolean;-}--/**- * Loads /api/settings/assistant-name and exposes saveName(). Mirrors- * useHotkey/useWakeWord. After a successful save it dispatches- * 'jarvis:assistant-name-changed'.- */-export function useAssistantName() {- const [config, setConfig] = useState<AssistantNameConfig | null>(null);- const [loading, setLoading] = useState(true);- const [error, setError] = useState<string | null>(null);-- const refetch = useCallback(async () => {- setError(null);- try {- const res = await fetch("/api/settings/assistant-name");- if (!res.ok) throw new Error(`HTTP ${res.status}`);- const data: AssistantNameConfig = await res.json();- setConfig(data);- } catch (e) {- setError((e as Error).message);- } finally {- setLoading(false);- }- }, []);-- useEffect(() => {- void refetch();- const onChanged = () => void refetch();- window.addEventListener("jarvis:assistant-name-changed", onChanged);- return () => {- window.removeEventListener("jarvis:assistant-name-changed", onChanged);- };- }, [refetch]);-- const saveName = useCallback(- async (name: string): Promise<AssistantNameSaveResult> => {- const res = await fetch("/api/settings/assistant-name", {- method: "PUT",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ name, persist: true }),- });- const body = await res.json().catch(() => ({}));- if (!res.ok) {- throw new Error(body.detail ?? `HTTP ${res.status}`);- }- const result = body as AssistantNameSaveResult;- window.dispatchEvent(new CustomEvent("jarvis:assistant-name-changed"));- return result;- },- [],- );-- return { config, loading, error, refetch, saveName };-}diff --git a/jarvis/ui/web/frontend/src/hooks/useAssistantNameSeed.ts b/jarvis/ui/web/frontend/src/hooks/useAssistantNameSeed.tsindex 5c17cdd316..719afd2fc0 100644--- a/jarvis/ui/web/frontend/src/hooks/useAssistantNameSeed.ts+++ b/jarvis/ui/web/frontend/src/hooks/useAssistantNameSeed.ts@@ -4,14 +4,14 @@ import { useEventStore } from "@/store/events";/*** Seed the resolved assistant name into the global store on mount.*- * The assistant's display name (header wordmark + every assistant byline) must- * follow the configured identity — `[persona].name`, else the name derived from- * the wake phrase — instead of a hardcoded "Jarvis". This hook reads the current- * value once via GET /api/settings/assistant-name (mirroring useVoiceStatus /+ * The assistant's display name (header wordmark + every assistant byline) is+ * derived solely from the wake phrase configured in `[trigger.wake_word].phrase`+ * (via `deriveAssistantName` on the backend). This hook reads the current value+ * once on mount via GET /api/settings/assistant-name (mirroring useVoiceStatus /* useBrainStatus) and writes `resolved` into the store.*- * The existing useAssistantName hook dispatches `jarvis:assistant-name-changed`- * after a Settings rename, so we re-fetch on that event to keep every byline+ * `useWakeWord.saveWakeWord` dispatches `jarvis:assistant-name-changed` after a+ * successful wake-word save, so we re-fetch on that event to keep every byline* live without a reload. A fetch failure (offline / headless host) is a no-op:* the store keeps its default and the next event/mount re-seeds it.*/diff --git a/jarvis/ui/web/frontend/src/hooks/useSystemPrompt.ts b/jarvis/ui/web/frontend/src/hooks/useSystemPrompt.tsindex fbc359f379..9b27b4cc5f 100644--- a/jarvis/ui/web/frontend/src/hooks/useSystemPrompt.ts+++ b/jarvis/ui/web/frontend/src/hooks/useSystemPrompt.ts@@ -20,7 +20,7 @@ export interface SystemPromptSaveResult extends SystemPromptConfig {/*** Loads /api/settings/system-prompt and exposes savePrompt()/resetPrompt().- * Mirrors useAssistantName/useWakeWord. The override applies on the assistant's+ * Mirrors useWakeWord. The override applies on the assistant's* next turn (no restart), so there is no restart plumbing here.*/export function useSystemPrompt() {diff --git a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts b/jarvis/ui/web/frontend/src/hooks/useWakeWord.tsindex 454ee0187d..2e9210171e 100644--- a/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts+++ b/jarvis/ui/web/frontend/src/hooks/useWakeWord.ts@@ -100,6 +100,9 @@ export function useWakeWord() {}const result = body as WakeWordSaveResult;window.dispatchEvent(new CustomEvent("jarvis:wake-word-changed"));+ // The assistant's display name is derived from the wake phrase, so bylines+ // that read from /api/settings/assistant-name must re-seed on every save.+ window.dispatchEvent(new CustomEvent("jarvis:assistant-name-changed"));return result;},[],diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex d5d788b85d..859c27a395 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -856,6 +856,7 @@"restart_required": "Neustart erforderlich, damit die Änderung greift.","degraded_warning": "Die gewählte Phrase wird von der ausgewählten Engine nicht unterstützt — sie fällt auf eine andere Engine zurück.","needs_whisper_hint": "Eine beliebige Phrase benötigt das lokale-Whisper-Extra. Ohne es fällt die Engine auf eine eingebaute Schnellphrase zurück.",+ "derived_name": "Dein Assistent heißt dann: {0}","engine_options": {"auto": "Automatisch (empfohlen)","openwakeword": "openWakeWord (eingebaute Phrasen)",@@ -899,16 +900,6 @@"none": "Keins (ausgeblendet)"}},- "assistant_name": {- "title": "Name des Assistenten",- "description": "Wie sich der Assistent in Antworten selbst nennt. Das ist NICHT das Wake-Word, das du zum Aktivieren sagst — das gesprochene Trigger-Wort stellst du im Panel „Wake-Word“ darunter ein. Leer lassen, um dem Wake-Wort zu folgen.",- "label": "Name",- "current": "Der Assistent nennt sich „{0}“.",- "auto_hint": "Leer — folgt dem Wake-Wort (aktuell „{0}“).",- "save": "Name speichern",- "saved": "Name gespeichert",- "restart_required": "Neustart nötig, damit es wirkt."- },"system_prompt": {"title": "System-Prompt","description": "Die Anweisungen, die bestimmen, wie dein Assistent denkt und spricht. Bearbeite das Markdown, um ihn zu personalisieren, oder setze ihn jederzeit auf den Standard zurück.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 473d9c4e9a..a25d234617 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -856,6 +856,7 @@"restart_required": "Restart required to take effect.","degraded_warning": "The chosen phrase isn't supported by the selected engine — it will fall back to a different engine.","needs_whisper_hint": "An arbitrary phrase needs the local-Whisper extra. Without it the engine will degrade to a built-in quick phrase.",+ "derived_name": "Your assistant will be called: {0}","engine_options": {"auto": "Auto (recommended)","openwakeword": "openWakeWord (built-in phrases)",@@ -899,16 +900,6 @@"none": "None (hidden)"}},- "assistant_name": {- "title": "Assistant Name",- "description": "How the assistant refers to itself in its replies. This is NOT the wake word you say to activate it — set the spoken trigger in the Wake Word panel below. Leave empty to mirror the wake word.",- "label": "Name",- "current": "The assistant calls itself “{0}”.",- "auto_hint": "Empty — follows the wake word (currently “{0}”).",- "save": "Save name",- "saved": "Name saved",- "restart_required": "Restart required to take effect."- },"system_prompt": {"title": "System Prompt","description": "The instructions that define how your assistant thinks and speaks. Edit the Markdown to personalize it, or reset to the default at any time.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex c969b18388..cbe3329e78 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -856,6 +856,7 @@"restart_required": "Es necesario reiniciar para que surta efecto.","degraded_warning": "La frase elegida no es compatible con el motor seleccionado — recurrirá a otro motor.","needs_whisper_hint": "Una frase arbitraria requiere el extra de Whisper local. Sin él, el motor recurrirá a una frase rápida integrada.",+ "derived_name": "Tu asistente se llamará: {0}","engine_options": {"auto": "Automático (recomendado)","openwakeword": "openWakeWord (frases integradas)",@@ -899,16 +900,6 @@"none": "Ninguno (oculto)"}},- "assistant_name": {- "title": "Nombre del asistente",- "description": "Cómo se llama el asistente a sí mismo en las respuestas. Esto NO es la palabra de activación que dices para activarlo — define el disparador hablado en el panel «Palabra de activación» de abajo. Déjalo vacío para seguir la palabra de activación.",- "label": "Nombre",- "current": "El asistente se llama «{0}».",- "auto_hint": "Vacío — sigue la palabra de activación (actualmente «{0}»).",- "save": "Guardar nombre",- "saved": "Nombre guardado",- "restart_required": "Reinicio necesario para que surta efecto."- },"system_prompt": {"title": "Prompt del sistema","description": "Las instrucciones que definen cómo piensa y habla tu asistente. Edita el Markdown para personalizarlo o restablece el valor predeterminado cuando quieras.",diff --git a/jarvis/ui/web/frontend/src/lib/deriveAssistantName.test.ts b/jarvis/ui/web/frontend/src/lib/deriveAssistantName.test.tsnew file mode 100644index 0000000000..3594fb22af--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/deriveAssistantName.test.ts@@ -0,0 +1,27 @@+import { describe, expect, it } from "vitest";+import { deriveAssistantName } from "./deriveAssistantName";++describe("deriveAssistantName", () => {+ it("strips a wake prefix and title-cases", () => {+ expect(deriveAssistantName("Hey Ruben")).toBe("Ruben");+ expect(deriveAssistantName("hey computer")).toBe("Computer");+ expect(deriveAssistantName("ok friday")).toBe("Friday");+ expect(deriveAssistantName("Micron")).toBe("Micron");+ expect(deriveAssistantName("micron")).toBe("Micron");+ });++ it("returns empty string for blank input", () => {+ expect(deriveAssistantName("")).toBe("");+ expect(deriveAssistantName(" ")).toBe("");+ });++ it("keeps an all-prefix phrase rather than emptying it", () => {+ // mirrors backend phrase_core: never returns empty for a non-empty phrase+ expect(deriveAssistantName("Hey")).toBe("Hey");+ });++ it("strips multiple leading wake prefixes", () => {+ expect(deriveAssistantName("ok hey nova")).toBe("Nova");+ expect(deriveAssistantName("Hey Hey Nova")).toBe("Nova");+ });+});diff --git a/jarvis/ui/web/frontend/src/lib/deriveAssistantName.ts b/jarvis/ui/web/frontend/src/lib/deriveAssistantName.tsnew file mode 100644index 0000000000..9890969e91--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/deriveAssistantName.ts@@ -0,0 +1,29 @@+/**+ * Derive the assistant's display name from a wake phrase — the TS mirror of+ * `jarvis.speech.wake_constants.phrase_core` + the title-casing in+ * `jarvis.brain.assistant_name.resolve_assistant_name`. Used for the live+ * "Your assistant will be called: X" hint while the user sets the wake word.+ *+ * Keep in lockstep with the backend WAKE_PREFIXES set.+ */+const WAKE_PREFIXES = new Set([+ "hey", "hi", "ok", "okay", "hello", "hallo", "yo", "hej",+]);++export function deriveAssistantName(phrase: string): string {+ // normalize_phrase: lower-case, punctuation→space, split (keeps umlauts/ß).+ const tokens = (phrase || "")+ .toLowerCase()+ .replace(/[^0-9a-zäöüß]+/g, " ")+ .trim()+ .split(/\s+/)+ .filter(Boolean);+ if (tokens.length === 0) return "";++ // phrase_core: drop leading wake prefixes, but never empty a non-empty phrase.+ let core = [...tokens];+ while (core.length > 0 && WAKE_PREFIXES.has(core[0])) core.shift();+ if (core.length === 0) core = tokens;++ return core.map((tok) => tok.charAt(0).toUpperCase() + tok.slice(1)).join(" ");+}diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex fc6af5dadc..ca3deb4df6 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -190,9 +190,10 @@ interface EventStore {// renders as the collapsible "Thought for Xs" disclosure above the reply.thinkingTraces: Record<string, ThinkingTraceSnapshot>;brainProvider: string;- // How the assistant refers to itself (resolved name: explicit [persona].name,- // else derived from the wake phrase, else the neutral default). Seeded once at- // app start by useAssistantNameSeed and refreshed on a Settings rename, so the+ // How the assistant refers to itself (resolved name: derived from the wake+ // phrase with its prefix stripped, else the neutral "Assistant" default —+ // [persona].name was removed 2026-06-20). Seeded once at app start by+ // useAssistantNameSeed and refreshed on a wake-word save, so the// header wordmark + every assistant byline follow the configured identity// instead of a hardcoded "Jarvis". Defaults to "Jarvis" only for the sub-tick// before the local seed fetch resolves (zero-regression first paint).diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsxindex 7be76e1228..3b2df03fd7 100644--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx@@ -3,7 +3,6 @@ import {Settings,Mic,Keyboard,- Bot,} from "lucide-react";import { ViewHeader } from "@/views/ChatsView";import { Switch } from "@/components/ui/switch";@@ -30,7 +29,7 @@ import {} from "@/hooks/useHotkey";import { KeyboardMap } from "@/views/settings/KeyboardMap";import { detectKeyboardPlatform } from "@/views/settings/keyboardLayout";-import { useAssistantName } from "@/hooks/useAssistantName";+import { deriveAssistantName } from "@/lib/deriveAssistantName";import { WAKE_ENGINES, WAKE_ENGINE_I18N_KEY } from "@/constants/wakeEngines";import { useEventStore } from "@/store/events";import { useT } from "@/i18n";@@ -67,7 +66,6 @@ export function SettingsView() {<AppSettingsGroup /><JarvisApiGroup /><TeamProxyGroup />- <AssistantNamePanel /><SystemPromptGroup /><WakeWordPanel /><SilenceWindowGroup />@@ -137,6 +135,7 @@ function WakeWordPanel() {const trimmedPhrase = phrase.trim();// No local-Whisper extra + any non-empty phrase → the engine will degrade.const showNeedsWhisperHint = !localWhisperAvailable && trimmedPhrase.length > 0;+ const derivedName = deriveAssistantName(phrase);async function onSave() {if (!trimmedPhrase) return;@@ -193,6 +192,12 @@ function WakeWordPanel() {className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"/>+ {derivedName ? (+ <p className="mt-1.5 text-xs text-muted-foreground">+ {t("settings_view.wake_word.derived_name").replace("{0}", derivedName)}+ </p>+ ) : null}+{/* Engine select */}<label className="mt-4 block text-xs font-medium text-muted-foreground">{t("settings_view.wake_word.engine_label")}@@ -297,97 +302,6 @@ function WakeWordPanel() {);}-/**- * Editable assistant-name panel. The assistant calls itself this name in its- * replies. Empty = derive it from the wake phrase (so "Micron" wake → "Micron"- * identity). A successful save surfaces a restart hint (the system prompt is- * assembled once per BrainManager).- */-function AssistantNamePanel() {- const t = useT();- const { config, loading, error, saveName } = useAssistantName();- const pushToast = useEventStore((s) => s.pushToast);-- const [name, setName] = useState("");- const [saving, setSaving] = useState(false);- const [saved, setSaved] = useState(false);-- useEffect(() => {- if (config) setName(config.name);- }, [config]);-- async function onSave() {- setSaving(true);- setSaved(false);- try {- const res = await saveName(name.trim());- setSaved(res.restart_required);- pushToast("success", t("settings_view.assistant_name.saved"));- } catch (e) {- pushToast("error", (e as Error).message);- } finally {- setSaving(false);- }- }-- const resolved = config?.resolved ?? "Assistant";- const dirty = !!config && name.trim() !== config.name;-- return (- <div className="rounded-lg border border-border bg-card/60 p-4">- <div className="flex items-start gap-3">- <Bot className="mt-0.5 h-4 w-4 shrink-0 text-primary" />- <div className="min-w-0 flex-1">- <h4 className="font-display text-sm font-semibold">- {t("settings_view.assistant_name.title")}- </h4>- <p className="mt-1 text-xs text-muted-foreground">- {t("settings_view.assistant_name.description")}- </p>-- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}-- <label className="mt-4 block text-xs font-medium text-muted-foreground">- {t("settings_view.assistant_name.label")}- </label>- <input- value={name}- onChange={(e) => {- setName(e.target.value);- setSaved(false);- }}- maxLength={40}- placeholder={resolved}- disabled={loading}- className="mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"- />- <p className="mt-1.5 text-xs text-muted-foreground">- {name.trim()- ? t("settings_view.assistant_name.current").replace("{0}", resolved)- : t("settings_view.assistant_name.auto_hint").replace("{0}", resolved)}- </p>-- <div className="mt-4 flex items-center gap-3">- <Button size="sm" onClick={onSave} disabled={saving || loading || !dirty}>- {saving- ? t("settings_view.saving")- : t("settings_view.assistant_name.save")}- </Button>- </div>-- {saved && (- <div className="mt-3 rounded-md border border-primary/40 bg-primary/10 p-3 text-xs text-foreground">- <p className="text-muted-foreground">- {t("settings_view.assistant_name.restart_required")}- </p>- </div>- )}- </div>- </div>- </div>- );-}-/** Pretty-print a combo string ("ctrl+right_alt+j" → "Ctrl + Right-Alt + J"). */function formatCombo(combo: string): string {const labels: Record<string, string> = {diff --git a/jarvis/ui/web/frontend/src/views/settings/WakeWordPanel.test.tsx b/jarvis/ui/web/frontend/src/views/settings/WakeWordPanel.test.tsxindex 4135abefab..f703cd961f 100644--- a/jarvis/ui/web/frontend/src/views/settings/WakeWordPanel.test.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/WakeWordPanel.test.tsx@@ -24,19 +24,11 @@ vi.mock("@/i18n", async (importOriginal) => {// ---------------------------------------------------------------------------// Silence hooks that make real network calls unrelated to wake-word:-// useWebSocket, useBrainStatus, useAssistantName, useKeybinds, useProviders,+// useWebSocket, useBrainStatus, useKeybinds, useProviders,// useAutostart, and the event store's pushToast.// ---------------------------------------------------------------------------vi.mock("@/hooks/useWebSocket", () => ({ useWebSocket: vi.fn() }));vi.mock("@/hooks/useBrainStatus", () => ({ useBrainStatus: vi.fn() }));-vi.mock("@/hooks/useAssistantName", () => ({- useAssistantName: () => ({- config: null,- loading: true,- error: null,- saveName: vi.fn(),- }),-}));vi.mock("@/hooks/useHotkey", () => ({useKeybinds: () => ({config: null,diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex 3903bc375e..6a1607e3bc 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -610,64 +610,21 @@ async def put_keybind(body: KeybindBody, request: Request) -> dict[str, object]:# ----------------------------------------------------------------------------# Assistant name (persona identity). GET current (explicit + resolved); PUT to-# change. Persisted to jarvis.toml [persona].name; applies on the next-# BrainManager build (a Jarvis restart). Empty = derive from the wake phrase.+# Assistant name (read-only). The name derives from the wake phrase; GET+# exposes the resolved name for the frontend bylines. There is no write endpoint.# ----------------------------------------------------------------------------class AssistantNameBody(BaseModel):- # Empty string is allowed and meaningful: "" = auto-derive from wake phrase.- name: str = Field(default="", max_length=40)- persist: bool = Field(default=True, description="Persist to jarvis.toml")--@router.get("/assistant-name")async def get_assistant_name(request: Request) -> dict[str, object]:+ """The assistant's resolved name. Read-only: the name derives from the wake+ phrase (set via PUT /api/settings/wake-word), there is no separate control."""from jarvis.brain.assistant_name import DEFAULT_ASSISTANT_NAME, resolve_assistant_namecfg = _config(request)- persona = getattr(cfg, "persona", None) if cfg is not None else None- explicit = (getattr(persona, "name", "") or "") if persona is not None else ""return {- "name": explicit, # the explicit override ("" = auto)- "resolved": resolve_assistant_name(cfg), # what the assistant actually calls itself- "default": DEFAULT_ASSISTANT_NAME,- }--[email protected]("/assistant-name")-async def put_assistant_name(body: AssistantNameBody, request: Request) -> dict[str, object]:- from jarvis.brain.assistant_name import resolve_assistant_name-- name = body.name.strip()-- # Best-effort in-memory cfg update so a later cfg read agrees pre-restart.- cfg = _config(request)- if cfg is not None and getattr(cfg, "persona", None) is not None:- try:- cfg.persona.name = name # type: ignore[attr-defined]- except Exception as exc: # noqa: BLE001 — frozen model is not an error- log.debug("in-memory persona.name update skipped: %s", exc)-- persisted = False- if body.persist:- try:- from jarvis.core import config_writer-- config_writer.set_assistant_name(name)- persisted = True- except Exception as exc: # noqa: BLE001- log.warning("assistant-name persist failed: %s", exc)-- return {- "ok": True,- "name": name,"resolved": resolve_assistant_name(cfg),- "persisted": persisted,- # The system prompt is assembled once per BrainManager, so a name change- # needs a restart to take effect.- "restart_required": True,+ "default": DEFAULT_ASSISTANT_NAME,}diff --git a/tests/unit/brain/test_assistant_name.py b/tests/unit/brain/test_assistant_name.pyindex b9c53cced5..c11a99dbb6 100644--- a/tests/unit/brain/test_assistant_name.py+++ b/tests/unit/brain/test_assistant_name.py@@ -40,17 +40,18 @@ def test_name_derived_from_wake_phrase(phrase, expected):# -----------------------------------------------------------------------# Explicit override wins+# The wake phrase is the single source — a legacy [persona].name is ignored# -----------------------------------------------------------------------def test_explicit_persona_name_overrides_wake_phrase():- # Wake "Hey Computer" but identity pinned to "Friday".+def test_legacy_persona_name_is_ignored_in_favor_of_wake_phrase():+ # A stale override from before the coupling must NOT win anymore.cfg = _cfg(persona_name="Friday", wake_phrase="Hey Computer")- assert resolve_assistant_name(cfg) == "Friday"+ assert resolve_assistant_name(cfg) == "Computer"-def test_explicit_name_is_trimmed():- assert resolve_assistant_name(_cfg(persona_name=" Vision ")) == "Vision"+def test_legacy_persona_name_alone_does_not_name_the_assistant():+ # No wake phrase + a stale persona name → fall back, do not use the override.+ assert resolve_assistant_name(_cfg(persona_name="Friday", wake_phrase="")) == DEFAULT_ASSISTANT_NAME# ----------------------------------------------------------------------diff --git a/tests/unit/brain/test_system_prompt_name.py b/tests/unit/brain/test_system_prompt_name.pyindex f9f171b68f..c36aeebc49 100644--- a/tests/unit/brain/test_system_prompt_name.py+++ b/tests/unit/brain/test_system_prompt_name.py@@ -11,7 +11,7 @@ from jarvis.brain.manager import BrainManagerfrom jarvis.core.config import load_config-def _manager_with_name(*, persona_name: str = "", wake_phrase: str = "Hey Jarvis") -> BrainManager:+def _manager_with_name(*, wake_phrase: str = "Hey Jarvis") -> BrainManager:"""A BrainManager with __init__ bypassed — only the attrs the prompt needs."""m = BrainManager.__new__(BrainManager)m._soul = None@@ -24,7 +24,6 @@ def _manager_with_name(*, persona_name: str = "", wake_phrase: str = "Hey Jarvism._reply_language = "auto"cfg = load_config()cfg.performance.cache_optimized_prompt = False- cfg.persona.name = persona_namecfg.trigger.wake_word.phrase = wake_phrasem._config = cfgreturn m@@ -33,7 +32,9 @@ def _manager_with_name(*, persona_name: str = "", wake_phrase: str = "Hey Jarvisdef test_default_name_keeps_jarvis_and_no_identity_directive() -> None:prompt = _manager_with_name(wake_phrase="Hey Jarvis")._build_system_prompt()assert "Du bist Jarvis" in prompt- # No override directive when the name is still the historical default.+ # "Jarvis" is the persona-file baseline (SOUL.md / JARVIS_PERSONA.md already+ # say "Jarvis"), so no identity-override directive is needed — emitting one+ # would produce the self-contradictory "Du heisst Jarvis — nicht Jarvis".assert "DEIN NAME IST" not in prompt@@ -45,9 +46,9 @@ def test_wake_phrase_micron_makes_assistant_micron() -> None:assert "nicht Jarvis" in prompt-def test_explicit_persona_name_wins_over_wake_phrase() -> None:- prompt = _manager_with_name(- persona_name="Friday", wake_phrase="Hey Computer"- )._build_system_prompt()- assert "Du bist Friday" in prompt- assert "DEIN NAME IST FRIDAY" in prompt+def test_wake_phrase_is_the_only_name_source() -> None:+ # "Hey Computer" wake → the assistant is "Computer"; there is no override.+ prompt = _manager_with_name(wake_phrase="Hey Computer")._build_system_prompt()+ assert "Du bist Computer" in prompt+ assert "DEIN NAME IST COMPUTER" in prompt+ assert "nicht Jarvis" in promptdiff --git a/tests/unit/core/test_config_writer_persona_strip.py b/tests/unit/core/test_config_writer_persona_strip.pynew file mode 100644index 0000000000..57e07bab44--- /dev/null+++ b/tests/unit/core/test_config_writer_persona_strip.py@@ -0,0 +1,45 @@+"""set_wake_word() removes a stale [persona] name so a legacy override can't linger."""+from __future__ import annotations++from pathlib import Path++from jarvis.core import config_writer+++def test_set_wake_word_strips_legacy_persona_name(tmp_path: Path) -> None:+ toml = tmp_path / "jarvis.toml"+ toml.write_text(+ "[persona]\nname = \"Josef\"\n\n[trigger.wake_word]\nphrase = \"Hey Jarvis\"\n",+ encoding="utf-8",+ )++ config_writer.set_wake_word("Hey Ruben", path=toml)++ text = toml.read_text(encoding="utf-8")+ assert "Hey Ruben" in text+ # The stale identity override is gone; the wake word is now the single source.+ assert "Josef" not in text+++def test_set_wake_word_without_persona_table_is_a_noop_strip(tmp_path: Path) -> None:+ toml = tmp_path / "jarvis.toml"+ toml.write_text("[trigger.wake_word]\nphrase = \"Hey Jarvis\"\n", encoding="utf-8")++ config_writer.set_wake_word("Hey Nova", path=toml) # must not raise++ assert "Hey Nova" in toml.read_text(encoding="utf-8")+++def test_set_wake_word_strips_legacy_persona_name_bom_file(tmp_path: Path) -> None:+ # A UTF-8 BOM (Notepad / VS Code utf8bom) must survive the strip+save.+ toml = tmp_path / "jarvis.toml"+ toml.write_bytes(+ "[persona]\nname = \"Josef\"\n\n[trigger.wake_word]\nphrase = \"Hey Jarvis\"\n".encode()+ )++ config_writer.set_wake_word("Hey Nova", path=toml)++ raw = toml.read_bytes()+ assert raw.startswith(b"\xef\xbb\xbf"), "BOM must be preserved"+ assert b"Josef" not in raw+ assert b"Hey Nova" in raw