Daily AI recipesWorkVerified Aug 19, 2026

Set Up a Claude Code Sandbox in 5 Minutes: Isolate the AI Agent from Your System

Enable the built-in sandbox, block access to credentials, and automate permissions - the agent can't do harm even if it's «hacked».

  1. 1.Install Claude Code if you haven't yet. Open a terminal and run the install command.

    Requires Node.js LTS. Installation is free; Anthropic signup is by email with no card needed.

    Claude Code About this tool
    Prompt
    npm install -g @anthropic-ai/claude-code
    What this prompt doesGlobal package installation. After installing, type claude to launch and complete the quick setup (Anthropic account).
  2. 2.Launch Claude Code and open the sandbox panel - type /sandbox in a session.

    If the sandbox requires installing dependencies (bubblewrap, socat), follow the instructions on the Dependencies tab in the panel. On Ubuntu: sudo apt install bubblewrap socat.

    Claude Code About this tool
    Prompt
    /sandbox
    What this prompt doesThis command opens the sandbox control panel in the Claude Code interface.
  3. 3.Create or edit the file ~/.claude/settings.json and add the configuration to isolate credentials.

    The file is not committed to Git. Replace the paths with your real secret files (for example, ~/.env).

    Claude Code About this tool
    Prompt
    {
      "sandbox": {
        "enabled": true,
        "credentials": {
          "files": [
            { "path": "~/.aws/credentials", "mode": "deny" },
            { "path": "~/.ssh", "mode": "deny" }
          ],
          "envVars": [
            { "name": "GITHUB_TOKEN", "mode": "deny" }
          ]
        }
      }
    }
    What this prompt doesThis JSON snippet blocks reading AWS keys, the SSH folder, and the GITHUB_TOKEN variable. Paste it into settings.json. You can add other files and variables.
  4. 4.In the /sandbox panel, switch Mode to «Auto-approve» - commands inside the sandbox will run without prompts, since the boundary is enforced by the operating system.

    For maximum security, leave it on «Ask». Auto-approve is convenient for automation but reduces control. This mode is a sensible replacement for the --yes flag.

    Claude Code About this tool
  5. 5.Test the isolation: ask the agent to read a protected file. If the sandbox is working, you'll get an access error.

    The file ~/.aws/credentials must be inaccessible. If it is readable, check the sandbox.credentials settings and restart the session.

    Claude Code About this tool
    Prompt
    Read the contents of the file ~/.aws/credentials
    What this prompt doesA test request to the agent. The response should be an access-denied (permission denied) message.
💰 What it costs to followprices as of 2026-08
  • freeClaude Code (free tier)Free for personal use with a daily request limit (see Anthropic's page for details). No credit card required.
  • freeNode.jsFree, JavaScript runtime.
Try it and be the first to check in

Why today

AI services change fast - interfaces and free limits may differ from what's described.