The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telemetry): feature_adoption ignores Hermes-internal curator/skill work; age read never raises (M15, m21)
teknium185c317b0a957
diff --git a/hermes_cli/observability/shared_metrics_fields.py b/hermes_cli/observability/shared_metrics_fields.pyindex f52cd3480e2..d7676110567 100644--- a/hermes_cli/observability/shared_metrics_fields.py+++ b/hermes_cli/observability/shared_metrics_fields.py@@ -14,6 +14,7 @@ from . import shared_metrics_contract as contractfrom .shared_metrics_contract import (MODEL_IDENTIFIER_MAX_LENGTH, PROVIDER_IDENTIFIER_MAX_LENGTH, _bucket, _metric_identifier, _norm,)+from .shared_metrics_signals import user_created_skill_MINUTE_MS = 60_000_SESSION_DURATION_THRESHOLDS = (@@ -188,7 +189,7 @@ _MILESTONE_RULES = {("first_mcp_tool_success", lambda d: d.get("outcome") == "success" and d.get("tool_name") == "mcp"),("first_delegation", lambda d: d.get("outcome") == "success" and d.get("tool_name") == "delegate_task"),),- contract.SKILL_LIFECYCLE_METRIC: (("first_skill_created", lambda d: d.get("action") == "created"),),+ contract.SKILL_LIFECYCLE_METRIC: (("first_skill_created", user_created_skill),),contract.SKILL_LOAD_METRIC: (("first_skill_reused", lambda d: d.get("reuse_state") == "reused"),),contract.SESSION_METRIC: (("first_long_session", _long_session),),contract.SETUP_COMPLETED_METRIC: (("setup_completed", lambda d: True),),diff --git a/hermes_cli/observability/shared_metrics_signals.py b/hermes_cli/observability/shared_metrics_signals.pyindex bc6a8b3f0d7..97b5a83322c 100644--- a/hermes_cli/observability/shared_metrics_signals.py+++ b/hermes_cli/observability/shared_metrics_signals.py@@ -62,15 +62,20 @@ def _tool(*names: str, prefix: str = "") -> Callable[[dict[str, str]], bool]:return used+def user_created_skill(d: dict[str, str]) -> bool:+ """A skill created at the user's request (``agent_created`` is Hermes' own background review)."""+ return d.get("action") == "created" and d.get("provenance") != "agent_created"++_TASK_SURFACE = {"desktop": "desktop", "tui": "tui"}# metric -> [(feature, predicate over the recorded dimensions)]. Unattended Hermes-owned work only-# counts where the user set it up (a cron job, a curator run doing real work).+# counts where the user set it up (a cron job, a curator run the user started)._FEATURE_RULES: dict[str, tuple[tuple[str, Callable[[dict[str, str]], bool]], ...]] = {contract.MEMORY_OP_METRIC: (("memory", lambda d: _success(d) and d.get("origin") == "foreground"),),- contract.SKILL_LIFECYCLE_METRIC: (("skills_created", lambda d: d.get("action") == "created"),),+ contract.SKILL_LIFECYCLE_METRIC: (("skills_created", user_created_skill),),contract.DELEGATION_RUN_METRIC: (("delegation", lambda d: True),),contract.CRON_RUN_METRIC: (("cron", lambda d: d.get("outcome") in {"success", "failed"}),),- contract.CURATOR_RUN_METRIC: (("curator", _success),),+ contract.CURATOR_RUN_METRIC: (("curator", lambda d: _success(d) and d.get("trigger") == "manual"),),contract.TASK_STARTED_METRIC: (("gateway_platform", lambda d: d.get("platform") not in {None, "none"}),("desktop", lambda d: d.get("execution_surface") == "desktop"),@@ -103,7 +108,7 @@ def days_since_install_bucket(home: Path) -> str:try:first = _first_session_started_at(home)- except sqlite3.Error:+ except (sqlite3.Error, OSError, TypeError, ValueError): # unreadable, or a non-numeric started_atreturn "unknown"age = contract._non_negative_number(time.time() - first) if first is not None else Nonereturn "unknown" if age is None else contract._bucket(age, _DAYS_SINCE_INSTALL_THRESHOLDS, "gte_90d")diff --git a/tests/hermes_cli/test_shared_metrics_signals.py b/tests/hermes_cli/test_shared_metrics_signals.pyindex e564d6025ee..000c7038b83 100644--- a/tests/hermes_cli/test_shared_metrics_signals.py+++ b/tests/hermes_cli/test_shared_metrics_signals.py@@ -104,6 +104,29 @@ def test_counter_rows_map_to_features():assert signals.features_for(contract.FEATURE_USED_MARK, {"feature": "bot_mode"}) == ("bot_mode",)+def test_hermes_internal_work_never_latches_adoption():+ from hermes_cli.observability.shared_metrics_fields import milestones_for++ curator = {"archived_bucket": "0", "created_bucket": "0", "merged_bucket": "0", "patched_bucket": "0",+ "outcome": "success"}+ assert signals.features_for(contract.CURATOR_RUN_METRIC, {**curator, "trigger": "scheduled"}) == ()+ assert signals.features_for(contract.CURATOR_RUN_METRIC, {**curator, "trigger": "manual"}) == ("curator",)+ by_review = {"action": "created", "provenance": "agent_created"} # the background-review fork+ assert signals.features_for(contract.SKILL_LIFECYCLE_METRIC, by_review) == ()+ assert milestones_for(contract.SKILL_LIFECYCLE_METRIC, by_review) == ()+ by_user = {"action": "created", "provenance": "local"}+ assert signals.features_for(contract.SKILL_LIFECYCLE_METRIC, by_user) == ("skills_created",)+ assert milestones_for(contract.SKILL_LIFECYCLE_METRIC, by_user) == ("first_skill_created",)+++def test_unreadable_first_session_reads_unknown(monkeypatch, tmp_path):+ def text_stamp(home):+ return float("yesterday")++ monkeypatch.setattr("hermes_cli.observability.shared_metrics_snapshot._first_session_started_at", text_stamp)+ assert signals.days_since_install_bucket(tmp_path) == "unknown"++@pytest.mark.parametrize(("age_s", "bucket"), [(60, "same_day"), (2 * 86_400, "1d_to_7d"), (10 * 86_400, "7d_to_30d"), (40 * 86_400, "30d_to_90d"),(200 * 86_400, "gte_90d"),diff --git a/website/docs/developer-guide/relay-shared-metrics.md b/website/docs/developer-guide/relay-shared-metrics.mdindex 53263e9cd5c..695829f1837 100644--- a/website/docs/developer-guide/relay-shared-metrics.md+++ b/website/docs/developer-guide/relay-shared-metrics.md@@ -295,7 +295,7 @@ itself ships.| Metric | Dimensions | Question it answers ||---|---|---|| `hermes.session.count` | entrypoint, surface, platform, turn/failed-turn buckets, active-duration bucket, last outcome, message / model-call / tool-call count buckets (`0` … `101_to_250`, `251_to_1000`, `gte_1001`) | How deep is real usage per surface; do sessions end right after a failure? One row per conversation, written when the surface closes it: the session ids a compression rotation hands it to merge into one row (the retired id closes as soon as its in-flight turn ends); a gateway reset, idle expiry, `/new` or `/branch` starts a new conversation even though it records the old session as its parent. Background review forks that reuse the session id add no turns, calls or messages. Messages are user turns + primary-model replies + tool results; model calls are logical primary API requests (retries excluded). |-| `hermes.install.milestone` | milestone, install age bucket | How long from install to first success, first gateway message, first cron run, first delegation, first created skill, first long session? Recorded once per install. |+| `hermes.install.milestone` | milestone, install age bucket | How long from install to first success, first gateway message, first cron run, first delegation, first created skill (one Hermes' background review created does not count), first long session? Recorded once per install. || `hermes.setup.completed` | surface (`cli`/`desktop`), provider | Which providers people choose at setup, and on which surface. || `hermes.model_tokens.sum` | call role, model, provider, auxiliary task, token type | Token volume per model/provider, prompt-cache share, and what auxiliary work (compression, titles, vision, ...) costs. The value is a token sum, not an event count. || `hermes.model_route.count` `ttft_bucket` | time to first token | Perceived latency per provider/model. |@@ -444,7 +444,7 @@ database and the count is not reported.|---|---|---|| `hermes.tool_unavailable.count` | provider, model, tool name (shipped built-ins only) | Which toolsets should be on by default: the model called a tool Hermes ships that this session did not enable. Any other unknown name (plugin, MCP, hallucinated) stays a `model_tool_quality` `unknown_tool` issue only. A built-in the session enabled but deferred behind `tool_search` (reachable through `tool_call`) is not unavailable. Background reviews, delegated children and cron jobs, whose toolsets are narrowed on purpose, are excluded. || `hermes.provider_setup.count` | provider (catalog name; custom endpoints read `custom`), surface (`cli_setup`, `cli_model`, `tui`, `desktop`, `dashboard`), event (`started`, `completed`, `failed`, `abandoned`), failure class (`auth`, `network`, `no_models`, `cancelled`, `other`; `none` unless failed) | Where connecting a provider breaks down. `started` counts once a provider is picked; the flow's end is recorded by the surface that ran it. In the CLI pickers Esc ends the flow `failed`/`cancelled`; Back (Left arrow) keeps it open, so picking the same provider again continues it (one `started`), while picking another provider or leaving the command ends it `cancelled`. A flow nobody finished leaves a local marker that the next setup start or Hermes start in the profile reports as `abandoned` (its process is gone, or it has been pending over an hour); an OAuth device code left to expire is also `abandoned`. A new or changed provider API key saved from a form (TUI/Desktop/dashboard) and a newly added custom endpoint start and complete in one action; clearing a key, re-saving the same key, editing an existing endpoint, ecosystem tokens (`GITHUB_TOKEN`, `GH_TOKEN`, `HF_TOKEN`) and keys a tool's settings panel also asks for (e.g. `GEMINI_API_KEY`, `XAI_API_KEY`, `DEEPINFRA_API_KEY`) are not counted from the generic key form. Never a key, token, base URL or error text. Leaving the provider picker before choosing one is not counted. |-| `hermes.feature_adoption.count` | feature (`memory`, `skills_created`, `delegation`, `cron`, `gateway_platform`, `desktop`, `tui`, `mcp`, `plugins`, `browser`, `voice`, `kanban`, `projects`, `bot_mode`, `curator`), days since install (`same_day`, `1d_to_7d`, `7d_to_30d`, `30d_to_90d`, `gte_90d`, `unknown`) | How long after install each major feature is first really used. Once per feature per install, latched in the local database, derived from the counters above (a foreground memory write, a created skill, a successful MCP/plugin/browser/TTS/kanban tool call, a Desktop/TUI/gateway task, a cron run, a curator run) plus direct first-use reports for Bot Mode messages and project creation. The age is the owning profile's (its first session). |+| `hermes.feature_adoption.count` | feature (`memory`, `skills_created`, `delegation`, `cron`, `gateway_platform`, `desktop`, `tui`, `mcp`, `plugins`, `browser`, `voice`, `kanban`, `projects`, `bot_mode`, `curator`), days since install (`same_day`, `1d_to_7d`, `7d_to_30d`, `30d_to_90d`, `gte_90d`, `unknown`) | How long after install each major feature is first really used. Once per feature per install, latched in the local database, derived from the counters above (a foreground memory write, a skill created at the user's request (not by Hermes' background review), a successful MCP/plugin/browser/TTS/kanban tool call, a Desktop/TUI/gateway task, a cron run, a manual curator run; the scheduled curator pass does not count) plus direct first-use reports for Bot Mode messages and project creation. The age is the owning profile's (its first session). || `hermes.feature_disabled.count` | kind (`toolset`, `skill`, `plugin`, `platform`, `setting`, `memory`, `curator`, `compression`), name, surface (`cli_tools`, `cli_config`, `cli_slash`, `tui`, `desktop`, `dashboard`), event (`disabled`, `re_enabled`) | What users turn off. Diffed at the config write itself: a default-on toolset removed, a skill or plugin added to its disabled list, a default-`true` setting set false (and each moved back). Names are public only when shipped — toolset key, bundled/catalog skill, bundled/catalog plugin (messaging-platform plugins report as `platform`), `DEFAULT_CONFIG` key path (never a value) — else `custom`. Uninstalling a catalog skill counts as `disabled`. Only user entry points record (`hermes tools` / `config` / `skills` / `plugins`, chat slash commands, TUI/Desktop, dashboard); setup and migrations do not. At most once per (kind, name, event) per day. |<!-- ---- end v5 signals ---- -->