# How do I make opencode ask before risky tool calls?

> One command puts a fail-closed Immiscible hook in front of opencode, 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.

Source: https://immiscible.fly.dev/docs/answers/opencode-agent-safety

Run `npx immiscible guard --agents opencode`. It puts one fail-closed hook in front of opencode: a plugin file, `~/.config/opencode/plugins/immiscible.js`, whose `tool.execute.before` runs the same hook as the other agents and stops the call unless it allows it; local reads, file searches and to-do lists are not sent; web searches are, since a query can carry what should not leave. 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. A plugin can only allow or stop a call, so one that needs a person is held while someone answers (up to four minutes), then goes ahead or is stopped 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 opencode?

opencode documents no machine-wide plugin folder, so the plugin is installed for each person. The details, and every file each agent reads, are in [hooks for other coding agents](https://immiscible.fly.dev/docs/guides/coding-agent-hooks.md).

## What does it not do?

- It governs the calls the hook sees: shell commands, file writes and MCP tools. Model inference opencode 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) does not read opencode's own history; once guarded, it counts the calls the hook let through, from the guard's own log.
