fix(hermes): make mnemosyne CLI bank-aware under profile_isolation (#362)#363
Open
doziedotdev wants to merge 2 commits into
Open
fix(hermes): make mnemosyne CLI bank-aware under profile_isolation (#362)#363doziedotdev wants to merge 2 commits into
doziedotdev wants to merge 2 commits into
Conversation
The `hermes mnemosyne` CLI built its beam with a bare `BeamMemory(session_id="hermes_default")`, always binding to the default/ legacy bank. Under `profile_isolation` the provider writes to a per-profile bank (`banks/<profile>/mnemosyne.db`), so `stats`/`inspect`/`sleep`/`export` reported empty state while the real data lived in the profile bank. Resolve the active bank the same way the provider does — explicit `--bank`, else the profile bank derived from HERMES_HOME when `profile_isolation` is enabled — and build a bank-aware beam via `Mnemosyne(bank=...).beam`. Behavior is unchanged when isolation is off or no bank resolves. Fixes AxDSan#362.
AxDSan
approved these changes
Jun 23, 2026
AxDSan
left a comment
Owner
There was a problem hiding this comment.
Sorry for the delay, was IRL busy the last few days. Catching up on the board now.
LGTM, this is a clean targeted fix for issue 362.
What I verified:
_resolve_cli_bankcorrectly mirrors the provider's_resolve_profile_bankfallback: HERMES_HOME basename, isolation guard, default-bank treatment of.hermes,hermes, anddefault. Diff is small and surgical.- Explicit bank flag precedence over profile resolution is right. The
importbank argument is correctly excluded since it names the source provider, not the target. Good catch calling that out. - Backward compatible. With isolation off, no bank flag, or any resolution failure, the CLI falls through to the bare
BeamMemory(session_id="hermes_default")path. No exceptions leak. - The bank-aware path uses
Mnemosyne(session_id="hermes_default", bank=bank).beam, matching how the provider itself constructs the beam under profile_isolation. Consistent surface. - Local run:
pytest integrations/hermes/tests/→ 16 passed (including the 6 new intest_cli_bank.py). Thetest_install_status.pycollection failure is pre-existing onmain(missingfrom enum import Enumininstall.py:16), confirmed unrelated to this PR. - CI: all 6 checks green on the latest run.
Minor asks before merge:
- Please add a one-line entry under
[Unreleased]inCHANGELOG.mdnoting the CLI bank awareness under profile_isolation. A 3.10.2 PATCH bump inmnemosyne/__init__.pywould be appropriate when this lands, since this is a user-facing behavior fix in the integration layer. - The
_profile_isolation_enabledhelper re-parses config.yaml here while the provider caches its parsed config. Not blocking, but worth a follow-up to share the parser if more CLI commands grow profile awareness.
Approve. Solid fix, well-scoped test coverage. Thanks for the clear writeup.
Addresses maintainer review on AxDSan#363: - bump mnemosyne.__version__ to 3.10.2 (PATCH; user-facing fix in the hermes integration layer) and drop a stray duplicate __version__ line - add an [Unreleased] CHANGELOG entry noting hermes mnemosyne CLI bank awareness under profile_isolation (AxDSan#362, AxDSan#363)
Author
|
Thanks for the feedback @AxDSan I made the changes to both the CHANGELOG.md and the init.py files. The PR should be good to merge once you eyeball it. |
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
hermes mnemosyne <stats|inspect|sleep|export>built its beam with a bareBeamMemory(session_id="hermes_default"), which always binds to the default/legacy bank (<data_dir>/mnemosyne.db). Underprofile_isolationthe provider writes to a per-profile bank (<data_dir>/banks/<profile>/mnemosyne.db), so these commands reported empty results even when the profile bank held data.This makes the CLI resolve the active bank the same way the provider does:
--bankflag onstats,sleep,inspect,exportfor explicit targeting.--bankis given andprofile_isolationis enabled, auto-resolve the profile bank fromHERMES_HOME(mirroring the provider's_resolve_profile_bankfallback), reusingMnemosyneMemoryProvider._sanitize_bank_name.Mnemosyne(session_id="hermes_default", bank=...).beam, matching how the provider builds its own beam.import --bankis left untouched — it names the source provider bank (e.g. Hindsight), not the Mnemosyne target, so it is explicitly excluded from target resolution.Backward-compatible: with isolation off, no
--bank, or an unresolvable bank, the CLI uses the default bank exactly as before. Resolution never raises — any failure falls back to the default bank.Fixes #362.
Test plan
integrations/hermes/tests/test_cli_bank.pycovers: explicit--bank(sanitized), profile bank resolved when isolation is on, default bank when isolation is off / no config / root.hermeshome, andimport --banknot redirecting the target.pytest integrations/hermes/tests/→ 16 passed (6 new), no regressions.test_install_status.pycurrently fails to collect onmaindue to a pre-existing missingfrom enum import Enumininstall.py(class PluginState(Enum)atinstall.py:16) — unrelated to this change; excluded from the run.