fix(acp): preload startup skills from --skills - #30560
Open
lsaether wants to merge 1 commit into
Open
Conversation
Collaborator
19 tasks
briandevans
added a commit
to briandevans/hermes-agent
that referenced
this pull request
Jun 2, 2026
…Research#30571) `hermes -p <profile> acp` already set `HERMES_HOME` via the top-level profile override, but ACP-created sessions could not see the canonical profile name (HERMES_PROFILE was never published) and `hermes-acp -p <profile>` direct invocations — used by editor configs like Zed agent commands — had no `--profile` flag at all. This change plumbs profile activation through both entrypoints: 1. `hermes_cli.main._apply_profile_override` now also publishes `HERMES_PROFILE` (canonical, setdefault-only so a shell-set value wins). Downstream callers that branch on profile name (kanban, gateway adapters, ACP entry) can read it without re-parsing `HERMES_HOME`. 2. `acp_adapter.entry` gains a `--profile/-p` argument that runs `resolve_profile_env` before `_load_env`, so direct `hermes-acp -p code-reviewer` invocations land in the same profile environment as `hermes -p code-reviewer acp`. 3. `hermes_cli.main.cmd_acp` forwards the active profile to `acp_main` via argv, keeping the two invocation paths consistent. Mirrors lsaether's `--skills` plumbing pattern in PR NousResearch#30560 so the two follow-ups land cleanly side by side. Tests cover: both entrypoints set HERMES_HOME + HERMES_PROFILE before `_load_env`; `-p` is equivalent to `--profile`; `--check` short-circuit still honours `--profile`; missing `--profile` leaves inherited env untouched; unknown profile name exits cleanly; explicit `HERMES_PROFILE` from the spawning shell is preserved.
NakePranob
pushed a commit
to NakePranob/hermes-agent
that referenced
this pull request
Jul 3, 2026
…Research#30571) `hermes -p <profile> acp` already set `HERMES_HOME` via the top-level profile override, but ACP-created sessions could not see the canonical profile name (HERMES_PROFILE was never published) and `hermes-acp -p <profile>` direct invocations — used by editor configs like Zed agent commands — had no `--profile` flag at all. This change plumbs profile activation through both entrypoints: 1. `hermes_cli.main._apply_profile_override` now also publishes `HERMES_PROFILE` (canonical, setdefault-only so a shell-set value wins). Downstream callers that branch on profile name (kanban, gateway adapters, ACP entry) can read it without re-parsing `HERMES_HOME`. 2. `acp_adapter.entry` gains a `--profile/-p` argument that runs `resolve_profile_env` before `_load_env`, so direct `hermes-acp -p code-reviewer` invocations land in the same profile environment as `hermes -p code-reviewer acp`. 3. `hermes_cli.main.cmd_acp` forwards the active profile to `acp_main` via argv, keeping the two invocation paths consistent. Mirrors lsaether's `--skills` plumbing pattern in PR NousResearch#30560 so the two follow-ups land cleanly side by side. Tests cover: both entrypoints set HERMES_HOME + HERMES_PROFILE before `_load_env`; `-p` is equivalent to `--profile`; `--check` short-circuit still honours `--profile`; missing `--profile` leaves inherited env untouched; unknown profile name exits cleanly; explicit `HERMES_PROFILE` from the spawning shell is preserved.
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for tracing the full CLI → ACP-session path. The underlying defect is still present on current main: cmd_acp drops args.skills at hermes_cli/main.py:12720-12731, acp_adapter/entry.py:260 creates an unconfigured agent, and SessionManager._make_agent has no preload path at acp_adapter/session.py:617-645.
Problems
- The new
ephemeral_system_promptpath would be omitted from ACP's context indicator.acp_adapter/server.py:683-686estimates usage from_cached_system_prompt, but the actual request appendsephemeral_system_promptatagent/conversation_loop.py:852-856. A large preloaded skill would therefore under-report the session's used context.
Suggested changes
- Include
ephemeral_system_promptin_build_usage_update()'s effective system prompt and add a regression test covering a preloaded skill.
Automated hermes-sweeper review.
| if missing_skills: | ||
| raise ValueError(f"Unknown skill(s): {', '.join(missing_skills)}") | ||
| if skills_prompt: | ||
| existing_prompt = kwargs.get("ephemeral_system_prompt") or "" |
Contributor
There was a problem hiding this comment.
ephemeral_system_prompt is sent on every request, but ACP usage estimation currently counts only _cached_system_prompt (acp_adapter/server.py:683-686). Please update that estimator and add coverage so startup-skill tokens are reflected in the ACP context indicator.
This was referenced Jul 28, 2026
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
Fixes the ACP startup path so global
--skills/-sflags are honored when launching Hermes as an ACP server.Before this change,
hermes -s <skill> acpparsed the requested startup skills in the top-level CLI, but dropped them beforeacp_adapter.entry.main()and ACP session creation. ACP could still discover/load skills later, but the explicitly requested startup skills were not preloaded into the session context.This PR threads startup skills through the ACP stack and applies them to each ACP-created agent session:
args.skillsfromhermes_cli/main.pyintoacp_adapter.entry.main(...)skills=in ACP entry andHermesACPAgentSessionManagerbuild_preloaded_skills_prompt(...)during ACP session agent constructionAIAgent(ephemeral_system_prompt=...)Unknown skill(s): ...errors instead of silently ignoring themWhy
Issue #24466 reports that:
silently starts ACP mode without preloading the requested skill. That differs from chat mode, where
--skillsis forwarded into session startup and becomes active before the model's first response.ACP sessions are created after the stdio server starts, so the fix keeps the requested startup skills in ACP server/session-manager state and applies them when each ACP session constructs its
AIAgent.Implementation notes
SessionManagerinitialization.ephemeral_system_promptrather thanprefill_messages, so the skill instructions are session guidance rather than persisted/user-visible conversation messages.How to test
Focused and regression coverage added for the CLI, ACP entry/server/session layers, and the full ACP startup-skill path.
Run:
Local results:
146 passedfor the targeted CLI/ACP/preloaded-skill regression set301 passedfortests/acpandtests/acp_adaptergit diff --checkpassedpython -m hermes_cli.main -s hermes-agent acp --checkpassed under the Hermes dev environmentManual interactive editor smoke test: not run. The ACP behavior is covered through unit/integration tests that assert the CLI-provided startup skills reach ACP session agent construction and are injected as an ephemeral system prompt.
Platforms tested
Cross-platform impact should be low: this is Python argument/session plumbing and prompt construction only. It does not add filesystem, process-management, shell, path, or dependency changes.
Related issue
Closes #24466
Scope
This PR only fixes startup skill propagation for ACP. It does not change skill discovery, skill installation, ACP protocol framing, editor configuration, or runtime
/skillbehavior.