Forcing Analysis Mode in Gemini CLI with Pseudo Code

December 10, 2025 Wietse Venema

I've been using the Gemini CLI (specifically with Gemini 3 Pro) heavily for my daily coding tasks. While it's powerful, I found it can sometimes jump into coding a bit too fast.

When I want to discuss a complex refactoring or a tricky logic change, I often start by explaining the goal. In many cases, the CLI fires up a tool call to start editing before I can finish my thoughts and explore edge cases.

I used to handle this by cancelling the tool calls and repeatedly telling it to "continue PLANNING with me." This adds friction and pollutes the context window with failed attempts and corrections.

Using Annotated Pseudo Code

Recently, I've been using a way to prevent this behavior: force the model into an "analysis mode" first using annotated pseudo code.

Here is an example of a prompt I used today:

"In @file.py, read the find_entity logic, and describe how it works to me, in annotated pseudo code."

By asking for a description in annotated pseudo code, I effectively disable the implementation reflex. The model seems to switch from "how do I change this?" to "how does this work?", which is exactly what I want for the planning phase.

What It Looks Like

Here is an example of the output this prompt generates. It's concise, readable pseudo code, just like in textbooks:

FUNCTION scan_container(container_items, current_path):
  FOR EACH item_id, item IN container_items:
    # A. Attribute Filter (Optional)
    # If we are looking for a specific type (e.g., must have "destination" for exits),
    # skip items that don't have it.
    IF required_attributes AND item MISSING attributes:
      CONTINUE

    # B. Strict Matching Logic
    # Check if the user's tokens match this entity's identifiers
    IF matches_entity_strict(item, tokens):
      ADD (item, current_path/item_id) TO candidates

    # C. Recursion (Deep Search)
    # If item matches OR not, we still look inside it (e.g., inside a box)
    # UNLESS it is locked.
    IF item HAS "contents" AND item IS NOT "locked":
      scan_container(item["contents"], current_path/item_id/"contents")

The Workflow

Once we're in pseudo code "mode", I can freely chat with the model and compare different approaches without rewriting actual code. Only when the pseudo code looks correct I tell it to start implementing.

For me, this technique is helpful, and it might help you too!

* * *

More on: Gemini CLI: Google's coding agent for the terminal →