ClawMart AI
← Back to Blog
August 18, 20268 min readClaw Mart Team

OpenClaw Security Settings: Keep Your Local AI Agent Safe

OpenClaw Security Settings: Keep Your Local AI Agent Safe

OpenClaw Security Settings: Keep Your Local AI Agent Safe

Let's cut to it: most people running local AI agents have basically no security. They spin up an agent, give it access to their filesystem, maybe an API key or two, and cross their fingers. It works until it doesn't — and when it doesn't, you're staring at a $500 API bill, a deleted folder, or your credentials plastered across a debug log.

I've seen this play out dozens of times across Reddit threads, Discord servers, and GitHub issue trackers. The same story every time. Someone builds something cool with an agent framework, deploys it with default settings, and then something breaks spectacularly. The agent loops. The agent overspends. The agent accesses something it shouldn't. The agent leaks a secret.

OpenClaw was built with these failure modes in mind. It's one of the few agent frameworks where security isn't an afterthought bolted on — it's woven into how agents operate. But here's the thing: having good security features doesn't matter if you don't know how to configure them. So let's walk through the settings that actually matter, how to set them up, and the specific configurations that'll keep your local AI agent from becoming a liability.

The Core Problem: All-or-Nothing Access

The complaint I see more than any other goes something like this: "I want my agent to read files but not delete them. Why is this so hard?"

In most frameworks, it is hard. You either give full tool access (dangerous) or no access (useless). There's no middle ground without writing custom wrappers for every single tool, which nobody actually does.

OpenClaw fixes this with its policy system. Policies are declarative rules that define exactly what an agent can and can't do, down to the specific action on a specific resource.

Here's what a real policy looks like:

from openclaw import Agent, Policy, FileSystemTool

read_only_policy = Policy(
    name="safe_file_access",
    rules=[
        {
            "resource": "filesystem",
            "paths": ["/home/user/documents/**"],
            "actions": ["read", "list"],
            "deny_actions": ["write", "delete", "execute"]
        },
        {
            "resource": "filesystem",
            "paths": ["/home/user/output/**"],
            "actions": ["read", "write", "create"],
            "deny_actions": ["delete"]
        }
    ]
)

agent = Agent(
    name="document_analyzer",
    tools=[FileSystemTool()],
    policy=read_only_policy
)

This agent can read anything in /documents, write new files to /output, but can't delete a single thing anywhere. That's the granularity you need. Not "filesystem: yes/no" but "this folder, these actions, nothing else."

The deny rules are explicit too. You're not hoping the agent won't try to delete something — you're telling the framework to block it at the permission layer before the action ever executes.

Audit Logging: Know What Your Agent Actually Did

The second most common complaint: "My agent ran for three hours and I have no idea what it did."

This isn't just a debugging problem. It's a trust problem. If you can't explain what your agent did, you can't deploy it in any context where accountability matters. Your boss asks what happened, your security team wants a report, or you just want to understand why the output looks wrong — and you've got nothing.

OpenClaw's audit logger captures everything by default:

from openclaw import Agent, AuditLogger

agent = Agent(
    name="research_agent",
    audit_logger=AuditLogger(
        log_level="detailed",
        include_reasoning=True
    )
)

await agent.execute("Research competitor pricing")

Every action generates a structured log entry:

{
  "action_id": "act_123",
  "timestamp": "2026-01-15T10:23:45Z",
  "agent": "research_agent",
  "action": "web_search",
  "parameters": {"query": "competitor pricing 2026"},
  "permission_check": "passed",
  "policy_applied": "read_only_web",
  "cost": "$0.003",
  "result": "success",
  "reasoning": "User requested pricing research, read-only access approved"
}

Timestamp. Tool used. Parameters sent. Permission check result. Cost. Success or failure. Reasoning. All of it, for every action. This is what compliance teams want to see. It's also what you want to see when you're trying to figure out why your agent went sideways at 2 AM.

Resource Limits and Circuit Breakers: The Emergency Brake

Here's a horror story that's played out across multiple Reddit threads: someone kicks off an AutoGPT session before bed, wakes up, and finds a $500 OpenAI bill. The agent got stuck in a loop — searching, browsing, searching, browsing — burning tokens the entire time with no guardrails.

