Guides / How kosa8 works
How kosa8 works
kosa8 is three programs and a boundary. A command-line tool you type into, a background service that does the work, and a small helper inside every virtual machine. Everything an AI assistant does happens on the far side of the boundary; everything that decides what it may do stays on yours.
The whole thing in one picture
- You type a command, or an AI client calls a tool. Both arrive at the same place.
kosa8d, a service running as your user, receives it over a socket only you can open.- Before anything happens it is checked against policy, attributed to whoever asked, and written to the audit log.
- The work itself runs in a sandbox: a real virtual machine with its own kernel. Nothing in it can see your files except the one folder you shared.
- Every packet the machine sends passes the network guard, which lives on your side where nothing inside the machine can reach it.
- API keys stay with the broker. The assistant gets a stand-in that is worthless anywhere else.
- Requests to the hosts you named go out, with the real key added on the way.
- Anything else is refused before it leaves your computer, and the attempt is recorded.
The three programs
Two kinds of place to run things
kosa8 can run a container in two places, and the difference matters.
The shared engine
kosa8 run and the Docker-compatible API use one always-warm virtual machine for
all your everyday containers. It starts in milliseconds and behaves like Docker. Containers in
it are separated from your Mac by a VM, and from each other by ordinary container isolation.
A sandbox
kosa8 sandbox and kosa8 agent run give the work a virtual machine
of its own: its own kernel, its own disk, its own private network with its own rules. This is
where an AI assistant belongs, and where save, copy and undo work.
An organisation can require it. With require_sandbox in the signed policy, the
shared engine refuses to run anything and every container gets a machine of its own. See
Policy reference.
What crosses the boundary
A sandbox is useful only if the list of things that cross into and out of it is short. This is the whole list.
| Crossing | Direction | Who controls it |
|---|---|---|
| Control channel | Your side → sandbox | The service only. It is not a network connection, and the sandbox cannot open one back. |
| Shared folder | Both | You, when you create the sandbox. Exactly the folders you named; writable unless you add :ro. |
| Network | Sandbox → world | The network guard, by the sandbox's rules. See Network rules. |
| Credentials | Never | They stay with the broker. See Keep API keys out of the sandbox. |
| Disk and memory | Neither | Each sandbox has its own. A snapshot is a file on your side that the sandbox cannot read. |
What happens when you create a sandbox
$ kosa8 sandbox create dev --egress-allow registry.npmjs.org sandbox dev ready in 737ms (32 GB disk) $ kosa8 sandbox pull dev alpine $ kosa8 sandbox run dev alpine uname -r 6.18.35 $ kosa8 sandbox egress dev policy: allow:registry.npmjs.org (enforced on the host) frames: 3 passed, 0 denied, 1 dropped as link noise dns: 2 answered, 0 refused
Where things are kept
All of kosa8's state is in one folder in your home directory, ~/.kosa8, readable
only by you.
| Path | What it is |
|---|---|
run/kosa8.sock | The socket the command talks to the service over. |
sandboxes/ | Each sandbox's disks and record. |
snapshots/ | Saved machines. |
audit.jsonl, audit.key | The audit log and the key that makes it tamper-evident. |
policy.json, mcp-policy.json | Your organisation's signed rules, if it has any. |
agents.json | Agent identities. Tokens are stored as digests, never as themselves. |
mcp-servers.json, mcp-pins.json | Third-party tool servers and the definitions they are pinned to. |
kits/ | Your own sandbox kits. |
log/ | The service's log and each sandbox's console. |