With AI agents everywhere now, forking a process is becoming a normal thing to do. An agent needs a fresh, isolated environment to run code in, and starting one from scratch every time is slow. If you can keep one warm and fork a copy on demand, you skip most of that startup cost. That idea is what I'm chasing with ForkCage: a container that can fork, so an AI system spends less time waiting on a new sandbox and more time doing actual work.
To be clear about scope: this is a basic project built on raw Linux syscalls, and I'm making it mainly to learn how containers work under the hood.
Here's what works so far. It can take any command, run it as a child process, capture its output and exit code, and hand it a fake root filesystem it can't see outside of. So a command runs in its own separate environment with no view of my real files. The code is here:
⭐ Repo: ForkCage. PS :Please leave a star :)
Getting that working gave me three bugs that taught me a lot, so this post walks through each one and what I learned from it. At the end I'll cover what I'm building next.







