The AI Development Dilemma
Picture this: You're deep in a coding session with an LLM, and your AI assistant suggests running some shell commands or manipulating files. It's incredibly productive—until that nagging voice in your head whispers, "What if this goes wrong?"
We've all been there. AI tools with filesystem and command execution capabilities are absolute game-changers for productivity, but handing over the keys to your entire system? That's a hard pass for any security-conscious developer.
While there are several containerization solutions available (Docker, Podman, LXC, etc.), this post focuses on Guix containers. The main reason is that I'm already managing Emacs and its packages through the Guix ecosystem.
The Perfect LLM Client for Emacs
For interacting with LLMs in Emacs, my go-to client is gptel. It's elegant, fast, and integrates seamlessly with the Emacs ecosystem. Since most things we do is produce and consume text, I already have all my things (emails, slides, accounting, code, etc) in Emacs. That already gives super powers. Adding gptel on top of it is.. magnificent.
Speaking of tools, I've configured a comprehensive set of AI tools for gptel that cover my daily requirements. You can find all my tool configurations and setup details in my Emacs configuration repository.
Enter the Guix Container Solution
With Guix and Emacs, we can have our cake and eat it too: Full AI tool access in an isolated environment. If you're new to Guix containers, the official Guix Cookbook documentation provides background on how container isolation works using Guix.
Let's peek at the shell script that makes using such a container/jail/chroot more convenient:
Notice how only specific directories are shared with --share. Your workspace gets mounted as /workspace, but your system root? Completely inaccessible.
The container launches directly into Emacs with Dired showing your workspace directory.
The Result: Fearless AI Development
With this setup, you can confidently tell your AI assistant to:
- Refactor entire codebases
- Run experimental scripts
- Install and test new tools
- Even rm -rf to its heart's content
All while knowing your host system remains pristine and secure.
So fire up that container, and let your AI assistant run wild. Happy hacking🙏
P.S.: While this guide focuses on Guix containers, the same security principles apply whether you choose Docker, Podman, or other containerization solutions. The key is consistent isolation.
Want to see more creative uses of free software? Follow along as we explore the endless possibilities when you own your tools.