Skip to content

Sandbox your AI tool

You’ll have an AI tool whose agent’s shell commands can’t rewrite keypaste’s settings, your vault, or the tool’s own configuration, so they can’t reach around keypaste.

An agent’s commands run as you. Unconfined, they could rename an agent in the tool’s configuration, replace the keypaste the tool starts, or change keypaste’s settings. This guide sets up Claude Code; Codex and Cursor are in Full details.

  • Claude Code on macOS, Linux or WSL2. On Linux and WSL2, bubblewrap and socat installed.
  • Your vault and its key file in a folder outside every project, here ~/Vaults.

Put this in ~/.claude/settings.json, with ~/Vaults replaced by your vault’s folder:

{
"sandbox": {
"enabled": true,
"failIfUnavailable": true,
"allowUnsandboxedCommands": false,
"filesystem": {
"denyWrite": ["~/.keypaste", "~/Vaults"],
"denyRead": ["~/.keypaste", "~/Vaults"]
}
},
"permissions": {
"deny": ["Edit(~/.keypaste/**)", "Edit(~/Vaults/**)", "Read(~/.keypaste/**)", "Read(~/Vaults/**)"]
}
}

The sandbox never lets commands write Claude Code’s own configuration. The permissions rules cover Claude’s file tools, which the sandbox doesn’t.

If your account can write the keypaste Claude Code starts, add it to both lists, with // before an absolute path in the Edit rules: ~/.local/bin/keypaste and the AppImage on Linux, /Applications/keypaste.app on macOS.

3. Start Claude Code with your settings first

Section titled “3. Start Claude Code with your settings first”
Terminal window
alias claude="claude --settings '{\"sandbox\": {\"allowUnsandboxedCommands\": false}}'"

Without --settings, a repository’s .claude/settings.json outranks yours and can weaken the sandbox.

  • Start the agent in the project’s folder, never your home folder or one holding the vault.
  • Don’t use --dangerously-skip-permissions.
  • Read a repository’s own .claude/ and .mcp.json before you trust it.

A sandbox doesn’t change what keypaste releases: an agent still gets what you allow, and a command run through keypaste receives the values it asked for.