feat(skills): /reload-skills slash command + skills_reload agent tool#17255
Closed
shannonsands wants to merge 5 commits into
Closed
feat(skills): /reload-skills slash command + skills_reload agent tool#17255shannonsands wants to merge 5 commits into
shannonsands wants to merge 5 commits into
Conversation
Adds a public reload path for the in-process skill caches so newly installed (or removed) skills become visible mid-session without a gateway restart. Mirrors the shape of /reload-mcp. Three surfaces: * /reload-skills slash command — CLI (cli.py) and gateway (gateway/run.py), with /reload_skills alias for Telegram autocomplete and an explicit Discord registration. * skills_reload agent tool (tools/skills_tool.py) — lets agents/subagents pick up freshly-installed skills via tool call. * agent.skill_commands.reload_skills() — shared helper that clears _skill_commands, _SKILLS_PROMPT_CACHE (in-process LRU), and the on-disk .skills_prompt_snapshot.json, then returns an added/removed diff plus the new total count. Tested: * tests/agent/test_skill_commands_reload.py (9 cases) * tests/cli/test_cli_reload_skills.py (3 cases) * tests/gateway/test_reload_skills_command.py (4 cases) Use case: NemoClaw / OpenShell-style sandboxed orchestrators that drop skills into ~/.hermes/skills mid-session, plus agentic flows where the agent itself installs a skill via the shell tool and needs it bound without a gateway restart. The Python helper clear_skills_system_prompt_cache(clear_snapshot=True) already exists internally — this PR just exposes it via slash command and tool.
13 tasks
Contributor
Author
|
Closing in favour of #17670 — this PR's branch had an unrelated #17670 is the surgical version: just The OpenShell sandbox provider work continues to live on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a public reload path for the in-process skill caches so newly installed (or removed) skills become visible mid-session without a gateway restart. The existing internal API
agent.prompt_builder.clear_skills_system_prompt_cache(clear_snapshot=True)is now exposed across three surfaces:/reload-skillsslash command — works in the CLI (cli.py) and the gateway (gateway/run.py), mirroring the shape of/reload-mcp. Includes/reload_skillsalias for Telegram autocomplete and an explicit Discord registration.skills_reloadagent tool — exposed in theskillstoolset alongsideskills_list/skill_view/skill_manageso an agent/subagent can rescan after dropping a new skill via the shell orskills_hub.agent.skill_commands.reload_skills()— shared helper used by all three callers.The helper clears every in-process skill cache:
agent.skill_commands._skill_commands(slash-command map)agent.prompt_builder._SKILLS_PROMPT_CACHE(in-process LRU)~/.hermes/.skills_prompt_snapshot.json(cross-process snapshot)…and returns a structured diff:
{ "added": ["new-skill"], # bare names, no leading slash "removed": [], "unchanged": ["..."], "total": 37, # post-rescan skill count "commands": 37, # /slash-skill count }When the diff is non-empty, both the CLI and gateway append a short
[IMPORTANT: Skills have been reloaded …]note to the end of the conversation history so the model sees the change on its next turn (same pattern/reload-mcpuses).Related Issue
Aligns with #15626 (plugin reload — same shape, different subsystem) and addresses the runtime cache-staleness called out in #14535 / #14536. No specific skill-reload issue exists yet; happy to file one and link, or fold it under one of the above if a maintainer prefers.
Type of Change
Changes Made
agent/skill_commands.pyreload_skills()helpertools/skills_tool.pyskills_reloadagent tool +SKILLS_RELOAD_SCHEMAcli.py_reload_skillsmethod +/reload-skillsdispatchgateway/run.py_handle_reload_skills_command+ dispatcher entrygateway/platforms/discord.pyhermes_cli/commands.pyCommandDef("reload-skills", …)toolsets.pyskills_reloadto theskillstoolset (4 enumerations)tests/agent/test_skill_commands_reload.pytests/cli/test_cli_reload_skills.pytests/gateway/test_reload_skills_command.pyTotal: +682 / -4 across 10 files.
How to Test
Manual
The same flow works inside the gateway (Telegram, Discord, Slack, etc.). For agentic flows, the model can call the new
skills_reloadtool directly after installing a skill.Automated
pytest tests/agent/test_skill_commands_reload.py \ tests/cli/test_cli_reload_skills.py \ tests/gateway/test_reload_skills_command.py -q # 16 passedSurrounding regressions (skills tooling, prompt builder, command registry, gateway slash dispatch) all green:
pytest tests/agent/test_skill_commands_reload.py \ tests/agent/test_skill_commands.py \ tests/agent/test_prompt_builder.py \ tests/cli/test_cli_reload_skills.py \ tests/gateway/test_reload_skills_command.py \ tests/tools/test_skills_tool.py \ tests/skills/ \ tests/hermes_cli/test_commands.py \ tests/gateway/test_unknown_command.py -q # 527 passed, 1 skippedChecklist
Code
pytest tests/ -qfor the touched areas — green (527 passed across surrounding files)Documentation & Housekeeping
/helpvia the existingCommandDefregistry)cli-config.yaml.exampleif config keys changed — N/ACONTRIBUTING.mdorAGENTS.mdif architecture changed — N/Askills_reloadschema added; existing tools unchangedBackground — why this matters
We're integrating Hermes into a sandboxed orchestrator (NemoClaw-style). When the orchestrator drops a freshly-installed skill into
~/.hermes/skills/mid-session, Hermes can't see it until restart. The internalclear_skills_system_prompt_cache(clear_snapshot=True)already does the right thing — this PR just wires it to a slash command (so users can invoke it) and an agent tool (so agents that just installed a skill via shell can pick it up themselves, closing the agentic-install catch-22 also raised in #15626).