-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug] MEMORY.md injected twice on Windows NTFS (case-insensitive filesystem) #43931
Copy link
Copy link
Open
Description
Summary
On Windows with WSL2 where the workspace is mounted from a Windows NTFS path (e.g. D:\openclaw), the filesystem is case-insensitive. OpenClaw hardcodes two bootstrap patterns for memory:
pattern: "MEMORY.md"
pattern: "memory.md"
And in memory path resolution:
const memoryPaths = [path.join(workspaceDir, "MEMORY.md"), path.join(workspaceDir, "memory.md")];On NTFS, both paths resolve to the same physical file, so it gets injected into the system prompt twice — doubling the token cost for every session.
Environment
- OS: Windows 11 + WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)
- Workspace: Windows NTFS path bind-mounted into Docker container
- OpenClaw version: 2026.3.8 (3caab92)
Steps to Reproduce
- Deploy OpenClaw on Windows with workspace on a Windows NTFS path
- Create a
MEMORY.mdfile in the workspace - Observe
MEMORY.mdcontent appears twice in the system prompt bootstrap section
Expected Behavior
MEMORY.md injected once per session.
Actual Behavior
MEMORY.md injected twice (NTFS treats MEMORY.md and memory.md as the same file).
Impact
- ~13K extra tokens injected per session (doubles MEMORY.md bootstrap cost)
- Higher cacheWrite costs on every cold start / compaction
Suggested Fix
Deduplicate bootstrap file paths by real path before injection:
const seen = new Set();
const deduped = files.filter(f => {
try {
const real = fs.realpathSync(f.path);
if (seen.has(real)) return false;
seen.add(real);
return true;
} catch { return true; }
});Workaround
None via openclaw.json. Moving workspace to a Linux native filesystem (Docker named volume or WSL2 native path) resolves the issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.