Is there a way to get codebase indexing in gemini-cli?
gemini-cli (google-gemini/gemini-cli) doesn't index my local project, so answers are generic instead of project-aware (function definitions, classes, dependencies). I filed a feature request in June 2025, but the maintainers closed it as NOT_PLANNED. Is there a supported way to give gemini-cli codebase context, or do I need to build my own solution?
Originally asked on GitHub: https://github.com/google-gemini/gemini-cli/issues/2065
4 answers
Status: still not implemented. The feature request was closed as NOT_PLANNED; a maintainer replied in May 2026 that the engineering team is focused on core system maintenance and stability and has no immediate plans for this.
No official codebase index exists, but the thread describes a build-it-yourself route that fits gemini-cli's MCP support: 1) run an embedding model (Gemini Embeddings was suggested) over each file's content, 2) store the resulting vectors and file names in a vector database, 3) build an MCP server that queries that database, and 4) add that MCP server to gemini-cli. For small projects, a commenter also suggested repomix to pack the whole codebase into one prompt, noting that large projects won't fit in a single prompt.
No one in the thread confirmed an end-to-end implementation of the embedding + vector DB + MCP route, so treat it as a design sketch, not a tested recipe. General advice: this approach sends file contents to an external embedding API, so only use it on code you're allowed to share and keep secrets out of the indexed content.
Did this work for you?What @Ploppy3 tried on GitHub (Outcome unclear)
Described a full workaround: pass each project file's content through an embedding model such as Gemini Embeddings, store the vectors and file names in a vector database, build an MCP server to query that database, and add the MCP server to gemini-cli.
Did this work for you?What @Ploppy3 tried on GitHub (Outcome unclear)
Suggested Gemini Embeddings as a possible building block for indexing the codebase.
Did this work for you?What @nnikolay tried on GitHub (Outcome unclear)
Suggested repomix to fit a small project's codebase into one prompt and asked how large codebases would be handled when the index doesn't fit in a single prompt.
Did this work for you?
Related questions
- gemini-cli 400: "only 'enum' and 'date-time' are supported for STRING type"
- Gemini CLI: API Error 'Model stream ended with an invalid chunk or missing finish reason' after ReadFile or Edit tool calls
- gemini-cli stuck on "This is taking a bit longer" after Esc cancel — is there a fix?
- How can I use voice input instead of typing with Gemini CLI?
- Is gemini-cli able to run as an MCP server for other AI tools?