Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions agent/skill_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,24 @@ def get_all_skills_dirs() -> List[Path]:
"""Return all skill directories: local ``~/.hermes/skills/`` first, then external.

The local dir is always first (and always included even if it doesn't exist
yet — callers handle that). External dirs follow in config order.
yet — callers handle that). If ``skills.create_dir`` is configured and
differs from the default, it is inserted second so created skills are found.
External dirs follow in config order.
"""
dirs = [get_skills_dir()]
default = get_skills_dir()
dirs: List[Path] = [default]

# Include create_dir in the read path if it differs from the default
try:
from hermes_cli.config import load_config
raw = load_config().get("skills", {}).get("create_dir", "")
if raw:
create_dir = Path(raw).expanduser().resolve()
if create_dir != default.resolve() and create_dir not in dirs:
dirs.insert(1, create_dir)
except Exception:
pass

dirs.extend(get_external_skills_dirs())
return dirs

Expand Down
3 changes: 2 additions & 1 deletion hermes_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,10 @@ def _ensure_hermes_home_managed(home: Path):

# Skills — external skill directories for sharing skills across tools/agents.
# Each path is expanded (~, ${VAR}) and resolved. Read-only — skill creation
# always goes to ~/.hermes/skills/.
# goes to ``skills.create_dir`` (default: ``~/.hermes/skills/``).
"skills": {
"external_dirs": [], # e.g. ["~/.agents/skills", "/shared/team-skills"]
"create_dir": "", # where new skills are written; empty = ~/.hermes/skills/
},

# Honcho AI-native memory -- reads ~/.honcho/config.json as single source of truth.
Expand Down
23 changes: 21 additions & 2 deletions tools/skill_manager_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,28 @@ def _security_scan_skill(skill_dir: Path) -> Optional[str]:
import yaml


# All skills live in ~/.hermes/skills/ (single source of truth)
# Default write location for new skills. Override via skills.create_dir in config.yaml.
HERMES_HOME = get_hermes_home()
SKILLS_DIR = HERMES_HOME / "skills"
_DEFAULT_SKILLS_DIR = HERMES_HOME / "skills"


def _get_skills_create_dir() -> Path:
"""Return the directory where new skills are written.

Reads ``skills.create_dir`` from config.yaml. Falls back to the default
``~/.hermes/skills/`` when unset, so existing setups are unaffected.
"""
try:
from hermes_cli.config import load_config
raw = load_config().get("skills", {}).get("create_dir", "")
if raw:
return Path(raw).expanduser().resolve()
except Exception:
pass
return _DEFAULT_SKILLS_DIR


SKILLS_DIR = _get_skills_create_dir()

MAX_NAME_LENGTH = 64
MAX_DESCRIPTION_LENGTH = 1024
Expand Down