feat(skills): add targeted skill_view retrieval - #49503
Conversation
Refs revise-repeat/siva-os#187 Co-authored-by: siva-splicer[bot] <292605095+siva-splicer[bot]@users.noreply.github.com> Generated-By: hermes/2.0 (role: Splicer; model: gpt-5.5) Agent-Session: 20260620_030045_2e35e647 Task-Reference: NousResearch#187
Refs revise-repeat/siva-os#187 Co-authored-by: siva-splicer[bot] <292605095+siva-splicer[bot]@users.noreply.github.com> Generated-By: hermes/2.0 (role: Splicer; model: gpt-5.5) Agent-Session: 20260620_030045_2e35e647 Task-Reference: NousResearch#187
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the thorough implementation and targeted tests.
Problems
tools/skills_tool.py:1030-1065deliberately omits SKILL.md sections and asks the model to retrieve them later. This conflicts with the current repository rule inAGENTS.md:111-113: instructional tools, including skills, must be read fully because models otherwise stop after the first page.tools/skills_tool.py:1098-1102adds the user-facing non-secretHERMES_SKILL_VIEW_TARGETEDbehavior flag.AGENTS.md:102-107requires behavioral settings to be configured throughconfig.yaml, not newHERMES_*environment variables._TARGETED_SKILL_REPEAT_CACHEattools/skills_tool.py:934is populated at:1766-1769without eviction, so a long-lived process retains an entry for every distinct task/skill/mode combination.
Suggested changes
- Re-scope away from partial SKILL.md retrieval unless maintainers explicitly revise the full-read contract.
- Remove the environment-variable override and avoid unbounded process-global repeat-load state.
Automated hermes-sweeper review.
| for idx, section in enumerate(sections): | ||
| if section["start"] < covered_end: | ||
| continue | ||
| include = idx == 0 or _section_is_safety_critical(section) |
There was a problem hiding this comment.
This is a lazy-reading path for an instructional document: it includes only the first/safety-matched sections and omits the rest. AGENTS.md:111-113 explicitly says skills must be read fully because models will otherwise read page 1 and skip the remainder. Please do not introduce this partial SKILL.md retrieval behavior without a maintainer-approved change to that contract.
| threshold = int(targeted_cfg.get("threshold_chars", threshold)) | ||
| except Exception: | ||
| pass | ||
| env_enabled = os.getenv("HERMES_SKILL_VIEW_TARGETED", "").strip().lower() |
There was a problem hiding this comment.
HERMES_SKILL_VIEW_TARGETED is a new user-facing non-secret behavioral flag. AGENTS.md:102-107 requires feature flags and other behavior settings to live in config.yaml; please remove this environment-variable interface.
| ) | ||
| _TARGETED_SKILL_DEFAULT_THRESHOLD = 20_000 | ||
| _TARGETED_SKILL_SECTION_LIMIT = 3_500 | ||
| _TARGETED_SKILL_REPEAT_CACHE: set[tuple[str, str, str]] = set() |
There was a problem hiding this comment.
This process-global set has no eviction path and is populated for every distinct task/skill/mode combination. Long-lived gateway processes will retain it indefinitely; use bounded or session-owned state if repeat-load metadata is retained.
|
Tested against a real production install (583 sessions / 30 days, 1,215 skill loads): my largest SKILL.md had grown to 119 KB because the This PR's brief/section retrieval is exactly the right fix at the tool layer — progressive loading would have made that kind of bloat harmless. Would love to see this merged. |
What does this PR do?
Adds a production targeted retrieval path for
skill_viewso mandatory skill loading can stay safe without flooding context on large skills.The implementation lives in the Hermes core skill tool path and supports:
mode="brief"responses with manifest plus safety-critical sections;section_slug/section_titleretrieval;full=true/mode="full"escape hatch;The intended retrieval flow is progressive: request
mode="brief"first, inspect the returned section manifest, then retrieve a specific section withsection_slugorsection_titleonly when the task needs it. This avoids loading an entire large skill solely to access one subsection, while preservingfull=true/mode="full"for cases where the complete document is required.Related Issue
Refs revise-repeat/siva-os#187
Type of Change
Changes Made
tools/skills_tool.pymode,full,section_title, andsection_slugsupport toskill_view.hermes_cli/config.pyskills.targeted_viewrollout config withenabledandthreshold_chars.cli-config.yaml.exampletests/tools/test_skills_tool.pytests/test_plugin_skills.pyHow to Test
/Users/timbeaulac/.hermes/hermes-agent/venv/bin/python -m pytest tests/tools/test_skills_tool.py tests/tools/test_skill_size_limits.py tests/tools/test_skill_view_traversal.py tests/test_plugin_skills.py -q -o 'addopts='Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A — this PR does not add a skill.
Screenshots / Logs
Scoped verification:
Live smoke savings:
Historical state DB analyzer from the linked SIVA OS worktree:
Rollout/rollback:
skills.targeted_view.enabled=trueorHERMES_SKILL_VIEW_TARGETED=1.full=trueormode="full"always returns complete content.