feat(skills): add opt-in 'compact' index_mode to shrink the skills system prompt - #24448
Open
RyanRana wants to merge 1 commit into
Open
feat(skills): add opt-in 'compact' index_mode to shrink the skills system prompt#24448RyanRana wants to merge 1 commit into
RyanRana wants to merge 1 commit into
Conversation
…pt skill list The skills system-prompt builder already ships only name + 60-char description per skill — full bodies are correctly deferred to ``skill_view(name)``. For users with many skills, even those per-skill descriptions add up: 50 skills × ~70 chars = ~3.5KB / ~900 tokens of index in every system prompt, on top of the preamble guidance. This adds an opt-in ``skills.index_mode`` setting: - ``detailed`` (default, unchanged): ``- name: description`` - ``compact``: ``- name`` only — drops per-skill descriptions and per-category descriptions. The full description is still one ``skill_view(name)`` call away. Resolution: ``HERMES_SKILLS_INDEX_MODE`` env var > ``skills.index_mode`` in config.yaml > ``detailed``. Invalid values fall back to ``detailed`` rather than producing an empty / malformed index. The mode is included in the existing skills-prompt cache key so a config change takes effect on the next build. Tests: - ``test_compact_index_mode_drops_descriptions`` — verifies per-skill and per-category descriptions are stripped while names stay. - ``test_detailed_index_mode_is_default_and_keeps_descriptions`` — guards against accidental regressions for existing users. - ``test_invalid_index_mode_falls_back_to_detailed`` — boundary check. No behavior change for any existing user (default unchanged). All 128 prompt_builder + skill_utils tests pass.
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for targeting a real prompt-budget concern. Current main has moved to a scoped names-only implementation, so this needs a design-aware salvage rather than direct application.
Problems
- The documented
HERMES_SKILLS_INDEX_MODEoverride incli-config.yaml.example:541(PR commitc0ab216b) is a new user-facing non-secret behavior variable.AGENTS.md:102-105requires behavioral settings to useconfig.yamlinstead. - The proposed helper reparses raw YAML independently, while current main already has the shared raw-config cache at
agent/skill_utils.py:322-354. - Main now renders scoped compaction through
agent/system_prompt.py:292-318andagent/prompt_builder.py:1622-1667; merged #44342 (ee1a744) intentionally chose category-scoped names-only demotion. The submitted tests exercise the environment override but not an actualskills.index_modeconfig file.
Suggested changes
- Remove the user-facing env-var path; use
config.yamlonly. - If a global mode is desired, build it atop current
compact_categories, register it inhermes_cli/config.py:2317, and test config-file and cache interactions.
Automated hermes-sweeper review.
| # 50+ skills, negligible with a handful. | ||
| # Override at runtime with HERMES_SKILLS_INDEX_MODE=compact for one-shots. | ||
| # index_mode: detailed | ||
|
|
Contributor
There was a problem hiding this comment.
Please remove the documented HERMES_SKILLS_INDEX_MODE override. AGENTS.md:102-105 requires non-secret behavioral settings to be user-facing through config.yaml; this prompt-index mode is not a credential or build-only transport setting.
1 task
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?
The skills system-prompt builder already does the right thing for full skill bodies — they're not in the prompt; only
name + 60-char descriptionper skill is, and the body is loaded on demand viaskill_view(name).But for users with many skills, even those one-line descriptions add up. With 50 skills × ~70 chars/line that's ~3.5KB / ~900 tokens of index in every system prompt, on top of the ~400-token preamble that explains how skills work.
This PR adds an opt-in
skills.index_modesetting that lets users trade per-skill description visibility (still discoverable viaskill_view(name)) for a smaller prompt:detailed(default, unchanged)- name: descriptioncompact(new)- nameDefault behavior is unchanged. Users without the setting see the exact same prompt as today.
Why this is the right shape
index_modeso a config change takes effect on the next build.HERMES_SKILLS_INDEX_MODEenv var for one-shot runs / tests, matching the pattern used elsewhere (HERMES_PLATFORM,HERMES_KANBAN_TASK).index_mode: turbo) fall back todetailedrather than producing an empty / malformed index.skill_view(name)call away — the agent's instruction block already tells it to load skills when even partially relevant.Changes Made
agent/skill_utils.py— Addsget_skills_index_mode()following the existingget_disabled_skill_names()pattern (direct config.yaml read, no extra deps).agent/prompt_builder.py— Threadsindex_modeinto the cache key and skips per-skill / per-category descriptions in the formatting step whencompact.cli-config.yaml.example— Documents the new option with a clear when-to-use note (handful of skills → leave default; 50+ → consider compact).tests/agent/test_prompt_builder.py— Three new regression tests:test_compact_index_mode_drops_descriptions— names kept, descriptions stripped.test_detailed_index_mode_is_default_and_keeps_descriptions— guards against accidental regressions.test_invalid_index_mode_falls_back_to_detailed— boundary check for bad config values.Type of Change
How to Test
Local results: 3 new + 125 existing = 128 passed, 1 skipped in the relevant suite.
Diff size
Checklist
feat(skills):)cli-config.yaml.examplewith the new config key🤖 Generated with Claude Code