gemini-cli - 💡(How to fix) Fix Gemini CLI ignores existing architectural patterns and silently deletes working code

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

Title: Gemini CLI ignores existing architectural patterns and silently deletes working code

Description: Two related systematic issues observed repeatedly across sessions in a large codebase (~40,000 lines, FastAPI + LangChain + React):

1. Parallel structures instead of extending existing patterns The project has a central useChatTools hook managing tool selection, model config, and backend settings. When asked to add PDF form tool support, Gemini created a separate toolConfigStore.ts with its own state, its own toggles, and its own model config — duplicating existing state management instead of extending the established pattern.

The existing hook was explicitly provided as context and reference.

2. Silent deletion of working code During an edit to index.ts, Gemini removed 8 existing lines — imports and component registrations — without mention. These lines were unrelated to the requested change. Result: frontend crashed on load.

Expected behavior:

  • Extend existing patterns when the codebase structure is provided as context
  • Never remove lines outside the scope of the requested change
  • Flag any necessary deletions explicitly

Additional context: These issues persist even with minimal isolated examples where the full file and explicit instructions are provided. The same patterns are not observed with other models (Claude, DeepSeek) given identical context.

Impact: High — requires full manual review of every generated file, negating productivity gains.


I am no longer using Gemini CLI for production work. These issues are documented here for the benefit of other developers and the Gemini engineering team.

What did you expect to happen?

nothing

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here
</details>

Login information

No response

Anything else we need to know?

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING