Skip to content

fix(gateway): include external_dirs skills in Telegram/Discord slash command registration#8790

Closed
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/telegram-external-skills-registration
Closed

fix(gateway): include external_dirs skills in Telegram/Discord slash command registration#8790
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/telegram-external-skills-registration

Conversation

@luyao618

Copy link
Copy Markdown
Contributor

What does this PR do?

Skills configured via skills.external_dirs in config.yaml were visible in CLI (hermes skills list) and usable by the agent, but silently excluded from Telegram and Discord slash command menus. Users who organized skills in external directories could not invoke them via /slash-commands on gateway platforms.

The root cause is in _collect_gateway_skill_entries() (hermes_cli/commands.py): it filtered skills by checking skill_path.startswith(_skills_dir) where _skills_dir is only ~/.hermes/skills/. External skills have paths outside this prefix (e.g. ~/my-skills/morning-briefing/SKILL.md), so they were dropped by the continue statement. Meanwhile, scan_skill_commands() correctly scans both local and external directories — the inconsistency was only in the gateway registration path.

This PR widens the allowed-prefix set to include all configured external directories alongside the local skills dir. It also:

  • Enforces trailing / on all directory prefixes to prevent false-positive matches when one directory name is a prefix of another (e.g. /my-skills vs /my-skills-extra)
  • Skips entries with empty skill_md_path to avoid accidental matches

Related Issue

Fixes #8110

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • hermes_cli/commands.py: Import get_external_skills_dirs, build _allowed_prefixes from SKILLS_DIR + external dirs (all slash-terminated), replace single startswith(_skills_dir) with any(startswith(prefix) for prefix in _allowed_prefixes), add empty-path guard, slash-terminate _hub_dir for consistency
  • tests/hermes_cli/test_gateway_external_skills.py (new): 7 test cases covering external skill inclusion, local-only behavior, hub exclusion, path-prefix boundary safety, multiple external dirs, empty skill_md_path handling, and hub-sibling directory boundary

How to Test

  1. pytest tests/hermes_cli/test_gateway_external_skills.py -v — all 7 tests pass
  2. pytest tests/ -q — full suite passes (pre-existing env-dependent failures are unrelated)
  3. Manual verification:
    • Configure skills.external_dirs in ~/.hermes/config.yaml pointing to a directory with a valid SKILL.md
    • Confirm hermes skills list shows the external skill
    • Start a Telegram gateway — the external skill should now appear in the slash command menu (getMyCommands)

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 (Apple Silicon)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

@luyao618 luyao618 force-pushed the fix/telegram-external-skills-registration branch from d23bee2 to a2e86ec Compare April 24, 2026 17:05
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard tool/skills Skills system (list, view, manage) platform/telegram Telegram bot adapter platform/discord Discord bot adapter labels Apr 24, 2026
@luyao618 luyao618 force-pushed the fix/telegram-external-skills-registration branch from a2e86ec to c2d35c2 Compare April 28, 2026 16:06
…command registration

Skills configured via skills.external_dirs in config.yaml were visible in
CLI and agent but silently excluded from Telegram/Discord slash command
menus. The path filter in _collect_gateway_skill_entries() only accepted
skills under SKILLS_DIR (~/.hermes/skills/), dropping any skill whose
path did not start with that prefix.

Widen the allowed-prefix set to include all configured external
directories. Also enforce trailing "/" on every prefix to prevent
false-positive matches when one directory name is a prefix of another
(e.g. /my-skills vs /my-skills-extra), and skip entries with empty
skill_md_path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@teknium1

teknium1 commented May 2, 2026

Copy link
Copy Markdown
Contributor

Salvaged as #18741 with you as co-author — the fix was correct and applied cleanly. Thanks for the path-prefix boundary handling and the 7-test coverage.

teknium1 added a commit that referenced this pull request May 2, 2026
…commands (#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes #8110

Salvages #8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
nickdlkk pushed a commit to nickdlkk/hermes-agent that referenced this pull request May 11, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
…commands (NousResearch#18741)

Skills configured through `skills.external_dirs` in config.yaml were
visible via `hermes skills list`, `get_skill_commands()`, and the
agent's `/skill-name` dispatch, but silently excluded from the
Telegram and Discord slash-command menus. The filter in
`_collect_gateway_skill_entries` only accepted skills whose
`skill_md_path` started with `SKILLS_DIR`, so anything under an
external directory fell through.

Widen the accepted-prefix set to include all configured external
dirs alongside the local skills dir. Every prefix is now
slash-terminated so `/my-skills` cannot also admit
`/my-skills-extra`. Also guard against empty `skill_md_path`
values so they can't accidentally match.

Fixes NousResearch#8110

Salvages NousResearch#8790 by luyao618.

Co-authored-by: Yao <34041715+luyao618@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter platform/telegram Telegram bot adapter tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Telegram slash command registration excludes external skills from skills.external_dirs

3 participants