Guide
Everything a new kapellmeister needs: install, your first room, your first loop, and every command. Read it top to bottom once, then come back to the part you need.
1Install
You need Node 24 or newer, git, and macOS or Linux. WSL counts as Linux. Windows is not supported.
npm$ npm install -g kapelle $ kapelle --help
pnpm$ pnpm add -g kapelle $ kapelle --help
bun$ bun add -g kapelle $ kapelle --help
from source · no build step$ git clone https://github.com/EdwardLiuyc/kapelle.git $ cd kapelle $ npm install $ node cli.ts --help $ alias kapelle='node /path/to/kapelle/cli.ts'
The package is for macOS and Linux only, so npm refuses a global install on Windows with EBADPLATFORM. If npm install -g fails with EACCES, npm's global folder belongs to root. Use a folder you own instead of sudo:
$ npm config set prefix ~/.local # then add ~/.local/bin to PATH
From source, you can check kapelle with no agent and no account. A fake agent ships with the repository:
$ npm run selftest
You should see ✓ allowed Write ACP_TEST.md. Delete ACP_TEST.md when you are done.
2Quick start
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.
kapelle is the client. The agent is a separate program, and it logs in by itself. pi is the default. Install pi and its ACP adapter, then log in to pi once:
$ npm i -g @earendil-works/pi-coding-agent pi-acp $ pi # type /login, then quit
Now type kapelle inside any repository. It starts the daemon when none runs, and opens the chat:
$ kapelle
Or send one prompt, with no chat:
$ kapelle "summarise this repo in three sentences"
pi works in your own checkout here, and it never asks for permission, so no mode can stop its changes. Read What a mode cannot stop before you give it real work.
Useful options:
--agent <id>picks another agent. See Supported agents.--cwd <dir>works in another folder.--mode safe|ask|autosets what the agent may do. See Modes.--verboseshows the agent's own error output.--quiethides normal output, but never the safety notices.
3Set up your agents
At the first start, the chat shows the setup list: each agent the daemon finds on its PATH, and what is missing. It shows again at each start until you choose done, and always while no agent is ready. /setup opens it at any time. kapelle setup prints it.
$ kapelle setup pi ready (pi 0.74.0, pi-acp 0.0.34) codex codex 0.51.0; needs codex-acp: npm i -g @agentclientprotocol/[email protected] kimi not installed: no kimi on the daemon's PATH
- Install an adapter. When an agent is there but its ACP adapter is not, check it in the list and choose setup. The daemon runs
npm i -gwith the version kapelle was tested on. If npm fails, for example because it needssudo, the list shows the command for you to run. - The login check. kapelle opens a session with each ready agent, with no prompt, so it spends no tokens. It saves the agent's models and whether it is logged in. A logged-out agent shows its own login command. kapelle never logs in for you.
- Pick a model.
/newand/addtake--model <id>, and their form lists the saved models.@name /modelchanges it during a chat. If the agent refuses the model, it keeps its own, and a notice says so. - Pick a thinking level.
@name /levellists the levels of the agent's model, and@name /level <id>picks one. The status line shows it.kapelle room addtakes--level <id>.
4Rooms, loops, runs
Six words cover all of kapelle:
- agent
- A coding agent such as pi, Claude Code or Copilot. It runs as a separate program. kapelle talks to it with ACP, the Agent Client Protocol.
- daemon
- One background program that holds all your work, for all your repositories. Close the terminal, and the work stays.
- room
- A long chat with a team of agents. Each agent keeps its memory across messages. You decide who does what by choosing who to message.
- loop
- A room with a lead agent, the orchestrator. It follows a recipe you wrote, gives the work to the others, and stops for every choice.
- run
- Many tasks at once, from one file. Each task has its own prompt, agent and mode, and ends with a result.
- worktree
- A separate checkout of your repository. Each agent in a room, and each task in a run, gets its own, on its own branch. Your own checkout stays yours.
Open a room
Rooms live in the daemon. kapelle alone starts it in the background when none runs. It keeps running after you leave the chat. Add each repository once:
$ kapelle # the chat; starts the daemon if needed $ kapelle daemon add . # in your repository, once $ kapelle daemon stop # when you want it gone
Then open a room:
$ kapelle chat new --agent pi # open a room and chat in it $ kapelle chat # every room, 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 dismiss <roomId> # stop the room's agents
Each agent in a room works on its own branch, kapelle/<roomId>/<agentId>.
An agent can work in another folder: /add takes --cwd <dir>, and its form has a folder field. In a repository with a commit, the agent gets its own checkout and branch there. In a folder with no git, it works in that folder.
A new checkout has none of your untracked folders, such as node_modules. List them as linkPaths in your repository's file, and each new checkout links them from yours.
The room API is new, and it can still change.
Talk to agents
Type a message and press Enter. It goes to the room's orchestrator: the agent whose role is orchestrator. In a room with no orchestrator and one agent, it goes to that agent. Start a message with @name to send it to that agent instead. In an agent's thread, the box always starts with its @name.
An agent works on one message at a time. A message to a busy agent waits in a queue.
Add a second agent with /add. For example, a reviewer on pi that may only read:
/add pi --name rev --mode safe
Then talk to it by name:
@rev review the last commit on dev's branch
Chat with one agent
A chat is one agent of its own, outside every room, like a person you message. /chat <agent>, or "new chat …" in the ctrl+o menu, starts one from any view. In a chat, the box always starts with the agent's @name, and /add, /title, /cap and /config refuse.
A chat agent gets an empty folder of its own, with no git. Give it --cwd <dir> to work in your repository instead. When you remove the agent, its folder goes if it is still empty, and stays if the agent used it. To list or remove the folders that stay:
$ kapelle chat scratch # the kept folders $ kapelle chat scratch clean # show what clean would remove $ kapelle chat scratch clean --yes # remove the stale ones
On a pipe, kapelle chat attach @name opens one chat as plain lines.
Room commands
A command never reaches an agent. Room commands work in any view. An agent's command needs its @name first.
| Command | What it does |
|---|---|
/leave | Exit. The rooms and their agents stay alive. |
/dismiss | Stop the room's agents. Uncommitted work stays in each agent's checkout. |
/delete | Show every branch the room owns and its unmerged commits, then ask again. Yes removes the room and its branches. |
/help | Show the commands on the screen. |
/setup | Open the setup list. |
/new [agent] | Open a new room. Options: --cmd, --name, --model, --title, --cwd. |
/add <agent> | Add an agent to the room. Options: --cmd, --name, --role, --mode, --model, --base @name|ref, --cwd. |
/chat <agent> | Start a chat. Options: --cmd, --name, --mode, --model, --cwd. |
/loop <recipe> <task> ["note"] | Start a loop in a new room. Options: --agent, --cmd, --model, --cwd. |
/title <new title> | Rename the room. |
/cap <n> | Raise the orchestrator's turn cap for this room. |
/config | Open a form with your repository's file: see every value and change it. |
@name /mode <m> | Set the agent's mode: ask, safe or auto. |
@name /role <r> | Set the agent's role, or none. |
@name /model [id] | Change the agent's model. With no id, it shows the model in use and the agent's list. |
@name /level [id] | Change the agent's thinking level. With no id, it shows the level in use and the model's levels. |
@name /rename <new> | Rename the agent. |
@name /cancel | Cancel the agent's turn. |
@name /remove | Remove the agent from the room. |
/new, /add, /chat or /loop alone opens a form, as /config does.
Keys and marks
On a terminal, a sidebar lists every room and its agents, then every chat.
| Key | What it does |
|---|---|
alt+↑ alt+↓, or ctrl+p ctrl+n | Pick a room's timeline or one agent's thread. A click works too. |
ctrl+t | Hide or show the sidebar. |
ctrl+o | Open the menu: cancel a turn, change a mode, view changes, fast-forward, add an agent, and more. Type to filter it. |
ctrl+x | Show or hide the side pane: a diff, your message history, or a shell. |
ctrl+] | Move the keys between the side pane and the message box. |
ctrl+r | Your earlier messages, to pick one again. |
ctrl+c twice | Leave the chat. The rooms and the daemon keep running. |
Beside the transcript, a rail has one ● per message. Click a mark to jump to that message, or hover on it to read its first lines. ▲ and ▼ move one message.
A mark next to each agent says what it is doing. A room takes the mark of its most urgent agent.
| Mark | Meaning |
|---|---|
? | Asks you something. The bell rings once. |
! | Looks stuck: no progress for a while, or the same step again and again. |
◐ | Busy. A timer shows how long. |
‖ | Paused. It comes back on its next message. |
✕ | Killed during a turn. |
◌ | Exited. |
● | Something new you have not seen. |
○ | Nothing new. |
Take the work
In a room, kapelle never commits for an agent. An agent commits its own branch. Uncommitted work stays in the agent's checkout.
- See an agent's changes:
ctrl+o, then view changes. The side pane shows the diff.bswitches between uncommitted changes and the whole branch. - Give one agent another's work:
ctrl+o, then fast-forward from …. The pane shows what it would bring, and Enter confirms. - Take the work into your own checkout with git, when you are ready.
$ git log -p kapelle/<roomId>/<agentId> $ git merge kapelle/<roomId>/<agentId>
Run files
A run hands out many tasks at once. Each task has its own prompt, agent and mode, and each ends with a result.
{
"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 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. Task ids name git branches, so kapelle checks them and never changes them.
In the background
With the daemon running, 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.
Merge the results
$ 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.
Look at one task's work first with git log -p kapelle/<runId>/<taskId>.
Where the work lives
Worktrees and records live in ~/.local/state/kapelle/. Nothing goes into your repository.
$ kapelle workspace # 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.
Run a loop
Most issues run the same loop: pick up, build, review, open the PR, answer the bot reviews, hand over. A loop gives it to one agent, the orchestrator. It adds the other agents when their step comes, gives them the work, reads their reports, and decides the next step. It does none of the work itself, and you decide every choice.
The daemon must run, and the repository must be added. Then start a loop with a recipe and a task:
$ kapelle loop list # every recipe, and which one wins a name $ kapelle loop starter "add a --version flag" # recipe starter, and the task $ kapelle loop fix-issue 312 # recipe fix-issue, task 312 $ kapelle loop fix-issue 312 "skip rev2" # a note for this run only $ kapelle loop fix-issue 312 --agent pi # a pi lead; claude by default $ kapelle loop fix-issue 312 --model <id> # the lead's model
kapelle ships one recipe, starter: one agent builds the task, and a second agent reviews it. It needs no skill, no gh and no remote, but it needs a git repository with at least one commit. Both workers run in auto. fix-issue is kapelle's own recipe, and it works only in kapelle's repository.
With --model, the loop does not start when the lead is not confirmed on that model.
In the chat, /loop fix-issue 312 does the same, and /loop alone opens a form. kapelle opens a room titled fix-issue-312 and adds the lead, po, in auto mode. Its first message holds kapelle's orchestrator skill, your recipe, the task and the note, so you see all it was told.
- The plan.
pojoins the recipe, the task and the note into one plan: the team, the steps, the outside review and the protected paths. It does no work before you saygo. A plan you correct costs nothing. - The work.
posends one order at a time and ends its turn. Its status line says which step runs. - The stops.
poends its turn with a question for you: one line on where the loop is, the options, a recommendation, and the reply that lets it go on. - The hand-over. The last report says what each step did, the open findings, and the number of commits. You read the work and merge it.
You may talk to any agent at any time. Answer a choice to po, or to the worker that raised it. Cancel a turn with @name /cancel. po then waits for you, and does not send the order again.
What the lead does
- Orders through kapelle
potalks to the others only withkapelle room, from its own checkout. Each order shows in your timeline aspo → dev. A worker never gives orders to another worker: the daemon refuses it.- A reply to the sender
- When a worker's turn ends, its answer goes back to
poas a message,[reply from dev]. When you talk to one of its workers yourself,pogets a copy of your message and the answer. - The step board
- The main developer ends every report with the plan's steps, each marked done, running or not started.
poreads where the loop is from the board, and never guesses. - Reviews in a line
- A reviewer starts from the developer's branch and commits its fixes.
pomoves them in with a fast-forward, removes the reviewer, and tells the developer which commits came in. The developer judges each fix. - Every choice is yours
postops for every choice, a protected path, a step that fails twice, an agent that exited, an outside review that times out, a refusal it cannot fix, and the hand-over.- A cap on turns
pomay send 40 messages to workers in one room. At the cap, the daemon refuses the next one and the chat rings the bell./cap <n>raises it for the room. Set the default withorchestratorTurnCapin your repository's file. Your own messages never count.- A hard limit on rounds
- An outside review, such as a bot on the PR, gets 3 rounds unless the recipe says other. A round with only nits ends the review. At the limit,
pooffers: hand over as it is, fix without another review, or split the task.
po runs in auto. The skill tells it to edit, build, commit and push nothing, but no mode can hold it to that. Its workers run as your user, with your forge login. A stop button, a bell when it waits for you, and a decision log are coming soon.
Write a recipe
A recipe is a Markdown file in your own words. kapelle never reads it: it pastes it into po's first message. So there is no format and no validator. kapelle looks in three places, and for one name the first wins:
.kapelle/loops/<name>.mdin your repository, to share with your team;~/.config/kapelle/loops/<name>.md, your own, for every repository;- the recipes that ship in the package, such as
starter.
To write your own, start from assets/loops/starter.md.
Give it these parts:
- The team
- Each worker's name, agent and role, and when it joins. Say which one is the main developer.
- The steps
- In order, with the skill or the words each one uses.
- The outside review
- Optional. How to start it, how a worker waits for it, and the most rounds.
- Protected paths
- Optional. Paths that need your yes before a worker changes them.
- Rules for every worker
- For example, what git may do in this loop.
A short example:
# fix-issue One GitHub issue: pick it up, build it, review it, open the PR, answer the bot, hand over. The task is the issue number. ## The team | Name | Harness | Role | Joins | | --- | --- | --- | --- | | dev | claude | developer, the main developer | at the start | | rev1 | pi | reviewer | after dev commits, from dev's branch | ## The steps 1. Pick up. dev runs /pickup-issue for the issue. 2. Build. After "go": dev builds it, runs the tests, and commits. 3. Review. rev1 reviews dev's branch and commits its fixes. 4. PR. dev pushes and opens the PR. 5. Outside review. Below. 6. Hand over. ## The outside review dev comments "@claude review" on the PR and waits for the answer inside its own turn, 20 minutes at most. 3 rounds at most. ## Rules for every worker - Commit and push only your own branch. Never merge.
kapelle's own repository runs its issues with a longer one: .kapelle/loops/fix-issue.md.
Supported agents
Pick one with --agent <id>. Each agent logs in by itself.
| --agent | Install | Tested |
|---|---|---|
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 |
The setup list shows which ones the daemon finds, and can install a missing adapter for you. Any other ACP agent works too: --cmd "some-agent --acp". kapelle says that it is not tested.
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.
Modes: safe, ask, auto
| 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: 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. |
In a room, each agent has its own mode. The default is auto, because a room is often left alone, and an ask default would leave it waiting.
In the question box, each answer has a number. Deny comes first, so a stray Enter says no. A key only moves the cursor, and only Enter answers.
What a mode cannot stop
A mode 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.
kapelle prints a notice about this, and --quiet never hides it. If you need a wall, run the agent in a container.
Commands
kapelle the chat; starts the daemon if none runs kapelle "<prompt>" [--agent id] [--cmd "cmd"] [--cwd dir] [--mode m] [--verbose] [--quiet] kapelle setup kapelle demo the chat with an offline demo agent kapelle loop <recipe> <task> ["<note>"] [--agent id] [--cmd "cmd"] [--model id] [--cwd dir] kapelle loop list [--cwd dir] kapelle room info | send | add | ff | diff | remove [--room id] [--as name] kapelle run --file <run.json> [--detach] [--cwd dir] kapelle attach <runId> [--task <taskId>] kapelle ps kapelle merge <runId> [--squash] [--cwd dir] kapelle workspace [--cwd dir] kapelle workspace move <old-repo> <new-repo> kapelle daemon start [--port n] [--permission-timeout s] kapelle daemon stop kapelle daemon add <path> kapelle chat [new | attach | list | dismiss | scratch]
kapelle room is the lead's: it runs in an agent's checkout, and finds its room from there.
kapelle --help and kapelle chat --help print the full list.
Configuration
Two optional JSON files, and KAPELLE_* environment variables. Only /config creates your repository's file, and nothing creates your user file. Both are strict: an unknown key or a wrong type is refused, and the error names the file and the key.
Your user file
~/.config/kapelle/config.json holds the daemon's settings:
{ "port": 4719, "permissionTimeoutMs": 120000 }
Your repository's file
.kapelle/config.json in your repository holds the run defaults, and the paths each new checkout links. It is the only file kapelle reads from your repository. You may commit it. Type /config in the chat to see every value and change it, or write the file by hand. When the file has a wrong value, /config still opens: it shows the error, and a save replaces the whole file.
| Key | What it sets |
|---|---|
stallIdleMs | Warn when an agent shows no progress for this long. 0 turns it off. |
stallRepeatCount | Warn when an agent repeats the same step this many times. 0 turns it off. |
ttlMs | Cancel a run's task after this long. 0 turns it off. |
maxConcurrency | How many tasks of a run work at once. |
retentionMs | How long finished runs and dismissed rooms are kept. |
orchestratorTurnCap | How many messages a new room's orchestrator may send to workers. 40 by default. |
linkPaths | Paths, such as ["node_modules"], that each new checkout links from your own. Git must ignore each one, and it must stay inside the repository. |
A linked path is shared, not a copy: an agent that writes through it writes your file. List only paths the agents read.
A KAPELLE_* variable overrides both files. linkPaths has none. A value in a run file still wins over all of them.
Troubleshooting
An agent fails to start
It often shows as Internal error (code -32603). The line after it names the next step when there is one: the login command, the agent's stderr log, or --verbose. Run again with --verbose to see the agent's own error output. In a run, read the task's .stderr.log file in the run's record folder. kapelle workspace tells you where that is.
spawn claude-agent-acp ENOENT
The Claude Code adapter is not on your PATH. Install it, then check with command -v claude-agent-acp.
--mode ask became safe
ask in a plain run needs a terminal to ask you in. Without one, kapelle uses safe and says so. Use --detach to answer through the daemon instead.
add the repository first
The daemon does not know this repository yet. Run kapelle daemon add . in it once.
Worktrees show as prunable
The repository was moved with a plain mv. Run kapelle workspace move <old> <new> to repair the links.