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.
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 an ephemeral sandbox, so maybe don't do
it in a directory with sensitive data. You can run opencode or claude or
gemini, but note that you will have to manually log in every time. See the
next section for how to avoid that.
{
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 --'Add the following to ~/.config/clank.sh (on the host):
export SCW_PROJECT_ID='594a268d-8577-4b86-a983-be375e13e197' # Magenta's 'AI' Project ID
export SCW_SECRET_KEY='<your-scaleway-secret-key>' # https://vault.bitwarden.com/#/vault?itemId=c9b60efc-e0b3-4a7a-a3d7-b43500d29310
export OPENCODE_MODEL='scaleway/qwen3.5-397b-a17b' # https://models.dev/?search=scaleway/You can now run opencode in Clank, which will automatically use the Scaleway
model you specified. You can also switch to a different model temporarily by
pressing Ctrl-p while inside the opencode interface.
Create an access token:
nix run github:magenta-aps/clank -- claude setup-tokenAdd it to ~/.config/clank.sh (on the host):
export CLAUDE_CODE_OAUTH_TOKEN='<your-access-token-here>'You can now run claude in Clank without having to log in every time.
Add the following to ~/.config/clank.sh (on the host):
export GEMINI_API_KEY='<your-google-api-key>' # https://vault.bitwarden.com/#/vault?itemId=c9b60efc-e0b3-4a7a-a3d7-b43500d29310You can now run gemini in Clank without having to log in every time.
git 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