Merge pull request #1311 from NousResearch/hermes/hermes-315847fd

feat: seed a default global SOUL.md
This commit is contained in:
Teknium 2026-03-14 09:28:39 -07:00 committed by GitHub
commit 8d5563b3f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 141 additions and 24 deletions

View file

@ -29,6 +29,7 @@ _ENV_VAR_NAME_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")
import yaml
from hermes_cli.colors import Colors, color
from hermes_cli.default_soul import DEFAULT_SOUL_MD
# =============================================================================
@ -68,6 +69,15 @@ def _secure_file(path):
pass
def _ensure_default_soul_md(home: Path) -> None:
"""Seed a default SOUL.md into HERMES_HOME if the user doesn't have one yet."""
soul_path = home / "SOUL.md"
if soul_path.exists():
return
soul_path.write_text(DEFAULT_SOUL_MD, encoding="utf-8")
_secure_file(soul_path)
def ensure_hermes_home():
"""Ensure ~/.hermes directory structure exists with secure permissions."""
home = get_hermes_home()
@ -77,6 +87,7 @@ def ensure_hermes_home():
d = home / subdir
d.mkdir(parents=True, exist_ok=True)
_secure_dir(d)
_ensure_default_soul_md(home)
# =============================================================================
@ -879,6 +890,7 @@ def _normalize_max_turns_config(config: Dict[str, Any]) -> Dict[str, Any]:
def load_config() -> Dict[str, Any]:
"""Load configuration from ~/.hermes/config.yaml."""
import copy
ensure_hermes_home()
config_path = get_config_path()
config = copy.deepcopy(DEFAULT_CONFIG)