К основному содержанию
плагин CX Codex

review-agent-governance — плагин Claude Code: суть и установка

Блокирует отправку ревью, слияние PR и правку CI-конфигов агентом без явного одобрения человека. Создаёт проверяемые Ed25519-подписи для выполненных вызовов.

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add wshobson/agents
/plugin install review-agent-governance@claude-code-workflows
Открыть на GitHub

Что делает review-agent-governance

Плагин перехватывает команды Claude Code с помощью двух хуков: PreToolUse и PostToolUse. Перед выполнением опасной операции проверяется флаг одобрения. Если его нет, вступает в силу политика Cedar из файла ./review-governance.cedar, которая завершает вызов с кодом 2. Успешные операции подписываются ключом Ed25519 и сохраняются в ./review-receipts/receipts.jsonl.

Под блокировку попадают публикация комментариев, слияние пулреквестов через gh pr merge, пуши в ветки main и production, а также изменение файлов вроде .github/workflows/ или .gitlab-ci.yml. При этом создание новых PR через gh pr create остаётся доступным, чтобы агент мог передать результат человеку.

Проверка строк работает по шаблонам подстрок, поэтому вызов git push без явного указания ветки фильтр пропустит. Для подтверждения действий достаточно выполнить команду /approve-review или создать маркер touch ./.review-approved.

Какие задачи решает

  • запретить агенту публиковать ревью и комментарии к PR без проверки
  • заблокировать слияние веток и форс-пуши в production или main
  • предотвратить несанкционированное изменение файлов CI-пайплайнов
  • вести криптографически подписанный журнал вызовов инструментов

Примеры запросов агенту

  • /approve-review "Публикация ревью для PR #142"
  • Проверь изменения через gh pr diff 15, но не пытайся их сливать
  • /approve-review "Разрешить слияние пулреквеста"

Как установить review-agent-governance

Через маркетплейс плагинов

/plugin marketplace add wshobson/agents
/plugin install review-agent-governance@claude-code-workflows

По шагам, с командами для каждой платформы: Плагины Claude Code: маркетплейсы, установка и как собрать свой

Вопросы о review-agent-governance

Как установить review-agent-governance в Claude Code?

Подключите каталог командой /plugin marketplace add wshobson/agents, затем выполните /plugin install review-agent-governance@claude-code-workflows. Для активации правил скопируйте файл ./review-governance.cedar в корень своего репозитория.

Какие операции блокируются плагином по умолчанию?

Запрещены команды gh pr review, комментарии, слияние PR, форс-пуши, пуши в ветки main и release, а также любые правки файлов в .github/workflows/ и .gitlab-ci.yml.

Как разрешить агенту выполнить заблокированное действие?

Вызовите внутри диалога команду /approve-review "причина" либо создайте временный маркер командой touch ./.review-approved.

Исходный текст

review-agent-governance · MIT
# review-agent-governance

