feat(skills): skills.auto_load pins skills into every new session (salvage #74060/#26840) - #92048
feat(skills): skills.auto_load pins skills into every new session (salvage #74060/#26840)#92048teknium1 wants to merge 7 commits into
Conversation
…-loading - Add auto_load skill injection in agent/system_prompt.py (gated on new-session + HERMES_IGNORE_RULES) - Add resolve_auto_load_skills() and build_auto_load_prompt() to agent/skill_commands.py - Add auto_load resolution + dedup + display in cli.py - Add skills.auto_load config entry in hermes_cli/config.py - Add comprehensive tests in tests/agent/test_skills_auto_load.py - Rebased onto latest main (forwarder pattern for system_prompt)
Builds on ArcherQAQ's implementation (#26840) with two improvements: 1. Replace build_preloaded_skills_prompt + string-replace activation note with a dedicated build_auto_load_prompt() that uses _load_skill_payload directly with a purpose-built note. The string replace was fragile: if upstream note wording changes, the replace silently breaks and the CLI-specific note leaks into all sessions. 2. Replace bare 'except Exception: pass' in system_prompt injection with logger.debug so config errors are diagnosable. Also fixes stale _install_safe_stdio patch target (moved to agent.process_bootstrap) and updates test assertions for the new activation note wording.
…_IGNORE_RULES Address reviewer request to explicitly document the user-facing --ignore-rules CLI flag in the skills.auto_load section, showing its invocation and explaining how it relates to HERMES_IGNORE_RULES, --ignore-user-config, --safe-mode, and profile-scoped config.
Inspired by Cursor: custom modes / always-on pinned skills (Aug 19 2026 changelog). Salvages #74060 (itself an authorship-preserving salvage of #26840) onto current main: - main backgrounded the --skills payload load into a thread joined by finalize_preloaded_skills(); pass excluded_loaded_names=auto_load_set into the background loader and merge the activated-skills display at finalize time instead of synchronously in main() - finalize_preloaded_skills() now merges explicit --skills names into the auto_load names already shown instead of overwriting the list - drop the now-dead loaded_skills local in main() - update the three CLI-facing tests to exercise the real finalize path (join the thread, then assert display/error contract) - docs: register skills.auto_load in configuration.md alongside the cli.md section the original PR added
૮ >ﻌ< ა ci reviewran on 42f27c7 — fix(skills): adapt auto_load salvage to backgrounded --skill
|
|
Cross-reference: #68608 (open, CI green) also changes |
This salvage does the two hard things right. First, cache safety by construction: auto-load resolves once per agent lifecycle and the exact rendered bytes are reused across model switches, compression, and static-prefix restoration ( The CLI adaptation to the backgrounded Minor points:
|
Summary
skills.auto_loadinconfig.yamlnow pins skills as fully loaded at the start of every new session — CLI, TUI, gateway, cron, and API agents all included — the "always-on skill" pattern Cursor shipped as Custom Modes in its Aug 19, 2026 changelog.Salvages #74060 by @ctaylor86 (itself an authorship-preserving salvage of #26840 by @ArcherQAQ, whose feature commit leads the branch) onto current
main, adapted to the backgrounded--skillspreload that landed since.Their mechanism vs ours
--ignore-rules/HERMES_IGNORE_RULES=1suppresses auto-load with the rest of the auto-injected context. Explicit--skillsrequests dedupe against auto-load by canonical name.Changes
agent/skill_commands.py:resolve_auto_load_skills()+build_auto_load_prompt()(purpose-built activation note; same disabled-skill gate and Curator usage bump as--skills)agent/system_prompt.py: resolve-once injection in the shared prompt path (all agent surfaces), lifecycle-stableagent/agent_init.py,hermes_cli/cli_agent_setup_mixin.py: per-agent resolve-once cache, CLI hands its pre-resolved result to the lazily built agentcli.py: auto-load resolution after session-ID creation; adaptation to current main — the--skillspayload load is now a background thread joined byfinalize_preloaded_skills(), so the dedup set is passed into the background loader and the activated-skills display merges at finalize time (auto_load first)hermes_cli/config_defaults.py:skills.auto_load: []defaultwebsite/docs/user-guide/cli.md(new section from the original PR) +website/docs/user-guide/configuration.mdValidation
tests/agent/test_skills_auto_load.py+tests/cli/test_cli_preloaded_skills.pytest_system_prompt,test_prompt_builder,test_prompt_caching,test_prompt_cache_boundary,test_prompt_cache_scope)HERMES_HOME, real skill files, realbuild_system_prompt_partson a realAIAgent)HERMES_IGNORE_RULESsuppression ✓scripts/audit_pr_attribution.py --fixCloses #26840. Closes #74060.
Infographic