Guardrails and hooks
What Fragua stops an agent from doing, and how to add your own checks.
On Claude Code runs, Fragua wraps the agent in guardrails: checks that run before and after its actions, on your machine, and stop the ones that shouldn't happen. Some are always on; two you can tune per workspace; and you can upload your own as a hook bundle.
Always on
These run on every Claude run that needs them, and can't be turned off.
- Read-only
- — planning, shaping, and diagnosis runs can read your code but not change it.
- Secrets
- — the agent can't read secret files such as
.envor credential stores. - Dangerous commands
- — dropping or resetting a database, editing credentials, deploying, force-pushing or deleting branches, and piping a download into a shell are blocked. Read-only production checks are allowed.
- Completeness
- — a spec or diagnosis missing a required section is sent back to the agent to finish.
What you can tune
On the workspace's Foundation page, the Run guardrails card has the build checks. Any developer or admin can change them.
- Lint after each edit
- — runs your linter on the files the agent just changed.
- Run the tests before a build stops
- — a build can't finish while tests fail. The failures go back to the agent, up to three attempts, and the run page shows each round.
- Test command
- — leave it blank and Fragua picks one from the repository —
bin/rails test, the package.json test script,go test,cargo test, orpytest. If your tests need setup, point it at a script in the repo. It runs with the agent's environment, workspace secrets included.
What you see when one fires
A blocked action shows on the run's timeline — Blocked: read .env (secrets) — and the run page's Guardrails card counts the blocks and follow-ups. The agent is told why, so it can take another route.
Your own hooks
Upload a hook bundle on the same card: a hooks.json and the scripts it calls. Each hook names an event — before a shell command or a file read, after an edit, when the agent stops, and others — and a command to run. A run keeps the bundle it started with.
Up to 20 scripts, 64 KB each and 256 KB in all, text only. A script that crashes doesn't stop the agent unless its hook sets failClosed. Hook scripts run without Fragua's tokens or your workspace secrets, and the machine needs fragua 1.21.0 or newer.
Codex and Copilot
Guardrails aren't active for Codex or GitHub Copilot runs yet, and the run page says so. Running the agent in an isolated container is the way to contain those.
See also: Why run in isolation · Workspace secrets