Skip to content

The agent that grows with you

feat(telemetry): shared-metrics opt-in offer on every surface

teknium17a06cb50d7ae
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index b85bf11fe71..adbcd7d8872 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -1866,6 +1866,9 @@ def cmd_chat(args):
os.environ["HERMES_SESSION_SOURCE_EXPLICIT"] = "1"
_pin_kanban_board_env()
+ from hermes_cli.observability.shared_metrics_consent import offer_consent_before_chat
+
+ offer_consent_before_chat(args)
_confirm_startup_expensive_model_override(args)
passthrough = {k: getattr(args, k, d) for k, d in _CHAT_PASSTHROUGH}
diff --git a/hermes_cli/observability/shared_metrics_consent.py b/hermes_cli/observability/shared_metrics_consent.py
new file mode 100644
index 00000000000..b8592e353b9
--- /dev/null
+++ b/hermes_cli/observability/shared_metrics_consent.py
@@ -0,0 +1,153 @@
+"""The one shared-metrics consent answer, and the terminal's first-run offer.
+
+Every surface reads and writes the same two keys in the profile's config.yaml:
+``telemetry.shared_metrics.enabled`` (collect locally) and ``.send`` (upload daily). The question
+counts as answered once either key is written explicitly; the shipped defaults are not an answer.
+Desktop paints the offer as a composer strip (``consent-strip.tsx`` over the ``shared_metrics.*``
+RPCs). The terminal asks at the end of every ``hermes setup`` flow and, for a profile that never
+answered, once before an interactive ``hermes`` / ``hermes --tui`` chat (which also covers the
+dashboard's Chat tab, a PTY-hosted TUI). The messaging gateway never asks: a chat participant is
+not the install owner.
+"""
+
+from __future__ import annotations
+
+import logging
+import os
+import sys
+from typing import Any
+
+logger = logging.getLogger(__name__)
+
+# (label, enabled, send): the Desktop strip's three equal answers, in its order.
+OFFER_CHOICES = (
+ ("Collect and send to Nous", True, True),
+ ("Collect locally only", True, False),
+ ("No thanks", False, False),
+)
+_NO_THANKS = len(OFFER_CHOICES) - 1
+DOCS_URL = "https://hermes-agent.nousresearch.com/docs/developer-guide/relay-shared-metrics"
+_OFFER_DESCRIPTION = "\n".join((
+ "Shared metrics are bounded counters: activity, outcomes, error classes, model routes,",
+ "token totals, feature use and coarse machine facts. Never prompts, files, paths,",
+ "setting values or error text. Collection stays on this machine; sending to Nous is",
+ "a separate choice, and data from before you opt in is never sent.",
+ f"Details: {DOCS_URL}",
+ "Change it any time: hermes setup telemetry",
+))
+
+
+def _section(cfg: Any) -> dict:
+ telemetry = cfg.get("telemetry") if isinstance(cfg, dict) else None
+ section = telemetry.get("shared_metrics") if isinstance(telemetry, dict) else None
+ return section if isinstance(section, dict) else {}
+
+
+def consent_state(raw_cfg: Any) -> dict:
+ """``{enabled, send, decided}`` from a RAW config mapping (no defaults merged)."""
+ section = _section(raw_cfg)
+ enabled = section.get("enabled") is True
+ return {
+ "enabled": enabled,
+ "send": enabled and section.get("send") is True,
+ "decided": "enabled" in section or "send" in section,
+ }
+
+
+def consent_decided() -> bool:
+ from hermes_cli.config import read_raw_config
+
+ return consent_state(read_raw_config())["decided"]
+
+
+def _set_answer(target: dict, enabled: bool, send: bool) -> None:
+ telemetry = target.get("telemetry")
+ if not isinstance(telemetry, dict):
+ telemetry = target["telemetry"] = {}
+ section = telemetry.get("shared_metrics")
+ if not isinstance(section, dict):
+ section = telemetry["shared_metrics"] = {}
+ section["enabled"], section["send"] = enabled, send
+
+
+def save_consent(enabled: bool, send: bool, config: dict | None = None) -> None:
+ """Write both keys into the user's raw config.yaml now. ``save_config`` strips values equal
+ to the shipped defaults, so a "No thanks" (both false) saved through it vanished and the
+ profile was asked again on every surface. ``config`` (a caller's in-memory copy, e.g. the
+ wizard's) gets the same answer so its later save agrees. Sending cannot outlive collection."""
+ from hermes_cli.config import (
+ _write_user_config, get_config_path, is_managed, managed_error, require_readable_config_before_write,
+ )
+ from hermes_cli.setup import _record_send_consent_change
+
+ if is_managed():
+ managed_error("save configuration")
+ return
+ send = enabled and send
+ config_path = get_config_path()
+ user_config = require_readable_config_before_write(config_path)
+ _set_answer(user_config, enabled, send)
+ _write_user_config(config_path, user_config)
+ if config is not None:
+ _set_answer(config, enabled, send)
+ # Unconditional: a send key already false may still have an open consent window.
+ _record_send_consent_change(enabled=send)
+
+
+def offer_consent(config: dict | None = None) -> bool:
+ """Ask once, with the Desktop strip's three answers; "No thanks" is the default so Enter never
+ opts anyone in. Esc leaves the question open (asked again next time). True when answered."""
+ from hermes_cli.cli_output import print_info, print_success
+ from hermes_cli.curses_ui import curses_radiolist
+
+ idx = curses_radiolist(
+ "Help improve Hermes?", [label for label, _, _ in OFFER_CHOICES], selected=_NO_THANKS, cancel_returns=-1,
+ description=_OFFER_DESCRIPTION,
+ )
+ if idx < 0:
+ print_info("Not answered; Hermes will ask again. Decide any time with `hermes setup telemetry`.")
+ return False
+ _, enabled, send = OFFER_CHOICES[idx]
+ save_consent(enabled, send, config)
+ outcome = "collected and sent to Nous" if send else "collected on this machine only" if enabled else "off"
+ print_success(f"Shared metrics {outcome}. Change it any time with `hermes setup telemetry`.")
+ return True
+
+
+def offer_consent_if_undecided(config: dict | None = None) -> None:
+ """The end-of-setup offer: every ``hermes setup`` flow funnels through the setup-completed
+ record, so this one call covers Quick, Full, Blank Slate, Portal and ``--quick``."""
+ from hermes_cli.config import is_managed
+ from hermes_cli.setup import is_noninteractive
+
+ if is_managed() or is_noninteractive() or not sys.stdin.isatty() or consent_decided():
+ return
+ try:
+ offer_consent(config)
+ except (KeyboardInterrupt, EOFError):
+ print()
+
+
+def offer_consent_before_chat(args: Any) -> None:
+ """One-time offer before an interactive chat on a profile that never answered. Skipped for
+ anything without a person at a terminal (``-q``, piped or JSON output, spawned actions) and for
+ a Desktop-spawned pane (the app shows its own strip)."""
+ from hermes_cli.config import is_managed
+ from hermes_cli.setup import is_noninteractive
+
+ if any(getattr(args, name, None) for name in ("query", "query_file", "oneshot", "oneshot_exit")):
+ return
+ if getattr(args, "safe_mode", False) or getattr(args, "ignore_user_config", False):
+ return
+ if os.environ.get("HERMES_DESKTOP") or is_noninteractive():
+ return
+ if not (sys.stdin.isatty() and sys.stdout.isatty()) or is_managed():
+ return
+ try:
+ if consent_decided():
+ return
+ offer_consent()
+ except (KeyboardInterrupt, EOFError):
+ print()
+ except Exception:
+ logger.debug("shared-metrics offer skipped", exc_info=True)
diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py
index f032d15380d..9d001c3c78e 100644
--- a/hermes_cli/setup.py
+++ b/hermes_cli/setup.py
@@ -535,23 +535,21 @@ def setup_telemetry(config: dict):
"local model server yes/no). Never prompts, files, paths, setting values or",
"error text.",
"Collection is local. Sending them to Nous is a separate opt-in.")
+ # The answer is written to config.yaml here, not by the caller's later save: that save strips
+ # values equal to the defaults, so a "no" would vanish and every surface would ask again.
+ from hermes_cli.observability.shared_metrics_consent import save_consent
+
shared_metrics = _sub_dict(_sub_dict(config, "telemetry"), "shared_metrics")
- current = shared_metrics.get("enabled") is True
- shared_metrics["enabled"] = prompt_yes_no("Enable local shared metrics?", default=current)
- if not shared_metrics["enabled"]:
+ if not prompt_yes_no("Enable local shared metrics?", default=shared_metrics.get("enabled") is True):
print_info("Local shared metrics disabled.")
- # Sending cannot outlive collection (send=true would log an error every run, never send).
+ # Sending cannot outlive collection; turning collection off withdraws send consent too.
if shared_metrics.get("send") is True:
- shared_metrics["send"] = False
print_info("Sending shared metrics disabled as well.")
- # Turning collection off withdraws send consent too. Recorded unconditionally: the send
- # key may already be false while the consent window is still open, and it must close.
- _record_send_consent_change(enabled=False)
+ save_consent(False, False, config)
return
print_success("Local shared metrics enabled.")
_info(*_SEND_CONSENT_EXPLAINER)
- shared_metrics["send"] = prompt_yes_no("Send shared metrics to Nous?", default=shared_metrics.get("send") is True)
- _record_send_consent_change(enabled=shared_metrics["send"])
+ save_consent(True, prompt_yes_no("Send shared metrics to Nous?", default=shared_metrics.get("send") is True), config)
if shared_metrics["send"]:
print_success("Sending shared metrics enabled.")
else:
@@ -752,8 +750,11 @@ def _run_setup_wizard_impl(args):
def _record_setup_completed(config: dict) -> None:
- """Count a wizard run that finished. Runs after every section (shared-metrics consent
- included) so a user who opted in during this run is counted; the API checks enablement."""
+ """Count a wizard run that finished. Every setup flow ends here, so the one-time
+ shared-metrics offer runs first: a user who opts in now is counted; the API checks enablement."""
+ from hermes_cli.observability.shared_metrics_consent import offer_consent_if_undecided
+
+ offer_consent_if_undecided(config)
from hermes_cli.observability.shared_metrics_events import record_setup_completed
model = config.get("model")
record_setup_completed(surface="cli", provider=model.get("provider") if isinstance(model, dict) else None)
diff --git a/hermes_cli/web_routers/shared_metrics.py b/hermes_cli/web_routers/shared_metrics.py
new file mode 100644
index 00000000000..902f691b99a
--- /dev/null
+++ b/hermes_cli/web_routers/shared_metrics.py
@@ -0,0 +1,48 @@
+"""``/api/shared-metrics/consent``: the dashboard's first-run shared-metrics offer.
+
+The twin of Desktop's composer strip and the terminal's offer: one answer per profile, the same
+two config.yaml keys (``telemetry.shared_metrics.enabled`` / ``.send``), read and written through
+``hermes_cli.observability.shared_metrics_consent`` for the ``?profile=`` being managed.
+"""
+
+from __future__ import annotations
+
+import asyncio
+from typing import Optional
+
+from fastapi import APIRouter
+from pydantic import BaseModel
+
+from hermes_cli.web_routers._common import config_write_scope, scoped_to_thread
+
+router = APIRouter()
+
+
+class ConsentAnswer(BaseModel):
+ enabled: bool
+ send: bool = False
+
+
+def _read_consent() -> dict:
+ """``{enabled, send, decided, managed}``; a managed install cannot save, so it is never offered."""
+ from hermes_cli.config import is_managed, read_raw_config
+ from hermes_cli.observability.shared_metrics_consent import consent_state
+
+ return {**consent_state(read_raw_config()), "managed": is_managed()}
+
+
[email protected]("/api/shared-metrics/consent")
+async def get_shared_metrics_consent(profile: Optional[str] = None):
+ return await scoped_to_thread(profile, _read_consent)
+
+
[email protected]("/api/shared-metrics/consent")
+async def put_shared_metrics_consent(body: ConsentAnswer, profile: Optional[str] = None):
+ from hermes_cli.observability.shared_metrics_consent import save_consent
+
+ def _write() -> dict:
+ with config_write_scope(profile):
+ save_consent(body.enabled, body.send)
+ return _read_consent()
+
+ return await asyncio.to_thread(_write)
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index e19d3eb4fa5..077c7a5fa3c 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -1004,6 +1004,7 @@ from hermes_cli.web_routers import ( # noqa: E402
chat_ws as _chat_ws_routes,
chat_workspaces as _chat_workspaces_routes,
dashboard_ui as _dashboard_ui_routes,
+ shared_metrics as _shared_metrics_routes,
)
app.include_router(_files_routes.router)
@@ -1036,6 +1037,7 @@ app.include_router(_analytics_routes.router)
app.include_router(_chat_ws_routes.router)
app.include_router(_chat_workspaces_routes.router)
app.include_router(_dashboard_ui_routes.router)
+app.include_router(_shared_metrics_routes.router)
# Plugin API routes and the dashboard auth routes (/login, /auth/*, /api/auth/*)
# mount before the SPA catch-all so /{full_path:path} doesn't swallow them. Auth
diff --git a/tests/hermes_cli/test_setup_telemetry.py b/tests/hermes_cli/test_setup_telemetry.py
index 23975243434..5b70194345a 100644
--- a/tests/hermes_cli/test_setup_telemetry.py
+++ b/tests/hermes_cli/test_setup_telemetry.py
@@ -80,3 +80,36 @@ def test_setup_parser_accepts_telemetry_section():
assert args.section == "telemetry"
assert args.func is handler
+
+
+def test_no_answer_survives_the_callers_later_config_save(monkeypatch):
+ """A "no" equals the shipped defaults; saved only through ``save_config`` it was stripped, so
+ the profile read undecided and every surface (Desktop strip, CLI offer) asked again."""
+ from hermes_cli.config import load_config, read_raw_config, save_config
+
+ monkeypatch.setattr("hermes_cli.setup.prompt_yes_no", lambda _question, default: False)
+ config = load_config()
+ setup_telemetry(config)
+ save_config(config) # what the wizard and `hermes tools` do afterwards
+
+ assert read_raw_config()["telemetry"]["shared_metrics"] == {"enabled": False, "send": False}
+
+
+def test_chat_offer_asks_an_undecided_profile_once(monkeypatch):
+ from hermes_cli.config import read_raw_config
+ from hermes_cli.observability import shared_metrics_consent as consent
+
+ asked = []
+ monkeypatch.setattr("hermes_cli.curses_ui.curses_radiolist", lambda *a, **k: asked.append(a) or 1)
+ monkeypatch.setattr("sys.stdin.isatty", lambda: True)
+ monkeypatch.setattr("sys.stdout.isatty", lambda: True)
+ monkeypatch.delenv("HERMES_DESKTOP", raising=False)
+ monkeypatch.delenv("HERMES_NONINTERACTIVE", raising=False)
+
+ consent.offer_consent_before_chat(argparse.Namespace(query="hi")) # no person to ask
+ assert asked == []
+ consent.offer_consent_before_chat(argparse.Namespace())
+ consent.offer_consent_before_chat(argparse.Namespace())
+
+ assert len(asked) == 1
+ assert consent.consent_state(read_raw_config()) == {"enabled": True, "send": False, "decided": True}
diff --git a/tui_gateway/methods_shared_metrics.py b/tui_gateway/methods_shared_metrics.py
index a15c4defcf1..10d6215ad17 100644
--- a/tui_gateway/methods_shared_metrics.py
+++ b/tui_gateway/methods_shared_metrics.py
@@ -17,22 +17,11 @@ method = _registry.method
_profile_scoped = _registry.profile_scoped
-def _shared_metrics_section(cfg) -> dict:
- telemetry = cfg.get("telemetry") if isinstance(cfg, dict) else None
- section = telemetry.get("shared_metrics") if isinstance(telemetry, dict) else None
- return section if isinstance(section, dict) else {}
-
-
def _shared_metrics_consent(cfg) -> dict:
- """``decided`` = the user answered somewhere (either key written explicitly); the shipped
- defaults are not an answer, so a profile that never saw the question reads undecided."""
- section = _shared_metrics_section(cfg)
- enabled = section.get("enabled") is True
- return {
- "enabled": enabled,
- "send": enabled and section.get("send") is True,
- "decided": "enabled" in section or "send" in section,
- }
+ """The one ``{enabled, send, decided}`` reading every surface shares (CLI offer included)."""
+ from hermes_cli.observability.shared_metrics_consent import consent_state
+
+ return consent_state(cfg)
def _shared_metrics_record_setup_completed(cfg) -> None:
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 4dd47f27e04..58dcea04ef0 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -74,6 +74,7 @@ import { ProfileSwitcher } from "@/components/ProfileSwitcher";
import { ProfileScopeBanner } from "@/components/ProfileScopeBanner";
import { MemoryPressureBanner } from "@/components/MemoryPressureBanner";
import { MultiplexStandaloneBanner } from "@/components/MultiplexStandaloneBanner";
+import { SharedMetricsConsentBanner } from "@/components/SharedMetricsConsentBanner";
import { useSystemActions } from "@/contexts/useSystemActions";
import type { SystemAction } from "@/contexts/system-actions-context";
// Route pages are lazy-loaded so the initial dashboard shell does not pay for
@@ -578,6 +579,7 @@ export default function App() {
<ProfileScopeBanner />
<MemoryPressureBanner status={sidebarStatus} />
<MultiplexStandaloneBanner status={sidebarStatus} />
+ <SharedMetricsConsentBanner />
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<div className="flex min-h-0 min-w-0 flex-1">
diff --git a/web/src/components/SharedMetricsConsentBanner.tsx b/web/src/components/SharedMetricsConsentBanner.tsx
new file mode 100644
index 00000000000..75b2829c1dd
--- /dev/null
+++ b/web/src/components/SharedMetricsConsentBanner.tsx
@@ -0,0 +1,107 @@
+import { useEffect, useState } from "react";
+import { BarChart3, X } from "lucide-react";
+import { api, type SharedMetricsConsent } from "@/lib/api";
+import { useProfileScope } from "@/contexts/useProfileScope";
+import { useI18n } from "@/i18n";
+
+const DOCS_URL =
+ "https://hermes-agent.nousresearch.com/docs/developer-guide/relay-shared-metrics";
+const STORAGE_KEY = "sharedMetricsOfferDismissed";
+
+/**
+ * The dashboard's first-run shared-metrics offer: the twin of Desktop's composer strip and the
+ * terminal's offer, with the same three equal answers. Shown while the managed profile has no
+ * answer in its config.yaml; answering writes it (every surface then stops asking), while the X
+ * only hides the banner for this browser session.
+ */
+export function SharedMetricsConsentBanner() {
+ const { t } = useI18n();
+ const { profile } = useProfileScope();
+ // Keyed by the profile it was read for, so a profile switch hides a stale answer at once.
+ const [loaded, setLoaded] = useState<{ profile: string; consent: SharedMetricsConsent } | null>(
+ null,
+ );
+ const [saving, setSaving] = useState(false);
+ const [failed, setFailed] = useState(false);
+ const [dismissed, setDismissed] = useState(() => {
+ try {
+ return sessionStorage.getItem(STORAGE_KEY) === "1";
+ } catch {
+ return false;
+ }
+ });
+
+ useEffect(() => {
+ let live = true;
+ api
+ .getSharedMetricsConsent()
+ .then((next) => {
+ if (live) setLoaded({ profile, consent: next });
+ })
+ .catch(() => undefined);
+ return () => {
+ live = false;
+ };
+ }, [profile]);
+
+ const consent = loaded?.profile === profile ? loaded.consent : null;
+ if (dismissed || !consent || consent.decided || consent.managed) return null;
+
+ const answer = (enabled: boolean, send: boolean) => {
+ setSaving(true);
+ setFailed(false);
+ api
+ .saveSharedMetricsConsent({ enabled, send })
+ .then((next) => setLoaded({ profile, consent: next }))
+ .catch(() => setFailed(true))
+ .finally(() => setSaving(false));
+ };
+ const dismiss = () => {
+ try {
+ sessionStorage.setItem(STORAGE_KEY, "1");
+ } catch {
+ /* ignore */
+ }
+ setDismissed(true);
+ };
+ const choice =
+ "shrink-0 rounded border border-current/30 px-2 py-0.5 hover:bg-current/10 disabled:opacity-50";
+
+ return (
+ <div
+ role="region"
+ aria-label={t.app.sharedMetricsTitle ?? "Help improve Hermes?"}
+ data-testid="shared-metrics-consent-banner"
+ className="flex flex-wrap items-center gap-2 border-b border-current/20 bg-current/5 px-4 py-1.5 text-xs text-midground"
+ >
+ <BarChart3 className="h-3.5 w-3.5 shrink-0" />
+ <span className="font-semibold">{t.app.sharedMetricsTitle ?? "Help improve Hermes?"}</span>
+ <span className="min-w-0 flex-1 opacity-80">
+ {failed
+ ? (t.app.sharedMetricsSaveFailed ?? "Couldn't save your choice")
+ : (t.app.sharedMetricsBody ??
+ "Shared metrics are bounded counters, never prompts, files, paths or error text. Collection stays on this machine; sending to Nous is a separate choice.")}{" "}
+ <a href={DOCS_URL} target="_blank" rel="noreferrer" className="underline">
+ {t.app.sharedMetricsDetails ?? "Details"}
+ </a>
+ </span>
+ <button type="button" disabled={saving} className={choice} onClick={() => answer(true, true)}>
+ {t.app.sharedMetricsShare ?? "Send to Nous"}
+ </button>
+ <button type="button" disabled={saving} className={choice} onClick={() => answer(true, false)}>
+ {t.app.sharedMetricsLocal ?? "Local only"}
+ </button>
+ <button type="button" disabled={saving} className={choice} onClick={() => answer(false, false)}>
+ {t.app.sharedMetricsOff ?? "No thanks"}
+ </button>
+ <button
+ type="button"
+ aria-label={t.app.dismiss ?? "Dismiss"}
+ onClick={dismiss}
+ className="shrink-0 opacity-70 hover:opacity-100"
+ >
+ <X className="h-3.5 w-3.5" />
+ </button>
+ </div>
+ );
+}
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 1c81698330e..6dbc56affd0 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -113,6 +113,14 @@ export const en: Translations = {
multiplexStandaloneBanner:
"Your gateway serves only one profile. Not served: {profiles}. Why: {reason}. Fix: hermes gateway migrate --multiplex",
dismiss: "Dismiss",
+ sharedMetricsTitle: "Help improve Hermes?",
+ sharedMetricsBody:
+ "Shared metrics are bounded counters, never prompts, files, paths or error text. Collection stays on this machine; sending to Nous is a separate choice.",
+ sharedMetricsShare: "Send to Nous",
+ sharedMetricsLocal: "Local only",
+ sharedMetricsOff: "No thanks",
+ sharedMetricsDetails: "Details",
+ sharedMetricsSaveFailed: "Couldn't save your choice",
},
status: {
diff --git a/web/src/i18n/types.ts b/web/src/i18n/types.ts
index f7fd2bd983b..da3e26318e8 100644
--- a/web/src/i18n/types.ts
+++ b/web/src/i18n/types.ts
@@ -130,6 +130,14 @@ export interface Translations {
/** Multi-profile host whose gateway boots standalone on a guard — optional, English fallback. */
multiplexStandaloneBanner?: string;
dismiss?: string;
+ /** First-run shared-metrics offer — optional, English fallback. */
+ sharedMetricsTitle?: string;
+ sharedMetricsBody?: string;
+ sharedMetricsShare?: string;
+ sharedMetricsLocal?: string;
+ sharedMetricsOff?: string;
+ sharedMetricsDetails?: string;
+ sharedMetricsSaveFailed?: string;
};
// ── Status page ──
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index 96bf20e0034..764a75ef8d1 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -133,6 +133,8 @@ const PROFILE_SCOPED_PREFIXES = [
"/api/dashboard/theme",
"/api/dashboard/font",
"/api/dashboard/plugins",
+ // The shared-metrics answer is one per profile (telemetry.shared_metrics in its config.yaml).
+ "/api/shared-metrics",
];
// The dashboard's own profile when nothing else named one. The backend injects it only
@@ -646,6 +648,17 @@ export const api = {
body: JSON.stringify(body),
},
),
+ getSharedMetricsConsent: (profile = getManagementProfile()) =>
+ fetchJSON<SharedMetricsConsent>(appendProfileParam("/api/shared-metrics/consent", profile)),
+ saveSharedMetricsConsent: (
+ answer: { enabled: boolean; send: boolean },
+ profile = getManagementProfile(),
+ ) =>
+ fetchJSON<SharedMetricsConsent>(appendProfileParam("/api/shared-metrics/consent", profile), {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(answer),
+ }),
saveConfig: (config: Record<string, unknown>, profile = getManagementProfile()) =>
fetchJSON<{ ok: boolean }>(appendProfileParam("/api/config", profile), {
method: "PUT",
@@ -1977,6 +1990,14 @@ export interface PlatformStatus {
updated_at: string;
}
+/** One profile's shared-metrics answer; `decided` is false until either key is written. */
+export interface SharedMetricsConsent {
+ enabled: boolean;
+ send: boolean;
+ decided: boolean;
+ managed: boolean;
+}
+
export interface StatusResponse {
active_sessions: number;
/** Phase 7: ``true`` when the dashboard's OAuth gate is engaged
diff --git a/website/docs/developer-guide/relay-shared-metrics.md b/website/docs/developer-guide/relay-shared-metrics.md
index c5bca3df9a1..2ae7663db81 100644
--- a/website/docs/developer-guide/relay-shared-metrics.md
+++ b/website/docs/developer-guide/relay-shared-metrics.md
@@ -572,13 +572,23 @@ telemetry:
- Like `enabled`, `send` is profile-owned and is not overridden by
managed-scope configuration.
-Both keys are asked once per profile: by the Shared Metrics section of
-`hermes setup`, or in Hermes Desktop by an offer strip above the composer
-(Send to Nous / Local only / No thanks, with a Details view). The Desktop offer
-never blocks the composer or takes focus, appears only after first-run
-onboarding, and stays until answered. A profile whose `config.yaml` already
-carries either key is never asked again on any surface. Settings › Safety ›
-Privacy & network toggles both keys later.
+Both keys are asked once per profile, with the same three answers everywhere
+(Send to Nous / Local only / No thanks):
+
+| Surface | Where the offer appears |
+| --- | --- |
+| `hermes setup` | At the end of every flow (Quick, Full, Blank Slate, Portal, `--quick`). |
+| `hermes` / `hermes --tui` | Once before an interactive chat starts. Skipped for `-q`, piped or JSON output, spawned actions and Desktop-hosted panes. |
+| Hermes Desktop | A strip above the composer, after first-run onboarding. It never blocks the composer or takes focus. |
+| Web dashboard | A banner above every page, for the profile being managed. |
+
+"No thanks" is the default in the terminal, so pressing Enter never opts
+anyone in. Esc in the terminal and the dashboard banner's ✕ leave the question
+open, so it is asked again next time. Answering on any surface writes both keys
+to the profile's `config.yaml`, and a profile that already carries either key is
+never asked again. A managed install is never offered. To change the answer
+later, use `hermes setup telemetry`, `hermes tools`, or Desktop's Settings ›
+Safety › Privacy & network.
**A package is only sent when its whole period falls inside a recorded
consent window.** Consent is stored as explicit intervals in the shared-