Skip to main content

AI sandboxing without the taste of sand

Project description

Locki is the first sandbox I've used where I genuinely forget I'm in one — until I try something I shouldn't.

⸺ Claude Code (Opus 4.6)

L O C K I

AI sandboxing without the taste of sand

 

Locki is a CLI that safely runs AI agents with all permissions bypassed in isolated worktrees.

❌ without Locki ✅ with Locki
git worktree add -b fix-42 ../fix-42
cd ../fix-42
claude "fix issue #42"
# ...wait a few seconds
# ...approve a command
# ...wait a few seconds
# ...approve another command
# ...different agent rebuilt the image
#    and caused a name clash‽
# ...something is hogging the port‽
# ...approve another command
# ...
locki x claude "fix issue #42"
# ...go make a cup of tea
# ...drink tea 🍵
# ...look, the PR is ready

 

Locki gives you:

  • Maximum UX (user experience): no permission prompts, isolated worktrees automatically managed.
  • Maximum AX (agent experience): run real-world software, including systemd, Docker, or Kubernetes.

 

How is Locki different than other sandboxes?

Others run either:
a) full VM per sandbox: resource-heavy and slow to start
b) OS-level jail (Landlock, Bubblewrap, etc.): not isolated (ports collide, image tags get overwritten, etc.)
c) OCI container / microVM: limited support for background services (i.e. no systemd), containers, Kubernetes, ...

Locki runs Incus containers (full OS) inside a single shared VM. While the VM layer isolates host from AI mischief, Incus containers are a lightweight layer on top to isolate sandboxes from each other. Spawn a real non-micro OS in <5s and run anything in it.

Furthermore, Locki protects your Git history from tampering while still allowing safe operations like commits to the worktree branch. Be able to fall back on earlier commits when an agent goes haywire, while not giving up the convenience of arriving at a fully baked pull request.

Case study: Kagenti ADK uses Locki to run a full MicroShift node, allowing agents to verify their work using E2E tests on a real cluster. Something breaks? The agent can kubectl right in and debug, all contained within the Locki sandbox.

 

How to install and use Locki?

  1. Install: uv tool install locki. (Install uv first if you don't have it.)

  2. If you're on Linux, also install OpenSSH (usually preinstalled) and QEMU.

  3. cd to your Git repository and run: locki ai

    (Use locki x alone to open a regular shell instead.)

  4. First start takes longer, wait a few minutes for the VM to boot.

  5. Follow prompts to log in to the AI CLI. Login will be persisted across sandboxes.

  6. Build! Your agent is already instructed on how to behave in the sandbox.

  7. Run locki ai again to open an interactive selector: continue existing session, or start a new one.

  8. Once happy, commit and push your changes. Ask the agent, or do this manually for more control.

  9. After merging the branch, just delete the worktree from your IDE and Locki will clean up the sandbox.

    (Or do it manually with: locki rm)

 

Pro-tips for power users

  • locki x opens an interactive picker to select an existing sandbox or create a new one. Use locki x -n to create a new sandbox non-interactively. Use locki x -b <substring> to match an existing sandbox by any part of its branch name (e.g. the branch name or the 8-char ID). cd to a worktree folder (~/.locki/worktrees/...) to operate on it directly.

  • Editors like VSCode show worktrees in the sidebar, useful as a quick UI for reviewing and modifying changes. (⚠️ VSCode 1.115.0+ requires setting "git.detectWorktrees": true for this to work.)

  • Locki sandboxes provide Mise for tool version management -- replacing nvm, rbenv, brew etc. with a single tool. To make your agents' (and humans') lives easier, optionally (ask your agent to) create mise.toml with tool versions and project tasks.

  • Want to use custom AI configuration in the VM -- instructions, skills, MCP servers, ...? Sandboxes share a home folder accessible at ~/.locki/home on host. For example, you can run cp ~/.claude/CLAUDE.md ~/.locki/home/.claude/CLAUDE.md to copy your custom instructions for use in sandboxes.

  • Forward ports from a sandbox to your host: locki pf -b <substring> 8080 or locki pf -b <substring> :3000 for a random host port. Use --clear to remove all forwards. Agent in sandbox can forward via self-service, just ask them.

  • Using Git hooks? Locki worktrees are automatically configured to run these inside the sandbox, even if you run git from outside. You won't be surprised by a .venv or node_modules containing incompatible binaries.

  • Something is broken? Try locki vm delete -- it will preserve your worktrees and settings in ~/.locki, but the VM will be recreated from scratch on next run.

  • Sandboxes run on Fedora 43. Want a different OS? Create a locki.toml file referencing either an available OS image, or a local Incus rootfs tarball by path. Example:

    # locki.toml
    
    [incus_image]
    aarch64 = "ubuntu/questing"
    x86_64 = "ubuntu/questing"
    

    (Since containers share a binary cache, it is not recommended to mix musl distros (like Alpine) with regular ones.)

 

