2026-01-26 · Authensor

Switching from allow-by-default to deny-by-default is the single most impactful change you can make to your AI agent's safety posture. SafeClaw by Authensor implements deny-by-default action gating where every action is blocked unless explicitly permitted by policy. Install it with npx @authensor/safeclaw to make this transition with a tested, production-ready policy engine.

Why Deny-by-Default Is Superior

Allow-by-default means your agent can do anything unless you specifically block it. You must anticipate every dangerous action and write a rule to prevent it. You will always miss something. Every new capability the agent discovers is automatically permitted.

Deny-by-default means your agent can do nothing unless you specifically allow it. You only need to define the actions your agent legitimately needs. Unknown actions are blocked automatically. Every new capability the agent discovers is blocked by default until you explicitly permit it.

This is the same principle that governs firewall rules, container security policies, and zero-trust network architectures. It works because the set of "things the agent should do" is small and knowable, while the set of "things the agent should not do" is vast and unknowable.

The Migration Challenge

The hardest part of switching to deny-by-default is not the technical implementation. It is building confidence that your allow list is complete enough for your agent to function. SafeClaw's simulation mode solves this problem.

Step-by-Step Migration

Step 1: Install SafeClaw

npx @authensor/safeclaw

Step 2: Run in Observation Mode

Start SafeClaw in simulation mode with no policy. This logs every action your agent attempts without blocking anything:

safeclaw.init({
  mode: 'simulation',
  audit: true
});

Run your agent through all of its typical workflows. Let it process real tasks. The audit log captures a complete picture of what your agent actually does.

Step 3: Categorize Actions

Review the audit log and sort actions into categories:

Must allow: Actions essential to the agent's core function. These become your allow rules.

Should approve: Actions that are sometimes needed but carry risk. These become approval rules requiring human sign-off.

Should deny: Actions the agent attempts that it should not. These are already handled by the default deny.

Unexpected actions: Actions you did not know the agent performed. Investigate these. Some may need allow rules. Many reveal unnecessary risk.

Step 4: Write Your Policy

Create a deny-by-default policy with explicit allows:

rules:
  # Core file operations
  - action: "file:read"
    path: "/project/src/**"
    effect: "allow"
  - action: "file:write"
    path: "/project/src/**"
    effect: "allow"

# Approved commands
- action: "shell:execute"
command: "npm test"
effect: "allow"
- action: "shell:execute"
command: "npm run build"
effect: "allow"

# Approved network access
- action: "network:request"
host: "api.github.com"
effect: "allow"

# High-risk actions requiring approval
- action: "shell:execute"
command: "npm publish*"
effect: "approve"

# Everything else is denied by default

Step 5: Test with Simulation + Policy

Apply your policy in simulation mode to see what would be blocked:

safeclaw.init({
  mode: 'simulation',
  policy: './safeclaw-policy.yaml',
  audit: true
});

Run your agent through its workflows again. Check for legitimate actions that are being denied. Adjust your policy. Repeat until no legitimate actions are blocked.

Step 6: Enable Enforcement

When your policy is validated:

safeclaw.init({
  mode: 'enforce',
  policy: './safeclaw-policy.yaml',
  audit: true
});

Your agent now operates under deny-by-default. Every action not in your allow list is blocked. The hash-chained audit trail records every decision.

Step 7: Iterate

Deny-by-default policies evolve. As your agent's needs change, add new allow rules through the same simulation-then-enforce cycle. The key principle is that new permissions are added deliberately, not by default.

Common Concerns

"My agent will break." Not if you use simulation mode first. The observation period catches every action your agent needs. Start with a permissive policy and tighten over time if you prefer a gradual transition.

"This is too restrictive." Deny-by-default is not about restricting your agent. It is about ensuring your agent only does what you intend. If your agent needs an action, add it to the policy. The point is that the action is intentional, not accidental.

"This adds too much overhead." SafeClaw's policy evaluation adds negligible latency. The time investment is in writing the policy, and simulation mode does most of that work for you.


Related reading:

Try SafeClaw

Action-level gating for AI agents. Set it up in your browser in 60 seconds.

$ npx @authensor/safeclaw