OpenClaw has two mechanisms that prevent this: resource limits and circuit breakers.

from openclaw import Agent, ResourceLimits, CircuitBreaker

agent = Agent(
    name="api_agent",
    limits=ResourceLimits(
        max_actions_per_session=50,
        max_cost_per_session=10.00,
        max_api_calls_per_minute=10,
        max_execution_time=300,
        max_retries=3
    ),
    circuit_breaker=CircuitBreaker(
        failure_threshold=5,
        timeout=60
    )
)

The resource limits are straightforward: cap actions, cap cost, cap time, cap retries. When any limit is hit, the agent stops cleanly and tells you why.

The circuit breaker is more nuanced. If the agent hits five consecutive failures, it pauses for 60 seconds. This prevents the hammering-a-broken-API pattern that gets your account rate-limited or banned. After the timeout, it can try again — but if it fails again, it stops for good.

The difference this makes in practice is dramatic. Instead of an uncontrolled session that runs up hundreds of dollars, you get a controlled execution that stops at $10 and sends you a notification. You can review the audit log, understand what happened, adjust the task, and try again.

Preset Policies: Security That Doesn't Require a PhD

The most honest complaint I've read was from someone on Hacker News: "Spent 2 days trying to configure permissions, gave up and ran with --no-security."

I get it. Security that's too complex to configure correctly is security that nobody uses. This is where OpenClaw's preset policies come in — pre-built security configurations for common use cases that you can apply in one line:

from openclaw import Agent, preset_policies

agent = Agent(
    name="research_bot",
    policy=preset_policies.WEB_RESEARCH_SAFE
)

That's it. The WEB_RESEARCH_SAFE preset gives your agent rate-limited web search, read-only browsing, no file access, and no code execution. Secure defaults, zero configuration.

There are presets for the most common patterns:

  • WEB_RESEARCH_SAFE — Web search and browsing, nothing else
  • FILE_PROCESSOR — Read from input folder, write to output folder, no network
  • CUSTOMER_SERVICE — Read customer data (PII redacted in logs), create tickets, send template emails, no deletions
  • DEVELOPMENT_ASSISTANT — Read/write in project folder, run sandboxed tests, search docs, no system access outside the project

If you need something custom, you can also write policies in a human-readable YAML format:

allow:
  - read files in /documents
  - search web (max 10 requests/min)
  - send emails to @company.com

deny:
  - delete any files
  - execute code
  - access environment variables

limits:
  max_cost: $5
  max_time: 10 minutes

You can read that and immediately understand what the agent can and can't do. No cryptic IAM policy syntax. No JSON nested six levels deep. Just plain statements about what's allowed.

If you don't want to set all of this up manually, Felix's OpenClaw Starter Pack on Claw Mart includes pre-configured skills with sensible security policies already baked in. For $29, you get a bundle of ready-to-use agent configurations that follow these best practices out of the box — including preset policies, audit logging, and resource limits. It's genuinely the fastest way to get running with a secure setup if you'd rather skip the configuration phase and start building.

Simulation and Dry-Run Modes: Test Without Consequences

Another underappreciated problem: how do you test an agent that sends emails, writes to databases, or calls paid APIs? In most frameworks, you just... run it. With real side effects. Using real credentials. Spending real money.

OpenClaw has a proper testing pipeline:

from openclaw import Agent, SimulationMode

agent = Agent(
    name="email_agent",
    mode=SimulationMode(
        simulate_tools=["email", "database", "api"],
        record_intent=True,
        cost_calculation=True
    )
)

result = await agent.execute("Send weekly report to all customers")

print(result.simulation_report)
# {
#   "actions_planned": [
#     {"tool": "database", "action": "query_customers", "count": 1500},
#     {"tool": "email", "action": "send", "count": 1500, "cost": "$1.50"}
#   ],
#   "estimated_cost": "$1.53",
#   "estimated_time": "3m 45s",
#   "policy_violations": [],
#   "actual_execution": False
# }

