fix: resolve Hermes native memory import path on Windows - #2210
Open
asorry75 wants to merge 1 commit into
Open
Conversation
hermesNativeMemoryPath() hardcodes ~/.hermes/memories/MEMORY.md via os.homedir(). On Windows, Hermes stores memories under %LOCALAPPDATA%\hermes\memories (HERMES_HOME), so the import scan always reports not found and the viewer UI cannot correct it because the path is not editable. Resolve the Hermes home directory in order: 1. HERMES_HOME env var (set by Hermes at runtime) 2. Windows: %LOCALAPPDATA%\hermes 3. Other platforms: ~/.hermes (previous behavior, unchanged) Verified on Windows: import scan now locates MEMORY.md.
Collaborator
🤖 Open Code ReviewTarget: PR #2210 ✅ OpenCodeReview: No comments generated. Looks good to me. Generated by cloud-assistant via Open Code Review. |
Collaborator
✅ Automated Test Results: PASSEDAll tests passed (75/75 executed). memos_local_plugin/unit: 75/75. Duration: 4s Branch: |
5 tasks
Memtensor-AI
pushed a commit
to Memtensor-AI/MemOS
that referenced
this pull request
Aug 5, 2026
…r#2221) The memos-local-plugin resolved the Hermes home as ~/.hermes in several places, while Hermes itself uses %LOCALAPPDATA%\hermes on Windows (HERMES_HOME). The plugin's runtime data, PID files, and native import sources therefore landed outside Hermes' real home on Windows: install config never reached the daemon (MemTensor#2211), native memory import missed MEMORY.md (MemTensor#2210), hermes backup could skip plugin state, and host and plugin tooling disagreed on where the data lived. Add a single canonical Hermes-home resolver on each language side that mirrors Hermes' own _get_platform_default_hermes_home: - Python: adapters/hermes/memos_provider/hermes_home.py - TypeScript: core/config/hermes-home.ts Resolution: HERMES_HOME env -> %LOCALAPPDATA%\hermes on win32 (with ~/AppData/Local/hermes fallback) -> ~/.hermes elsewhere. All hard-coded sites now route through it: the Python provider fallback + child-session lookup, the bridge_client runtime home, both bridge.cts/bridge.mts pidFilePath resolvers, core/config/paths.ts resolveHome (hermes default), and the migrate + import-export server routes. Non-Hermes agents (openclaw, custom) keep the ~/.<agent>/memos-plugin convention. MEMOS_HOME / MEMOS_CONFIG_FILE still win over HERMES_HOME. Tests: added tests/python/test_hermes_home.py (8 tests) and tests/unit/config/hermes-home.test.ts (6 tests) covering all four resolver branches plus the Python provider / bridge_client integration paths. Extended tests/unit/config/paths.test.ts with a resolveHome("hermes") + HERMES_HOME regression assertion. Full Python suite (109) and full vitest suite (1274) pass; tsc --noEmit clean.
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
On Windows, the "Import Hermes native memory" flow always reports the file as missing because
hermesNativeMemoryPath()hardcodes the home directory viaos.homedir():Hermes on Windows stores its memory files under
%LOCALAPPDATA%\hermes\memories\(itsHERMES_HOME), not~/.hermes. The viewer UI shows the resolved path and offers no way to edit it, so the import is unusable on Windows.Changes
Resolve the Hermes home directory in order:
HERMES_HOMEenv var — set by Hermes at runtime on all platforms%LOCALAPPDATA%\hermes~/.hermes(previous behavior, unchanged)Test
GET /api/v1/import/hermes-native/scannow locatesMEMORY.md.Related to #2221 (systemic Hermes home resolution on Windows).