Skip to content

The agent that grows with you

fix(personality): honour the top-level `personalities:` config block on every surface

teknium144ce128a2710
diff --git a/hermes_cli/personality.py b/hermes_cli/personality.py
index 9d0a7a79950..e2dc1631255 100644
--- a/hermes_cli/personality.py
+++ b/hermes_cli/personality.py
@@ -3,6 +3,8 @@
* ``display.personality`` holds the selected NAME (empty = no overlay).
* ``agent.system_prompt`` is the user-owned manual overlay; personality code never writes it.
* ``agent.personalities`` holds user-defined/overridden personalities, overlaying built-ins by name.
+ The schema also exposes a top-level ``personalities:`` block (the original #643 shape); both are
+ honoured, ``agent.personalities`` winning on a name clash.
"""
from __future__ import annotations
@@ -82,10 +84,12 @@ def normalize_personality_name(value: Any) -> str:
def available_personalities(cfg: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
- """Built-ins overlaid by the user's ``agent.personalities`` (user wins)."""
+ """Built-ins overlaid by the user's personalities: root ``personalities`` then
+ ``agent.personalities`` (later wins). Root entries were silently ignored (#9636)."""
merged: Dict[str, Any] = dict(BUILTIN_PERSONALITIES)
- user = _get(cfg, "agent", "personalities", default={})
- if isinstance(user, dict):
+ for user in (_get(cfg, "personalities", default={}), _get(cfg, "agent", "personalities", default={})):
+ if not isinstance(user, dict):
+ continue
for name, definition in user.items():
key = str(name).strip().lower()
if key and key not in NEUTRAL_PERSONALITY_NAMES:
diff --git a/tests/hermes_cli/test_personality_single_owner.py b/tests/hermes_cli/test_personality_single_owner.py
index 1281099e148..778ea289e88 100644
--- a/tests/hermes_cli/test_personality_single_owner.py
+++ b/tests/hermes_cli/test_personality_single_owner.py
@@ -50,6 +50,17 @@ def test_user_entries_overlay_builtins_by_name():
assert merged["custom"] == "hi"
+def test_root_level_personalities_are_honoured_below_agent_block():
+ """config.yaml's top-level ``personalities:`` (the shape DEFAULT_CONFIG ships) must be
+ visible on every surface; ``agent.personalities`` wins on a clash (#9636)."""
+ cfg = {"personalities": {"robot": "root", "shared": "root"},
+ "agent": {"personalities": {"shared": "agent"}}}
+ merged = available_personalities(cfg)
+ assert merged["robot"] == "root"
+ assert merged["shared"] == "agent"
+ assert resolve_personality("robot", cfg)[0] == "robot"
+
+
def test_neutral_names_normalize_to_empty():
for raw in ("", "none", "None", " DEFAULT ", "neutral", None):
assert normalize_personality_name(raw) == ""
diff --git a/website/docs/user-guide/features/personality.md b/website/docs/user-guide/features/personality.md
index 1cb64ac7b23..e8b2beb01ed 100644
--- a/website/docs/user-guide/features/personality.md
+++ b/website/docs/user-guide/features/personality.md
@@ -211,7 +211,7 @@ These are convenient overlays, but your global `SOUL.md` still gives Hermes its
## Custom personalities in config
-Built-in personalities are always available on every surface (CLI, messaging platforms, TUI, and the desktop app). You can add your own — or override a built-in by reusing its name — in `~/.hermes/config.yaml` under `agent.personalities`.
+Built-in personalities are always available on every surface (CLI, messaging platforms, TUI, and the desktop app). You can add your own — or override a built-in by reusing its name — in `~/.hermes/config.yaml` under `agent.personalities` (a top-level `personalities:` block works too; `agent.personalities` wins if the same name appears in both).
```yaml
agent: