Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions agent/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,9 +1466,10 @@ def build_skills_system_prompt(
Falls back to a full filesystem scan when both layers miss.

External skill directories (``skills.external_dirs`` in config.yaml) are
scanned alongside the local ``~/.hermes/skills/`` directory. External dirs
are read-only — they appear in the index but new skills are always created
in the local dir. Local skills take precedence when names collide.
scanned alongside the active local skills directory. New skills are always
created locally; existing external skills remain mutable unless
``skills.external_read_only`` is enabled. Local skills take precedence when
names collide.

``compact_categories`` (e.g. from the coding posture — see
agent/coding_context.py) demotes whole categories to a names-only line in
Expand Down Expand Up @@ -1578,8 +1579,8 @@ def build_skills_system_prompt(
)

# ── External skill directories ─────────────────────────────────────
# Scan external dirs directly (no snapshot caching — they're read-only
# and typically small). Local skills already in skills_by_category take
# Scan external dirs directly (no snapshot caching; they're typically small).
# Local skills already in skills_by_category take
# precedence: we track seen names and skip duplicates from external dirs.
seen_skill_names: set[str] = set()
for cat_skills in skills_by_category.values():
Expand Down
9 changes: 5 additions & 4 deletions agent/skill_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,11 @@ def is_external_skill_path(path) -> bool:
"""Return True when ``path`` lives under a configured external skills dir.

``skills.external_dirs`` are externally owned: Hermes can discover and view
their skills, and foreground user-directed tool calls may still edit them,
but autonomous lifecycle maintenance must treat them as read-only. This
helper centralizes the ownership boundary so curator/reporting/tool paths do
not each need to re-interpret the config.
their skills. Foreground ``skill_manage`` calls may edit them unless
``skills.external_read_only`` is enabled, while autonomous lifecycle
maintenance always treats them as read-only. This helper centralizes the
ownership boundary so curator/reporting/tool paths do not each need to
re-interpret the config.
"""
candidate = _resolve_for_skill_ownership(path)
for root in get_external_skills_dirs():
Expand Down
17 changes: 13 additions & 4 deletions cli-config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,23 @@ skills:
creation_nudge_interval: 15

# External skill directories — share skills across tools/agents without
# copying them into ~/.hermes/skills/. Each path is expanded (~ and ${VAR})
# and resolved to an absolute path. External dirs are read-only: skill
# creation always writes to ~/.hermes/skills/. Local skills take precedence
# when names collide.
# copying them into the active profile's HERMES_HOME/skills/. Each path is
# expanded (~ and ${VAR}) and resolved to an absolute path. Skill creation
# always writes to
# HERMES_HOME/skills/. Existing external skills are mutable by skill_manage by
# default, and local skills take precedence when names collide.
# external_dirs:
# - ~/.agents/skills
# - /home/shared/team-skills

# Optional skill_manage ownership boundary. When true, external skills stay
# discoverable/readable but skill_manage mutations are limited to skills and
# resolved targets under this profile's HERMES_HOME/skills/. This also blocks
# writes through local symlinks to external files. remove_file may still
# unlink the final symlink entry itself. Ordinary file/terminal tools are
# unaffected. Default: false (preserves external skill updates).
external_read_only: false

# =============================================================================
# Agent Behavior
# =============================================================================
Expand Down
9 changes: 7 additions & 2 deletions hermes_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2361,10 +2361,15 @@ 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/.
# Each path is expanded (~, ${VAR}) and resolved. Skill creation always goes
# to HERMES_HOME/skills/; existing external skills are mutable unless the
# opt-in read-only boundary below is enabled.
"skills": {
"external_dirs": [], # e.g. ["~/.agents/skills", "/shared/team-skills"]
# Restrict skill_manage mutations to resolved targets under the active
# profile's HERMES_HOME/skills/. Discovery and skill_view stay available;
# ordinary file/terminal tools are intentionally unaffected.
"external_read_only": False,
# Substitute ${HERMES_SKILL_DIR} and ${HERMES_SESSION_ID} in SKILL.md
# content with the absolute skill directory and the active session id
# before the agent sees it. Lets skill authors reference bundled
Expand Down
1 change: 1 addition & 0 deletions tests/hermes_cli/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def test_returns_defaults_when_no_file(self, tmp_path):
assert "terminal" in config
assert config["terminal"]["backend"] == "local"
assert config["display"]["interim_assistant_messages"] is True
assert config["skills"]["external_read_only"] is False

def test_legacy_root_level_max_turns_migrates_to_agent_config(self, tmp_path):
with patch.dict(os.environ, {"HERMES_HOME": str(tmp_path)}):
Expand Down
Loading
Loading