Gemini CLI terminal interface showing the AI assistant responding to a code request Screenshot from the google-gemini/gemini-cli GitHub repository
by VibecodedThis

Gemini CLI Preview Switches to Surgical Code Edits and Adds Session Portability

Gemini CLI v0.43.0-preview.0 ships an edit tool that modifies only the changed lines instead of rewriting full files, plus session export and import, an adaptive token calculator, and shell safety evaluations.

Share

Google released two Gemini CLI builds on May 12: v0.42.0 as the new stable release and v0.43.0-preview.0 as the next preview. The preview contains one architectural change worth paying attention to.

Surgical Code Edits Instead of Full Rewrites

The headline item in the preview is a new editing strategy. Gemini CLI now steers the model to use an edit tool that targets only the specific lines being modified, rather than rewriting the entire file and returning it.

Full-file rewrites are a known problem with LLM-driven editing tools. They consume far more context than necessary, introduce noise into diffs (whitespace changes, reformatting), and make it harder to review what actually changed. Competing tools like Claude Code use targeted edit tools precisely for this reason. Gemini CLI’s preview brings parity.

The change is a single-PR commit from contributor @aishaneeshah — functionally significant even if the implementation is compact. The preview channel is where Google validates new behavior before promoting it to stable, so this should land in stable within a few releases.

Session Export and Import

The preview also adds session portability via CLI flags. You can export a chat session to a file and import it in a new run. The use cases: sharing a session with a teammate, archiving a long research conversation, or picking up exactly where you left off from a different machine without relying on the session store.

The commit lands from contributor @cocosheng-g and pairs naturally with the machine hostname display feature also in this release, which makes it easier to know which machine a session came from when you’re working across multiple environments.

Adaptive Token Calculator

Context management gets a more accurate estimator. The adaptive token calculator adjusts its sizing based on observed content patterns rather than using fixed per-token weights. The practical effect: the CLI makes fewer surprises when long conversations approach context limits. Previously the static calculator could trigger compaction earlier or later than necessary depending on the content type.

Shell Command Safety Evaluations

The preview adds automated safety evaluations for shell commands, contributed by @akh64bit. This is infrastructure work — it gives Google a way to test and measure how the CLI handles potentially risky shell operations across a benchmark of cases. Users don’t see a UI change, but the evals provide coverage that should reduce regressions in command safety behavior over time.

v0.42.0 Stable: What Changed

The stable release that shipped alongside the preview is mostly cleanup. It prevents automatic updates from switching channels (a common annoyance when preview users got bumped to stable), handles DECKPAM keypad mode, and fixes several edge cases including OAuth hangs on headless Linux and numeric project ID handling in GOOGLE_CLOUD_PROJECT.

The stable release also includes Gemma 4 support via the Gemini API, voice mode wave animations from 0.41.0, and the Auto Memory inbox with the canonical-patch contract that shipped in the preview cycle earlier.

Installing the Preview

To try v0.43.0-preview.0:

npm install -g @google/gemini-cli@preview

For stable, the standard install still applies:

npm install -g @google/gemini-cli

Sources: Gemini CLI v0.43.0-preview.0, Gemini CLI v0.42.0

Share