tbsklg

Confine.Nix — AI skill for Claude Code

AI community

Sandbox for AI coding agents on macOS, declared in Nix, enforced by the kernel.

How to install Confine.Nix

This entry records only its repository, not the path inside it, so there is no exact command to give. Open tbsklg/confine.nix and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Confine.Nix does

Sandbox for AI coding agents on macOS, declared in Nix, enforced by the kernel.

Alternatives in AI

  • Agent Kernel — Minimal kernel to make any AI coding agent stateful 334 ★
  • Cplt — Sandbox for AI coding agents 114 ★
  • Enso OS — The first AI plugin that speaks first 88 ★

README

confine.nix

A sandbox for any command-line program on macOS: a coding agent, a test runner, an install script you don't trust.

You write a `confine.toml`: which program runs, which tools it may use and which API it may reach. confine starts the program under a Seatbelt profile that denies everything else. Your credentials stay outside the sandbox: a gateway adds an API's key, and a broker runs your tools with their own logins.

confine uses [Nix](https://nixos.org) to build the programs the sandbox may run and to keep them read-only.

This reduces what the program can reach, but it is not a complete isolation boundary; see [Security limits](docs/README.md#security-limits). Apple Silicon only.

Quickstart

This sets up Claude Code as the program. You need [Nix](https://nixos.org/download) with flakes, and a Claude login: run `claude` once outside confine and log in.

mkdir -p ~/.confine/envs/dev && cd ~/.confine/envs/dev
nix flake init -t github:tbsklg/confine.nix
nix profile add .

Then, in a project:

confine-dev claude

The env is configured in `~/.confine/envs/dev/confine.toml`, where the sandbox can't read or change it:

#:schema ./confine.schema.json

name = "dev"
preset = "claude"

[gateway.anthropicOauth]

After editing it, run `nix profile upgrade --all`. Until then, `confine-dev` keeps using the sandbox you installed.

Documentation

Presets, gateways a