Notes on security

Locki uses a single Lima VM which can only access the ~/.locki/worktrees and ~/.locki/home folders, which forms the security boundary. The sandboxed programs can read and write to these folders, and also access anything on the internet and local network. Furthermore, an allowlist of git and gh commands is used to offer a guest-to-host SSH server. .git files are checked for tampering when hooks are executed against them.

Locki is designed to provide protection for the host operating system and files from being messed up by a malfunctioning AI agent. There is no exfiltration protection, so be aware that API keys exposed to the agents need to be treated as potentially exposed and disposable, with limited scope. (This is no different from running the agent locally, just specifying that Locki does not help here. Use a dedicated solution like OneCLI if interested.)

Despite best effort, Locki provides no security guarantees and is provided "as is". That's the legal speak for "this is a random project by a random dude provided for free", you can't expect corporate-paid-support level security assurances. Random dude believes that while not perfect, using Locki is better than many existing sandboxing solutions and certainly better than going full --yolo on your bare machine and hoping for the best.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locki-0.0.8.tar.gz (27.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

locki-0.0.8-py3-none-manylinux_2_34_x86_64.whl (20.8 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

locki-0.0.8-py3-none-manylinux_2_34_aarch64.whl (18.8 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ ARM64

locki-0.0.8-py3-none-macosx_12_0_x86_64.whl (21.2 MB view details)

Uploaded Python 3macOS 12.0+ x86-64

locki-0.0.8-py3-none-macosx_12_0_arm64.whl (24.3 MB view details)

Uploaded Python 3macOS 12.0+ ARM64

locki-0.0.8-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file locki-0.0.8.tar.gz.

File metadata

  • Download URL: locki-0.0.8.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8.tar.gz
Algorithm Hash digest
SHA256 101153447ccd955601a5d4cd6b79a259f815315528fb9a4f0815a73550cc4d1d
MD5 291dbfab0ba95ace128292da13f85c02
BLAKE2b-256 ddb7ac26e0fec851550a2d9119bf6b34920e0ee828beeea44467b036b731230b

See more details on using hashes here.

File details

Details for the file locki-0.0.8-py3-none-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: locki-0.0.8-py3-none-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 20.8 MB
  • Tags: Python 3, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b2d753ea23d45e0dd157fac8fd3d85ad498f164f2e6543d8d8019a01a1c168c2
MD5 58303fcc6ba6bc884de428f50d4bb724
BLAKE2b-256 f20637e2a36cd32b701f2629659515380e3a6c1955e8645cf74364df415f5280

See more details on using hashes here.

File details

Details for the file locki-0.0.8-py3-none-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: locki-0.0.8-py3-none-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 18.8 MB
  • Tags: Python 3, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8-py3-none-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 58ba56e07c869ff0b56d138c8df800aafd095fa36806e8c98fbb047370fec00d
MD5 87e13ff950d091fc555eac1c62c87e89
BLAKE2b-256 862fc0e6a038e6d44070ea45e22360c945dc03f4147d88e818dd4345a6e07a15

See more details on using hashes here.

File details

Details for the file locki-0.0.8-py3-none-macosx_12_0_x86_64.whl.

File metadata

  • Download URL: locki-0.0.8-py3-none-macosx_12_0_x86_64.whl
  • Upload date:
  • Size: 21.2 MB
  • Tags: Python 3, macOS 12.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 383661db3743344db5aa8e3635193e2381ef07ea07ec62d2c4198661dd3258b3
MD5 80de489ca5658d49d5e4e251a65b071d
BLAKE2b-256 eb12bd502475f99c2b9423a3aad1c126a6e1f81f3ad89dbf65f667efa3336ddd

See more details on using hashes here.

File details

Details for the file locki-0.0.8-py3-none-macosx_12_0_arm64.whl.

File metadata

  • Download URL: locki-0.0.8-py3-none-macosx_12_0_arm64.whl
  • Upload date:
  • Size: 24.3 MB
  • Tags: Python 3, macOS 12.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8-py3-none-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 50dc5e5c0bd715642bf70f449038bec23056b19370dd6d319ba81956f8cf848f
MD5 82ae576f0d8dd18f11ca30c67e17f727
BLAKE2b-256 e93ee9e0b53be87815a268d3af58aa3a93adbbae5d64a159714c61aa3436e881

See more details on using hashes here.

File details

Details for the file locki-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: locki-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for locki-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6002fee6352e9123b48fa29348e0371bad66d93938375b22ce39b8daaf1aaa4f
MD5 6f05a2fcff9d72ef3354c78e818f14a5
BLAKE2b-256 903da2c16dc7f408e333a041f221eca5667bb7b89dae9daa228f20857c99873f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page