Require a human approval signal before an AI agent can post PR reviews,
comments, merges, or writes to CI configuration. Built on
[`protect-mcp`](https://www.npmjs.com/package/protect-mcp) + Cedar, with
every tool call that runs producing an Ed25519-signed receipt that verifies
offline.

## The failure mode this addresses

AI agents that post to review surfaces (PR comments, approvals, merges,
CI workflow edits) can take actions that affect other contributors,
regulated systems, and the integrity of the codebase itself. When the
agent hallucinates, mis-reads context, or is tricked into acting
incorrectly, the damage is immediate and visible: bogus reviews show up
under a real account, merges happen that should not, workflow files get
rewritten.

This is not a hypothetical. Review bots have posted mass hallucinated
review comments, approved PRs they should not have approved, and edited
workflow files in ways that compromised other security controls. The
pattern is common enough to name: an automated agent is given scope to
act on review surfaces, and the lack of a human gate at the moment of
action is what turns a localized bug into a public incident.

## What the plugin does

Two hooks run around every Claude Code tool call:

1. **`PreToolUse`** checks for a human approval flag. If absent, evaluates
   a Cedar policy (`./review-governance.cedar`) that forbids review-surface
   actions unconditionally. Cedar deny means the tool call exits with code
   2 and Claude Code blocks it.

2. **`PostToolUse`** signs an Ed25519 receipt for each tool call that ran
   and appends it to `./review-receipts/receipts.jsonl`. A denied call
   never runs, so it gets no receipt.

Approved windows are opened by creating a `./.review-approved` flag file,
or by running the `/approve-review` slash command shipped with this plugin.
The window stays open until the flag is removed.

## What gets gated

The default policy forbids (unless approved):

- **`gh pr review`, `gh pr comment`, `gh pr merge`, `gh pr close`, `gh pr edit`**
- **`gh issue comment`, `gh issue close`, `gh issue edit`**
- **`gh release create`, `gh release edit`**
- **`gh api` calls that can write**: any call with `graphql`, `-X` /
  `--method`, or `-f` / `-F` / `--field` / `--raw-field` / `--input`
  (including attached forms such as `-fbody=x`). This is conservative:
  GraphQL queries and parameterized GETs (`-X GET -f q=...`) are blocked too,
  because a command string cannot prove the request is a read. Open an
  approval window for them. Plain `gh api repos/o/r/pulls` reads pass.
- **GitLab equivalents** (`glab mr comment`, `glab mr approve`, `glab mr merge`, `glab issue comment`)
- **`git push` naming `main`, `master`, `release`, or `production`** as a whole
  word (`origin main`, `HEAD:main`, `refs/heads/main`), so `maintenance` or
  `fix-release-notes` pass
- **Force pushes to any branch** (`--force`, `--force-with-lease`, `-f`,
  `--mirror`, or a `+`-prefixed refspec such as `+feature`)
- **Chained or quoted pushes**: a `git push` that also contains `;`, `&`,
  `|`, a newline, a backtick, `$`, `<`, a quote, or a parenthesis, such as
  `git push origin main; true`, `git push origin "main"`, or
  `(git push origin main)`. This is conservative: a push with `2>&1` or a
  push option such as `git push -o "ci.skip"` also needs an approval window.
- **Remote branch deletes** (`--delete`, `-d`, `--prune`, or
  `git push origin :feature`) and **`git push --all`**, which updates `main`
  without naming it
- **Writes and edits to `.github/workflows/`, `.github/CODEOWNERS`, `.gitlab-ci.yml`, `.circleci/config.yml`, `buildkite/pipeline.yml`**

Everything else passes through. This plugin is focused on the review
surface; use it alongside [protect-mcp](../protect-mcp/) if you want
general tool-call policy enforcement.

### Known limits

Matching shell commands as strings is best-effort: the rules use substring
patterns such as `*gh *pr merge*`, which also catch `cd x && gh pr merge 1`,
`env gh ...`, `/usr/bin/gh ...`, and `gh -R o/r pr merge 1`, but a determined
rewording (a tab or extra spaces between `pr` and `merge`, a gh alias, `curl`
against the API, or a Bash redirect into `.github/workflows/`) can still get
through. They can also over-match, for example `echo gh pr merge`; open an
approval window for those. Other limits:

- A bare `git push` is allowed. The evaluator sees only the command string,
  not the upstream branch it pushes to.
- Force and delete flags are matched alone, when a bundle starts with `-f`,
  or in two-letter bundles such as `-uf` or `-df`. A longer bundle is matched
  only when it starts with `-f` or one of those pairs (`-fuv` and `-qdf` are,
  `-uvf` is not), because Cedar `like` has no character classes.
- `gh pr create` and `gh issue create` are not gated on purpose: opening a PR
  or an issue is how an agent hands work to a human.
- `WebFetch` is not gated. Claude Code's WebFetch tool only issues GET
  requests, so it cannot post a review, comment, or webhook message.
- Path patterns are case-sensitive, so on a case-insensitive file system a
  write to `.GITHUB/workflows/` is not matched.

## Installation

```bash
claude plugin install wshobson/agents/review-agent-governance
```

Copy the default policy into your project:

```bash
cp .claude/plugins/review-agent-governance/policies/review-agent-governance.cedar \
   ./review-governance.cedar
```

Then either:

- **(Recommended)** keep hooks active for every session and open approval
  windows explicitly before review actions, or
- Set `REVIEW_APPROVAL_FLAG=./never-approve` to effectively disable the
  approval bypass (forces every review action through Cedar).

## Opening an approval window

### Flag file

```bash
touch ./.review-approved
# Let the agent perform the approved action
rm ./.review-approved
```

### Slash command (from inside Claude Code)

```
/approve-review "Posting the code review for #123"
```

The command creates `./.review-approved` with a note describing the
approval reason and appends a JSON entry under
`./review-receipts/approvals/`.

**Important note on the approval log:** entries under
`./review-receipts/approvals/*.json` are **plain JSON records, not signed
receipts**. They do not flow through `protect-mcp sign`, so
`@veritasacta/verify` does not cover them. The approval log is
operator-trust; it records what the human intended to approve but can be
edited after the fact without detection.

What is signed and tamper-evident: the `PostToolUse` receipts in
`./review-receipts/receipts.jsonl`, one for each tool call that ran. Verify
them with the public key from `./review-governance.key`:

```bash
PUB=$(node -p 'JSON.parse(require("fs").readFileSync("./review-governance.key")).publicKey')
npx @veritasacta/[email protected] --replay-chain ./review-receipts/receipts.jsonl --key "$PUB"
```

To add a signed record of an approval, emit a separate receipt. protect-mcp
0.7.4 signs only the name `approve-review` and the time, not the reason:

```bash
npx [email protected] sign --tool approve-review --receipts ./review-receipts/ --key ./review-governance.key
```

### Listing pending or denied actions

```
/list-pending
```

Lists the tool calls that the policy blocked in the current session. A
denied call writes no receipt, so the receipts file cannot show denials.

### A note on what the signed receipts cover

protect-mcp 0.7.4 signs the same fields for every tool call that ran: the
tool name, `decision: allow`, and `policy_digest: none`. A receipt does not
show whether the approval flag was present, and a denied call has no
receipt. The unsigned approval log shows when a window was opened.

## Example session

An agent working on a PR wants to post a review comment. Without approval:

```
$ agent: gh pr review 42 --comment --body "LGTM"
  → PreToolUse hook runs
  → No ./.review-approved file, policy evaluates
  → Cedar: forbid on context.input.command like "*gh *pr review*"
  → Exit 2: Claude Code blocks the tool call
  → PostToolUse does not run, so no receipt is written
```

With approval:

```
$ touch ./.review-approved
$ agent: gh pr review 42 --comment --body "LGTM"
  → PreToolUse hook runs
  → ./.review-approved present, exit 0
  → Tool call proceeds
  → PostToolUse appends a signed receipt (decision=allow)
$ rm ./.review-approved
```

The receipts file records only the allowed call. The denied attempt is
visible in the Claude Code session, and the approval log records when the
window was opened.

## Composing with protect-mcp

This plugin focuses on review-surface actions specifically. For general
policy enforcement across all Claude Code tool calls, install
[protect-mcp](../protect-mcp/) alongside it. They compose naturally:

- `protect-mcp` evaluates a general policy (e.g., deny `rm -rf`, restrict
  `Write` to project root) for every tool call
- `review-agent-governance` adds the review-surface gate on top

Both hooks run, and both sign a receipt for each tool call that ran. They
write to different directories (`./receipts/` and `./review-receipts/`)
with different keys, so verify each file with its own public key.

## Why Cedar, why receipts

**Cedar** (AWS's open authorization engine) expresses policy declaratively
and formally. Reviewers read the policy to understand exactly what is
gated without reading code. Policies type-check with `cedar validate`.
Changes to the policy are diffable.

**Ed25519 receipts** (RFC 8032, JCS canonicalization per RFC 8785) provide
tamper-evident evidence that does not depend on the operator. Any party with
the public key can run the `--replay-chain` command above and get an exit
code that shows whether every receipt is authentic. If any receipt was
altered after signing, verification fails with exit 1. The receipts carry
no link to the previous receipt, so a deleted line goes undetected.

## Standards

- **Ed25519** (RFC 8032) for receipt signatures
- **JCS** (RFC 8785) for deterministic canonicalization before signing
- **Cedar** (AWS) for declarative, formally verifiable policy evaluation
- **IETF draft** [draft-farley-acta-signed-receipts](https://datatracker.ietf.org/doc/draft-farley-acta-signed-receipts/) for receipt format

## Related

- [`protect-mcp`](../protect-mcp/) — general Cedar + receipt enforcement
  for all Claude Code tool calls
- [`protect-mcp` on npm](https://www.npmjs.com/package/protect-mcp) — the
  runtime this plugin depends on
- [`@veritasacta/verify`](https://www.npmjs.com/package/@veritasacta/verify)
  — offline receipt verification CLI
- [Cedar for AI agents](https://github.com/cedar-policy/cedar-for-agents)

© Tom Farley · MIT · wshobson/agents

Похожие плагины

Все плагины по теме «Безопасность» →
security-guidance официальный Anthropic Три слоя проверки кода, который пишет Claude: мгновенные предупреждения по regex, разбор диффа через LLM и агентная проверка коммитов. ★ 44 635звёзд репо mcp-tunnels официальный Anthropic Соединяет Claude с MCP-сервером внутри вашей сети через туннель Anthropic: без входящих портов и публичного доступа. ★ 44 635звёзд репо hookify официальный Anthropic Создаёт хуки и правила для Claude Code через простые Markdown-файлы. Защищает проект от случайных опасных команд и нежелательных правок в коде. ★ 44 635звёзд репо code-modernization официальный Anthropic Ведёт перенос легаси-кода по шагам: разбор, план, сборка и доказательство, что новое поведение совпадает со старым. ★ 44 635звёзд репо claude-security официальный Anthropic Ищет уязвимости в вашем коде прямо в сессии Claude, проверяет каждую находку и по желанию готовит патчи. ★ 44 635звёзд репо google-cloud-developer официальный Google LLC Плагин помогает агенту настраивать Google Cloud, выбирать учётные данные и проверять команды gcloud. MCP-сервер подключает актуальную документацию Google. CX Codex ★ 21 578звёзд репо

Из того же набора371

Весь набор →
improve-agent Прогоняет существующего агента через замеры, правку промптов и A/B-тесты, чтобы понять, что именно в нём сломано. CX Codex ★ 41 729звёзд репо pptx-deck-creation Плагин собирает редактируемые PowerPoint-презентации по брифу и исходникам: сначала спецификация, потом точная раскладка по дюймам. CX Codex ★ 41 729звёзд репо skill-forge-essentials Плагин добавляет поведенческие навыки для борьбы со скрытым техдолгом от агента, потерей контекста при сжатии и неточными правками в Design Mode. CX Codex ★ 41 729звёзд репо ship-mate Плагин превращает файл с описанием задачи в готовую фичу: архитектор, разработчик, ревьюер, QA и Playwright идут по цепочке. CX Codex ★ 41 729звёзд репо signed-audit-trails Объясняет, как подписывать записи о вызовах инструментов Claude Code и проверять их на подмену. Пригодится для изучения схемы до внедрения в проект. CX Codex ★ 41 729звёзд репо protect-mcp Проверяет каждый вызов инструмента по политике Cedar и выдаёт Ed25519-подписанную квитанцию. Пригодится, когда агенту нужно ограничить доступ к файлам и командам. CX Codex ★ 41 729звёзд репо block-no-verify Блокирует флаги обхода git-хуков, чтобы агент не пропускал линтеры и проверки перед коммитом. CX Codex ★ 41 729звёзд репо plugin-eval Проверяет структуру плагинов и скиллов, а экспериментальные режимы оценивают их с помощью модели. Пригодится для линтинга и сравнения скиллов. CX Codex ★ 41 729звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой