TermHerd
A terminal workspace for your Claude Code sessions — browse them, launch them, arrange them in tabs and splits, watch which one needs you, and let a session drive the workspace it runs in.
It is a native Rust desktop app (macOS, Windows, Linux — all three first-class), keyboard-driven, built around a real PTY terminal per session.
cargo run -p termherd-app # or install a release build — see Installation
What it is not
Not an IDE. TermHerd deliberately does not emulate an editor and does not
register in ~/.claude/ide: Claude keeps using the editor you already
configured. Dropping IDE emulation is what keeps the product a workspace —
the hardest, largest surface (an in-app diff panel) left the critical path, and
what remains is the capability that actually earns its keep: multiplexing many
sessions on one screen.
Not a replacement for your shell. A tab can be a Claude session or a plain shell, and they behave identically. TermHerd arranges terminals; it does not try to be one you have to relearn.
What makes it different
It reads Claude’s own files, and never writes to them. Sessions come from
walking ~/.claude/projects. Your stars, custom titles, archives and the
repositories you added by hand live in an overlay at
~/.termherd/metadata.json — TermHerd never writes under
~/.claude. Run it beside another session manager if you want; nothing it does
is destructive to the CLI’s own state.
It knows which session needs you. Every session carries an activity status
— starting, busy, idle, attention, exited — folded from what the
terminal says about itself: Claude’s OSC title stream, and for a plain shell an
OSC 133 shell-integration snippet TermHerd injects at spawn. The status drives
tab badges, the close confirmation, and the MCP wait tool. It is not a
heuristic on top of output text.
A session can drive the workspace it lives in. A Claude session launched from TermHerd gets an in-process MCP server wired into its config at spawn — no setup. It can read the whole workspace, open and split panes, type into other sessions, wait for one to go idle, screenshot the window, put a repository in the sidebar, and press TermHerd’s own key chords. That loop is what lets an agent verify a change instead of only proposing one.
The quality bar is the reason it exists. TermHerd is a replatform of an
Electron app, and the rewrite is scoped by a fixed list of defects it must fix
by construction: a headless, pure domain core (core::App::apply(Event) -> Vec<Effect>), a hexagonal crate graph where adapters depend on the core and
never the reverse, one actor per session instead of shared mutable state, typed
errors with unwrap/panic clippy-denied in the domain crates, one logging
stack, and CI gates that block a merge. See
Architecture at a glance.
Where to go next
| You want to… | Read |
|---|---|
| Get it running | Installation → Quick start |
| Learn the workspace | The sidebar, Tabs and splits |
| Look up a key | Keyboard shortcuts |
| Change a setting | settings.json |
| Let an agent drive it | Driving termherd over MCP |
| Understand how it’s built | Architecture at a glance |
This book documents shipped behaviour. Where a feature is partial, the page says so rather than describing an interface that does not exist yet. The authoritative status of every feature is
ROADMAP.md.
Installation
Requirements
A shell — and, to launch Claude sessions, the Claude Code CLI 2.0.73 or
newer on your PATH.
That floor is the CLI’s --session-id flag. TermHerd starts every fresh Claude
session under an id it chooses itself, so a new tab knows its conversation from
the first keystroke. Claude Code’s changelog never records when the flag
arrived, so the floor is an estimate: 2.0.73 is the oldest release whose
notes show the flag working. An older CLI may well accept it too; one that does
not refuses the launch, and TermHerd has no fallback for it.
The next flag down is --settings (1.0.61), which TermHerd also puts on every
Claude launch. It re-enables the CLI’s terminal title for that session
only, and the title is where a Claude session’s activity status comes from:
without it, a
CLAUDE_CODE_DISABLE_TERMINAL_TITLE anywhere in your own settings would leave
every session reading starting forever. An older CLI rejects either flag and
the launch fails. TermHerd’s other flag, --mcp-config (the
live bridge), has been available since 0.2.75.
A plain shell needs nothing installed — see Status and attention for what it takes to give one an accurate status.
Desktop installers
Each tagged release publishes installers on the Releases page.
| Platform | File | Notes |
|---|---|---|
| macOS | TermHerd_<version>_<arch>.dmg | Open it, drag TermHerd into Applications. |
| Windows | *-setup.exe (NSIS) | |
| Linux | .deb or .AppImage | sudo apt install ./termherd_<version>_amd64.deb, or chmod +x the AppImage. |
Builds are not signed yet. On macOS, first launch needs a right-click → Open, or clearing the quarantine flag:
xattr -dr com.apple.quarantine /Applications/TermHerd.app
On Windows, SmartScreen may warn — choose More info → Run anyway.
Bare command-line binary
The same releases carry one-line installers that drop termherd into your
Cargo bin directory. Every release so far is a pre-release, which GitHub’s
/releases/latest/ shortcut skips, so name the tag — the newest one is at the
top of the Releases page:
# macOS / Linux
TAG=v0.1.0-prerelease.4
curl --proto '=https' --tlsv1.2 -LsSf \
"https://github.com/Termherd/termherd/releases/download/$TAG/termherd-app-installer.sh" | sh
# Windows
$Tag = "v0.1.0-prerelease.4"
irm "https://github.com/Termherd/termherd/releases/download/$Tag/termherd-app-installer.ps1" | iex
Verifying a Linux download
Linux release binaries carry a sigstore keyless build-provenance attestation — no signing key; the signer is the release workflow itself, via GitHub OIDC, logged in the public Rekor transparency log.
gh attestation verify termherd-app-x86_64-unknown-linux-gnu.tar.xz \
--repo Termherd/termherd
A passing check proves both integrity and that the artifact was built by this
repository’s CI. The attestation and its SHA256SUMS file come from a signing
step added after v0.1.0-prerelease.4, so that pre-release has neither — only
per-file .sha256 checksums and a combined sha256.sum, which every release
carries.
From source
The toolchain is pinned in rust-toolchain.toml (Rust 1.95.0, edition 2024);
rustup picks it up automatically.
git clone https://github.com/Termherd/termherd
cd termherd
cargo run -p termherd-app
Where TermHerd writes
Never under ~/.claude. Everything it owns lives in ~/.termherd
(%USERPROFILE%\.termherd on Windows):
| Path | Holds |
|---|---|
~/.termherd/settings.json | your settings — reference |
~/.termherd/window.json | window size and position |
~/.termherd/layout.json | the tab strip a launch reopens — see Coming back after a restart |
~/.termherd/metadata.json | stars, archives, custom session titles, hand-added repositories |
~/.termherd/captures/ | capture-<ts>.json / .png / .gif — see Capture and record |
~/.termherd/inbox/ | termherd:// links waiting for the running window — see Opening a tab from a link |
~/.termherd/termherd.log | the log, on Windows only — see Where the log goes |
Where the log goes
On macOS and Linux, TermHerd logs to stderr: start it from a terminal to read
it. On Windows, a release build appends its log to
%USERPROFILE%\.termherd\termherd.log instead, even when started from a
terminal. A log that has reached 5 MB is renamed termherd.log.old at the
next launch, replacing the previous one, and a fresh log starts. A build from
source in debug mode (cargo run -p termherd-app) logs to the terminal on
every OS.
Started from Explorer or the Start menu, TermHerd opens no console window beside its own on Windows 11 24H2 or later. Older Windows versions still open one; closing it closes TermHerd.
The RUST_LOG environment variable sets what is logged wherever it goes, for
example termherd=debug.
TermHerd is single-instance: a lock named after the system temp directory
(a file there on macOS, a named mutex on Windows, an abstract socket on
Linux). A second launch carrying a termherd:// link hands it to the
running instance and exits with code 0; the tab opens there without bringing
the window forward. Without a link, it exits with code 2. To
run a second build alongside one that already holds the lock, point it at a
throwaway temp dir so its lock differs. On macOS and Linux:
TMPDIR=$(mktemp -d) cargo run -p termherd-app
On Windows, TMP decides the temp dir:
$env:TMP = (New-Item -ItemType Directory "$env:TEMP\termherd-2").FullName; cargo run -p termherd-app
Quick start
Five minutes, from a cold launch to two sessions side by side with an agent driving them.
1. Launch it
Open the app you installed:
| Platform | Launch |
|---|---|
| macOS | TermHerd in Applications — Launchpad, Spotlight, or double-click it in Finder. |
| Windows | TermHerd in the Start menu, or its desktop shortcut. |
| Linux | TermHerd in your application menu (.deb), or run the .AppImage directly. |
Prefer the terminal? The bare command-line binary is on your PATH as
termherd, and from a clone it is one command:
termherd # the installed bare binary
cargo run -p termherd-app # from a clone
If you have not installed it yet, see Installation.
The window opens on the workspace: the sidebar on the left, listing every
Claude session TermHerd found by walking ~/.claude/projects, grouped by
project — plus any repository you added by hand; the tab strip across the
top; the focused terminal filling the rest.
Nothing is scanned from your source trees and nothing under ~/.claude is
written. A first run on a large history takes a moment to walk the tree — the
scan is in-memory (a SQLite cache is roadmapped, not shipped).
About the chords below
Every shortcut is rebindable, and the defaults differ by platform. The tables give both columns; the full vocabulary is in Keyboard shortcuts.
2. Open a session
Click a project in the sidebar to expand it, then click a session to open it in a tab. TermHerd resumes it through the Claude CLI.
From the keyboard, with a terminal focused:
| Action | macOS | Windows / Linux |
|---|---|---|
| New shell in the focused session’s directory | Cmd+T | Ctrl+Shift+T |
| New Claude session in that directory | Cmd+Alt+T | Ctrl+Alt+T |
| Focus the sidebar search box | Cmd+F | Ctrl+Shift+F |
Search matches session titles and indexed transcript content; a content hit shows the matched line under the row so you can tell why it matched. See The sidebar.
3. Arrange it
| Action | macOS | Windows / Linux |
|---|---|---|
| Split vertically (side by side) | Cmd+D | Alt+Shift++ |
| Split horizontally (stacked) | Cmd+Shift+D | Alt+Shift+- or Alt+Shift+D |
| Move focus between panes | Cmd+Shift+←↑↓→ | Ctrl+Shift+←↑↓→ |
| Next / previous tab | Ctrl+Tab / Ctrl+Shift+Tab | same |
| Jump straight to tab 1–9 | Cmd+1…9 | Alt+1…9 |
| Close the focused pane (a lone pane closes its tab) | Cmd+W | Ctrl+Shift+W |
| Reopen the tab you just closed | Cmd+Shift+T | Ctrl+Alt+Shift+T |
Tabs also reorder by drag-and-drop. Drag the divider between split panes to resize them: the ratio updates as you drag, stays between 10% and 90% of the split’s usable space, and the terminal grids resize on release. See Tabs and splits for details.
4. Watch what needs you
Each tab carries an activity dot: busy while a session is working, attention when it is waiting on you (a permission prompt, a question), idle when it is done. That is also what arms the close confirmation — closing a tab whose session is mid-command asks first, closing an idle one does not. Status and attention.
5. Let a session drive the workspace
A Claude session launched from TermHerd already has the MCP control surface wired in. Ask it, inside that session:
Split this pane, run
cargo testin the new one, wait for it to finish, and tell me what failed.
It will call split_pane → run_in_session → wait_for_status →
read_terminal. That act → wait → observe loop, and everything else the
session can reach, is in Driving termherd over MCP.
6. Make it yours
There is no settings panel yet: edit ~/.termherd/settings.json
(%USERPROFILE%\.termherd\settings.json on Windows) and restart. Shell, theme,
terminal colours and font size, close-confirmation policy, sidebar density, GIF
recording budget, the editor a clicked file path opens in, and every key
binding live there — full reference.
Where to go next
- The sidebar — browsing, search, stars, plans and memory
- The terminal — selection, clickable links and paths, scrollback, zoom
- Capture and record — hand an AI assistant the app’s exact state
The sidebar: browse, search, star
The sidebar is the session browser. It lists every Claude session TermHerd
found by walking ~/.claude/projects, grouped by project — together with the
repositories you added by hand, which need no session to appear. It refreshes
live as the filesystem changes, so a session started elsewhere shows up without
a restart:
- half a second after the changes stop;
- two seconds at most while a session keeps writing;
- ten seconds at most if the filesystem watch delivers nothing at all, as macOS can: the sidebar also rescans on its own every ten seconds.
Before Claude Code’s first run there is no ~/.claude/projects: the sidebar
reads No sessions found., and lists the first session once Claude Code
creates the directory.
The walk follows no symlink: a linked project folder, session subdirectory or
.jsonl under ~/.claude/projects is skipped. A transcript is read whole up
to 256 MiB; past that, only its first and last 128 MiB are read, so the message
count of such a session misses its middle. Titles and slugs are cut to 120
characters, like the summary.
Toggle it with Cmd+B (macOS) or Ctrl+Shift+B (Windows, Linux).
┌────────────────────────────────┐
│ ◀ Hide + Add a repo ⚙ │ ← add a folder · open the settings panel
│ Search… │ ← focus: Cmd+F / Ctrl+Shift+F
│ ☐ Titles only ☐ Show archived │
├────────────────────────────────┤
│ ★ Favorites │
│ my-app · fix the race │
├────────────────────────────────┤
│ new-repo ❯ ✳ │ ← added by hand, no sessions yet
│ No sessions yet … │
│ ▾ my-app ★ ❯ ✳ │ ← launch a shell / a fresh Claude session
│ ★ fix the race │ ← starred
│ ☆ add the cache ↗ ✎ ⊟ │ ← under the pointer
│ … 3 more │
│ ▸ other-repo ❯ ✳ │
├────────────────────────────────┤
│ Plans & memory │
│ CLAUDE.md (global) │
│ my-app/CLAUDE.md │
│ plan-2026-08-01.md │
└────────────────────────────────┘
Opening a session
Click a project to expand it, then a session to resume it in a new tab.
Antigravity (agy) conversations discovered in
~/.gemini/antigravity-cli/conversation_summaries.db appear under their
matching project with a ✦ mark beside the title; clicking one resumes it via
agy --conversation <id> (or brings its open tab forward).
Beside each project row are two launch buttons: ❯ opens a plain shell in
that project’s directory, ✳ starts a fresh Claude session there — under a
session id TermHerd picks (claude --session-id <uuid>), so once the session
shows up in the list, clicking it brings its tab forward instead of resuming
a second copy. When another supported agent CLI is detected on the machine
(such as Antigravity, agy), a compact ▾ button appears beside ✳ to
open a picker and launch it (✦ Antigravity) in that project’s directory. The same
two actions are on the keyboard as Cmd+T (elsewhere
Ctrl+Shift+T)
and Cmd/Ctrl+Alt+T, which use the
focused session’s
directory instead.
Adding a repository
A project only appears once it has a Claude session, so a repository you have never opened Claude in is invisible — including the one you are about to start work in. + Add a repo puts it there anyway: pick a folder, or drop one on the window. Both do the same thing.
Drop a folder, not a file: a dropped file is ignored, so dragging one onto a terminal never quietly adds its directory.
The row that appears carries the same ❯ and ✳ buttons as any other, and says
No sessions yet until it has one. When it does, it becomes an ordinary
project row — there is no second entry.
An added repository sorts to the top of the list until its first session, then takes its place by recency like everything else. A ✕ on its row, under the pointer, removes it; the button only appears on rows you added, since a discovered project has no declaration to drop. Removing a repository that has since gained sessions drops only the addition — the project stays, because the scan still finds it.
What you pick is not always what is stored, but it is filed by exactly the rule the scan uses for a session’s working directory — that agreement is what keeps one repository on one row. A git worktree collapses onto its main checkout; a file becomes the folder holding it; everything else is stored as given, symlinks and all.
One consequence is worth knowing: a subdirectory is not climbed. Add
~/dev/app/crates/core and you get a row for that subdirectory, not for
~/dev/app — because a Claude session started there is filed the same way.
Add the directory you actually want the row for.
Additions live in ~/.termherd/metadata.json, beside stars and renames.
Nothing is written under ~/.claude.
Hovering a session shows a card with its fuller description — relative last
activity and message count (3h ago · 214 messages), the model of its last
reply with the last reasoning effort the transcript recorded
(Model: claude-opus-5-5 · medium effort), and the Claude Code version that
wrote it (Claude Code 2.1.294). A line is left out when the transcript does
not record it: older Claude Code versions write no effort. A tab shows the same
card on hover, plus the live facts described in
Tabs and splits.
A session given a colour with Claude Code’s /color shows a thin bar of that
colour at the start of its row, whether or not it is open, and its card names
the colour (Colour: green) for anyone who cannot tell the bars apart. The
colour comes from the session’s transcript, so a /color in an open session
reaches its row at the next rescan.
Search
Cmd+F (elsewhere Ctrl+Shift+F) focuses the search box. Search runs in memory over the scan’s digests — titles, slugs, first prompts and indexed transcript text.
- A content hit renders the matched line in muted text under the session row, windowed around the match and clipped to the sidebar width, so you can tell why a row matched.
- Titles only narrows the search to titles and slugs.
- Show archived brings archived sessions back into the results.
Search is in-memory by design at this stage: the SQLite + FTS5 digest cache
(F-store-cache) is an optimisation on the roadmap, not shipped. On a very
large ~/.claude history the first scan is the slow part, not the query.
Stars, renames, archives
At rest a session row shows what tells it apart: its colour bar and status dot when it has them, its title and message count, and a ★ when starred. The title takes the whole row at rest. Its four buttons appear when the pointer is over the row, which is drawn on a lighter or darker fill, and the title is cut shorter to make room; a row being renamed keeps them in view. A project’s ☆, just after its name, and the ✕ of a repository you added, work the same way.
A title too long for its row ends in … where the row runs out, and the
message count keeps its place at the end; the card on hover shows the title
whole.
| Button | Does |
|---|---|
| ★ | star / unstar — starred sessions collect under ★ Favorites at the top |
| ↗ | reveal the transcript: its .jsonl file, selected in Finder or Explorer; on Linux, the folder holding it opens |
| ⊟ | archive (with a confirmation) — hidden unless Show archived is on; an archived row shows ⊞, which restores it in one click |
| ✎ | rename — an inline field, committed with ✓ or Enter; Escape abandons the edit |
The star, archive and rename are an overlay: they are written to
~/.termherd/metadata.json, never under ~/.claude. Nothing you do in the
sidebar changes what the Claude CLI sees, with one exception: renaming a
session that is open in a Claude tab asks Claude to rename it, with
/rename, exactly as renaming its tab does (see
Tabs and splits). Clearing the field still only
removes the sidebar’s own name, and the greyed-out hint shows the title that
leaves. Between a name given here and Claude’s own /rename, the later one
shows: a rename here outranks the name Claude had, until Claude is renamed
again.
Density
Long projects fold: past sidebar.session_limit sessions (default 5) the tail
collapses behind a … N more expander, and show less folds it back. Set the
limit to 0 to always show every session —
settings.json.
Plans & memory
The bottom section lists Claude’s plan files (~/.claude/plans/*.md) and the
memory files: the global ~/.claude/CLAUDE.md and the CLAUDE.md of each
repo in the sidebar, an added repo with no session yet included. Clicking one
loads it off-thread and opens it in the main pane, replacing the terminal view
until you close it.
The doc pane can edit — Save, with a • Modified marker while there
are unsaved changes and Saved after a write. Two ways out, and they behave
identically: the Close button, or Escape. With unsaved changes,
both ask first — Discard unsaved changes to “CLAUDE.md”? — and clicking
another doc in the sidebar asks too, naming both docs. Enter or
Discard throws the edits away; Escape or Cancel goes back to the
editor with them intact. Saving first closes without a question. Quitting
TermHerd with unsaved changes asks too, naming the doc — whatever the
close.app policy says, since that policy is about the sessions a quit stops.
When nothing is open
With no session open, the main pane shows a welcome card: how many sessions in
how many projects were found, and the two ways to start — the ❯ / ✳ buttons
beside a project, or a click on a session to resume it.
Tabs and splits
Every session you open is a tab. Every tab holds a pane tree — one terminal, or many, split vertically and horizontally.
┌ ●busy ✳ my-app ┬ ○idle ❯ tests ┬ ○idle ❯ notes ────┐
├────────────────┴───────────────┴───────────────────┤
│ │ │
│ claude (my-app) │ $ cargo test │
│ │ │
│ ├───────────────────────────┤
│ │ │
│ │ $ git log --oneline │
│ │ │
└────────────────────────┴───────────────────────────┘
Cmd+D / Alt+Shift+Plus split side by side
Cmd+Shift+D / Alt+Shift+Minus or D split stacked
Tabs
| Action | macOS | Windows / Linux |
|---|---|---|
| Next / previous tab | Ctrl+Tab / Ctrl+Shift+Tab | same |
| Jump to tab 1–9 | Cmd+1…9 | Alt+1…9 |
| New shell here | Cmd+T | Ctrl+Shift+T |
| New Claude session here | Cmd+Alt+T | Ctrl+Alt+T |
| Reopen the tab you closed | Cmd+Shift+T | Ctrl+Alt+Shift+T |
| Close focused pane | Cmd+W | Ctrl+Shift+W |
| Rename the focused tab | Cmd+Shift+I | Ctrl+Shift+I |
| Open the focused tab’s menu | Cmd+Shift+M | Ctrl+Shift+M |
Jump-to-tab is matched by physical key position, not by the character the
key produces. On AZERTY and QWERTZ, where the number row produces &, é, …
without Shift, Cmd/Alt+1 still lands on tab 1.
Each tab carries its own activity dot (see
Status and attention) — omitted for providers whose live
activity is not monitored — a kind mark (✳ for a Claude session, ✦ for
Antigravity, ❯ for a shell), a title derived from its session, and a × to
close it. In a split tab, the mark follows the focused pane. The kind is never
part of the title, so renaming a tab or a retitle from Claude cannot lose it: a
fresh tab is titled after its project alone. Hovering a tab shows the
session’s fuller description — the card the sidebar shows, for a fresh Claude
tab as soon as the sidebar lists its session. Should /clear or a
plan-accept give the conversation a new id, the tab picks it up from
Claude’s own session file the next time TermHerd reads it — hovering the
tab, or clicking a row in the sidebar — and keeps it after Claude exits
(not on Windows, where that file cannot be matched to its pane). Until then
the sidebar’s status dot stays on the old row. Reopening a closed Claude tab
resumes the conversation it held last, once the sidebar lists it; a fresh
tab closed before then comes back as a new conversation. When a Claude
runs in it, the card also names its agent (Agent: termherd-b0), the peer
name other Claude sessions address it by; the copy-agent-name action puts
it on the clipboard. The card also says how long the tab has run, counted from
the moment termherd started its terminal (Running for 1h 12m), and which
Claude Code version runs in it: the one the running Claude reports, else the
one its transcript last recorded. Model and effort come from the transcript,
as in the sidebar card. A plain shell tab, with no Claude running in it,
shows only its running time beside its working directory; a shell tab in
which claude was typed by hand also shows its agent and version while that
Claude runs. In a split tab, the card describes the first pane.
A Claude tab wears the colour its /color set. Run /color green in a
Claude session and its tab is outlined in green, and its sidebar row gets a
green bar, usually within half a second — the time the sidebar takes to
notice the transcript changed — and at most about ten seconds later if the
filesystem watch misses the change. /color default takes the colour away
again. The
colour is Claude’s, read from the session’s transcript: there is no setting
for it, and on a Claude tab no way to override it from TermHerd (a shell tab’s
pick, below, does win over a Claude started by hand in that shell). In a split
tab the focused pane decides, as it does for the kind mark, so a shell focused
beside a coloured Claude leaves the tab uncoloured.
The eight colours are tuned for each theme, but red and green are both among
them, so the colour is never the only cue: the hover card names it
(Colour: green) — in a split, the colour the outline shows, the focused
pane’s. A shell tab wears the colour picked for it, below.
TermHerd asks Claude rather than overriding it. Where a change belongs to
Claude — handing a session to the desktop app with send-to-desktop, or a
Claude tab’s colour from the colour list below — TermHerd types Claude’s own
slash command for you, behind a prompt that shows the exact line first.
Enter types it and Escape drops it.
/desktop is offered only while that Claude is idle with nothing typed in its
prompt; a draft that appears meanwhile keeps the prompt open and says so.
/rename and /color are also typed while Claude is at work, since Claude
applies them mid-turn, and a message you queued during the turn stays queued.
A Claude tab goes by the name Claude gives its session. The title is the first of these that exists:
| Rank | Source |
|---|---|
| 1 | the session’s name — Claude’s /rename or one you gave it in the sidebar, whichever came last |
| 2 | the title Claude last reported to the terminal |
| 3 | Claude’s own summary of the conversation, else its first prompt |
| 4 | the project the tab opened in |
A /rename typed in Claude reaches the tab the next time TermHerd rescans
~/.claude, which it does when the transcript changes on disk — a fresh tab
included, since TermHerd starts it under a session id of its own. A
conversation with no prompt yet has nothing to rescan, so a rename typed
before the first prompt shows once that prompt is sent.
Double-click a tab to rename it, or press the rename-tab chord to rename
the focused one; both open the same field and end the same way. The tab strip
does not scroll yet: with more tabs than fit, the focused one can sit past its
right edge, and the chord then opens a field you cannot see. It still holds the
keyboard, so Escape leaves it.
The field opens on the current name; clear
it and it shows, greyed out, the name Enter would then leave. For a
shell tab, the name you type is the tab’s own and stays until you clear it,
which reverts the tab to the name it would have without one. For a Claude
tab, TermHerd asks Claude instead: Enter arms /rename <name>
behind the same prompt as any other command, and the tab takes the new name
once Claude has recorded it, even mid-turn. When Claude cannot take the
command — waiting on an answer, a draft in its prompt — the rename is not lost
silently: a notice under the tab strip says why, until you dismiss it with
✕. A blank name, or the name the tab already shows, asks nothing. Once the
Claude in a tab has exited and its shell is back in front, the tab is
renamed like a shell tab.
Right-click a tab for its menu, or press open-tab-menu for the focused
one. A right-click focuses the tab first, because every entry acts on the
focused tab:
| Entry | Runs | Shown on |
|---|---|---|
| Rename tab | rename-tab | every tab |
| Tab colour… | pick-tab-color | every tab; disabled, with why, when no colour can be picked now (below) |
| Copy agent name | copy-agent-name | a tab whose focused pane has a named Claude in front |
| Reveal directory | reveal-session-dir | a tab whose focused pane’s directory is known |
| Reveal transcript | reveal-transcript | a tab whose focused Claude’s transcript the scan has found |
| Send to Claude Desktop | send-to-desktop | a Claude tab on macOS or Windows; disabled, with why, when Claude cannot take the command now |
| New shell here | new-shell-here | every tab |
| New Claude session here | new-claude-session-here | every tab |
| New Claude session in a worktree | new-claude-session-in-worktree | a tab whose focused pane is in a git checkout (below) |
| Split right | split-vertical | every tab |
| Split down | split-horizontal | every tab |
| Park tab | toggle-park-tab | every tab |
| Close pane | close-focused | every tab |
Each entry is the keyboard action of the same name, so it does exactly what
that action’s chord does — Rename tab opens the field above, which on a
Claude tab asks Claude to /rename; Close pane closes the focused pane of a
split and the whole tab otherwise, asking first as the chord does.
↑ and ↓ move the selection, Enter runs it,
Escape or a click outside the menu closes it without running
anything.
Tab colour… is always listed. When no colour can be picked for the focused pane at the moment the menu opens, it is greyed out with the reason beneath it — Claude waiting for an answer, draft in prompt, prompt not on screen (the view is scrolled back), and the like — and choosing it runs nothing and leaves the menu open.
Copy agent name is listed when the action would find a name at the moment
the menu opens: a Claude runs in front of the focused pane and has written its
session file, whether the pane was opened as a Claude session or as a shell.
On Windows that Claude must run as claude.exe: one an npm install runs as
node.exe is never named, so the entry never appears for it.
Reveal transcript shows the conversation’s .jsonl file selected in Finder
or Explorer, and opens the folder holding it on Linux. A fresh Claude has no
such entry until the sidebar’s scan has found its file. Send to Claude
Desktop is left out on Linux, where Claude Desktop does not run; elsewhere
it is greyed out as Tab colour… is, for the same reasons and also while
Claude is busy. The menu belongs to the pane it opened over: if that pane
closes or loses focus, the menu goes with it.
The menu opens in the middle of the window rather than beside the tab, and screen readers do not see it: it is drawn by termherd, not by the operating system.
Pick a tab’s colour from the menu’s Tab colour…, or with the
pick-tab-color action. A list of the eight colours /color offers, and
None, opens over the tab on the colour it wears — None when it wears
none; ↑,
↓, Enter and Escape drive it, as they drive
the menu, and a click picks too. Where the pick goes depends on the focused
pane:
| Focused pane | A pick | Shows |
|---|---|---|
| Claude, still running | types /color <name> (/color default for None), behind the prompt below | once Claude records it, usually half a second later (ten seconds at most) |
| Shell — or a Claude tab whose Claude has exited | is kept on the tab by TermHerd | at once |
A Claude tab’s colour is Claude’s: TermHerd keeps no copy of it, so it never
disagrees with Claude’s own prompt bar, and a /color typed by hand changes
it just the same. The list is offered while Claude is at work, but not for a
Claude waiting on an answer, or with something typed in its prompt — the
action does nothing then, and the menu greys Tab colour… out, saying why —
and if a dialog or a draft appears while the list is open, the pick is
refused and the list stays, saying why. Once the Claude in a tab has exited,
the tab is back at the shell it ran in, and TermHerd colours it as a shell:
/color is never typed into a shell.
That needs the operating system to report what runs in front of the shell,
which Windows does not, so there a Claude tab stays Claude’s.
A shell tab’s colour lasts as long as the tab: it moves with the tab and is
gone once the tab closes, and a tab reopened with reopen-closed-tab comes
back uncoloured. It also wins over the colour of a Claude you start by hand
in that shell, and None hides that colour too.
Tabs reorder by drag-and-drop. Press a tab and drag it onto another slot: the carried tab fades, the drop slot is outlined, and the reorder commits on release. The drag survives the pointer leaving the strip: releasing anywhere drops the tab at the last slot shown. To cancel, drag back onto the carried tab before releasing; switching away from termherd mid-drag abandons it too. A plain click still just activates the tab. The order lives in the pure workspace model — the tab strip holds only transient pointer state, so there is no second, rival tab tree to drift out of sync.
Parking a tab
Park a tab you are not working in with the menu’s Park tab, or with the
toggle-park-tab action, which has no default chord (bind one in
settings). The tab shrinks to its activity dot and
kind mark, moves to the right end of the strip, after the other tabs, and
leaves the Ctrl+Tab cycle. Parking does not pause
anything: its sessions keep running, and their status and notifications keep
flowing. Hovering a parked tab still shows its card.
A parked tab comes back when you select it: click it, jump to it by number, or reopen its session from the sidebar. It then takes its place at the end of the unparked tabs. A session in it that asks for attention brings it back as well, without switching to it — unless every tab was parked, since a parked tab is shown only then. Dragging a tab past the last unparked tab parks it, and dragging a parked tab before it unparks it. New tabs open before the parked ones, and a closed parked tab reopens unparked. The tab menu offers Park tab on unparked tabs only.
A Claude session in a new worktree
Run two Claude sessions on one repo without them editing the same files:
the menu’s New Claude session in a worktree, or the
new-claude-session-in-worktree action, which has no default chord, adds a
git worktree to the focused pane’s repo and opens a fresh Claude session in
it.
- The worktree goes in
.claude/worktrees/claude-<8 hex digits>under the repo’s main checkout, the folderclaude --worktreeuses, on a new branch of the same name. The digits are the first eight of the session’s id, so a branch tells you which conversation wrote it. It branches off what the focused pane’s checkout has checked out, a linked worktree included. - The session joins the repo’s row in the sidebar, as any worktree’s does.
- Nothing is removed for you: when you are done, merge the branch and run
git worktree removeon the folder. Add.claude/worktrees/to the repo’s.gitignoreifgit statuslists it.
The tab opens once git has finished, in front if you are still on the pane
you asked from, behind it if you have moved on or opened a prompt since. When
git fails — no git on the PATH, or the name already taken — a notice
under the tab strip says why, and no tab opens; what git created before
failing, a branch or a folder, is left for you to remove.
Coming back after a restart
Quitting TermHerd writes the tab strip to ~/.termherd/layout.json, and the
next launch opens it again: every tab in its order, each split with its
ratios and focused pane, the tab names and colours you set, the parked tabs,
and the tab you were on. Each pane starts afresh in the directory it was in
when you quit. A Claude pane resumes the conversation it held last, once the
sidebar listed it; one that never got that far starts a new conversation, as
reopening a closed tab does. A shell pane comes back as a new shell: what ran
in it, and its scrollback, do not.
The strip is written when you quit, not as you work, so a crash or a forced kill brings back the strip of the last clean quit. A link that starts TermHerd is followed once the strip is back, so it shows a restored tab working in its repo before it opens a shell.
Opening a tab from a link
A page can link straight into termherd: a README, a dashboard, a report listing repos. The link names a repo by its absolute path, percent-encoded:
termherd://open?repo=/Users/me/work/my%20repo
termherd://open?repo=C:%5CUsers%5Cme%5Cwork
termherd shows the tab already working in that repo: a pane whose current
directory is the repo or a folder inside it. That pane takes the focus, and a
parked tab is unparked. When no pane works there, termherd opens a shell in the
repo, in front. A link never types into a session and never starts Claude: it
only shows a tab or opens a shell. Anything else is refused whole and opens
nothing: another action, another parameter, a relative path, a network share
(//host/share), a path with a control character. When termherd is not
running, the link starts it.
A shell is still a shell: opening one runs your shell’s startup files and
prompt in that directory, as cd would. A prompt that runs git status reads
the repo’s own git configuration, so follow a link into a repo only when you
would cd into it. Each link opens at most one shell, but nothing limits how
many links a page sends.
The installers register the scheme: the macOS .app, the .deb, and the
Windows installer. The AppImage installs nothing, so it registers nothing, and
neither does a build run with cargo run.
| Action | macOS | Windows / Linux |
|---|---|---|
| Split vertical (side by side) | Cmd+D | Alt+Shift++ |
| Split horizontal (stacked) | Cmd+Shift+D | Alt+Shift+- or Alt+Shift+D |
| Focus a neighbour | Cmd+Shift+←↑↓→ | Ctrl+Shift+←↑↓→ |
A split opens a fresh shell beside the focused pane. Directional focus walks the pane tree geometrically — Cmd/Ctrl+Shift+→ goes to the pane on the right, whatever the nesting.
Closing the last pane in a tab closes the tab.
Drag-resize a split by dragging the handle between its panes. The ratio
updates as you drag; each side stays between 10% and 90% of that split’s usable
space. Terminal sizes update when you release. Two extra focus actions,
focus-next and focus-prev, exist in the keymap with no default chord — bind
them yourself if you prefer cycling to directional movement
(settings.json).
Closing, and what asks first
Closing a tab, and quitting the app, are each governed by their own
confirmation policy — alwaysConfirm, confirmWhenActive (the default), or
noConfirmation. Under the default, a tab whose session is mid-command asks
before closing; an idle one closes silently. Quitting names how many sessions
will be force-stopped, and always asks while the doc editor holds unsaved
changes.
A pane whose shell exits cleanly closes itself; one whose shell exited with
a failure stays on screen so you can read what happened, under a line naming
its exit code: [process exited with code 1. Press Enter to close].
Enter closes it; any other key does nothing. Under cmd.exe, a bare
exit returns the last command’s error level, so exit after a failed
command leaves the pane open: type exit 0 to close it at once.
The terminal
Each pane is a real PTY running a real program — a login shell, or the Claude CLI — rendered on a canvas. It is a terminal, not a transcript viewer: full escape-sequence handling, scrollback, selection, colours.
Selection and clipboard
Drag with the mouse to select; a double-click selects the word under the
pointer, or the whole URL or path when there is one — exactly the span a
link click opens, so a sentence’s closing . is left out
and a :42 suffix kept; a triple-click selects the whole line, every row a
long line wrapped onto;
Shift+click extends the current selection.
The chords that reach the clipboard:
| macOS | Windows / Linux | |
|---|---|---|
| Copy selection | Cmd+C | Ctrl+Shift+C |
| Paste | Cmd+V | Ctrl+Shift+V; also Ctrl+V on Windows |
On Windows and Linux Ctrl+C must stay the interrupt; it
sends SIGINT on every platform. On Windows Ctrl+V
pastes too, as in Windows Terminal, and Claude Code takes its image paste from
Alt+V; on Linux Ctrl+V reaches the
program, where Claude Code pastes an image on it.
A paste that would run line by line
A program that turns on bracketed paste — Claude Code, zsh, fish, bash 5.1
and later, vim — receives a paste as one block, so its line breaks stay text.
A program that never turned it on, such as sh or cmd.exe, cannot tell a
paste from typing: each line break is an Enter, and each line runs as it
arrives, including one you did not see on the page you copied from.
So a paste holding a line break — a trailing one included — into such a terminal waits for you. A prompt names the tab and the number of lines; Paste (or Enter) sends the text unchanged, Cancel (or Escape) drops it. The paste chord and the right-click paste both ask. A single line with no line break, or any paste into a program that turned bracketed paste on, is written at once.
Option as Meta (macOS)
The left Option key is Meta: ⌥B / ⌥F move by word,
and Claude Code’s ⌥T / ⌥P work. The right one types
what the layout composes: | with ⌥⇧L on a French layout, å on
a US one.
"terminal": { "option_as_meta": "left" }
"right" swaps them, "none" makes both compose, "both" makes both Meta.
⌥Enter (a newline in Claude), ⌥⌫ and ⌥← /
⌥→ work with either key. On Windows and Linux, Alt is always Meta.
Meta sends ESC before what the key would send without it, for any ASCII
character: Meta+. is ESC . (the shell’s last
argument), Meta+Shift+B is ESC B,
Ctrl+Meta+B is ESC ^B, and
Meta+Space is ESC and a space. A shifted symbol
types what the layout gives it, without ESC.
Cursor keys
The arrows, Home and End follow the mode the program
asked for: ESC O A once it switched to application cursor keys (as vim and
less do), ESC [ A otherwise. With a modifier held they always send the
ESC [ 1 ; <mod> A form.
Accents and composed text
Dead keys and input methods compose in the focused terminal: ^ then
e types ê on a French layout, and CJK input methods work the same
way. While a composition is pending, its text shows underlined over the
cursor cell, at the terminal’s font size but in the interface font. It goes
away when the character is typed, and when you press Escape, leave
the window or open a prompt.
Mouse gestures
The two classic terminal conventions are available, both off by default — so nothing reaches the clipboard unless you asked for it:
"terminal": { "copy_on_select": true, "paste_on_right_click": true }
copy_on_select— releasing a drag, or double- or triple-clicking, copies the selection outright, in a session still running: a pane whose session exited selects and copies nothing. With it off the selection still highlights and waits for the copy chord, which asks the terminal for its current selection — even one scrolled out of view — so the text you copy is the text you just selected, never what you copied last. With nothing selected the chord does nothing — in particular in a pane whose program owns the mouse (below), where the program’s own copy of a drag stays on the clipboard untouched.paste_on_right_click— a right-click pastes into the pane under the pointer, which need not be the focused one, and is bracketed when that pane asked for bracketed paste. The click also focuses that pane, so the keys you type next go where you just pasted. A confirmation prompt refuses it, exactly as it refuses the paste chord — the pointer is not a way past a prompt. A multi-line paste into a pane without bracketed paste asks first.
When the program reads the mouse
A full-screen program that turns mouse reporting on — Claude Code’s /diff
and /resume, vim, lazygit, fzf, less, tmux with mouse on — owns the mouse
while it runs. Clicks, drags and (when it asked for them) bare moves go to the
program, so clicking an entry in /resume selects it and clicking in vim
places the cursor; the terminal draws no selection of its own over it, and a
right-click reaches the program instead of pasting. The wheel already worked
this way.
Hold Shift to take the mouse back: Shift+drag selects text from a mouse-mode program exactly as a plain drag does at a shell, and the copy gestures above apply to it. The link modifier does the same for a Ctrl/Cmd+click on a path or URL, which opens it rather than reaching the program. Neither modifier is reported to the program, so it never sees the click it lost.
See settings.json.
Scrollback
The wheel scrolls back through history. Cmd+Up jumps to the top of the buffer and Cmd+Down back to the bottom on macOS; Ctrl+Shift+Home / End on Windows and Linux, where Ctrl+Up / Down reach the program.
Zoom
Cmd/Ctrl + + / - / 0
steps the font size up, down, and back to the configured base. Zoom is a
runtime state — it does not rewrite terminal.font_size in your settings.
Three chords are bound to zoom-in, not one: mod+=, mod+shift+= and
mod+plus. On QWERTY and AZERTY + is the shifted face of the = key, so
zoom-in answers that key with or without Shift; mod+plus is the keypad
+.
Clickable links
URLs in terminal output (http, https, file, ftp, termherd) are
detected per row. Hold Cmd/Ctrl: the link under the
pointer underlines and the cursor becomes a hand;
Cmd/Ctrl+click opens it in your OS default handler.
Trailing prose punctuation and unbalanced brackets are trimmed from the match.
A termherd:// link comes back to termherd itself: see
Opening a tab from a link.
Hidden hyperlinks work the same way. A program can print a label over a
URL it never shows — the OSC 8 escape, which gh, ls --hyperlink, cargo
and Claude Code’s rendered markdown all emit — so a table cell reading #76
may point at the full issue URL. termherd carries that target with the grid:
hover the label and it underlines, click it and the hidden URL opens. Where a
label sits over a hyperlink and looks like a URL itself, the hyperlink wins —
it is what the program meant, the text is only its face.
Clickable file paths
The same gesture opens file paths — the payoff being that cargo test
prints crates/pty/src/grid.rs:184, and you click it.
Detection is syntactic, then checked against the disk. A bare word with no
separator and no extension is never a candidate (otherwise every word under the
pointer would cost a stat). A :line[:column] suffix is split off the target
before resolution. URL cells are masked out so the two detectors never light
the same columns.
Resolution walks candidate roots innermost first, and that order is the
disambiguation rule — cargo, git and pytest print relative to different
roots:
- the session’s live working directory (which follows your
cds), - the repository containing it,
- the directory the session was launched from.
A path underlines only once it has resolved. An underline that turns out to point at nothing is worse than an underline one frame late.
What it opens the file with
By default, the OS default handler — and that has two consequences worth
knowing, both of which the open setting removes.
A line number cannot be honoured. Detection splits :184 off the target
and carries it all the way through, but “open this file” is all the OS handoff
can express.
Executable-by-association files are neither underlined nor opened. Handing
a path to the OS means “do what the association says”, and for a program that
means run it — an ls of an untrusted clone is enough to put payload.app on
screen. The refusal happens where the resolved path arrives, so hover and click
can never disagree: what will not open does not underline either, and you see
the refusal before you click. It is a mitigation, not a guarantee: on macOS and
Linux the set of extensions that execute is small and closed, but on Windows
the association table maps .js, .py and every installed language onto an
interpreter, and excluding those would refuse exactly the source files the
feature exists to open.
Naming an editor removes both. Set open.command with {path}, {line}
and {col} templates — see settings.json — and
the click lands on the right line. An explicit editor consults no association
either, so the refusal above lifts and those files open like any other. Give a
GUI editor: the child’s standard streams are closed, so a terminal editor
would start invisible and unkillable. The command runs as argv, never through a
shell, and it is split on whitespace before {path} is filled in — so a
filename containing spaces or & can never become a second argument.
One limit remains, known and accepted: a path that wraps across two lines is not detected, the same limit URLs have; a double-click on it selects only the part on the clicked line.
Colours and font
The terminal grid keeps its own colours, independent of the app chrome theme.
Start from one of the 18 built-in schemes, each named like the chrome theme it
matches, and override any slot — foreground,
background, cursor, and the 16 ANSI colours. A malformed colour degrades alone,
with a logged warning, instead of failing the file. See
settings.json.
What the shell announces
TermHerd tracks the session’s working directory from the shell’s own OSC 7
announcements, so a pane’s cwd follows your cds rather than reporting the
directory it was launched in forever. That live cwd is what
Cmd+T / Ctrl+Shift+T
opens a new shell in, what path resolution tries first, and what snapshot
reports over
MCP.
The environment a pane starts with
A pane inherits TermHerd’s environment, with two kinds of change: the
terminal identity Claude’s status stream needs (see
Status), and nothing of a Claude Code session TermHerd itself
was started from. Started from a Claude Code shell, TermHerd would otherwise
pass that session’s CLAUDECODE, CLAUDE_CODE_SESSION_ID, CLAUDE_PID,
messaging socket and the like to every pane, and a Claude launched there took
itself for part of the parent session and could not be named. Variables you
set yourself, such as CLAUDE_CONFIG_DIR or an API key, still reach every
pane.
Status and attention
Running many sessions is only useful if you can tell, at a glance, which one needs you. Every session carries one of five activity statuses:
| Status | Means |
|---|---|
starting | spawned, nothing heard from it yet |
busy | running a command / thinking |
idle | at a prompt, waiting for input |
attention | actively wants you — a permission prompt, a question |
exited | the program is gone |
The status drives the tab activity dot, the focused-terminal badge, the
marks of a waiting session, the close
confirmation, and the MCP wait_for_status tool.
When a session waits for you
A session in attention is marked wherever you might be looking:
| Where | Mark |
|---|---|
| its tab, when another tab is active | the chip is tinted red |
| its pane, in a split, when it does not hold the keyboard | a red frame, kept when the window loses focus |
| the end of the tab strip | N waiting; a click goes to the next one |
| the Dock icon (macOS) | the number of sessions waiting |
next-attention (mod+shift+a) goes to the next waiting session after the
focused pane, across tabs and splits, and wraps around. With none waiting it
does nothing. Every mark clears when the session resumes work.
A session’s own colour (/color) outlines its tab and marks its sidebar row;
a waiting mark is a fill, a frame or words instead, so a red session is never
mistaken for one that waits.
Where the signal comes from
Status is folded from what the terminal says about itself — not guessed from output text.
Claude sessions report through the CLI’s OSC title stream. Two things are needed for that stream to exist, and TermHerd arranges both:
- The CLI only emits its busy/idle/attention stream when it detects iTerm2 as
the host, so the PTY adapter advertises
TERM_PROGRAM=iTerm.app(with a version) on every spawned session. - A
CLAUDE_CODE_DISABLE_TERMINAL_TITLEin your own~/.claude/settings.jsonwould silence it entirely, and thatenvblock outranks the environment TermHerd spawns with. So a Claude launch passes a private--settingsoverlay, which outranks it in turn and merges with — never replaces — your settings. The flag needs Claude Code 1.0.61; the CLI floor sits higher still, at 2.0.73, for--session-id(see Installation).
The CLI’s own product name (✳ Claude Code), which it reports until it has
something session-specific to say, is ignored: a tab would otherwise trade its
project name for the program’s.
Plain shells get an injected OSC 133 shell-integration snippet, whose prompt and command marks fold into the same status:
| Shell | How | Always on? |
|---|---|---|
| zsh | a private ZDOTDIR | ✅ yes, unless ~/.zshenv sets ZDOTDIR |
| bash | --rcfile | only when named in settings.shell |
| fish | --init-command | only when named in settings.shell |
Each recipe replays your startup files first, so your prompt and aliases are untouched.
Bash and fish need their snippet as a command-line argument, and TermHerd
will not add one to the platform’s default program — that would demote your
login shell to an ordinary one and change which startup files run. So: name
your shell explicitly in settings.json to get the finer marks. zsh needs no
argument and is integrated by default — unless your ~/.zshenv itself sets
ZDOTDIR, which takes zsh away from TermHerd’s files: see
Environment variables.
Where injection cannot apply — an unknown shell, an unwritable temp
directory — the PTY’s foreground process group stands in. It is retired for
good by the first real mark or Claude signal, so it can never contradict what
the terminal says about itself. Windows ConPTY exposes no foreground process
group, so a shell with neither route stays on starting there.
Desktop notifications
When a session asks for you (Claude’s OSC 9 notification), TermHerd posts a desktop notification titled with the session’s tab name and carrying Claude’s message. None is posted for the pane you are already looking at while the TermHerd window has focus.
Clicking the notification brings you back to that session:
TermHerd comes to the front — restored first if it was minimised — and
activates the tab and pane that raised it, the same reveal the MCP
focus_pane tool performs. The notification
remembers the session, not the tab title, so two tabs with the same name are
never confused. If the tab was closed in the meantime, or a prompt is open (a
close or quit confirmation, the settings panel, the document editor), the
click brings TermHerd forward and changes nothing else; an inline rename is
dismissed, as any click elsewhere dismisses it. Dismissing the notification
does nothing.
Confirmed on macOS only. A real click brought the right tab forward. The minimised-window and open-prompt cases, and the Linux and Windows rows, are read from the notification libraries’ sources.
| OS | Click reaches TermHerd | Window comes forward |
|---|---|---|
| macOS | ✅ while the banner is still in the notification centre | ✅ |
| Linux | ⚠️ only if the notification server supports actions | ❓ Wayland may refuse |
| Windows | ⚠️ only while the toast is on screen — once it times out into the action centre, the click is lost | ❓ may only flash the taskbar |
On Linux a session’s new notification replaces its previous one, so each session shows one banner. On Windows the toast is attributed to PowerShell until TermHerd registers its own application id.
At most 16 notifications wait for a click at once; past that, a new one still appears but clicking it does nothing, until earlier ones are clicked or dismissed.
Close confirmation
Closing is governed per action — tab and app — by one of three policies:
| Policy | Behaviour |
|---|---|
alwaysConfirm | always ask |
confirmWhenActive | default — ask only while a session runs a foreground process |
noConfirmation | never ask |
Under the default, “runs a foreground process” means:
| Session | Runs a foreground process while |
|---|---|
| Claude | it has not exited, an idle prompt included |
| shell, macOS and Linux | it is busy or attention, or a program other than the shell has the terminal (vim, less, htop, a long make) |
| shell, Windows | it is busy or attention, a Claude runs in it, or a program is on the alternate screen (vim, less) |
On macOS and Linux TermHerd reads which process owns the terminal, so a
program in front of the shell counts even when the status reads idle: after
a claude typed by hand has exited, for instance, Claude’s last title can
leave the shell reading idle while vim runs. Windows has no such reading:
there TermHerd finds only a Claude below the shell, so beyond the status only
a Claude and full-screen programs count; a long command a shell without
integration runs closes without asking.
Quitting names the cost: “Quit TermHerd? 3 open sessions will be
force-stopped — any running work is lost.” Every non-exited session dies on
quit, Claude or shell. A doc with unsaved changes is named in the same prompt,
and makes the quit ask under every policy, noConfirmation included.
Every confirmation is answerable from the keyboard — Escape to cancel, Enter to confirm — which is also what makes them reachable from MCP.
Capture and record
Two shortcuts exist for one job: handing an AI assistant — or a bug report — the app’s exact state, without asking a human to describe it.
| macOS | Windows / Linux | Writes | |
|---|---|---|---|
| Capture state | Cmd+Shift+S | Ctrl+Shift+S | capture-<ts>.json + capture-<ts>.png |
| Record (start / stop) | Cmd+Shift+R | Ctrl+Shift+R | capture-<ts>.gif |
Everything lands in ~/.termherd/captures/. <ts> is a UTC
YYYYMMDD-HHMMSS-mmm stamp, so the latest capture is the highest-named
file — an assistant finds it by sorting the directory, with no clock of its
own.
The state dump
capture-<ts>.json is a diffable dump of the whole workspace: focus, the
resolved config, the sidebar, every tab with its panes (each pane’s stable
handle, kind, cwd, status, and the pid, peer_name and session_id of
the Claude running in it, all three null when none is, and the color
it wears — its Claude’s /color, or the colour picked for a shell’s tab),
and the focused terminal’s visible text, its secrets masked
(below).
It is the same model the MCP snapshot tool
reports, taken under a fixed full filter — one model, two readers, so a field
never means one thing on disk and another on the wire.
Because it is text, no vision is needed to read it:
> Read the newest file in ~/.termherd/captures/ and tell me
> why the second pane shows no prompt.
The screenshot
capture-<ts>.png is the real window pixels, for the render, colour and glyph
bugs a text dump cannot show. It is the companion to the JSON, not a
replacement — reach for it when the question is visual.
The screencast
Cmd/Ctrl+Shift+R starts a GIF
screencast; press again to stop, or let it auto-stop at the cap. Defaults: 8
fps, 30 s, 0.5× scale, all configurable under record in
settings.json.
Motion is what a still cannot carry: a gesture that half-works, a flicker, a focus that lands on the wrong pane.
What a capture keeps private
A capture holds a whole terminal’s text, and a terminal shows secrets: a
pasted token, an env listing, a .env file someone printed.
-
Only you can read it. The directory is
0700and every file in it0600, on macOS and Linux; a directory an older build left open is tightened at the next capture. On Windows the files inherit your profile’s permissions. -
Secrets are masked in the dump. Before the JSON is written, the terminal text has each of these replaced by
[redacted]:Shape Example Kept AWS access key id AKIA…,ASIA…— AWS secret assignment AWS_SECRET_ACCESS_KEY=…, anyAWS_name holdingKEY,SECRETorTOKENthe name API key sk-…(OpenAI, Anthropic)— GitHub token ghp_…,gho_…,ghu_…,ghs_…,ghr_…,github_pat_…— HTTP bearer token Authorization: Bearer …BearerPEM private key -----BEGIN … PRIVATE KEY-----blockthe BEGINandENDlinesTurn it off with
"capture": { "redact": false }insettings.json; an MCP client cannot change it. The screenshot and the screencast are pictures and are not masked: a secret on screen is in them.Only these shapes are recognised. A password or a token in some other format is written as-is: there is no guess based on how random a string looks, because hashes, UUIDs and base64 output would be masked with it.
-
Only the newest 50 captures are kept. After each capture or screencast, the oldest ones beyond 50 are deleted; a JSON dump and its screenshot count as one. Only files named like TermHerd’s own (
capture-YYYYMMDD-HHMMSS-mmm.json,.pngor.gif) are ever deleted: anything else you put in the directory, or a capture you rename, stays. Copy a capture out of the directory to keep it.
How it stays honest
Capture is pure in the domain core — an Event::Capture in, an
Effect::Capture out — and every piece of I/O (the clock, the JSON and PNG
encoding, the files) lives in the GUI adapter. The GIF encoder runs on its own
thread, so recording does not stutter the UI or itself.
The recording state machine uses frames as its time proxy, not a clock, which is what keeps it testable without one.
The settings panel
The ⚙ at the top of the sidebar — or
Cmd/Ctrl+, (rebindable as open-settings) —
opens a panel over the workspace. Escape, Close, or a click
outside it closes it.
┌ Settings ─────────────────────────── Close ┐
│ Interface theme [ Solarized Light ▾ ] │
│ Terminal colours [ Solarized Light ▾ ] │
└──────────────────────────────────────────────┘
Today it holds the appearance. The rest of settings.json is edited in the
file, which applies on save too — see settings.json.
An edit to the file while the panel is open shows in it at once.
A pick applies at once, and saves itself
There is no Apply button. Picking a value:
- Interface theme restyles the sidebar, tab strip and buttons on the next
frame. Every theme iced ships: 22. While the terminal colours are
Same as theme, it recolours every open terminal with them. - Terminal colours recolours every open terminal, not only new ones.
Same as theme, the default, follows the interface theme; a scheme picked here stays when the theme changes. Explicit colour overrides interminal.colorsstill win over the scheme, as they do at startup.
Each pick writes its own key to settings.json — theme or
terminal.colors.scheme — and leaves the rest of the file as you wrote it.
A file that does not parse is left alone rather than rewritten.
With Same as theme, the window matches by itself. 18 themes have a scheme
of their own; the list shows which, and
what the others bring.
One thing a live change cannot reach
A program asks the terminal for its background colour when it starts, and picks a light or a dark look from the answer. Claude Code does this. A Claude session that was already running keeps the look it chose until it restarts; TermHerd’s own colours change at once. New sessions get it right.
Keyboard shortcuts
Every shortcut is an action with a kebab-case name and a default chord.
Rebind any of them in the keys section of
settings.json; an override replaces that action’s
default, and unlisted actions keep theirs.
The window shows the chord where it offers the action: at the end of each tab menu line, in the tooltips of the sidebar’s Hide and settings buttons, and in the search box’s placeholder. It reads your keymap, so a rebinding shows there at once, and an action with no chord shows none. macOS spells a chord with symbols (⇧⌘R), other platforms with words (Ctrl+Shift+R).
Below, mod is the platform primary modifier: Cmd on macOS,
Ctrl everywhere else. It is a shorthand for reading this table —
not valid chord syntax. Write concrete modifiers in your own bindings.
On Windows and Linux, defaults leave the terminal’s control keys alone.
A bare Ctrl chord a shell’s line editor reads is one —
Ctrl+D is end-of-file, Ctrl+W
deletes a word, and xterm sends Ctrl+2 … 8 as
control bytes — and a chord TermHerd binds never reaches the program in the
pane. So where mod would land on one, the action takes
Ctrl+Shift instead, as GNOME Terminal, Konsole and kitty
do; the rows below name that chord off macOS. A program reading the legacy
keyboard encoding sees Ctrl+Shift+letter as the same byte
as the unshifted chord, so nothing is taken from it. The splits follow Windows
Terminal: Alt+Shift++ side by side,
Alt+Shift+- stacked. The tab jumps take
Alt+1 … 9, as in GNOME Terminal and Konsole.
Two exceptions are kept on purpose: plain Ctrl+V pastes on Windows, and zoom-out stays on Ctrl+- — both below.
The full action vocabulary
Tabs
| Action | Default | Does |
|---|---|---|
next-tab | ctrl+tab | next tab (Ctrl on every platform) |
prev-tab | ctrl+shift+tab | previous tab |
activate-tab-1 … -9 | cmd+1 … cmd+9; alt+1 … alt+9 off macOS | jump to tab N |
new-shell-here | mod+t; ctrl+shift+t off macOS | new shell in the focused session’s directory |
new-claude-session-here | mod+alt+t | new Claude session in that directory |
new-claude-session-in-worktree | (unbound) | new Claude session in a new git worktree of that repo (worktrees) |
reopen-closed-tab | mod+shift+t; ctrl+alt+shift+t off macOS | reopen the tab you just closed |
close-focused | mod+w; ctrl+shift+w off macOS | close the focused pane; a lone pane closes its tab |
rename-tab | mod+shift+i | rename the focused tab, as a double-click does |
open-tab-menu | mod+shift+m | open the focused tab’s menu, as a right-click does |
pick-tab-color | (unbound) | pick the focused tab’s colour |
toggle-park-tab | (unbound) | park the focused tab, or unpark it (parking) |
open-new-session | (unbound) | reserved — no surface yet |
rename-tab opens the same inline field a double-click on the tab opens,
filled with the tab’s current name: Enter keeps the edit — on a
Claude tab by asking Claude to /rename it, as
a double-click does — and
Escape drops it. Its chord is Terminal.app’s Edit Title on macOS;
on Windows and Linux Ctrl+Shift+I reaches a
program in the terminal as the same byte as Ctrl+I, which
is Tab, so claiming it takes nothing away from that program.
pick-tab-color opens a list of the eight colours Claude’s /color takes,
and None, over the focused tab — the list the tab menu’s Tab colour…
opens. ↑ and ↓ move, Enter picks,
Escape leaves. On a Claude tab the pick is typed as /color behind
the usual prompt, and the action does nothing unless that Claude has an empty
prompt and no dialog open (it may be at work); on a shell tab, or one whose
Claude has exited, TermHerd keeps the colour itself (see
tabs). Bind it yourself; it has no
default.
open-tab-menu opens the tab menu a
right-click opens; every entry in it is one of the actions on this page. With
no tab open it does nothing. The chord follows the letter M wherever the layout
puts it. On Windows and Linux Ctrl+Shift+M
reaches a terminal program as Ctrl+M, which is
Enter, so the unshifted chord still gets there.
Bind letters and named keys, not punctuation that needs Shift. A chord is
matched on the key pressed before Shift applies, so on French AZERTY, where
. is Shift+;, a press of
Cmd+Shift+; is the chord cmd+shift+;, never
cmd+shift+.. When a chord does nothing, run with
RUST_LOG=termherd=debug: every chord with a modifier other than Shift that
reaches no action is logged with the key and modifiers it arrived as.
activate-tab-N is matched by physical key position, so it lands on the
same keys on AZERTY and QWERTZ, where the number row produces &, é, …
without Shift. Off macOS it takes Alt, which costs the shell its
Alt+digit numeric argument from the number row; bind
"activate-tab-1": "ctrl+1" and so on to get the old chords back.
Splits and focus
| Action | Default | Does |
|---|---|---|
split-vertical | mod+d; alt+shift+= off macOS | split side by side |
split-horizontal | mod+shift+d; alt+shift+-, alt+shift+d off macOS | split stacked |
focus-left | mod+shift+left | focus the pane to the left |
focus-right | mod+shift+right | … to the right |
focus-up | mod+shift+up | … above |
focus-down | mod+shift+down | … below |
focus-next | (unbound) | cycle forward through panes |
focus-prev | (unbound) | cycle backward |
next-attention | mod+shift+a | go to the next session waiting for you |
Terminal
| Action | Default (macOS) | Default (Windows / Linux) |
|---|---|---|
copy | cmd+c | ctrl+shift+c |
paste | cmd+v | ctrl+shift+v; also ctrl+v on Windows |
copy-agent-name | (unbound) | (unbound) |
send-to-desktop | (unbound) | (unbound) |
reveal-session-dir | (unbound) | (unbound) |
reveal-transcript | (unbound) | (unbound) |
scroll-top | cmd+up | ctrl+shift+home |
scroll-bottom | cmd+down | ctrl+shift+end |
zoom-in | cmd+=, cmd+shift+=, cmd+plus | ctrl+… (same three) |
zoom-out | cmd+- | ctrl+- |
zoom-reset | cmd+0 | ctrl+0 |
On Windows and Linux Ctrl+C must stay the interrupt, so
copy takes Shift; Ctrl+C sends SIGINT everywhere. Paste
takes Ctrl+Shift+V, and on Windows plain
Ctrl+V as well, as in Windows Terminal: Claude Code on
Windows pastes an image on Alt+V, which still reaches it.
On Linux Ctrl+V is left to the program, because
Claude Code pastes an image on it there. To paste text on it anyway, bind
"paste": ["ctrl+v", "ctrl+shift+v"].
split-horizontal also takes Alt+Shift+D off
macOS. On AZERTY, - shares the 6 key, and a number-row key is
matched by its position, so Alt+Shift+- works
there from the keypad minus only.
Off macOS, scroll-top and scroll-bottom take Windows Terminal’s
Ctrl+Shift+Home / End, leaving
Ctrl+↑ / ↓ to the program in the pane.
copy-agent-name copies the peer name of the Claude in the focused pane:
the name /list-agents shows and another Claude session addresses it by, such
as termherd-b0. It reads Claude’s session file at the moment you press it,
and does nothing when no Claude runs there or it has not written one yet.
On Windows it finds a Claude that runs as claude.exe, and not one an npm
install runs under node.exe. Bind it yourself; it has no default.
send-to-desktop asks to type /desktop into the Claude in the focused pane,
which hands the session to the Claude desktop app. A prompt shows the exact line
first: Enter types it, Escape drops it. It does nothing
unless that Claude is idle with nothing typed in its prompt. On Linux, where
Claude Desktop does not run, it does nothing. Bind it yourself;
it has no default.
reveal-session-dir opens the focused pane’s working directory in the file
manager: Finder, Explorer, or the one xdg-open picks on Linux.
reveal-transcript shows the focused Claude’s transcript, its .jsonl file,
selected there; on Linux, where no file manager takes a selection the same
way, the folder holding it opens. It does nothing on a shell pane, and on a
fresh Claude until the sidebar’s scan has found its file. Neither has a
default.
Off macOS zoom keeps bare Ctrl, as GNOME Terminal, Konsole and
Windows Terminal do. Ctrl+- shares its key with _
(undo in a shell’s line editor) on US layouts, but TermHerd sends that chord
to a program as a plain -, so binding it takes no control byte away. Moving
it to Ctrl+Shift+- would leave AZERTY, where
- is on the 6 key, without a zoom-out chord.
Zoom-in binds three chords. On QWERTY and AZERTY + is
Shift+=, and a chord is matched on the key before Shift
applies (see above), so Cmd++ arrives as mod+shift+=
and Cmd+= as mod+=. mod+plus is the keypad
+, or the + key of a layout that types it without Shift,
such as German QWERTZ. On Windows and Linux AZERTY, where - shares the
6 key, zoom-out answers the keypad minus only, as split-horizontal
does above.
App
| Action | Default | Does |
|---|---|---|
focus-search | mod+f; ctrl+shift+f off macOS | focus the sidebar search box |
toggle-sidebar | mod+b; ctrl+shift+b off macOS | show / hide the sidebar |
open-settings | mod+, | open / close the settings panel |
capture | mod+shift+s | write a state dump + screenshot |
toggle-record | mod+shift+r | start / stop a GIF screencast |
Not in the keymap
| Gesture | Does |
|---|---|
| Ctrl+C | interrupt (SIGINT) — passed through to the program |
| Escape | cancel an open prompt, rename, tab menu or doc pane |
| Enter | confirm an open prompt; run the selected tab-menu entry |
| ↑ / ↓ in the tab menu | move the selection |
| Right-click a tab | focus it and open its menu |
| Drag a selection | select; copies too with terminal.copy_on_select (off by default) |
| Double-click | select the word, or the whole URL or path, under the pointer; copies too with terminal.copy_on_select |
| Triple-click | select the whole line, wrapped rows included; copies too with terminal.copy_on_select |
| Right-click | paste, with terminal.paste_on_right_click (off by default) |
| Wheel | scroll back through history, or the wheel event to a program reading the mouse |
| Click, drag, right-click in a program reading the mouse | the event goes to the program — vim, lazygit, Claude Code’s /resume; nothing is selected or pasted locally |
| Shift+drag in such a program | the terminal’s own selection, as a plain drag is at a shell |
| Cmd/Ctrl+click | open a URL, hidden (OSC 8) hyperlink or file path under the pointer |
| Drag a tab | reorder it |
| Ctrl+Cmd+Space (macOS) | open the Character Viewer (Edit → Emoji & Symbols); a picked emoji goes to the focused rename field or terminal |
| Cmd+M (macOS) | minimize the window (Window → Minimize); as a menu shortcut it wins over a mod+m binding |
Escape and Enter are bound to no action on purpose: they belong to whichever overlay is open. That is also what makes them the only way an MCP caller can answer a prompt it armed.
Chord syntax
Case- and order-insensitive. Modifiers ctrl, shift, alt, cmd, joined to
a key with +. Aliases: control for ctrl, option for alt, and
super, logo, win or meta for cmd. The + key itself is spelled
plus, since a literal + is the separator. It names a key that types +
without Shift, such as the keypad +: on QWERTY and AZERTY,
Ctrl+Shift++ is ctrl+shift+=, never
ctrl+shift+plus.
"keys": {
"copy": "ctrl+y",
"paste": ["ctrl+shift+v", "shift+insert"],
"activate-tab-1": "ctrl+1"
}
A key is a single character (a, 1, ;) or one of these names: tab,
enter, escape, space, backspace, delete, insert, up, down,
left, right, home, end, pageup, pagedown, and f1 to f12. A
chord naming any other key never matches a press.
A binding wins over the terminal. Bind space, backspace or a letter with
no modifier, or with Shift alone, and that key stops reaching the program in
the pane.
One chord or a list of chords per action. Unknown action names and unparsable chords are logged and skipped — they do not invalidate the rest of the file.
Reading the live keymap
The stdio MCP server publishes the action catalogue — each
action with its default chords and the override settings.json sets for it,
if any — as a resource at termherd://keys/schema. It is generated from the
same in-code table this page describes, so it cannot drift from the binary you
are running, and its defaults are the running platform’s. One gap: the
activate-tab-N family is not listed.
settings.json
~/.termherd/settings.json (macOS, Linux)
%USERPROFILE%\.termherd\settings.json (Windows)
Changes apply as soon as the file is saved — no restart, no session lost. The settings panel changes the appearance from inside the app and saves it here.
The annotated template with every option, its default and its meaning is
docs/settings.example.jsonc
— copy the blocks you want and strip the comments. The real file is strict
JSON: no comments, no trailing commas.
How it loads
Read at startup, then again each time the file changes on disk — whoever
wrote it: your editor, an MCP set_option, the settings panel. Defensively,
both times:
- Every field is optional. A missing file, a missing field, or a corrupt file falls back to built-in defaults — settings never block startup.
- A file that is not valid JSON is set aside as
settings.json.corrupt-1(then-2, …) and the sidebar says so, so nothing TermHerd saves later can overwrite what you wrote. Fix the copy and move it back.metadata.jsonis protected the same way. - Out-of-range values clamp instead of failing the file.
- One bad value — a typo’d colour, an unknown action name — degrades alone with a logged warning. The rest of the file still applies.
- While the app runs, a file that does not parse — a save your editor has only half written, a missing brace — changes nothing: the running settings stay until the next valid save. Nothing falls back to defaults mid-run, and nothing is set aside.
What a live change reaches:
| Setting | Applies to |
|---|---|
theme, terminal.colors | the chrome and every open terminal, at once |
keys, close, sidebar, open, mcp.allow_claude_nesting, capture, terminal.copy_on_select, terminal.paste_on_right_click, terminal.option_as_meta | the next keypress, click or call |
terminal.font_size | every terminal, at once (your zoom steps are kept on top) |
shell | the next session you open — a running one keeps its program |
record | the next recording — one in progress keeps its budget |
mcp.attach | the next launch — the published endpoint is decided at startup |
A program that read the terminal’s colours when it started — Claude Code picks its light or dark look that way — keeps its choice until it restarts.
Three neighbouring files are TermHerd’s, not yours to edit: window.json
(size and position — a position left off every connected monitor is dropped,
so the window re-centers instead of opening out of reach), layout.json (the
tab strip a launch reopens) and metadata.json (stars, archives, custom
titles, and the repositories you added by hand).
Options
shell
The program launched for each session. Omit the block, or set it to null, for
the platform default login shell. args is optional.
"shell": { "program": "pwsh", "args": [] }
Naming your shell here has a side effect worth knowing: bash and fish get their OSC 133 shell-integration snippet — and therefore an accurate activity status — only when named explicitly. See Status and attention.
theme
The GUI chrome: sidebar, tab strip, buttons. "dark" by default; an unknown
value falls back to it. While terminal.colors.scheme is unset, or names no
scheme, the terminals follow the theme too: a ✓ value brings the scheme of the
same name, and the table names what the others bring. A scheme you set wins
over the theme’s. Both are set live from the
settings panel.
theme values | Same-name colors.scheme | Terminal with no scheme set |
|---|---|---|
dark | — | the built-in palette |
light | — | catppuccin-latte |
solarized-dark, solarized-light, gruvbox-dark, gruvbox-light | ✓ | the same name |
dracula, nord | ✓ | the same name |
catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha | ✓ | the same name |
tokyo-night, tokyo-night-storm, tokyo-night-light | ✓ | the same name |
kanagawa-wave, kanagawa-dragon | ✓ | the same name |
kanagawa-lotus | — none published | gruvbox-light |
ferra | — none published | the built-in palette |
moonfly, nightfly, oxocarbon | ✓ | the same name |
Status dots and /color marks are shaded per theme to stay legible, at 3:1
or better. The active tab’s dot is shaded against that tab’s own fill, so it
reads there too.
close
Per-action close confirmation. Both keys default to "confirmWhenActive".
"close": { "tab": "confirmWhenActive", "app": "confirmWhenActive" }
| Value | Behaviour |
|---|---|
alwaysConfirm | always ask |
confirmWhenActive | ask only while a session runs a foreground process |
noConfirmation | never ask |
Unsaved changes in the doc editor make a quit ask under any app value: the
policy covers the sessions a quit stops, not text it would lose.
terminal
"terminal": {
"font_size": 14,
"copy_on_select": false,
"paste_on_right_click": false,
"option_as_meta": "left",
"colors": {
"scheme": "solarized-dark",
"foreground": "#839496",
"background": "#002b36",
"cursor": "#839496",
"palette": ["#073642", "#dc322f", "…16 entries…"]
}
}
| Key | Default | Notes |
|---|---|---|
font_size | 14 | pixels, clamped to 6–40. The zoom chords step from here at runtime without rewriting it. |
copy_on_select | false | a drag release, a double-click or a triple-click copies the selection outright, no chord needed |
paste_on_right_click | false | a right-click pastes into the pane under the pointer, not necessarily the focused one |
option_as_meta | "left" | macOS only: which Option key is Meta — "none", "left", "right" or "both"; the other one types what the layout composes. Another value falls back to "left". |
colors.scheme | the theme’s | every theme value marked ✓, e.g. catppuccin-mocha |
colors.foreground / .background / .cursor | from the scheme | "#rrggbb"; the # is optional |
colors.palette | from the scheme | the 16 ANSI colours — normal 0–7, then bright 8–15 |
Every colour field is optional and overrides the scheme it starts from. Fewer than 16 palette entries override the head of the list; entries past 16 are ignored.
sidebar
"sidebar": { "session_limit": 5 }
Sessions shown per project before the tail folds behind a … N more expander.
0 shows every session.
record
The GIF screencast budget
(Cmd/Ctrl+Shift+R).
Values clamp: fps 1–60, max_seconds 1–600, scale 0.1–1.0.
"record": { "fps": 8, "max_seconds": 30, "scale": 0.5 }
capture
Whether a state capture masks the secrets its
terminal text shows — access keys, API tokens, Bearer headers, private
keys. On by default; a value that is not true or false keeps it on.
Turn it off only to debug a capture that masked too much.
"capture": { "redact": true }
mcp
Two keys, both off by default.
allow_claude_nesting: whether the live bridge’s prompt_in_session may
prompt another Claude session — one agent driving another. A shell session
is never gated. A single call can opt in on its own with
allow_claude_nesting: true (see The live bridge,
and Orchestrating sessions for the whole loop).
"mcp": { "allow_claude_nesting": false }
attach: whether a running TermHerd publishes its
live bridge for a client it did not launch — a
script, an editor, or the very terminal you started TermHerd from.
"mcp": { "attach": true }
| Value | Means |
|---|---|
false | the default: nothing is published, and only sessions TermHerd spawned can reach the bridge |
true | ~/.termherd/bridge.json carries { url, token } for the running instance, readable only by you |
"never" | as false, and the TERMHERD_MCP_ATTACH override below cannot turn it on |
attach is read at launch only: changing it while TermHerd runs takes
effect at the next start. TERMHERD_MCP_ATTACH=1 (or 0) in TermHerd’s own
environment flips true and false for one launch — useful for a one-off
automation run without editing the file. Against "never" it does nothing,
and says so in the log at info.
Publishing is off by default because of what it exposes: any process running as
you can then read the token and drive the workspace, including run_in_session,
which types into a terminal. See Attaching from
outside for the whole picture and the termherd mcp-config
subcommand that consumes the file.
open
The command a Cmd/Ctrl-clicked file path opens in. Omit
the block to hand the file to the OS default handler (open / explorer /
xdg-open) — the default, which cannot honour a line number.
"open": { "command": "code -g {path}:{line}:{col}" }
Templates: {path} (required), {line}, {col}. A path the terminal printed
without a position opens at 1:1, so one command stays well-formed either way.
| Rule | Why |
|---|---|
| Give a GUI editor | the child’s standard streams are closed, so vim would start invisible and unkillable. Reach one through a terminal emulator: ["wezterm", "start", "--", "vim", "+{line}", "{path}"] |
| Run as argv, never a shell | the string is split on whitespace before {path} is filled in, so a filename with spaces or & can never become a second argument. Use the array form when the program’s own path has spaces |
No ~, no shell lookup | the program is spawned directly; write the full path. An app launched from Finder/Explorer inherits a minimal PATH that often lacks code |
Windows: code.cmd | a direct spawn only ever appends .exe, so a bare "code" is not found |
| A placeholder in the program name is refused | what the terminal printed chooses the file, never the executable |
An empty command, one without {path}, or one with an unknown placeholder is
logged and ignored — the OS handoff applies instead. A command that fails to
start raises a desktop notification.
Configuring this also lifts a restriction: with no command, a path the OS
would run rather than show (.app, .exe, .desktop) is neither underlined
nor opened, because the handoff obeys the file association. An explicit editor
consults no association, so those files open like any other.
keys
Keyboard overrides — one chord or a list per action, replacing that action’s default. The full vocabulary and its defaults are in Keyboard shortcuts.
"keys": {
"copy": "ctrl+y",
"paste": ["ctrl+shift+v", "shift+insert"],
"activate-tab-1": "ctrl+1"
}
Reading and writing it from a Claude session
The stdio MCP server exposes a subset of these options
as list_options / set_option, so you can ask “what can I configure here?”
or “switch me to a light theme” from any Claude session.
The eight ids it covers today: theme, shell.program, shell.args,
terminal.colors.scheme, terminal.colors.foreground,
terminal.colors.background, terminal.colors.cursor,
terminal.colors.palette. Two of them — shell.program and shell.args —
are read-only over MCP: they name what TermHerd executes at the next
launch, so an agent may read them but never set them. The close, sidebar,
record, capture, open, mcp, keys, terminal.font_size,
terminal.copy_on_select, terminal.paste_on_right_click and
terminal.option_as_meta blocks are file-only for now; keys is published
as a read-only resource.
mcp is file-only by design rather than by backlog: its keys govern who may
reach the live bridge and what it may do there, and a surface able to widen
its own reach is not a setting.
A set_option write lands in settings.json and applies as soon as it is
written, like any other edit to the file.
A complete example
{
"shell": { "program": "/bin/zsh" },
"theme": "dark",
"close": { "tab": "confirmWhenActive", "app": "alwaysConfirm" },
"terminal": {
"font_size": 15,
"copy_on_select": true,
"paste_on_right_click": true,
"option_as_meta": "left",
"colors": { "scheme": "gruvbox-dark" }
},
"sidebar": { "session_limit": 0 },
"record": { "fps": 10, "max_seconds": 20, "scale": 0.5 },
"capture": { "redact": true },
"open": { "command": "code -g {path}:{line}:{col}" },
"mcp": { "allow_claude_nesting": false, "attach": false },
"keys": {
"toggle-sidebar": "ctrl+alt+b",
"focus-next": "ctrl+alt+right"
}
}
Environment variables
TermHerd reads a few variables from the environment it starts in, and sets a few on every session it spawns. None is required.
What TermHerd reads
| Variable | Read for | Notes |
|---|---|---|
TERMHERD_MCP_ATTACH | publishing the live bridge for this launch | 1 / true / yes / on turns mcp.attach on, 0 / false / no / off turns it off, case-blind. Anything else is ignored, and so is any value when the setting is "never". See Attaching from outside. |
RUST_LOG | what is logged | For example termherd=debug. Where the log goes: Installation. |
TMPDIR (macOS, Linux), TMP (Windows) | the system temp directory | The single-instance lock is named after it, so a build given its own temp directory runs beside the installed one. Each session’s private files (the MCP config, shell integration) live there too. |
USERPROFILE, then HOME | your home directory | ~/.termherd and ~/.claude are found from it. With neither set, nothing is persisted. |
TERMHERD_DATA_DIR | where TermHerd keeps its own files | Replaces ~/.termherd: settings, layout, log, bridge file. Your home, ~/.claude and the shells’ home are left alone, which is how a second build is kept off your settings without hiding your sessions. termherd-mcp reads it too. Empty counts as unset. |
CLAUDE_CONFIG_DIR | where Claude Code keeps its files | Replaces ~/.claude, the same variable Claude Code reads, so the sidebar lists the sessions the Claude you launch writes. Empty counts as unset. |
ZDOTDIR, TERMHERD_ORIG_ZDOTDIR | where a zsh session replays your startup files from | See below. |
What a session receives
Every session TermHerd spawns, shell or Claude, inherits TermHerd’s own environment with these changes:
| Variable | Value | Why |
|---|---|---|
TERM | xterm-256color | a colour-capable terminal type |
TERM_PROGRAM | iTerm.app | Claude Code emits its busy / idle / attention stream only when it believes it runs under iTerm2 — see Status and attention |
TERM_PROGRAM_VERSION | 3.5.0 | read with TERM_PROGRAM as “a recent iTerm2” |
ZDOTDIR | a private per-session directory | zsh only: how the prompt marks are installed |
TERMHERD_ORIG_ZDOTDIR | the directory your own startup files were replayed from | zsh only, and only when TermHerd found one — your ZDOTDIR, or else your home |
Some variables are removed: the ones a Claude Code session exports to name
itself — CLAUDECODE, CLAUDE_CODE_ENTRYPOINT,
CLAUDE_CODE_CHILD_SESSION, CLAUDE_CODE_SESSION_ID,
CLAUDE_CODE_SESSION_ATTENDED, CLAUDE_CODE_MESSAGING_SOCKET,
CLAUDE_CODE_MESSAGING_TOKEN, CLAUDE_CODE_EXECPATH, CLAUDE_PID,
CLAUDE_EFFORT and AI_AGENT. A TermHerd started from inside a Claude session
would otherwise hand them on, and each Claude it launched would take itself
for part of that session. The variables you set on purpose, such as
CLAUDE_CONFIG_DIR or CLAUDE_CODE_USE_BEDROCK, reach every session
unchanged.
The live bridge’s address and token are not in the environment: a Claude
session receives them in a private file passed with --mcp-config.
TERMHERD_ORIG_ZDOTDIR
zsh reads every startup file from $ZDOTDIR. To install its prompt marks,
TermHerd points ZDOTDIR at a private directory whose .zshenv,
.zprofile, .zshrc and .zlogin each source your own file of the same name
first, then (in .zshrc only) add the hooks. Your own files are looked for in,
in order:
TERMHERD_ORIG_ZDOTDIR, when set;ZDOTDIR, when set to a directory TermHerd did not generate;HOME.
TERMHERD_ORIG_ZDOTDIR records the directory that was displaced, so a
TermHerd started from a TermHerd zsh still finds your files rather than the
outer session’s private ones.
What this means if you use a custom ZDOTDIR:
- Inside a session,
$ZDOTDIRis not yours. It names the private directory. A script that needs your configuration directory reads${TERMHERD_ORIG_ZDOTDIR:-$ZDOTDIR}. - Export it before TermHerd starts. A
ZDOTDIRin the environment TermHerd inherits works: a launch from a terminal whose shell exported it, for example. - A
ZDOTDIRset in~/.zshenvtakes the session over. Sourcing your~/.zshenvchangesZDOTDIR, and zsh then reads.zprofileand.zshrcfrom your directory instead of the private one. Your configuration loads, but TermHerd’s hooks never do: the session gets no prompt marks, and its status falls back on the foreground process (macOS, Linux). This is what happens when TermHerd starts from the Dock, Finder or a desktop launcher, whose environment never ran your shell. Starting TermHerd from a terminal avoids it. .zlogoutis not replayed. zsh reads it from the private directory, where there is none.- A
ZDOTDIRtyped on a command line inside a session is overridden.ZDOTDIR=… termherdstarted from a TermHerd zsh still replays fromTERMHERD_ORIG_ZDOTDIR, which takes precedence. Unset it first to choose another directory.
bash and fish read only HOME, and take their hooks as a command-line
argument; neither sets a variable.
Troubleshooting
Each entry gives a symptom, its cause and the fix, then links to the page that explains it in full. The environment variables named here are listed in Environment variables.
TermHerd will not start a second time
Symptom. A second launch exits at once, with code 2, and no window opens.
Cause. TermHerd is single-instance. The lock is named after the system temp
directory, so a second launch from the same environment finds it taken. A
launch that carries a termherd:// link hands the link to the running instance
and exits with code 0 instead.
Fix. Use the window already open. To run a second build beside it — a
build from source, a worktree — give that build a throwaway temp directory
(TMPDIR on macOS and Linux, TMP on Windows), so its lock has another name.
The commands are in
Installation.
Where is the log?
| Platform | The log goes to |
|---|---|
| macOS, Linux | stderr: start TermHerd from a terminal to read it |
| Windows, release build | %USERPROFILE%\.termherd\termherd.log, even when started from a terminal |
| any OS, debug build from source | the terminal it was started from |
On Windows the log is renamed termherd.log.old at the first launch after it
reaches 5 MB, and a fresh one starts. RUST_LOG sets what is logged, for
example RUST_LOG=termherd=debug. Details:
Where the log goes.
A console window opens beside TermHerd on Windows
Symptom. Started from Explorer or the Start menu, TermHerd opens a black console window as well as its own; closing the console closes TermHerd.
Cause. TermHerd asks Windows not to allocate a console when nothing hands it one. Only Windows 11 24H2 and later read that request; older versions ignore it.
Fix. Leave the console open, or update Windows. Started from a terminal, TermHerd uses that terminal’s console on every version.
A notification click does nothing
Symptom. Clicking a desktop notification does not bring the session forward.
| Platform | Cause | Fix |
|---|---|---|
| Windows | Once a toast times out into the action centre, its click is lost. | Click the toast while it is still on screen. |
| Linux | The notification server must support actions; some do not. | Use a notification server that supports actions. |
| Linux, Wayland | The compositor may refuse to raise the window. | Switch to TermHerd by hand; the right tab is already active. |
| any | More than 16 notifications wait for a click. | Click or dismiss earlier ones. |
A click also changes nothing but the window when the tab has closed, or while a prompt is open (a close confirmation, the settings panel, the document editor).
On Windows a toast is attributed to PowerShell, not TermHerd: TermHerd does not register an application id of its own yet. That is expected, not a sign of something else posting it.
Details: Desktop notifications.
A Claude session has no termherd MCP server
Symptom. /mcp in a Claude session lists no termherd server, or a
client cannot reach the live bridge.
Cause. TermHerd hands the live bridge only to the Claude sessions it
launches itself: a new Claude tab, or a session reopened from the sidebar. It
passes the endpoint on that launch’s command line. A claude typed by hand
into a shell pane, or started in another terminal, gets nothing.
Fix.
- Open the session from TermHerd as a Claude tab.
- To reach the bridge from a client TermHerd did not launch, turn on
mcp.attach, restart TermHerd, and register the client withtermherd mcp-config— see Attaching from outside. When that command prints nothing, its message on stderr says why: When there is nothing to print. - With
"attach": "never"insettings.json,TERMHERD_MCP_ATTACH=1is ignored on purpose: see Refusing it outright.
To change settings from any Claude session, TermHerd-launched or not, the stdio server needs no running app.
settings.json seems ignored
| Symptom | Cause | Fix |
|---|---|---|
| At startup, the sidebar says the file was set aside, and defaults apply. | The file was not valid JSON. It was moved to settings.json.corrupt-1 (then -2, …) so nothing TermHerd saves can overwrite it. | Fix the copy and move it back. |
| An edit made while TermHerd runs changes nothing. | The saved file does not parse; the running settings stay as they were. | Fix the syntax and save again. |
| A number is not the one you wrote. | Out-of-range values clamp: terminal.font_size to 6–40, for example. | Use a value inside the range. |
| One key has no effect, the rest do. | A bad value (a typo’d colour, an unknown action name) degrades alone, with a warning in the log. | Read the warning in the log. |
| A change shows up only later. | Some keys apply at the next session, recording or launch: shell, record, mcp.attach. | Open a new session, start a new recording, or restart. |
The file is strict JSON: no comments, no trailing commas. Details: How it loads.
A plain shell’s status stays on starting
Cause. The shell reports no prompt marks. TermHerd injects them into zsh
always, and into bash and fish only when settings.shell names them; an
unknown shell gets none. On macOS and Linux the foreground process stands in
until the first mark; Windows has no such fallback.
Fix. Name your shell in settings.json. A zsh whose ~/.zshenv sets
ZDOTDIR loses the marks too: see
TERMHERD_ORIG_ZDOTDIR. Details:
Where the signal comes from.
Two surfaces
TermHerd exposes itself to Claude sessions over MCP, so a session can read and drive the workspace it is running in. There are two servers, and which one you get depends on how the session started.
┌──────────────────────────────┐
│ TermHerd (GUI) │
│ ┌────────────────────────┐ │
in-proc │ │ core::App (state) │ │
loopback │ └───────────▲────────────┘ │
┌──────┼──────────────┘ │
│ │ the LIVE BRIDGE │
│ │ 20 tools · the running │
│ │ workspace + settings.json │
│ └──────────────────────────────┘
│
│ wired in at spawn, per-session token
▼
┌─────────────────────┐ ┌──────────────────────────┐
│ a Claude session │ │ any Claude session │
│ LAUNCHED BY termherd│ │ anywhere │
└─────────────────────┘ └────────────┬─────────────┘
│ you register it
▼
┌──────────────────────────┐
│ termherd-mcp (stdio) │
│ 2 tools · settings.json │
└──────────────────────────┘
| The live bridge | The stdio server | |
|---|---|---|
| Reaches | the running workspace and the settings file | the settings file |
| Setup | none — wired in at spawn | you register termherd-mcp yourself |
| Available to | sessions launched from TermHerd, plus any client that attaches | any Claude session |
| Transport | in-process, loopback, per-session bearer token | JSON-RPC over stdio |
| Surface | 20 tools | 2 tools + 2 resources |
| Needs the app running | ✅ yes | ❌ no |
The gap between them, and the bridge across it
Two servers, but three ways in. The live bridge holds the running workspace and hands its endpoint only to sessions it spawned; the stdio server is reachable from anywhere and sees only the settings file. Between those sat a hole: the terminal that launched TermHerd could not ask it for a screenshot the app already knows how to take.
Attaching from outside closes it — the same live bridge and
the same twenty tools, reached by a client TermHerd did not spawn. What was
missing was discovery, not capability, so nothing new was added to the surface.
It is opt-in (mcp.attach), because publishing an endpoint that can type into
a terminal is a decision, not a default.
Which one you want
- “Split this pane and run the tests” → live bridge. It only exists inside a session TermHerd started. One session driving others through it: Orchestrating sessions.
- “Switch me to a light theme” → either. Both carry
list_optionsandset_option, over one shared catalogue; the write lands insettings.jsonand a running TermHerd applies it at once. From a session TermHerd started, the bridge already has them — register the stdio server only for a session started elsewhere.
Design notes
Sessions are addressed by a stable handle — the runtime session id —
never by the Claude resume_id, which re-keys on a fork or a plan-accept.
Every call is timeout-bounded. A wedged shell surfaces as a tool error, never a hang. Waits have a default and a hard cap, so no call, however parameterised, can park a caller indefinitely.
The domain core has no MCP awareness at all. Every mutation goes through an
Event that already existed for the keyboard. That is the invariant behind the
whole surface: an MCP caller cannot reach a state the keyboard cannot.
The live bridge
A Claude session launched from TermHerd is wired to an in-process MCP
server on loopback, with a per-session token, injected into its mcpServers at
spawn. Nothing to configure — if you started the session from the app, the
tools are there. The server refuses, with a 403, any request whose Host or
Origin names something other than 127.0.0.1, localhost or [::1] on
its own port, so a web page cannot reach it by rebinding a domain to
loopback.
Its private files — the mcp config carrying that bearer token, the shell-integration directory, the settings overlay — are deleted when the session is torn down. Each is created afresh and owner-only; if another user already holds its name, the session starts without the bridge.
A client TermHerd did not launch can reach the same server, and the same tools, once the instance is told to publish its address — see Attaching from outside. Everything below applies unchanged there.
Antigravity (agy) and CLIs without --mcp-config
Every agent session TermHerd spawns also receives TERMHERD_MCP_CONFIG in its
PTY environment, pointing to that session’s private 0600 mcpServers file
(the bearer token stays in the file, never in the environment). Register
termherd mcp-proxy once in Antigravity so every session launched from
TermHerd gets the same live tools:
agy mcp add termherd /path/to/termherd mcp-proxy
When TERMHERD_MCP_CONFIG is present, termherd mcp-proxy forwards stdio
JSON-RPC to that session’s loopback bridge and surfaces transport or token
errors directly as JSON-RPC errors. When TERMHERD_MCP_CONFIG is absent
(launched outside TermHerd, or a host CLI that does not propagate it), it
serves the settings.json tools (list_options, set_option) and states in
its initialize instructions why the live workspace tools are unavailable.
The tools
Perception
| Tool | Args | Returns |
|---|---|---|
list_sessions | — | { sessions: [...] } — each row a live session: stable handle, tab title, cwd, kind (shell / claude), resumed Claude id (resume_id, null for a fresh tab — session_id is the live one), status, and Claude’s pid, peer_name, session_id |
snapshot | sections, terminals, focused_terminal, text_lines | the whole state: config, sidebar, tabs and panes |
read_terminal | session, lines | { text, rendered } |
screenshot | max_width | the window as a PNG |
Every tool answers a JSON object: MCP clients reject anything else on their
schema check, which is why list_sessions puts its rows in a sessions field
rather than answering the array itself.
A tab title carries no kind marker: a fresh tab is titled after its project
alone (my-app). Read what a session runs from its kind field.
Which Claude is which. A session running Claude, in list_sessions and in
a snapshot pane, also carries pid, peer_name and session_id.
peer_name is the name other Claude sessions address it by (ListAgents /
SendMessage), so two Claude panes in the same directory stay told apart. All
three are read from Claude Code’s own ~/.claude/sessions/<pid>.json for the
job in front of the pane, on every call. That file is the proof a Claude runs
there, whatever the pane’s kind: a claude typed into a shell pane is
identified, and a vim left running after Claude quit is not. The file must
also be that process’s own: its procStart has to match when the process in
front started, so a file a crashed Claude left behind is never pinned on a
program that later reuses its pid. All three are null together, and are
always present:
- when no Claude is in front (a shell prompt, any other program);
- when the file in place belongs to an earlier process with the same pid;
- on Windows, for a Claude that does not run as
claude.exe(an npm install runs it asnode.exe), the image the process tree is searched for; - while Claude Code has written no session file, or one without
procStart(an older CLI, a session still starting).
session_id is Claude’s own id, which changes on a fork or a plan-accept;
address a session by handle, never by it.
A snapshot pane also carries color: the colour the pane wears, as its tab
shows it, spelt as /color takes it ("green"), or null when it wears
none. For a pane running Claude it is the colour Claude Code’s /color set,
read from the transcript, so it follows the sidebar’s rescan rather than each
call, and is null until the sidebar lists the conversation. For a shell it
is the colour picked for its tab (see
tabs), else that of a Claude run in
it by hand — and a Claude pane whose Claude has exited counts as a shell.
A snapshot tab carries parked: true for a tab parked at the strip’s
end, out of the tab cycle (see parking a tab).
Its sessions keep running, so its panes report as any other’s. focus_pane
on a handle in a parked tab unparks it.
snapshot is light by default: structure only, no terminal text. Scope
text to named handles with terminals (or set focused_terminal: true for the
focused pane, when you do not know its handle yet), or pass sections (any of "config",
"sidebar", "tabs") to narrow it further. text_lines defaults to 40. Read
the structure first, then ask for a handle — that ordering is why the filter
exists.
read_terminal’s rendered: false means the session is live but its screen
has not been drawn yet. Retry — do not give up on the handle.
screenshot is the pixel companion for render, colour and glyph questions text
cannot answer. Reach for it last: a default-bound window is on the order of
200 kB of PNG and a third more again as base64, where a snapshot is a few
hundred bytes. max_width defaults to 1200 (clamped 64–4096); a total-pixel
ceiling also bounds tall windows the width alone would not, the frame is
area-averaged down rather than nearest-sampled — which is what keeps terminal
glyphs legible at the ~0.4× a retina window is reduced by — and a window
smaller than the bound is never upscaled. The reported width/height are
what you actually received. A headless run has no window and says so as a
tool-level error; the text reads keep working.
Action
| Tool | Args | Notes |
|---|---|---|
open_session | project, kind, background | kind is "shell" (default), "claude", or "antigravity"; omit project for the home dir; background: true opens without taking focus |
split_pane | direction, pane | "vertical" (default) or "horizontal"; omit pane for the focused one |
focus_pane | session | |
rename_tab | tab, title | tab is the 0-based index snapshot reports; a blank title reverts a shell tab to the derived one. A Claude tab is renamed by arming /rename <title> for confirmation, answered as claude_command is; a blank title, or the name it already shows, arms nothing and leaves it as it is |
close_pane | pane, background | a lone pane is its whole tab, which closes; background: true closes pane without focusing it first |
run_in_session | session, text | a trailing newline is sent as Enter and submits; see below |
mouse_in_session | session, kind, col, row, button, click_count | a mouse event at a cell of the terminal; see below |
add_repo | path | put a repository in the sidebar before it has any session |
forget_repo | path | drop an addition; the row survives on its sessions |
claude_command | session, command, argument | arms a confirmation to type a Claude slash command; see below |
Each returns the resulting focused_handle (null when the workspace is now
empty). open_session also returns opened_handle, the new session’s handle:
read the new session from it rather than from focused_handle, which names it
only when the open took focus.
Working beside someone who is typing
Every action above moves the keyboard by default: an open activates its new
tab, and a close focuses its target before closing it. An agent orchestrating
workers in the same window as a human would send that human’s next keys into a
terminal they did not choose. background: true on open_session and
close_pane keeps the user where they are:
- A background open appends the tab at the end of the strip without activating it. Into an empty workspace it is the only tab, so it is the active one all the same. Its terminal is sized to the tab area at once, so a Claude started there draws its first screen at the size it will be shown.
- A background close closes
panewherever it lives, without revealing it, and requirespane: the focused pane is the user’s, so there is no default to fall back on. The flag means never take focus, not focus cannot move: closing the pane that holds focus still hands it to its sibling. A lone pane takes its tab with it, onto the reopen stack like any tab close, and a close prompt or tab drag the user has under way stays on the tab it named.
Neither flag lets an agent reach a state the keyboard cannot: a background tab is one the user could have opened and then left.
A background session is driven exactly like any other, by handle:
run_in_session, prompt_in_session, wait_for_status, read_terminal and
mouse_in_session all reach a tab nobody has looked at. The terminal fills its
screen from the program’s output, not from being drawn, so mouse_in_session
is bounded as soon as the program has printed something.
An MCP close asks no confirmation, background or not: unlike the keyboard’s
close, it kills a busy pane straight away. Wait for the session to settle with
wait_for_status first when that matters.
The two repo tools answer about a sidebar row rather than about focus, so they add four fields:
| Field | Means |
|---|---|
repo_path | the normalised key the row is filed under |
declared | whether it is currently a hand-added repository |
session_count | sessions on that row right now |
in_sidebar | whether a row is there at all |
The last two report membership, not what the window happens to be drawing:
a search left in the box, or the archived filter, changes neither. Otherwise a
successful add_repo would read back as a failure for no reason the caller
could see.
repo_path is the one to keep. add_repo files a path by exactly the rule
the scan uses for a session’s working directory — a worktree collapses onto
its main checkout, a file becomes its parent directory, everything else is kept
as given (symlinks included, and not climbed to a repository root). Two
spellings of one directory are one key: a trailing slash, a ./, and forward
slashes on Windows all normalise away, since none of them is a spelling the
scan can produce. That agreement is what stops one repository from occupying
two rows, so address the row afterwards with what came back, not with what you
sent. A path that does not exist, or a relative one, is rejected.
forget_repo is the asymmetric one: forgetting a repository that was never
added is not an error, and forgetting one the scan still reports leaves the
row standing. Read in_sidebar to tell the two outcomes apart — false means
it is gone, true with declared: false means it lives on its sessions.
A Claude slash command, confirmed
claude_command asks TermHerd to type one of Claude Code’s own commands into
a Claude session — the way TermHerd changes what Claude owns, such as a
session’s name or colour, rather than keeping a rival copy of it. The list is
closed:
command | argument | Types |
|---|---|---|
rename | the new name | /rename <name> |
color | red, blue, green, yellow, purple, orange, pink, cyan or default | /color <colour> |
desktop | none | /desktop |
Nothing is typed by the call. It arms the same confirmation prompt the
send-to-desktop action arms, naming the exact line, and answers with that
line and the prompt’s name, overlay: "claude-command-confirm". The prompt
then holds the keyboard: press_keys(["enter"]) types the line,
press_keys(["escape"]) drops it, and a human at the window can answer it
too. The prompt is there for the human at the window: it shows them the
line before it lands. It does not constrain the caller, which can confirm its
own prompt with enter — and could type into the terminal with
run_in_session anyway. What the tool adds over raw typing is the checks
below, and one write path shared with the keyboard. On Linux, where Claude
Desktop does not run, the send-to-desktop action answers no-surface; this
tool still arms /desktop there.
It is refused, with nothing armed, when:
- the session is not a Claude launch — a shell would run the line as a program;
- Claude is starting, exited, or waiting on an answer such as a permission
prompt; a busy Claude is refused
desktoponly, since Claude appliesrenameandcolormid-turn and leaves a queued message queued; - Claude’s prompt holds a draft — the error quotes it; the command would be typed into it, and a draft of several lines would be submitted with it as a prompt to the model;
- Claude’s input prompt is not on screen — a menu, picker or dialog has the keyboard (Enter would pick an entry), or the view is scrolled away from it;
- another prompt is already open.
Confirming checks all of it again against the screen as it is then. A refusal
at that point keeps the prompt open, showing why, and press_keys reports
the step as refused with the reason rather than overlay; escape dismisses
it, enter tries again.
The prompt is read off the screen: the row starting with ❯ under a
horizontal rule, down to the next rule. Its placeholder hint (Try "…") reads
as empty, and the hint Claude shows under a queued message (Press up to edit queued messages) reads as a queued message, which does not refuse. A draft
spelling exactly one of those two shapes is read wrong.
A prompt armed by this tool ignores a physical Enter for 600 ms: someone
typing in another pane when it appears would otherwise confirm it with the
Enter that ends their own line. So does one armed by a press_keys or
run_action call — send-to-desktop, or a pick in the tab colour list.
escape, and enter sent through press_keys, are never held back.
A name is made safe before it is shown: control characters, line breaks and
tabs become spaces, invisible formatting characters are dropped, a trailing
backslash goes (in Claude’s prompt, \ then Enter starts a new line instead of
submitting), and the result is cut to 80 characters on a character boundary
— an accent or a flag is never split. Joiners and variation selectors are kept,
since emoji sequences and Persian or Indic names are spelled with them. A name
with nothing left is refused.
Confirming sends Ctrl+U first — a guard against a key landing between the screen read and the write — then the line, then Enter on its own.
The pointer, inside a terminal
mouse_in_session is the pointer counterpart of run_in_session: it places
one mouse event inside a session’s terminal. It is addressed by cell, not
by pixel — a terminal is a grid, and a grid is what a mouse report carries —
so an agent with no screen coordinates can still point.
| Arg | Values |
|---|---|
kind | press, release, click, drag, move |
col, row | 0-based cells of the visible screen |
button | left (default), middle, right |
click_count | 1 (default), 2 for a double-click, 3 for a triple-click — on a click or a press only |
The answer adds a pointer field saying what the terminal did:
pointer | Means |
|---|---|
forwarded | the program in the session reads the mouse and was sent the event |
selection | no program reads the mouse; the event drove the terminal’s own text selection |
ignored | it drove nothing — a release, a move or a non-left button with no program reading the mouse, or a motion the program’s mouse mode does not cover |
Which of the first two you get is the program’s choice, not yours. A
full-screen program that turns mouse reporting on — Claude Code’s /diff and
/resume, vim, lazygit, fzf, less — owns the mouse while it runs: every event
goes to it in the encoding it negotiated, and the terminal selects nothing of
its own. Follow a forwarded with wait_for_status / read_terminal to see
what the program made of it, as after run_in_session. Mouse reporting comes
in three widths, and a motion the program did not ask for is dropped rather
than selected: click-only reporting takes presses and releases, drag reporting
adds motion with a button held, and motion reporting takes every move.
At a plain shell, or any program not reading the mouse, the same calls drive
the terminal’s selection. A drag is two calls — press at one cell, then
drag at another — and the text between them is selected, both cells
included. Read it back with the copy action (run_action), which puts the
selection on the clipboard. A bare click clears the selection. A cell outside
the pane’s geometry, or a session that has not rendered yet, rejects the
whole call before anything applies, naming the geometry so you can retry
inside it.
click_count repeats the click as a human’s double- or triple-click would.
At a shell, 2 selects the word under the cell — or the whole URL or path
there, the span a link click opens — and 3 the whole line, every row a long
line wrapped onto, exactly as the same clicks by hand; with
terminal.copy_on_select on, the selection is also copied — by the terminal,
so the text reaches the clipboard just after the call answers, not with it. A
double-click on a blank selects nothing and is two plain clicks. A
program reading the mouse is sent that many clicks — for a press, the clicks
before it and then the press, held — and tells them apart by their timing as
it would a human’s. A count outside 1 to 3, or above 1 on
a release, drag or move, rejects the call.
The report carries no modifier keys: a press is a plain press whatever the
human’s keyboard is doing. The same split governs a human’s mouse over the
pane — see When the program reads the mouse.
Synchronisation
| Tool | Args | Returns |
|---|---|---|
wait_for_status | session, statuses, timeout_ms | { status, timed_out } |
prompt_in_session | session, text, statuses, lines, timeout_ms, allow_claude_nesting | { status, timed_out, text, rendered, focused_handle } — prompt, wait and read in one round trip |
statuses defaults to idle-or-attention — the two a caller waiting on a
command actually wants. timeout_ms defaults to 30 000 and is capped at
300 000. prompt_in_session is the composed agent-loop tool: prompt a session,
wait for its activity status to settle, and read back its terminal text in a
single round trip. Prompting a shell session is enabled by default; prompting
a nested Claude session requires opt-in via mcp.allow_claude_nesting setting or
the allow_claude_nesting: true parameter.
A timeout is not an error. On expiry the reported status is the session’s
current one, and timed_out is true. And a session that exits settles
the wait whatever you asked for — it can no longer reach your target. Both
behaviours exist so a wait can never silently park you.
A wait answers at once on a status the session already shows. Just after
typing, Claude Code still shows the status from before the prompt, for up to a
few hundred milliseconds. prompt_in_session therefore first waits, up to 2 s,
for the session to leave the target statuses; a command that finished sooner
costs those 2 s. Composing the loop by hand, wait for busy before waiting for
idle.
A Claude session reads idle only once its idle title stands. Between two
busy stretches, such as when a background subagent’s result restarts the
agent, Claude Code can show its idle title for a few milliseconds. termherd
holds that title back for 150 ms and reports idle only if no work resumed in
the meantime, so the status, the tab dot and every wait trail the real end of
a turn by that much. A shell’s prompt marks are not held, and a session that
exits during the hold reports exited with no idle before it.
Settings
| Tool | Args | Returns |
|---|---|---|
list_options | — | { options } — every configurable option with its current value |
set_option | id, value | { id, value } — one writable option, written to settings.json |
The same two tools as the stdio server, over the same catalogue —
the option ids, which ones are writable, and what each accepts are defined
once and read by both. The write lands in settings.json, and the running app
applies it the moment the file changes, as it does for any edit to the file.
A refused value is an invalid_params error; a settings.json that does not
parse is refused too, rather than overwritten.
The keyboard
press_keys and run_action drive TermHerd’s own interface — see
Driving the keyboard.
The loop: act → wait → observe
run_in_session returns as soon as the text is sent. It does not wait for
the command.
run_in_session(session, "cargo test\n")
│
▼
wait_for_status(session, ["idle", "attention"])
│
▼
read_terminal(session, lines: 60)
Alternatively, use prompt_in_session to run all three steps in one round trip.
A trailing newline submits. Both tools send it as Enter, so it submits in
a shell and in Claude Code alike. Enter follows the text after a short pause,
so Claude Code does not read a long text and its Enter as one paste; a
confirmed claude_command is submitted the same way. Earlier newlines are
sent as they are: Claude Code and PowerShell take them as line breaks in their
input, so a multi-line prompt is submitted once. A Unix shell runs each line;
cmd.exe drops them, so send it one command per call.
Do not poll snapshot in a loop. It races the transition you are watching
for — that race is exactly why the wait tool exists.
A worked example, from inside a session TermHerd launched:
1. split_pane({ direction: "vertical" }) → focused_handle: "7"
2. prompt_in_session({ session: "7",
text: "cargo test --workspace\n",
timeout_ms: 300000,
lines: 80 }) → { status: "idle",
timed_out: false,
text: "...",
rendered: true,
focused_handle: "7" }
Errors and refusals
- An unknown handle, an out-of-range tab index, a non-numeric handle → an
invalid_paramserror naming the problem. - A malformed chord or unknown action name rejects the whole call before anything applies: half an applied sequence is worse than none, because the caller cannot tell how far it got. A pointer event outside the pane, or an unknown pointer word, is refused the same way.
- A wedged shell surfaces as a tool error, never a hang.
What has shipped, and what is open
This page describes the bridge as it is built. What each release added is in
the release notes and the
project’s
CHANGELOG.md;
what is still open is the issue list filtered on the
area:mcp
label.
Driving the keyboard
Two tools reach TermHerd’s own interface — the sidebar, the tab strip, the
overlays — rather than a terminal. Typing into a session stays
run_in_session’s job.
| Tool | Takes | Tests |
|---|---|---|
press_keys | chords in settings.json syntax — "cmd+shift+s", "ctrl+tab", "escape" | the binding, resolved through the live keymap, including your overrides |
run_action | kebab-case action names — "split-vertical", "activate-tab-3" | the behaviour, skipping the keymap, so it survives a rebind |
Both take a list applied in order and return one steps entry per item, plus
the resulting focused_handle.
press_keys names keys as the
chord syntax does. A chord bound to
nothing reaches the focused terminal through TermHerd’s own key encoder, so
"pageup" or "shift+f5" there shows the bytes TermHerd sends for that key.
An arrow follows the cursor-key mode the program asked for, so "up" sends
ESC O A in vim and ESC [ A at a shell prompt that leaves that mode off.
"alt+." sends ESC .: off macOS Alt is always Meta, and on macOS a
synthesised Alt has no side, so it is Meta unless terminal.option_as_meta is
"none" or the user holds only the Option key the setting excludes.
run_in_session writes the caller’s bytes as they are and cannot show it.
Why it is a real key event
A chord is dispatched as a synthesised key event fed to the app’s key handler — the whole routing ladder, not just a keymap lookup.
That is what makes Escape and Enter reachable at all: they are overlay keys, bound to no action. Without them an agent that armed a close confirmation would have no way to answer it, and would park the app until a human intervened.
escape leaves every prompt — that is what guarantees an agent can always
back out. enter confirms confirmation prompts and commits both inline
renames. Menus and pickers handle it themselves, as described below.
The corollary: an open overlay consumes an MCP press exactly as it consumes a
keypress. The step reports which prompt ate it, so a caller learns why its
chord did nothing. run_action is gated on the same ladder on purpose —
neither tool may reach a state the keyboard cannot.
Reading a step
| Outcome | Means | Extra field |
|---|---|---|
ran | the ladder applied it | action — the name that ran |
inert | nothing happened | reason — see below |
overlay | an open prompt consumed it | which prompt |
refused | a prompt’s confirmation typed nothing; it stays open | which prompt, and refusal — why |
typed | bound to nothing, so it reached the focused terminal | |
unbound | nothing claimed it |
ran means the shell applied the event, not that the effect was
interesting: activate-tab-9 on a single-tab workspace reports ran, because
the event was applied and absorbed. Collapsing that into inert would make the
distinction useless.
The two kinds of nothing
inert carries a reason because they call for opposite responses:
| Reason | Means | Do |
|---|---|---|
no-surface | the action is wired to nothing here: open-new-session everywhere, send-to-desktop on Linux | stop — retrying is pointless |
no-context | a precondition was absent — nothing focused to derive a repo from, no closed tab to reopen, no tab to rename, colour or open a menu on, nothing to scroll, nothing selected to copy, no Claude agent name to copy, no Claude able to take a command now (or a colour), no known directory or no transcript a scan has found to reveal | create it, then retry |
Each handler that can refuse this way says so at its own refusal site.
On Windows, copy-agent-name finds a Claude by walking down from the pane’s
shell to the nearest claude.exe. A Claude that runs under another image (an
npm install runs it as node.exe) is never named there, so that no-context
cannot be created.
copy refuses on the terminal’s own answer: it holds a selection or it does
not, wherever that selection has scrolled to. An MCP drag in a forwarded
pane selects nothing (it carries no Shift, so it is the program’s), so copy
after it is no-context — and the program’s own clipboard write (Claude Code
copies a drag on release) is left alone. A human’s Shift+drag there is a
selection, and copy runs on it.
Answering an overlay
escape usually cancels; enter usually confirms. Six cautions:
- On
quit-confirm,enterquits the app — killing every session and the connection you are speaking over, and dropping a modified doc’s edits. session-rename(the sidebar’s inline ✎ field) andtab-renameboth commit onenter;escapeabandons either edit. MCP and the widget submit use the same commit messages. When a rename targets a live Claude session, committing may openclaude-command-confirmfor/rename.tab-menu(opened byopen-tab-menu, or a human’s right-click on a tab) answersup,downandenteritself, so unlike the renames it is fully drivable:entercloses the menu and runs the selected entry exactly asrun_actionwould run that entry’s action. Theenterreports what that action did —ranwith its name, orinertwith its reason — and every other press while the menu is open reportsoverlay: "tab-menu". The entries and their order are on the tabs page. Tab colour… is always listed, but disabled when no colour can be picked for the focused pane (a Claude waiting on an answer, a draft in its prompt, the prompt off screen):enteron it runs nothing, leaves the menu open and reportsrefusedwith the reason. Send to Claude Desktop is disabled the same way, and also while Claude is busy. Copy agent name, Reveal directory, Reveal transcript and Send to Claude Desktop are listed only where they apply (see the tabs page); one left out shifts every entry below it by one. The menu closes if its pane loses focus, so afocus_panecall while it is open dismisses it.tab-color-picker(opened bypick-tab-color, or the tab menu’s colour entry) answersup,downandenterlike the tab menu; its lines arered,blue,green,yellow,purple,orange,pink,cyan, then None, and it opens on the colour the tab wears — on None when it wears none, so an immediateenterleaves it uncoloured.enteron a shell tab sets the colour and closes the list. On a Claude tab it closes the list and opensclaude-command-confirmfor/color <name>, so a secondentertypes it; if that Claude cannot take a command any more,enteranswersrefusedwith the reason and the list stays open.- On
claude-command-confirm,entertypes the slash command the prompt names into its Claude session — or answersrefusedwith the reason, leaving the prompt open, when meanwhile Claude raised a dialog, exited or is not in a state that takes the command, a draft appeared, or its prompt left the screen; seeclaude_command. paste-confirmopens when thepasteaction, or a right-click paste, carries a line break into a terminal that did not turn bracketed paste on; nothing is written untilenterpastes the text unchanged, andescapedrops it. See the terminal page.doc-editorwith unsaved edits answersescapeby openingdoc-discard-confirmrather than closing. There,enterdiscards the edits andescapereturns todoc-editorwith them intact — soescapealone never loses a modified doc, however many times it is pressed.- Every other overlay is exitable from the keyboard, and a test sweep derived from the overlay enumeration — not a hand-written list — is what keeps it that way. A new overlay added without an exit fails there.
Rejection is all-or-nothing
A malformed chord or an unknown action name rejects the whole call before anything applies. The error names the offender and the syntax. This is deliberate: a half-applied sequence is worse than none, because the caller cannot tell how far it got.
The action catalogue — less the activate-tab-N family, which run_action
accepts all the same — is published by the stdio server at
termherd://keys/schema; the live bridge serves tools only, so its run_action
error message carries the syntax instead.
Example: verify a keyboard gesture end to end
run_action(["split-vertical"]) → { steps: [{ result: "ran",
action: "split-vertical" }],
focused_handle: "4" }
screenshot({ max_width: 900 }) → the pixels, to check the divider
press_keys(["cmd+w"]) → { steps: [{ result: "overlay",
overlay: "tab-close-confirm" }] }
press_keys(["escape"]) → cancelled
Attaching from outside
The live bridge is wired into a Claude session at spawn:
TermHerd mints a token, writes it into that session’s mcpServers config, and
hands the file to the child it is launching. Nothing about the server refuses
another caller — it accepts any token it minted, whoever presents it. What a
caller outside that process tree lacks is the address: an ephemeral port it
cannot learn, and a token it was never handed.
Attaching publishes that address, once, for the whole instance. The tools are unchanged — the same twenty, reached from somewhere else.
Turning it on
Off by default. In ~/.termherd/settings.json:
{ "mcp": { "attach": true } }
Restart TermHerd. It then writes, and keeps current for its lifetime:
// ~/.termherd/bridge.json — mode 0600
{ "url": "http://127.0.0.1:52431/mcp", "token": "9f1c…" }
One instance runs at a time, so the file needs no “which instance” field.
It is removed on a clean quit — and, more importantly, cleared unconditionally
at every startup, whether or not that launch publishes anything. Teardown
alone would not be enough: a crash skips it, so does an exit routed through
macOS’s terminate: (Dock → Quit, logout), and a launch that opts out has no
teardown of its own to run. Startup is the one moment that always happens. In
the window between a hard exit and the next launch the file is stale, which is
what the probe below exists for.
For a one-off run — an automation script, a CI-ish sweep — the environment variable flips the setting without editing it:
TERMHERD_MCP_ATTACH=1 termherd # publish for this launch only
TERMHERD_MCP_ATTACH=0 termherd # and back off, with attach: true on file
1 / true / yes / on and 0 / false / no / off are all understood,
case-blind. Anything else is not an override at all: the setting stands.
Refusing it outright
{ "mcp": { "attach": "never" } }
"never" is not a third spelling of false. It is off and out of reach of
the environment variable, so a machine — a shared box, a build agent, a laptop
under someone else’s policy — can decline the exposure in a way an ambient
TERMHERD_MCP_ATTACH=1 cannot quietly undo. An override attempted against it is
ignored and logged at info, so nobody is left wondering why the variable did
nothing.
Registering a client
Do not read bridge.json by hand. Ask the running instance:
$ termherd mcp-config
{"mcpServers":{"termherd":{"type":"http","url":"http://127.0.0.1:52431/mcp","headers":{"Authorization":"Bearer 9f1c…"}}}}
That is the mcpServers snippet, byte-for-byte what a spawned session
receives — literally the same code renders both. Pipe it where your client
wants it:
termherd mcp-config > .mcp.json # a project-local MCP config
claude --mcp-config <(termherd mcp-config)
The subcommand prints to stdout and exits 0; it answers about the running
instance without disturbing it — no window opens and the single-instance lock is
never touched. Every diagnostic TermHerd emits goes to stderr (or, for a
release build on Windows, to its log file),
so the redirect above captures the config and nothing else.
When there is nothing to print
The command probes the endpoint with a real MCP initialize before printing
anything. A file left behind by a crash names a port nothing answers on, and a
config built from it would fail on the first call instead of the zeroth. Four
failures, four different things to do:
| stderr says | What happened | Do |
|---|---|---|
| no running termherd is publishing… | no file: not running, or not opted in | set mcp.attach and restart |
| …could not be read | the file exists but is unreadable, or is not the expected JSON | delete it (the message names the path) and restart |
| …no longer answering | the instance that wrote it has exited | restart |
| …refused its own token | the endpoint is live but rejects the token | restart to publish a fresh one |
Each exits non-zero, so a script can tell “no config” from a config.
What you are exposing
Worth stating plainly, because the default is false for this reason and no
other.
The published file hands any process running as you the ability to drive your
workspace: run_in_session types into a terminal, which is arbitrary command
execution under your account, and read_terminal reads back whatever is on
screen. The file is 0600, which keeps other users out; it does not keep out
anything running as you.
This is not a new capability — a process that can read a spawned session’s
--mcp-config file already has the same reach. Attaching makes it
discoverable rather than newly possible. That distinction is a reason to say
so out loud, not a reason to skip the gate: on a machine where that trade is
wrong, "never" is the answer.
Orchestrating sessions
Recipes for one Claude session driving others through the
live bridge: opening workers, handing them work, waiting
for them and reading what they did. Every tool named here is a live-bridge
tool; a Claude session lists them as mcp__termherd__<tool>.
The driving session must be one TermHerd launched as a Claude tab, or a client
attached from outside. A claude typed by hand into a shell
pane has no bridge.
Find a session, and keep its handle
list_sessions answers one row per live session. Address every later call by
the row’s handle. Never use resume_id: Claude Code re-keys a
conversation on a fork or a plan-accept, while the handle stays the same for
as long as the session lives.
Each row also says what the session runs (kind is shell or claude), its
working directory, its status, and, for a Claude, the peer_name other Claude
sessions address it by. Two Claude tabs in the same directory are told apart
by their handle and peer_name, not by their title.
Open a worker without taking the user’s keyboard
{ "tool": "open_session",
"args": { "project": "/path/to/worktree", "kind": "claude", "background": true } }
background: true appends the tab without activating it, so the next key the
user types still lands where they were typing. Read the new session from
opened_handle, not from focused_handle. Wait for idle before handing the
new session work: the wait answers at once when Claude is already at its
prompt.
Close a finished worker the same way, with close_pane and
background: true.
Hand work over as a brief file
Write the task into a file in the worker’s own directory — say
.personal/brief.md in its worktree — and type one short line:
{ "tool": "run_in_session",
"args": { "session": "12", "text": "Read .personal/brief.md and carry it out.\n" } }
A file can be as long as the task needs, the user can read and amend it, and
it outlives the conversation that wrote it. A one-line prompt is typed
reliably, and the worker reads the whole brief with its own tools. A trailing
newline in text is sent as Enter and submits; earlier newlines stay line
breaks, so a multi-line prompt is still submitted once.
Act, wait, observe
run_in_session returns as soon as the text is sent. Follow it with a wait,
then a read:
run_in_session— type the prompt.wait_for_statuswithstatuses: ["busy"]— just after typing, the session still shows the status it had before, so a wait foridlestraight away answers at once with the old one.wait_for_statuswithstatuses: ["idle", "attention"].read_terminal— the last lines of the screen, as text.
Ask for more lines than the default 40 when reading a Claude session, on
read_terminal and prompt_in_session alike: Claude Code pads its screen with
blank rows between the conversation and the input box, and on a tall pane the
last 40 lines can hold none of the reply. lines: 80 or more reaches it.
prompt_in_session does all three in one round trip: it types, waits up to
2 s for the status to leave its old value, waits for the target statuses, and
returns the screen text. Prefer it for a prompt; keep the separate calls when
you need to act between the steps.
Never poll snapshot to wait: it races the very transition you are waiting
for, and a snapshot loop costs far more than one wait.
attention means the worker is asking for something — a permission prompt, a
question. Read the screen and decide. An outward action it proposes (a push,
a public comment, closing an issue) waits for the user’s answer, not yours.
Long runs and the wait cap
A wait is bounded: timeout_ms defaults to 30 000 and is capped at 300 000
(five minutes), on wait_for_status and prompt_in_session alike. A timeout
is not an error: the call returns { status, timed_out: true } with the
session’s current status. For a task that runs longer, wait again — reading
the screen between two waits shows how far it got. A session that exits
settles any wait with exited.
Prompting another Claude needs an opt-in
prompt_in_session refuses a Claude target unless nesting is allowed,
either for every call:
{ "mcp": { "allow_claude_nesting": true } }
or for one call, with allow_claude_nesting: true among its arguments. A
shell target is never gated. The separate run_in_session +
wait_for_status calls are not gated either: the opt-in guards the composed
call only.
Text already in another tab’s input box
Before typing into a Claude session you did not just open, read its screen. Text already sitting in its input box is usually a suggestion Claude Code offers, drawn there for the user to accept or ignore — and in plain text it looks exactly like something the user typed. It may also be the user’s own unfinished draft. Either way, it is not yours to send: never submit it without asking the user.
Leave the screenshot for last
read_terminal answers what a session printed. screenshot returns the whole
window as a PNG and weighs hundreds of times a snapshot: take one only for a
question text cannot answer — a colour, a glyph, a layout — and at the end of
the run rather than inside a loop.
TermHerd’s own interface
press_keys and run_action drive TermHerd, not a terminal. An open prompt
takes their keys, and escape leaves any prompt. enter on the quit prompt
quits TermHerd, and with it the bridge the driving session is talking through.
See Driving the keyboard.
The stdio server
termherd-mcp is a separate, small binary that exposes TermHerd’s
configuration — so you can ask “what can I configure here?”, or “switch me
to a light theme”, from any Claude session, whether or not TermHerd is
running.
It speaks JSON-RPC over stdio and is stateless: it reads and writes
~/.termherd/settings.json, nothing else. A session TermHerd launched does not
need it — the live bridge carries the same two
tools over the same catalogue. Register this one for a session started
elsewhere.
Registering it
cargo build -p termherd-mcp # lands in target/
Add it to your mcpServers config, pointing command at the built binary:
{
"mcpServers": {
"termherd": { "command": "/path/to/termherd-mcp" }
}
}
Tools
| Tool | Args | Does |
|---|---|---|
list_options | — | lists the configurable options with their current values |
set_option | id, value | sets one writable option; the change lands in settings.json and applies at once |
Both speak the option id — a stable, dotted name:
| id | Kind | Writable | Values |
|---|---|---|---|
theme | enum | yes | dark, light, and the 20 named themes listed under theme |
shell.program | string | no | unset means the platform default login shell |
shell.args | array | no | |
terminal.colors.scheme | enum | yes | the 18 theme values marked ✓ under theme |
terminal.colors.foreground | string | yes | "#rrggbb" |
terminal.colors.background | string | yes | "#rrggbb" |
terminal.colors.cursor | string | yes | "#rrggbb" |
terminal.colors.palette | array | yes | the 16 ANSI colours — normal 0–7, bright 8–15 |
shell.program and shell.args are read-only over MCP: their value is
what TermHerd executes for every shell session at the next launch, and an
agent must not get to choose that unattended. list_options and the schema
carry the writable flag per id, so a model can tell before it tries.
set_option refuses rather than degrades: a read-only id, an unknown id,
or a value that does not fit the option’s kind (a non-array palette, a theme
outside the listed choices) answers a JSON-RPC error and writes nothing. So
does a settings.json that does not parse: writing the one option onto an
empty object would discard the rest of the file. null is
always accepted on a writable id — it unsets the option.
That is the whole write surface today. The close, sidebar, record,
capture, open, mcp, keys, terminal.font_size,
terminal.copy_on_select, terminal.paste_on_right_click and
terminal.option_as_meta blocks of
settings.json are file-only — keys is
readable as a resource, below.
mcp is file-only by design rather than by backlog: its keys govern who may
reach the live bridge and what it may do there, and a surface able to widen
its own reach is not a setting.
Resources
| URI | Holds |
|---|---|
termherd://options/schema | the schema of the configurable options |
termherd://keys/schema | the bindable actions, with their default and current chords |
termherd://keys/schema is generated from the same in-code action table the
keymap itself uses, so it cannot drift from the binary you are running. It is
the machine-readable form of
Keyboard shortcuts, and the catalogue the live
bridge’s run_action speaks — less the activate-tab-N family, which
run_action accepts but the resource does not list. Defaults are those of the
platform the server runs on.
What it is not
It does not reach the running app: no sessions, no tabs, no terminals, no keyboard. That is the live bridge, which reaches a session TermHerd launched, or a client attached from outside.
It is also not F-mcp-ide-bridge — a deferred, unbuilt feature that would
run the other way round, with TermHerd as an MCP client of Claude’s IDE
bridge. docs/ARCHITECTURE.md §7 sketches that bridge, and §15 lists it as a
row of its own, apart from the mcp crate: the crate holds the server
described here and the option catalogue both servers share.
Architecture at a glance
TermHerd is a replatform of an Electron session manager, and the rewrite is scoped by the defects it must fix by construction — a god object, races, silent catches, and an untestable design. Everything below is downstream of that.
The authoritative documents are
docs/PRD.md and
docs/ARCHITECTURE.md.
The dependency rule
A hexagonal workspace. Adapters depend on the core; the core depends on no adapter.
app ──────► core ◄────── adapters
(iced GUI) │ (scan, pty)
▼
claude
(pure codec)
| Crate | Is | Depends on |
|---|---|---|
core | the domain: headless App state machine, the tab/pane tree, the keymap, the port traits | claude only |
claude | a pure codec for the Claude CLI’s own formats — path encode/derive, JSONL digest, OSC decode | nothing |
app | the iced GUI shell; builds the adapters in main() and injects them; owns the one effect executor and the MCP control surface | core + adapters |
scan | filesystem discovery — walks ~/.claude/projects | core |
pty | the terminal adapter (portable-pty + alacritty_terminal) | core, private-fs |
mcp | the stdio settings server, and the option catalogue both MCP servers share | core |
private-fs | owner-only files and directories (0600 / 0700) | nothing |
The live MCP bridge is not a crate: it lives in app, as a bridge into the
shell. The IDE bridge — TermHerd as an MCP client of Claude’s own — is
deferred and unbuilt.
When adding code the question is which crate does this belong in? If the answer is “the core should call this adapter directly”, the answer is wrong — add a port trait and have the adapter implement it.
The headless core
core::App::apply(Event) -> Vec<Effect>
Elm-style, and pure: no I/O, no clock, no panic. The GUI translates user
gestures into Events and performs the returned Effects. Everything testable
lives behind apply — which is also why the MCP surface
adds no new mutation path: every tool goes through an Event the keyboard
already used.
The pane tree is pure data, exhaustively unit-testable. Its mutators return
Option<()> rather than panicking when an invariant is violated — a broken
invariant surfaces as None/Err, never an unwrap.
Concurrency
One tokio runtime, actor per session: each session is owned by a task
holding its PTY handle and terminal grid, reachable only by channel. There is
no shared &mut Session. The GUI thread owns the App and applies events
single-threaded.
That structure is the fix for the session-id race the predecessor had, not a mitigation of it.
The quality bar
Non-negotiable, and CI-enforced:
unwrap,expectandpanicare clippy-denied incoreandclaude. Production paths return typed errors.unsafe_codeis denied workspace-wide. The two sanctioned exceptions are the macOS AppKit FFI (the Cmd+Q quit path, the menus, the text and link relays) and the Win32 process listing a ConPTY pane’s Claude is found through: each acfg-gated module with aSAFETY:note on every block.- No global mutable state — no
static mut, nolazy_static, no require-time singletons. Dependencies are built inmain()and injected. - One logging stack:
tracing. Noprintln!outside tests. - Function length is gated (
clippy::too_many_lines, threshold 150). A function that exceeds it on purpose carries a local allow with a rationale. - Nine gate jobs guard a pull request —
rustfmt & arch(cargo fmt, intra-crate module boundaries, OS-cfg containment, and the file-length report),clippy(warnings denied),test(nextest),portable(every non-GUI crate built and tested on Windows),cargo-checks(cargo-deny,cargo-machete, the crate dependency rule, and toolchain lockstep),actionlint,markdownlint,roadmap, andmdbook. Each runs only when its own file category changed, so a docs-only change skips every Rust job; they fan into one required check (ci-success), which treats a skipped gate as a pass.
The full CI reference is
docs/CI.md.
Toolchain
Pinned to Rust 1.95.0, edition 2024, via rust-toolchain.toml.
Contributing
The full conventions live in the repository, and they are the authority:
CONTRIBUTING.md— contribution conventionsAGENTS.md— the engineering rules: dependency rule, quality bar, how work is trackedCODING_STANDARDS.md— Tidy First, CUPID, YAGNI, test firstdocs/CI.md— every gate, why it exists, and how to mirror it
Before you push
Every gate below is blocking in CI. Mirror them locally:
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo deny check # if cargo-deny is installed
cargo machete # unused deps; if cargo-machete is installed
just check-deps # the hexagonal crate dependency rule
just check-arch # intra-crate module boundaries + OS-cfg containment
markdownlint-cli2 # markdown is gated too, including this book
CI runs each gate only when its file category changed, and they fan into one required check. A docs-only pull request skips every Rust job.
Building this book
just docs # build → docs/book/index.html
just docs-serve # live reload on http://localhost:3000
create-missing = false in book.toml means a SUMMARY.md entry for a page
that does not exist fails the build rather than silently minting an empty
page. The chapter map is a promise; that setting keeps it honest. It covers
SUMMARY.md only — a broken link inside a page still builds, so check those
by hand.
Three rules that surprise newcomers
No issue numbers in code. Not in comments, doc-comments, or test names —
git already links code to its issue, and an in-code #42 rots when issues are
renumbered. Cite issues in commit messages, PR bodies, and roadmap prose
instead.
ROADMAP.md is generated — never edit it. Edit the feature file under
.roadmap/features/; CI checks it. The release regenerates ROADMAP.md, so
between two releases it can lag behind the feature files.
A user-visible change updates this book in the same PR. If what a user
sees, types or configures moves, the page describing it moves with it — not in
a follow-up. No gate catches a stale page: the book job proves the book
builds and that SUMMARY.md resolves, never that it still describes the
binary. Pages that restate what the code holds as data — the shortcut table,
the settings reference, the MCP tool tables — are the ones that rot first.
AGENTS.md carries the mapping from what you changed to what to update.
Everything written for the project is in English — commits, issues, pull requests, comments, docs. The history is bilingual because the rule arrived late; new writing is English whatever language the work was discussed in.
How work is tracked
Three layers, each owning exactly one thing:
| Layer | Owns |
|---|---|
.roadmap/ + docs/PRD.md | the what and why — features, MoSCoW bucket, shipped history |
| GitHub issues | the unit of work — scoped, actionable, typed and labelled |
| The project board | priority and order — Horizon, Class, Effort, Severity |
The published view of the first layer is
ROADMAP.md:
every feature, its MoSCoW bucket, whether it has shipped, and the reasoning
behind it. It is compiled from .roadmap/ — read it, never edit it. The board
that orders the work is internal, so ROADMAP.md is the answer to “does this
feature exist?” and the issue tracker to “is anyone on it?”.
An epic graduates from the roadmap to an issue only when it is scoped enough to act on.