Skip to content

How kndl works

kndl has three parts: a Hub that people sign in to, Runners that run Sessions, and a Sandbox for each Session.

How kndl's parts connectBrowsers connect to the Hub. A Runner connects out to the Hub over a WebSocket. On the Runner's machine, each Session's pi and mod run in a Sandbox, and reach the Hub through the Runner's mod relay. The Hub sends pi's model calls on to the Providers, with the Creator's credentials. For Claude's Models, Claude Code in the Sandbox talks to Anthropic directly, on the Creator's setup token.PeoplebrowserbrowserbrowserHubweb UI · SessionsPrompt queues · SQLiteProviders' APIsmodel callsA Runner's machineRunnermod relay · WorkspacesSandboxone microVM per Sessionpi + modin tmux/workspace, from the Runneryour Repo's builds, tests, serversSession tokenconnects outsetup token
pi's model calls go through the Hub, which adds the Creator's credentials on the way to each Provider. For Claude's Models, Claude Code talks to Anthropic directly, on the Creator's setup token. The Runner connects to the Hub, never the other way. The mod holds only a Session token, which the Runner's mod relay swaps for its mod token.
  • 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 is one agent conversation on one Repo. When someone starts one:

  1. The Hub records it and picks a Runner, or the one you chose.
  2. The Runner clones the Repo into the Session’s Workspace, on its Work branch.
  3. The Runner boots the Sandbox from the Repo’s Environment, with the Workspace mounted at /workspace.
  4. 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.
  5. 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.
  6. 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.

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.

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.

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.

WhatWhere it lives
Source codeThe Workspace, a directory on the Runner mounted at /workspace
node_modules and package cachesDisks of the Session’s own, faster than the host mount
Docker’s dataIts own disk, when the Environment turns Docker on
The agent’s conversation and settingsIts own disk, so a woken Session carries on

Only what git in the Sandbox pushes leaves the Runner.

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.

Hub’s machineRunner’s machineSandbox
Sessions, history, Prompt queues, Environments, VariablesYes, in SQLite
The GitHub App’s private keyYes
People’s Connected providersEncrypted
People’s Claude credentialsEncryptedPassed on as a Session startsThe Creator’s, in pi’s or Claude Code’s environment
The mod relayYes
The WorkspaceYesMounted at /workspace
pi, Claude Code, the mod, and your Repo’s code runningYes
A GitHub token for the Session’s RepoYes, in memory (ADR 0010)
The Environment’s VariablesEncrypted, if SensitiveIn memory, while neededYes

For the parts in more depth, see Inside kndl.

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