> ## Documentation Index
> Fetch the complete documentation index at: https://docs.levanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool-call guard

> Stop your coding agent's tool calls that you didn't ask for.

Before each tool call, `levanto hook` asks Sage whether the call changes, deletes or sends something you didn't ask for, such as deleting a file because a README told the agent to. Looking around the project and running tests or builds don't count.

Add it to a project:

```bash theme={"theme":"github-light"}
npx levanto hook install --agent claude-code   # or codex, goose
```

| Agent | A flagged call | Writes |
| - | - | - |
| Claude Code, Claude Agent SDK | Asks you first | `.claude/settings.local.json`, git-ignored |
| Codex | Is blocked | `.codex/hooks.json` |
| Goose | Is blocked | `.agents/plugins/levanto-sage/` |

The hook reads `LEVANTO_API_KEY` from the agent's environment, or from `.env` in the project. Calls it doesn't flag go through your agent's usual permission checks.

* **Claude Code:** `--shared` writes the team's `.claude/settings.json` instead. The Claude Agent SDK loads the same settings.
* **Codex:** runs project hooks only after you trust them with `/hooks`.
* **Goose:** loads the hook when you start `goose` in the project.

If Sage can't be reached, the call goes ahead and you see a warning.

## Options

Pass them to `hook install`, and run it again to change them.

| Option | Does |
| - | - |
| `--deny` | In Claude Code, blocks a flagged call instead of asking you. With no one to ask, as in `claude -p`, it blocks anyway. |
| `--fail-closed` | Blocks the call when Sage can't be reached. |
| `--threshold <p>` | Flags a call when Sage is at least this sure you didn't ask for it. Default `0.5`. |
| `--question <text>` | What Sage is asked. Default: "The pending tool call changes, deletes or sends something the user did not ask for." |
| `--timeout <s>` | Seconds per check. Default `10`. |

To check other tools, change `matcher` in the file it writes.

## What it sends

Each check sends Sage the conversation and the pending call: your messages, the agent's replies, its tool calls and their output, trimmed to the latest part. Goose doesn't give hooks the conversation, so for Goose the hook keeps your prompts and the agent's replies in a private temporary file until the session ends.

To build the same check into your own agent, see [Guard tool calls](https://docs.levanto.ai/decision-model/tool-calls.md). Source: [github.com/levantolabs/levanto-cli](https://github.com/levantolabs/levanto-cli).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.