feat: support user-installed context engine plugins via $HERMES_HOME/plugins/ - #30761
Closed
whtoo wants to merge 1 commit into
Closed
feat: support user-installed context engine plugins via $HERMES_HOME/plugins/#30761whtoo wants to merge 1 commit into
whtoo wants to merge 1 commit into
Conversation
…plugins/ Context engine plugins were previously only discoverable from plugins/context_engine/<name>/ (bundled in the source tree). This mirrored how memory providers already support user-level installation via $HERMES_HOME/plugins/<name>/. Changes: - Add _get_user_plugins_dir() helper (profile-aware) - Add _is_context_engine_dir() heuristic to filter non-engine dirs - Add _find_engine_dir() to resolve bundled vs user paths - Update discover_context_engines() to scan both directories - Update load_context_engine() to check both paths - Use isolated module namespace (_hermes_user_context_engine.*) for user-installed engines to avoid sys.modules collisions Bundled engines take precedence on name collisions. Fixes symlinks in the git source tree being nuked by git stash during 'hermes update' — users can now install context engines under $HERMES_HOME/plugins/ which is outside the git worktree.
4 tasks
Contributor
|
Thanks for the contribution. Current
This is an automated hermes-sweeper review. |
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.
Problem
Context engine plugins (
plugins/context_engine/__init__.py) only support a single discovery path:plugins/context_engine/<name>/inside the source tree. This is inconsistent with memory providers, which already scan both bundled (plugins/memory/<name>/) and user-installed ($HERMES_HOME/plugins/<name>/) directories.Practical impact: user-installed context engines that live outside the hermes-agent git worktree (e.g., development symlinks) get destroyed by
hermes updatebecausegit stash --include-untrackedpicks up untracked symlinks andgit reset --harddiscards them on stash-apply conflicts.Solution
Mirror the memory provider discovery model:
_get_user_plugins_dir()— profile-aware$HERMES_HOME/plugins/resolver_is_context_engine_dir()— cheap text-scan heuristic (looks forContextEngineorregister_context_enginein__init__.py)_find_engine_dir(name)— resolves bundled first, then user path, with bundled taking precedencediscover_context_engines()to scan both directoriesload_context_engine()to use_find_engine_dir()_hermes_user_context_engine.*) to avoidsys.modulescollisionsBehavior
_is_context_engine_dir()so non-engine plugins (memory providers, general plugins) in the same$HERMES_HOME/plugins/directory are skippedln -s /path/to/engine ~/.hermes/profiles/main/plugins/spc_ctxsurviveshermes updateFiles changed
plugins/context_engine/__init__.py