How kndl works
kndl has three parts: a Hub that people sign in to, Runners that run Sessions, and a Sandbox for each Session.
- The Hub is one Bun process with a SQLite database. It keeps every Session, its history and its Prompt queue, and relays prompts and replies between people and Runners. It also holds each person’s Connected providers, and carries their Sessions’ model calls.
- A Runner is a machine that runs Sessions. It connects out to the Hub over a WebSocket, so the Hub never needs to reach it.
- A Sandbox is a microVM on a Runner, one per Session. The Session’s agent runs there, with every tool and command it starts.
Browsers, Runners and each Session’s mod talk to the Hub, never to each other.
A Session, end to end
Section titled “A Session, end to end”A Session is one agent conversation on one Repo. When someone starts one:
- The Hub records it and picks a Runner, or the one you chose.
- The Runner clones the Repo into the Session’s Workspace, on its Work branch.
- The Runner boots the Sandbox from the Repo’s Environment, with the Workspace mounted at
/workspace. - It starts the Session’s Harness, the program that runs its agent, in the Sandbox, with kndl’s mod loaded. The mod connects the Session to the Hub.
- A prompt from the Session’s Creator goes to the Hub, into the Session’s Prompt queue. When the agent is idle, the Hub hands the mod the next prompt.
- As the agent works, the mod reports its text, each tool call and each subagent to the Hub. The Hub masks secrets and sends it to everyone in the Session.
The Hub holds the queue, so the Creator can send prompts while a Turn runs. They run in order, one Turn at a time.
The agent in the Sandbox
Section titled “The agent in the Sandbox”A Session’s Harness runs inside the Sandbox, so its tools run where it runs (ADR 0013). It’s Claude Code or pi, whichever runs the Session’s Model (ADR 0029): Claude Code for its own models, and pi for every Provider’s, Claude’s included. A Runner that can’t run pi runs Claude Code alone.
- It never asks for approval. The Sandbox is the boundary, not a prompt (ADR 0004).
- pi’s model calls go through the Hub. pi sends each one to the Hub’s Gateway, on the Session token, and the Gateway sends it on to the Provider with the Creator’s credential. The credential stays on the Hub. See the security model.
- Claude’s Models run through Claude Code. For a Claude Model, pi runs Claude Code in the Sandbox as the model alone, with pi’s tools, on the Creator’s setup token. Claude Code talks to Anthropic directly, as it does in a Claude Code Session. See The Creator’s token.
- The mod reaches the Hub through the Runner. The Runner’s mod relay passes the mod’s calls, model calls and MCP traffic to the Hub, so the Sandbox needs no route to it.
- Its versions are pinned. Each kndl version runs one tested pi, on one Node.js, and one tested Claude Code, which the Runner downloads once and shares with every Sandbox.
Switching Harness
Section titled “Switching Harness”A Session switches Harness when its Creator picks a Model of the other one (ADR 0030). Nothing translates one Harness’s conversation into the other’s. Instead:
- Each Harness keeps its own conversation. Between Turns, the Runner stops one and starts the other in the same Sandbox, resuming the other’s conversation if the Session ran on it before.
- The Hub hands over what it hasn’t seen. Before the next prompt, the Hub sends the mod a Handoff, built from the Session’s history: the Turns that Harness hasn’t seen, as prompts, tool calls and answers, shortened and kept within a budget. The agent reads it as context for that prompt.
- The agent can read further back. A tool in both Harnesses’ mods reads earlier Turns from the Hub, a page at a time.
A Handoff is lossy: the other Harness learns what was said and done, not the reasoning, tool results or Attachments.
Sandboxes are disposable
Section titled “Sandboxes are disposable”A Session’s data lives on disks that outlive its Sandbox (ADR 0006). The Runner can stop a Sandbox when the Session sleeps, or replace it with a newer one, and nothing is lost.
| What | Where it lives |
|---|---|
| Source code | The Workspace, a directory on the Runner mounted at /workspace |
node_modules and package caches | Disks of the Session’s own, faster than the host mount |
| Docker’s data | Its own disk, when the Environment turns Docker on |
| The agent’s conversation and settings | Its own disk, so a woken Session carries on |
Only what git in the Sandbox pushes leaves the Runner.
Several people, one Session
Section titled “Several people, one Session”The person who started a Session is its Creator. It runs on their Connected providers and commits as them, and only they drive it (ADR 0026).
- The Creator drives. They prompt it, steer and cancel its queued prompts, answer the agent’s questions, and stop Turns and subagents. Sleep, wake, Keep awake, restart, the model and thinking level, rename, delete and restore are theirs too.
- Participants watch. Anyone with access to the Repo on GitHub can join the Session, follow it live or Archived, see its Attachments, and forward its ports. Their prompt box is off, with a note saying who drives.
- The terminal is the Creator’s. The Terminal tab mirrors the agent’s own screen, pi’s or Claude Code’s, for what the chat doesn’t handle, such as their dialogs, Esc and Ctrl-C. Only the Creator sees it.
To carry on someone else’s work, start a Session of your own on its Work branch once it’s pushed. The conversation doesn’t come with it. Forking a Session (#332), suggesting prompts to its Creator (#333) and Sessions on an API key that several people drive (#334) are open issues.
What runs where
Section titled “What runs where”| Hub’s machine | Runner’s machine | Sandbox | |
|---|---|---|---|
| Sessions, history, Prompt queues, Environments, Variables | Yes, in SQLite | ||
| The GitHub App’s private key | Yes | ||
| People’s Connected providers | Encrypted | ||
| People’s Claude credentials | Encrypted | Passed on as a Session starts | The Creator’s, in pi’s or Claude Code’s environment |
| The mod relay | Yes | ||
| The Workspace | Yes | Mounted at /workspace | |
| pi, Claude Code, the mod, and your Repo’s code running | Yes | ||
| A GitHub token for the Session’s Repo | Yes, in memory (ADR 0010) | ||
| The Environment’s Variables | Encrypted, if Sensitive | In memory, while needed | Yes |
For the parts in more depth, see Inside kndl.
Next steps
Section titled “Next steps”kndl is an independent project. It is not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic, PBC. About kndl