Skip to content

fix: resolve Hermes native memory import path on Windows - #2210

Open
asorry75 wants to merge 1 commit into
MemTensor:mainfrom
asorry75:fix/hermes-native-memory-path
Open

fix: resolve Hermes native memory import path on Windows#2210
asorry75 wants to merge 1 commit into
MemTensor:mainfrom
asorry75:fix/hermes-native-memory-path

Conversation

@asorry75

@asorry75 asorry75 commented Aug 5, 2026

Copy link
Copy Markdown

Summary

On Windows, the "Import Hermes native memory" flow always reports the file as missing because hermesNativeMemoryPath() hardcodes the home directory via os.homedir():

return join(homedir(), ".hermes", "memories", "MEMORY.md");

Hermes on Windows stores its memory files under %LOCALAPPDATA%\hermes\memories\ (its HERMES_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:

  1. HERMES_HOME env var — set by Hermes at runtime on all platforms
  2. Windows: %LOCALAPPDATA%\hermes
  3. Other platforms: ~/.hermes (previous behavior, unchanged)

Test

  • Verified on Windows: GET /api/v1/import/hermes-native/scan now locates MEMORY.md.
  • Non-Windows behavior is unchanged (same fallback as before).

Related to #2221 (systemic Hermes home resolution on Windows).

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.
@Memtensor-AI Memtensor-AI added area:plugin OpenClaw & Hermes status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Aug 5, 2026
@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2210
Task: b8e53cbf77d847d9
Base: main
Head: fix/hermes-native-memory-path

OpenCodeReview: No comments generated. Looks good to me.

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

✅ Automated Test Results: PASSED

All tests passed (75/75 executed). memos_local_plugin/unit: 75/75. Duration: 4s

Branch: fix/hermes-native-memory-path

@Memtensor-AI Memtensor-AI added status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发 and removed status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Aug 5, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugin OpenClaw & Hermes status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants