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.9.tar.gz (28.6 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.9-py3-none-manylinux_2_34_x86_64.whl (20.8 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ ARM64

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

Uploaded Python 3macOS 12.0+ x86-64

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

Uploaded Python 3macOS 12.0+ ARM64

locki-0.0.9-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: locki-0.0.9.tar.gz
  • Upload date:
  • Size: 28.6 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.9.tar.gz
Algorithm Hash digest
SHA256 41a919b2dd466d14ee6e68503728bf24bd0e8487e9ebba77a9d52e127444e31f
MD5 fa377417ac764580f867be1813945fd6
BLAKE2b-256 cf1d0e01d2e452d98fd7e94ce86018dbcbad223f77baff5e43383aec0616d60e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: locki-0.0.9-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.9-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2e99339c32f0da176bfa136aea9fb44aa453770bfa9c03c4d2a97e080f270a62
MD5 03a712bf5e6fcc275c4403aa2dc915cb
BLAKE2b-256 c2d9d12b192afe2d700a28fde8b786171e3d02f004153d29858e735e490281d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: locki-0.0.9-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.9-py3-none-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 a06862678aefb3f541c22672d04b3a03aa490e4cadc690edb0509dde3c2080af
MD5 0349aa9c0b338731b1de2b8d3ad7d66e
BLAKE2b-256 44e525e9a1c0356a76443617325bde2addab9b02cf3737c3b230029d00bac970

See more details on using hashes here.

File details

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

File metadata

  • Download URL: locki-0.0.9-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.9-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4dbd07ca7b0f8fd561ec230f1178736de8455e6a3904d95c796939a03da27bec
MD5 5db9773fad0598c0bfc2c76b4b61f765
BLAKE2b-256 684431f76b63d24b9693f7ed502e9616fbe544b4ef409f4a0bf192d7abd14105

See more details on using hashes here.

File details

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

File metadata

  • Download URL: locki-0.0.9-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.9-py3-none-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 8505a5a534e06cdf78ae704acb5681342f1aa0250cc536b498a94fe63d44f136
MD5 250977825206c5efc977d11c687839bd
BLAKE2b-256 f4086b33cf78e3e419633b642942c3005597f368189a463f684f4e363124a561

See more details on using hashes here.

File details

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

File metadata

  • Download URL: locki-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 35.9 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 610398c7ab1876bcc8fd9f4424db7aac055725a44290a64041802f3b2b63cdbb
MD5 73f025eb99f01ee71725a357e986a91c
BLAKE2b-256 18d4839ca98d0962267df9130c0761e6ed4a4cd3ff6618303943378cce57c236

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