agterm
A native macOS terminal with a deliberately small interface and a full control API.
Overview
agterm is intentionally opinionated: rather than scattering shells across tabs, it organizes them into named workspaces, each holding the sessions for one project or context. That hierarchy is the whole model, and there is nothing else to learn before it is useful.
Everything the model holds is also an object a script can address. Almost anything you can do by hand, agtermctl can do over a local socket, and every state it sets it reads back. That is what keeps a screen of concurrent coding agents in order, but nothing here is limited to agents: with nothing scripted at all it is a capable general-purpose terminal.
For the real terminal work — rendering, VT parsing, and shell I/O — agterm embeds Ghostty's engine (libghostty); everything above is agterm's own.
A vertical, two-level sidebar groups sessions under named workspaces.
agtermctl drives almost everything over a local socket.
Split a session into two shells, drop a scratch over it, or run a program in an overlay.
An installable skill teaches Claude Code or Codex to drive agterm through agtermctl.
Tinted glyphs show which of many agents needs you.
Install
Signed, notarized builds for Apple Silicon (arm64) Macs running macOS 14 or later are published on the releases page. They open without any Gatekeeper workaround.
Homebrew
brew install --cask umputun/apps/agterm
The cask also installs the agtermctl command-line tool, so cask users do not need the in-app installer for it.
Direct download. Download the latest .dmg from the releases page, open it, and drag agterm.app into /Applications.
Updates
On its second launch a published release asks once whether to check for updates automatically; allowed, it checks once a day. An update it finds downloads and installs only after you click Install. agterm ▸ Check for Updates… checks at once either way. A Homebrew install updates itself the same way, and brew upgrade acts only when the cask is newer than the installed app. A build you make yourself never updates itself.
- A version a background check finds while you work shows as a blue arrow at the right end of the title bar; right after launch, or when you come back after a while away, agterm opens the update window instead. Click the arrow for the release notes and Install.
- With Update available off in Settings ▸ Interface, or the toolbar hidden, a new find opens the update window. Turning it off while the arrow shows only hides the arrow: the update waits for Check for Updates….
- Installing asks to restart. With Live sessions the dialog says your sessions keep running and reconnect; otherwise it says which shells end. Later keeps agterm open, and the next quit asks again.
- Started with a custom
AGTERM_STATE_DIR, agterm comes back without it after the restart; reopen it with the sameAGTERM_STATE_DIRto reconnect, as the dialog says. agtermctl update checkchecks from a script with no alert of its own and opens the update window only when there is something to install;agtermctl versionshows whether checks are automatic and when the last one ran.
Optional Help-menu installers
None is needed to use agterm as a terminal; each connects it to a wider workflow, and you can run any of them later. The first launch on a Mac points them out in a welcome dialog that offers the skill and the status hooks and never appears again.
| Help menu item | What it does |
|---|---|
| Install Command Line Tool… | puts the bundled agtermctl on your PATH as a link in /usr/local/bin. When it can write there it links without a prompt; otherwise, as on a clean Apple Silicon Mac where that folder is root-owned, macOS asks once for an administrator password. The Homebrew cask already installs it |
| Install Agent Status Hooks… | lets a coding agent (Claude Code, Codex, Pi, OpenCode and others) report its state on its session's row, so you can tell which of several agents is working, blocked or finished (Agent status) |
| Install Agent Skill… | teaches Claude Code or Codex to drive agterm through agtermctl, so an agent in a session can build its own layout, run overlays and manage windows without you explaining the API. It also knows the cookbook: ask it to list the recipes, set one up, or read one for reference. It needs the command-line tool |
The skill as a plugin. The same skill is published as a plugin from the repository: claude plugin marketplace add umputun/agterm, then claude plugin install agterm@agterm, or the matching codex plugin commands.
- Use the plugin or the Help menu installer, not both: with two copies of the skill, which one the agent picks is undefined.
- Adding the marketplace clones this whole repository. Both CLIs take
--sparseonmarketplace addto limit the checkout; it has to cover the marketplace manifest as well asplugins/agterm.
Build from source
Requires macOS 14+, Xcode 26 with xcodegen on PATH (plus its Metal Toolchain), and Homebrew.
scripts/setup.sh # build libghostty and stage resources (safe to rerun)
scripts/run.sh # generate the Xcode project, build Debug, launch
cd agtermCore && swift test # unit tests, no Xcode needed
The app bundles the CLI, but agtermctl also builds on its own from the agtermCore Swift package, without Xcode or libghostty:
cd agtermCore && swift build -c release # binary at agtermCore/.build/release/agtermctl
Extend agterm
agterm ships a small set of features on purpose. Many tools you might wish it shipped are one line in keymap.conf, built from three pieces:
- a command turns any shell line into a named action on a key chord;
- an overlay gives an interactive program its own temporary terminal over the session;
- any CLI you already have fills that slot. agterm never needs to know what the program is.
So "does agterm have a file browser?" has no yes-or-no answer: you bind the file browser you like, in one line. The four steps below each add one building block.
You are not expected to write these by hand: install the agent skill (Help ▸ Install Agent Skill…) and ask the agent in your session, as step 4 shows. Steps 1-3 are what let you read the line it writes, change it later, and tell a working answer from a plausible one. To edit the file yourself, use File ▸ Edit Keymap… and File ▸ Reload Keymap.
1. Act on the session you are in
# open the session's working directory in Finder
command "Open in Finder" ctrl+a>o open "$AGT_SESSION_PWD"
commandis the directive, the quoted text is the name shown in the custom-commands palette (Navigate ▸ Custom Commands),ctrl+a>ois the chord (Ctrl-A, then O), and the rest is an ordinary shell line.- The chord is optional: without it the command lives in the palette only. Names are unique: a second line with a name already taken is skipped with a diagnostic.
- For the mouse, turn on the Custom commands title-bar button in Settings ▸ Interface. It lists the same commands with their chords, in file order. With more than five, the five you run most are grouped on top, still in file order.
The building block is session context. Every command gets the session it fired from (its directory, name, id and selection) as $AGT_* environment variables and {AGT_*} tokens. That is what makes one binding work in every session.
2. Run an interactive program over the session
# the yazi file manager, floating over the session at 95%
command "Yazi" ctrl+a>y agtermctl session overlay open 'zsh -lc yazi' --size-percent 95 --target "$AGT_SESSION_ID" --socket "$AGT_SOCKET"
The building block is the overlay. A custom command alone runs with no terminal, which suits launching a GUI app but ends a TUI at once. An overlay is a real terminal, so yazi, lazygit, htop and the rest work normally in it. It opens in the session's directory and disappears when the program exits, leaving the shell underneath untouched.
zsh -lc, notzsh -c. The program an overlay runs gets agterm's own PATH, not your shell's, so a Homebrew binary needs a login shell or an absolute path. Without it the overlay flashes open and closes.--target "$AGT_SESSION_ID".agtermctlsends a request over a socket, and agterm resolves it when it arrives. Without a target it means whichever session is selected at that moment, which may not be the one you pressed the chord in. The token pins it to the session that fired.- Failures. Custom commands report failures in notification banners. Add
--error-hudbefore the shell line to also show a ten-second panel with the command name, its exit status or launch error, and the last useful stderr line. A successful command shows nothing, and a running program overlay keeps its place instead of the panel. See Custom commands for its placement.
3. Reach the rest of the app
# a second session in this directory, next to this one, left in the background
command "Session here" ctrl+a>n agtermctl session new --cwd "$AGT_SESSION_PWD" --workspace "$AGT_WORKSPACE_ID" --window "$AGT_WINDOW_ID" --no-select --socket "$AGT_SOCKET"
The building block is the control API. Overlays are one entry in a large catalog: agtermctl also creates and renames sessions, splits panes, moves windows, opens the picker or a question dialog, reads a session's text and posts notifications. Every state it sets it also reads back, which is what lets a script build a whole layout.
The extra flags pin every axis the command could drift on. A bare session new lands in whichever window is in front and whichever workspace is current when the request arrives, and selects the new session. The ids pin all three to where you pressed the chord, and --no-select leaves you where you were. Keymap lines never wrap, so this one is long.
Past a certain size the line becomes a script, and that is where the cookbook starts: open any project in its own workspace, park a set of workspaces and bring them back later, or have each tab resume its own agent conversation after a restart.
4. Have the agent write it
This is the normal way to add things. Install the agent skill from Help ▸ Install Agent Skill…, then ask the agent in one of your sessions:
add a custom command that opens yazi in a 95% overlay, bound to ctrl+a then y
The skill carries the keymap syntax, the full command catalog, the context tokens and the PATH rule, so the agent writes a working line. An agent without it still answers, plausibly and wrongly; steps 1-3 are how you tell the two apart and change the line later without asking again.
From here, Custom commands & keys has the full keymap syntax and bindable actions, the command reference lists every agtermctl command, and the cookbook collects recipes to copy and edit.
Workspaces & sessions
A session is one running shell with a name, a working directory and its own scrollback: the unit you work in, and a row in the sidebar. A workspace is a named group of sessions for one project or context. A session can move between workspaces while it runs, keeping its shell and scrollback. A session can also sit outside any workspace, among the window's top-level sessions.
The sidebar
- The sidebar is a two-level tree: the top-level sessions first, with no row above them, then the workspaces, each holding sessions. A workspace row has a filled folder icon, a session row an outlined terminal.
- An unnamed terminal session uses the focused pane's terminal title when it has one, or else the last folder of its working directory. In a local window, a split reopens with focus on its left or top pane. Renaming pins a name of your own; clearing it restores automatic naming. Rename inline by double-clicking a row's name.
- The four icons at the bottom of the sidebar add a workspace, add a session, and toggle the workspace filter and the flagged view.
- A click on a workspace's icon folds it at once.
- Copy Name on a session or workspace row copies its name.
- Duplicate Session in a session's context menu opens a fresh shell right after it, in the same workspace and its current directory. Only the directory carries over.
- Reveal in Finder opens the focused pane's directory, and is greyed out when that directory no longer exists.
Several rows at once. Shift-click and ⌘-click select several sessions. Right-clicking inside the selection keeps it, so Flag, Tint, Close and Move to act on all of them; right-clicking a row outside it narrows the menu to that row. Dragging moves the selection, and dragged sessions keep running.
Top-Level Sessions
The top-level sessions are the sessions outside any workspace, for a shell that belongs to no project. Menus name the group Top-Level Sessions.
- File ▸ New Top-Level Session (the
new_root_sessionaction, no default key, also in the action palette) opens a shell there in the usual new-session directory. - By default every other new session, from New Session, Open Directory or a script that names no destination, goes where the selected session is, the top-level sessions included, unless you just created a workspace or the focus filter shows exactly one group without it; Addressing has the full rule. A script can name the top-level sessions as
root. - Drag a session among the top-level sessions to put it there, or into a workspace to move it out. Move to ▸ Top-Level Sessions does the same from the context menu.
- Deleting the last workspace is allowed; the window keeps its top-level sessions.
- A new window opened while a session among the top-level sessions is selected starts its first shell among its own top-level sessions; otherwise, and from the Dock menu or a remote window, it starts in
workspace 1. - A session among the top-level sessions shows no workspace name: the title bar, Recent Closed and the Attach Remote picker leave it out, and
{AGT_WORKSPACE_NAME}expands empty. Reopening one puts it back among the top-level sessions. - A server window whose server predates top-level sessions shows these items disabled.
Companions
A companion keeps a related shell or program next to a session: a log tail, a watcher, a second shell for the same task. It is an ordinary session pinned to its parent, listed right after it and indented under it.
logs companion shows its own status.
- The parent's disclosure triangle folds its companions away. A folded parent shows a small stack marker while a hidden companion has an agent status, in that status's color; blocked wins over working, working over completed, and the marker's tooltip lists each companion's status. A hidden companion's unread notifications count in its workspace's badge.
- Drag a companion among its siblings to reorder it, or onto another top-level session, or into that session's companions, to move it under that session, in any workspace of the window or among its top-level sessions. Move Under in a companion's context menu lists the window's other top-level sessions. From a script:
agtermctl session move --parent SID [--index N]. In the flagged view a drag never changes a companion's parent; use Move Under there. - Drop a top-level session on another top-level session's row to make it that session's companion, in any workspace of the window; its own companions come with it. A drop between rows still reorders. From a script:
agtermctl session move --target SID --parent PARENT. - Drop a companion on a workspace row, or between top-level sessions, to make it a top-level session there; a workspace picked in Move to does the same, at the end. From a script:
agtermctl session move --target SID --top-level [WORKSPACE | --after X | --before X], which with no destination puts it right after its former group. - Moving the parent carries its companions.
- Closing a companion closes only it. Closing the parent closes the group, and one Reopen Closed Item brings it all back.
- While a parent has companions, its shell exiting starts a fresh shell in the same directory instead of closing the session; one that exits again within 2 seconds closes the group. A Mac viewing that session attaches to the new shell.
- Flat lists (the ⌃P palette, the Ctrl-Tab switcher, the Dock menu and the Attach Remote picker) label a companion
parent › child; the tree, rename and Copy Name keep the bare name.
| Command | What it does | keymap.conf action |
|---|---|---|
| New Companion | a login shell in the parent's current directory | new_companion |
| Duplicate as Companion | copies the session's split layout into a new companion and starts another copy of each pane's program in its directory. If a pane's program cannot be copied, nothing is created and a panel over the session names the pane | duplicate_companion |
| Convert to Companion | turns a top-level session into a companion: a fresh shell takes its place in its directory, and the session moves under it still running, with its own companions, and stays selected | convert_companion |
All three are in the session row's context menu, the Session menu and the action palette.
From a script, --wait keeps the output after the command exits:
agtermctl session new --parent active --command 'tail -f build.log' --name logs --wait
Page sessions. A page companion shows an HTML page or URL instead of a shell, labelled with the file name or origin. With --page in place of --companion the page opens as a top-level session of its own, right after the target's group, and holds companions like any session; Convert to Companion works on it too. A page row's own window.close() closes it as ⌘W does, with the close confirmation and the undo, and the row comes back after a relaunch (Restore & persistence).
agtermctl session overlay open --html report.html --companion
agtermctl session overlay open --html report.html --page
On a session attached from another Mac (Remote sessions):
- New Companion and Duplicate as Companion ask that Mac to create the companion under its own session and attach it here. Closing it here only detaches it.
- Convert to Companion runs on that Mac, and its new parent attaches here.
- A session moves only under another session from that Mac: when the parent changes, that Mac moves its own session first, with the companions it has there, then the row moves here with the companions shown under it; a reorder under the same parent stays here. Another Mac attached to the same sessions keeps the old grouping until it attaches them again.
- Making a companion top-level runs on that Mac when its parent comes from there too, and the row then takes its place here; under a parent from anywhere else only this Mac's grouping changes.
- A page companion opened there is that Mac's page, shown here through its own channel; it stays there when you close it here.
Opening sessions from Finder
- Drag up to 20 folders from Finder onto the tree to open sessions there. A drop on a row lands in that row's workspace, or among the top-level sessions for one of theirs; a drop on empty sidebar space uses the current workspace, or the focused one when the workspace filter narrows the tree to exactly one. Folded workspaces spring open while you hover and close again if you cancel.
open -a agterm <path>, or Open With ▸ agterm on a folder in Finder, adds a session in that directory to the last-active window, starting agterm first when it is not running. A remote window shows only its server's sessions, so it refuses the folder, with a notification when banners are on. To place the session precisely, useagtermctl session new --cwd <path>.- Folder-picking panels (Open Directory… and the Settings directory choosers) open in the focused pane's directory, or in the directory already configured where there is one, else in your home directory.
Narrowing the sidebar
Two independent ways to cut a crowded sidebar down. If narrowing would hide the session you are working in, agterm moves you to the most recent session still on screen, unless nothing is left visible at all.
Flag sessions across workspaces into a working set. A flag is durable and survives a move.
- The flagged view is one flat list, or with Settings ▸ General ▸ Flagged view layout set to Workspace tree, nested under their workspaces, leaving out the ones with nothing flagged.
- Drag to reorder. The flat list keeps its own order per window, across workspaces, and next/previous session follows it. In the workspace tree a drag moves sessions between workspaces, as in the ordinary tree.
- A workspace row's Flag All Sessions flags every session in it, and reads Unflag All Sessions once they all are.
- View ▸ Edit Flagged Sessions… lists every session in the window; Return or a click flags or unflags one without leaving the flagged view. The empty flagged view links to it.
Focus a set of workspaces to collapse the tree to just their sessions.
- Focus one workspace to zoom to it, or mark several from their row menus and apply the filter once with the sidebar's grid button. Marking never narrows the tree on its own, and suspending the filter keeps the set for one click back.
- View ▸ Edit Focused Workspaces… marks and unmarks workspaces the same way.
- The top-level sessions take part like a workspace: the context menu of a session among them offers Focus Top-Level Sessions and Add Top-Level Sessions to Focus, View ▸ Focus reads the same while the top-level sessions are current, and the focus editor lists them first. While the filter is on and they are not focused, the ordinary tree hides them; the flagged view ignores the filter, as for workspaces.
- Creating a workspace while the filter is on adds it to the set. Selecting a session outside the set suspends the filter rather than discarding it.
- The set is per window and remembered across restarts.
Terminals: split, scratch, quick, search, overlay
| Surface | Key | What it is |
|---|---|---|
| Split panes | ⌘D, ⌘⇧D | a second shell in the same session, side by side or top and bottom |
| Quick terminal | ⌃` | one throwaway shell for the whole app, in a floating panel |
| Scratch | ⌘J | an extra shell belonging to one session, over it full-screen |
| Search | ⌘F | find in the focused terminal's scrollback |
| Overlay | control API | a program, page or message shown over a session |
| Terminal zoom | ⇧⌘↩︎ | one terminal filling the window |
| Dashboard | ⌘⇧G | several sessions' live output in one grid |
Split panes
A split is one session with two terminals, sharing one sidebar row.
- ⌘D splits side by side, ⌘⇧D top and bottom. The other shortcut turns a shown split to its axis; the current one hides the split without closing the second shell.
- ⌥⌘← and Ctrl-1 focus the left or top pane, ⌥⌘→ and Ctrl-2 the right or bottom one. On a hidden split they swap which pane is shown.
agtermctl session focuswith no pane switches to the other one. - The divider follows the axis and remembers its position. Drag it to resize, double-click it for an even split.
- Close Split in the action palette ends the second pane, whatever it is running.
- When the first pane's shell exits, the second pane takes its place and the session stays. In Live mode that includes a split still hidden since a relaunch, while its program runs.
- Swap Panes (View or the action palette) exchanges the two terminals without restarting them. The primary and split roles follow the positions, focus follows its terminal, and the divider stays put.
agtermctl session swapdoes the same, also while the split is hidden.
Quick terminal
One throwaway shell for the whole app, tied to no session or window.
- It appears in a floating panel on the screen and Space you are on, in the active session's directory, sized to 90% of that screen up to a comfortable maximum. Settings ▸ Interface can make the size a plain share of the screen instead, worth doing on a large display where the built-in maximum is the smaller of the two.
- Bind
global-hotkeyinkeymap.confto summon agterm with it from any app. - Press the key again or click away to dismiss it; its shell stays alive. A panel opened by
agtermctl quick showstays put on click-away, so a script can drive it. - It is not restored across launches.
Scratch
An extra shell belonging to one session, for a quick aside next to your main work.
- It covers the session full-screen, and ⌘J hides it again without ending it.
- While it is up, ⌘D and the split button hide it rather than rearrange the panes beneath.
- It opens in the session's directory. With Live sessions it survives a relaunch and comes back hidden; otherwise it is not restored.
Search
⌘F opens a search bar at the top of the focused terminal. It highlights matches in the live scrollback with an "N of M" counter. Enter steps forward, Shift-Enter back, Esc closes.
Paste and drop
⌘V, Edit ▸ Paste, a drop onto a pane and agtermctl session paste follow one rule, in a local pane and a remote one alike:
- Files and folders copied in Finder, or dropped, paste as their paths, shell-escaped.
- Otherwise text pastes as text.
- Otherwise an image, such as a screenshot on the clipboard, is saved as a PNG and its path is pasted. Claude Code attaches a pasted image path, so ⌘V of a screenshot gives it the image.
In a pane whose program runs on another host, an attached session's pane or a remote window's pane, the files, folders or image are copied to that host first, and the path pasted is the one there. A folder is copied without the symbolic links and special files inside it, and an offered link or special file is refused. A panel over the session shows the copy unless another panel is already up there, and a failure shows as a panel or a notification. The copy is limited to 100 MB and 10,000 files and folders; anything larger pastes nothing and says why. A pane takes one copy at a time, and a second paste while one runs is refused. Pasted files are kept under agterm/paste in the cache folder of the host that runs the program (~/Library/Caches on a Mac, ~/.cache on Linux), readable only by you; pastes older than 24 hours are removed on the next paste.
Ctrl-V is the program's own key: Claude Code's Ctrl-V reads the clipboard of the host it runs on, which in a remote pane is not yours, so use ⌘V there. A paste binding of your own in ghostty.conf, and the bundled one that pastes from the V position on a Latin layout such as Dvorak, paste text only and copy no files into a remote pane.
Overlay
An overlay runs one program in a temporary terminal over a session and disappears when the program exits, leaving the session as it was. Scripts and agents use it to show an interactive program, such as a diff viewer or a process monitor, full size, as a floating panel, or over one split pane while the other stays live. The agtermctl reference has the commands.
- The same slot can hold a HUD: a small passive panel with a message instead of a program. The session stays focused and typable under it.
- ⇧⌘J hides a session's program and page overlays without closing them, and brings them back; a hidden program keeps running. The View menu, the command palette, an optional title-bar button (Settings ▸ Interface) and
agtermctl session overlay hide|show|toggledo the same. File ▸ Edit Keymap…, Edit Hooks… and Edit ghostty.conf… cannot open over a session overlay out of sight: they beep, and bring a hidden one back unless a pane overlay is drawn over it.
Pages. With --html the overlay shows a local HTML page, such as a report or chart an agent just made; with --url, a web page such as a running dev server.
- A strip above the page names the file or site, then the page's title dimmed, with a close button, and a hide button while the title-bar hide-overlays button is enabled. ⌘W closes it like any overlay.
--navigationadds back, forward, reload, open in browser, and Show in Finder for a file or Copy Link for a URL.--chromelessdrops the strip from a file page, so a dashboard fills its session or pane like a native view. A web page may drop it too when served from127.0.0.1,::1orlocalhost, and then loads frames from its own site only.- ⌘+, ⌘− and ⌘0 zoom the page, and every later page opens at that zoom.
- A page runs none of its own JavaScript unless opened with
--js; one that does can close its overlay withwindow.close(). - A web page keeps cookies and logins only while it is open, unless opened with
--persistent, which uses one saved store shared by those pages;agtermctl browser clearempties it. A login that goes through another site still fails. - A link the page opens in your browser asks you first.
- Pages can match the terminal through the theme's
--agterm-*CSS variables, and drive agterm through the page bridge.
Terminal zoom
⇧⌘↩︎ fills the window with one terminal (a pane, the scratch or an overlay), hiding the sidebar and shrinking the title bar to a slim strip with the traffic lights, the window title and an exit button. ⌘W leaves zoom too.
- It is a view, not a layout change: leaving restores split ratios, focus and visibility exactly, and everything else keeps running behind it.
agtermctl surface zoomzooms any terminal by id, including the pane under a running overlay, which keeps running and returns when zoom ends.- It differs from macOS window zoom and full screen, which size the window itself.
Dashboard
Watch several agents or builds at once: sessions' live output in one view-only grid over the window.
- A cell is one pane: a session without a split is one cell, a split session two. The grid holds at most nine.
- Each cell's name chip shows the session's agent status, filled with the status color and pulsing while it blinks. With macOS Reduce Motion on, the color and text stay and the pulse stops.
- A pane covered by an overlay shows a label instead of the terminal: the page's file or origin with its title, or the program's command when known.
- No cell takes input. Arrow keys move a highlight; Enter or a click jumps into that session and focuses that exact pane; Esc closes.
- ⌘⇧G, Navigate ▸ Dashboard, the command palette's Dashboard or the title-bar grid button opens it with the window's most recently used sessions, the cell font scaled to the grid.
- It cannot be open together with terminal zoom.
From a script:
agtermctl dashboard "$a" "$b" "$c" # these sessions
agtermctl dashboard --mru # the window's most recently used sessions
agtermctl dashboard "$a:left" "$b:right" # one pane each, keeping the others out of the nine
agtermctl dashboard --mru --font-size 11 # a fixed cell font size; --auto-size scales it to the grid
The :left/:right form is what tree --json reports in dashboardMembers.
Windows
A window is a macOS window with its own sidebar, workspaces and sessions, so "work" and "personal" can run side by side, each with its own tree. agterm keeps a library of windows: open one per screen, and create, rename or delete them from the File menu (New Window ⌥⌘N) or the action palette.
- The windows open at quit reopen at the next launch, with their frames.
agtermctl windowcreates, raises, moves, resizes and minimizes windows. A few lines of shell can give every window the same frame and park all but the current one, so several windows feel like one that switches contents. See the agtermctl reference.
Remote sessions
Open a session that runs on another Mac in this sidebar, as a row marked remote, splits and companions included. Its programs keep running over there; this Mac shows them at its own window size. A session on a Linux host running agterm-server attaches here the same way, or the whole host opens in a remote window (Remote server); a remote window can also show a whole window of another Mac (A window of another Mac).
Set up the other Mac
- agterm runs in Live sessions mode there (Restore), which keeps a live program behind each pane. A page session needs no live program.
agtermctlis installed there by the cask or Help ▸ Install Command Line Tool…. A Mac that only runs agterm has no CLI an ssh command can find.- Key-based ssh works without prompts. agterm runs ssh non-interactively, so a password or host-key prompt is a failure, not a question.
Check the connection the way agterm makes it:
ssh -o BatchMode=yes studio.local true
No output means agterm can reach the host. A password or host-key prompt means agterm fails the same way. agterm runs ssh from the app, which has the launch environment, not your shell's: an agent exported in .zshrc passes this check and still fails in agterm. Put IdentityAgent and key settings in ~/.ssh/config, which both read.
Attach a session
File ▸ Attach Remote… (the attach_remote action, ⌘⇧R by default) lists the Macs in remotes.conf:
# remotes.conf, in the config directory: destination [label]
studio.local Studio
[email protected] Mac mini
- The destination is what ssh takes; the rest of the line is an optional picker label. Lines starting with
#are comments. - With more than one Mac listed, the picker asks which, then shows that Mac's sessions. The one you choose attaches in the current window, with its companions when it is a top-level session.
- A panel over the session reports the connection while it is made. A failure stays up for five seconds, over the new session when part of a group could not be attached.
- The item is greyed out while the file is missing or empty. An unusable line or an unreadable file is reported in a notification.
From a script:
agtermctl zmx tree studio.local # window/workspace/name (split) [id] cwd, every open window
agtermctl zmx tree # without a host: what this Mac offers, in the same shape
agtermctl zmx attach studio.local 7c1e… # the id from that listing, not the name
agtermctl zmx attach studio.local 7c1e… --companions # with its companions
agtermctl zmx attach studio.local 7c1e… --window "$win" # into an open window (id from window list), not raised
agtermctl zmx attach studio.local 7c1e… --workspace-name api --create-workspace # into the workspace named api
# pick from the listing and attach the choice
s=$(agtermctl zmx tree studio.local --json \
| jq '[.result.remote.sessions[] | {id, label: .name, subtitle: (.windowName + "/" + .workspaceName + " " + .cwd)}]' \
| agtermctl pick --prompt "Attach which session?" | jq -r '.id // empty')
[ -n "$s" ] && agtermctl zmx attach studio.local "$s"
Without --window the session opens in the frontmost window, and without --workspace or --workspace-name in that window's current workspace. --create-workspace adds a named workspace that does not exist yet. A companion that joins its parent's row goes where that row is.
What can be attached
- Only a session whose every pane still has a live program is listed. The choice is checked again at attach time, so a session that ended in between fails instead of handing back a fresh shell wearing its name.
--companionsattaches each companion under the session. If one cannot be attached, the rest stay and the command fails naming what is missing.- A terminal companion attached on its own joins its parent's group when exactly one row in the window is attached from that parent.
- A companion created over there later, or moved under the session, appears under its row here by itself, without changing the selection or taking the lead of its panes. One this Mac already shows stays where it is, and one you close here is not brought back. With two rows attached from the same session, a new companion gets one row, under either of them. A companion that could not be attached when it appeared, because it had ended or its program was not running yet, shows up once it runs again at the session's next companion change or reconnect, not at the restart;
agtermctl zmx attachbrings it sooner. A host on an older release sends no companion list, so nothing follows;followsCompanionsintreesays whether a row follows. - A page session is listed too: attaching it opens that Mac's page as a top-level row here. A page companion attaches only under the row attached from its parent, so the picker leaves it out.
Start a session on another host
File ▸ New Remote Session… (the new_remote_session action, no default key) starts a shell on a host in remotes.conf and attaches it here, at the end of the workspace that was current when you chose the item.
- With more than one host listed, the picker asks which. A Mac with several open windows is asked which window gets the session there.
- On the host the session goes into the workspace with your workspace's name, the first one when several share it, created when there is none. Nothing is selected there. Started from the top-level sessions, it goes among the host's top-level sessions, and a host too old for them refuses before creating anything.
- The host must be a Mac in Live sessions mode or an agterm-server. A host that does not answer, or runs an agterm too old to tell, gets nothing created and the panel says why.
- A session created but not attached is named in the panel with its id;
agtermctl zmx attach HOST IDattaches it later. When the host's reply is lost, the panel says it is unknown whether a session was created. Either way nothing is sent again. - The item is greyed out while
remotes.conflists no host, and in a remote window, whose new sessions come from its server.
agtermctl session new --remote studio.local # frontmost window, current workspace
agtermctl session new --remote studio.local --origin-window 6f1c # that window on a Mac with several (id or prefix)
agtermctl session new --remote srv --cwd /srv/app --command "make run"
agtermctl session new --remote srv --workspace-name deploy # name of the workspace on the host
agtermctl session new --remote srv --window "$win" # into another open window here
It prints the new row's id, an attached row like any other. A placement, a name, a tint, --wait and --no-select are refused: the row always lands at the end of the current workspace and is selected.
The attached row
- The title bar shows a cloud and the host; hide it with Settings ▸ Interface ▸ Remote host. The Ctrl-Tab switcher and the recent and attention lists mark the row the same way.
- Closing the row ends only this Mac's connection, and the programs over there keep running.
agtermctl session close --terminateends the session on the other Mac too, andagtermctl zmx killends the targeted pane's program there. - A closed row joins File ▸ Open Recent under Remote Sessions. Reopening attaches again while the other Mac still lists the session, or has it reopen its own entry first. Reopen Closed Item (⌘Z) inside the other Mac's undo time undoes a terminate there.
- An open session is saved and attached again at the next launch. If agterm confirms that an attached terminal session is gone on the host, it closes the session here.
agtermctl tree --jsonreportsremoteHostandremoteSessionIDon the row.
Who leads a pane
The program in a pane sees the window size of the one Mac that leads it.
- Attaching takes the lead in every pane, so the session arrives at your size with nothing to press.
- On the other Mac, those panes are covered with a note that they are in use elsewhere. A key press or click on the cover, or
agtermctl session lead, takes the lead back and covers the pane here. - Scripts typing into a covered pane on the other Mac still work, and so do their screen reads: both go through the session, not the covered view.
- Closing the session here uncovers the panes over there.
- When the connection drops and a pane or the scratch terminal reconnects, it takes the lead back if this Mac led it when the link dropped and nobody has used it since: the lead is still held by this Mac's lost connection, or another Mac took it only because the pane was free and nothing has been typed, pasted or clicked there since. Otherwise the pane comes back covered. After a relaunch or a reopened window, each pane this Mac led when it left takes the lead back the same way: in a session attached from another Mac, in a remote window, and in this Mac's own sessions while another Mac shows them. Opening a window of another Mac takes the lead outright, as the next item says. A session started on the host by an agterm without this behavior keeps leaving the lead where it is until it ends.
- In a window of another Mac, this Mac takes the lead when you open the window, in the rows you create, reopen or bring back with undo from here, and in the new pane of a split you add from here; the row's other pane keeps its leader. Rows created on the other Mac leave the lead where it is, and a relaunch or a reconnect takes it back only as described above.
- Both Macs need an agterm with this behavior; against an older one the session arrives at the other Mac's size until you type.
- While another Mac leads at a different size, cursor and screen-text reads here can disagree with the program's layout. Automation that relies on them is unsupported in that state.
What follows the session to this Mac
Each terminal attach also opens a presentation stream back to the other Mac. Over it, this Mac mirrors:
| Mirrored | Detail |
|---|---|
| layout | two remote panes follow the other Mac's split direction, hide and show, and swaps; a split opened there later attaches here into an empty split slot; a replica closed here stays closed |
| status | clearing the row's status or badge here (typing, selecting, Clear Status) clears it there too, under that Mac's reset settings, when the status came from there; a status set on this Mac's row clears here only, and one pane here finishing leaves the other Mac's active shown |
| session context | a context set here wins over the mirrored one; clearing it here shows the other Mac's again |
sidebar info line, notify notifications, HUD |
a timed HUD closes on this Mac's own count of the time left, so the two can close a moment apart |
What stays local: local panes, the divider ratio and keyboard focus. A HUD or overlay opened by a program on this Mac is never replaced by a mirrored one. A terminal notification (OSC 9/777) is not mirrored: it already arrives in the pane's output and shows here once.
- A page session uses its page channel instead and mirrors none of this.
- The stream needs only
agtermctlon the other Mac's ssh PATH. An agterm there from before context mirroring mirrors everything but the context; one too old for the stream readsunsupportedand the attach still works. agtermctl tree --jsonreports the stream as the row'spresentation.connectedmeans mirroring works; it says nothing about the panes' own ssh connections.- An older other Mac leaves the layout alone.
What runs on the other Mac
Commands that change the session run on the Mac it came from, and the result attaches here:
- Duplicate Session, a new split and Close Split, Convert to Companion, moving a companion under another session;
- the scratch terminal, refused while the row is not connected or when the other Mac's agterm is too old to show its scratch;
agtermctl session restart,zmx killandsession restore; a session from agterm-server refusessession restore, since the server keeps every pane running.
When the other Mac gives no answer, the request is reported as unknown and is never sent again or done here.
Commands that only inherit the session's directory run here: a custom command, an overlay opened without --cwd, the quick terminal, and New Session set to open in the current directory. They start in the other Mac's reported directory when that path exists here, else in your home. A custom command still sees the reported path in $AGT_SESSION_PWD and the host in $AGT_SESSION_HOST (empty for a local session).
Questions, overlays and pages from the other Mac
The first attached Mac to ask presents the session while nobody else does; its row's presentation reads mode: presenter. When that Mac leaves, another attached Mac takes over without reconnecting, if it and the other Mac (or agterm-server) both run a current agterm.
- A question (
ask,pick) or program overlay that a program there opens is shown on the attached Mac leading its pane, the one you last typed in; one covering the whole session follows the other Mac's main pane. When no attached Mac leads that pane, the presenting Mac shows it. - When the other Mac is a Mac rather than agterm-server, this happens only while that pane follows another Mac's lead there; while you work at the other Mac itself, it stays there.
- A question or page already open follows the lead too: it moves to the Mac you now type in, or back to the other Mac when you type there. A dialog moving to an attached Mac waits there until that Mac can show it; one coming back waits on its old Mac until the other Mac can, for example once a picker closes, the session is selected or a dashboard closes. A page an attached Mac refuses stays where it is and is offered again the next time the lead moves. Moving a dialog clears text typed into it and a picker's filter, and moving a page reloads it. A program overlay stays on the Mac it started on.
- A Mac leading one of the session's panes also opens clicked pages and clears the status, as the presenting Mac does. With an older agterm on either side, everything goes to the presenting Mac.
- The tree tells you where the next one goes:
remoteon the other Mac's pane readstruewhen it opens on an attached Mac, andpresenters.viewerscounts the attached rows showing the session (viewed byinagtermctl tree). - The answer or exit status still reaches the program over there. A handed-over overlay's program runs once, on the other Mac, inside an ssh terminal this Mac opens for it.
- When this Mac goes away, a question or page it showed moves to the attached Mac that would take a new one, or back to the other Mac when none can; a page's result stays open while it moves. A dialog the other Mac cannot show then ends cancelled with
presentation-lost, and a page with no free place there ends dismissed. A page whose connection drops after it loaded is shown once more. - If this Mac refuses a question, it goes back to the other Mac. An overlay this Mac cannot show fails rather than opening over there. Closing such an overlay from a script asks it to end, and its result says how it did.
- A status sound follows the same rule, for the pane that set the status: it plays on the attached Mac it goes to, with that Mac's own blocked sound.
Pages follow the same rule, and below, "this Mac" is the Mac a page opened on:
- A file page reads its files from the other Mac as needed, and its buttons and scripts act on the other Mac's session, so a page that answers its caller answers the program over there. Finder and browser are refused for it, since the file is not on this Mac.
- A web page loads directly here; with
--persistentit uses this Mac's saved browser storage. Alocalhostpage names a server on the other Mac, so it loads through an ssh forward from this Mac; an agterm here too old to forward refuses it. - A picture, markdown or text page (
--image,--markdown,--text) is fetched and built here. A markdown page follows its links to the other Mac's files (an older agterm here keeps them as text), and a picture opened without a size is sized for this screen, so an agent there can show you its screenshot. An agterm here too old for these pages refuses the open.session overlay expandfrom the other Mac lays out a JSON Lines page here as it would locally; an agterm here too old for it refuses the command. - A log page follows the file over there.
session overlay follow,search,wrapandchangesfrom the other Mac act on the page here and answer as they would locally; what you do in the page's bar reads back there. An agterm here too old for live text pages refuses a log page, opens a clicked log as a plain page, and refuses those commands. - Closing the page from a script over there takes it down here; reloading asks this Mac to do it.
Clipboard
pbcopy on the other Mac fills that Mac's clipboard, not yours. agtermctl clipboard set sends the text through the pane, asking every terminal attached to it to set its clipboard, this Mac's included; each applies its own clipboard-write setting. It needs no terminal, so an agent's shell tool can use it.
Files and screenshots you paste or drop into an attached pane are copied to the other Mac, as Paste and drop describes.
When the connection drops
The presentation stream. Mirrored status, context and HUD clear here and return on reconnect. Retries run after 1, 2, 4, 8, 16, then 30 seconds, every 5 minutes after eight failures in a row, and never stop; waking the Mac or a network change retries at once. While it is down:
- the row says so and names the host;
- a notification raised over there is never shown here;
- a handed-over question goes back to the other Mac, a finished overlay held open with
--waitcloses, and a running overlay keeps running until its program ends.
Close and reattach the session to retry by hand.
A pane's ssh connection. The pane keeps its last screen, and what happened shows in a small panel at the bottom of the pane rather than as terminal text.
- If ssh itself failed (exit 255, which a refused login also gives), the panel reads Connection to HOST lost and says it is reconnecting. agterm attaches again once the host answers, on the stream's schedule; any key, a click on the panel, waking the Mac or a network change retries at once and restarts the schedule. ⌘W still closes the session.
- While the host keeps refusing, the panel adds what ssh said last, such as a changed host key or a rejected login.
- When the host answers, the last screen is replaced before the new connection is up, so a link that drops again right away leaves an empty pane with only the panel.
- The pane takes the lead back only as Who leads a pane describes; otherwise it arrives covered.
- Any other exit shows SESSION on HOST ended; any key closes the pane.
- If the other Mac closes the session, the row here closes by itself with no panel, whether it is open now or comes back at the next launch. A session closed there with undo keeps its row here until the undo window passes; undo there leaves it as it was.
Keepalive. When your ssh config sets no ServerAliveInterval for the host, or sets 0, agterm adds ServerAliveInterval 5 and ServerAliveCountMax 2, so a dead connection is noticed within about 15 seconds. Set a large value to opt out. A connection that joins an existing ControlMaster ignores these; the master's settings decide.
Remote server
agterm-server runs agterm sessions on a Linux host, and a remote window on the Mac shows them over ssh. The server keeps the workspaces, sessions and shells, so closing the Mac, losing the network or quitting agterm leaves every shell running, and the next connection finds them as they were.
Install
Install the server from the Mac with the app's own agtermctl:
agtermctl server install dev.example.com # -p, -i, -J and -F pass to ssh
The host needs systemd with a user manager, logind for lingering, bash and tar, and zsh, fish or bash as the login shell. A password or host-key prompt is answered in the terminal you run the command from.
What the install does:
- Downloads the agterm-server release matching the app's version for the host's architecture (aarch64 or x86_64), and refuses it unless its sha256 matches the one the app was built with.
- Puts the server in
~/.local/lib/agterm-serverwith links in~/.local/bin. - Writes
~/.config/systemd/user/agterm-server.serviceonly when it is absent, so later runs keep your edits, and starts or restarts the service. - Enables lingering, without which systemd stops the server and every shell at your last logout. When
loginctl enable-lingeris refused, the install stops before starting anything and prints the command an administrator runs. - Ends with
agterm-server install-hooks, which installs the agent status hooks and the agterm skill for the host's user. Run it again on the host after installing an agent there.
An upgrade is the same command; the service restarts and every shell keeps running.
| Exit code | Meaning |
|---|---|
| 0 | installed |
| 3 | installed, but the agent hooks are incomplete |
| 1 | failed |
Agent hooks on the host.
- The Codex hooks need jq on the host; without it they are skipped and the install reports the hooks incomplete.
- Copilot CLI's hooks go to
COPILOT_HOMEwhen it is set and not empty, resolved likeCODEX_HOME, otherwise to~/.copilot, and only when that directory exists. - The Claude Code and Copilot CLI hooks read their payload with jq on the host to tell a subagent from the main agent. Without it, a Claude Code subagent's activity replaces the main agent's status and a turn that leaves background agents running reports completed; a Copilot CLI subagent's tool clears a pending permission prompt, its stop reports completed during the turn, and a
copilot -prun ends idle. - Codex's hooks and skill go to
CODEX_HOMEwhen it is set and not empty (a relative one is resolved against the working directory), otherwise to~/.codex. ACODEX_HOMEthat does not exist is reported and skipped. - OpenCode's plugin is installed only where its config directory exists, for the version
opencode --versionreports or the one--opencode v1|v2names.
Options and notes.
--from FILEinstalls a tarball already on the Mac, such as one you fetched from the release page; it must match the same sha256.- On the host,
agtermctlreaches the server with no flags. A plainssh HOST agtermctl treecan miss it, because a non-login shell's PATH often lacks~/.local/bin; the installer says when that is so, and~/.local/bin/agtermctlneeds no PATH. agterm's own remote commands set PATH themselves. - A service edited to use another state directory also needs
AGTERM_STATE_DIRset to it. - A development build has no release to install. From a checkout of this repository,
scripts/setup-zmx-linux.shstages the Linux artifacts once andscripts/install-server.sh HOSTbuilds the server from the tree and installs it the same way. It needs Docker, the toolchain of a source build, and key-based ssh.
Open a remote window
File ▸ Open Remote Window… offers the hosts in remotes.conf, the same list Attach Remote… reads, and opens the only one without asking. It is the open_remote_window keymap action, with no default key. agtermctl window remote open HOST does the same and prints the window id. A window already showing that host is raised rather than opened twice.
The sidebar is the server's: creating, renaming, splitting, moving and closing sessions and workspaces happen on the server. Selection, focus, font size, split dividers and the window frame stay on this Mac.
On agterm-server, a pane this Mac creates or restarts with a program holds that program until the first terminal attaches to it, at most 30 seconds, so a program that asks the terminal for its colors at startup, as codex does, gets its answers when a terminal attaches in time. A restart of a pane the window is not laying out, such as the hidden pane of a collapsed split, starts at once. A command created on the server itself, such as an agent there running agtermctl session new --command codex, starts at once even with no terminal attached, and codex started that way can draw its prompt line without the background band; add --attach-pending when a terminal attaches to the pane afterwards.
A window of another Mac
The host can also be a Mac running agterm in Live sessions mode. The remote window then shows one window of that Mac, and everything on this page about a remote window applies, with that Mac in the server's place. A Mac with one open window opens it at once; with several, the same picker asks which. From a script, agtermctl window remote open HOST --origin-window W names it by id or unique prefix; without it, a Mac with several open windows is refused with their names.
- Changes made here happen in that Mac's window, even while someone works in it. They never change the selection there, except that closing the selected row selects another, as it would locally.
- A Mac not in Live sessions mode is refused before any window opens.
- Rows that Mac attached from a third Mac are not shown. A workspace holding such rows cannot be deleted from here; the refusal says how many it holds.
- Recent Closed, Reopen Closed Item and Clear Menu use the list of that one window. The other Mac's own File ▸ Open Recent still lists every window.
- Asks, picks and page questions follow the rules of an attached session.
- A pane stopped on that Mac shows its end here and is not attached again while it stays stopped; a session whose every pane stopped reads Ended on HOST.
- A hidden split on that Mac whose shell exits by itself can still read as running here until that window's panes change, an action is sent from here, or this Mac reconnects.
- On that Mac,
agtermctl window listandtreereportcatalogViewerson the window: how many Macs show it. Nothing on its screen marks it.
What runs where
| On the host | On the Mac |
|---|---|
| every shell, the scratch, overlay programs | the window, settings, theme and keymap |
| the workspaces and sessions | the quick terminal |
| flag and tint of the server's rows, so every Mac shows them | custom command bodies |
- An ask, a pick, a page, a HUD or an overlay is drawn by the Mac showing that session. With no Mac connected, a HUD is kept on the host and shown when a Mac shows the session.
- The connection works with a stock sshd configuration; nothing on the server's ssh setup needs changing.
- A program on the host reads the server's own state:
agtermctl eventsandsession waitfollow the server's event history, a session info line expires there,surface cursorreads the pane's screen, andzmx listandzmx screencover the server's shells. - Clearing the server's status or a badge on the Mac (typing, selecting the row, Clear Status) clears it on the server under the Mac's default rules. A status set on the Mac's row is cleared there only.
Disconnects
When the connection drops, the window keeps its last sidebar and screens, marked Disconnected, and keeps trying to reconnect.
- Selection and scrolling still work. Anything that would change the server is disabled, never queued, and no local shell takes a session's place.
- A reconnect starts from a fresh copy of the server's state.
- An action whose reply was lost is marked pending, then unknown. The window asks the server what became of it as soon as it can and clears the mark; it never sends the action again. One the server no longer remembers stays unknown, listed in the connection strip, and
agtermctl window remote dismissclears those marks without undoing or resending anything.
While no Mac shows a session. An ask, a pick, a page or an overlay opened on the host waits there and is offered to the next Mac that shows the session.
- Only an ask or a pick ends unanswered, at its
--timeoutwhen it has one. A page or an overlay job waits with no limit. The Mac it is offered to has a short time to claim it, and a claimed job never starts a second time. - A server restart forgets everything still waiting, and the
agtermctlcall waiting on it fails. - Notifications are shown live and never replayed.
Close, detach and terminate
Closing the remote window detaches it, and everything keeps running on the host. Closing a session, a group or a workspace in it asks first:
| Choice | Effect |
|---|---|
| Detach (default) | hides it on this Mac and leaves it running |
| Terminate | ends it on the server; needs a live connection |
| Cancel | keeps it |
- Terminate on a server that keeps Recent Closed has the same undo grace as a local close: Reopen Closed Item (⌘Z) brings it back for a few seconds. While the remote window is frontmost, File ▸ Open Recent and Reopen Last Closed Item read that server's list;
agtermctl recent list|open|clear --window Wreaches it from a script. An older server ends it with no undo. - Running overlays close either way.
- File ▸ Detached Sessions… (
detached_sessions) brings a detached session or workspace back.agtermctl session detach|reattachandworkspace detach|reattachdo the same from a script.
Ended sessions. A shell that exits is handled on the host as it would be locally. When the server loses the program in a session's last primary or split pane, or cannot start its replacement, the row stays in the sidebar marked Ended on HOST, its scratch still running if it had one.
- Closing it needs no prompt while connected and with nothing in its group still running.
- Detached Sessions… lists an ended session only to remove its record.
- An unreachable host never marks a session Ended; it reads Disconnected.
Scratch, custom commands and pages
- Scratch. A remote session's scratch is a shell on the host. It is kept while hidden and across a closed window, and ends only with its own exit, the session's close, a server restart or
session scratch --commandreplacing it. - Custom commands run on the Mac, with
AGT_*tokens naming the server's session and host. Anagtermctlcall they make goes to agterm on the Mac, which passes the actions a remote row supports on to the server. - Pages at the host's loopback. A page at a loopback URL on the host, such as
http://localhost:3000, opens through an ssh forward on a free local port kept for the page's life; a failed forward shows as the page's error.
Page rows. A page session or page companion made on the host (agtermctl session overlay open --page --html FILE with a path on the host, or --url) shows in the remote window as a page row, and the same command aimed at one of the window's rows makes one on the server.
- A page at the host's own loopback is refused there, since no Mac would reach it.
- Each Mac shows the row through a view of its own. While it has none, the row shows why (waiting for the host, the host unreachable, or the page's connection ended) and keeps retrying until the page shows. A refusal from the server stays shown; detaching and reattaching the row tries again.
- Only closing the row on the server removes it, which closing its page from the Mac does.
- An older agterm on the Mac does not show page rows, and their companions appear there as top-level rows.
Notifications
A program in any session can raise a desktop notification with OSC 9 or OSC 777, or with agtermctl notify. It shows as a macOS banner and as an unseen-count badge on the session's sidebar row; the workspace row shows the total of its sessions, folded or not.
- Clicking the banner brings agterm forward and focuses the exact pane that raised it.
- Focusing a session or typing in it clears its badge. Badge reset in Settings can limit typing to Enter, or turn the typing reset off.
agtermctl session seenclears a badge without moving focus, so a script driving a session can acknowledge it.agtermctl tree --jsonreports each session'sunseencount.
Settings ▸ Notifications turns banners and count badges on and off separately, and sets:
- the Dock icon bounce for a notification while agterm is in the background: off, once, or until you focus agterm;
- a notification sound, a system sound played with each banner: None by default, silenced by Do Not Disturb.
For a coding agent that only needs to say it is waiting, agent status usually fits better.
Accessibility
Dictation tools. MacWhisper and similar apps that look for a focused text field work over the terminal: the pane on screen presents itself to macOS as an editable text area, so a hold-to-dictate widget anchors to it and the text lands at the prompt.
- Text arrives at the cursor the same way typing does.
- Text carrying a newline, a tab or another control character goes in as a bracketed paste, so a program that supports bracketed paste takes it as literal text instead of running the line or completing the word. At a raw prompt with bracketed paste off, the same caveat as ⌘V applies: a trailing newline still submits and a tab still completes.
- System Dictation types through macOS text input, the same path the keyboard and input methods use.
Limits.
- Scrollback is not exposed: to a screen reader the pane reads as an empty text area named "Terminal", not as the terminal's contents.
- The terminal only appends at the cursor, with nothing to read back. A dictation tool that re-sends its whole transcription on every revision, instead of only the new words, leaves each draft at the prompt one after another. Tools that insert as they go, MacWhisper among them, are unaffected.
Customization & settings
Themes. View ▸ Select Theme… (also in the action palette) previews each of the 512 bundled themes on the open terminals as you move through the list. Enter keeps the theme and saves it to Settings; Esc goes back to the one you started on.
Settings (⌘,) has six tabs. Most changes apply at once; a change of restore mode applies at the next launch.
General
- Mouse scroll speed and right-click to paste.
- Open links in: the browser, or a session overlay at full size, 95%, 75% or 50%, for a ⌘-clicked web link (see links).
- Whether clicking a workspace row folds and unfolds it (on by default). The disclosure triangle, the row's icon and the row's right-click Collapse/Expand Workspace always do.
- Flagged view layout for every window: a flat list with or without each row's workspace name, or a workspace tree. The tree shares each workspace's fold state with the ordinary tree.
- Where a new session opens: your home directory (default), the current session's directory, or a folder you pick; and whether New Session adds it at the end of the workspace or right after the current session.
- Restore mode: fresh shells, re-run commands, or Live sessions (Restore & persistence).
- An optional confirmation before closing a session.
- Confirm before quitting (on by default). Ticking Don't ask again in the Quit Agterm? dialog and quitting turns it off; turn it back on here.
- Whether to load your global Ghostty config (Ghostty config).
Appearance
- Terminal font and size, cursor shape and blink, and theme.
- Follow system appearance (off by default) adds a second theme picker for the other appearance, so the theme follows the macOS light/dark switch. While it is on, the Theme picker edits the appearance you are in.
- Toolbar: Normal (with the working directory), Compact, or Hidden for a full-bleed terminal with no title bar or traffic lights. In Hidden mode an invisible strip along the window's top edge still drags the window. A double-click there follows Desktop & Dock ▸ Double-click a window's title bar to: Zoom or Fill zooms, Minimize minimizes, Do Nothing does nothing (Zoom by default). The keyboard and the Window menu still close, minimize and zoom the window.
- Window background opacity and blur. Blur needs opacity below 100%.
- Sidebar tint, sidebar font size, and sidebar density (Default, or Compact for shorter rows and a smaller indent).
- Palette and switcher font size.
- Inactive pane and backdrop mute: how much the terminal behind a floating panel dims, which covers the inactive half of a split and the session around a floating overlay or the quick terminal.
Reduce Transparency and Reduce Motion. With macOS Reduce Transparency on, translucent windows, palettes and switchers show opaque and unblurred; your saved opacity and blur are kept and come back when it is off. Ignore Reduce Transparency (off by default) keeps the window's opacity and blur anyway; palettes and switchers stay opaque. Reduce Motion keeps status colors and glyphs but stops their pulsing in the sidebar and the dashboard.
Interface
Turn individual controls in the title bar and the sidebar on or off. All are on by default except Workspace name, Custom commands and Hide overlays.
- Workspace name shows before the session name, cut to 24 characters.
- Hide overlays stays in place and is dimmed while the session has no overlay to hide.
- Update available appears only while a background check has found a new version (Updates).
- Workspace add-session is the + shown on a workspace row on hover.
- Hiding Workspace icons or Session icons gives names more room, and takes what the icon shows with it: a session's split, flag fill, remote cloud, page glyph and icon-only tint, and a workspace's focus mark. A remote session's connection notice then shows when you hover its name.
- Hiding Workspace chevrons moves every row left into their space; a workspace row then gives no sign of being folded.
- Session info: where a session's info line shows: Always, Flagged (the flagged view only) or Off.
- Active window only (off by default) shows the sidebar only in the frontmost window and hides it in the others, so the sidebar moves with focus.
- Quick Terminal ▸ Size: the quick terminal's share of the screen (Quick terminal).
Notifications
Banners, the unseen-count badge, the Dock icon bounce (off, once, or until focused), the notification sound (None by default), the title-bar attention indicator, and Badge reset: when typing in a session clears its badge (on the first key, on Enter, or never). See Notifications.
Agent Status
Status glyph colors and shapes, the blocked-session sound, and Status reset: when typing into a blocked or completed session clears its glyph (on the first key, on Enter, or never). Navigation settings choose whether attention navigation also stops on active sessions and whether it crosses windows, and an idle time after which agterm moves to a blocked session. Reset to defaults restores the colors, shapes, sound and status reset. See Agent status.
Key Mapping
The folder holding keymap.conf, a list of parse errors, and a reload button (Custom commands & keys).
Lock in agterm (off by default) picks one of the keyboard layouts enabled in macOS and holds it while any agterm window has the keyboard, including overlays, pickers, dialogs and rename fields. Switching layouts there is undone at once, and your earlier layout returns when you move to another app. A crash or force quit leaves the locked layout selected.
Custom commands & keys
~/.config/agterm/keymap.conf rebinds built-in shortcuts and defines your own shell commands, bound to keys and listed in the custom-commands palette (⌃⇧O). The file is optional: a commented starter is written on first launch, and Settings ▸ Key Mapping can point to another folder. It uses kitty-style syntax with four verbs; blank lines and # comments are ignored.
# rebind a built-in to a chord (modifiers joined by +)
map cmd+shift+l toggle_split
map ctrl+shift+k command_palette
# or to several alternatives, joined by | with no spaces
map cmd+t|ctrl+a>t toggle_scratch
# custom commands: the quoted name shows in the palette; the chord is optional
command "Open in Zed" cmd+shift+e open -a Zed "$AGT_SESSION_PWD"
command "Lazygit" ctrl+a>g agtermctl session overlay open 'zsh -lc lazygit' --socket "$AGT_SOCKET"
command "Deploy" ./deploy.sh
# one system-wide chord that summons the quick terminal from any app
global-hotkey ctrl+opt+space
# your own viewer for ⌘-clicked files
open *.md glow-page.sh "$AGT_PATH"
Editing. File ▸ Edit Keymap… (also in the action palette) opens the file in a 95% overlay running $VISUAL or $EDITOR (vi if neither is set) and reloads it when the editor quits. Apply edits made elsewhere with File ▸ Reload Keymap or agtermctl keymap reload. A bad line never discards the rest: it shows in the diagnostics list in Settings ▸ Key Mapping while the good lines apply.
Chords
- A chord is modifier words (
ctrl,cmd,opt,shift) joined by+, then a base key: a single character,tab,space,return,delete,left,right,up,down, orf1throughf20. - A symbol typed with Shift is written as Shift plus its base key:
shift+/for?,shift+=for+. - A custom command's chord must start with a modifier or a function key:
f5andf5>xare valid. - On Apple keyboards, hold Fn/Globe or turn on standard function keys in System Settings to send F1-F12 instead of media keys.
Alternatives. Join several chords with |, with no spaces: map cmd+t|ctrl+a>t toggle_scratch fires from either, and a command takes alternatives the same way.
- For a built-in, the first single chord becomes the menu shortcut. Every other alternative must start with a modifier or a function key.
- A typo in one alternative rejects the whole line. An alternative that breaks a rule or is already taken is dropped alone, and the others keep working.
- A line that ends up binding nothing leaves the action with its default shortcut.
Leader sequences. ctrl+a>g means ⌃A, then G. A built-in bound only to a sequence, like map ctrl+a>s toggle_split, has no menu shortcut at all: its default ⌘D is released and free for another action.
A sequence fires once. Add --repeat after the chord, on either verb, to keep the prefix live until half a second after you release the key, like tmux's bind -r:
map cmd+opt+up|ctrl+a>ctrl+h --repeat previous_session
map cmd+opt+down|ctrl+a>ctrl+l --repeat next_session
Now ⌃A ⌃L ⌃L ⌃H walks two sessions down and one back, ⌘⌥↑ and ⌘⌥↓ still work, and holding the last key repeats it. Any other key ends the repeat and reaches the terminal as usual. A last key with no modifier, like ctrl+a>n, takes that letter when you type it within half a second.
Non-Latin layouts. Chords are written in Latin and keep working on any layout.
- A layout that cannot type ASCII (Russian, Greek, Hebrew, Arabic, Thai) matches by physical key position, so
cmd+ofires on the key marked O even though it types щ. - A layout that can type ASCII matches what it types: on Dvorak,
cmd+ofollows the O you type. - A chord with ⌘ matches what the layout types while ⌘ is held, as the menus do, so on Dvorak - QWERTY ⌘,
cmd+dfires on the QWERTY D key.
Global hotkey
global-hotkey binds one chord system-wide: it summons the quick terminal while any app is in front. Every other binding works only while agterm has the keyboard.
- It needs a modifier unless it is a function key, and takes no alternatives and no leader sequence. A second
global-hotkeyline replaces the first. - macOS registers it by physical key position, so it keeps working on a non-Latin layout.
- It wins over agterm's own bindings, even while agterm is in front: give it a chord a menu item uses and that menu shortcut stops working.
- None is set by default, because a system-wide chord is taken from every other app on the Mac.
global-hotkey ctrl+`gives ⌃one meaning everywhere: it summons the panel from any app, and no app gets that chord any more.global-hotkey f5` likewise takes F5 from every app, agterm's own bindings included.
Built-in actions
new_window rename_window delete_window
new_workspace rename_workspace delete_workspace
new_session new_root_session open_directory rename_session duplicate_session
new_companion duplicate_companion convert_companion
close_session reopen_recent undo_close clear_status
increase_font_size decrease_font_size reset_font_size
toggle_split toggle_horizontal_split toggle_scratch toggle_search
toggle_sidebar toggle_flag toggle_flagged_view toggle_overlay
focus_left_pane focus_right_pane focus_workspace toggle_workspace_filter
toggle_workspace_collapse
previous_session next_session first_session last_session
previous_workspace next_workspace
previous_window next_window
previous_attention_session next_attention_session
quick_terminal session_palette command_palette
custom_command_palette show_attention
select_theme toggle_fullscreen toggle_terminal_zoom
dashboard attach_remote new_remote_session
open_remote_window detached_sessions
edit_flagged_sessions edit_focused_workspaces
toggle_fullscreen (⌃⌘F by default) has no menu item of its own: macOS adds its own Enter Full Screen item to the View menu and shows Globe+F there. Both work, and rebinding toggle_fullscreen changes agterm's chord as usual; it just does not appear next to that menu item.
Custom commands
Tokens expand when the command fires, and are also exported to it as $AGT_* environment variables:
| Token | Value |
|---|---|
{AGT_SESSION_ID}, {AGT_SESSION_NAME}, {AGT_SESSION_PWD}, {AGT_SESSION_HOST} |
the active session |
{AGT_WORKSPACE_ID}, {AGT_WORKSPACE_NAME} |
its workspace |
{AGT_WINDOW_ID}, {AGT_WINDOW_NAME} |
its window |
{AGT_PANE} |
the pane's current role: left, right or scratch |
{AGT_PANE_ID} |
the pane's stable id, the shell's AGTERM_PANE_ID, so --pane-id keeps addressing that terminal after a swap |
{AGT_SELECTION} |
the selected text |
{AGT_SOCKET} |
the control socket |
- A token is pasted raw into the shell line. For text you do not control (
{AGT_SELECTION}, and also{AGT_SESSION_NAME}and{AGT_SESSION_PWD}, which a remote host can set), use the quoted variable instead:"$AGT_SELECTION". - A chord pressed inside an overlay carries the pane underneath it. The pane tokens are empty for a command fired with no session.
How a command runs.
- It runs detached as
/bin/sh -cwith no terminal, which suits launching apps and scripts, not interactive programs. Run a TUI like lazygit in an overlay (agtermctl session overlay open) or the scratch, which have a real terminal. - A non-zero exit or a failure to start posts a banner when notifications are on.
- It finds programs on the app's PATH: the macOS default plus the bundled
agtermctl,/usr/local/binand/opt/homebrew/bin. Anything else your shell profile adds is missing and fails with exit 127: use an absolute path, or wrap the line inzsh -lc '…'(zsh -ilc '…'when that PATH comes from~/.zshrc). A program run in an overlay or the scratch gets the app's plain PATH and always needs one of those.
Failure panels. A command can show its failures in a panel over the session. Only commands that opt in have their standard error captured.
command "Build" ctrl+a>b --error-hud ./build.sh
| Flag | Effect |
|---|---|
--error-hud |
show a failure panel, centered over the whole session; a running program overlay keeps its place |
--error-position POS |
panel position: top-left, top-center, top-right, center-left, center, center-right, bottom-left, bottom-center, bottom-right; top and bottom mean the middle column |
--error-pane left\|right |
show it over that pane; a hidden or closed pane gets the whole session |
- Flags go after the chord in any order, or after the quoted name for a command with no chord.
--error-positionand--error-paneneed--error-hud. - A missing or invalid value, a repeated flag, an unknown
--error-*option or an empty command body skips the line with a diagnostic. - The first ordinary word starts the command, so in
--error-hud ./script --error-pane rightthe last two words go to the script. Use--to end the flags before a command whose first word looks like a flag. A chord is never read after the flags.
Your own viewer for clicked files
An open line runs your own program instead of agterm's page when you ⌘-click a file whose name it lists:
open *.md,*.markdown --error-hud glow-page.sh "$AGT_PATH"
open Makefile,*.mk code "$AGT_PATH"
- Selectors are comma-separated.
*.exttakes that extension in any case; any other word takes that exact file name. A file name wins over an extension, and when two lines name the same selector the later one wins and the earlier is reported as a diagnostic. - The command runs like a custom command, detached under
/bin/sh -con the app's PATH, and starts in your home folder. The clicked file is in$AGT_PATH, and the other$AGT_*variables describe the pane you clicked in.{AGT_…}tokens are refused on this line, since the path comes from terminal output: pass it quoted, as"$AGT_PATH". - The failure-panel flags work as on a
commandline. A chord and--repeatare refused. - A rule runs on an ordinary link click on a path agterm found in the output (⌘-click, or ⌘⇧-click in a program that captures the mouse), and only for a regular file that opens as a picture, markdown, text or HTML page. A link a program printed as an OSC 8 hyperlink keeps the built-in page, because its target need not be what the screen shows. Sending a link to the browser or revealing it in Finder keeps its meaning, and a file no rule names opens as before.
- Treat the file as untrusted input: any program running in the terminal can print a path. A renderer that shows its result with
agtermctl session overlay open --htmlgives that page the control API throughdata-agtermtags, even with its scripts off, so never put the file's own HTML into it unescaped. Show the file itself with--markdownor--text, which run nothing. - Each run is reported as an
opener.runevent with the file, the rule's selectors and, for a copied file, the host it came from.
Files on another host. In a session attached from another Mac or served by agterm-server, the clicked file is on that host. agterm copies it to agterm/open in your cache folder, readable only by you, and runs the rule on the copy; copies older than an hour are removed at launch and on the next copy. Only that one file is copied: files next to it are not, and a log is copied once, not followed. A file larger than its page's limit is not copied and follows the built-in page rules. When a panel is up over the session and the path can still be clicked, the rule runs on a copy and the panel stays; such a click never opens a page. A host whose agterm predates rules opens its page as it always did. A failed copy is reported like any refused remote click.
Check what is bound
agtermctl keymap list prints every built-in with the chords it resolved to (the menu shortcut first, then the alternatives, joined with |), the custom commands, each diagnostic in full, and the shortcuts the menu bar actually carries. If a binding does not fire, compare the last two: an action whose chord no menu item holds is usually a menu problem, not a keymap one. Only menu shortcuts appear in that last list: alternatives never do, nor do undo_close (⌘Z) and toggle_fullscreen (⌃⌘F), which agterm handles itself.
increase_font_size's default is listed as cmd++, which the file cannot parse: write that chord as cmd+shift+= in keymap.conf.
Limits
- A built-in's menu shortcut is a single chord. A leader sequence binds as an alternative and never shows next to the menu item.
- A built-in cannot be bound to a bare arrow key with no modifier: it would take the key from the terminal, the palettes, the dashboard and every text field. Any modifier makes it bindable.
+and>cannot be a bare key, since they are separators; bind those keys asshift+=andshift+..- The Ctrl-Tab switcher and Ctrl-1/Ctrl-2 pane focus cannot be rebound yet.
- Shortcut hints differ by verb. A built-in shows macOS glyphs (⌘⇧E), alternatives separated by spaces and a sequence's chords joined by
>(⌘T ⌃A>T), in the palette and in tooltips. A command shows the spelling you typed (cmd+shift+e), alternatives joined by|.
Event hooks
A hook is a shell line agterm runs when an event fires: an agent status change, a notification, a session created or closed, a split or scratch shown or hidden, the sidebar tree changing. Nothing has to stay running to react.
Hooks live in ~/.config/agterm/hooks.conf, beside keymap.conf. A commented starter is written on first launch. File ▸ Edit Hooks… opens it, and File ▸ Reload Hooks or agtermctl hooks reload applies it. Each line is on <kind> <shell line>; blank lines and # comments are ignored.
on status ~/.config/agterm/hooks/status.sh
on session.closed echo "$(date +%T) closed $AGT_SESSION_ID" >> ~/.local/state/agterm/sessions.log
on pane.scratch ~/.config/agterm/hooks/scratch-layout.sh
on tree.changed ~/.config/agterm/hooks/sync-outline.sh
on app.launched ~/.config/agterm/hooks/reopen-pages.sh
The redirection in the second line does not create its folder: run mkdir -p ~/.local/state/agterm first. A status script that cares about one status must exit 0 for the others, or every idle event counts as a failure:
#!/bin/sh
[ "$AGT_EVENT_STATUS" = blocked ] || exit 0
afplay /System/Library/Sounds/Glass.aiff &
agtermctl notify "needs input" --target "$AGT_SESSION_ID" --socket "$AGT_SOCKET"
Kinds
The kinds are the ones agtermctl events prints.
| Kind | Fires when |
|---|---|
status |
a session's agent status is set; also carries previous, the status before, so a script sees the change without keeping state |
notify |
a notification is raised |
session.created, session.closed |
a session is created or closed |
session.selected |
a session is selected |
pane.split, pane.scratch |
the split or scratch is shown or hidden; carries shown or hidden and fires only on a real change, including a split closing or the scratch shell exiting |
pane.focused |
a session's selection settles on a split pane; names the pane and its paneID |
remote.opened, remote.closed |
a row attached from another Mac with zmx attach appears in or leaves the tree; carries its ssh destination as host and the origin's session id as remoteSessionID. It describes the row, not the connection, so undo fires remote.opened again |
opener.run |
an open rule ran on a clicked file; carries path, the rule's selector list and the clicked pane, plus host for a file copied from another host |
tree.changed |
the sidebar tree changes, including an overlay, page or HUD opening or closing. Changes within 100 ms in one window fire once, so it says the tree moved, not what happened |
app.launched |
once per app run, after this file is loaded and the control socket is up, with the restored sessions already in the tree: the place to recreate what a relaunch does not restore, such as pages in overlays. A hook added by a later reload does not get it |
What a script gets
- The event as one JSON object on standard input, followed by a newline and end of file: the shape
agtermctl events --jsonprints. AGT_EVENT_KIND,AGT_EVENT_STATUS,AGT_EVENT_HOST,AGT_SESSION_ID,AGT_WORKSPACE_ID,AGT_WINDOW_IDandAGT_SOCKET, each set and empty when the event has no such field.- The line runs detached through
/bin/sh -cin the app's working directory, with the same PATH a custom command gets, so a bareagtermctlworks. Pass--socket "$AGT_SOCKET"so it reaches the agterm that fired the hook.
How hooks run
- Several lines per kind. Each line is its own hook; they start together in no particular order. The same kind and command twice is skipped with a diagnostic.
- One process per line at a time. While a hook's script runs, further events for that line queue in order, up to 256; past that the oldest is dropped and
agtermctl hooks listshows the count. Nothing waits on a script: a slow or stuck one holds only its own queue, and there is no timeout. - Failures. A non-zero exit, a script that could not start, or an event that could not be handed to it posts one banner per hook until that hook next succeeds or the file is reloaded. A script that never reads standard input is fine; only its exit status counts.
hooks listkeeps the last failure. - Reload. A hook whose line is unchanged keeps its running script, queue and counters across a reload, even if comments or the line order changed. A removed line takes no more events and finishes its running script, which
hooks listshows as retired until it exits. - Loops. A hook whose command fires the kind it listens to runs itself again; the queue limits how many processes run but does not stop the loop.
session hud openundertree.changedis one, since opening a panel fires the kind again: open a HUD only when the tree shows none, and usesession hud updateotherwise.
Page bridge
A page shown with session overlay open --html can run any agterm command: read the tree, switch sessions, rename one, set a status, or hand a value back to the script that opened it.
- These are pages you or your agents write, trusted like a program in an overlay, which can already run every command. A
--urlpage gets none of this. - A page that inserts outside text, such as an issue body, must escape it.
Tags
Tag a button or a form with data-agterm and the command name. This works with the page's JavaScript off, because agterm's own script handles the tags.
| Attribute | Meaning |
|---|---|
data-agterm |
the command, as the socket names it (session.select) |
data-agterm-target |
its target |
data-agterm-args |
a JSON object of fixed arguments |
data-agterm-into |
an element that shows the reply as text, or the error |
- A form's named inputs add arguments by their name: a number input sends a number, a checkbox
trueorfalse, anything else a string. A name that would send two values is refused. - A button outside a form must be
type="button".
<!-- switch sessions, rename this one, and the page's own controls -->
<button type="button" data-agterm="session.select" data-agterm-target="3F2A">api</button>
<form data-agterm="session.rename"><input name="name"><button>Rename</button></form>
<button type="button" data-agterm="session.overlay.reload">Refresh</button>
<button type="button" data-agterm="session.overlay.close">Done</button>
<button type="button" data-agterm="window.list" data-agterm-into="#out">Windows</button><pre id="out"></pre>
What a command acts on when the page leaves it out:
- A session command with no target acts on the page's own session; a window command on the page's window.
session.overlay.close,reload,resize,navigateandsubmitact on the page itself;reloadre-reads the shown page.hide,showandtoggleact on the page's pane, or on every overlay of its session for a page that covers the whole session.- An explicit target,
activeor window is used as given. Global commands stay global, andwindow.go,sidebarandsidebar modeact from the frontmost window, as over the socket.
JavaScript
Without JavaScript, the buttons above are what the file says when it was written. A live list, built from tree and redrawn on Refresh, needs --js, which also gives the page agterm.request(cmd, {target, args}). It returns a promise with the reply, or rejects with the error.
<!-- switcher.html, opened with --js -->
<div id="list"></div>
<script type="module">
const list = document.getElementById('list');
const {tree} = await agterm.request('tree');
for (const ws of tree.workspaces) for (const s of ws.sessions) {
const row = list.appendChild(document.createElement('button'));
row.textContent = `${ws.name} / ${s.name}`;
row.onclick = () => agterm.request('session.select', {target: s.id});
}
</script>
Answer the script that opened it
Like agtermctl pick, a page can return a value. Open it with --block: the command waits, prints the outcome as JSON, and exits 0 with the submitted value, or 2 when the page closes unanswered.
choice=$(agtermctl session overlay open --html branches.html --block) || exit
<!-- branches.html -->
<button type="button" data-agterm="session.overlay.submit" data-agterm-args='{"value":"main"}'>main</button>
<form data-agterm="session.overlay.submit"><input name="value" placeholder="other"></form>
Refused from a page: commands that stream or finish after their reply (zmx.present, zmx.reset, catalog.subscribe, session.overlay.job.run, session.overlay.page.serve and session.companion.page.attach), and any request from a frame inside the page. See the command reference for submit and result --page.
agtermctl
agtermctl drives agterm from scripts over a local socket: create and arrange workspaces and sessions, type into them, run actions, open overlays and dialogs, and poll an event feed for status and lifecycle changes. It does not stream terminal output. Every command, with arguments, results and errors, is in the Command reference.
Addressing
--targetand--workspacetake a session or workspace UUID, a unique prefix of it (git-style), oractive. Never a name.--targetdefaults toactive, so the current session rarely needs naming.- For a session,
activeis the selected one. For a workspace, it is the one a new session lands in: a workspace you just created in the foreground, else the one the focus filter shows alone in the sidebar tree when it hides the selected session or nothing is selected, else the selected session's (the top-level sessions for one of them), else the last named workspace, else the top-level sessions.rootnames the top-level sessions; see the workspace commands for which take it. - A new workspace stays the target until the selection changes (to another session or to none), or until you delete it or hide it with the workspace filter.
workspace selectmoves the target to the one you name, an empty one included. Sosession newright afterworkspace newlands in the new workspace. --windowaddresses another window's tree; see Windows.
Output and exit codes
- A mutating command normally prints the id it changed; a few print a count or a diagnostic instead.
- Batch
session closeandsession movetake repeated--targetand print how many sessions actually changed. session close --undoableappends(undoable)or(not undoable)afterokor the count.--jsonprints the raw response;--socket PATHoverrides the socket.- Exit code 0 on success, non-zero on error.
Inside a session
A shell inside agterm gets these variables, so a script can drive its own window without hard-coded ids:
| Variable | Value |
|---|---|
AGTERM_ENABLED |
set in every agterm shell |
AGTERM_WINDOW_ID |
the window |
AGTERM_WORKSPACE_ID |
the workspace the shell started in; not updated when the session moves (tree shows the current one) |
AGTERM_SESSION_ID |
the session |
AGTERM_SOCKET |
the live socket path |
AGTERM_PANE |
the pane's role at spawn: left, right or scratch; not updated after a promotion or swap, unset in an overlay |
AGTERM_PANE_ID |
a stable per-pane token; --pane-id on session status, restore, text, type, restart and surface cursor resolves the pane's current slot from it |
TERM_PROGRAM, TERM_PROGRAM_VERSION |
agterm and its version |
A tool that picks capabilities from a list of terminal names may need its own override. Claude Code prints links as plain text until FORCE_HYPERLINK=1 is set; see troubleshooting. File links that Claude Code emits as OSC 8 skip open rules.
Sessions and workspaces
See and create
agtermctl tree # the workspace/session tree with ids
ws=$(agtermctl workspace new work) # create a workspace, keep its id
agtermctl session new --workspace "$ws" --cwd ~/src/agterm
agtermctl session new --name myhost --workspace-name servers --create-workspace
agtermctl session new --after active # right after the current session (--before to precede)
agtermctl session new --cwd ~/src/agterm --no-select # in the background, without switching to it
agtermctl session duplicate --target 9f3c # a fresh shell in that session's workspace and cwd, after it
Run a command as the session's process
agtermctl session new --command "ssh user@host"
agtermctl session new --command "zsh -lc 'make test'" --wait # after exit, a key press closes it; needs --command
Wrap a ; or && list in sh -c.
Companions
agtermctl session new --parent active --command 'tail -f build.log' --name logs # under the current session
session collapse folds it under its parent.
Step, reorder, relocate
agtermctl session go --to next # next | prev | first | last
agtermctl session move --to up # up | down | top | bottom
agtermctl session move "$ws" # into another workspace
agtermctl session move --after 9f3c # after an anchor, in the anchor's workspace
agtermctl session move "$ws" --target 9f3c --target abcd # a batch, as one ordered block
Close
agtermctl session close --target 9f3c --target abcd # one undo for the whole batch
agtermctl session close --target 9f3c --undoable # with ⌘W's undo time
Workspaces
agtermctl workspace go --to next # select the next workspace's first session
agtermctl workspace move --to top
agtermctl workspace new work --collapsed # created closed; fill it with session new --no-select
agtermctl workspace collapse --target 9f3c # workspace expand reopens it
Focus a set of workspaces
agtermctl workspace focus on # mark this one alone and filter to it (on | off | toggle | add)
agtermctl workspace focus add --target a1b2 # mark another without narrowing yet
agtermctl workspace filter on # apply the marked set; filter off keeps the set
Reveal in Finder
agtermctl session reveal --target 9f3c # the focused pane's directory
Typing and reading text
agtermctl session type --target 9f3c $'make test\n' # every newline is a real Return
echo 'make test' | agtermctl session type --stdin
agtermctl session type --pane right $'ls\n' # left (default) | right | scratch, even hidden
agtermctl session type --target "$id" $'echo hi\n' # a background session, focus unchanged
sel=$(agtermctl session copy --target 9f3c) # the selection; the clipboard is untouched
agtermctl session text --pane scratch --target 9f3c # the pane's text
agtermctl session paste --target 9f3c # paste the clipboard, like ⌘V
printf 'a\nb\n' | agtermctl session paste --stdin # paste text, unsubmitted where the program allows
agtermctl session select-all --target 9f3c # like ⌘A; session copy then reads it
Splits, scratch, quick terminal and search
agtermctl session split toggle --axis horizontal # vertical = left/right, horizontal = top/bottom
agtermctl session split close
agtermctl session resize --split-ratio 0.7 # the primary pane's share
agtermctl session resize --grow-left 0.05 # or --grow-right|top|bottom|primary|split
agtermctl session scratch toggle # on | off | toggle
agtermctl session flag on # on | off | toggle | clear
agtermctl session seen --target 9f3c # clear the unseen badge without focusing
agtermctl sidebar mode flagged # tree | flagged | toggle
agtermctl quick toggle # show | hide | toggle
agtermctl quick type 'ls -la' # or --stdin; quick text reads it back
agtermctl surface zoom # fill the window with the active pane
agtermctl surface zoom --target "surface:${id}:right" # a specific pane (show | hide | toggle)
agtermctl dashboard "$a" "$b" "$c" --auto-size # view-only grid
agtermctl font inc # main pane font size
agtermctl font dec --pane right # one pane: left | right | scratch
agtermctl session search "error" # open the search bar, print "N of M"
agtermctl session search --next # --prev | --close
The dashboard shows a split session as two cells, up to nine panes. It takes --mru, --font-size N or --auto-size, and --close.
Windows
agtermctl window list # id name [open] [active]
w=$(agtermctl window new work)
agtermctl window new proj-b --minimized # created in the Dock
agtermctl window select "$w" # raise it, opening it if closed
agtermctl window go --to next # next | prev, wrapping
agtermctl window rename "$w" personal
agtermctl window minimize "$w" on # off restores
agtermctl window close "$w" # closes the window, keeps its sessions
agtermctl window delete "$w" # the last window cannot be deleted
# --window works on session, workspace, tree and font commands
agtermctl tree --window "$w"
agtermctl session new --window "$w" --cwd ~/src/agterm
Keymap, config and notifications
agtermctl keymap reload # re-read keymap.conf; prints the diagnostic count
agtermctl config reload # re-read the ghostty config; prints the diagnostic count
agtermctl notify --title Build --body "tests passed"
Picker
agtermctl pick opens agterm's fuzzy picker over a list your script supplies and prints the choice as JSON.
printf '%s\n' staging production | agtermctl pick --prompt "Deploy where?"
agtermctl pick --allow-custom --query "$name" --prompt "Rename to" < /dev/null
id=$(printf '%s\n' alpha beta | agtermctl pick --no-block | jq -r '.id')
agtermctl pick result "$id"
agtermctl pick cancel "$id"
agtermctl tree --json | jq -r '.result.tree.pickPending // empty'
Input. Nonblank lines on stdin, or a JSON array of {id, label, subtitle?} objects, each optionally with status, statusColor and statusShape for a status glyph at the end of the row.
| Option | Effect |
|---|---|
| (none) | blocks and prints the picked, custom or cancelled result as bare JSON |
--no-block |
prints the picker id at once; read it later with pick result, end it with pick cancel |
--query TEXT |
prefills the field and filters at once, ranked by match score |
--select ID |
opens with that item highlighted and scrolled into view; a --query that filters it out leaves the first visible row highlighted |
--allow-custom |
allows an empty item list, turning the picker into a text prompt; the custom row appears once the query is not blank |
- Typing matches labels only. A subtitle is shown but never searched, so warning text on one row cannot filter out its safer neighbor.
- With an empty query the items keep your order, so without
--selectReturn on open runs your first item. - A call with no items still reads stdin: redirect it (
< /dev/null) or it blocks. - While the picker waits,
treereports its id as the top-levelpickPending.
Question dialogs
agtermctl ask puts a question over a session and prints the answer as JSON.
agtermctl ask "Continue?" --button yes=Yes --button no=No --default no
agtermctl ask "Commit message" --input multiline --placeholder "subject, blank line, body"
# {"result":"answered","id":"ok","label":"OK","index":0,"text":"fix: ..."}
agtermctl ask "Open which?" --multiple --choice 398="issue #398" \
--choice-subtitle 398="waits on you: review" --choice 395="PR #395"
# {"result":"answered","id":"ok","label":"OK","index":0,"selected":["398"]}
Check the answer's id before acting: Yes and No both exit 0.
| Result | Exit code |
|---|---|
| answered (any button) | 0 |
| cancelled | 2 |
| escaped (Esc or ⌘W) | 3 |
--style gui.
Where it appears
- The default terminal style uses the session's theme, one pending question per session.
--pane rightcovers only that pane; the other pane and the rest of the window stay usable.- An explicit
--targetcan name an unselected session; the question waits hidden until you select it. --style guiuses native buttons in a window modal shared withpick. Terminal questions can be open beside it.
Keys
- Buttons only: Tab and the arrows move the highlight, Return answers.
- A text field has the keyboard as soon as it opens. Return answers a one-line field, ⌘Return a multiline one.
- A list: Up and Down move, Space toggles.
- Esc and ⌘W dismiss the question as
escaped.
Forms
--multiple with subtitles and --other.
- Buttons default to OK and Cancel; Cancel ends it like Esc, returning nothing.
- Without
--multiplea list is radio buttons and returns exactly one id. --other "Something else"adds a free-form line after the items. Typing selects it, clearing deselects it, and while selected its text comes back astextbesideselected. A radio list returns one id or that text, never both.
Placement, sizing, input priority, result polling and cancellation are in the ask reference.
Overlays
An overlay runs a program over a session without disturbing the shell beneath.
agtermctl session overlay open "revdiff HEAD~3" --target 9f3c # full, hides the shell beneath
agtermctl session overlay open "htop" --size-percent 70 # floating, framed, 70% of the pane
agtermctl session overlay open "revdiff HEAD~3" --size-percent 80 --background-color "#2a1a3a"
agtermctl session overlay open "revdiff HEAD~3" --size-percent 80 --target 9f3c --follow
agtermctl session overlay open "make test" --wait # keep it open after exit
agtermctl session overlay open "make test" --block # wait for exit, return its status
agtermctl session overlay resize --size-percent 60 --target 9f3c # in place; the program keeps running
agtermctl session overlay resize --full --target 9f3c
agtermctl session overlay close --target 9f3c
agtermctl session overlay result # the last overlay's exit status
agtermctl session overlay open "revdiff HEAD~3" --target 9f3c --pane right # cover one split pane
agtermctl session overlay copy --target 9f3c --pane right # the selection made inside it
agtermctl session overlay text --target 9f3c --pane right # its screen
| Option | Effect |
|---|---|
--wait |
keeps a "press any key to close" prompt so you can read the final output |
--block |
reports only the exit status; an overlay never captures stdout, so a TUI writes its own result file |
--follow |
switches you to the target; without it the overlay opens there without changing the active session |
resize --size-percent / --full / --width --height |
floating at a percent, back to full, or one floating axis in points |
--pane left\|right |
covers one split pane (below) |
agtermctl tree tags a session with an open overlay (overlay).
Reading an overlay. session overlay copy returns the selection made inside the overlay, session overlay text its screen as drawn, wrapped where it wrapped. session copy and session text read the pane underneath instead: a selection in the overlay reads there as no selection, and session text --pane right returns the shell under it. A chord already gets the selection of the pane it fired in, overlay included, as $AGT_SELECTION, so a custom command uses that. For a program's real output, read the file it writes.
Pane overlays (--pane left|right) cover one split pane and leave the other visible and usable, so an agent in the split can show a diff over its own pane without blanking the one you read.
- Each pane can hold its own overlay at once, each with its own background color.
- Always full-pane:
--panedoes not combine with--size-percent, andoverlay resizetakes no--pane. - A session without a split accepts
--pane left. - A pane that is not on screen is refused with
pane not visible. Hiding the split afterwards is fine: the program keeps running and returns with the split. - Over a session-wide program or page, a pane overlay draws on top; the session overlay keeps running out of sight and comes back when the pane overlay closes or hides, unless you hid it yourself.
close,result,copyandtexttake the same--pane. ⌘W dismisses the focused pane's overlay before it would close the session; one on the other pane is not in front of you, so ⌘W keeps its usual meaning there.tree --jsonreports the covered panes aspaneOverlays.AGTERM_PANEis the spawn role and is not updated after a promotion or swap, so a long-running shell should not assume--pane "$AGTERM_PANE"still names its slot.
Message panel (HUD)
A HUD shows a message over a session while a script or agent works, so the session says what is happening instead of sitting silent. It is passive: the session keeps the keyboard, the terminal is neither dimmed nor blocked, and nothing waits for an answer.
agtermctl session hud "gathering options…" --spinner --detail "scanning branches" --target "$AGTERM_SESSION_ID"
agtermctl session hud update "ready" --detail "pick a branch" --target "$AGTERM_SESSION_ID" # repaint in place
agtermctl session hud "deploy finished" --hide-after 10 --target "$AGTERM_SESSION_ID"
agtermctl session hud "deploying" --position top-right --size-percent 30
agtermctl session hud "working" --pane "$AGTERM_PANE" --pane-id "$AGTERM_PANE_ID" --target "$AGTERM_SESSION_ID"
agtermctl session hud "deploying" --text-color "#7ec07e" --background-color "#202020"
agtermctl session hud "**deploy api** [PR](https://example.com/pr)" --markdown --sticky \
--no-frame --position top --size-percent 100 # a caption strip across the top
agtermctl session hud close --target "$AGTERM_SESSION_ID"
open is the default subcommand, so session hud "…" posts one.
| Option | Effect |
|---|---|
--position |
one of nine anchors: top-left, top-center, top-right, center-left, center (default), center-right, bottom-left, bottom-center, bottom-right; bare top and bottom mean the middle column. Off center it keeps a margin from that edge |
--sticky |
drops the edge margin and lets the width reach 100% |
--no-frame |
drops the border and the blank rows above and below the text |
--size-percent |
sets the width only: at most 80% of the pane, or 100% with --sticky off center |
--pane, --pane-id |
sizes and anchors within one pane; --pane-id "$AGTERM_PANE_ID" follows the shell through swaps and promotion, with --pane "$AGTERM_PANE" as fallback |
--text-color, --background-color |
the text's color and the panel's backing |
--spinner, --spinner-style |
bar, braille, circle, blocks, dot (blinks) or none; a style turns the spinner on |
--hide-after SECONDS |
takes the panel down by itself; without it the panel stays until closed |
--markdown, --file, --font-size PT |
a small board (below) |
Size. Width comes from the longest line and height from the number of lines, so a title and subtitle give a wide, short panel. A frameless panel is its rows plus 12 points of padding tall, one row more than its text at the default font and padding; a program meant to sit under a caption leaves that room.
Updates. update replaces the whole message, so --detail, --spinner, --text-color, --sticky, --no-frame, --pane and --pane-id must be repeated. It can switch the spinner style in place. --background-color and --font-size are read once when the panel opens and kept across updates, which is why update does not take them.
Markdown boards. --markdown renders headings, bold, lists, code blocks, quotes and tables, up to 4096 characters. A single newline inside a paragraph is a space; use list items, or end a line with two spaces, to keep rows apart. A board taller than the panel is clipped, the hidden rows shown as a dim … N more. A link shows its label underlined and opens on ⌘-click as it would in the terminal, the one click the panel takes; any other click reaches the terminal. --file reads the message from a file once per command, so push each change with update. --font-size PT gives the panel its own font size. A controller agent can keep a board in a corner of its session:
agtermctl session hud --file status.md --markdown --font-size 11 --position top-right
agtermctl session hud update --file status.md --markdown --position top-right
One slot. The HUD shares the overlay slot:
- a second
hudreplaces the first, andsession overlay openreplaces a HUD; - a HUD over a running program is refused, because a message is replaceable and a program is not;
- ⌘W or
session overlay closetakes it down; session overlay resultover a HUD errors, andoverlay resizetakes a percent but refuses--full.
Panes. Opening on a pane that is not shown is refused. Hiding that pane hides the panel without stopping it, showing the pane brings it back, and closing the pane closes it. A restart of agterm drops the panel, so a script posts it again.
tree --json reports the panel as the session's hud object, with a pane HUD's current role in hud.pane and overlay false beside it. There is no event; poll the tree.
Messages between panes
A program in one pane can leave a message for another pane without typing into its terminal, so nothing has to guess when the receiver is ready.
agtermctl msg send "build done" --to "$AGTERM_SESSION_ID:right" # the split pane
agtermctl msg send --all "deploy starting" # every live pane but this one
agtermctl msg read # oldest first; removes nothing
agtermctl msg ack ID # remove what was handled
agtermctl msg read --ack --wait --timeout 60 # wait for mail and take it
- Every live pane has a mailbox; the receiver reads it when it chooses and acknowledges what it handled.
- In Live mode a split or scratch still hidden since a relaunch takes mail while its program runs.
- Run inside a pane,
agtermctl msgacts as that pane throughAGTERM_SESSION_IDandAGTERM_PANE_ID. - Mail lives in the running app only: closing or restarting the pane, closing its session, workspace or window, or quitting agterm drops it.
- A full mailbox refuses that recipient alone.
- On agterm-server the server's panes message each other the same way, and a Mac showing the server window sees their pending counts and message events. A local pane and a server pane cannot message each other yet.
Two agents in one split can hold a conversation this way, each reading the other's messages as they arrive: see the two-agent mailbox chat recipe.
Details: command reference.
Cookbook
The cookbook collects complete workflows, each with a README and its scripts: switching the sidebar to one project, closing a project's workspaces and bringing them back, picking a path with fzf and typing it into the shell, and giving each tab its own Claude Code or Codex conversation across a restart. Copy them into your setup and edit them; cookbook/CONTRIBUTING.md has the rules for adding one.
Recipes come from other people as well as the maintainer. Each is reviewed, but they are shell scripts that run on your machine against your sessions, and several close sessions or delete workspaces, so read one before running it.
Ghostty config
agterm builds its terminal config from four sources. Each one overrides the one before it:
- ghostty's defaults.
~/.config/ghostty/config, your global Ghostty config. Off by default, so a config written for the standalone Ghostty.app never silently changes agterm. Turn on Settings ▸ General ▸ Use my global Ghostty config to fold it in.<config dir>/ghostty.conf(default~/.config/agterm/ghostty.conf). Always loaded, and read only by agterm.- agterm's Settings, which win. They set
font-family,font-size,theme,background-opacity,background-blur,mouse-scroll-multiplierandright-click-action; the last two are set even when their controls are at the defaults.
ghostty.conf
This is the place to customize the terminal. It sits next to keymap.conf and works the same way: a fully commented starter file is written on first launch, so a fresh one changes nothing.
- Any ghostty terminal key goes here; the key reference lists them. A common one:
macos-option-as-alt = true. - File ▸ Edit ghostty.conf… opens it in a 95% editor overlay, as Edit Keymap does.
- File ▸ Reload Config or
agtermctl config reloadapplies edits made elsewhere. A malformed line is skipped and the good ones still apply; the returned diagnostic count covers every config source.
What it cannot change
| Key | In agterm |
|---|---|
shell-integration-features ssh-env, ssh-terminfo |
forced off, the rest of your flags kept. Ghostty does these by wrapping ssh with the ghostty tool, which agterm does not ship, so every connection would fail. To put the terminfo entry on a host once, run agtermctl terminfo install <host>. |
env naming TERM_PROGRAM, TERM_PROGRAM_VERSION or an AGTERM_* variable |
no effect: agterm sets these after reading the file. Other env keys reach every new shell. |
| Ghostty.app's window and split chrome | mostly not read, since agterm draws its own. split-divider-color is read and colors the split divider (otherwise a faint line from the theme). unfocused-split-fill and unfocused-split-opacity are not: Settings ▸ Appearance sets how much the inactive pane dims. |
global: keybinds, toggle_visibility |
parse and never fire; agterm's system-wide chord is global-hotkey in keymap.conf |
Keybinds follow ghostty's rules, which differ from keymap.conf's. A bare letter or digit binds the character the active layout types, so keybind = super+opt+ctrl+g=text:hello stops firing on a non-Latin layout, where that key types п. Prefix the key with key_ to bind the physical key: keybind = super+opt+ctrl+key_g=text:hello works on any layout. agterm's bundled ⌘C, ⌘V and ⌘A use it.
Clipboard
Programs can read and write the macOS clipboard over OSC 52.
- Reads ask first, since a read hands your clipboard to the program. A normal ⌘V paste never asks.
- Writes go through, as in other terminals, so a remote tmux or vim yank reaches your clipboard. Set
clipboard-write = askordenyto gate them. - Each prompt offers Don't ask again this session.
Selecting text with the mouse copies it to a private selection clipboard, which a middle-click pastes; the system clipboard is left alone until ⌘C. Set copy-on-select = clipboard to put every selection on the system clipboard as well, or false to copy nothing on select.
Links
Hold ⌘ over a link to see where it goes, at the bottom-left of the pane: a link whose text says one thing and points elsewhere shows its real target, and a session link shows the session it selects. Ghostty's link-previews setting decides which links get it.
Web links. A ⌘-click opens an http or https link in your browser. With Settings ▸ General ▸ Open links in set to a Session overlay choice, or agtermctl browser links overlay, it opens in a web overlay over its session instead:
- full size or at 95%, 75% or 50% (
overlay,overlay95,overlay75,overlay50;browseris the default); - JavaScript on, navigation buttons, and agterm's saved browser store, so a login made there lasts. Nothing is taken from your browser;
- the page may go on to other sites, and its strip always names the site shown.
With a Session overlay choice selected, outside a program that captures the mouse, ⌘⇧-click sends that one link to the browser; use Shift-click to extend a selection. In a program that captures the mouse, ⌘⇧-click is the ordinary link click and follows the setting.
The link still opens in the browser when it sits in a HUD, when a HUD is up on the session, when the terminal is zoomed, when the session already has an overlay, or in the quick terminal. So does a plain http link to anything but a local address (localhost, a .local name, a private or link-local IP address), which the overlay could not load. One exception: a page an earlier click opened and you then hid with ⇧⌘J is replaced by the new link and shown.
Local files
A ⌘-click on a local path opens it over its session. The path can be plain output, such as /tmp/shot.png or ~/notes.md, or a file:// link of the kind ls --hyperlink, eza and many compilers print.
| Clicked file | Opens as |
|---|---|
.png, .jpg, .gif, .webp |
the picture, sized to it up to 80% of the session |
.md, .markdown |
a rendered page |
| source, config and text files | a read-only page, highlighted when its language is known, in terminal colors when it carries color codes |
.log, .out |
a log page that follows the file |
.diff, .patch |
a diff page that steps through changes |
.jsonl, .ndjson |
a JSON Lines page: one record per line as written, laid out on request |
.html, .htm |
a page with its scripts off, no access to other files, and nothing loaded from the network; a web link goes to the browser only after asking |
| anything else | revealed in Finder |
Markdown, text, log and diff pages wear the terminal's theme and open at the link-open size, 95% when links open in the browser. An open rule in keymap.conf opens a file type with your own program instead.
./main.go:42:7, as compilers and test runners print it, opens the file at that line. A relative path is looked up in the pane's own directory.- A
.,?,!or;ending a sentence after a path is dropped when only the file without it exists. - ⌘⌥-click reveals any local path in Finder instead (⌘⌥⇧ while a program captures the mouse); ⌘⌥-drag still selects a block.
- From a HUD or the quick terminal, or while the session's overlay is busy, the file is revealed instead. A hidden page an earlier click opened is replaced, as with a web link.
- Revealing selects the file without running it, so a link in untrusted output pointing at a
.appor.commandcannot launch it; opening stays a separate, explicit action. Afile://link naming another host is ignored, so a stray link cannot trigger a Finder network mount. Web andmailtolinks open as before.
Esc or ⌘. closes a picture, markdown, text, log or diff page, one step per press: it first closes the diff file list, clears the search or leaves the find box, and only then closes the page. A clicked .html page, pages opened with --html or --url, and page companions keep Esc for themselves.
Text pages run nothing, load nothing and link nowhere: a URL in a log stays text. Long lines run off the right edge until you wrap them; a wrapped line keeps its number on its first row, and the page keeps the choice until it closes. ⌘F always searches what is on top, so over a page or overlay it never reaches the terminal behind.
| Key | On a text page |
|---|---|
⌘F or / |
focus the find box |
Return, Shift-Return or n, N |
next, previous match (a step pauses a following log) |
| Esc or ⌘. | clear the search or leave the find box; otherwise close the page |
w or the Wrap button |
wrap long lines |
e or the Expand button |
JSON Lines: lay records out, or back as written |
F |
log: follow on or off |
G or End, g or Home |
log: bottom and follow, top |
], [ or the bar's arrows |
diff: next, previous change |
f or the file button |
diff: the patch's file list |
JSON Lines pages show the file as written, one record per line, colored as JSON. Expand lays every record out over indented rows, numbered by its line in the file, and keeps the record you were reading under the bar; the page keeps the choice until it closes. A line that is not a JSON object or array, or does not parse, stays as written, and so does a record that does not fit the page's 4 MB layout budget. A file over 4 MB does not open: the click reveals it in Finder. A .jsonl opened as a log (--tail, --follow-file) stays as written and has no Expand.
Log pages show the last 5,000 lines, read from the end so a log of any size opens, and follow the file as it grows. The bar shows whether it follows. Scroll up to pause; scroll back to the bottom or press Resume to follow again. A rotated or truncated log is picked up, and a missing one shows waiting until it returns. app.log:120 opens the plain page at that line instead.
.patch: the bar steps between changes and between files.
Diff pages color each file's code in its language over green and red bands for added and removed lines. A change is a run of removed and added lines; the page counts them, marks the one a step reached, and after a scroll steps on from what is shown. The file button names the file in view; its list narrows as you type, arrows and Return pick, and Escape closes it. A pick shows that file's header and marks its first change.
.md file, rendered in the terminal's theme.
Markdown pages show a leading YAML frontmatter block as code, pictures kept in the file's own folder, and the alt text of any other picture. They run none of the file's script and hand a web link to the browser only after asking. A relative link to another .md or .markdown file in the same folder or below opens in the same page, with Back and Forward. A file directly in / or your home folder keeps its links as text and shows no Back or Forward.
Remote sessions. In a session attached from another Mac or in a remote window, a path names a file on that Mac or Linux host, so the click goes there; a scratch running there works the same way. The picture, markdown, text, log or HTML page opens and shows here, a relative path looked up in that pane's directory there. A web link to localhost, 127.0.0.1 or ::1 names that host, so it opens through an ssh forward from this Mac once the forward answers. A click that cannot open, a ⌘⌥-click, and a click while that Mac runs an older agterm show a short panel saying why, or beep when no panel can be shown.
Session links
A ⌘-click on an agterm://session/<id> link in a pane, split or scratch selects that session and raises its window, with no confirmation. Print one from a shell:
printf '\e]8;;agterm://session/%s\e\\%s\e]8;;\e\\\n' "$AGTERM_SESSION_ID" "back to this session"
In Claude Code markdown, [label](agterm://session/<id>) does the same, since Claude Code prints it as a link (OSC 8); while Claude Code captures the mouse, use ⌘⇧-click. The bare agterm://session/<id> in plain text is a link too, so an agent that prints such a markdown link as plain text, such as Codex, still gives you one to ⌘-click. In a session attached from another Mac the id is that Mac's, and the click selects the one row here showing it; it never attaches anything or acts there.
Nothing happens for an unknown or closed session; when the destination window is zoomed, has the dashboard open or a picker pending; for any other agterm:// form; on a ⌘⌥-click; or for a link in a HUD, the quick terminal or a program overlay.
From other apps. agterm registers agterm:// with macOS, so the same link opened anywhere else selects that session and brings its window to the front: a notification app, a browser (which asks first), a note, or open "agterm://session/$AGTERM_SESSION_ID" in a script. When agterm is not running, it starts with your windows as you left them and then selects the session. The id must name exactly one open row in this agterm and is taken as it is, never translated from another Mac's id. A link that names no such row, or whose window is zoomed, has the dashboard open or a picker pending, leaves the selection unchanged.
Links in programs that use the mouse
While a program has mouse reporting on, such as tmux with mouse on or stock vim, ⌘-hover underlines nothing and ⌘-click opens nothing: links are detected only while reporting is off. Ghostty.app does the same, per program.
- Hold Shift as well (⌘⇧-hover, ⌘⇧-click) to reach the link anyway, unless the program claimed Shift for itself. That click follows Open links in.
- In
ghostty.conf,mouse-shift-capture = nevermakes Shift always win, andmouse-reporting = falseturns reporting off for every program.
Agent status
A coding agent running in a session can put its status on that session's sidebar row, so you can tell at a glance which of many agents needs you. The glyph sits just left of the notification badge on every session that is not idle.
| State | Glyph |
|---|---|
active |
lavender-grey |
blocked |
amber |
completed |
green; a one-time completed flash clears once you visit the session |
idle |
nothing |
Colors and shapes
Every state draws a filled circle by default, so the color tells them apart. Settings ▸ Agent Status ▸ Colors and Shapes gives each state its own color and shape. A distinct shape per state adds a second signal, so the states stay apart at a glance from the corner of your eye and without depending on color.
Set it from a script
# the state is idle, active, completed or blocked
agtermctl session status active --target "$AGTERM_SESSION_ID"
agtermctl session status blocked --sound default --target "$AGTERM_SESSION_ID"
agtermctl session status completed --auto-reset --target "$AGTERM_SESSION_ID"
agtermctl session status blocked --color '#ff0000' --target "$AGTERM_SESSION_ID"
agtermctl session status blocked --shape triangle --target "$AGTERM_SESSION_ID"
agtermctl session status blocked --pane right --target "$AGTERM_SESSION_ID"
agtermctl session status idle --target "$AGTERM_SESSION_ID" # clear it
| Option | Effect |
|---|---|
--auto-reset |
clears the status the moment you visit the session |
--blink |
adds an attention pulse. macOS Reduce Motion stops the repeating sidebar and dashboard animation and keeps the status; the pulse returns when Reduce Motion is off |
--sound NAME |
plays a sound once: default, or a system sound such as Basso, Ping or Tink. To sound on every blocked prompt without touching the hooks, set Settings ▸ Agent Status ▸ Blocked sound |
--color #rrggbb |
overrides the color for this call only; the next status set without it goes back to the configured color |
--shape NAME |
overrides the shape the same way: circle, square, triangle, triangle-down, play, diamond, capsule, seal, star, bolt, bell or checkmark |
--pane left\|right\|scratch |
records which pane set the status, the main pane by default (below) |
agtermctl tree --json reports on each session:
statusandstatusPane, the pane that set it;statusColorandstatusShape, only while a per-call override is in effect;activePanes, the panes still reportingactive(left,right,scratch), an empty list when none, whatever the row shows. A script waiting for one pane's agent reads this rather thanstatus, which can show the other pane's work;statusChangedAt, epoch seconds of the last applied write. Every write counts,idleand a repeat of the same status included, except one another pane's status keeps off the row, and so do automatic and manual clears, so a script pollingtreecan tell how long ago the status was last written. It is absent before the first set and is not kept across a restart.
Which pane set it
- A block set from a background pane survives typing in another pane.
- When the status needs you (blocked or completed), selecting the session reveals and focuses the pane that set it (the split, or a hidden scratch) instead of the main pane. That covers every way of selecting it: auto-follow, attention navigation ⌃⌥↑/↓, plain session navigation, the command palettes, a Dock-menu session and a sidebar click. An active status keeps the current pane.
agtermctl session go --to next-attentiononly steps the selection and does not move focus into the pane. - While a session is blocked, a status written from a different pane does not replace the block unless it is another
blocked. With an agent in each pane, one reporting its progress cannot erase the other's request for input. That holds foridletoo, which the bundled agent hooks send on their own when an agent starts or finishes. The write is still accepted: it plays its sound, and the row shows that pane's work once the block ends. - While one pane's agent is still working, the other pane finishing leaves the row active. When Codex in the split finishes a turn while Claude Code waits on a background command in the main pane, the row stays active until Claude Code finishes too.
- The pane that set the block changes it freely, typing into that pane clears it, and Clear Status in the sidebar row menu clears it from anywhere.
Clearing it
- Typing into a blocked or completed session clears its status, on the first key by default. Settings ▸ Agent Status ▸ Status reset can move that to On Enter, so a reply you started and walked away from keeps the glyph until you send it; Esc or Ctrl-C still clears a blocked one, since cancelling the prompt answers it. Disabled leaves the status to the agent's next hook or Clear Status.
- Esc or Ctrl-C interrupts an active session and clears its status, whatever the setting. In a split it ends that pane's work only, so the row shows what the other pane still runs.
- To come back to a session later, Mark for Attention in its row menu gives an idle session a completed status that stays when you visit it, so attention navigation stops on it again. It never replaces a live status; typing in the session's main pane, Clear Status or the agent's next update clears it as usual.
Finding the sessions that need you
Attention navigation (⌃⌥↑/↓) steps through blocked and completed sessions. Two settings under Settings ▸ Agent Status, both off by default, widen it:
- Attention navigation includes active sessions stops on active sessions too, in the same sidebar order. Landing on one keeps the current pane.
- Attention navigation crosses windows walks every open window, window by window in sidebar order, raising the window it lands in.
When the sidebar is hidden the glyphs go with it. The title-bar bell (Settings ▸ Notifications ▸ Show attention indicator, off by default) covers every open window: dimmed when nothing needs you, plain when a session is active or completed, filled amber when any is blocked.
- Clicking it lists the sessions that are not idle across all open windows: blocked, then active, then completed, newest first within each. Hover to highlight, click to jump.
- With more than one window open each row names its window, and picking a session in another window brings that window forward first.
- A blocked or completed row reveals the pane that set its status; an active row keeps the current pane.
The same list opens as a searchable palette with ⌃⇧I, Navigate ▸ Go to Attention…, or Show Attention in the action palette. Right-clicking agterm's Dock icon shows the last-active window's list under Sessions Needing Attention, beside its recent sessions.
Auto-follow blocked sessions
With several agents running, a session that blocks is easy to miss. Settings ▸ Agent Status ▸ Auto-follow blocked sessions (Disabled by default, or 5 sec, 10 sec, 30 sec, 60 sec or 5 min idle) selects and focuses the oldest waiting blocked session once you have not typed or clicked for that long.
- It works per window, across that window's workspaces.
- It takes you to each block once. After you have been shown a block and moved on, even without replying, it does not pull you back; it walks the waiting blocks oldest first, then stays quiet. A session counts again only after it leaves blocked and enters it again.
- While you stay on a blocked session, it does not jump.
- Turn off Auto-follow away from a running session (on by default) to keep the selection where it is while the current session is active.
agtermctl tree --json reports the window's idleMs (milliseconds since your last input, live) and autoFollowMs (the timeout in milliseconds, omitted when Disabled). agtermctl window list --json reports autoFollowMs per window as of the last refresh, but not the live idleMs.
Session context
Status says how a session is going; context says what it is about: a short line shown in the title bar, such as the PR, the issue or the task in hand. It states lasting purpose rather than current activity, so it survives quit and relaunch, and only --clear removes it.
agtermctl session context "PR #517: restore reap ordering" --target "$AGTERM_SESSION_ID"
agtermctl session context --clear --target "$AGTERM_SESSION_ID"
- In the Normal toolbar it takes the title bar's second line, in place of the working directory.
- In Compact it follows the session and window names on the one row, and a long value is cut before the names are.
- Settings ▸ Interface hides it without clearing it.
treereports it as the session'scontext.
Session info
For current activity there is session info: one line under the session's sidebar row, such as the step an agent is on or how many tests have run.
agtermctl session info --markdown --hide-after 30 --target "$AGTERM_SESSION_ID" \
'**3** agents ^[running](color: "green") ^[1 idle](dim: true)'
agtermctl session info --clear --target "$AGTERM_SESSION_ID"
--markdownallows bold, italic and code.^[text](color: "green")colors a fragment with any named tint color (not a hex), and^[text](dim: true)dims it.- Each set replaces the whole line. The line is never saved, so it is gone after a relaunch.
--hide-after SECONDSclears it by itself. Give a positive interval and repeat it on each refresh, so the line expires if the script stops.- Settings ▸ Interface ▸ Session info shows it Always (the default), only in the flagged view (Flagged), or never (Off). Hiding never clears it.
- A session attached from another Mac shows that Mac's line too, unless one is set here.
treereportsinfo,infoMarkdownandinfoHideAfter.
Row tint
A tint tells rows apart at a glance: red for production, green for development. Pick one from Tint in a session or workspace row menu: None or one of twelve colors (red, orange, yellow, green, blue, purple, gray, teal, pink, brown, indigo, mint) that follow light and dark mode. Then Show On chooses Icon, Name, or Icon and Name.
agtermctl session tint red --target "$AGTERM_SESSION_ID"
agtermctl session tint green --on icon,name --target "$AGTERM_SESSION_ID"
agtermctl workspace tint red
agtermctl session tint clear --target "$AGTERM_SESSION_ID"
- A workspace tint colors only the workspace row, never the sessions in it.
- With several rows selected, Show On is available only when every selected row is tinted.
- A color picked for an untinted row starts on the last Show On choice made while the app runs, and Show On shows it checked.
- The command palette offers Tint Session: Red through Tint Session: None for the active session.
- Any other color is a
#rrggbbhex throughagtermctl. It stays the same in light and dark mode, and the Tint submenu shows it as a checked Custom entry. session new --tintandworkspace new --tintcreate a row already tinted.treereportstintandtintOn.
A tint on a local row survives quit and relaunch; a duplicated session starts without one. On a session attached from another Mac the tint stays on this Mac: the row does not show the other Mac's tint, and a tint set here is saved with the row. A remote window's row shows the server's tint, which every Mac shares. On an older agterm, an emoji or a PROD or DEV word in the name gives a visible marker, at the cost of pinning the name: the row then no longer shows the live terminal title.
Install the agent hooks
Help ▸ Install Agent Status Hooks… wires agents up for you:
| Agent | Reports |
|---|---|
| any shell (bash, zsh, fish) | active while a command matching AGTERM_AGENT_RE runs; by default gemini, cursor-agent, aider, crush and goose |
| Claude Code | five hooks: prompt and tool run → active, Stop → completed, permission request and permission prompt → blocked |
| Codex | six lifecycle hooks through an adapter (below) |
| Pi | a lifecycle extension, when ~/.pi/agent already exists |
| OpenCode | a lifecycle plugin for v1 or v2, when its configuration directory already exists |
Antigravity CLI (agy) |
three hooks (below), when ~/.gemini/config already exists |
| GitHub Copilot CLI | six hooks through an adapter (below), when ~/.copilot, or COPILOT_HOME if set, already exists |
The Claude Code, Codex, agy and Copilot CLI hooks each give up after 5 seconds, so an agent never waits on a status update agterm is slow to take. Hooks installed by an earlier version get that limit when you run the installer again. Codex hooks you added by hand are not updated: add timeout = 5 to each one yourself, as in the manual setup.
Where it writes
- The scripts go to
~/.config/agterm/agent-status/, with the bundledagtermctl's absolute path baked in, so they work without the CLI on your PATH. - A marker-guarded line for the shell integration goes into
~/.zshrc,~/.bashrcand~/.config/fish/config.fish(fish only when that directory exists). Open a new terminal for it to take effect. - The Claude Code hooks are merged into
~/.claude/settings.json, the six Codex hooks into~/.codex/config.toml, and the agy hooks into~/.gemini/config/hooks.json. Before changing any of them, the installer saves a copy beside it with a.baksuffix. The Copilot CLI hooks get a file of their own,~/.copilot/hooks/agterm-status.json, underCOPILOT_HOMEwhen your login shell sets it. - Running it again upgrades agterm-managed integrations and otherwise changes nothing.
Claude Code
- When Claude Code runs as a worker under another agent with a shell between them, as in a tool call, its hooks stay silent, so the status of the pane that started it is not overwritten.
- A background subagent or workflow keeps the row working. Its activity lights an idle row but never replaces the main agent's status. While Claude Code (2.1.145 or later) reports one, or a background shell, still running, Stop posts active instead of completed; completed comes from the Stop after the last one finishes, so a background server that never exits keeps the row active. To leave background shells out, for example long-running pollers, export
AGTERM_CLAUDE_IGNORE_SHELLS=1in the shell that starts Claude Code; subagents and workflows still keep the session active. - Two gaps remain: the main agent's activity can replace a subagent's permission prompt, and when the key that answers that prompt leaves the block in place, the row stays blocked until the main agent's next event.
- After upgrading, restart agterm and run the install again: a running older app ignores the subagent's
--if-idleand applies the write.
Codex
- When Codex runs as a worker under another agent with a shell between them, as in
codex execfrom a tool call or a review tool, its hooks stay silent while they run beneath that agent, so the status of the pane that started it is not overwritten. - A permission request is only a candidate, because it fires before Auto Review. The adapter keeps automatic decisions active and turns the row blocked only once a real approval or structured question appears in that pane.
- On Stop, a final message that ends a sentence with
?reports blocked. This is a guess from the text: it ignores code in single and triple backticks, and a?that stands alone, opens quoted text, or sits inside a word (as in a URL query string) does not count. Every other final message reports completed and auto-resets. - Run
/hooksin Codex after installing or upgrading and approve the hooks. Codex runs changed command hooks only once they are approved, so until then they do nothing.
Both the skill and the hooks installers read CODEX_HOME as exported by your interactive login shell. A nonempty value selects the Codex directory, a relative path resolved against that shell's working directory. An unset or empty value, a shell that fails to start, unreadable output or a timeout falls back to ~/.codex. The selected directory must already exist: a missing custom directory is skipped, with nothing installed into ~/.codex instead. Whether OpenCode is installed does not affect this.
Pi
Pi work starts as active and settles as completed once retries and queued continuations finish. Pi has no permission or structured-question event, so blocked is never guessed from its replies. Restart Pi or run /reload after installing.
OpenCode
The installer runs opencode --version and installs the matching plugin. It finds OpenCode on your interactive login shell's PATH ($SHELL, or /bin/zsh when unset). If the version cannot be told, it asks you to choose v1 or v2, or to skip OpenCode. Nothing else is needed: no npm dependencies, no configuration edits. Restart OpenCode after installing.
v1 installs ~/.config/opencode/plugins/agterm-status.js. It serves OpenCode 1.x only; OpenCode 2 does not load 1.x plugins and shows no status with it.
| OpenCode event | Status |
|---|---|
session.status busy or retry |
active |
| idle | completed, only when no session is still busy, so a task subagent cannot complete a busy parent |
| permission or question prompt | blocked |
| reply or reject | active, once no other prompt is waiting |
a turn-ending session.error for a session already busy |
blocked. The idle that follows the halt is ignored, and a clean sibling's idle cannot erase it. An abort is ignored. A context overflow waits for the next event: busy means compaction resumed, idle means the turn ended (blocked) |
deprecated session.idle |
ignored, so it does not fire twice with session.status |
v2 installs a plugin at ~/.config/opencode/plugins/agterm-v2/tui.js by default. It reports the selected OpenCode session and its descendants into the current pane, even when several clients share a server; background tabs, ancestors and sibling sessions are left out.
- Running work, retries and recovering compaction are active. Pending permissions and questions are blocked until all are answered or cancelled.
- Success or an interruption by you is completed, but only once the whole family is no longer busy. A failure that ends the work is blocked once the family stops, and stays blocked until the next run.
- Switching sessions, reconnecting and unloading the plugin refresh or clear the status.
- The directory comes from that shell's
OPENCODE_CONFIG_DIR, then$XDG_CONFIG_HOME/opencode, then~/.config/opencode. An emptyOPENCODE_CONFIG_DIRskips v2 with a warning, and so does a shell configuration that cannot be read while~/.config/opencodeexists; without that directory OpenCode is skipped as not installed.
Re-run the installer after switching major versions. A v2 install removes the agterm-marked v1 plugin in its directory; a v1 install leaves the v2 plugin directory alone. A v1 file you own, or one that cannot be read, is kept and reported in the install result.
Antigravity CLI (agy)
- The hooks live under the name
agterm-statusin~/.gemini/config/hooks.json; other named hooks there are kept. A model call reports active, a question or permission request from agy reports blocked until you answer it, and the end of a turn reports completed. Restart agy after installing. - An
agterm-statusblock installed from the cookbook'santigravity-agent-statusrecipe is replaced; any other block, such as one with a command of your own or"enabled": false, is left untouched and reported in the install result. - While background work agy started, such as a command, is still running, the end of the turn reports active instead of completed; agy runs a follow-up turn when a command finishes, and that turn completes. To leave background work out, export
AGTERM_AGY_IGNORE_BACKGROUND=1in the shell that starts agy. A server agy starts as a daemon never holds the session active. - A subagent agy starts reports active only while the session is idle, so its work does not replace a pending question or a completed run. Its finish still reports completed, even over a pending question, since it is often the last thing agy reports. While the main agent or another subagent is still working, the session can show completed early.
- When agy runs as a worker under another agent with a shell between them, as in a tool call, its hooks stay silent, and so do those of a Claude Code worker agy starts that way.
- Two gaps remain. agy has no event for a command or edit approval prompt, so those show as active, not blocked. And it reports nothing when it exits, so quitting while background work holds the session active leaves it active until you press Esc or Ctrl-C there or clear it.
GitHub Copilot CLI
- A prompt and each finished tool report active, a permission prompt reports blocked until you answer it, and the end of a turn reports completed. Leaving Copilot with
/exitor/clearclears the status, while acopilot -prun keeps its completed status. Restart Copilot after installing. - A
copilot-status-hooks.jsonfrom the cookbook'scopilot-agent-statusrecipe in Copilot's ownhooksdirectory is moved aside to a.bakcopy; a changed one, or anagterm-status.jsonholding hooks of your own, is left untouched and reported in the install result. A copy of the recipe in a repository's.github/hooksis not touched, so remove it there yourself, or its hooks keep posting beside agterm's in that repository and a subagent's stop still reports completed. - When Copilot runs as a worker under another agent with a shell between them, as in a tool call, its hooks stay silent, and so do those of a Claude Code worker Copilot starts that way. A subagent's work does not clear a pending permission prompt.
- Five gaps remain. A question Copilot asks you shows as active, not blocked, since Copilot reports a question only after its Autopilot mode has answered it. The main agent's activity can replace a subagent's permission prompt, and when the key that answers that prompt leaves the block in place, the row stays blocked until the main agent's next event. A subagent still running in the background when the turn ends does not keep the session active, as it does for Claude Code and agy, so the turn reports completed while that subagent works. And Copilot reports nothing when a turn is interrupted, so press Esc or Ctrl-C in that pane, as for other agents, to clear the status.
Add Codex hooks by hand
The installer never rewrites a ~/.codex/config.toml it does not own. If that file already defines its own [hooks…] entries, or is not valid TOML, it is left untouched and the install alert sends you here. With CODEX_HOME set, edit <CODEX_HOME>/config.toml instead.
Check the shape of your existing hooks first, since that is why the installer declined:
- If every one is an
[[hooks.…]]array-of-tables entry, appending is safe, including for events you already hook. A repeated[[…]]header adds an element, so both your hook and agterm's run. - An inline
hooks = { … }table or a plain[hooks.SessionStart]table makes the file stop parsing once you append, since TOML allows neither extending a closed inline table nor redefining a value. Convert those entries to the array-of-tables form first. - Do not add a second
commandline inside an existing entry: a repeated key in one table breaks the file too.
Then add the six blocks below, replacing /Users/you with your home directory. The path must be absolute, since Codex runs the hook without your shell's PATH.
[[hooks.SessionStart]]
[[hooks.SessionStart.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' session-start"
timeout = 5
[[hooks.UserPromptSubmit]]
[[hooks.UserPromptSubmit.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' user-prompt-submit"
timeout = 5
[[hooks.PreToolUse]]
[[hooks.PreToolUse.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' pre-tool-use"
timeout = 5
[[hooks.PostToolUse]]
[[hooks.PostToolUse.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' post-tool-use"
timeout = 5
[[hooks.PermissionRequest]]
[[hooks.PermissionRequest.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' permission-request"
timeout = 5
[[hooks.Stop]]
[[hooks.Stop.hooks]]
type = "command"
command = "'/Users/you/.config/agterm/agent-status/agterm-codex-status.sh' stop"
timeout = 5
The adapter script is already in place: the installer copies it to ~/.config/agterm/agent-status/ on every run, whether or not the config merge succeeded. Once the blocks are added, run /hooks in Codex and approve them. For a file that is not valid TOML, fixing it and running the installer again is easier: it merges the blocks for you.
Restore & persistence
When agterm opens again, your workspaces, sessions, splits, directories and font sizes come back. What happens to running programs depends on Settings ▸ General ▸ Restore sessions:
| Mode | Each pane comes back with |
|---|---|
| Fresh shells (default) | a new shell in the saved directory |
| Re-run commands | the command it was running at the last clean quit, started again |
| Live sessions | the same program, still running |
A new mode applies after agterm restarts. agtermctl restore mode reads or sets it.
Live sessions
Quit, update or relaunch agterm while shells, servers and agents keep running. Primary and split panes reconnect; the scratch terminal comes back hidden. Overlays and the quick terminal close with the app.
Requirements
- A zsh or fish shell: your macOS login shell, or the ghostty
commandwhen it is an absolute zsh or fish path with only login or interactive flags (command = /opt/homebrew/bin/fish --login). - The ghostty
commandwins over the login shell. The last one counts, acrossghostty.conf, the inherited global config and theirconfig-fileincludes. Any othercommandis ignored in Live mode. - agterm's bundled session helper (
zmx).
Without a supported shell or the bundled helper, agterm uses fresh shells and Settings says why. The shell is read at launch; running panes keep theirs until Reset Live Sessions.
Upgrade and switch modes
- Upgrade: install the update when agterm offers it and restart (Updates), or install the new version by hand (
brew upgrade --cask agterm), quit, reopen. Panes reconnect.agtermctl versionshows the installed version when it differs from the running one. - Switch to Live: current shells end at the next clean quit. The first Live launch restarts their commands where it can; shell state is lost.
- Switch away from Live: after a restart, every detached live program in this state directory ends. If Live is still selected but cannot run, they are kept for a later launch.
Quit, close, delete
| You | The live program |
|---|---|
| quit cleanly | keeps running; agterm records each pane's command as a fallback |
force quit, crash, SIGTERM |
keeps running; nothing recorded |
| close a window | keeps running; File ▸ Open Window reconnects it |
| delete a session, split, workspace or window | ends after the undo time |
A program that is still running always reconnects. If it is gone (say, after a Mac restart), agterm starts the recorded command in a new live shell. The pane gets a fresh shell instead when:
- nothing was recorded (force quit, crash,
SIGTERM, power loss); - its window was closed before the quit;
- the command is on the denylist or has a control character.
What a reconnected screen keeps
Text, full-screen programs and normal colors come back. Lost from before the reconnect:
- inline images;
- prompt marks (OSC 133), so prompt jumps start at the reconnect;
- palette colors a program changed;
- links on screen.
New output works normally.
Known limit: startup feature checks
A program may ask the terminal about features while it starts. In a new Live pane, these can go unanswered:
- kitty keyboard protocol (richer keys);
- XTVERSION (terminal name);
- OSC 11 (background color, for light or dark themes).
The program then lacks the feature until it asks again. fish 4.9.3 asks for kitty keyboard and XTVERSION only at startup: if unanswered, never again in that shell. zsh asks nothing at startup.
Reset Live Sessions
Reserve Agterm ▸ Reset Live Sessions… for rare repairs. Running Live sessions can stay open through app updates. The reset restarts the sessions it selects and reopens agterm with the same layout. The item appears only while Live sessions is both selected and running. Use it for problems like these:
- a tool in a session created before session-host support asks for the microphone after every update;
- a session needs a Live fix that reaches only new sessions;
- a session under an older build's session host cannot use the microphone after an update;
- a session under an older build's or another login's session host cannot reach the local network.
For the session host problems, one pane can move to the current host without the reset: agtermctl session restart replaces just that pane's shell and running program and runs the command you give it with --command (troubleshooting).
The dialog shows how many sessions the reset can affect. It can include working sessions that predate the last Live update or still use an earlier session host. Their running work stops, and recorded commands restart where possible; agent conversations may need resuming by hand. Other sessions are untouched. Another Mac attached to a reset session may need to attach it again.
With banners on, a notification appears only when something went wrong: some sessions could not be reset (run it again for the rest), or the session list could not be read and nothing was reset. agtermctl zmx reset --force skips the dialog.
Microphone requests from panes under the current session host stay attributed to agterm across restarts (troubleshooting).
From the command line
These need agterm running: only the app knows a leftover program from a closed window's.
| Command | Does |
|---|---|
agtermctl zmx list |
every live program and its pane; closed windows' panes show nothing attached, which is normal |
agtermctl zmx screen |
prints one program's screen, even with its window closed |
agtermctl zmx prune |
ends programs no pane claims; a terminal attached from outside at that moment may end too |
agtermctl zmx kill |
ends one pane's program, even in no visible window, with everything attached; needs session, pane, --force |
agtermctl zmx reset --force |
Reset Live Sessions without the dialog |
After zmx kill a split closes; a primary hands its place to its split, or the session closes. No undo time; Reopen Last Closed Item or agtermctl recent open brings it back with a fresh shell.
agtermctl tree --json reports live panes: surfaces[].backedByZmx, and a session-level backedByZmx that is true when every primary and split pane is live. The sidebar has no mark for it. Full options: command reference.
Commands from scripts
In Live mode, agtermctl session new --command takes long commands fine. A surviving program reconnects without running it again; a gone one gets the usual fallback. The pane closes when the command ends, or keeps its output with --wait. A command that ends quickly can lose its output and show only agterm: session is gone.
Re-run commands
At each clean quit agterm records every pane's foreground command; the next launch starts it again as a new process, visible panes first, the rest gradually.
A pane gets a plain shell instead for:
- a force quit or crash, unless
agtermctl restore captureran first (a capture is used for one launch only); - a control character in the command (it would be typed as an editing key);
- bytes that are not valid UTF-8 (they would replay a different argument);
!in a csh or tcsh pane (expanded as history even in quotes);- a program on the denylist.
Only a single program restores faithfully; pipelines and command chains may not.
Denylist
restore-denylist.conf lists programs that never re-run: one command name per line, matched on the file name. agterm writes a commented starter (tmux, screen, zellij) only when the file does not exist.
- Location: next to
keymap.confandghostty.conf, default~/.config/agterm/. - Settings ▸ Key Mapping moves all three; with no folder set,
AGTERM_STATE_DIRputs them in<state dir>/config. - Read at launch, so edits apply next time.
Pin a pane's command
agtermctl session restore pins the shell code a pane runs at launch. --none pins a plain shell, --clear removes the pin.
- Applies every launch until cleared.
- Wins over the recorded command and the session's
--command; ignores the denylist. - Runs only in Re-run mode, but can be set in any mode.
- Stored in the window's state file and shown by
agtermctl tree: no secrets.
A SessionStart hook can rewrite it, for example so claude --resume … --fork-session resumes instead of forking.
Page sessions
Page sessions on this Mac come back in every mode, with their file or URL, flags and companions, and after Reopen Closed Item. A missing file or silent server leaves the row with the error and a Reload button.
- A file page opened with
--jsgets full control of agterm (page bridge) at every launch and reopen, without asking. Open only pages, and scripts they load, that you trust. A restored--commandonly reruns in Re-run mode. - A URL page gets no bridge.
- A page row from another Mac is saved as an attachment, without the page; that Mac sends it again at launch.
Working directory
Sessions reopen in their last directory if the shell reports it (OSC 7). Ghostty's shell integration does that for zsh, bash, fish and nu; otherwise the session reopens where it was created. Wrappers that replace your shell at startup (Amazon Q, Kiro, Fig) break it: fix.
The directory is saved on quit and on each session add, close, move, rename or select, so a crash loses only cds since then.
Older agterm versions
Saving settings in this version removes the old restoreRunningCommand key. An older agterm opening the same state directory then uses fresh shells.
Troubleshooting
Where the logs and config live, how to read them, and the common problems (a keymap editor that won't open, a custom action that does nothing, missing notifications) are covered in the repo's troubleshooting guide.