How to Run AI Agents on Your Laptop Safely
You want to use AI to help you code. You have heard about Claude Code, GPT-based agents, or LangChain tools that can write files, run commands, and build entire features on your behalf. You want that productivity. But your laptop has your SSH keys, your AWS credentials, your .env files with API tokens, your personal documents, and years of work. You do not want an AI agent touching any of that.
This is the guide for you. One install, one command, and your AI agent is contained. No deep technical knowledge required.
The Problem in Plain Terms
AI coding agents are not just chatbots. They act on your computer. When you give an AI agent access to your terminal or file system, it can:
- Write files anywhere on your computer, not just your project folder
- Run shell commands including ones that delete files, install software, or modify system settings
- Make network requests to any server on the internet
Your laptop is not a disposable server. It has your real credentials, your real files, and your real identity. Running an unrestricted AI agent on it is like handing someone your house keys and saying "just fix the kitchen."
The Solution: SafeClaw
SafeClaw is a security layer that sits between your AI agent and your computer. It checks every action the agent tries to take -- every file it tries to write, every command it tries to run, every network connection it tries to make -- and blocks anything you have not explicitly allowed.
The key concept: nothing is allowed until you say so. This is called deny-by-default. Your agent starts with zero permissions and you add only the ones it needs.
Installing SafeClaw: One Command
You need Node.js installed (version 18 or later). If you are using AI coding tools, you probably already have it. Check with:
node --version
Then install SafeClaw:
npx @authensor/safeclaw
That is it. No configuration files to create. No YAML to write. No Docker containers. One command.
Your browser opens to the SafeClaw dashboard. This is where you set up your rules.
What Happens Next
The dashboard walks you through three steps:
- Create an account. Free tier. No credit card. You get a key that renews every 7 days.
- Pick your agent. Tell SafeClaw whether you use Claude, OpenAI, LangChain, or something else.
- Set your first rules. The wizard suggests a starter policy based on your selection.
Understanding the Rules (Simple Version)
SafeClaw controls three types of actions:
1. File Writes
Which files and folders can the agent create or modify?
You probably want to allow: files in your current project folder.
You definitely want to block: .env files, .ssh directory, .aws directory, anything outside your project.
2. Shell Commands
Which terminal commands can the agent run?
You probably want to allow: npm install, npm test, npm run build, maybe git status.
You definitely want to block: rm -rf, curl to unknown sites, anything that modifies system files.
3. Network Requests
Which websites and APIs can the agent connect to?
You probably want to allow: npm registry (for installing packages), maybe your AI provider's API.
You definitely want to block: everything else.
A Starter Policy That Works
Here is a policy that covers the most common scenario -- an AI coding agent helping you with a JavaScript or TypeScript project:
{
"name": "my-safe-agent",
"rules": [
{
"action": "file_write",
"effect": "deny",
"pathPattern": "*/.env"
},
{
"action": "file_write",
"effect": "deny",
"pathPattern": "/.ssh/"
},
{
"action": "file_write",
"effect": "deny",
"pathPattern": "/.aws/"
},
{
"action": "file_write",
"effect": "allow",
"pathPattern": "/Users/you/projects/my-app/**"
},
{
"action": "shell_exec",
"effect": "allow",
"command": "npm install"
},
{
"action": "shell_exec",
"effect": "allow",
"command": "npm test"
},
{
"action": "shell_exec",
"effect": "allow",
"command": "npm run build"
},
{
"action": "network",
"effect": "allow",
"destination": "registry.npmjs.org"
}
]
}
What this does in plain language:
- The agent can never touch your
.envfiles, SSH keys, or AWS credentials, no matter what. - The agent can write files inside your project folder and nowhere else.
- The agent can run
npm install,npm test, andnpm run build. No other commands. - The agent can download packages from npm. No other network connections.
- Everything not listed here is automatically blocked.
Try Before You Enforce
SafeClaw has a simulation mode. Turn it on before you enforce your rules. In simulation mode, SafeClaw does not actually block anything. Instead, it logs what it would block and what it would allow.
This lets you run your AI agent normally and then review the log. You will see entries like:
- "Would allow: file_write to /Users/you/projects/my-app/src/index.ts" -- good, that is expected.
- "Would deny: file_write to /Users/you/.env" -- good, that is exactly what you want blocked.
- "Would deny: shell_exec git push" -- maybe you want to allow this. Add a rule for it.
What Happens When Something Is Blocked
When your AI agent tries to do something that your rules do not allow, SafeClaw blocks the action. The agent receives a denial. Most agents handle this gracefully -- they report that the action was not permitted and suggest an alternative or ask for guidance.
The blocked action is recorded in SafeClaw's audit trail. This audit trail is tamper-proof: each entry is cryptographically linked to the previous one using SHA-256 hashing. Nobody can go back and edit the log. You always have an accurate record of what your agent tried to do and what was blocked.
Common Questions
Does SafeClaw slow down my agent?
No. Policy evaluation happens in under a millisecond, locally on your machine. There is no network round-trip.
Does SafeClaw send my code to a server?
No. Everything evaluates locally. SafeClaw's client is 100% open source. You can verify this yourself.
What if I need to change my rules later?
Open the dashboard and edit your policy. Changes take effect immediately. Use simulation mode to test changes before enforcing.
Does it work with my AI tool?
SafeClaw works with Claude, OpenAI, and LangChain out of the box. It is built on the Authensor framework, which supports additional integrations.
How much does it cost?
The free tier covers everything in this guide. No credit card required. API keys renew every 7 days.
The Files You Should Always Protect
Regardless of your specific project, always deny write access to these paths:
| Path | What It Contains |
|---|---|
| */.env | API keys, database passwords, secrets |
| /.ssh/ | SSH private keys |
| /.aws/ | AWS credentials and config |
| **/.npmrc | npm authentication tokens |
| **/.gitconfig | Git credentials |
| */id_rsa | SSH key files |
| /.gnupg/ | GPG keys |
| ~/.config/** | Application configs with saved credentials |
Put deny rules for all of these at the top of your policy. First-match-wins means deny rules at the top override any allow rules below them.
Getting Started Right Now
npx @authensor/safeclaw
One command. Browser opens. Set your rules. Run your agent safely.
SafeClaw is built on the Authensor framework with 446 tests, TypeScript strict mode, and zero dependencies. It is the one thing you should install before running any AI agent on your laptop.
Your code, your credentials, your machine, your rules. Visit safeclaw.onrender.com or authensor.com to learn more.
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw