提交记录修改README.md+23 −1看文件
修改claude-vm.sh+1 −1看文件
| @@ -33,7 +33,7 @@ echo "source $(pwd)/claude-vm.sh" >> ~/.bashrc # or bash | ||
| 33 | 33 | claude-vm-setup |
| 34 | 34 | ``` |
| 35 | 35 | |
| 36 | 删除:Creates a VM template with dev tools, Docker, Chromium, and Claude Code pre-installed. You'll be prompted to authenticate Claude during setup. | |
| 36 | 新增:Creates a VM template with dev tools, Docker, Chromium, and Claude Code pre-installed. During setup, Claude will launch once for authentication. After it responds, type `/exit` to continue with the rest of the setup. (We haven't found a way to automate this step yet.) | |
| 37 | 37 | |
| 38 | 38 | ### Run Claude in a VM |
| 39 | 39 | |
| @@ -94,6 +94,28 @@ Ports opened inside the VM (e.g. by Docker containers) are automatically forward | ||
| 94 | 94 | | Containers | docker | |
| 95 | 95 | | AI | Claude Code, Chrome DevTools MCP server | |
| 96 | 96 | |
| 97 | 新增:## Why a VM? | |
| 98 | 新增: | |
| 99 | 新增:Running an AI agent with full permissions is powerful but risky. Here's how the options compare: | |
| 100 | 新增: | |
| 101 | 新增:| | No sandbox | Docker | VM (agent-vm) | | |
| 102 | 新增:|---|---|---|---| | |
| 103 | 新增:| Agent can run any command | Yes | Yes | Yes | | |
| 104 | 新增:| File system isolation | None | Partial (shared kernel) | Full | | |
| 105 | 新增:| Network isolation | None | Partial | Full | | |
| 106 | 新增:| Can run Docker inside | Yes | Requires DinD or socket mount | Yes (native) | | |
| 107 | 新增:| Kernel-level isolation | None | None (shares host kernel) | Full (separate kernel) | | |
| 108 | 新增:| Protection from container escapes | None | None | Yes | | |
| 109 | 新增:| Browser / GUI tools | Host only | Complex setup | Built-in (headless Chromium) | | |
| 110 | 新增: | |
| 111 | 新增:Docker containers share the host kernel, so a motivated agent could exploit kernel vulnerabilities or misconfigurations to escape. A VM runs its own kernel — even if the agent gains root inside the VM, it can't reach the host. | |
| 112 | 新增: | |
| 113 | 新增:A VM also avoids the practical headaches of Docker sandboxing. Docker runs natively inside the VM without Docker-in-Docker hacks or socket mounts. Headless Chromium works out of the box without fiddling with `--no-sandbox` flags or shared memory settings. Lima automatically forwards ports from the VM to your host, so if the agent starts a server on port 3000, it's immediately accessible at `localhost:3000`. The agent gets a normal Linux environment where everything just works. | |
| 114 | 新增: | |
| 115 | 新增:Finally, using a VM means you don't need Node.js, npm, Docker, or any other dev tooling installed on your host machine. The only host dependency is Lima. All the tools (and their vulnerabilities) live inside the VM. | |
| 116 | 新增: | |
| 117 | 新增:For AI agents running with `--dangerously-skip-permissions`, a VM is the only sandbox that provides meaningful security. | |
| 118 | 新增: | |
| 97 | 119 | ## License |
| 98 | 120 | |
| 99 | 121 | MIT |
| @@ -73,7 +73,7 @@ claude-vm-setup() { | ||
| 73 | 73 | |
| 74 | 74 | # Authenticate Claude (saves token in template, inherited by clones) |
| 75 | 75 | echo "Setting up Claude authentication..." |
| 76 | 删除: limactl shell "$CLAUDE_VM_TEMPLATE" bash -lc "claude setup-token" | |
| 76 | 新增: limactl shell "$CLAUDE_VM_TEMPLATE" bash -lc "claude 'Ok I am logged in, I can exit now.'" | |
| 77 | 77 | |
| 78 | 78 | # Configure Chrome DevTools MCP server for Claude |
| 79 | 79 | echo "Configuring Chrome MCP server..." |

