
Reflex makes AI coding agents prod-safe for infra teams: an open-source pre-execution hook for
Claude Code, Codex CLI, opencode and pi that judges every shell command by where it points and what
it will change, then lets it run, asks a human, or blocks it.
Documentation website: https://ursuciprian.github.io/reflex/

A real Claude Code session in a scratch repository; how to reproduce it.
What it adds to the agents' built-in permission rules:
- Plan-aware terraform gate.
terraform apply without a saved plan asks for
terraform plan -out=tfplan. With infra.terraform_show on, Reflex reads the saved plan with
terraform show -json and denies any delete or replace, naming stateful resources such as
aws_db_instance first. It is off by default and needs a provider plugin cache, because
terraform show starts the provider binaries in .terraform, which an agent could have written.
- Environment awareness. A command is judged with the AWS profile, kube context, Terraform
workspace, git branch and production paths such as
envs/prod: kubectl delete namespace asks in
a dev context and is denied in a prod one.
- One policy across agents. A committed
.reflex/policy.json gives every teammate the same
extra rules, production markers, always-human patterns and freezes in Claude Code, Codex CLI,
opencode, pi and Hermes. It can only tighten; its fast lane and webhook apply only after each
teammate runs reflex trust ..
- Change freeze. A window such as Friday after 15:00 in
Europe/Bucharest, or a date range,
makes production commands that are not read-only ask or be denied, in shadow and enforce mode.
- Audit export and webhook.
reflex audit writes one row per decision (agent, cwd, production
tier, redacted command, decision, rule, who approved it) as csv, json or jsonl for SOC 2 and
ISO 27001 change management evidence. A Slack or json webhook gets denies, asks or production
decisions without delaying the hook.
- Fail-closed hooks. In enforce mode a hook that crashes while loading or deciding answers ask
(Claude Code) or deny (Codex) instead of letting the command run unchecked.
It starts keyless, with local rules in shadow mode, and it also scans what the agent reads for
prompt injection. It gates shell commands, not file edits or MCP calls, and it does not replace a
sandbox or least-privilege credentials.
Install
Claude Code plugin
Reflex is a Claude Code plugin with its own marketplace in this repository. Inside Claude Code:
/plugin marketplace add ursuciprian/reflex
/plugin install reflex@reflex
Or from your shell: claude plugin marketplace add ursuciprian/reflex, then
claude plugin install reflex@reflex. Restart the session (or run /reload-plugins).