Skip to content

Answers

How do I make Gemini CLI ask before risky tool calls?

One command puts a fail-closed Immiscible hook in front of Gemini CLI, so a force push, a deploy or a secret leaving the machine is refused or waits for a person, by the same rules as every other coding agent.

Run npx immiscible guard --agents gemini. It puts one fail-closed hook in front of Gemini CLI: a BeforeTool hook for run_shell_command, write_file, replace, web_fetch and MCP tools, in ~/.gemini/settings.json, or in the system settings file, which overrides user and project settings. With no account the hook decides on your machine and sends nothing; --connect sends the questions to your workspace, so approvals reach Slack, Teams, email or your phone. guard and these hooks are in the next CLI release, 0.3.0, not yet on npm; until then, run it from a checkout of the repository.

#What does it stop?

The same rules as for Claude Code and the other agents: a force push to main or a release branch, rm -rf of the root or home directory and a secrets file sent off the machine are refused; publishing a package, terraform apply, kubectl against production and the network after a secret was read are asked about. Gemini CLI hooks can only allow or block, so a call that needs a person is held while someone answers (up to four minutes), then goes ahead or is refused with the approval link.

#What if Immiscible cannot be reached?

The call is refused, with the reason. A missing hook file, a missing node or a crash refuses it too: the hook fails closed, so an outage never lets a call through unchecked.

#Anything specific to Gemini CLI?

A person can still list a hook by name in their own hooksConfig.disabled; install warns when the file it writes does. The details, and every file each agent reads, are in hooks for other coding agents.

#What does it not do?

  • It governs the calls the hook sees: shell commands, file writes and MCP tools. Model inference Gemini CLI runs on its vendor’s own servers does not pass through it.
  • It does not read or change your code. immiscible scan (from 0.3.0) shows what the agents already did, from the history they keep on your machine.