# Show HN: Kapelle – Terminal chat room for your agents

> Source: <https://github.com/EdwardLiuyc/kapelle>
> Published: 2026-12-05 21:36:27+00:00

**Key takeaway:** Kapelle isolates each coding agent in its own git worktree and branch under a persistent background daemon, so multiple agents can work one repository concurrently and their work is merged only when the user approves.

A *Kapelle* is the ensemble a *Kapellmeister* directs: the players, not the conductor. kapelle directs, and the agents play.

**A terminal chatting workspace for a team of coding agents.**

kapelle runs different coding agents side by side on one repository: pi, Claude Code, Copilot, opencode and more. Each agent works in its own git worktree, on its own branch. You talk to them in your terminal, answer their permission requests, and merge their work when you are ready.

One background daemon holds all the work. Close the terminal and come back later: your agents and their history are still there. Each agent logs in by itself. kapelle never touches a key.

[Demo](#demo) · [Install](#install) · [Quick start](#quick-start) · [Rooms](#rooms) · [Loops](#your-first-loop) · [Runs](#runs) · [Remote daemon](#reach-a-daemon-from-another-machine) · [Agents](#agents) · [Safety](#what-the-modes-do-and-do-not-do) · [Docs](#docs)

## kapelle-loop-demo.mp4

One `fix-issue` loop, from the issue to the merged PR, in 3 minutes. The real run took 1 h 42 min. The orchestrator plans the steps and adds a developer and two reviewers. You type three things: `go`, your two choices, and `merge close`.

You need Node 24 or newer, Git 2.36 or newer, and macOS or Linux. WSL counts as Linux. Windows is not supported.

```
npm install -g kapelle
kapelle --help
```

The package supports macOS and Linux, so npm refuses a global install on Windows with `EBADPLATFORM`.

```
git clone https://github.com/EdwardLiuyc/kapelle.git && cd kapelle
npm install
node cli.ts --help
```

The checkout runs TypeScript directly and needs no build. To use the short command, add an alias:

```
alias kapelle='node /path/to/kapelle/cli.ts'
```

`npm pack` and `npm publish` run `prepack`, which builds the JavaScript package in `dist/`.

1. 
Install kapelle: `npm install -g kapelle` . See[Install](#install) .
2. 
Install one agent and log in to it once. pi is the default. For another agent, see [Agents](#agents) .

```
npm i -g @earendil-works/pi-coding-agent pi-acp
pi                     # type /login, then quit
```

3. 
In your repository, run `kapelle` . It starts its daemon in the background. Then the setup list shows each agent it finds, and whether it is ready. When an agent's ACP adapter is missing, the list can install it: press Space to tick the agent, then Enter. When you are done, press Enter with nothing ticked. Then the list stops opening at each start, once an agent is ready. Esc only closes it for now.`/setup` shows the list again.

```
cd your-repo
kapelle
```

4. 
Type `/new pi` and press Enter. The first time, kapelle asks to add your repository: pick`add and open` . The room opens, and you can type a message to pi.`/new` alone opens a form. Press Ctrl+C twice to leave. The room and its agent keep running.pi never asks for permission, so no mode can stop its changes. In a room, it works in its own git worktree, not in your checkout. Read [Safety](#what-the-modes-do-and-do-not-do) before you give it real work.

Try the chat before you install an agent:

```
kapelle demo
```

It opens a room with an offline demo agent. It needs no account, no tokens and no network. The agent answers, asks one permission question, and writes a file you can see with `@demo /diff`. The room works in its own folder, never in your checkout. Each `kapelle demo` deletes the last demo room and starts again. It is local-only: with a remote `client.json` setting it refuses, so run it on the daemon machine.

For developers: in a source checkout, check that kapelle works with no agent and no account. This uses a test agent that ships with the repository, not with the package:

```
npm run selftest
```

You should see `✓ allowed Write ACP_TEST.md`. Delete `ACP_TEST.md` when you are done.

Give one agent one task. This needs no room and no daemon:

```
kapelle "summarise this repo in three sentences"
```

The agent works in your own checkout here.

Other options: `--agent <id>` picks another agent. `--cwd <dir>` works in another folder. `--mode` sets what the agent may do (see [Safety](#what-the-modes-do-and-do-not-do)). `--verbose` shows the agent's own error output. `--quiet` hides normal output, but never the safety notices.

A room is a chat with a team of agents. Each agent keeps its memory across messages, and works on its own branch, `kapelle/<roomId>/<participantId>`. You decide who does what by choosing who to message.

Rooms live in the daemon. `kapelle` starts it, and `/new` adds your repository (see [Quick start](#quick-start)). To run, add, or stop the daemon yourself, see [Run the daemon by hand](#run-the-daemon-by-hand). With the daemon running, these commands work from the shell too:

```
kapelle chat new --agent pi         # open a room and chat in it
kapelle chat                        # every room and chat, on a terminal
kapelle chat list                   # every room, then every chat, as text
kapelle chat attach <roomId>        # rejoin a room; its history replays
kapelle chat attach @<name>         # rejoin a chat by its agent's name
kapelle chat dismiss <roomId>       # stop the room's agents
kapelle chat scratch [clean [--yes]] # list kept chat scratch folders; clean previews, --yes removes stale ones
kapelle chat archive list           # every removed chat, until retention deletes it
kapelle chat archive show <chatId>  # a removed chat's messages, read only
```

`kapelle chat new` does not add a repository for you. Add it first: `/new` in the chat, or `kapelle daemon add .`.

In a room, type a message and press Enter. It goes to the room's orchestrator, or to the only agent when the room has no orchestrator. Start it with `@name` to send it to that agent instead. In an agent's thread, the box always starts with its `@name`. `/leave` exits and keeps the agents alive. `/dismiss` stops the room's agents. `/delete` shows every branch and its unmerged commits, then asks again before removing the room. They work in any view, after an agent's `@name` too, and never reach an agent. In a room, kapelle never commits for an agent: uncommitted work stays in the agent's checkout.

A chat is one agent of its own, outside every room, like a person you message. `/chat <harness>`, or "new chat …" in the `ctrl+o` menu, starts one from any view. With `--cwd` it works in that folder, on its own branch in a repository; without, in an empty scratch folder of its own. Every message in a chat goes to its agent, so it needs no `@name`. `@name /remove` removes the chat.

On a terminal, a sidebar lists every room and its agents, then every chat. Click a row, or press `alt+↑`/` alt+↓` (or `ctrl+p`/` ctrl+n`), to see a room's timeline or one agent's thread. A `●` means something waits for you: magenta is a question, yellow is an agent that looks stuck. `ctrl+t`, or a click on `«`, hides the sidebar.

The room API is new, and it can still change.

A loop is a room whose orchestrator follows a recipe. A recipe is a Markdown file with the team and the steps. The orchestrator adds the agents, gives them the work and reads their reports. You make the choices.

kapelle ships one recipe, `starter`: one agent builds a task, and a second agent reviews it. It needs no skill, no `gh` and no remote. The daemon finds recipes on its own machine. With the daemon running, this shows every recipe and the folder it comes from:

```
kapelle loop list
```

Starting a loop needs the daemon running and your repository added. Run `kapelle` once to start the daemon (see [Quick start](#quick-start)), and `kapelle daemon add .` to add the repository. Then:

```
kapelle loop starter "add a --version flag" --agent pi
```

The orchestrator runs on the agent you name, and `starter` gives every worker the same one. With no `--agent`, it is `claude`. On a terminal, the chat opens on the new room. In the chat, `/loop starter "add a --version flag" --agent pi` does the same, and `/loop` alone opens a form. There, `/loop` asks to add the repository the first time.

`starter` needs a git repository with at least one commit. Then each worker gets its own git worktree and branch. In a folder with no commit, the workers share the folder, and `rev` cannot start from `dev`'s branch, so the loop stops at the review. Both workers run in `auto` mode, so they change files without asking you. Read [Safety](#what-the-modes-do-and-do-not-do) before you give a loop real work.

What you do during the loop:

1. The orchestrator shows its plan. Type `go` .
2. When it stops with a choice, type your answer.
3. At the end, read the work with `@dev /diff base` . If you want it, merge`dev` 's branch with git. Its name is`kapelle/<roomId>/<participantId>` (see[Rooms](#rooms) ), and`git branch --list 'kapelle/*'` lists it.

A loop spends tokens: every agent turn is a real prompt. A room limits how many orders the orchestrator sends its workers (`orchestratorTurnCap` in [`docs/CONFIG.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md)). `/cap <n>` raises the limit for one room.

To write your own recipe, put `<name>.md` in your repository's `.kapelle/loops/`, or in `~/.config/kapelle/loops/` on the daemon's machine for every repository. A recipe there wins over a shipped one of the same name. Start from [`assets/loops/starter.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/assets/loops/starter.md). The orchestrator's own rules are in [`assets/orchestrator.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/assets/orchestrator.md). The video at the top runs `fix-issue`, this repository's own recipe. It uses this repository's skills, so it works only here.

A run hands out N tasks at once. Each task has its own prompt, agent and mode, and each ends with a result. `tasks.json` is an example:

```
{
  "agent": "pi",
  "mode": "safe",
  "tasks": [
    { "id": "summarise", "prompt": "Summarise what this project does in three sentences." },
    { "id": "look-for-bugs", "prompt": "List any obvious bugs or missing error handling you can see." }
  ]
}
kapelle run --file tasks.json
```

In a git repository, each task gets its own `git worktree`, on a branch named `kapelle/<runId>/<taskId>`. Keep working in your own checkout while the agents work in theirs. Your uncommitted changes do not reach the tasks, and kapelle tells you so. Outside a git repository, the tasks share the folder.

When a task ends `done` or `warned`, kapelle commits its work on the task's branch. Look at one task's work with `git log -p kapelle/<runId>/<taskId>` before you merge.

See `schema/run.schema.json` for every field. Task ids name git branches, so kapelle checks them and never changes them.

With the daemon running (run `kapelle` once, or see [Run the daemon by hand](#run-the-daemon-by-hand)), hand the run over and follow it from any terminal:

```
kapelle run --file tasks.json --detach   # prints the run id
kapelle ps                               # every run and each task's status
kapelle attach <runId>                   # watch it, and answer its `ask` prompts
kapelle attach <runId> --task <taskId>   # watch one task in full
```

kapelle rings the bell and sends a desktop notification when a run needs you.

When [`client.json`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md#client-file--xdg_config_homekapelleclientjson)
reaches a daemon on another machine through an
[SSH tunnel](#reach-a-daemon-from-another-machine) at a local `127.0.0.1`
port, run files must use `--detach`. A folder is then a folder on
that daemon's machine: `--cwd app` means the daemon user's `~/app`, and no
`--cwd` means that home.

```
kapelle merge <runId> --squash
```

This puts the changes of all tasks into your working tree, unstaged. It makes no commit. It refuses when two tasks change the same file, or when your own changes touch a file a task changed.

Worktrees and records live in `~/.local/state/kapelle/`. Nothing goes into your repository.

```
kapelle workspace                      # print where this repository's work lives
kapelle workspace move <old> <new>     # after you move or rename the repository
```

Use `workspace move`, not a plain `mv`. A plain `mv` breaks git's link to each worktree.

`kapelle` starts the daemon in the background when none runs. To run it yourself, for example to see its output:

```
kapelle daemon start     # runs in this terminal until Ctrl-C
kapelle daemon add .     # in another terminal, in your repository
kapelle daemon person add alice
kapelle daemon key add alice --label laptop
kapelle daemon key list
kapelle daemon key cancel <key-id>
kapelle daemon stop      # stop the daemon, also one that kapelle started
```

The supported remote setup is an SSH tunnel. The daemon stays on the server's loopback address, and SSH carries the HTTP connection and logs in to the server. Do not expose the daemon port directly.

Use this with people you trust to read and change the daemon user's files. Agents run as that user and the tunnel does not sandbox them; see [`SECURITY.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/SECURITY.md).

On the server, install kapelle and an agent as in [Quick start](#quick-start), log the agent in, and keep one fixed nonzero port. Use the same kapelle version on both machines; the client refuses a different API major and warns on a different minor ([version rules](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CLIENT-API.md#versions-and-stability)). This example uses 4719, the default:

```
kapelle daemon start --port 4719
```

Leave that terminal open. In another terminal on the server, create a person and one key for the laptop:

```
kapelle daemon person add <person>
kapelle daemon key add <person> --label laptop
```

The `key:` line prints once. Copy it now.

On the laptop, create the [client file](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md#client-file--xdg_config_homekapelleclientjson). This example follows its path rule:

```
config="$HOME/.config/kapelle/client.json"
case "${XDG_CONFIG_HOME:-}" in
  /*) config="$XDG_CONFIG_HOME/kapelle/client.json" ;;
esac
mkdir -p "$(dirname "$config")"
(umask 077; ${EDITOR:-vi} "$config")
chmod 600 "$config"
```

Put this in the file, replacing the key value with the one from the server:

```
{
  "daemonAddress": "http://127.0.0.1:4719",
  "accessKey": "<key printed by kapelle daemon key add>"
}
```

Keep the daemon on one fixed port. The laptop's `daemonAddress` names the local tunnel port. The two ends of `-L` may differ: `-L <local-port>:127.0.0.1:<daemon-port>`. The example below uses 4719 on both. Start the tunnel on the laptop and leave it open:

```
ssh -N \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 \
  -L 4719:127.0.0.1:4719 \
  <user>@<server>
```

If the laptop already uses 4719, keep the daemon on 4719 and use a free local port, for example `-L 4720:127.0.0.1:4719`. Then set `daemonAddress` to `http://127.0.0.1:4720`.

A daemon inside WSL2 usually has no reachable `sshd`. Windows localhost forwarding may make a WSL listener available on Windows localhost, but it does not make that daemon reachable from another machine. If WSL can reach an SSH server on the laptop, run the tunnel in the other direction from inside WSL:

```
ssh -N \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 \
  -R 127.0.0.1:4720:127.0.0.1:4719 \
  <laptop-user>@<laptop>
```

The explicit loopback bind makes the reverse tunnel listen on the laptop at `127.0.0.1:4720` and reach the daemon's `127.0.0.1:4719` inside WSL; use `http://127.0.0.1:4720` as `daemonAddress`. The measured M11-7 run used this reverse tunnel; see the [M11-7 measurement](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/FINDINGS.md#m11-7--ssh-tunnel--measured-2026-11-30-481).

With the tunnel open, check the connection and add a repository that exists on the server:

```
kapelle chat list
kapelle daemon add '~/src/<repo>'
```

The quoted folder is resolved on the daemon's machine; see the [client file rules](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md#client-file--xdg_config_homekapelleclientjson). Open a room and send the agent a message:

```
kapelle chat new --agent pi --cwd '~/src/<repo>'
```

Type a message in the room, wait for pi's reply, then type `/leave`. The room and agent remain alive. List the rooms and reattach by id:

```
kapelle chat list
kapelle chat attach <roomId>
```

From the laptop, `kapelle room` can also name the room explicitly:

```
kapelle room info --room <roomId>
kapelle room diff pi --room <roomId>
```

`kapelle merge` and `kapelle workspace` read the repository on disk, so run them from a shell on the server. `/term` stays on the laptop; it is not a shell on the server.

To revoke the laptop, cancel its key on the server:

```
kapelle daemon key cancel <key-id>
```

Pick one with `--agent <id>`. Each agent logs in by itself.

| `--agent` | Install | Tested here | 
|---|---|---|
| `pi` (default) | `npm i -g @earendil-works/pi-coding-agent pi-acp` | yes | 
| `claude` | `npm i -g @agentclientprotocol/claude-agent-acp` , then`claude auth login` | yes | 
| `copilot` | the Copilot CLI ( `copilot --acp` ) | yes | 
| `opencode` | `npm i -g opencode-ai` , then`opencode auth login` | yes | 
| `codex` | the Codex CLI, then `npm i -g @agentclientprotocol/codex-acp` and`codex login` | yes | 
| `kimi` | the Kimi Code CLI ( `kimi acp` ), then`kimi login` | yes | 

Any other ACP agent works too: `--cmd "some-agent --acp"`.

**Claude Code** has no ACP mode of its own, so it needs the adapter above. If you see `spawn claude-agent-acp ENOENT`, the adapter is not on your `PATH`. Check with `command -v claude-agent-acp`. You can run kapelle from inside a Claude Code session. No `env -u` is needed.

| Mode | What it does | 
|---|---|
| `safe` | Allows reads. Refuses every change the agent asks about. | 
| `ask` | Allows reads. Asks you about each change. A run in your terminal needs the terminal: without one, kapelle uses `safe` and prints a notice. A room, or a run started with`--detach` , asks through the daemon instead: the question waits for your answer, and is refused at the time limit. | 
| `auto` | Allows everything. A file request for a path outside the workspace is still refused. | 

**A mode is a filter, not a sandbox.** It decides the answer when an agent asks for permission. An agent that changes files through its own shell does not ask. pi never asks. opencode asks only for a write outside the workspace. So `safe` does not stop them.

kapelle always refuses a file request for a path outside the workspace, in every mode. But this covers only file requests that go through kapelle. An agent can still write the file itself: opencode 2.0.18 did, after kapelle refused its request (#308).

What each agent was measured to do is in [`docs/FINDINGS.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/FINDINGS.md).

Three optional JSON files and `KAPELLE_*` environment variables:

- `~/.config/kapelle/config.json` : the daemon's`port` and permission timeout.
- `~/.config/kapelle/client.json` : a remote daemon's address and access key, for the client only.
- `.kapelle/config.json` in your repository: stall limits, time limits, how many tasks run at once, and how long records are kept. This is the only file kapelle reads from your repository. Type`/config` in the chat to see every value and change it, or write the file by hand.

Every key, its range and its order of precedence: [`docs/CONFIG.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md).

- [`docs/CONFIG.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CONFIG.md) : every config key.
- [`docs/CLIENT-API.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/CLIENT-API.md) : the daemon's HTTP API, to write your own client.
- [`docs/FINDINGS.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/FINDINGS.md) : what each agent was measured to do.
- [`docs/PROJECT-BRIEF.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/docs/PROJECT-BRIEF.md) : why this project exists.

Read [`AGENTS.md`](https://github.com/EdwardLiuyc/kapelle/blob/master/AGENTS.md) first. It has the commands, the file map and the rules. This applies to people and to coding agents.

```
npm run check && npm run fmt:check && npm run test && npm run knip
```

[MIT](https://github.com/EdwardLiuyc/kapelle/blob/master/LICENSE) © Yongchuan Liu
