gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

[JITContext] Refactor Memory Discovery for JIT Loading

Open abhipatel12 opened this issue 5 months ago • 0 comments

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

  • [ ] loadServerHierarchicalMemory accepts an experimentalJitContext flag.
  • [ ] When the flag is true, loadServerHierarchicalMemory skips the recursive bfsFileSearch.
  • [ ] When the flag is true, it still correctly finds and loads the Global GEMINI.md and the Project Root GEMINI.md.
  • [ ] loadServerHierarchicalMemory returns a structured result containing globalMemory, environmentMemory, and initial loadedPaths.
  • [ ] The CLI's loadCliConfig correctly passes the feature flag and handles the structured response to populate the Config object.
  • [ ] Legacy behavior (recursive search) is preserved when the flag is false.

Technical Details

  • Modify packages/core/src/utils/memoryDiscovery.ts:
    • Update loadServerHierarchicalMemory signature and return type.
    • In getGeminiMdFilePathsInternalForEachDir, conditionally bypass bfsFileSearch based on the flag.
  • Modify packages/cli/src/config/config.ts:
    • Update loadHierarchicalGeminiMemory to pass the flag.
    • Update loadCliConfig to read the flag from settings and use the new structured response from loadHierarchicalGeminiMemory.

abhipatel12 avatar Oct 24 '25 20:10 abhipatel12