The agent plans and reasons through the entire task, but nothing actually fires. You see exactly what it would do, how much it would cost, and whether any policy violations would occur. Then you can promote through stages:

  1. Simulation — Plans actions, doesn't execute anything
  2. Dry-run — Checks all permissions, still doesn't execute
  3. Sandbox — Real execution in an isolated environment with mock external services
  4. Production — Full execution with all guardrails active

This is how mature software deployment works, and it's how agent deployment should work too. The fact that most frameworks skip straight to production with no testing layer is genuinely reckless.

Human-in-the-Loop Approval: The Runtime Kill Switch

Static permissions are good. Runtime controls are better.

Sometimes an agent needs to do something sensitive, and the right answer isn't to block it forever — it's to ask a human first. OpenClaw's approval workflow lets you define exactly which actions require human sign-off:

from openclaw import Agent, ApprovalWorkflow

agent = Agent(
    name="admin_agent",
    approval_workflow=ApprovalWorkflow(
        require_approval_for=[
            "delete",
            "cost > $1.00",
            "database.write",
            "email.send_count > 10"
        ],
        timeout=300,
        notify_channels=["slack", "email"]
    )
)

When the agent hits one of these thresholds, it pauses, sends you a notification with exactly what it wants to do and why, and waits for approval. If you don't respond within five minutes, it auto-denies. And if something goes truly sideways, you can hit the emergency stop from anywhere:

agent.emergency_stop(reason="Suspicious behavior detected")

This isn't just a nice-to-have. For financial agents, customer-facing agents, or anything that touches production data, human-in-the-loop approval is the difference between "we use AI responsibly" and "we let an algorithm make unchecked decisions."

Credential Protection: Stop Leaking Secrets

The last thing I'll mention because it's the one that keeps security teams up at night: credential exposure. I've seen Reddit posts where people found their API keys in plaintext in framework debug logs. AWS credentials printed in agent output. Customer PII in error messages.

OpenClaw automatically redacts sensitive information from all logs and outputs. You configure what to look for:

from openclaw import Agent, PIIRedactor

agent = Agent(
    name="customer_service",
    redactor=PIIRedactor(
        detect=["email", "phone", "ssn", "credit_card", "api_key"],
        redaction_method="hash"
    )
)

When the agent processes john.doe@email.com, the audit log shows [EMAIL_REDACTED_SHA256:a1b2c3...]. The agent still functions — it can still use the email to do its job — but the logs never contain the raw value. This is table stakes for any deployment that handles personal data, and it's wild that most frameworks don't include it.

What to Do Right Now

If you're running an OpenClaw agent today, here's the priority order:

  1. Add a preset policy. Even if you do nothing else, go from no security to preset_policies.WEB_RESEARCH_SAFE or whichever preset fits your use case. One line of code, massive improvement.

  2. Set resource limits. At minimum, set max_cost_per_session and max_execution_time. These are your financial and temporal circuit breakers.

  3. Enable audit logging. You'll thank yourself the first time something goes wrong and you can actually see what happened.

  4. Use simulation mode for new tasks. Before you let an agent do something new in production, run it in simulation first. See what it plans to do. Then promote it.

  5. Add PII redaction if you handle any personal data. Non-negotiable for anything customer-facing.

  6. Set up approval workflows for high-risk actions. Anything involving deletion, significant cost, or external communication should have a human checkpoint.

If you want all of this preconfigured and ready to go from day one, seriously consider grabbing Felix's OpenClaw Starter Pack. It bundles these security patterns into skills you can deploy immediately, and at $29 it'll save you a weekend of configuration and testing. I've seen too many people run insecure agents because the setup felt overwhelming — this removes that excuse entirely.

Security doesn't have to be the thing you skip because it's too hard. OpenClaw made it configurable, auditable, and — for once — actually practical. Use it.

Recommended for this post

Complete ClawArmor security suite — 5 skills, one purchase, 31% off

All platformsOps
CI
Clawgear IO
$79Buy

Claw Mart Daily

Get one AI agent tip every morning

Free daily tips to make your OpenClaw agent smarter. No spam, unsubscribe anytime.

More From the Blog