# OpenClaw Hooks and Permissions: before_tool_call, Approvals and What Happens When ACP Is Down

How OpenClaw's before_tool_call hook works, how it differs from operator shell hooks, how the ACP plugin uses it, and what the plugin does when it can't reach ACP.

<div style="background:var(--acp-surface,#f8f9fb);border:1px solid var(--acp-border,#e2e5ea);border-radius:12px;padding:20px 24px;margin:24px 0;">
<p style="margin:0 0 10px;font-weight:600;">Just want the answer?</p>
<p style="margin:0 0 12px;">OpenClaw's control point is a plugin hook called <code>before_tool_call</code>, not a hooks.json file. Install the ACP plugin:</p>
<pre style="margin:0 0 12px;overflow-x:auto;"><code>curl -sf https://agenticcontrolplane.com/install.sh | bash
# or by hand:
openclaw plugins install @agenticcontrolplane/openclaw</code></pre>
<p style="margin:0;">Full walkthrough: <a href="/integrations/openclaw">OpenClaw install guide</a>. Native control model: <a href="/controls/openclaw">OpenClaw permissions, explained</a>.</p>
</div>

OpenClaw is a personal-assistant gateway that fronts messaging channels, and it usually runs with nobody watching. It isn't a terminal coding agent. Its hooks look different too. There's no `hooks.json` to edit. Instead, plugins register a typed hook that runs before each tool call and can plug into OpenClaw's own approval flow.

## Two hook systems, and only one sees tool calls

OpenClaw has two kinds of hooks.

- **Plugin hooks** are in-process TypeScript, registered from a plugin's entry point. `before_tool_call` and `after_tool_call` live here, next to agent and message events.
- **Internal hooks** are shell scripts you write, triggered by command and gateway events. They can't see tool calls. A `tool:before` / `tool:after` pair has been requested but doesn't exist.

So if someone says they added a hook to control what OpenClaw's tools do, ask which kind. Only a plugin hook can see a tool call before it runs.

## before_tool_call: block, or ask for approval

`before_tool_call` can return `{ block: true }`, which stops the call and any lower-priority handlers. Or it can return a `requireApproval` result. The approval resolves to `allow-once`, `allow-always`, `deny`, `timeout` or `cancelled`. That's how a plugin can use OpenClaw's own approval flow instead of adding a second approval screen.

Two checks before you rely on it:

- Only the typed hook runner calls `before_tool_call` and `after_tool_call`. The older `registerHook` path still exists for backward compatibility, and it doesn't fire them. A plugin registered the old way never sees a tool call.
- `before_tool_call` sat in the codebase for a while before it was wired into the execution path. After any fresh install, run a real test call. Don't trust that the hook name appears in the docs.

## Installing the ACP plugin

```bash
curl -sf https://agenticcontrolplane.com/install.sh | bash
```

Or by hand:

```bash
openclaw plugins install @agenticcontrolplane/openclaw
```

Before each tool runs, the plugin sends it to ACP to check (`POST /govern/tool-use`). After it runs, the plugin sends the result (`POST /govern/tool-output`) for the log and content scanning. Each call, decision and identity lands in the activity log, with the sender attached where OpenClaw provides one.

When ACP says allow, the call runs. When it says deny, the call is blocked. When it says ask, the plugin uses OpenClaw's approval prompt if your OpenClaw build supports that. If the build doesn't, the call is blocked and the approval waits on the console. The plugin sends the OpenClaw prompt only after checking the build acts on it. If you get asked in OpenClaw and ACP has its own pending approval for the same call, approving in one place doesn't clear the other.

The plugin maps agents to tiers. The agent named `main` is interactive. Every other named agent is a subagent. Rules can differ by tier.

## What happens when ACP is down

This depends on the plugin version, and the docs disagree.

In the plugin source at version 0.2.1, an outage is handled by tier. The `main` agent counts as interactive. Its calls go ahead, the plugin reports them as ungoverned, and a line goes in `~/.acp/lapse.log`. Named agents count as subagents. Their calls are blocked until ACP answers.

The plugin's README still says the hook fails open on network errors, with no tier split. The source is newer than that sentence. Check the version you install.

One catch for OpenClaw. A gateway that runs the `main` agent unattended is still treated as interactive. In an outage, that agent's calls run ungoverned, and nobody is there to see the warning. If that worries you, run the work under a named agent.

## Using it with `--local`

Under `--local`, the installer skips the plugin step for Hermes, opencode, pi, Prime Agent, Grok Build, Muse Code, Antigravity and dsh. It prints that they need a workspace. It doesn't skip OpenClaw, so `openclaw plugins install @agenticcontrolplane/openclaw` runs either way.

That doesn't mean OpenClaw works offline. `--local` skips sign-in and writes `~/.acp/policy.json` for the on-device engine that the Claude Code and Cursor hooks call. The OpenClaw plugin doesn't read that file. It sends calls to ACP with a workspace key. So `--local` plus OpenClaw is untested. Don't count on the local rules covering it.

## What this hook doesn't reach

`before_tool_call` is the tool-call control point. OpenClaw's own hardening, such as approval binding and per-sender policy, sits above it. See [OpenClaw permissions, explained](/controls/openclaw).

## Known limits

- Hooks see tool calls, not tokens. ACP doesn't meter OpenClaw's model spend. The log has allow and deny decisions per call, not token cost.
- Check that your OpenClaw version uses the typed hook runner. The old `registerHook` path doesn't fire `before_tool_call`.
- Internal shell hooks can't see tool calls. That's how OpenClaw is built, and no plugin changes it.
- ACP runs as a plugin inside OpenClaw. Anyone who can change the OpenClaw install can remove it. The README shows how to pause it by moving `~/.acp/credentials`.

## How it compares to Claude Code hooks

Claude Code hooks are registered in `settings.json` and run as a separate process per call. OpenClaw's are registered by a plugin and run in-process. OpenClaw's approval has more outcomes than Claude Code's allow, deny or ask. Either way, a hook that controls tools needs its own plan for when it can't reach its backend. The [Claude Code hooks reference](/blog/claude-code-hooks-reference) covers that side.

## Frequently asked questions



## Where to read more

- [OpenClaw permissions, explained](/controls/openclaw)
- [OpenClaw install guide](/integrations/openclaw)
- [Claude Code hooks reference](/blog/claude-code-hooks-reference)
- [Codex hooks reference](/blog/codex-cli-hooks-reference)
- [openclaw-acp-plugin source](https://github.com/agentic-control-plane/openclaw-acp-plugin)
- <!-- source: https://github.com/openclaw/openclaw --> [OpenClaw](https://github.com/openclaw/openclaw)
