Gemini CLI Kept Forgetting My Model. So I Fixed It!
Gemini CLI forgets which model you picked the moment you restart it, and after enough restarts that gets old fast. I fixed it, and the fix is merged into Google's official google-gemini/gemini-cli, which sits at 100K+ GitHub stars.
The bug wasn't a secret. Someone had already tried working around it by hand-editing ~/.gemini/settings.json, only to find there was no code path reading that preference back in, and a handful of other issues reported the exact same problem independently. The feature simply didn't exist yet.
My first draft solved it with a confirmation prompt: "Save this for future sessions?" The maintainer wanted something quieter: save the choice the instant you make it, since nobody wants to answer a yes-or-no question every time they switch models. That's what shipped. Pick a model, and the CLI remembers it, with the --model flag and environment variable still able to override it when you need them to.
Landing it took twelve commits, most of them fighting cross-platform test failures (my mocks passed on my machine and broke on the Mac and Linux CI runners) and a rebase around a concurrent Gemini 3 Flash release. When it merged, the maintainer's reply left me a little starstruck:

It's my first merged PR into this repo. Contributing to a Google project has been a dream of mine for a while, and this made it real.
Resources
- Pull Request: google-gemini/gemini-cli#13199
- LinkedIn post: View the post