Skip to content

Native memory import ignores USER.md (Hermes adapter reads only MEMORY.md) #2306

Closed as not planned

Description

@hxyinan

Bug Description

GET /api/v1/import/hermes-native/scan and the paged import endpoints read only MEMORY.md from the Hermes memories directory. USER.md (the user-profile store that Hermes maintains next to MEMORY.md) is never imported, so user-profile content silently never reaches the MemOS L1/L2 layers on a native-memory import.

Affected code (2.0.17)

dist/server/routes/import-export.js — readHermesNativeMemories(path, opts):

async function readHermesNativeMemories(path, opts = {}) {
    const info = await stat(path);
    ...
    const raw = await readFile(path, "utf8");
    const source = {
        memories: splitHermesNativeMemories(raw),   // <-- MEMORY.md only
        bytes: info.size,
        mtimeMs: info.mtimeMs,
    };
    ...
}

Both consumers (scan at line ~315, paged import at line ~126) go through this single function, so one fix covers both. Cache correctness requires the bytes/mtimeMs fingerprint to cover USER.md too, otherwise edits to USER.md won't invalidate the cache.

Suggested fix

Read the sibling USER.md (optional, skip silently when missing) and include its entries in the same source structure:

const memories = [];
const memoryMtime = info.mtimeMs;
for (const text of splitHermesNativeMemories(await readFile(path, "utf8"))) {
    memories.push({ text, file: "MEMORY.md", mtimeMs: memoryMtime });
}
let bytes = info.size;
let mtimeMs = memoryMtime;
try {
    const userPath = join(dirname(path), "USER.md");
    const userInfo = await stat(userPath);
    const userRaw = await readFile(userPath, "utf8");
    for (const text of splitHermesNativeMemories(userRaw)) {
        memories.push({ text, file: "USER.md", mtimeMs: userInfo.mtimeMs });
    }
    bytes += userInfo.size;
    mtimeMs = Math.max(mtimeMs, userInfo.mtimeMs);
} catch { /* USER.md is optional */ }
const source = { memories, bytes, mtimeMs };

Note: this also requires dirname to be imported from node:path (2.0.17 currently imports only join).

Entries carry a file tag so the UI/dedup layer can distinguish MEMORY.md vs USER.md entries. A local patch running this exact body on 2.0.17 has been verified end-to-end (import + viewer display).

Environment

  • Plugin: @memtensor/memos-local-plugin 2.0.17
  • Agent: Hermes (Windows native)

Activity

  1. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale due to inactivity.

  2. added
    status:staleAuto-marked stale after 30d inactivity; closes 7d later unless exempt.
    on Sep 29, 2026
  3. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    This issue has been automatically closed due to inactivity.

  4. keeponlight commented on Oct 14, 2026

    @keeponlight
    Contributor

    Note: This issue was auto-closed by the stale bot while the fix in #2378 was awaiting review. #2378 has been rebased onto the latest main (cd3237c3) with all OpenCodeReview items addressed and all 1,606 plugin unit tests passing. cc @Hun-ger @syzsunshine219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:pluginOpenClaw & Hermesstatus:needs-triageNeeds initial triage | 需要初步判断 & 问题复现status:staleAuto-marked stale after 30d inactivity; closes 7d later unless exempt.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions