clank is an AI sandbox, pre-configured to quickly start using AI.
Note
This tool is designed for internal use at Magenta. It is open source, so you're allowed to use it and fork it, but we may not be able to help you if you don't work at Magenta.
We would like feedback from your experience with using Clank, please write your complaints in this hedgedoc.
Clank is built using the Nix package manager.
sudo apt install -y nix uidmap
echo 'experimental-features = nix-command flakes' | sudo tee -a /etc/nix/nix.conf
sudo usermod -aG nix-users $USERAt this point you need to log out and in again to effectuate the change to your user's groups.
Through the power of Nix, you can run Clank without installing anything else.
nix run github:magenta-aps/clankThis mounts the current directory into a sandbox, which the AI will have full
access to, so maybe don't do it in a directory with sensitive data. Get the
vibes going by running opencode or claude. See below for more.
{
inputs = {
clank = {
url = "github:magenta-aps/clank";
# inputs.nixpkgs.follows = "nixpkgs";
};
};
}{clank, pkgs, ...}: {
environment.systemPackages = [
clank.packages.${pkgs.stdenv.hostPlatform.system}.default
];
}alias clank='nix run github:magenta-aps/clank --'See the OpenCode documentation for a list of providers.
- Gemini: run
opencodeand then/connecttoGoogle. The API key is here. We recommend theGemini 3.1 Pro Previewmodel. - Scaleway: run
opencodeand then/connecttoScaleway. The API key is here. We don't recommend any of these models, as they're all kinda bad.
Anthropic doesn't allow using OpenCode with a Claude subscription, so we have
to use Claude Code. Open claude and then /login using Claude account with subscription - make sure to Continue with email, not Google.
Due to a bug, you
can't use regular /login if you want to use multiple concurrent Claude Code
sessions. In this case, run claude setup-token and add the resulting token to
~/.config/clank.sh (on the host):
export CLAUDE_CODE_OAUTH_TOKEN='<your-access-token-here>'CLANK_PODMAN_OPTS='--publish=127.0.0.1:4096:4096' clank opencode web --hostname=0.0.0.0 --port=4096git clone https://github.com/magenta-aps/clank.git
nix run ~/clankrm ~/.config/clank.sh
nix run nixpkgs#podman -- rm --force --filter 'name=^clank'
nix run nixpkgs#podman -- volume rm clank-persist