gemini-cli
gemini-cli copied to clipboard
[JITContext] Refactor Memory Discovery for JIT Loading
Description
Modify the existing memory discovery logic to support a non-recursive mode that only loads Tier 1 (Global) and Tier 2 (Project Root + Extensions) memory when the feature flag is enabled.
Acceptance Criteria
- [ ]
loadServerHierarchicalMemoryaccepts anexperimentalJitContextflag. - [ ] When the flag is
true,loadServerHierarchicalMemoryskips the recursivebfsFileSearch. - [ ] When the flag is
true, it still correctly finds and loads the GlobalGEMINI.mdand the Project RootGEMINI.md. - [ ]
loadServerHierarchicalMemoryreturns a structured result containingglobalMemory,environmentMemory, and initialloadedPaths. - [ ] The CLI's
loadCliConfigcorrectly passes the feature flag and handles the structured response to populate theConfigobject. - [ ] Legacy behavior (recursive search) is preserved when the flag is
false.
Technical Details
-
Modify
packages/core/src/utils/memoryDiscovery.ts:- Update
loadServerHierarchicalMemorysignature and return type. - In
getGeminiMdFilePathsInternalForEachDir, conditionally bypassbfsFileSearchbased on the flag.
- Update
-
Modify
packages/cli/src/config/config.ts:- Update
loadHierarchicalGeminiMemoryto pass the flag. - Update
loadCliConfigto read the flag from settings and use the new structured response fromloadHierarchicalGeminiMemory.
- Update