# Terminals and workspaces

Real terminals in their own process, and workspaces for repos, worktrees and topic folders.

Canonical: https://brainplane.app/docs/cockpit-terminals/

## Real terminals

Every Cockpit terminal is a real shell, zsh or bash, with your own dotfiles. The page draws it with xterm.js. The bytes come straight from brainplane-ptyd, the process that owns your terminals, so they never pass through brainplane's other service.

## They outlive the window

brainplane-ptyd runs on its own. Quit the app, or let it crash, and your agents keep working: open the app again and each tab finds its terminal, live.

After a Mac restart, each terminal comes back with its scrollback. Its shell starts again when you open the tab. An agent that was running is not started again on its own: press Restart when you want it back.

## Tabs, splits and Quick Commands

- Command T opens a terminal in the current workspace.
- Command Backslash splits a pane right, Command Shift Backslash splits it down.
- Command F finds text in the scrollback.
- Quick Commands keep the commands you run often, such as your tests, and the prompts you give often. Command Shift C opens them.
- Command Option A shows a floating terminal.

Every write to a terminal goes through 1 queue in brainplane-ptyd: your keys, Quick Commands and review notes, so 2 writers never mix their text.

## Workspaces

A workspace is where sessions run:

- **A checkout.** The main folder of a repo.
- **A worktree.** A new git worktree for 1 task, on its own branch. The sheet shows the branch and the folder before you press Create.
- **A topic folder.** The folder of a topic, for business work with no git: contracts, finance, operations.

Projects group your repos, and project groups sort projects by area. Worktrees made by hand or by another tool show under Other worktrees, ready to add.

## Setup scripts

A repo can name a setup script that runs in each new worktree, such as an install. brainplane shows the script and waits for your OK: Run once, or Always for this version. A changed script asks again.

## Archive and trash

Archive moves a worktree to the Trash and keeps its branch. Empty trash lists each item with its size and its unmerged commits first, then asks you again before it removes them.
