Agent action governance
Coding agents should not be the authority on whether their own next action is safe. Savants Guard moves that decision into a deterministic policy layer outside the model, so teams can move quickly without turning every command into an approval prompt.
The short version: enforce capabilities, not vibes. Let routine reads, edits, builds and tests flow. Stop, ask, or deny the actions whose blast radius is real—production changes, secrets, destructive commands, spend, and unknown executables.
The approval trap
An approval prompt looks like a control. In practice it often asks the wrong party. The agent has the task context, the repository state and the reason it wants to run a command. The human has a notification, a partial diff and a queue of other work. The model asks “may I?”; the person clicks “allow” because the alternative is reading a command they cannot fully evaluate in the moment.
That is not review. It is self-certification with a human in the loop. The model that wants to finish the task is also the model deciding whether the action is appropriate. Calling that “system 2” does not create separation of duties; it moves the same judgment into a different prompt.
Per-command approval also fails at scale in two directions. If the prompt is frequent, people rubber-stamp it. If it is rare, it fires when context is thinnest—during an incident, a deploy, or a long refactor—and the person is least able to reconstruct why the command exists.
The enforcement boundary
Savants Guard is a policy check that runs before an action, outside the model. The model proposes; Guard evaluates. Rules are deterministic, so the same action and context always produce the same decision. There is no LLM in the evaluation path and no opportunity for the agent to talk its way through a rule.
A policy can return one of four useful outcomes: allow the action, block it, require a human
approval, or surface a safer alternative. require_approval is a stop, not a warning.
The action does not run until a person approves that exact action.
Because the policy is data, not prose in a system prompt, it can be reviewed, tested, versioned and shared. That is the difference between a guardrail and a suggestion.
Capabilities, not command strings
A useful policy classifies actions by capability. The command is the surface; the capability is what the organisation is actually deciding to trust. A team might allow repository reads and test runs by default, scope edits to the checked-out tree, and require a person for anything that changes production or moves money.
| Capability | Default posture | Typical examples | Control |
|---|---|---|---|
| Read workspace | Allow | Search, inspect, build, run tests | Path scope; no credential stores |
| Edit workspace | Allow within scope | Patch source, add tests, update docs | Protected paths; no writes outside the repo |
| Execute known tooling | Allow known, deny unknown | cargo test, npm test, formatters | Narrow command families; fail closed on unknown |
| Network | Ask or deny | Downloads, package installs, API calls | Destination allowlist; never secret-bearing requests |
| Secrets | Deny | Environment dumps, SSH keys, cloud credentials | Path and command blocks; separate credential store |
| Production change | Require approval | Deploys, migrations, infrastructure apply | Named human approval; exact action and environment |
| Destructive action | Block | Recursive delete, table drops, force pushes | Explicit rule; no broad allow above it |
| Spend | Require approval | Paid APIs, cloud provisioning, paid data | Amount threshold; named owner |
This is why a programmable guard beats a binary “auto-approve” switch. The team decides which capabilities are routine and which are exceptional. The decision is written down once, reviewed like code, and applied consistently to every agent and every developer.
A practical policy
Rules are ordered. The first match wins, so write the most restrictive rules first and keep
allow rules narrow. The example below is intentionally small; a production policy
should cover the tools your team actually grants.
when tool eq 'Bash' and command contains 'rm -rf' then block
when tool eq 'Bash' and command matches 'git push .*--force' then require_approval
when tool eq 'Bash' and command starts_with 'kubectl ' and env eq 'production' then require_approval
when tool eq 'Write' and file_path contains '.env' then block
when tool eq 'Bash' and command starts_with 'npm test' then allow
when tool eq 'Bash' and command starts_with 'cargo test' then allow The allow rules do not say “the agent may do anything.” They say “these two test commands are routine.” Everything else either matches a more specific rule or falls through to the deployment default. That default is the important part.
Human approval where it matters
The goal is not to remove humans. It is to spend human attention on irreducible risk. A person
should approve a production deploy, a schema migration, a credential boundary crossing, or a
spend event. A person should not be asked to re-approve cargo test for the twentieth
time in a session.
An approval should be tied to the exact action: the command, the target environment, the actor, and an expiry. “Approve all future deploys” is a different decision from “approve this deploy now.” The policy should make that distinction explicit and log both outcomes.
Teams and change control
A guard policy is operational code. Treat it that way:
- One baseline. The organisation sets a floor that every repository inherits.
- Repository overrides. A repo can add rules, but it cannot silently weaken the baseline.
- Reviewed exceptions. Exceptions are narrow, owned, and time-boxed.
- Versioned profiles. Rules ship with semver and a lock file; changes are reviewed before rollout.
- No background auto-update. A policy change happens when someone deliberately updates it.
- Audit trail. Every allow, block and approval records the rule and the action, not the prompt contents.
This is governance without a committee in every loop. The team agrees on capabilities once, then the guard applies the agreement at machine speed.
What Guard is not
Guard is not a sandbox. It cannot make an unsafe command safe, and it cannot contain a process that already has the credentials to do damage. Pair it with filesystem boundaries, network egress controls, scoped credentials and a real sandbox where the risk justifies one.
Guard is not a replacement for code review either. It governs execution, not intent. A reviewed policy can still miss a novel technique. The point is to make the common path deterministic and leave the uncommon path visibly exceptional.
Guard is also not an argument for granting broad credentials. The safest policy is still the one that gives the agent only the access the task needs.
Threat model and limits
Command matching is a security boundary only if it is treated like one. A naive substring check is easy to evade with wrappers, aliases, interpreters, encoded payloads or a different tool that does the same thing. A production policy needs to inspect the full command chain, understand the tools it allows, and fail closed on anything it does not recognise.
- Shell composition. Pipes, subshells, command substitution and redirection can change the meaning of a command. Parse the whole action, not just the first token.
- Unknown executables. “Unknown” is not “safe.” Deny or require approval by default.
- MCP and non-shell tools. A file-writing MCP tool or a cloud API is an action too. Give it the same capability review.
- Network and credentials. A command that looks harmless can exfiltrate data if it has a token. Scope credentials independently of command policy.
- Policy integrity. If an attacker can rewrite the guard, the guard is decorative. Sign or review policy changes and keep the enforcement path outside the agent’s write scope.
No policy covers unknown attack vectors. Defence in depth is the honest answer: policy, sandbox, least-privilege credentials, egress control, and human review for irreversible actions.
Rolling it out
Start in observe mode. Record what the agent attempts, which rules would fire, and how often a human would be interrupted. Promote rules to enforcement only after the false-positive rate is understood. Measure blocked actions, approvals, overrides, and time-to-merge. A policy that makes developers fight the guard will be disabled; a policy that catches the one deploy that should not happen will survive.
Then test the policy like code: known-safe actions must pass, known-dangerous actions must fail, and every bypass the team can think of gets a regression case. The rule set is not done when it is written. It is done when it is exercised.
The operating principle is simple: the agent proposes, the guard decides, and a human owns the irreducible risk. That is how a team increases agent velocity without making every command a negotiation.