Skip to content

feat(skills): skills.auto_load pins skills into every new session (salvage #74060/#26840) - #92048

Open
teknium1 wants to merge 7 commits into
mainfrom
cursor-inspired/skills-auto-load
Open

feat(skills): skills.auto_load pins skills into every new session (salvage #74060/#26840)#92048
teknium1 wants to merge 7 commits into
mainfrom
cursor-inspired/skills-auto-load

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

skills.auto_load in config.yaml now 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 --skills preload that landed since.

skills:
  auto_load:
    - my-workflow
    - github-pr-workflow

Their mechanism vs ours

  • Cursor: pick a skill → "Use as Mode" → the skill stays pinned in the chat, keeping the agent on a playbook.
  • Hermes: profile-scoped config list; skills are resolved once when the agent's system prompt is first built and the exact rendered bytes are reused across model switches, compression, and static-prefix restoration — so prompt caching stays intact. Missing/disabled skills warn and are skipped. --ignore-rules / HERMES_IGNORE_RULES=1 suppresses auto-load with the rest of the auto-injected context. Explicit --skills requests 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-stable
  • agent/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 agent
  • cli.py: auto-load resolution after session-ID creation; adaptation to current main — the --skills payload load is now a background thread joined by finalize_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: [] default
  • Docs: website/docs/user-guide/cli.md (new section from the original PR) + website/docs/user-guide/configuration.md

Validation

Check Result
tests/agent/test_skills_auto_load.py + tests/cli/test_cli_preloaded_skills.py 29 passed
Prompt-cache/system-prompt suites (test_system_prompt, test_prompt_builder, test_prompt_caching, test_prompt_cache_boundary, test_prompt_cache_scope) 183 passed
E2E (isolated HERMES_HOME, real skill files, real build_system_prompt_parts on a real AIAgent) injection ✓, missing-skill warning ✓, resolve-once byte stability after on-disk skill mutation ✓, HERMES_IGNORE_RULES suppression ✓
ruff on all touched files clean
scripts/audit_pr_attribution.py --fix all emails mapped

Closes #26840. Closes #74060.

Infographic

skills.auto_load — pinned skills every session

ArcherQAQ and others added 7 commits August 21, 2026 21:11
…-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
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 42f27c7 — fix(skills): adapt auto_load salvage to backgrounded --skill

⚠️ Warnings

CI timings · View report · View job

Wall time 7m39s vs 5m10s (+48.1%). 12 job(s) slower, 12 faster, 1 unchanged.

  • Python tests / Run tests slice 4/12: -42.0s
  • Python tests / Run tests slice 1/12: -40.0s
  • Python tests / Run tests slice 11/12: +39.0s
  • Python tests / Run tests slice 7/12: +35.0s
  • Docs Site / docs-site-checks: +28.0s

OSV vulnerability scan · View job

7 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard tool/skills Skills system (list, view, manage) area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) labels Aug 22, 2026
@Sora-bluesky

Copy link
Copy Markdown
Contributor

Cross-reference: #68608 (open, CI green) also changes agent/agent_init.py and agent/system_prompt.py, for an unrelated mechanism: it gates the kanban worker protocol (KANBAN_GUIDANCE) on HERMES_KANBAN_TASK instead of kanban_show tool presence, at the session-static resolution in init_agent and at the fallback in build_system_prompt_parts. The hunks sit in different regions from the skills preload here, and a merge of the two heads is clean. I will rebase #68608 once this lands.

@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

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 (_auto_load_skills_resolved + seeded result), with HERMES_IGNORE_RULES captured at first resolution so the prompt stays stable even if env changes mid-session — the system prompt remains byte-stable for the conversation's life, which is the invariant that matters most here. Second, contributor credit: authorship-preserving salvage from #74060/#26840 with the contributors email mapping included.

The CLI adaptation to the backgrounded --skills preload is also correct: pre-resolve after session creation (so ${HERMES_SESSION_ID} substitution sees the real ID), seed the agent cache so the shared prompt path doesn't re-read config, pass the canonical-name exclusion set into the background loader, and merge display names auto_load-first at finalize time. E2E validation against a real agent with real skill files, including byte stability after on-disk mutation, is the verification standard the repo asks for on context-affecting paths.

Minor points:

  1. First-turn latency on non-CLI surfaces: gateway/TUI/cron agents resolve lazily inside the first build_system_prompt_parts, so each configured skill's tree walk (~0.5s per the description for large libraries) lands inside the first turn rather than a startup phase. Probably imperceptible for 1–3 skills; worth a doc line so users with long lists know where the cost goes, and a natural follow-up would be warm-preloading where a background phase already exists (as the CLI does).
  2. Missing/disabled entries warn once per agent and skip — good failure direction; consider including whether a similarly-named skill exists in the warning to shorten the typo-debugging loop.
  3. Config edits take effect next session (resolve happens at first build) — consistent with the repo's deferred-invalidation default; no action needed, just confirming that's intended behavior worth stating in configuration.md (the new section covers usage; a one-line "picks up on next session" note would help).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/skills Skills system (list, view, manage) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants