feat: Lazy skill loading — skills.loading config option - #12379
Open
downwind7clawd-ctrl wants to merge 1 commit into
Open
feat: Lazy skill loading — skills.loading config option#12379downwind7clawd-ctrl wants to merge 1 commit into
downwind7clawd-ctrl wants to merge 1 commit into
Conversation
When skills.loading is set to 'lazy' in config.yaml, the full skill listing is omitted from the system prompt. Instead, a short hint tells the agent to call skills_list() on demand, then load relevant skills with skill_view(name). This saves ~1,500-2,000 system-prompt tokens per turn when many skills are installed — especially beneficial for messaging platform users who pay per-token through API proxies without prompt caching. Changes: - hermes_cli/config.py: add skills.loading default 'eager' - agent/prompt_builder.py: add lazy parameter + on-demand hint - run_agent.py: read config and pass lazy flag to prompt builder Closes NousResearch#2045
wilsonchengassistant
approved these changes
Apr 19, 2026
wilsonchengassistant
left a comment
There was a problem hiding this comment.
Hermes Agent 程式碼審核\n\n### 總結\n此 PR 實施了延遲載入技能的功能,符合 #2045 的提案。程式碼乾淨,邏輯清晰,預期能節省系統提示的 token 消耗。\n\n### 優點\n- ✅ 配置選項設計良好,預設為 'eager' 保持向後相容。\n- ✅ 在 lazy 模式下提供明確的提示,引導代理使用 skills_list()。\n- ✅ 變更最小,只影響提示建構和配置讀取。\n\n### 建議\n- 在 tests/agent/test_prompt_builder.py 中新增單元測試,驗證 lazy 模式下提示字串的生成(例如檢查是否包含 'skills_list()' 提示)。\n- 考慮在 README 或文件更新中提及此新配置選項。\n\n### 結論\nLGTM!批准合併。\n\n---\n由 Hermes Agent 審核
4 tasks
Collaborator
This was referenced Apr 30, 2026
4 tasks
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for targeting a real prompt-size cost.
Problems
agent/prompt_builder.py:609removes the catalog entirely. Current main deliberately preserves every skill name even when it compacts descriptions (agent/prompt_builder.py:1464-1468), and the regression test explains why: models do not reliably rediscover skills throughskills_listafter the index goes quiet (tests/agent/test_prompt_builder.py:429-455).- The patch has no regression coverage for either config mode.
- The integration points have moved: current prompt assembly is
agent/system_prompt.py:314-318, and skill config initialization isagent/agent_init.py:1423-1428(introduced by2d2cd5e904).
Suggested changes
- Please get maintainer direction on the discoverability trade-off before salvage; the analogous proposal #19174 was closed on this design concern.
- If the direction is approved, implement it at the current integration points and add eager/lazy prompt-builder coverage.
Automated hermes-sweeper review.
| @@ -604,6 +609,17 @@ def build_skills_system_prompt( | |||
| if not skills_dir.exists() and not external_dirs: | |||
Contributor
There was a problem hiding this comment.
This removes every skill name from the initial prompt. Current main intentionally keeps all names visible even in compact mode because tests/agent/test_prompt_builder.py:429-455 documents that models do not reliably rediscover skills after the index goes quiet. Please resolve that discoverability contract before adopting this branch.
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.
Summary
Implements lazy skill loading as proposed in #2045.
Problem
When many skills are installed, all skill names + descriptions are injected into
<available_skills>in the system prompt at every session start. With 87 bundled skills, this block alone consumes ~1,500–2,000 tokens — re-sent with every API call. For messaging platform users (Discord/Telegram) paying per-token through proxies without prompt caching, this adds up fast.Solution
Add a
skills.loadingconfig option:When
lazy:skills_list()on demandskill_view(name)as normal after discovering relevant skillsWhen
eager(default):Changes (3 files, +21 lines)
hermes_cli/config.pyskills.loading: "eager"defaultagent/prompt_builder.pylazyparam + on-demand hint branchrun_agent.pylazyflag to prompt builderToken savings estimate
Closes #2045