brig README

项目的 README,来自 github.com/brig-sh/brig。合并为一个 markdown 文件:README.md。

brig

Release CI Coverage Go License: Apache 2.0

Brig runs a coding agent, such as Claude Code, inside a microVM on your own machine.

The agent gets a kernel and a home directory of its own, and works on the one project you name. It does not see the rest of your disk, your keychain or your SSH agent. So you can let it work without approving each command, and the only host files it can change are that project and its own home.

Terminal recording. brig run opens Claude Code in a sandbox, in /work/demo. Asked to write hello.py and run it, Claude writes the file, runs it and lists the directory. After exit, ls on the host shows hello.py in the project.

Install

Host Supported
Mac, Apple silicon, macOS 15 or newer Yes
Mac, Apple silicon, macOS 14 Yes, with BRIG_HYPERVISOR=vz BRIG_NETWORK=shared set for each run
Intel Mac No
Linux, x86-64 or arm64, with KVM Yes

On macOS, install with Homebrew:

brew tap brig-sh/brig
brew trust brig-sh/brig
brew install --cask brig

On Linux, install Brig and its runtime for the whole machine. This needs root:

curl -fsSL https://raw.githubusercontent.com/brig-sh/brig/main/install.sh | sudo sh

After this install, run every brig command as root, for example sudo brig doctor. Install covers a Mac without Homebrew, a Linux install for one user without root, and a build from source.

First run

Use a new, empty directory as the project, because the agent can change any file in it.

brig doctor                      # check the host
mkdir -p ~/code/demo
brig run claude ~/code/demo      # start a sandbox and run Claude Code in it

The first run downloads the guest image and the boot assets. Claude Code then asks you to log in inside the sandbox, so you need an Anthropic account. With no account, run brig run ubuntu ~/code/demo instead. It opens a root shell in the sandbox and needs no login.

The agent starts in /work/demo, which is ~/code/demo on the host. Ask it to create a file there, then exit the agent. The file is in ~/code/demo on the host.

The sandbox keeps running after the agent exits, so the next brig run claude starts at once. When you are done:

brig stop claude                 # stop the sandbox, keep its guest home
brig rm claude                   # remove the sandbox and its guest home

brig stop and brig rm do not touch ~/code/demo. Delete it yourself when you no longer need it. Quickstart shows the same steps with the output of each.

What the sandbox can reach

Security states each limit in full.

Next steps

The documentation index lists every page. The site brig.sh/docs has the same documentation, edited for the web.

Project

Brig has not reached 1.0, and a minor release can make breaking changes. Stability lists what you can script against, and Non-goals lists what Brig will not do.

NOFire AI

brig (brig-sh/brig)

正在搜索数据库…

这是什么?Brig 是一个 Go 命令行工具(brig),带有一个会话守护进程(brigd),可以在你自己电脑上的 microVM 沙箱里运行编程代理,这样无人值守的代理最多只能损坏你交给它的那一个项目。
那我实际运行的是什么——命令行工具、服务,还是虚拟机?既是命令行工具也是守护进程:一条命令就能启动一个 microVM 沙箱并在其中运行代理,而且每个命令都可以用会话引用来操作,比如 claude 或 claude@refactor。
怎么安装?第一次运行是什么样的?安装 Homebrew cask 即可——它会一并带上 hull 运行时和 cosign;install.sh、Linux 和源码构建方式见 docs/install.md。第一次运行会拉取客户机镜像和启动所需的资源文件,所以会比较慢。
我的电脑能跑吗,还是需要特殊硬件?需要 macOS 15 或更新版本的 Apple Silicon Mac;macOS 14 可以通过设置 BRIGHYPERVISOR=vz 来运行,Intel Mac 不受支持。x86-64 或 arm64 架构的 Linux 也可以,但需要 nerdctl、containerd 和 urunc shim。
这个代理到底被限制得多严?项目目录以读写方式挂载,里面放的是你的真实文件,所以代理可以改动目录下的任何内容。在默认的共享网络下,它还能访问互联网——凡是它能读到的内容,它都能发出去。
代理会不会偷看我的其他文件、密码或 SSH 密钥?不会:沙箱启动时不含任何凭据,只有当代理需要你登录时,你才会提供凭据。它拿不到你主机上的其他目录、钥匙串或 SSH agent。
为什么非要把编程代理放进沙箱里运行?无人值守的代理最多只能损坏你交给它的东西:把它指向一个项目,一次糟糕的修改或一条糟糕的命令最多波及到那个项目为止。用完之后,你把沙箱整个丢掉,从头再来就是干净的。
开箱即用支持哪些编程代理?内置了 Claude Code:会话名 claude 会解析到 claude-code 代理,它会在首次运行时让你在沙箱内登录。要运行自己的代理请看 docs/profiles.md,要使用自己的客户机镜像请看 docs/guest-image.md。
有哪些类似的项目?coop, nvx, smolvm, box, devvm, arcbox, CubeSandbox, agentbox
作者
brig-sh
大小
26.9 MB
星标
270
时长
3个月
提交 · 90 天