-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Summary
When using save_memory with scope: 'project', memories are saved to ./.llxprt/LLXPRT.md, but the memory discovery system's upward scan does not look for files in .llxprt/ subdirectories, causing project-scoped memories to not be loaded.
Root Cause
Where save_memory writes (project scope):
In packages/core/src/tools/memoryTool.ts line 120-122:
function getProjectMemoryFilePath(workingDir: string): string {
return path.join(workingDir, LLXPRT_CONFIG_DIR, getCurrentLlxprtMdFilename());
}
// Results in: ./.llxprt/LLXPRT.mdWhere memory discovery looks:
In packages/core/src/utils/memoryDiscovery.ts:
-
Global path (lines 150-154) - checks
~/.llxprt/LLXPRT.md✓ -
Upward scan (line 192):
const potentialPath = path.join(currentDir, geminiMdFilename);This looks for ./LLXPRT.md, ../LLXPRT.md, etc. - NOT ./.llxprt/LLXPRT.md
- Downward BFS search (lines 215-221) - searches subdirectories, might find
.llxprt/LLXPRT.mdbut is unreliable
The Mismatch
The upward scan looks for LLXPRT.md directly in directories, not inside .llxprt/ subdirectories. But save_memory with project scope saves to .llxprt/LLXPRT.md.
The only way project-scoped memories get found is via the BFS downward search, which might fail if:
.llxprtdirectory is being ignored (by.gitignoreor.llxprtignore)- The
maxDirslimit is reached before scanning.llxprt/ - The search starts from a subdirectory
Expected Behavior
Project-scoped memories saved to ./.llxprt/LLXPRT.md should be reliably loaded when the CLI starts.
Suggested Fix
The upward scan should also check for LLXPRT.md inside .llxprt/ directories:
// In addition to checking path.join(currentDir, geminiMdFilename)
// Also check:
const llxprtDirPath = path.join(currentDir, GEMINI_DIR, geminiMdFilename);
try {
await fs.access(llxprtDirPath, fsSync.constants.R_OK);
if (llxprtDirPath !== globalMemoryPath) {
upwardPaths.unshift(llxprtDirPath);
}
} catch {
// Not found, continue.
}Affected Files
packages/core/src/utils/memoryDiscovery.ts(lines 186-208)packages/core/src/tools/memoryTool.ts(lines 120-122)
Reproduction
- Run
save_memorywith a fact usingscope: 'project' - Verify the file is created at
./.llxprt/LLXPRT.md - Restart the CLI
- The saved memory is not loaded into context