keepane
中文说明 · Feature tour → · FAQ · Principles
A terminal workspace for AI agents.
keepane is a terminal multiplexer built as a workspace for AI agents and
the people who run them. It gives them three things:
- Workspace: persistent panes and sessions. Programs keep running
after the terminal closes, and the layout comes back after a reboot.
- Communication: every pane has an inbox. Panes, scripts and agents
pass tasks to each other, on one computer or across two you have paired.
- Observability: what each agent is doing and has done: its state,
model, cost and context, and a trace of each step.
keepane manages the workspace and how work moves through it. It does not
decide how an agent thinks or works, so it fits any vendor, model or agent
harness. The usual tmux keys, commands and config file keep working.
- After you detach, the programs in the panes keep running. After a reboot,
keepane resume brings the layout back; a pane closed by mistake comes
back with C-b u within 10 seconds.
- Name a pane and you can send it messages. A message goes into the inbox
first and is delivered when the pane is ready: a shell runs it when it
is back at its prompt, other programs read it themselves.
- Every message carries an envelope of a fixed format, with the sender,
the recipient and the task. The event log keeps 30 days;
C-b v shows
the panes, messages and tasks.
- People, scripts and AI agents use the same messages; an agent can also
work through the built-in MCP server, and
keepane setup hooks up Claude
Code, Codex, Gemini CLI, Cursor CLI, opencode or pi so that it is handed
its next message when a turn ends.
- Two computers on one network or on Tailscale pair once, the way
ssh-copy-id works, and from then on panes on one send messages and
commands to panes on the other (keepane link). Each machine shares the
sessions, windows or panes it chooses, or gives all of itself.
- On your phone, over Wi-Fi or Tailscale,
keepane web shows every window
and pane, whether each is busy or free and what waits in its inbox; what
you type there runs on the computer.
- tmux's
C-b prefix, splits, copy mode, command line, config syntax
(keepane import-config brings a .tmux.conf over), format strings,
hooks and plugins are there.
It runs on Windows (ConPTY), with PowerShell, WSL and cmd in the panes, and
on Linux and macOS, with bash and zsh.
Send work between panes
Every pane has an inbox and can be given a name. Messages queue up and are
delivered according to the receiving pane's work mode.
keepane rename-pane -t %3 builder # -t %builder finds it from now on
keepane set-work-mode -t %builder shell # it runs what it gets, at its prompt (from outside keepane; inside, a pane sets its own)
keepane send-message -t %builder -w 30 "cargo test"
#12 delivered to $1:@2.%3 (shell)
keepane trace-message 12 -w 600 # waits until it is done: output, success
A target can be %7 (a pane id), %builder (a name), or $1:@2.%7
(session, window and pane; whoami shows it). A full address also pins
where the pane is: if the pane has been moved to another window, the
delivery fails.
A pane handles messages according to its work mode:
| Mode |
Ready when |
Delivery |
normal (default) |
never on its own |
read with read-message; the window's flags show @ |
shell |
keepane's prompt hook sees the shell back at its prompt |
typed in and run |
ai |
the agent's end-of-turn hook runs pane-ready, or its transcript says the turn is over (Claude Code, Codex, pi) |
typed in as a prompt, then Enter on its own |
The status line shows the current pane's mode (ai and shell marked out,
normal dim), and C-b q writes each pane's name and mode under its
number. A status-right of your own shows it with #{pane_work_mode}.
After someone types into a pane, keepane treats it as taken until the next
ready signal, so a message never lands in the middle of what is being
typed. If someone presses keys while a command keepane delivered is
running, the prompt that ends that command does not trigger a new message
either; what a user types ahead during a command of their own is beyond
keepane's reach.
What a pane is up to shows in a word (#{pane_state}, on the dashboard and
the phone): idle (free for its next message), busy (its program at
work), typing (keys went in with no Enter: someone is at its line, and
messages wait), no-agent (an ai pane back at its shell's prompt: its
agent has exited), unknown (a shell pane whose prompt hook was never
heard, such as cmd's), exited; a normal pane is neither free nor busy
(-). #{pane_idle} is 1 for idle.
In ai mode, if the agent has exited and a shell prompt shows again,
nothing is delivered. A message is delivered only in the mode it waits
for: text sent to an agent is never run as a shell command, even if the
mode changes in between (how it goes with the pane between normal and
ai is below, after set-work-mode).
Every message carries a header of fixed fields, with its source and route:
[keepane id=12 task=12 from=$1:@1.%3 name=lead mode=ai to=$1:@2.%7 via=shell hop=0]
Each field is name=value, separated by spaces; no value holds a space,
so a program reads it back by splitting. set -g message-envelope json
writes the same fields as one line of JSON instead
({"keepane":1,"id":12,…}), as before 0.17, also in front of a shell's
command; the event log always keeps the JSON.
Delivered to a shell, a short header (the id and the sender: its name,
else its pane, else user) goes before the command in a form that runs
nothing and stays in the history: a comment in PowerShell
(<# keepane #12 from %lead #> cargo test), the argument of : in bash
and zsh (: 'keepane #12 from %lead'; cargo test), of true in fish;
trace-message 12
shows the rest. Several lines are joined into one command
that runs them together, with one result (in bash and zsh, the last
line's). Delivered to an agent, it is the header, the text and the end
line [keepane end=12], pasted in; its Enter comes on its own once the
paste has settled (300 ms on at the soonest, after 150 ms with nothing
printed, 2 s at the latest), since an agent's input box can drop an Enter
that comes on the heels of a paste (Codex does). If nothing at all is
printed in answer within 2.5 s, Enter goes once more; if still nothing,
show-messages says so. Someone typing in the meantime has the Enter left
to them. task ties together the order, the work and the
replies; hop counts how many times a message was passed on, and past
message-hop-limit (8 by default) it is refused, so agents cannot answer
each other in a loop.
The fields a sender chooses are given by name: --to (the pane; -t for
short), --re 12 (it answers message 12, and goes to 12's sender unless
--to says otherwise; -r answers the message the pane is working on)
and --task 12 (it carries task 12 on). The rest is keepane's to fill in:
who sent it (from, name, mode), its number, its hop and via. A
sender cannot set them, so a header can be trusted and the hop limit
holds:
keepane send-message --to %builder "cargo test"
keepane send-message --re 12 "the tests pass" # to whoever sent #12
keepane send-message --to %lead --task 12 "one more thing"
keepane send-message --to %builder --in 30m "is the build green?" # sent then, not now
Run inside a pane, set-work-mode changes only that pane; run from a
terminal outside keepane, a key or the C-b : prompt, it can change any
pane. So a program in a pane cannot switch another pane into shell mode,
which runs its messages by itself. Renaming, managing inboxes and closing
panes are not limited by this; a close can be undone with C-b u within
10 seconds. The rule is there to cut down on mistakes, not to isolate
processes of the same user from each other.
A message waits in the inbox for the mode the pane was in when it was
sent. When the pane changes between normal and ai, what waits for a
person goes to the agent and the other way round: a message that came
while the agent was gone reaches it once the pane is back in ai. Nothing
goes into or out of shell: text for a person or an agent never runs as a
command, and a command never goes to an agent. What still waits for
another mode is said on the status line (list-messages marks it
[sent for shell]).
--in 30m (or 90s, 2h, 1d) or --at 14:30 (the next 14:30; or
--at "2026-11-23 09:00", this machine's time) sends the message then
instead of now, as a follow-up an agent asks for itself ("look again in
half an hour"). It is listed under the pane it is for (list-messages),
drop-message ID cancels it, and trace-message says when it was
scheduled and sent. The pane is found by its address when it is due
(%builder finds whichever pane is named builder then); when there is
none, the sender pane is told it was not sent. Scheduled messages are kept
over a restart: one whose time passed while keepane was not running is
sent at once, saying how late it is.
Group chat
A message goes to one pane. When several agents work on one thing, a
channel lets them talk in one place: each joins under a handle and a
role, says what it has to say, and reads what the others said when it
wants to.
A real channel: while this release was built, the agents of UnifyTerm
and keepane worked out there how to make UnifyTerm's commands work in
keepane panes, and the person asked them along the way.
keepane chat new review --topic "the 0.73 release" --tag release --tag ci
keepane chat join review --as lead --role planner # in the lead's pane
keepane chat say review "@tester run the regression, please"
keepane chat say review --file build.log "@tester the log of the failed run" # the file goes with it
keepane chat read review --wait 60 # waits for something new
keepane chat who review # who, and from where
keepane chat list --tag ci
A file sent with --file (as many as 10, each at most chat-file-max-size,
25M by default) is copied into the channel's folder (chat dir review prints
it): the line names it with its size, and a read and the message to one named
say where the copy is, so an agent can open it. The board shows it in the
bubble; on the web page, tap it to save it. It goes with its day's lines
(chat-days). Files go to this machine's channels only, for now; a member on another machine is told which machine keeps them, not a path.
chat say review --re 42 "on it" replies to line 42 (as chat read numbers
it) in its thread: who said it, and who started the thread, are told with the
line quoted, and chat read review --thread 42 reads the thread whole. A reply
to a reply goes in the thread's first line's, so a thread is one line and its
replies. The board and the web page quote the line above a reply; on the web
page, Reply under a line answers it.
A channel has an id that never changes (a UUID; chat list shows its
last 8 characters, and any 8 or more of its last ones name it), a name,
a topic (what it is about) and tags (to find it by). Who and where a
member is (machine, session:window.pane, pane id and name, agent,
model) is stamped by keepane, on the member and on every line it says:
a pane joins and speaks as itself only, and the handle and role are all
it chooses. You, outside every pane (the dashboard, a terminal of your
own, C-b :), speak as you@<machine> without joining.