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

# Govern Coding Agents with Governance Plugins

> Install the Mezmo Governance plugins so Claude Code, Codex, Cursor, and other coding agents check each tool call against your Mezmo policy before it runs.

The Mezmo Governance plugins bring Agent Governance policies to coding agents and agent SDKs that don't run on [AURA](https://docs.mezmo.com/aura/index.md). Before the agent runs a tool, such as a shell command or an MCP tool call, the plugin asks Mezmo whether the call can proceed. Mezmo decides with the same policies, approvals, and workflows that govern AURA agents. This page explains how to set up a coding agent in Mezmo, install its plugin, and check that the agent is governed.

The plugins are open source in the [mezmo/agent-plugins repository on GitHub](https://github.com/mezmo/agent-plugins). The repository is the source of truth for each plugin's install steps, settings, and limits.

## Supported Agents and SDKs

The plugins support these coding agents:

* Claude Code
* Codex CLI
* Cursor
* Gemini CLI
* Antigravity CLI
* GitHub Copilot
* Goose
* Droid
* Windsurf
* Pi
* OpenCode

For agents you build yourself, the repository also has integrations for the Claude Agent SDK, LangChain, the OpenAI Agents SDK, and Mastra. You add these to your application code.

## How the Plugins Work

Before each tool call the plugin governs, it sends the call to Mezmo's authorize endpoint and waits for a decision:

* If Mezmo allows the call, the tool runs.
* If Mezmo denies the call, the tool doesn't run, and the agent shows the reason from the policy rule.
* If the policy requires approval, the plugin waits for an approver. If nobody decides within the plugin's timeout, the plugin denies the call. The timeout is 590 seconds, which is also the most it can be. To wait less, set `MEZMO_GOVERNANCE_TIMEOUT_SECONDS`. Mezmo keeps the request pending for its full 15-minute approval window, so it can still be approved after the plugin has given up. Approving it then doesn't run the call.
* If Mezmo can't be reached or returns a response the plugin can't read, the plugin denies the call.

Mezmo identifies the agent from the service account token the plugin sends, and records each request as a [workflow](https://docs.mezmo.com/docs/governance-workflows.md). The plugins also write a line for each call to a local audit log, `~/.mezmo/governance-audit.jsonl` by default. To change the path, set `MEZMO_GOVERNANCE_AUDIT_LOG`.

> [!WARNING]
>
> In these cases, tool calls run without asking Mezmo:
>
> * The Claude Code and Codex plugins have no token. Set `MEZMO_GOVERNANCE_REQUIRED=1` to deny every call instead.
> * Codex hasn't trusted the hooks in `/hooks`. Codex skips untrusted hooks without a warning, and you trust them again after each plugin update.
> * The agent's own hook timeout ends before the plugin decides. This applies to Codex, Gemini CLI, GitHub Copilot, and Droid. Keep the agent's hook timeout above the plugin's.
> * The OpenCode plugin fails to load.
>
> The repository's [Install by hand](https://github.com/mezmo/agent-plugins#install-by-hand) table lists the cases for each agent.

Each plugin sends Mezmo the tool name and its full arguments, such as the shell command, the file path, and the file content for write tools. Write policies on the assumption that Mezmo sees every argument, and keep secrets out of tool arguments.

The Claude Code and Codex plugins also send each tool call to the Mezmo ledger, which is on by default once the plugin has a token. For Bash and MCP calls, the ledger record includes the arguments and the tool's result or error, each cut at 4,096 characters. To turn this off, set the Claude Code plugin's `ledger_enabled` option to false, or run `./mezmo-governance setup codex --no-ledger` for Codex. Other plugins keep tool results on your machine. The repository's [What leaves your machine](https://github.com/mezmo/agent-plugins#what-leaves-your-machine) section lists what each plugin sends.

> [!NOTE]
>
> Coverage differs by agent. For example, the Claude Code plugin governs only Bash and MCP tool calls, and other built-in tools such as Read and Write run without a check. What each plugin governs, and whether it blocks the tool when the plugin itself fails, is listed in the repository's [Install by hand](https://github.com/mezmo/agent-plugins#install-by-hand) table.

### Write Rules for Claude Code Bash Commands

The Claude Code plugin splits a Bash command into its parts, such as `cd /repo` and `git push origin main` in `cd /repo && git push origin main`, and sends each part as its own tool call. The strictest outcome among the parts wins, so an allowed `cd` can't carry a `git push` through. Each part has these arguments for rules to match:

| Argument | For `git push --force origin main` |
| - | - |
| `command` | `git push --force origin main` |
| `program` | `git` |
| `arg_1`, `arg_2`, ... | `push`, `origin`, `main`. Flags are left out, and only the first 10 are sent. |
| `flag_<name>` | `flag_force` is `true` |

Each spelling of a flag is a separate argument. For example, `--force` gives `flag_force` and `-f` gives `flag_f`, so a rule for force pushes needs one rule per spelling. A part the plugin can't fully read, such as one with a variable or a redirect, has no `program`, `arg_`, or `flag_` arguments. Write allow rules on `program` with **is (`eq`)** or **is one of (`in`)**, because **is not (`neq`)** and **is not one of (`nin`)** also match a part with no `program`. For every case, see [Bash commands](https://github.com/mezmo/agent-plugins/tree/main/claude-code#bash-commands) in the Claude Code README.

## Set Up a Coding Agent in Mezmo

Register each coding agent in Mezmo before you install its plugin, so Mezmo can recognize its tool calls.

Before you begin, [create a policy](https://docs.mezmo.com/docs/governance-policies.md#create-a-policy) for the agent. In policy rules, the tool namespace is the plugin's namespace, such as `claude_code`, `codex`, or `cursor`, or the MCP server name for an MCP tool. Each plugin's README in the repository lists its tool names.

1. [Register an agent](https://docs.mezmo.com/docs/governance-agents.md#register-an-agent) for each coding tool on each machine, so that each one has its own policy and workflow history. For **Instance ID**, enter a value that is unique per machine, such as `claude-code-my-laptop`.
2. On the **Service Account** step, create a service account for this agent only.
3. Copy the new access key and store it securely. This key is the plugin's service account token, and Mezmo shows it only once.
4. On the **Policy** step, assign the agent's policy.
5. On the **Finished** step, copy the `url` value in the `[hitl.route]` table of the `config.toml` section. This URL ends in `/governance/workflow/authorize`, and the plugin uses it as `MEZMO_GOVERNANCE_URL`. The rest of the `config.toml` section applies only to AURA.

> [!WARNING]
>
> A governed agent can read its own token. If the service account can change policies or agents, the agent could change its own rules. Give the service account Agent Governance permissions only, without `policy` Write or `agent` Write. See [Permissions](https://docs.mezmo.com/docs/agent-governance.md#permissions).

## Install a Plugin

The repository's `mezmo-governance` command installs a plugin into an agent's user configuration, so it governs every session of that agent on the machine.

Before you begin:

* Use macOS or Linux. Windows isn't tested.
* Install Python 3.9 or later. Pi and OpenCode also need Node 22.18 or later.
* Install the coding agent you want to govern, so its command is on your `PATH`.

To install a plugin:

1. Clone the repository, and change to its folder:

   ```bash theme={null}
   git clone https://github.com/mezmo/agent-plugins
   cd agent-plugins
   ```

2. In the shell that starts the agent, export the URL and token from [Set Up a Coding Agent in Mezmo](#set-up-a-coding-agent-in-mezmo). OpenCode 2.x ignores these variables, because it runs tools in a background service. For OpenCode 2.x, the install names the plugin in `opencode.json` with the URL and a file that holds the token. See the repository's OpenCode README.

   ```bash theme={null}
   export MEZMO_GOVERNANCE_URL="<url from the Finished step>"
   export MEZMO_GOVERNANCE_TOKEN="<service account access key>"
   ```

3. Preview the changes the install makes. Replace `claude-code` with the name of your agent:

   ```bash theme={null}
   ./mezmo-governance install claude-code --dry-run
   ```

4. Install the plugin:

   ```bash theme={null}
   ./mezmo-governance install claude-code
   ```

Keep the cloned folder where it is. Pi loads the plugin from that folder, and Claude Code uses it as the plugin's marketplace.

To see the agent names that `install` accepts, run `./mezmo-governance agents`. To install every supported agent on your `PATH`, use `--all` in place of the agent name. Some agents need an extra step after the install. For example, Codex runs the hooks only after you trust them in `/hooks`, and Claude Code can store the token with `/mezmo:setup governance`, in the macOS Keychain or, on Linux, in `~/.claude/.credentials.json`, readable only by you. See the repository's README for each agent's steps, and for the SDK integrations.

## Check the Setup

1. In the shell with the exported URL and token, check the settings, the connection to Mezmo, and each installed plugin:

   ```bash theme={null}
   ./mezmo-governance doctor --probe
   ```

   Each check prints `ok`, `warn`, `FAIL`, or `skip`, with a fix for a failed check. The `--probe` option sends Mezmo one test call for the tool `doctor:probe`, which confirms that Mezmo finds the agent and its policy. An allowed or denied probe prints `ok`. If the policy holds the probe for approval, the check prints `warn`; to avoid that, add a rule to the agent's policy that allows tool `probe` in namespace `doctor`.

2. Send each installed plugin a test shell call and read call through a local mock server:

   ```bash theme={null}
   ./mezmo-governance smoke
   ```

3. In the agent, run a tool call that your policy denies. The agent shows the reason from the policy rule, and the request appears on the [Workflows](https://docs.mezmo.com/docs/governance-workflows.md) page.

To remove a plugin, run `./mezmo-governance uninstall <agent> --dry-run` to preview the change, then run the same command without `--dry-run`.

## Related Topics

* [Agent Governance](https://docs.mezmo.com/docs/agent-governance.md)
* [Governed Agents](https://docs.mezmo.com/docs/governance-agents.md)
* [Agent Governance Policies](https://docs.mezmo.com/docs/governance-policies.md)
* [Mezmo Governance plugins on GitHub](https://github.com/mezmo/agent-plugins)
