mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-14 13:27:38 -07:00
refactor(memory): replace MemoryManagerAgent with prompt-driven memory editing across four tiers (#25716)
This commit is contained in:
@@ -8,7 +8,10 @@ import * as fs from 'node:fs/promises';
|
||||
import * as fsSync from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { bfsFileSearch } from './bfsFileSearch.js';
|
||||
import { getAllGeminiMdFilenames } from '../tools/memoryTool.js';
|
||||
import {
|
||||
getAllGeminiMdFilenames,
|
||||
PROJECT_MEMORY_INDEX_FILENAME,
|
||||
} from '../tools/memoryTool.js';
|
||||
import type { FileDiscoveryService } from '../services/fileDiscoveryService.js';
|
||||
import { processImports } from './memoryImportProcessor.js';
|
||||
import {
|
||||
@@ -488,17 +491,34 @@ export async function getGlobalMemoryPaths(): Promise<string[]> {
|
||||
export async function getUserProjectMemoryPaths(
|
||||
projectMemoryDir: string,
|
||||
): Promise<string[]> {
|
||||
const geminiMdFilenames = getAllGeminiMdFilenames();
|
||||
const preferredMemoryPath = normalizePath(
|
||||
path.join(projectMemoryDir, PROJECT_MEMORY_INDEX_FILENAME),
|
||||
);
|
||||
|
||||
try {
|
||||
await fs.access(preferredMemoryPath, fsSync.constants.R_OK);
|
||||
debugLogger.debug(
|
||||
'[DEBUG] [MemoryDiscovery] Found user project memory index:',
|
||||
preferredMemoryPath,
|
||||
);
|
||||
return [preferredMemoryPath];
|
||||
} catch {
|
||||
// Fall back to the legacy private GEMINI.md file if the project has not
|
||||
// been migrated to MEMORY.md yet.
|
||||
}
|
||||
|
||||
const geminiMdFilenames = getAllGeminiMdFilenames();
|
||||
const accessChecks = geminiMdFilenames.map(async (filename) => {
|
||||
const memoryPath = normalizePath(path.join(projectMemoryDir, filename));
|
||||
const legacyMemoryPath = normalizePath(
|
||||
path.join(projectMemoryDir, filename),
|
||||
);
|
||||
try {
|
||||
await fs.access(memoryPath, fsSync.constants.R_OK);
|
||||
await fs.access(legacyMemoryPath, fsSync.constants.R_OK);
|
||||
debugLogger.debug(
|
||||
'[DEBUG] [MemoryDiscovery] Found user project memory file:',
|
||||
memoryPath,
|
||||
'[DEBUG] [MemoryDiscovery] Found legacy user project memory file:',
|
||||
legacyMemoryPath,
|
||||
);
|
||||
return memoryPath;
|
||||
return legacyMemoryPath;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user