runpane 2.4.231 → 2.4.233

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- [{"path":"docs/ADDING_NEW_CLI_TOOLS.md","title":"Adding a New CLI Agent Tool","text":"# Adding a New CLI Agent Tool\n\nAn agent in Pane is an entry in the agents config, `agents.entries` in\n`contracts/runpane/contract.json`. It runs in a `type: 'terminal'` ToolPanel\nwhose `customState.initialCommand` launches the CLI in a PTY, and, when its entry\nhas a `chat` section, in chat tabs over ACP ([CHAT_TABS.md](CHAT_TABS.md)).\nMenus, hotkeys, labels, command detection and chat tabs read the config, so a\nnew agent starts as one config entry. Terminal resume and status detection\nstill need code per agent. This guide uses the Cursor Agent CLI\n(`cursor-agent`, agent id `cursor`) as the worked example.\n\n## 0. Learn the CLI first\n\nBefore writing anything, verify against the real binary:\n\n- Launch command and permission-skip flags (`cursor-agent --force --trust`).\n- Whether it speaks ACP itself (`cursor-agent acp`), its oldest version that\n does, and how it signs in (`cursor-agent login`, or an API key variable).\n- Whether the prompt can be passed as a positional argument, including slash-prefixed\n input (Cursor: yes, unconditionally → argument delivery).\n- Session/resume mechanics (Cursor: `create-chat` pre-creates an id; `--resume <id>`;\n `--continue` for latest).\n- Screen frames for status detection: idle composer, working/spinner, approval\n prompts, first-run dialogs. Capture raw PTY bytes with a `pty` harness and distil\n them into test fixtures.\n- Whether the TUI uses the alternate screen and whether it repaints while idle.\n\n## 1. Add a config entry\n\nAdd the agent to `agents.entries` and its id to `enums.agents` in\n`contracts/runpane/contract.json`; the generator fails unless the two list the\nsame ids. The schema is `$defs/agent` and `$defs/agentChat` in\n`contracts/runpane/schema.json`.\n\n| Field | What it is |\n| --- | --- |\n| `title`, `label` | Full name (terminal tab titles) and short name (menus, chat headings) |\n| `icon` | Key into the clients' brand icon registry; an unknown key gets a generic icon |\n| `description` | One line for Settings → Agents |\n| `executables` | CLI names on PATH; the first launches, all of them identify the agent in a command or process |\n| `terminal.args`, `terminal.fullAccessArgs` | The terminal launch command is the first executable, then `fullAccessArgs`, then `args` |\n| `terminal.hotkey` | Default key for \"Add <title>\"; it must conflict with no other key |\n| `terminal.platforms` | Platforms the agent runs on, when not all |\n| `terminal.reportsConversation` | Pane's `SessionStart` hook reports the terminal's live conversation (Claude only) |\n| `terminal.paneMcpConfigFlag` | The flag that takes an MCP config file for one launch (`<flag>=<file>`) whose `pane` server replaces the user-level one; Pane's terminal tabs then reach its tools over HTTP. Set it only when a probe shows the CLI replaces, not duplicates, the user entry |\n| `terminal.promptArgument` | The CLI takes the starting message as a command argument. Without it, Pane types the message once the status manifest shows the agent's idle input box (below) |\n| `terminal.configDir` | The CLI's project config folder (`.claude`), copied into new worktrees by default |\n| `terminal.session` | How the CLI opens a saved conversation: `flag`, `minimumVersion` (the doctor checks `--help` for the flag), `idPattern`, `selectors` (flags with which a command picks its own conversation) and `paneChoosesId` (the flag also creates the conversation, so Pane picks the id) |\n| `install` | Install page `url` and install `command`, shown when the CLI is missing or too old |\n| `transcriptDirs` | Folders, relative to the home the CLI runs with, that hold its session transcripts. Before Pane deletes a folder it owns, it moves these out of it into `<pane-dir>/agent-logs/<agent>/` ([The scratch folder](SESSIONS.md#the-scratch-folder)) |\n| `signIn` | Arguments to the CLI that sign it in, run in a terminal tab when a chat agent advertises no terminal sign-in of its own; required with `chat` |\n| `models` | How the CLI takes a model (`flag`, and `effortFlag` or `effortConfig` for reasoning effort), its model `list` command and output `format`, or `aliases` when it has none, and its sign-in `status` command. `runpane handoff`, `runpane ask` and `runpane models` read it |\n| `ask` | One read-only headless turn for `runpane ask`: `args` that run a single turn and refuse edits and shell commands, any `env` it needs, and the `output` format its answer is read from. Leave it out unless a prompt asking the agent to write a file with its edit tool and with a shell command leaves the disk unchanged on macOS, Windows and WSL |\n| `onboarding` | Offered on the first-run screen |\n| `chat` | Present when chat tabs run the agent (below) |\n\n`chat` fields:\n\n| Field | What it is |\n| --- | --- |\n| `args` or `adapter` | Exactly one: arguments that start the CLI as an ACP agent (`[\"acp\"]`), or a bundled adapter package (pinned in `package.json`) with the variable that points it at the CLI |\n| `minimumVersion` | Oldest CLI version chat supports |\n| `apiKeyEnv` | Variables an API key saved in Settings is passed as |\n| `fullAccess` | `mode` (a session mode that never asks) or `args: true` (pass `terminal.fullAccessArgs` to the chat CLI); absent, Pane answers each approval with allow once |\n| `riskyModes` | Session modes in which the agent acts without asking; viewers mark them |\n| `terminalConversationsLoad` | A chat can load a conversation the agent's terminal started (Switch to chat) |\n| `paneMcpHttp` | Chat tabs pass Pane's MCP server over HTTP in `session/new`, and the agent uses it in place of its user-level `pane` server. Set it only when a probe shows that (Codex and Cursor keep theirs) |\n| `legacyClients` | Pane apps from before the agent catalog may show its chat tabs; leave it off for a new agent |\n| `registryIds` | ACP Registry ids this entry covers |\n\nThen:\n\n- Regenerate with `node scripts/generate-runpane-contract.js` (or `pnpm run\n generate-runpane-contract`) and commit every generated file, including\n `shared/types/generatedAgents.ts` and `docs/RUNPANE_CLI_CONTRACT.md`.\n- Update the hand-written `<codex|claude|cursor…>` usage strings in the\n contract, and the agent list `scripts/test-runpane-contract.js`\n (`checkAgentTemplateParity`) pins.\n- A new `chat.adapter` package also goes in `package.json` and `main/package.json`\n as an exact version, and in `ADAPTERS` in `scripts/verify-chat-adapters.js`.\n\nWhat derives from the entry with no further code:\n\n- Terminal launch presets, the toolbar pills and Add Tool menus on desktop,\n PWA and phone (`shared/constants/agentLaunchPresets.ts`).\n- The \"Add <title>\" shortcut and its default key\n (`shared/constants/keyboardShortcuts.ts`), so Keyboard Shortcuts, Help, the\n palette and the conflict check cover it.\n- Command and foreground-process detection: `AGENT_EXECUTABLES` and\n `CLI_AGENT_TYPES` in `main/src/services/agents/agentIdentity.ts`, and the\n `TerminalPanelState['agentType']` type.\n- Pane Chat and Sessions: `PaneChatAgent`, its labels\n (`PANE_CHAT_AGENT_LABELS`), panel ids and validators in\n `shared/types/paneChat.ts`.\n- `runpane --agent <id>`, the agent doctor's launch command and its `--help` check for `terminal.session.flag`.\n- How the starting message is delivered (`terminal.promptArgument`), and the\n default worktree file sync row (`terminal.configDir`).\n- For `terminal.session.paneChoosesId`: the launch and every relaunch add the\n flag with a Pane-chosen id (`agents/chosenSessionLaunch.ts`), the resume\n dialog, `--resume` checks and the update reopen read the same fields.\n- Chat tabs, for an entry with `chat`: launch, version check, API key, sign-in,\n full access, the host's agent catalog, Settings → Agents and Switch to chat.\n A Session orchestrator for it opens as a chat tab when chat tabs are on.\n- The Settings search alias (its label).\n\nCode never hard-codes an agent fact: an id, executable, session mode or\nminimum version as a string literal, or an env var name the config lists.\n`scripts/check-agent-names.mjs` (part of `pnpm lint`, so CI runs it) fails on\none outside `scripts/agent-names-allowlist.json`, which lists each exempt file\nwith its reason and the number of such literals it may hold. The count may only\nfall. The per-agent code below lives in files already on that list; a new\nliteral there means raising its count, which review sees.\n\n## 2. Terminal launch and resume\n\n`main/src/services/terminalPanelManager.ts` → `resolveCliLaunchCommand` gets a branch\nper agent that resumes differently: fresh launch (optionally with the prompt as a quoted argument), and\ninterrupted-resume (`wasInterrupted` + `agentSessionId`). Keep agent-specific string\nbuilding in a pure module next to `agents/cursorLaunch.ts` so it is unit-testable.\n\nIf the CLI owns its session ids, scrape them from PTY output via\n`captureAgentSessionId` (add an extractor to `extractAgentSessionId`'s dispatch). If\nlaunch readiness cannot key on first PTY byte (e.g. shell traffic precedes the TUI),\nadd a ready detector like `createCursorReadyDetector` and gate `signalCliReady` on it.\n\nOpenCode creates its own `ses_*` id on the first message and refuses `--session`\nfor an id it did not create, so a new conversation starts bare. Pane saves the id\nfrom the line OpenCode prints after leaving its TUI (`Continue opencode -s <id>`),\npersists it before the next spawn and resumes it with `--session`. Ids from Pane's\nearlier allocator (`ses_` + 32 lowercase hex) are dropped. Its idle composer gates readiness and\nonce-only stdin prompt delivery; wrapped commands remain opaque. RunPane doctor\nchecks the installed executable's session capability before reporting support.\n\nPi takes a caller-chosen id, so its entry sets `terminal.session.paneChoosesId`:\n`pi --session-id <id>` opens the working folder's session with that id and\ncreates it when there is none. Pane allocates a UUID for a direct `pi` launch,\nsaves it as the panel's `agentSessionId` and runs the same command on every\nrelaunch. A command that picks its own session (a `selectors` flag or its own\n`--session-id`), runs a subcommand (`pi auth login`), has a `--` or runs pi\nthrough a wrapper or shell syntax runs unchanged, and `--resume` is refused for\nit. Pi has no `promptArgument`: as an argument, pi reads a leading `@` as a\nfile to attach and sends a slash command to the model as text.\n\nA held starting message waits for positive evidence of the agent's own input\nbox: its manifest's `visibleIdle` rule, or the composer signature in\n`agentScreenSignature.ts` (Claude, Codex). An idle status alone is not enough,\nbecause a screen no rule recognizes also reads idle, and Enter there could\nanswer a prompt such as pi's project-trust question, whose first option is\nTrust. After 30 seconds without the input box, Pane records on the panel that\nit is holding the message and keeps holding it. `--wait-ready` waits for the\nsame input box. For an agent without `promptArgument`, `panels submit` (and so\n`agents send` and Notify's owed answers) types only when the manifest\nrecognizes the input box, idle (`visibleIdle`) or mid-turn (`visibleWorking`),\nand nothing blocks it. So a typed-message agent needs a `visibleIdle` rule, and\nblocked rules for every prompt or dialog that can replace its input box. Pi\nkeeps its footer and widgets below a dialog, so pi's `live_dialog` scans the\nwhole visible screen for a dialog frame: a border row, then the highlighted\noption (`→ `) or the key hint ending in `cancel`, then a border row. Such a\nframe anywhere reads blocked, which holds rather than guesses. Loops and handoff session\ncarrying do not offer pi yet.\n\n`main/src/services/agents/agentResume.ts` → `resolveResumeId` maps the agent to the\nresume id shown in the resume dialog. `sessionManager.resumeInterruptedSessions` and\nthe `index.ts` graceful-shutdown path are agent-generic once the classifier knows the\nbinary.\n\n## 3. Status manifest\n\n`main/src/services/agentStatus/manifests.ts`: write a `<TOOL>_MANIFEST` from captured\nfixtures and register it in `MANIFESTS_BY_AGENT`. Unknown agents fall back to\n`GENERIC_MANIFEST` (works, less precise). Keep blocker rules narrow and live-region\ngated so answered prompts in scrollback don't stick. Record the CLI version the\nfixtures came from.\n\n## 4. RunPane IPC\n\n`main/src/ipc/runpane.ts`:\n\n- `shouldUseArgumentDelivery`: argument delivery for an agent with\n `terminal.promptArgument` (Codex keeps slash commands typed).\n- `runAgentDoctor`: add fallback binary paths (`AGENT_FALLBACK_BIN_PATHS`) when the\n install dir is typically off the GUI PATH.\n\n## 5. Icons and worktree file sync\n\nAdd the brand icon to `frontend/src/components/ui/BrandIcons.tsx` and register\nit under the entry's `icon` key in `CLI_BRAND_ICONS`\n(`frontend/src/components/ui/brandIconRegistry.ts`), and a stand-in symbol in\nthe phone's `BRAND_ICONS` (`native/src/app/pane/[paneId]/new-panel.tsx`).\nWithout them the agent gets the generic icon.\n\nIf the CLI reads a project config folder (like `.cursor/`), set\n`terminal.configDir`; `DEFAULT_WORKTREE_FILE_SYNC_ENTRIES` in\n`shared/types/worktreeFileSync.ts` copies it into new worktrees.\n\n## 6. Sessions in a terminal\n\nA Session orchestrator in a terminal reuses the terminal's native conversation\nidentity and launch/resume support; do not allocate a second orchestrator\nidentity or replay a bootstrap prompt. Sessions emit generated `AGENTS.md`\ninstructions. OpenCode uses that existing context without new OpenCode\nskill/MCP installation and retains its default `opencode --auto` behavior:\nnon-denied operations are auto-approved, not sandboxed.\n\nOpenCode Session launches must be supported direct commands; wrappers and custom\nresume templates are rejected. Saved IDs restore history when it exists. Closing, archiving, switching, or PTY exit\ndoes not add a guarantee that shared-service work has stopped.\n\n## 7. Tests are the spec\n\nEvery step above lands test-first: `agentIdentity.test.ts`, `<tool>Launch.test.ts`,\n`terminalPanelManager.test.ts`, `agentResume.test.ts`, `manifests.test.ts` +\n`agentStatusPipeline.test.ts` (real captured bytes), `runpane.test.ts` (agent matrix +\ndoctor), `agentLaunchPresets.test.ts`, `keyboardShortcutCatalog.test.ts`,\n`scripts/test-runpane-contract.js`. For chat, run the chat tab suites against\nthe real CLI's ACP mode.\n\n## Agents launched through a wrapper\n\nPeople often start a supported agent through their own command, such as\n`agent-farm run free-range` or a shell script. The launch command then says\nnothing about the agent, but Pane still needs to know it, because composer\ndetection, `panels submit` staging, the agent-specific status manifest and the\nagent shown in `panels list` depend on the panel's `agentType`.\n\nManaged agent panels emit `agent.busy`, `agent.ready`, `agent.blocked`,\n`agent.unknown` and `agent.idle` events before identification. These reach the\ndefault agents-only workspace watch even without an `agentType`; ordinary shell\npanels do not emit them. For example, an Agent Farm variant picker can report\n`agent.blocked` before the agent starts. An untyped `panel.exited` is still\nfiltered by the agents-only watch.\n\nPane decides a terminal panel's agent in this order, and records the source in\n`TerminalPanelState.agentDetection`:\n\n1. **`declared`**: `--agent <id>` together with `--tool-command <command>` on\n `panes create`, `panes adopt` and `panels create`. On the wire this is\n `tool: { command, agentType }`. Here `--agent` means \"the agent this command\n runs\".\n2. **`command`**: the launch command's executable word, through\n `resolveAgentTypeFromCommand` in `main/src/services/agents/agentIdentity.ts`.\n3. **`process`**: the PTY's foreground process name, which node-pty reports as\n `pty.process`. Each entry's `executables` map to its agent. Pi sets its\n process title to `pi`, so an npm-installed pi is found here too.\n Claude Code's native installer runs `~/.local/share/claude/versions/<version>`,\n so it reports a bare version such as `2.1.283`. Pane resolves that name to an\n executable path with `ps` (or `/proc/<pid>/exe` on Linux) before trusting it.\n This source is skipped on Windows, WSL and ptyHost terminals, where node-pty\n cannot name the foreground program. A wrapper that stays in the foreground\n (for example a Node process that spawns the agent in its own process group)\n hides the agent from this check.\n4. **`screen`**: Claude's closed rule/`❯`/rule composer box, or Codex's\n `OpenAI Codex` header with its `›` prompt, or either agent's folder-trust\n screen: Claude's `Claude Code'll be able to read` with\n `Yes, I trust this folder`, or Codex's `Codex can read, edit, and run files here`\n with `Trust and continue`\n (`main/src/services/agents/agentScreenSignature.ts`). Pane adopts it only after\n two consecutive status polls match. It ignores the check while Pane's own\n shell is in the foreground, so an agent's last frame left above a shell\n prompt does not count.\n\nPane runs the process and screen checks on the agent-status poll\n(`TerminalPanelManager.pollAgentStatus`) until the panel's agent is known. Once\nit is known, Pane:\n\n- stores `agentType`, `agentDetection`, `launchCommand`, `isCliPanel: true` and\n `launchMode: 'wrapped'` on the panel's custom state;\n- switches the panel to that agent's status manifest;\n- restates the panel's current status with the identified agent attached.\n\nAgent-specific composer readiness and a starting message key off the identified\nagent, however it was identified. Pre-identification watch events and folder-trust\nidentification do not establish composer readiness:\n\n- `--wait-ready` (and `panels wait --for ready`) on a launched command matches\n only once the panel has an agent and that agent's own ready rule passes:\n Claude's composer, Codex's configured footer, the existing rules for the\n others. A wrapper's first output byte never counts. A command that shows no\n supported agent times out with `readiness.reason.code: no-agent-detected`;\n one that exits back to Pane's shell fails at once with `command-exited`\n (where the foreground process is known). A plain shell with no launch\n command is ready once it exists.\n- Prompts before the agent appears come back as `blocked` with their text:\n Agent Farm's `Trust this repository workspace? [y/N]`, and any `[y/N]` or\n similar last-line question a wrapper or shell asks, even when `--agent` was\n declared. Pane never answers them.\n- With `--wait-ready`, runpane owns the starting message: it claims the\n message at create, waits for readiness, stages the text and presses the\n detected agent's submit key separately (Ctrl+Enter for Codex), and verifies\n it like `panels submit`. Without `--wait-ready`, the terminal manager holds\n the message until the agent is identified and idle at its composer, then\n stages and submits it the same way. If no agent appears within 30 seconds\n (a blocking prompt restarts that wait), it records `initialInputError` and\n never types the message into the shell or the wrapper.\n- `[TerminalPanelManager] Starting message …` and `[Runpane] Starting message …`\n log lines mark each write and its outcome, with the agent, detection source,\n byte count, submit key and any `PANE_AGENT_SESSION_ID` the wrapper printed.\n They never include the message text.\n\n`launchMode: 'wrapped'` means the command is launched exactly as given.\n`resolveCliLaunchCommand` never adds `--session-id`, resume flags or a prompt\nargument to it. On restart, Pane runs the wrapper again, and the wrapper handles\nits own resume. The exceptions are a panel with an explicit custom command resume\nconfig and a recognized `agent-farm run|agent` command, which relaunch through\ntheir resume template (see\n[Resuming custom launchers](SESSIONS.md#resuming-custom-launchers)). For the same\nreason, `--resume` is rejected for wrapper commands.\n\nDirect OpenCode launches start without a selector, capture the session id from OpenCode's exit line (`opencode -s <id>`), resume it with `--session`, and use readiness-gated input. OpenCode refuses `--session` for an id it did not create, so Pane never invents one.\nNative selector insertion accepts literal direct commands and simple assignment or\n`env NAME=value` prefixes, not recognized shell wrappers or `env --` forms. Those\nforms fail before spawn; explicitly wrapped launches remain opaque.\nNative commands reject both `--continue` and `-c`, and reject OpenCode's\n`--prompt` argument because it would replay on every restore. Supply initial\ninput through Pane (or RunPane's `--prompt`) instead.\nOutside Pane Chat and named Sessions, wrapped OpenCode launches run unchanged;\nthe wrapper owns session selection and resume, just as it does for the other\nsupported agents. OpenCode Session launches reject wrappers and custom resume.\n\nA new agent works with wrappers once its config entry lists its executable\nnames (`executables`). Add a screen signature only if the agent's UI has a stable,\ndistinctive frame.\n\n## Delivery state and ghost text\n\n`panels submit`, `panels submit-composer`, `agents send` and create prompts\nreport `delivery: { state, evidence }` for Claude and Codex. The state comes\nfrom the agent's own transcript when Pane can find it\n(`main/src/services/agentTranscript/`):\n\n- Claude: `~/.claude/projects/<cwd, non-alphanumerics as '-'>/<session id>.jsonl`.\n Pane picks the session id (`--session-id`), except for wrapped launches, where\n it reads the worktree's recently written transcripts. A taken turn is a\n `type: \"user\"` entry. A message sent while Claude works is first a\n `queue-operation` `enqueue` entry, then a `user` entry once taken.\n- Codex: the newest rollout under `~/.codex/sessions/YYYY/MM/DD/` whose\n `session_meta.cwd` is the worktree, or the rollout named by the thread id once\n Pane knows it. A taken turn is a `response_item` user message. Codex writes a\n queued message only once it takes it, so `queued` comes from its screen\n (`Messages to be submitted after next tool call` / `↳ <message>`).\n\nThe reader tails each file from a byte offset, so polling a long transcript\nstays cheap. Without a transcript, the screen decides: a steadily empty composer\nis `taken`, text still in it is `in-composer`.\n\nThe terminal model splits each screen into typed cells and ghost cells: dim\n(SGR 2) or placeholder-grey text, which agents use for placeholders, prompt\nsuggestions and queued-message lists (`TerminalStateEmulator.getScreenText`).\nComposer detection reads only typed cells; `panels screen` reports the ghost\ntext in the composer as `composer.ghostText`. A new agent whose placeholder is\nneither dim nor mid-grey needs its own placeholder rule in\n`agentScreenSignature.ts`.\n"},{"path":"docs/ANALYTICS_INVARIANTS.md","title":"Analytics Invariants","text":"# Analytics Invariants\n\nThese rules keep Pane's PostHog funnel person-stitchable and privacy-safe. Pane\nturns product analytics on by default for new installs and for undecided\ninstalls whose config doesn't store analytics off.\nPrivacy Settings clearly discloses that default and provides the opt-out.\nExplicit choices from older versions must never be overwritten.\n\n## Bundled Executable Code\n\nImport the SDK through `posthog-js/dist/module.no-external` and keep\n`disable_external_dependency_loading` enabled. This is PostHog's\n[supported entry point for Electron](https://posthog.com/docs/libraries/js):\nexecutable configuration, session replay, surveys, and other remote extensions\ncannot load. All executable dependencies must come from the reviewed,\nlockfile-pinned build. Do not add a second import from the default SDK entry point.\n\nKeep `advanced_disable_flags` enabled. Pane uses no feature flags, and the SDK\nthen makes no `/array/<token>/config` or `/flags` requests. Those requests carry\nthe identity stored in localStorage, including after opt-out.\n\n## Identity Comes First\n\nResolve analytics identity in the main process before the renderer captures any\nanalytics disclosure or choice event.\n\nRequired ordering:\n\n1. Resolve GitHub CLI email, git email, or stable `install_id`.\n2. Persist the analytics identity in config.\n3. Capture `analytics_default_enabled` for an undecided install entering the\n default-on experiment.\n4. Capture `analytics_opted_in` or `analytics_opted_out` for explicit Settings\n choices.\n5. Capture `app_first_opened` and usage events only after the default or choice\n is applied.\n\nDo not flush queued usage until the initial default or stored choice has been\nresolved. Opting out must capture the choice marker directly, discard queued\nusage, and leave the PostHog SDK opted out.\n\n## Existing Choice Preservation\n\n`analytics_consent_shown=true` records an explicit choice made under the legacy\nopt-in dialog. Its stored `analytics.enabled` value is authoritative. The\n`analytics_default_applied` distinguishes installs already processed by the\nnew experiment from previously undecided installs.\n\nThe default-on experiment never replaces a stored `analytics.enabled: false`.\nWhen it finds `false` on an undecided install, it sends nothing, records\n`analytics_default_applied` and leaves analytics off. That `false` is usually a\nchoice, since a fresh install's default is `true`. Builds before 2026-08-31 also\nstored `false` by default, so an install that last ran one of them and never\nanswered the opt-in dialog stays off too: config can't tell the two apart.\n\n## Analytics Off Means Off\n\n`ConfigManager.isAnalyticsEnabled()` is the one gate for everything the main\nprocess sends: forwarded usage events, error reports, `app_closed` and the\ninstall heartbeat. It is off when any of these holds:\n\n- \"Allow product analytics\" is off (`analytics.enabled: false`).\n- `DO_NOT_TRACK=1` or a non-empty `RUNPANE_TELEMETRY_DISABLED` is set. The\n config the renderer receives then says `enabled: false` with\n `disabledByEnvironment: true` (`rendererConfig` in `main/src/ipc/config.ts`),\n so the renderer sends nothing, the default-on experiment waits, and Settings\n locks the switch with a note. config.json keeps its own value.\n- config.json exists but Pane has not read it since launch, because it is not\n JSON or a field fails to decode. Pane can't know whether it holds an off, so\n analytics stay off until the file reads, and the renderer receives\n `enabled: false`. The off is never saved: analytics writes made meanwhile\n (the install ID, identity) are dropped, so once the file reads, its\n analytics settings stand as they were.\n\n## Required Event Context\n\nEvery first-run funnel event must include:\n\n- `distinct_id`\n- `install_id`\n- `app_version`\n- `platform`\n- `identity_source`\n\nThe event should also set person properties when the identity is known\n(`personProperties` in `frontend/src/services/posthog.ts`):\n\n- `install_id`\n- `identity_source`\n- `github_username`\n- `github_email`\n- `git_email`\n- `git_email_sha256`\n- `git_user_name`\n- `app_version`\n- `platform`\n\nPrivacy Settings must disclose that analytics can be associated with locally\navailable GitHub or Git account details, including a username or email. Do not\ndescribe this telemetry as anonymous while those person properties are sent.\n\n## Opt-Out Is Still Identified\n\nCapture `analytics_opted_out` with identity context before disabling analytics.\nAfter that capture, discard queued usage events and keep analytics disabled.\n\nThis records who opted out without sending their later product usage. After\nopt-out, Pane sends no analytics requests, including the install heartbeat.\n\n## Install Heartbeat\n\nWhile analytics is on, the main process sends `app_heartbeat` at launch and\nevery 24 hours while Pane runs, so active installs stay countable\n(`startHeartbeat` in `main/src/services/analyticsManager.ts`). Each beat reads\nthe \"Allow product analytics\" setting, so turning it off stops the next beat. Its properties\nare exactly `distinct_id: install:<installId>`, `app_version`, `platform`, the\nenvironment tags below and `$process_person_profile: false`. It creates an install ID if the install has\nnone, and never sends `$set`, account or Git details. PostHog still shows it on\nan existing person already linked to that install ID, and derives location from\nthe request IP.\n\nOnly the installed app sends it: a packaged build on the default data directory\n(no `PANE_DIR`, `FOOZOL_DIR` or `--pane-dir`). Analytics off, `DO_NOT_TRACK=1`\nor a non-empty `RUNPANE_TELEMETRY_DISABLED` turns it off, as it does all analytics.\n\nSettings › Privacy discloses the payload. Adding a property means changing that\ncopy and this section in the same PR.\n\n## Environment Tags\n\n`app_heartbeat` and the events Pane captures itself (`capture`, direct\ncaptures such as `app_first_opened`, and main-process events such as\n`app_opened` forwarded through the renderer) say where Pane runs, so dashboards\ncan tell people apart from automated installs. Events the PostHog SDK generates\non its own, such as `$pageview` and `$autocapture`, don't carry them. They tag; they never drop an event. The main process detects them once\nper launch (`main/src/utils/analyticsEnvironment.ts`) and sends them on the\nanalytics identity, never saving them to config:\n\n| Property | Values |\n|---|---|\n| `ci` | a CI variable the runpane wrappers also check is set (the lists are kept equal by a test) |\n| `ci_provider` | `github_actions`, `gitlab`, `buildkite`, `circleci`, `azure_pipelines`, `jenkins`, `teamcity`, `codebuild`, `other` (bare `CI`), or `none` |\n| `container` | Linux only: `/.dockerenv`, `/run/.containerenv`, a `container` variable other than `flatpak`, or a Docker, Kubernetes, containerd, Podman or LXC cgroup. Toolbox, distrobox and devcontainers count too |\n| `display` | `native` on macOS and Windows; on Linux `wayland`, `x11`, `virtual` (the X server is Xvfb, except under Xpra or Chrome Remote Desktop, which people use) or `none` |\n| `in_wsl` | Linux under WSL (`WSL_DISTRO_NAME` or a Microsoft kernel). Not `wsl`: `onboarding_completed` already sends `wsl` for a WSL repository path |\n| `packaged` | a packaged build |\n| `custom_pane_dir` | started with `PANE_DIR`, `FOOZOL_DIR` or `--pane-dir` |\n| `automated` | `ci`, or a `virtual` or `none` display. A container alone isn't automated: people run Pane in toolbox or a devcontainer with their real display, and a CI container is caught by `ci` or its display |\n\nThey carry no paths, hostnames or environment values. Older app versions send\nnone of them, so treat a missing tag as unknown, not as a person. A Linux\nheadless daemon has no display, so it counts as automated.\n\n## Config Saves Preserve Analytics Fields\n\nRenderer settings updates must deep-merge analytics config instead of replacing\nit. In particular, do not drop the identity fields in `analytics`\n(`main/src/types/config.ts`):\n\n- `installId`\n- `distinctId`\n- `identitySource`\n- `githubUsername`, `githubEmail`, `gitEmail`, `gitEmailHash`, `gitUserName`\n\n## Attribution and Versioning\n\nWhen web attribution is present, emit attribution events with the same\n`distinct_id` and `install_id` as consent and usage events.\n\nApp version should come from the running app context and be attached to disclosure,\nfirst-open, usage, attribution, and close events. This lets PostHog distinguish\ncurrent users from older installs.\n\nThe app joins the web visitor id and the install id to the desktop id with\n`$create_alias`. PostHog merges the `alias` id into the `distinct_id` person and\nrefuses an `alias` id whose person is already identified, so the `alias` is\nalways the id that is new:\n\n- Web visitor id: `distinct_id` = desktop id, `alias` = web visitor id.\n- Install id, desktop id unchanged since the last launch (or first launch):\n `distinct_id` = desktop id, `alias` = `install:<id>`.\n- Install id, desktop id changed since the last launch: `distinct_id` =\n `install:<id>`, `alias` = new desktop id. The main process reads the stored\n desktop id before this launch overwrites it and passes it as\n `previousDistinctId`.\n- No install alias when the desktop id is `install:<id>`.\n\nThe SDK path (`posthog.alias(alias, original)`) and the direct HTTP path used\nwhen opting out send the same pairs.\n\n## Remote Pane Privacy\n\nRemote Pane analytics must use explicit sanitized events. Do not rely on\nautocapture for Remote Pane connection-code, token, host, or command surfaces.\nAny UI that renders or accepts `pane-remote://` codes, remote access tokens, or\nremote setup commands must include `ph-no-capture`.\n\nSSH host aliases from the user's SSH config never go into events or logs sent\noff the machine. The SSH hosts sidebar section and the SSH view carry\n`ph-no-capture`.\n\nRemote Pane events must never include:\n\n- connection codes\n- bearer tokens\n- token hashes\n- base URLs\n- hostnames or IP addresses\n- profile labels\n- client labels\n- device labels\n- raw error messages\n- local paths or Pane data directories\n- remote runtime ids\n\nAllowed properties should stay enum-like: `surface`, `role`, `flow`, `result`,\n`tunnel_preference`, `tunnel_kind`, `data_mode`, `client_kind`,\n`connection_mode`, `failure_stage`, `failure_category`, `failed_check`, and\nconnected-client count buckets.\n\n`failed_check` names the checklist row that failed. Connect checks send it on\n`remote_pane_client_connection_failed` with `failure_stage: connection_check`:\n`tailscale_here`, `host_offline`, `host_unreachable`, `pane_not_running`,\n`sign_in_rejected`, `password_required`, `owner_only`, `workspace_restore`.\nSet Up Host sends it on `remote_pane_host_setup_failed`: `setup_service`,\n`setup_port`, `setup_tailscale`, `setup_https`, `setup_code`, `setup_daemon`.\nThe sanitizer drops any other value.\n\n## Remote Pane Event Catalog\n\n| Event | Primary source | Funnel role |\n|---|---|---|\n| `remote_pane_host_setup_started` | `main/src/ipc/remoteDaemon.ts` | Host setup started |\n| `remote_pane_host_setup_succeeded` | `main/src/ipc/remoteDaemon.ts` | Host setup completed |\n| `remote_pane_host_setup_failed` | `main/src/ipc/remoteDaemon.ts`, `main/src/daemon/remoteTransportController.ts` | Host setup or transport failed |\n| `remote_pane_setup_terminal_opened` | `main/src/ipc/remoteDaemon.ts` | Setup command opened in terminal |\n| `remote_pane_connection_code_created` | `main/src/ipc/remoteDaemon.ts` | Host code created |\n| `remote_pane_connection_pair_created` | `main/src/ipc/remoteDaemon.ts` | Advanced paired profile created |\n| `remote_pane_connection_code_imported` | `main/src/ipc/remoteDaemon.ts` | Client imported code |\n| `remote_pane_connection_code_import_failed` | `main/src/ipc/remoteDaemon.ts` | Client import failed |\n| `remote_pane_client_connect_started` | `main/src/daemon/client/remotePaneClient.ts` | Desktop client connection started |\n| `remote_pane_client_connected` | `main/src/daemon/client/remotePaneClient.ts`, `main/src/daemon/httpApiServer.ts` | Desktop client connected |\n| `remote_pane_client_connection_failed` | `main/src/daemon/client/remotePaneClient.ts` | Desktop client initial connect or connection check failed; background state refreshes send nothing |\n| `remote_pane_client_disconnected` | `main/src/daemon/client/remotePaneClient.ts`, `main/src/daemon/httpApiServer.ts` | Desktop client disconnected |\n| `remote_pane_profile_deleted` | `main/src/ipc/remoteDaemon.ts` | Client profile removed |\n| `remote_pane_host_access_cleared` | `main/src/ipc/remoteDaemon.ts` | Host access revoked |\n| `remote_pane_host_clients_disconnected` | `main/src/ipc/remoteDaemon.ts` | Host disconnected clients |\n| `remote_pane_host_transport_started` | `main/src/daemon/remoteTransportController.ts` | Host transport live |\n| `remote_pane_host_transport_stopped` | `main/src/daemon/remoteTransportController.ts` | Host transport stopped |\n| `remote_pane_pwa_client_connected` | `main/src/daemon/httpApiServer.ts` | Browser/PWA client connected |\n| `remote_pane_pwa_client_disconnected` | `main/src/daemon/httpApiServer.ts` | Browser/PWA client disconnected |\n| `remote_pane_remote_runtime_used` | `main/src/daemon/client/remotePaneClient.ts` | Remote runtime actually used |\n\n## Failure Volume and Error Privacy\n\nKeep core desktop activity (`app_opened`, `app_closed`, `session_created`,\n`panel_switched`, `terminal_panel_created`). Neither wrapper emits routine\ncommand starts or successes. Preserve sanitized wrapper failures and download\nlifecycle events; honor explicit local analytics opt-out as well as CI,\n`DO_NOT_TRACK=1` and `RUNPANE_TELEMETRY_DISABLED`.\n\n`runpane_wrapper_command_failed` reports thrown errors, and non-zero exits from\n`install` or `update` only (also when setup runs them) (`runTrackedCommand` in\n`packages/runpane/src/cli.ts` and `run_tracked_command` in the pip `cli.py`).\nOther exit codes are documented results and send nothing. Polling and status\ncommands (`panes list`, `panels wait`, `watch`, `panes archive`,\n`workspace state`, `agents status`, `doctor`) send no failure events, and\nneither does a `not_found` failure outside `install` and `update`\n(`isExpectedFailure` in `packages/runpane/src/telemetry.ts`,\n`_is_expected_failure` in the pip `telemetry.py`). The event carries\n`error_code` (the code the `--json` error prints) and a `failure_category` read\nfrom that code and the message's first line. Both wrappers share\n`<PANE_DIR>/runpane-wrapper-telemetry.json`: one failure event per cause per\nhour and at most 10 failure events per hour per install.\n\nLocal control emits only `runpane_local_control_failed` for thrown failures or\nhandled `ok: false` results. Normal wait deadlines and optional agent\nunavailability are excluded. A `panes create` or `panels create` result reports\nits first failed item's error code, or why the agent was not ready\n(`no-agent-detected`, `agent-not-ready`, `command-exited`, `agent-blocked`,\n`readiness-timeout`) or that the starting message was not confirmed\n(`delivery-unverified`). `error_code` is one of those, a listed errno, or a\nPane `ERR_*` code; anything else is `unknown`. Its properties are `action`, `status`, `command_ok`,\n`failure_kind`, `error_type`, `error_code`, and `failure_category`, plus app version,\nplatform and Electron version. Each coarse operation/category/code combination\nreports at most once per five minutes, with an overall cap of 20 per hour per\napp process. Limits are in memory and reset on restart. Local logging remains\nindependent of analytics suppression.\n\nProduction ingestion drops legacy `runpane_wrapper_command_started`,\n`runpane_wrapper_command_succeeded`, and `runpane_local_control`. Keep the new\nfailure event name separate so useful failures survive these exclusions.\n\nPostHog `$exception` events are reserved for app errors: renderer global errors\nand unhandled rejections, React error boundaries, unexpected renderer crashes/OOM,\nmain uncaught exceptions, and shutdown errors. Console errors and handled CLI\nfailures never become exceptions. Exceptions have their own five-minute\ndeduplication and 20-per-hour cap. Both error event paths send directly from main\nthrough PostHog's capture API, with at most four concurrent requests and a 1.5s\ntimeout; neither waits for delivery. Errors obey analytics opt-out and use only\nthe existing install UUID identity, without person-profile updates, account\nproperties, SDK URL enrichment or persistent error storage.\n\nException payloads contain coarse source, built-in error type, allowlisted error\ncode/category, version/platform, a fixed message, and up to ten packaged app JS\nframes. Frames contain relative app filenames and numeric line/column offsets,\nnever absolute paths, function names or source context. Raw messages, causes,\nCLI argv, terminal contents, prompts, source code, repository paths, usernames,\nhome paths and environment values are excluded. Development/server URLs and\nexternal dependency frames are omitted. Restricted interactive-element\nautocapture and pageviews stay enabled, with text and attributes masked;\nautomatic exception capture is disabled. Session replay policy is unchanged.\n\nMain fatal capture uses `uncaughtExceptionMonitor`, preserving exit behavior.\nDelivery during process exit is best effort. Native main-process aborts and\nsegfaults cannot be captured by JavaScript; there is no minidump uploader or\nsource-map upload pipeline. Renderer process loss reports a coarse crash reason\nwithout a native stack. Native crash reporting remains a separate follow-up.\nPostHog's [Electron support request](https://github.com/PostHog/posthog/issues/43993)\ndoes not provide native Electron crash support. The payload follows the supported\n[manual exception schema](https://posthog.com/docs/error-tracking/installation/manual)\nfor JavaScript errors; this is not a replacement for native Electron crash reporting.\nSource-map symbolication is not wired or verified: current reports contain\npackaged JavaScript offsets only, and a future source-map upload integration must\nbe verified against a packaged build before claiming original TypeScript locations.\n\n## Test Coverage\n\nChanges to disclosure, analytics config, or first-run event ordering should update\nor add coverage in:\n\n- `main/src/services/analyticsIdentity.test.ts`\n- `main/src/services/analyticsManager.test.ts` (error events and the heartbeat)\n- `main/src/utils/analyticsEnvironment.test.ts` (environment tags)\n- `frontend/src/services/posthog.test.ts` (aliases and environment tags on events)\n- `tests/analytics-consent.spec.ts`\n\nThe Playwright test should verify both event order and payload shape, including\nSDK identity and interaction events, and reject external script, `/config` and\n`/flags` requests.\n"},{"path":"docs/APPEARANCE.md","title":"Appearance","text":"# Appearance\n\nPane can follow the operating system or stay on a fixed palette. **System** remembers one light palette and one dark palette and selects between them as the OS appearance changes. **Fixed** uses a third, independent palette. Switching modes never replaces any remembered selection.\n\nNew installations default to System with Folio for the light slot and Dusk (OLED) for the dark slot; the remembered Fixed palette is Folio. A saved appearance keeps whatever it holds, including the earlier defaults (Light (rounded) and Dark (sharp)); only missing or invalid fields take the new defaults. Existing configurations that only contain `theme` migrate to Fixed so their current palette remains exact. The legacy palette also seeds the matching System slot, while the opposite slot keeps its default.\n\nEither System slot accepts any palette: each picker lists every theme, so a dark palette can follow a light OS and the reverse. Slots are named for the OS appearance they follow, not for the palette's own base. Palettes are validated at load, renderer, IPC, and persistence boundaries; invalid stored fields are repaired independently and reported by the main process.\n\n## First paint\n\nAt startup the persisted config selects Electron's `nativeTheme` source. Main passes the four-field appearance snapshot through an argv argument and selects a cached, theme-specific BrowserWindow background colour. The preload decodes the snapshot synchronously; the HTML bootstrap resolves System against `prefers-color-scheme` and stamps the full class chain before React mounts. The provider then owns live OS updates, persistence, rollback, window controls, terminal, and editor updates. A versioned local cache and legacy `localStorage.theme` are fallback-only.\n\nOn Linux, System depends on the desktop environment and Chromium exposing `prefers-color-scheme`. Desktops that do not publish an appearance preference may remain on their reported default slot.\n\n## Custom theme\n\nAn agent can restyle Pane when the person asks (\"Tone down Pane's borders\"). It writes one Custom theme, `custom-theme.json` in Pane's data folder beside `config.json`, through `runpane theme set` or the `theme_set` MCP tool. Pane restyles the main window and notify cards within a second, terminal colours included, with no restart.\n\n```json\n{\n \"base\": \"dusk\",\n \"name\": \"Quiet Dusk\",\n \"colors\": { \"--color-border-primary\": \"#262b33\" },\n \"css\": \"[data-pane-part=\\\"tab\\\"] { border-radius: 8px !important; }\"\n}\n```\n\n- `base` is one of the 27 shipped themes. The Custom theme takes its light or dark family and fills every token it doesn't set.\n- `colors` sets `--color-*` tokens to hex, `rgb()` or `rgba()` values. `runpane theme read` lists every token with its current value.\n- `css` is up to 20,000 characters (the file up to 32 KB), applied after Pane's own styles.\n- `name` is optional and shows in Settings.\n\n`runpane theme set` merges colours into the current Custom theme (`null` removes one), replaces the CSS when `--css` is given, and selects Custom where the person sees it now: as the Fixed theme, or in the System slot of the base's family. `runpane theme set --theme <id>` switches to another theme and keeps the file. High contrast still wins over Custom colours for the tokens it sets.\n\n**Stable selectors.** CSS should target only `[data-pane-part=\"<name>\"]`: `app`, `sidebar`, `sidebar-pane`, `main`, `tab-bar`, `tab`, `panel`, `terminal`, `chat-message`, `chat-composer`, `button`, `input`, `dialog`, `settings`, `notify-card`. These stay across releases (a test keeps them). Tailwind classes, DOM shape and `data-testid` may change in any release. Terminal text is drawn on a canvas, so it takes colour tokens only.\n\n**No remote files.** Pane refuses CSS with `@import`, `src()`, `image-set()` or a `url()` that isn't a `data:` or `#id` address, and writes nothing. The renderer filters the parsed rules again and drops any declaration that could still fetch, such as an escaped `url(`.\n\n**Hand edits.** Pane reloads the file when it changes. An invalid file is ignored whole: Pane shows the base theme, and Settings > Appearance and `runpane theme read` give the reason.\n\n**Reset.** Each of these deletes the Custom theme and returns to its base: Settings > Appearance > Custom theme > Reset, View > Reset Custom Theme (macOS), `runpane theme reset` from any shell, or deleting the file. There is no readability check, so use one of these when a theme makes Pane hard to read.\n\nA setup export carries Custom as its base theme. Remote clients and the phone apps don't use the Custom theme.\n\n## App icon\n\n`pnpm generate-icons` renders the general app assets from\n`main/assets/icon-source.svg` and the macOS Dock assets from\n`main/assets/icon-macos-source.svg`. The macOS Dock PNG and bundle ICNS use the\nblack-sky landscape artwork inside a transparent 1024px canvas so its visible size\nmatches neighboring Dock icons. The simpler PNG, ICO, and favicons continue to\nserve Linux, Windows, and small web sizes. `pnpm dev` copies an updated Dock PNG\ninto the main-process build before launching Electron.\n"},{"path":"docs/ARCHITECTURE.md","title":"Pane architecture","text":"# Pane architecture\n\nThis is an index of how Pane fits together. It names the owning files; the code\nis the reference for details.\n\n## Renderer preference boundary\n\nUse `API.preferences.get(key)`, `getAll()`, and `set(key, value)` instead of generic IPC invokes. The preload's `preferences` methods validate host responses through `shared/types/preferences.ts` before returning values. A missing key returns `null`, an empty value remains `''`, and all preference values are strings. Failed or malformed responses reject; callers retain their existing loading/error handling. The frontend API forwards these typed values without parsing IPC envelopes again.\n\n## Words\n\n- **Repository (project):** a saved base git repo.\n- **Pane (session):** one feature or PR workspace. It normally owns one\n Pane-managed git worktree and branch.\n- **Panel:** a tab inside a pane. Types are `terminal`, `diff`, `explorer`,\n `editor`, `logs`, `dashboard`, `setup-tasks`, `browser` and `notes`\n (`shared/types/panels.ts`). Agent CLIs run in `terminal` panels.\n\n## Processes\n\n```\nrenderer (frontend/, React) ──IPC via preload──▶ main process (main/src)\n │ services, SQLite, git\nremote PWA / mobile ──HTTP + SSE──▶ daemon ◀──socket── runpane CLI\n │\n ptyHost (optional utility process)\n```\n\n- **Main process** (`main/src/index.ts`) owns native integration, git\n worktrees, CLI processes and persistence. Business logic lives in\n `main/src/services/`; IPC handlers live in `main/src/ipc/`.\n- **Preload** (`main/src/preload.ts`) is bundled with esbuild because the\n renderer is sandboxed (`scripts/verify-sandboxed-preload.js` checks it). It\n sends each invoke either to the main process or to the daemon, decided by\n `isDaemonOwnedChannel` in `shared/types/daemon.ts`. Keep ownership lists in\n that module, and run `pnpm build:main` to check the bundle still loads.\n- **Renderer** (`frontend/src`) is React with Zustand stores\n (`frontend/src/stores`). `frontend/index.html` is the desktop app;\n `frontend/remote.html` is the Remote PWA that `mobile/` also bundles. The\n desktop window shows on its first frame, the launch outline that an inline\n script in `index.html` draws before any app code loads: the title bar,\n sidebar and, when launch reopens a chat, that chat's message box, which the\n chat takes over as it mounts (`frontend/src/utils/launchOutline.ts`).\n- **Daemon** (`main/src/daemon`) serves the command registry over a local\n socket (a `pane-daemon-*` directory under the system temp directory, or a\n named pipe on Windows). The `runpane` CLI talks to it. For Remote Pane it also\n serves HTTP and SSE (`httpApiServer.ts`), and the same server, behind\n `tailscale serve` on port 8443, gives your other machines `runpane workspace`\n and codeless desktop remote mode (`workspaceHost.ts`,\n `services/tailnetMachines.ts`, [RUNPANE_WORKSPACES.md](RUNPANE_WORKSPACES.md)).\n Who it admits is the visibility and optional password in `auth.ts`.\n A desktop saves each computer it reaches once, with its routes in order\n (`shared/types/remoteComputers.ts`), and `daemon/client/remotePaneClient.ts`\n connects on the nearest route that answers ([Routes](QR_PAIRING.md#routes)).\n `pnpm daemon:headless` runs it\n without a window. Remote setup and lifecycle:\n [SELF_HOSTED_REMOTE_DAEMON.md](SELF_HOSTED_REMOTE_DAEMON.md) and\n [remote-daemon-lifecycle.md](remote-daemon-lifecycle.md).\n- **ptyHost** (`main/src/ptyHost`) runs PTYs in an Electron utility process.\n It is on by default on Windows (`usePtyHost` in `configManager.ts`), and\n `PANE_USE_PTY_HOST=1` turns it on elsewhere. Otherwise PTYs run in the main\n process. See [troubleshooting/WINDOWS_APP_HANG.md](troubleshooting/WINDOWS_APP_HANG.md).\n\n## Terminal output\n\nPTY output goes through `terminalPanelManager.ts`, which batches it and applies\nflow control. It feeds a headless xterm emulator (`terminalStateEmulator.ts`),\nwhose serialization restores a terminal when its panel is shown again, and\nstores capped scrollback in the `panel_buffers` table. The renderer draws with\nxterm.js in `frontend/src/components/panels/TerminalPanel.tsx`. The comment\nabove that component describes the activation lifecycle; read it before you\nchange how panels show, hide or refresh.\n\nAgent status (working, idle, blocked) is derived in\n`main/src/services/agentStatus/`, from each tab's screen or from the program's\nown OSC 7501 reports ([PROGRAM_STATUS.md](PROGRAM_STATUS.md)).\n\n## File previews\n\n`FileEditorView.tsx` routes editor tabs from the Files inspector, terminal links,\nand `runpane panels open --file` using `shared/utils/filePreview.ts`. Supported\nformats open read-only; ordinary code and text, HTML included, retain the editor\nand auto-save.\nImages, PDFs, fonts, video and audio load through `pane-media`, registered in\n`main/src/services/mediaPreview.ts`. A revocable URL grants access to one file;\neach request rechecks the existing worktree/symlink boundary through\n`file:getPath`. `mediaStream.ts` streams byte ranges from disk. File bodies do\nnot pass through text/base64 IPC. On a remote desktop, the URL is bound to the\nconnected host, and each request streams from the host's authenticated `/media`\nroute with the same boundary check and byte ranges. Archive and SQLite listings\n(`file:preview-list`) run on the host. \"Open with system app\" on a remote desktop\ncopies the file to a temporary folder on that desktop and opens the copy;\n\"Reveal in folder\" appears only on the host.\n\nHTML is not a preview format. Clicking an `.html`/`.htm` file in the Explorer,\nor its Eye button, opens it rendered in a browser tab: the tab already showing\nthat file, or else a new one (a tab showing anything else is never retargeted).\nThe \"Open HTML files\" setting (Settings → General) switches Explorer clicks to\neditable source, and an HTML file's right-click menu offers both \"Open preview\nin browser\" and \"Open as file\". A browser tab showing a worktree file offers\n\"View source\", and an HTML editor tab offers \"Preview\", which works like a click. `panels open --file` always\nopens the source; `--url file://...` renders.\n\nMarkdown, CSV/TSV and structured text fetch at most 1 MiB. Markdown renders\nwith a source toggle.\nTables display at most 500 data rows and 100 columns. JSON/JSONL are formatted;\nYAML/TOML retain source formatting in read-only Monaco with folding. Fonts use\na temporary FontFace specimen. Decode failures offer system open/reveal actions.\n\n`filePreviewListing.ts` lists ZIP central directories (up to 4 MiB) and TAR\nheaders without extraction, with at most 1,000 entries. ZIP64/split ZIP and\ncompressed TAR are unsupported; extended TAR names are not expanded. SQLite\nlists tables/views from a bounded temporary copy (32 MiB), opened read-only and\nremoved afterward. Nonempty WAL and rollback journals are refused before and\nafter copying beside the canonical target; hard-linked databases are refused\nbecause their recovery-file owner path is ambiguous. No source sidecars are\ncreated. Native schema inspection runs in\na child process with a 3-second deadline, a 1 MiB output cap and at most 1,000\ndisplayed entries. No table data queries are executed.\n\n`file:read` samples at most 8 KiB before decoding UTF-8. Binary files show a\nread-only notice, and `file:write` refuses to overwrite binary content as text.\nPreview components never enter the editable auto-save path, even on errors.\n\n## Data\n\n- The data directory is `~/.pane` for an installed app. `--pane-dir` or\n `PANE_DIR` overrides it (`main/src/utils/appDirectory.ts`).\n- `sessions.db` is SQLite in WAL mode. The base schema is\n `main/src/database/schema.sql`; later changes are inline migrations in\n `main/src/database/database.ts` that run at startup. These guarded upgrades inspect\n the existing schema (for example with `PRAGMA table_info` and `sqlite_master`);\n there is no migration-version table or numbered SQL-file runner. For schema\n changes, update the fresh-install schema and the guarded `runMigrations()`\n upgrade, preserving ordering across table rebuilds. Verify fresh and older\n databases in isolated tests; a standalone SQL file does not run an upgrade.\n- `config.json` holds app settings (`main/src/services/configManager.ts`,\n types in `main/src/types/config.ts`). It can be edited outside Pane while\n Pane runs: every save re-reads the file and writes only the keys it changes,\n a watcher reloads outside edits and emits `config-updated`, and a file that\n does not parse is never written over.\n- Worktrees go in `<repo>/worktrees/` unless the project sets another folder\n (`worktreeManager.ts`). A worktree on a remote-tracking base fetches that\n branch first (`worktreeBaseRefresh.ts`: capped at about 10 s, shared by\n concurrent creates, never fails the create). Every fetch (Fetch button,\n dashboard, branch list, new worktree, or an agent's `git fetch` or `git\n pull` in the active Pane, seen through its `FETCH_HEAD`) updates\n ahead/behind for the project's Panes, and the time under Fetch shows when\n the Pane's base branch was last fetched; `FETCH_HEAD` files seed that time\n at startup (`gitStatusManager.ts`).\n `worktreePoolManager.ts` keeps\n empty reserve worktrees on `_reserve/<hex>` branches so new panes open fast;\n a reserve is only claimed while its base ref still points at its commit.\n- Archive cleanup intents live in SQLite's `archive_cleanup_jobs`, atomically\n committed with the session archive flag. `ArchiveCleanupManager` resumes only\n those intents, validates physical directory/Git identity, and serializes work\n per repository with two global slots. Awaited, cooperative purge batches use\n Electron's `original-fs` and job-level busy retries. There are no detached\n deletion helpers or timed-out deletions left running. Failed jobs remain\n visible through ArchiveProgress; interrupted scripts require explicit skip\n on retry. Create/remove and pool background mutations share FIFO repository\n admission with no waiter timeout; archive scripts and purge run outside it.\n Known process trees are captured before committing intent. Teardown preserves\n PTY retirement cleanup, escalates freshly matched process identities, and\n verifies exit before touching files. Survivors remain in the job across\n restart and Retry; missing captures and snapshot errors fail closed.\n Process-table reads are confined to archive preparation/teardown/retry, each\n subprocess bounded to five seconds. Windows uses kernel start times and\n pinned process handles; POSIX revalidates start times before individual signals.\n Create/remove also check the cleanup path guard;\n Restore is blocked until cleanup completes. Quarantine lives under\n `<git-common-dir>/pane-archive-cleanup`, separate from legacy trash sweeps.\n- Per-repo setup, run and archive scripts come from `pane.json` and friends:\n [CONFIG_FILES.md](CONFIG_FILES.md).\n- Settings › Import & Export writes and reads an allowlisted setup file in main\n (`services/setupTransfer.ts`); the renderer applies it through Settings' own\n save calls: [SETUP_EXPORT_IMPORT.md](SETUP_EXPORT_IMPORT.md).\n- Per-project environment variables (`main/src/services/projectEnvVars.ts`) are\n read at spawn time by the terminal, script and legacy CLI spawners; Pane secret\n and keychain values are read then and never stored with the project:\n [PROJECT_ENV_VARS.md](PROJECT_ENV_VARS.md).\n- Pane secrets (`main/src/services/paneSecrets.ts`, `main/src/ipc/paneSecrets.ts`)\n keep an index in `config.json` and values in the keychain or a 0600 file\n (encrypted where the OS offers it), sync with the shared keys, and reach commands only through\n `runpane secrets exec`: [PANE_SECRETS.md](PANE_SECRETS.md).\n\n## Notes\n\nNotes is experimental and off by default: Settings → Advanced → Notes\n(`notesEnabled`). While it is off, Pane hides the Notes tab type, the add-tab\nentries and the terminal's Add to notes action, shows a one-line pointer to the\nsetting in a restored Notes tab, gives new terminals an empty `PANE_NOTES_FILE`,\nleaves the scoped-notes instruction out of user agent files, and removes scoped\nnotes from repository `AGENTS.md` and `CLAUDE.md` exports. Saved notes stay on\ndisk. Turning it on restores the UI, the instruction and repository exports\nright away; terminals opened while it was off need reopening to get\n`PANE_NOTES_FILE`.\n\nLocal Notes panels use `main/src/services/notes.ts` through `main/src/ipc/notes.ts`.\nCanonical documents live in `<PANE_DIR>/notes/notes.json`, outside disposable\nworktrees. A revision check rejects stale edits; writes atomically replace the\nstore. Promotion changes the canonical scope and retains references to earlier\nscopes. The Session view derives associated project notebooks from existing Pane\nassociations. Renderer recovery drafts retain edits when an autosave fails. The borderless\neditor inserts text/drawing blocks through inline plus or slash menus; the\nsettings cog holds promotion and deletion actions. Agent visibility is automatic\nwithin scope, with no sharing controls in the editor. Restoring an archived\nPane refreshes its derived context from current project notes.\n\n`noteExports.ts` derives marked instruction sections and drawing assets from saved\ndocuments. Excalidraw scenes remain editable JSON, with PNG previews and readable\nlabels in agent-facing Markdown. Global destinations are Claude's user\n`CLAUDE.md`, Codex's user `AGENTS.md` (or existing override), and Cursor's local\n`rules/pane-memories.mdc`. Cursor CLI also receives the generated memory through\na user `sessionStart` hook (`cursorNoteHook.ts`), preserving existing hooks.\nScoped content is exported outside repositories to\n`<PANE_DIR>/notes/contexts/<pane-id>.md`. While Notes is on, each new native Pane terminal receives\nits path through `PANE_NOTES_FILE`; the user-level integration tells agents to\nread that file before each turn. Project contexts contain only that project's\nnotes plus the current feature; Session contexts contain only Session notes.\nOrdinary saves leave repositories clean. The existing `managedAgentsMd` opt-in\nadditionally exports scoped notes into repository `AGENTS.md` and `CLAUDE.md`;\nturning it off removes those memory sections.\n\nExports preserve symlinks and permissions and replace files atomically. A store\nownership marker prevents a second Pane data directory from overwriting the\nfirst directory's user memory. Malformed marker pairs produce a visible error.\nChanging notebooks only reads data. Terminals predating this update need reopening\nto gain the context environment variable. After the first scoped note, start a\nnew agent conversation to load the scoped-reading instruction. Global-file changes refresh on Codex's next\nturn, Claude resume, or a new Cursor conversation in the tested CLI versions;\nupdating a file alone cannot erase context already read. Notes support native\nmacOS, Windows, and Linux installations; WSL agent exports report an unsupported\ndestination instead of claiming delivery. There is no cross-machine sync: the\n`notes:` commands are daemon-owned, so a desktop connected to another machine\nreads and writes that machine's notes. The notes reach a machine's agents only\nwhile Notes is on for that machine: its new terminals then read them through\n`PANE_NOTES_FILE`. While it is off, the Notes tab says \"Turn on Notes on\n<machine> so its agents read these\". Only the machine's owner may use its\nnotes; a teammate on a tailnet-shared workspace is refused. The glasses cannot\nreach them. A machine on a Pane\nwithout these commands gets \"Update Pane on <machine> to use its notes\" in its\nNotes tab.\n\n## Subsystems\n\n| Area | Owner | Doc |\n| --- | --- | --- |\n| Adding an agent CLI | `main/src/services/agents/` | [ADDING_NEW_CLI_TOOLS.md](ADDING_NEW_CLI_TOOLS.md) |\n| Panels | `panelManager.ts`, `shared/types/panels.ts` | [TOOL_PANEL_SYSTEM.md](TOOL_PANEL_SYSTEM.md) |\n| Chat tabs (ACP agents without a terminal) | `main/src/services/chatTabs/`, `main/src/ipc/chatTabs.ts`, `frontend/src/components/chatTab/` | [CHAT_TABS.md](CHAT_TABS.md) |\n| Autopilot (experimental agent above every Session) | `main/src/services/autopilot/`, `main/src/ipc/autopilot.ts`, `frontend/src/components/autopilot/` | [AUTOPILOT.md](AUTOPILOT.md) |\n| Renderer updates | IPC events in `main/src/events.ts` | [STATE_MANAGEMENT.md](STATE_MANAGEMENT.md) |\n| Timestamps | `main/src/utils/timestampUtils.ts` | [TIMESTAMP_HANDLING.md](TIMESTAMP_HANDLING.md) |\n| Pane Chat and orchestration sessions | `paneChatManager.ts`, `skillCacheManager.ts`, `paneChatBundle/` | [SESSIONS.md](SESSIONS.md) |\n| Loops (scheduled tasks) | `main/src/services/loops/`, `main/src/ipc/loops.ts`, `shared/types/loop.ts` | [LOOPS.md](LOOPS.md) |\n| Approvals / Pane Notify (agent questions) | One saved list per machine, the `approvals` table in `sessions.db` (each item filed under its Session, Session-inbox items included), floating strip and round windows, tray icon in `main/src/services/notify/`; the in-Pane Approvals screen in `frontend/src/components/approvals/`; `main/src/ipc/notify.ts`, `shared/types/notify.ts`; the floating windows load `frontend/notify.html`. Desktops (one slot per saved machine, fed by `main/src/services/machineConnections.ts`) and phones read each host's queue over `notify:remote-snapshot`, `notify:remote-command` and the `notify:shared-changed` event; phone alerts go through `main/src/daemon/mobilePushSender.ts` | [PANE_NOTIFY.md](PANE_NOTIFY.md) |\n| Machine connections | `main/src/services/machineConnections.ts` holds the desktop's one connection to each saved machine; key and Pane secret sharing and the shared Approvals switch (`sharedCredentialSync.ts`) and the renderer use it; the sidebar's All machines view (`frontend/src/stores/allMachinesStore.ts`, `frontend/src/components/machines/AllMachinesSidebar.tsx`) reads every machine through it and re-reads one machine when its events arrive; its arrangement (row order and open rows) is a preference on the viewing computer (`sidebar_all_machines_layout`), never written to a machine it shows. Each host adds a `repository` identity (origin remote, normalised; `main/src/services/repositoryIdentity.ts`, read from git once per project path) to the projects in `sessions:get-all-with-projects`, and the view merges projects by it. A host's Pane order is the `sessions.display_order` column read highest first (`shared/utils/paneOrder.ts`), so Panes created before any arranging list newest first; `sessions:get-all-with-projects` serves Panes in that order. `main/src/ipc/machineConnections.ts` and `shared/types/machineConnections.ts` give the renderer `machines:list`, `machines:read` (list reads), `machines:run` (a short command list) and `machines:retry`, and push `machines:event` (events tagged with their machine, never terminal output) to windows that subscribe. This computer is the machine `local` | |\n| SSH hosts view | `sshConfigHosts.ts`, `ipc/sshHosts.ts`, `SshView.tsx` | [SSH_HOSTS.md](SSH_HOSTS.md) |\n| `runpane` CLI contract | `contracts/runpane/` | [RUNPANE_CLI_CONTRACT.md](RUNPANE_CLI_CONTRACT.md) |\n| Analytics | `analyticsManager.ts`, `frontend/src/services/posthog.ts` | [ANALYTICS_INVARIANTS.md](ANALYTICS_INVARIANTS.md) |\n| Themes | `frontend/src/styles/tokens/colors.css` | [APPEARANCE.md](APPEARANCE.md), [scripts/README.md](../scripts/README.md) |\n| Background checks (pause while nobody looks) | `main/src/services/backgroundActivity.ts` decides when Pane is away: nobody looking (no phone, remote desktop or glasses stream open, which a saved machine's Notify stream does not count as, and the screen locked or the window off screen) while the Settings › General › Power profile's condition holds (Balanced: locked, asleep or Low Power Mode; Battery saver: also on battery; Performance: never). While away, port reads (`listeningPorts.ts`) and usage indexing (`main/src/services/usage/`) pause and catch up on return; nothing an agent, Approvals or a phone push needs depends on it | |\n| Usage and cost | `main/src/services/usage/` | [usage/README.md](../main/src/services/usage/README.md) |\n| Mobile companion | `mobile/` | [NATIVE_MOBILE.md](NATIVE_MOBILE.md) |\n\n## Rules that follow from this design\n\n- Run project commands through the asynchronous `CommandRunner` and\n `CommandExecutor` (`main/src/utils/`). Await results through IPC and the\n lifecycle callers, drop results from stopped or replaced watchers, and\n serialize Spotlight checkouts with restoration.\n- For git status in WSL, watch from inside the distro: prefer `inotifywait`.\n Without it, Pane polls `git status` in the distro every five seconds while\n focused. Don't add Windows-side recursive watchers over `\\\\wsl.localhost` or\n `\\\\wsl$`.\n- Production builds must never include React Scan (`pnpm perf:scan` is dev\n only).\n\n### Chat tabs\n\n[Chat tabs](CHAT_TABS.md) are a panel kind (`chat`) whose agent runs through its\nACP adapter in a host-owned process (`main/src/services/chatTabs/`). The host\nsaves a secret-free launch and the ACP session ID, reloads the conversation on\nrestart, keeps a bounded transcript window with older messages paged from disk,\nand publishes `chat-tab:state` and `chat-tab:event` to every client. Clients\nsend `chat-tab:*` commands through the shared registry; none of them owns the\nprocess.\n\n"},{"path":"docs/AUTOPILOT.md","title":"Autopilot (experimental)","text":"# Autopilot (experimental)\n\nAutopilot is one always-running agent above every Session on a machine. Press\nStart and it analyzes everything first: every Session (open, running, idle,\nold), its Panes, workers and PRs, and every waiting item on every machine. It\nplans the order (unblock running work first, then keep active work moving,\nthen propose closing what is stale), groups the work into a few\n**workstreams** by Session, repo or feature with their approvals together,\nwrites the plan to `docs/plan.html`, and walks it. It puts each item on a\n**stack** beside its chat, one at a time, with the item's documents and app as\ntabs.\n\n**It drives the conversation (D-146).** Every Autopilot turn ends with the\nnext step it is taking or proposing; it never stops at \"I'll wait for you\".\nWhile the person hasn't answered, it carries on with what doesn't need them.\nIf its agent sits idle for 3 minutes while it runs (not paused, Sentinel off),\nPane wakes it with a hidden `[Pane · Carry on]` line, at most 3 times in a row\nuntil the person or an event starts a turn. Pause stops the driving until Go\non; turning Autopilot off stops it. It writes its own\ndocuments and approvals, passes your questions and instructions to\norchestrators, and asks orchestrators to `/wrap-up` finished work.\n\n**It works your approvals, within limits (D-149 to D-152).** See\n[What it does with approvals](#what-it-does-with-approvals-d-149-to-d-152).\nPermission prompts stay yours, and everything else it does is recorded \"by\nAutopilot\" with your Override or Reopen.\n\n## Turning it on\n\nSettings › Advanced › Experimental › **Autopilot**. It needs **Chat tabs** on\n(Settings › AI & Agents),\nbecause its agent is a chat tab on your own installed `claude` and its\nsign-in: with Chat tabs off, the switch can't be turned on (it can still be\nturned off). Turning it on adds an **Autopilot** row to the sidebar's top\nlist, below Loops and directly above Approvals, in the one-machine sidebar\nand in All machines alike. Opening\nAutopilot never starts an agent turn: it shows **Start**.\n\n- **Pause** stops it from bringing new items. **Go on** resumes it.\n- Turning it off stops the agent. Its run, stack and conversation are kept.\n Turning it on again picks up the same run.\n- **New Autopilot Session** starts a fresh run, with a new folder and an\n empty stack. The old run's documents stay where they were.\n- After Pane restarts, the current run shows Start again, with its stack and\n folder kept.\n\n## Your instructions (D-196)\n\nWhile Autopilot is on, Settings › **Autopilot** has a **Your instructions**\nbox: how you want it to work, for example \"group things by repo\", \"always ask\nbefore closing anything\", \"be brief\" or \"focus on Bloom first\". They are kept\nin a plain file on the machine Autopilot runs on,\n`<PANE_DIR>/autopilot/instructions.md`, which you or a script can edit too.\n\n- Autopilot reads them after Pane's own rules, labelled as yours: in its\n run's AGENTS.md (a section after Never) and in the Start line.\n- Saved while it runs, they reach it at once as a `[Pane · Instructions]`\n line (shown in its chat as \"Your instructions updated\"), and the box says\n **Applied**. An edit to the file itself is picked up the same way within a\n couple of seconds; while Autopilot is paused, it reaches it at **Go on**.\n While it is stopped the box says **Applies on next Start**.\n- They shape how it works but never override its hard limits: it never\n answers an approval or a permission prompt, and never merges, deletes,\n pushes or closes anything without your word.\n- **View built-in instructions** shows what they add to (AGENTS.md, the Start\n line and the pane-autopilot skill), read-only. **Reset** clears yours.\n- In Autopilot's chat you can say \"from now on, group things by repo\":\n Autopilot offers to add that line as its own approval, with the exact text,\n and adds it only when you approve.\n- Longer than 20,000 characters is refused with\n `AUTOPILOT_INSTRUCTIONS_TOO_LONG`, and nothing is saved.\n\nAutopilot is a paid feature (D-65). Every way it turns on or starts goes\nthrough one entitlement check\n(`main/src/services/autopilot/entitlement.ts`). For now it allows everyone,\nwith no account or network call. To check the refusal path, start a dev build\nwith `PANE_AUTOPILOT_ENTITLEMENT=denied`. Turning it on and Start then refuse\nwith `AUTOPILOT_NOT_ENTITLED`, and the switch can't be turned on.\n\n## Where its data lives\n\nAutopilot is not a Session. It has its own store, apart from Sessions, and\nSession cleanup and `/wrap-up` never touch it:\n\n```\n<PANE_DIR>/autopilot/\n current # the active run's id\n instructions.md # your own instructions (Settings › Autopilot), for every run\n runs/<run-id>/\n AGENTS.md # its instructions; points to the pane-autopilot skill\n CLAUDE.md # @AGENTS.md\n docs/ # every document Autopilot writes\n stack.json # the stack (references only: item ids, paths, URLs, Session ids)\n state.json # last state and where the walk is\n run.json\n log # one line per action, for people reading the folder\n```\n\nIts agent runs as a chat tab in a hidden, detached owner Pane\n(`__autopilot_owner_<run-id>`) whose workspace is the run folder. That Pane has\nno project, no Session record and no associations. Other machines' items show\non the stack, read live through the workspace. Nothing from them is copied\ninto the folder.\n\n## What it does with approvals (D-149 to D-152)\n\nThere is no setting for this: it is how Autopilot works, in its skill, and it\ntakes its cues from you (\"leave those to me\", \"handle the approvals\"). By\ndefault, Autopilot:\n\n| It… | Recorded on the item, on every device |\n| --- | --- |\n| surfaces approvals from every machine, grouped so you can talk them through | |\n| closes the ones that don't matter or that it judges stale; you can reopen them | \"Closed by Autopilot: <reason>\" |\n| may close an unclear one and re-ask it rewritten; the answer goes to the original asker | \"Closed by Autopilot: rewritten as …\" on the old one, \"Rewritten by Autopilot from Q-n\" on the new one |\n| answers only when the way forward is clear and the item relates to what it's working on with you, or when you tell it to handle approvals | \"Answered by Autopilot · because <D-n, document or your words>\", with **Override** |\n| reads a typed reply its asker can't (D-258): takes it as an answer with `runpane notify --took`, or as a question, then finds out and sends a new version with `runpane notify --update` ([Replies](PANE_NOTIFY.md#replies-and-new-versions)) | \"Autopilot is reading your reply…\", then \"Taken as your answer\" or \"Updated · ready again\" |\n| never answers a permission prompt, or types raw keys into another tab | refused in code ([The guard](#the-guard-d-149)) |\n\nAn answer is delivered at once, with no hold. Override sends your answer to the\nasker as a correction, recorded on the item. Sentinel follows the same rules.\n\n**Its queue (D-168).** Its watch tells it of approvals made outside its chat,\nand `runpane autopilot waiting` is the queue: read from each machine's table,\nwith no copy. It tells you a count and brings in one group at a time, related\nitems together; when a group is finished it brings the next. An item answered\nor closed elsewhere just leaves the queue.\n\n**Across machines (D-165).** An approval lives on the machine where its creator\nruns, and Autopilot's own on Autopilot's machine (from the phone, that's the\ndesktop the phone is talking to). Autopilot reads every connected machine, and\nits answers and closes go to the owner, which records them \"by Autopilot\"; a\nrewrite stays on the old item's machine. The owner takes the first answer or\nclose, so a later one, from another Autopilot or from you, is refused with\n\"already answered by …\" and changes nothing. A saved machine it can't reach\nshows as \"<machine> offline\", and an answer aimed at it is refused with nothing\nqueued. One of your Tailscale machines not saved here shows as \"Can't see:\n<machine>\": a machine reads only the machines it has saved, so add it there. An\nowner too old for these commands is reported as needing an update.\n\n## In the chat and on the right (D-91)\n\n- **The question lives in the chat.** Each item Autopilot brings is a\n decision card in its chat: what it is, its Q-n, Session and who asked; the\n question and its one-line why; and the options, the recommended one first\n and marked, each with its one-line detail. Choosing an option answers it.\n The same card shows on the phone. The card that is current shows in full;\n the others in a message are one line until you click them. If the current\n item isn't in any message in view, its card is docked above the composer.\n- **The right side shows only the current item's context**, as tabs: its\n documents (HTML renders as a page, any other file as text), the app (a\n URL), a Session's overview. It never holds the question or answer buttons.\n A page follows Pane's theme, not the Mac's (D-163): whenever the page's\n `prefers-color-scheme` differs from Pane's light or dark, Pane swaps dark and\n light in the page's `prefers-color-scheme` rules (`guestColorScheme.ts`), so\n a document with dark styles shows dark whenever Pane does. Script in the page\n that asks `matchMedia` still gets the Mac's answer. Pane never attaches a DevTools\n debugger for this: one that stays attached crashes Electron 43 when the page\n closes (electron/electron#53376, D-216); any debugger goes through\n `attachDebugger` (`main/src/services/debuggerLifetime.ts`).\n- **One at a time (D-71).** Items come in the order Autopilot puts them on\n its **stack**. New ones wait and never replace the current one. When you\n answer the current card, the next one becomes current and the right side\n follows it. **‹ ›**, **← →** (when you aren't typing) and the header chips\n step through everything on the stack.\n- The right side's header (what it is, its Session, its title, its tabs)\n never moves. Long text and banners scroll below it (D-72).\n- **What's waiting** lists every waiting item. Picking one makes it current.\n- Answering shows \"by you\" on the card, with the Approvals Undo window.\n\nAutopilot's own approvals are violet and marked \"written by Autopilot\". In\nthe Approvals screen they appear under an **Autopilot** group.\n\n## On the phone (D-75 to D-77)\n\nThe phone shows the same Autopilot as the computer it is on, over the\nhost connection (`autopilot:*` channels, the `autopilot:changed` event). There\nare no tabs on the phone.\n\n- **Home** has an **Autopilot** bar above **Needs you** while Autopilot is on\n for that computer. Before Start it reads \"Walk these with Autopilot\" and\n carries **Start**, which starts Autopilot and opens it; then it says Paused,\n or what it is walking, with how many items are open on the stack. A computer\n whose Pane predates Autopilot shows no bar.\n- **The Autopilot screen** is its chat tab, with the walk bar above it:\n Running or Paused, every Session with what waits in it (the current one\n violet), and **Pause** or **Go on**. Opening it never starts a turn: until\n Start it shows **Start**. Pane's `[Pane · Start]`-style lines show as short\n notices.\n- **Decision cards.** Each item Autopilot names in an `autopilot-items` block\n is a card in the chat (the same `shared/autopilotDecision.ts` model as the\n desktop card). Tapping an option answers it at once, through Approvals'\n path (`notify:remote-command`), so the computer sees it as soon as it lands;\n the card then shows the answer and its Undo window, and later\n \"by you · <Session> recorded it\". **More context and related docs** opens\n the approval full screen.\n- **The approval full screen**: \"‹ Chat\" and \"n of N · Session\" (n of N counts\n the items on the stack), the decision, then **More context** (\"Why I'm\n asking\", written by Autopilot, on its own items) and **Related docs**, which\n open and close. The answer buttons are fixed at the bottom: two options are\n buttons, more are picked above, an open question takes typed text.\n Answering goes back to the chat where you were.\n- **A document** opens full screen with nothing to answer, and \"‹ Back to Q-14\n to answer\" returns to the approval. HTML files are read through the phone's\n connection (`autopilot:read-doc` with `{ inline: true }`); a page loads the\n way page tabs do. Only files on the stack, in the run's folder, or linked\n from a waiting item open.\n- Phone builds without chat tabs (runtimes before 1.4) never show Autopilot:\n its owner Pane is hidden and they don't know its channels. Every 1.4 build\n gets this over the air. \"Try a demo\" has a sample Autopilot.\n\n## Sentinel Mode (package 7, D-93)\n\nA toggle in Autopilot's header (desktop and phone) for when you step away.\nTurning it on also starts Autopilot; the sidebar row reads \"Sentinel\" while it\nis on, and the walk bar says how many Sessions it keeps moving.\n\n- Every 5 minutes, while Autopilot is idle and not paused, Pane wakes it with a\n `[Pane · Sentinel check]` line (hidden in the chat).\n- It answers orchestrators' questions that a plan, a decision or a clear\n recommendation settles, citing the source; works approvals by the rules\n above; nudges a Session that has been quiet 10 minutes with open work (at\n most 2 per Session per hour, then it asks you); and sends everything else to\n you as its own approval, which pushes to your phone. It never answers\n permission prompts, merges, archives or creates Sessions.\n- Each call shows in the chat as it happens (an `autopilot-log` block) and goes\n in `docs/away-log.html`. Turning Sentinel off posts a **While you were\n away** card (`autopilot-away`) with **Tell a Session otherwise** and the log.\n So does opening Autopilot (the desktop view, Pane coming to the front on it,\n or the phone screen) with Sentinel left on, whenever its away log has calls\n you haven't seen, however short the time away: Pane sends `[Pane · Back]`\n (`autopilot:opened`), and the card covers the calls since the last one. No\n new calls, or a stopped Autopilot, sends nothing.\n- After a Pane restart Sentinel is off. Pane asks you, as a push, \"Sentinel\n stopped: Pane restarted\", with \"Turn Sentinel back on\".\n- If Autopilot's agent exits on its own (it crashes, or the CLI quits),\n Autopilot stops too: Sentinel goes off, the checks end, and the view shows\n Start again. When Sentinel was on, Pane pushes \"Autopilot stopped: its agent\n exited\", with \"Start again with Sentinel\".\n- The rules are instructions in the `pane-autopilot` skill; Pane runs only the\n toggle, the timer and the restart and exit questions. `autopilot:sentinel` (true or\n false) is the channel both screens use.\n\n## From a brain-dump to Sessions (D-92)\n\nGive Autopilot a pile of ideas and it sorts them into workstreams, writes\n`docs/workstreams.html` (each proposed Session with its ideas and first\nbrief, new or existing), and asks \"Start N workstreams?\" as its own\napproval. Only after you choose \"Create them\" does it create each Session\n(`runpane sessions create`, an orchestrator only) and send its first brief,\nmarked `[From Autopilot]`. It keeps at most 2 Sessions it created working at\nonce, and waits while the machine is busy. These limits are instructions in\nthe skill; Pane does not enforce them yet.\n\n## How the agent works\n\nAutopilot follows the Pane-shipped `pane-autopilot` skill\n(`main/src/services/paneChatBundle/skills/pane-autopilot/SKILL.md`). Its\ncontrols reach it as `[Pane · Start]`, `[Pane · Pause]`, `[Pane · Go on]`,\n`[Pane · Carry on]` and `[Pane · Instructions]` lines. It uses:\n\n- `runpane autopilot waiting --json`, its queue: every waiting item on every\n machine it can reach, this machine's by Session in sidebar order, with\n `quiet`, `stale` and `connected` on each, and the `offline` and `cantSee`\n machines.\n- `runpane autopilot answer <id> (--choice <label> | --approve | --deny |\n --text <text>) --because <why>`, `runpane autopilot close <id> --reason <why>`\n and `runpane autopilot rewrite <id> --ui ... --title ...`, on the machine that\n holds the item. Anyone but Autopilot is refused with `AUTOPILOT_ONLY`.\n- `runpane autopilot stack push --item <id> [--next]` to put an item on the\n stack. It also takes `--file`, `--url` or `--session` instead of `--item`.\n `--next` puts a higher Session's new item right after the one on screen\n (D-59, \"jumping back up\"). While paused, a push from Autopilot is refused\n with `AUTOPILOT_PAUSED`.\n- `runpane watch --as autopilot --kinds item.created,item.answered,session.created,session.archived,orchestrator.turn_ended --until-event --json`\n to wake on change, under its own cursor. See\n [SESSIONS.md](SESSIONS.md#autopilots-kinds).\n- `runpane panels submit` / `panels wait --for idle` / `panels last-message`\n to ask an orchestrator, with the message marked `[From the person, via\n Autopilot]`. Every Session's fixed capability text accepts such a message\n as the person's own question or instruction, `/wrap-up` included. It never\n counts as an answer to an approval, and answering one goes through `runpane\n autopilot answer`. Autopilot's own messages are marked\n `[From Autopilot]`; an orchestrator replies to whoever asked and still\n sends anything the person must decide to them as an approval.\n\nThe seven `runpane autopilot` commands are also MCP tools in the `autopilot`\ntoolset ([PANE_MCP.md](PANE_MCP.md)). With Autopilot off, all but `status` fail\nwith `AUTOPILOT_OFF`, saying how to turn it on;\n`status` reports `enabled: false` (its plain output also says how to turn it\non; `--json` gives only the state).\n\n## The guard (D-149)\n\nrunpane sends the caller's Pane and tab (`PANE_SESSION_ID`, `PANE_PANEL_ID`)\non every daemon request (`caller` on the request frame; older builds leave it\nout). Autopilot acts on approvals only through `runpane autopilot answer`,\n`close` and `rewrite`, which record it, and `runpane notify --took` and\n`--update` on a reply it reads; the machine that holds the item refuses\nthem for a permission prompt (`AUTOPILOT_CANNOT_ANSWER`), Claude tool permissions\nand Bypass changes included. A guard on the command registry refuses every other\nanswer route when the caller is Autopilot's tab or owner Pane, since those\nwould read as the person's:\n\n- `notify:remote-command` answer, undo, close, reopen and override, and dismiss,\n skip and remind (hiding or putting off a card is the person's call too)\n- `permission:respond`\n- `chat-tab:permission` and `chat-tab:answer` for any other tab\n- every raw-input route: `runpane:panels:input`, `terminal:input`,\n `terminal:paste-file`, `terminal:paste-image`, `panels:send-input`,\n `panels:send-terminal-input`, `sessions:input`, `sessions:send-terminal-input`\n- `runpane:panels:submit` and `submit-composer` to a tab with a waiting permission prompt\n\nSending a chat message to another chat tab (`chat-tab:send`) is allowed: it\nqueues a message and never answers that tab's pending prompt, whose own answer\nroutes are refused above.\n\nThe caller also travels with `runpane workspace <machine> ...` requests\n(`caller` on the `/invoke` body), so another machine's guard refuses the same\nroutes.\n\nPane's own UI, phones and other screens send no caller, so you are never refused. The check relies on\nthe environment Pane gives its agents. It stops Autopilot on every normal\nroute. It is not a security boundary against an agent that deliberately\nrewrites its own environment.\n\n## Code map\n\n| Part | Where |\n| --- | --- |\n| Manager, store, stack, entitlement, events | `main/src/services/autopilot/` |\n| Channels (`autopilot:*`, `runpane:autopilot:*`) and the guard | `main/src/ipc/autopilot.ts` |\n| Types | `shared/types/autopilot.ts` |\n| Desktop view, stack, sidebar row | `frontend/src/components/autopilot/` |\n| Settings › Autopilot (your instructions) | `frontend/src/components/settings/categories/AutopilotSettings.tsx` |\n| Phone: home's Autopilot bar, chat with cards, approval and document screens | `native/src/features/autopilot/`, routes in `native/src/app/autopilot/` |\n| CLI | `packages/runpane/src/autopilot.ts`, `packages/runpane-py/src/runpane/autopilot.py` |\n| Journeys (scripted agent) | `tests/autopilot.spec.ts` (`pnpm test:chat-tabs`) |\n"},{"path":"docs/BUILDING_ON_WINDOWS.md","title":"Building Pane on Windows","text":"# Building Pane on Windows\n\nThis document explains how to build Pane for Windows.\n\n> **Note:** The primary native modules (`@lydell/node-pty` and `better-sqlite3-multiple-ciphers`) have prebuilt binaries for Windows.\n\n## Quick Start\n\n```bash\n# Build for x64 (recommended for most users)\npnpm run build:win:x64\n\n# Build for ARM64\npnpm run build:win:arm64\n```\n\nOutput files will be in `dist-electron/`:\n- `Pane-{version}-Windows-x64.exe` - x64 installer\n- `Pane-{version}-Windows-arm64.exe` - ARM64 installer\n\n## Prerequisites\n\n1. **Node.js** - 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x)\n2. **pnpm** - v10\n3. **Python** - v3.x (for native module compilation)\n4. **Visual Studio Build Tools** - With C++ workload\n\n### Installing Visual Studio Build Tools\n\n```bash\n# Using winget\nwinget install Microsoft.VisualStudio.2022.BuildTools\n\n# Or download from:\n# https://visualstudio.microsoft.com/visual-cpp-build-tools/\n```\n\nMake sure to install the \"Desktop development with C++\" workload.\n\n## How the Build Works\n\nThe Windows build uses a custom script (`scripts/build-win.js`). It:\n\n1. Downloads the Electron prebuilt for `better-sqlite3-multiple-ciphers` for the target architecture, or compiles its pinned source with `@electron/rebuild` for that exact Electron version and architecture when the prebuilt is unavailable. The resulting PE architecture must match the target.\n2. When building for a different architecture than the host, installs the matching `@lydell/node-pty-win32-<arch>` prebuilt package.\n3. Builds the frontend and main process, injects build info, and generates notices.\n4. Runs electron-builder with native module rebuild disabled.\n5. Checks the icons in the packaged app.\n\n### Why These Steps\n\n#### better-sqlite3-multiple-ciphers Electron Prebuilt\n\n**Problem:** When using `pnpm install --ignore-scripts`, the `prebuild-install` postinstall script doesn't run, so the package gets the wrong binary (Node.js ABI instead of Electron ABI). This causes \"is not a valid Win32 application\" errors at runtime.\n\n**Solution:** The build script runs `prebuild-install` with the correct Electron runtime and version. If the upstream release lacks that ABI/architecture combination (for example Electron 43 / ABI 148 / Windows ARM64), it builds the pinned package from source using the existing `@electron/rebuild` tool. Install Visual Studio 2022 C++ build tools, including the ARM64 compiler when cross-compiling. A failed rebuild or mismatched PE architecture stops packaging; the script never substitutes a host-architecture binary.\n\n#### Cross-Architecture node-pty\n\n**Problem:** pnpm only installs the `@lydell/node-pty` platform package that matches the host architecture.\n\n**Solution:** For cross-architecture builds, the build script downloads the target platform package and links it into `node_modules`.\n\n#### Native Module Rebuild\n\n**Problem:** Rebuilding native modules for Electron can fail on Windows due to pnpm path issues.\n\n**Solution:** The build script disables npm rebuild (`--config.npmRebuild=false`) and relies on:\n- Downloaded or explicitly source-built Electron binaries for `better-sqlite3-multiple-ciphers`, checked against the target PE architecture\n- Prebuilt platform packages for `@lydell/node-pty` (no rebuild needed)\n\n## Manual Build Process\n\nIf the build script fails, you can try these manual steps:\n\n### Step 1: Install dependencies without running scripts\n\n```bash\npnpm install --ignore-scripts\n```\n\n### Step 2: Download Electron prebuilt for better-sqlite3\n\n```bash\n# Navigate to the better-sqlite3-multiple-ciphers package directory\ncd node_modules/.pnpm/better-sqlite3-multiple-ciphers@*/node_modules/better-sqlite3-multiple-ciphers\n\n# Download the Electron-compatible prebuilt (replace 43.8.3 with your Electron version)\nnpx prebuild-install --runtime electron --target 43.8.3 --arch x64 --verbose\n\n# Return to project root\ncd -\n```\n\n### Step 3: Build\n\n```bash\npnpm run build:frontend\npnpm run build:main\npnpm run inject-build-info\npnpm run generate-notices\npnpm exec electron-builder --win --x64 --publish never --config.npmRebuild=false\n```\n\n## Troubleshooting\n\n### Error: `node-gyp failed to rebuild`\n\nTry building with `--config.npmRebuild=false` to skip native module rebuild:\n```bash\npnpm exec electron-builder --win --x64 --publish never --config.npmRebuild=false\n```\n\n### Error: `better_sqlite3.node is not a valid Win32 application`\n\nThe better-sqlite3 native module was built for Node.js instead of Electron. Run the prebuild-install step:\n```bash\ncd node_modules/.pnpm/better-sqlite3-multiple-ciphers@*/node_modules/better-sqlite3-multiple-ciphers\nnpx prebuild-install --runtime electron --target 43.8.3 --arch x64 --verbose\n```\n\n### Native modules not working at runtime\n\nIf the app crashes due to native module issues:\n1. Ensure you're running on the same architecture you built for\n2. Verify the better-sqlite3 prebuilt was downloaded for Electron (see above)\n3. Check that Python and Visual Studio Build Tools are properly installed\n\n## Architecture Notes\n\n### x64 vs ARM64\n\n- **x64 build**: Works on both x64 and ARM64 Windows (ARM64 uses emulation)\n- **ARM64 build**: Native performance on ARM64, but requires ARM64 native modules\n\nFor most users, the x64 build is recommended as it works on all Windows machines.\n\n### Native Module Compatibility\n\nThe following native modules are used:\n- `better-sqlite3-multiple-ciphers` - SQLite database (has Windows Electron prebuilts)\n- `@lydell/node-pty` - Terminal emulation (has Windows x64 prebuilts, validate after each Electron major upgrade)\n\nPrebuilt availability depends on the Electron ABI and target architecture. SQLite falls back to source compilation when necessary; node-pty uses the matching platform package. The Windows ARM64 build workflow exercises the installer build, but running the ARM64 app still requires an ARM64 machine.\n\n## CI/CD\n\nFor CI/CD pipelines, use:\n```bash\nnode scripts/build-win.js x64\n```\n\nThis runs all of the steps above.\n"},{"path":"docs/CHAT_TABS.md","title":"Chat tabs","text":"# Chat tabs\n\nA chat tab runs a coding agent as a conversation, with no terminal. Pane is an\n[Agent Client Protocol](https://agentclientprotocol.com) (ACP) client. Any\nagent in the agents config with a `chat` section can run in a chat tab\n([Agents](#agents)): Claude and Codex through Pane's bundled ACP adapters,\nCursor and OpenCode as their own CLI in ACP mode. A chat tab stays a chat:\nthere is no move back into a terminal. A terminal agent tab can move the other\nway with **Switch to chat** (below). The *In a terminal* entries of the + menu\nopen terminal agent tabs, as before.\n\nA fresh install starts with chat tabs on. An existing install keeps the setting\nit had, so one that never turned them on stays off until you switch\n**Settings → AI & Agents → Chat tabs**. While they are off, the + menu has no chat\nentries and new Sessions open their orchestrator in a terminal. Open chat tabs keep working.\n\n## Opening one\n\n- **Desktop**: the + menu lists, under *New tab*, each chat agent installed on\n the Pane's machine, **Agent Farm profile…** and **More agents…** (which opens\n Settings → Agents), then *In a terminal*: the terminal agents and a plain\n Terminal. The menu reads the host's agent catalog again each time it opens,\n so an agent installed meanwhile shows up. The empty Pane screen offers the\n same.\n- **Remote PWA** and **phone**: *Add Tool* lists the host's installed chat\n agents and **Agent Farm profile…** first when the host has chat tabs on.\n- **Agent Farm profile…** asks for a profile name and optional arguments, one\n `key=value` per line, and opens the chat tab on the Pane's machine exactly as\n `--agent-farm <profile> --arg key=value` does. The name is typed, not picked:\n `agent-farm profiles list` prints no machine-readable list. An unknown profile\n shows Agent Farm's error in the dialog and opens nothing.\n- **runpane**: `runpane panels create --pane <id> --chat --agent <id>`, or\n `--agent-farm <profile> [--arg key=value …]` for an Agent Farm profile.\n With `--chat`, `--agent` takes any agent id; the host refuses one it cannot\n run. `--initial-input` is the first prompt, sent once.\n- **Sessions**: with chat tabs on, a new Session runs its orchestrator in a\n chat tab for any chat agent, Cursor and OpenCode included (see\n [SESSIONS.md](SESSIONS.md)).\n\n## Agents\n\nEach agent is an entry under `agents.entries` in `contracts/runpane/contract.json`\n(schema: `$defs/agent` and `$defs/agentChat` in `contracts/runpane/schema.json`).\nIts `chat` section says how its chat starts:\n\n| Agent | Runs as | Full access | Switch to chat |\n| --- | --- | --- | --- |\n| Claude | bundled `claude-agent-acp` running `claude` | session mode `bypassPermissions` | yes, sure of the conversation |\n| Codex | bundled `codex-acp` running `codex` | session mode `agent-full-access` | yes, most recent conversation |\n| Cursor | `cursor-agent acp` | launch flag `--force` | no |\n| OpenCode | `opencode acp` | Pane answers each approval | yes, most recent conversation |\n\nThe host's agent catalog (`chat-tab:agents`,\n`main/src/services/chatTabs/agentCatalog.ts`) lists the agents this machine can\nopen as chats, for every client: label, icon, whether the CLI is installed, its\ninstall page, who gives full access (the agent, or Pane), and whether **Switch\nto chat** works and why not. Capabilities (reopens chats, lists past chats,\nimages) and the version come from each agent's last ACP `initialize` reply,\nkept in `chat-agent-capabilities.json` in Pane's data folder, so an agent shows\nnone until its first chat starts. The desktop + menu, the empty Pane screen,\nthe PWA + menu and the phone's Add Tool sheet offer the installed ones.\n\n**Settings → Agents** lists every agent in the catalog with what it supports,\nits version once known, and an **Install** link for one that is not\ninstalled.\n\n## Agents from the ACP Registry\n\nBelow Pane's own agents, **Settings → Agents** lists the\n[ACP Registry](https://agentclientprotocol.com) (its URL is the agents\nconfig's `registryUrl`). Pane reads the index at most once an hour, when the\npage opens or an installed agent launches; **Refresh** on the page reads it now.\nIt keeps the last copy in `agent-registry/registry.json` in Pane's data folder.\nWith no copy and no connection, installed agents still show, with Remove.\n\n- **Listed**: agents published as a download for this computer or as an npm\n package. Agents published only for `uvx` are left out (Pane ships no Python\n toolchain), and so are ones a configured agent covers (its `chat.registryIds`).\n- **Install** puts the registry's current version in\n `agent-registry/agents/<id>/<version>/`. A download is checked against the\n sha256 the registry publishes and refused when it differs. A download with no\n checksum installs only after you confirm you trust it; later versions of that\n agent then install without asking again. An npm package installs\n with your own `npm` and runs with your own Node.js; without them the row says\n **Needs Node.js**. A failed install shows its error on that agent's row only.\n- **Updates**: an installed agent moves to the registry's newest version on its\n next launch, with no prompt, and the older version's folder is removed once the\n new one starts and no other tab still runs the old one. When the registry cannot be read or the update fails, the\n installed version runs.\n- Installed agents join the + menu after Pane's own agents, marked\n **Full access by Pane** (Pane answers each approval with allow once when full\n access is on). They have no terminal tab, so they have no Switch to chat.\n **Remove** deletes every version; it is refused while a chat tab runs the\n agent. An installed agent the registry stops offering stays in the list,\n marked **No longer listed**, so it can still be removed.\n- Installing or removing an agent is refused for a teammate's Pane: it runs code\n on the owner's machine.\n\n## Switching a terminal tab to chat\n\n**Switch to chat** (right-click a terminal agent tab, or the command palette)\ncontinues the terminal's conversation in a chat tab (D-129, D-184, D-229,\nD-282). It works for agents whose config sets `chat.terminalConversationsLoad`\n(Claude, Codex and OpenCode). It asks with one plain confirmation and never\nsends anything to your agent. The menu of a tab running any agent in the\ncatalog always shows it (D-337): with chat tabs off it is greyed out with\n**Turn on chat tabs** below it; for an agent whose chat can't load its\nterminal's conversations (Cursor) it is greyed out with that reason; and a chat\ntab shows it greyed out as already a chat. The command palette offers it only\nwhen the switch can run.\n\nRight-click a Session in the sidebar (or on All machines, where it runs on the\nSession's own machine) and choose **Switch to chat…** to switch every terminal\nagent tab in it: the orchestrator, and the agent tabs of each Pane in it (all of\na Pane's tabs when the whole Pane is in the Session, otherwise only the tabs\nadded to it). A dialog\nfirst lists the tabs that will switch and the ones it will skip, with why (busy\nmid-turn, a tab Pane isn't sure of the conversation for, which includes every\nterminal of an agent other than Claude, not an agent, a launch chat can't run). A Session switch opens\nonly conversations Pane is sure of; switch an unsure tab from its own menu to\nget the most recent one and **Pick another**. A Pane's terminal dock is\nnot a tab and isn't listed. Pane then switches them one at a time the same way\nas one tab, so a tab that fails is put back the way one tab's switch puts it\nback and the others carry on,\nand the dialog ends with a summary such as \"4 switched, 1 skipped: busy\". Each\ntab is checked again just before it switches; one that wasn't on the confirmed\nlist (busy then, or opened since) is left as it is. The item is always in the\nSession menu (D-337): it shows a spinner and \"Checking…\" while the Session's\nmachine looks, then greys out with why when nothing can switch (\"Nothing to\nswitch: 2 busy, 1 no saved conversation\", or \"Chat tabs are off on build-box\"). When chat\ntabs are off on this window's own host, **Turn on chat tabs** sits below it;\nit turns them on and closes the menu, and the menu checks again each time it\nopens.\n\n**Which conversation opens.** Only Claude's terminal reports its conversation\n(`terminal.reportsConversation` in its config). Pane learns it from Claude\nCode's `SessionStart` hook, which fires on start, `/resume`, `/clear` and\ncompact (D-269). Pane adds the hook to plain `claude` tabs through the tab's\n`--settings` file, and Agent Farm ships it in the plugin it compiles for every\nClaude it launches. The hook runs `runpane panels conversation --hook`, which\nrecords the conversation on the tab and as the one its next restart resumes.\nPane never asks the running Claude.\n\n- **Sure**: the hook reported since the terminal's current launch started. The\n chat loads that conversation with ACP `session/load`, with its history and no\n banner. If it has no messages yet, the chat starts new with a \"Started a new\n conversation\" note instead.\n- **Not sure**: no report from this launch (a terminal started before the update\n or by an older Agent Farm, WSL and SSH tabs) and every terminal of another\n agent (Codex, OpenCode). The chat\n lists the folder's conversations (ACP `session/list`), leaves out any open in\n another Pane tab on this machine, and opens the newest, with the banner\n \"Opened the most recent conversation here\" and **Pick another**. The terminal\n has just stopped, so its own conversation counts, and it is usually the one.\n With none left the chat starts new with a note; if listing fails (for example\n Codex signed out), or every one of the newest 2,000 is open elsewhere, it\n starts new and says why. Two chats opened at once never get the same one.\n\nNothing is touched when a turn is in progress (Pane asks you to wait or stop\nit) or when the launch can't be kept: the chat gets the plain agent, whose\nterminal full-access flags become the chat's full access, or the Agent Farm\nprofile and its args (a Session's own saved launch for its orchestrator). The\nagent's other default terminal flags (`terminal.args`, such as Cursor's\n`--trust`) are accepted and dropped. A `--model` flag becomes the chat's model,\nand Claude in a Session's Pane keeps its read-only Session folder access\n(`--settings` there, `claudeCode.options.settings` here). Any other flag or a\nwrapper command is refused by name.\n\nOtherwise Pane stops the terminal agent, opens the chat tab, then closes the\nterminal tab. The chat takes the terminal's exact place in the tab order and is\nselected. A Session's orchestrator becomes its chat tab.\n\nIf the chat fails after the terminal stopped, the dialog says what happened,\nwith **Try again** (the reason is also in Pane's log, as `[ChatTabs]`), and the\nchat tab is removed. When Pane was sure, the terminal restarts on that\nconversation (\"The chat couldn't open it … The terminal is back on the same\nconversation\"); if that restart fails too, it says the terminal is stopped and\nthe conversation is saved. When Pane wasn't sure, or the conversation had no\nmessages, the terminal stays stopped (\"The chat couldn't start\"), since a\nrestart could open the wrong conversation or start an empty one. A terminal\nrestarted in place redraws at once. In the rare case that the chat has the\nconversation but the Session could not move to it, or the terminal tab could not\nbe closed, the dialog says so and both tabs stay, since removing either could\nlose the Session's tab. Pane rebuilds no telemetry for the switch.\n\nA terminal Codex that runs through Codex's shared background service\n(`codex app-server daemon`) stays that thread's writer after the terminal stops,\nso loading it in chat fails with \"in use by another Codex client\".\n\n## Continuing a past conversation (/resume)\n\nAny chat tab can continue another conversation from its folder. Type `/resume`\n(the composer menu lists it as Pane's own, since Claude Code hides its `/resume`\nfrom chat and Codex has none) or press **Pick another** on the banner. The\npicker lists the folder's conversations newest first, with a filter. The tab's\nown is marked \"open here\"; one open in another Pane tab shows \"Open in tab …\"\nand can't be picked, so two processes never write one conversation. Picking one\nreloads the tab on it with its history; the tab keeps its Session. Picking is\nrefused while the agent is in the middle of a turn, and while messages wait in\nthe queue, since they were written for the current conversation (remove them or\nlet them send first). Pane lists up to the newest 2,000 conversations of a\nfolder; past that the picker says older ones aren't shown. A conversation running\noutside Pane (a plain shell `claude`) can't be detected and is listed like any\nother. The picker works in the desktop chat tab, the Autopilot view and the\nremote web app.\n\n## Where the agent runs, and sign-in\n\nThe agent runs on the tab's host: this computer for a local Pane, the other\nmachine for a Pane on a connected machine. Clients (desktop, PWA, phone) only\nshow the conversation and send messages.\n\nA chat tab always runs the person's installed, unmodified CLI, found on the\nsame PATH terminal agent tabs use (`main/src/services/chatTabs/launch.ts`). A\nbundled adapter gets it through the variable its config names\n(`chat.adapter.executableEnv`: `CLAUDE_CODE_EXECUTABLE` for Claude, `CODEX_PATH`\nfor Codex). An agent with `chat.args` runs as its own CLI with those arguments\n(`cursor-agent acp`, `opencode acp`). Pane never uses a bundled copy of an\nagent CLI, never reads, stores or relays an agent's login, and never copies one\nbetween machines.\n\n- **Not signed in**: the tab stops and says so, with **Sign in in\n Terminal**, which opens a terminal tab on that machine running the agent's\n advertised terminal sign-in (an agent running as its own CLI), or its\n executable with the config's `signIn` arguments (`claude auth login`,\n `codex login`). Press **Retry** after signing in. The tab never retries alone.\n- **Not installed**: the tab says so with the command that installs it.\n- **API key (optional)**: Settings → AI & Agents → *Chat tab sign-in* keeps one\n key per agent whose config names `chat.apiKeyEnv`, in the OS secure store on\n that machine (Electron `safeStorage`, `chat-tab-keys.json`, a map by agent\n id), and passes it only as those env variables (Claude `ANTHROPIC_API_KEY`;\n Codex `OPENAI_API_KEY` and `CODEX_API_KEY`; Cursor `CURSOR_API_KEY`). OpenCode\n takes none. A key is never synced or sent to clients.\n The key is the owner's: a teammate (another login on the tailnet, when the\n host is set to \"Everyone on tailnet\") cannot save or remove it, and a chat\n tab a teammate opens starts without it or the project's secret variables,\n including after the owner switches that teammate's terminal to chat.\n A teammate cannot run Sign in for a chat tab either. Saving a key needs Chat\n tabs on; removing one always works.\n\nChat tabs don't run in WSL projects or on SSH hosts.\n\n## Adapters and versions\n\nThe adapters ship inside Pane as exact dependencies in `package.json`:\n`claude-agent-acp` 0.100.0 and `codex-acp` 2.5.0. Nothing is downloaded.\n`scripts/verify-chat-adapters.js` fails a packaged build unless each bundled\nadapter starts and answers ACP `initialize`. A build missing its\nadapter says to reinstall Pane.\n\nBefore a chat tab starts, `checkAgentCli`\n(`main/src/services/agentChat/adapterSetup.ts`) checks that the installed CLI\nit will run, in the tab's folder and environment, is at least the agent's\n`chat.minimumVersion`: Claude Code 2.1.316, Codex 0.165.0, Cursor 2026.10.22,\nOpenCode 1.18.14. An older one stops the tab with the command that updates it.\nChange an adapter pin only with its agent's `chat.minimumVersion`, and after\nrunning the chat tab suites against it.\n\n## Full access\n\nFull access lets the agent act without asking (D-16). The agents config says\nhow each agent gets it:\n\n- **A session mode** (`chat.fullAccess.mode`: Claude `bypassPermissions`,\n Codex `agent-full-access`): the agent's own permission mode chip sets it.\n- **A launch flag** (`chat.fullAccess.args`: Cursor, whose terminal\n `fullAccessArgs` are `--force`): Pane adds a **Full access** On/Off setting\n to the composer's settings menu. Switching it restarts the agent with or\n without the flag, on the same conversation.\n- **Neither** (OpenCode): the same **Full access** setting. While it is on,\n Pane answers each approval request with the agent's allow-once option, never\n allow-always, and marks the step \"Approved by Pane\" (the mark lasts while\n the tab runs; a reopened conversation's history comes from the agent and has\n none). Switching it takes effect at once.\n\nFull access can't change during a turn. While Pane's Full access is on, the\ncomposer marks it in amber like a mode that never asks.\n\n## What the chat shows\n\n- Replies stream as markdown; thinking is collapsed.\n- The agent's steps are grouped by kind: *Explored 2 files, 1 search*,\n *Edit file +18 −4* with **View diff** (which opens Pane's diff view; a diff\n never renders in the thread by itself; the PWA and the phone bring the Pane's\n Diff tab forward, which shows the branch's changes read-only), *Run* with the command's output\n streaming in its own row, *Ran 9 commands*.\n- To-do lists from the agent's plan updates.\n- **Approvals** dock above the composer with exactly the choices the agent\n sent; keys 1 to 9 answer while the composer is empty. Typing a message\n instead sends it and, once Pane has it, declines the request. ExitPlanMode shows the\n plan itself. A step Pane approved under its own Full access is marked\n \"Approved by Pane\" ([Full access](#full-access)).\n- **Questions** (ACP form elicitation, such as Claude's AskUserQuestion) dock\n as a form. Pane declares `elicitation.form`; without it Claude turns\n AskUserQuestion off. Agents use it only for a quick question in this chat;\n anything else goes to an approval card\n ([PANE_NOTIFY.md](PANE_NOTIFY.md#what-an-agent-can-send), \"Which card\").\n- The composer is the input over one row of controls: attach image, the\n permission mode chip, then one menu showing model and effort together\n (\"Opus 5.5 · Medium\"; a trailing \"(recommended)\" and an effort of \"Default\"\n are left off the button, never from the menu). A mode that never asks\n (Bypass, Codex's Full access) shows its chip in amber, as does any mode chip\n while Pane's own Full access setting is on; an agent with no mode chip shows\n a small shield instead. The row never overflows a\n narrow column: the model label truncates and the mode chip drops to its icon\n first, while attach and send keep their size. In a window dragged very\n narrow the row drops the model button, then attach, and keeps send. That menu also holds every other setting the agent\n offers (such as Claude's Fast mode, Ultracode and Agent), each under its own\n name, and Pane's **Full access** for an agent without a full-access mode. Pane places a setting by its ACP category (`mode`, `model`,\n `thought_level`), or by its id when the agent sends none. At phone width\n (the phone app, and the PWA when the composer is under 480px) the row is\n sparer: **+**, then the model as plain text with its effort muted (\"Opus 5.5\n Medium\"), then send. The permission mode moves into that button's sheet as\n **Permissions**, below Model, Effort and the other settings; each choice shows\n a check and On/Off settings are switches. A mode that never asks (Bypass), or\n Pane's Full access when on, leaves a small shield on the row. The `/` menu lists\n the agent's own commands and skills, plus Pane's own **/clear**; **Stop** (or Esc in the composer) cancels the turn.\n- **Status bar** (D-222, D-253, D-267, D-276): one muted line just above the composer,\n items split by dots, each opening what it names:\n - **Context left** (\"Ctx 41%\", amber at 20% or less) opens the tokens used,\n a meter and **Clear conversation**; it is absent when the adapter reports no\n usage;\n - **Agents working** (\"3 working\"), in a Session orchestrator's chat and in\n Autopilot's: how many of the Session's agents are working right now (for\n Autopilot, across every Session it walks), counted from the Session\n overview: one per tab whose agent is working, so a Pane with an implementer\n and a reviewer both working counts two. Tabs waiting, idle or finished\n don't count, and the item is hidden when none is working. A change re-reads\n only the Session it names. It opens a list of each agent with its tab; a\n row opens that tab (the PWA opens its Pane);\n - **Pull request** (\"#1272 · Open\", the chat's Pane's PR) opens it on GitHub;\n the PWA reads it from the host's git status;\n - **Background tasks** (\"2 tasks\") lists them, with Stop where the adapter\n allows it;\n - **Queued messages** (\"2 queued\") moves focus to the queue.\n\n Items with nothing to say stay out. **…** picks which items show; the choice\n is remembered on this device (`pane-chat-status-items:v1` in local storage),\n and **Reset to default** brings all five back. While a turn runs the bar ends\n with the send-now keys. At phone width it is compact (the percentage and PR\n number alone) and scrolls sideways instead of wrapping. The phone app has no\n status bar yet.\n- **Enter goes to the chat** (D-328): with a chat tab on screen and focus on\n no control (the page, a split, a scroll surface such as the commit history),\n Enter moves focus into its message box. Opening a Pane or Session with Enter\n from the sidebar, or pressing Enter on a chat's tab, lands there too, even\n while the chat is still loading. With splits, Enter stays in its own split:\n it goes to the focused split's chat, and a chat's tab opens into that chat,\n never into another split's. Enter in a field, terminal, button, menu, picker\n or dialog keeps its own meaning.\n- **Queue and Send now** (D-211): a message sent while the agent works (Enter)\n waits in the queue, listed in the order it will be sent. Each queued message\n can be edited (its images are kept), removed, or sent now. **Send now**, or\n Cmd/Ctrl+Enter in the composer, puts the message first and interrupts the\n running turn (including one blocked on an approval or question), so it is\n sent as soon as the turn stops (`chat-tab:send` with `now`, `chat-tab:send-now`,\n `chat-tab:edit-queued`).\n- **/clear** (or **Clear** above the thread) ends the agent and starts a fresh\n conversation in the same tab, with the same agent, launch and settings\n (`chat-tab:clear`). It asks first while a turn runs; a turn cut off this way is\n marked failed. Queued messages are kept and go to the new conversation, which\n starts with a \"Cleared · 2:04 PM\" divider. A stopped tab refuses it, and\n Autopilot's chat does not offer it (its conversation holds what Start told it).\n- **Context and background work**: the view carries the adapter's last\n `usage_update` (`context: { used, size }`, from any agent that sends it) and the\n background tasks it runs (`tasks`, Claude's background shells and subagents;\n `chat-tab:stop-task` stops one). Usage is kept in memory, so a reopened chat has\n none until its next turn, and the status bar shows nothing rather than a guess.\n- **Copying**: message text can be selected and copied like any page. Each\n message and each finished response has a copy button (on hover with a mouse,\n always on touch) that copies what was written, as Markdown, without the\n agent's activity. **Copy conversation** above the thread copies the loaded\n conversation under **You:** and the agent's name, with each tool step as one\n short line and no raw output. Code blocks have their own copy button. On the\n phone app, each message has a copy action, and a long press on a reply copies\n it.\n- **Attachments** (desktop and PWA): drop photos and files anywhere on the chat,\n paste them into the composer, or pick them with **+**. An image the agent\n takes (PNG, JPEG, WebP or GIF up to 5 MB) is sent as an image. Any other file,\n up to 10 MB, is copied to the Pane's folder on the chat's machine under its own\n name (in a folder of its own, so two files with one name never collide), the same\n way a terminal tab's upload works (`terminal:paste-file`, so a remote host\n receives it too), and its path is sent with the message. Each attachment is a\n chip that can be removed before sending, and sending waits until every file\n has finished copying. Every refusal says why, and nothing is attached for it.\n The phone app keeps its **+** photo picker.\n- The composer does not show the machine: the window's machine picker does, and\n an approval from a remote machine names it.\n\nA chat shows the agent's text and pictures; what it did in between stays out of\nthe way (D-192). While a turn runs, one quiet line says what it's doing now\n(\"Running pnpm test\", \"Thinking\"). When it ends, its steps, thinking, to-do lists\nand notices fold into one row, \"Worked for 27s\", that opens to them.\n\nThe latest turn says when it finished (D-202): \"Worked for 27s · 2:04 PM\", or\n\"2:04 PM\" alone when it did nothing but answer. An older time reads \"Yesterday\n4:12 PM\" or \"Nov 3, 4:12 PM\", in the person's locale. Every other message shows\nits time on hover; on the phone, a long press shows it. A conversation reopened\nafter a restart keeps the times of its last 200 turns; older turns show none.\n\nThe conversation stays in the order things happened (D-193). Claude can start a\nturn by itself, for example when a background command finishes. Pane sees that\nthrough the adapter's `asyncTasks` capability: the tab shows as working, the turn\ngets its own row, and a message sent meanwhile waits in the queue until the turn\nends, like one sent during any other turn. Stop ends it.\n\nIn a Session orchestrator's chat, a worker Pane shows up as one line with\n**Open** when it finished or failed during the latest turn, once that turn has\nended (D-201, narrowed by D-223), for example \"approvals-global finished ·\n**Open**\". A worker's question reaches the person as an approval the\norchestrator relays (D-220), never as a line here. Other workers stay out of\nthe chat; the sidebar lists every Pane. This comes from Pane's own Session state\n(its Panes, their agent states and `runpane report`s), never from what the agent\nwrote.\n\nApprovals and questions are also asked in Pane's Approvals and on the phone (see\n[PANE_NOTIFY.md](PANE_NOTIFY.md)), a question form one field at a time. The\nfirst answer wins everywhere. In the chat, a form that asks several questions\n(Claude's AskUserQuestion with more than one, or any form with several fields)\ntakes them one at a time (D-230): \"1 of 2\", each question with its options and\nits Other box, Next and Back, and on the last one a review of the picks beside\n**Answer**. Every field is a question of its own, except a choice's optional\nOther box (keyed after the choice, such as `question_0_custom`, or titled\n\"Other\"), which stays with it. Number keys pick an option and Enter goes on,\nwith focus moving to each new question; **Skip** passes over one question, and\nskipping every one declines the form. A form with one question has no steps.\n\n## Restart and resume\n\nA chat tab saves its agent, its launch (plain agent with an optional session\nmode, or an Agent Farm profile and its args), its working folder and the ACP\nsession ID. It saves no env and no secret: env is rebuilt at every start, and an\nAgent Farm profile is printed again.\n\nAfter Pane restarts, a chat tab starts again when you open it (or on\n`runpane panels resume` / `resume-many`), loads its conversation (the adapter\nreplays the history) and shows it. A turn that was running when Pane closed is\nmarked *Stopped when Pane closed*; a message sent then continues the same\nconversation. If the agent exits, the tab shows why with **Restart**, which\nloads the same conversation.\n\nAuto-pause (Settings > Pause) stops the agent of a chat tab idle for\n`chatIdleReleaseMinutes` (30 by default), which frees its memory. It skips the\nPane on screen and a tab that is working, holds a queued message or waits on the\nperson. The paused tab keeps showing its conversation and controls; opening it,\nsending it a message or using its model, mode or `/resume` controls resumes the\nagent in the same conversation.\n\n## Cost\n\n- No process polling: Pane learns about the adapter's exit from its own events,\n and stops the adapter's whole process group when the tab closes.\n- No cap stops a conversation: the newest messages stay in memory (up to 1,000\n or 24 MiB per tab) and older ones go to a per-tab file under `chat-tabs/` in\n Pane's data folder, rebuilt at every start. Viewers keep a window of at most\n about 700 messages: **Earlier messages** pages older ones in\n (`chat-tab:history`) and drops the newest, **Newer messages** pages back\n down, and the jump-to-latest arrow returns to the live end.\n- Only the chat tab on screen renders. A hidden tab is unmounted and holds no\n transcript; showing it reads the newest window from the host once.\n- A streaming reply redraws at most once per stream frame (`STREAM_FRAME_MS` in\n `shared/constants/streamCadence.ts`, also the terminals' output interval when\n no one is typing), and its markdown is parsed block by block, so an update\n re-parses only the block being written. A reply with link definitions,\n footnotes or a raw HTML block that can span blank lines is parsed whole, and\n so is a reply shown after its turn ended, which keeps opening a long chat\n fast.\n- A queued message keeps only a preview in the tab's saved state; its full text\n and images wait in a file beside it until they are sent.\n- A tool step's update sends only the fields that changed; command output is sent\n as appends.\n\n## runpane on chat tabs\n\n`panels submit` sends an ACP prompt and returns an `acp-receipt` (queued while\nthe agent works). `panels wait` is ready when a turn ended and nothing is queued,\nand returns at once as blocked while an approval or question waits. A text\nwait (`--for text`) searches only what the agent writes after the wait starts,\nplus a reply still streaming then, never the person's prompts. `screen`\nand `output` read the transcript (`source: acpTranscript`), `last-message` the\nnewest reply, `report` is kept in the tab's state, and `resume` restarts the\nagent and loads the conversation. `panels input` and `submit-composer` fail with\n`CHAT_TAB_NO_TERMINAL`: a chat tab has no terminal. The agent gets the same\nenv as a terminal agent tab: `PANE_*`, so `runpane report` and `notify` work from\ninside it, the project's environment variables, and `GIT_CEILING_DIRECTORIES`\nfor a Session orchestrator.\n\n## Agent Farm profiles\n\nFor `--agent-farm`, Pane runs `agent-farm run <profile> --print-acp --acp-adapter\n<bundled adapter> [--arg key=value …]` at every start, spawns the printed `argv`\nwith the printed `env` added, sends the printed `session` on `session/new` and\n`session/load`, and selects the printed `mode` with `session/set_mode` after each.\nAgent Farm runs the adapter with plain Node, which can't read inside `app.asar`,\nso a packaged Pane passes a small launcher from `agent-adapters/` in its data\nfolder that starts the bundled adapter with Pane's Electron.\nA profile's harness must be an agent Pane runs through a bundled adapter\n(Claude or Codex).\nThe profile's model, effort, instructions with LAUNCH CONTEXT, skills,\nsubagents, MCP servers and telemetry come with it. The contract is Agent Farm's\nCONFIGURATION.md, *ACP sessions*.\n\n## Older clients\n\nPhone apps released before chat tabs would crash on a tab kind they don't know,\nand send no version. Clients pass what they can show: `{ chatTabs: true,\nchatAgents: true }` from this desktop, the PWA and the current phone app. A\nclient without `chatTabs` shows no chat tab; one without `chatAgents` shows\nonly chat tabs of agents whose config sets `chat.legacyClients` (Claude and\nCodex) (`clientShowsChatTab` in `main/src/ipc/panels.ts`). For a chat tab the\nclient can't show, `panels:list` leaves it out, a Session the client creates\nstarts its orchestrator in a terminal, and `orchestration-sessions:get` of a\nSession whose orchestrator is that chat tab fails with\n`CHAT_TAB_CLIENT_OUTDATED`, which says to update Pane on the phone (D-100).\n\n## Code\n\n| Part | Where |\n| --- | --- |\n| Agents config (generated by `node scripts/generate-runpane-contract.js`) | `contracts/runpane/contract.json` `agents`, `shared/types/generatedAgents.ts`, read through `shared/agents.ts` |\n| ACP Registry install (`chat-tab:registry`, `install-agent`, `remove-agent`) | `main/src/services/agentRegistry/`, `frontend/src/stores/agentRegistryStore.ts` |\n| Agent catalog (`chat-tab:agents`) | `main/src/services/chatTabs/agentCatalog.ts`, `frontend/src/stores/chatAgentsStore.ts`, `frontend/src/components/settings/categories/AgentsSettings.tsx` |\n| Host runtime, transcript, launcher, Agent Farm profiles, Notify bridge, Switch to chat | `main/src/services/chatTabs/` |\n| Commands (`chat-tab:*`) | `main/src/ipc/chatTabs.ts` |\n| runpane | `main/src/ipc/runpaneChatTabs.ts`, `main/src/ipc/runpane.ts` |\n| Shared types, presentation, decoders | `shared/types/chatTab.ts`, `shared/chatTabPresentation.ts`, `shared/chatTabPermissions.ts`, `shared/chatTabQuestions.ts`, `shared/types/chatTabDecoders.ts` |\n| Viewer (window, paging, catch-up), shared by every client | `shared/chatTabViewer.ts` |\n| Desktop and PWA UI | `frontend/src/components/chatTab/`, `frontend/src/remote/components/RemoteChatTab.tsx` |\n| Phone UI | `native/src/features/chatTab/` |\n\n## Testing\n\nTests never touch a real agent account. `main/src/services/chatTabs/testing/scriptedAgent.mjs`\nis a scripted ACP agent (each prompt's first word picks a behaviour: `permission`,\n`question`, `slow`, `crash`, `steps 6`, `edit`, `plan`, …), and `fakeAgentFarm.mjs`\nprints a `--print-acp` launch for it. An unpackaged Pane started with\n`PANE_CHAT_TEST_AGENT=<path to scriptedAgent.mjs>` runs it in every chat tab;\n`tests/chat-tabs.spec.ts` uses that for journeys J1 and J5: run it with\n`pnpm build:main && pnpm test:chat-tabs` (CI runs it in Functional Smoke (Electron)).\n"},{"path":"docs/CONFIG_FILES.md","title":"Config File Detection","text":"# Config File Detection\n\nPane automatically detects workspace configuration files at your repository root and uses them to provide default scripts for session setup, the Play button, and cleanup on archive. This lets teams share workspace configuration via git — commit the file, push, and every teammate gets the same setup.\n\n## Supported Files\n\nPane checks for these files in priority order. The first file found with at least one script defined wins:\n\n| Priority | File | Format | Origin |\n|----------|------|--------|--------|\n| 1 | `pane.json` | JSON | Pane's native format |\n| 2 | `conductor.json` | JSON | [Conductor.build](https://conductor.build) |\n| 3 | `.gitpod.yml` | YAML | [Gitpod](https://gitpod.io) |\n| 4 | `.devcontainer/devcontainer.json` | JSON | [Dev Containers](https://containers.dev) |\n\nIf none of these exist, Pane falls back to checking for `scripts/pane-run-script.js` in the worktree (the legacy auto-generated script).\n\n## pane.json\n\nThis is Pane's native config format. It follows the same schema as [conductor.json](https://docs.conductor.build/core/conductor-json), so teams using Conductor can switch to Pane without changing their config.\n\n### Schema\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\",\n \"archive\": \"pnpm cleanup\"\n },\n \"runScriptMode\": \"concurrent\"\n}\n```\n\nAll fields are optional.\n\n### Fields\n\n#### `scripts.setup`\n\nRuns automatically when a new worktree/session is created. Use for dependency installation, database setup, environment configuration, etc.\n\n**Examples:**\n```json\n\"setup\": \"npm install\"\n\"setup\": \"pnpm install && pnpm db:migrate\"\n\"setup\": \"bundle install && rails db:setup\"\n```\n\n#### `scripts.run`\n\nRuns when you click the **Play** button in the panel tab bar (or press Run Dev Server's key: `Cmd+Shift+D` on macOS, `Ctrl+Shift+D` on Windows and Linux). Use for starting dev servers, test watchers, or any long-running process.\n\nPane sets `PANE_PORT` to the first of a block of 10 ports picked from the pane's id (range 3000–8999), so dev servers in parallel panes rarely collide.\n\nSetup, run and archive scripts also get the project's environment variables, including Pane secret and keychain variables: see [PROJECT_ENV_VARS.md](PROJECT_ENV_VARS.md).\n\n**Examples:**\n```json\n\"run\": \"pnpm dev\"\n\"run\": \"npm run dev -- --port $PANE_PORT\"\n\"run\": \"concurrently \\\"npm run server\\\" \\\"npm run worker\\\"\"\n```\n\n#### `scripts.archive`\n\nRuns before a worktree is deleted when you archive a session. Use for cleaning up external resources — dropping test databases, revoking tokens, stopping background services.\n\n**Examples:**\n```json\n\"archive\": \"npm run db:teardown\"\n\"archive\": \"docker compose down\"\n```\n\n#### `runScriptMode`\n\nControls behavior when a new run script starts while one is already running.\n\n| Value | Behavior |\n|-------|----------|\n| `\"concurrent\"` | (Default) New script starts alongside existing ones |\n| `\"nonconcurrent\"` | Existing script is stopped before starting the new one |\n\n> **Note:** `runScriptMode` is detected but not yet enforced. This will be implemented in a future release.\n\n## How Scripts Map to Pane\n\nEach config file format maps to Pane's three lifecycle hooks differently:\n\n| Lifecycle | pane.json / conductor.json | .gitpod.yml | devcontainer.json |\n|-----------|---------------------------|-------------|-------------------|\n| **Setup** (worktree creation) | `scripts.setup` | First task's `init` | `postCreateCommand` |\n| **Run** (Play button) | `scripts.run` | First task's `command` | `postStartCommand` |\n| **Archive** (session deletion) | `scripts.archive` | — | — |\n\n## Override Model\n\nPane follows the same override model as Conductor:\n\n```\nProject Settings (UI) > Config File > Nothing\n```\n\n1. **If you set a value in Project Settings**, it always wins — the config file is ignored for that field\n2. **If Project Settings is empty**, Pane uses the config file value\n3. **If neither exists**, no script runs (except for the Play button, which falls back to Claude-generated setup)\n\nThis means config files provide **team-shared defaults** that individual users can override locally through the UI.\n\n### Per-Field Override\n\nEach script field is independent. You can override `run` in Project Settings while still using `setup` from `pane.json`:\n\n```\nBuild Script: empty → uses pane.json scripts.setup\nRun Commands: \"npm run dev:custom\" → overrides pane.json\nArchive Script: empty → uses pane.json scripts.archive\n```\n\n### From the CLI or MCP\n\nAgents read and change Project Settings with `runpane repos get` and `runpane repos update` (MCP tools `repos_get` and `repos_update`, in the opt-in `repos` toolset). `repos get` shows each script's saved value, the config-file fallback, and which one Pane will run:\n\n```bash\nrunpane repos get --repo my-app --json\n```\n\n```json\n\"runScript\": {\n \"value\": null,\n \"fallback\": { \"command\": \"pnpm dev\", \"source\": \"pane.json\" },\n \"effective\": { \"command\": \"pnpm dev\", \"source\": \"pane.json\" }\n}\n```\n\n`repos update` saves through the same path as the Project Settings dialog, so open Pane windows show the new values. `--clear` empties a field, and a cleared script falls back to the config file again:\n\n```bash\nrunpane repos update --repo my-app --run-script \"pnpm dev:custom\" --yes\nrunpane repos update --repo my-app --clear run-script --yes\n```\n\n`repos get` reads the config file at the repository root. At run time Pane reads it from each Pane's worktree, as the next section explains.\n\n## Branch-Local Config\n\nConfig files are read from the **session's worktree**, not the project root. This means:\n\n- If a branch modifies `pane.json`, that branch's sessions use the modified config\n- You can test config changes in a worktree before merging to main\n- Different branches can have different setup/run/archive scripts\n\n## Quick Start\n\n### 1. Create a `pane.json` in your repo root\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\"\n }\n}\n```\n\n### 2. Commit and push\n\n```bash\ngit add pane.json\ngit commit -m \"Add pane workspace config\"\ngit push\n```\n\n### 3. That's it\n\nWhen your teammates pull, Pane will automatically:\n- Run `pnpm install` when they create a new session\n- Run `pnpm dev` when they click Play\n- Show \"From pane.json\" in Project Settings so they know where the scripts come from\n\n### Already using another tool?\n\nIf your repo already has a `conductor.json`, `.gitpod.yml`, or `.devcontainer/devcontainer.json`, Pane will detect and use it automatically. No changes needed.\n\n### Moving your own scripts to another computer\n\nScripts saved in Project Settings live on one computer. **Settings › Import & Export** carries them, with the rest of your setup, to another one, and skips any script a repo's config file already provides. See [Export and import your Pane setup](SETUP_EXPORT_IMPORT.md).\n\n## Visibility\n\n### Project Settings\n\nWhen Pane detects a config file, Project Settings shows:\n- An info banner identifying which file was detected\n- \"From pane.json\" badges beneath empty script fields, previewing the command that will run\n- Updated tooltips explaining the fallback behavior\n\n### Play Button\n\nThe Play button tooltip shows exactly what will run and where it came from:\n- **With config:** \"Run: pnpm dev\" with \"from pane.json\" subtitle\n- **Without config:** \"Set up run script (via Claude)\" — launches AI-assisted setup\n\n## Examples\n\n### Node.js / TypeScript project\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\",\n \"archive\": \"rm -rf node_modules/.cache\"\n }\n}\n```\n\n### Python / Django project\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pip install -r requirements.txt && python manage.py migrate\",\n \"run\": \"python manage.py runserver 0.0.0.0:8000\",\n \"archive\": \"python manage.py flush --noinput\"\n }\n}\n```\n\n### Monorepo with multiple services\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install --frozen-lockfile\",\n \"run\": \"concurrently \\\"pnpm --filter api dev\\\" \\\"pnpm --filter web dev\\\"\",\n \"archive\": \"docker compose -f docker-compose.test.yml down -v\"\n },\n \"runScriptMode\": \"nonconcurrent\"\n}\n```\n\n### Migrating from Conductor\n\nIf you already have a `conductor.json`, it works as-is — the schema is identical. You can optionally rename it to `pane.json`. If both files exist, `pane.json` wins.\n"},{"path":"docs/DEVICES.md","title":"Devices","text":"# Devices\n\nAny agent in a Pane can boot an iOS Simulator or an Android emulator, see it, drive it and\nbuild an app to it. The live screen opens in a device tab beside the agent, and chat tabs\nshow a card at the step that opened it. On Windows and Linux, iOS runs on a Mac you linked,\nwith no SSH setup.\n\n## The tools\n\nEvery agent gets six device tools through Pane's MCP server, and every terminal has the same\ncommands as `runpane devices`. Pane fills in the Pane, the device and the machine: after\n`device_open`, an agent never names them again.\n\n| Tool | Command | What it does |\n| --- | --- | --- |\n| `device_list` | `runpane devices list` | Devices this Pane can open: platform, name, OS, machine, state, and which Pane holds each |\n| `device_open` | `runpane devices open --platform ios` | Leases a device to this Pane, boots it and opens the device tab |\n| `device_screenshot` | `runpane devices screenshot` | The screen as an image (MCP) or a PNG path (CLI) |\n| `device_act` | `runpane devices act -- snapshot -i` | Runs an [agent-device](https://github.com/callstack/agent-device) command on the device |\n| `device_run` | `runpane devices run -- npx expo run:ios` | Runs a command where the device runs, such as a build, or Metro with `--background` |\n| `device_close` | `runpane devices close` | Ends the lease and stops the commands `device_run` started |\n\nA Pane can hold an iPhone and an Android emulator at once. `device_screenshot`, `device_act`,\n`device_run` and `device_close` act on the device it opened last; pass `--platform ios` or\n`--platform android` (the `platform` argument over MCP) to pick the other. `device_close`\nwithout a platform closes both.\n\nA typical session:\n\n```sh\nrunpane devices open --platform ios --json\nrunpane devices run --json -- npx expo run:ios\nrunpane devices act --json -- open com.example.app\nrunpane devices act --json -- snapshot -i # the screen's elements as @refs\nrunpane devices act --json -- press @e3 --settle\nrunpane devices screenshot --json\nrunpane devices close --json\n```\n\n`device_act` passes any agent-device command through (`help workflow` lists them), pinned to\nthe device this Pane holds. Flags that would pick another device, session or daemon\n(`--session`, `--device`, `--udid`, `--serial`, `--platform`) are refused, and so are the\ncommands that act on agent-device's shared daemon, sessions or connections (`daemon`,\n`session`, `connect`, `disconnect`, `proxy`, `batch`). Run batch steps as separate calls.\n\n## Setup\n\nNothing to install up front. On the first device call, Pane installs two pinned open-source\nhelpers with npm into its data folder (about a minute): Callstack's agent-device, which drives\ndevices for agents, and Expo's device hub, which boots devices and streams their screen. They\nrun on Pane's own Node, so your Node version doesn't matter, but npm must be on the PATH once.\n\n| Platform | Needs |\n| --- | --- |\n| iOS | A Mac with Xcode and an iOS runtime (Xcode > Settings > Components) |\n| Android | The Android SDK with its emulator, platform-tools and \"Android SDK Command-line Tools (latest)\" (Android Studio > SDK Manager > SDK Tools), and a system image |\n| Android on Linux | KVM (`/dev/kvm`) |\n\nPane never installs Xcode, the Android SDK, runtimes or system images; when one is missing,\nthe tool's error says what and where to get it. **Settings → Devices** shows what this\ncomputer has.\n\nAndroid emulators register with adb on port 5037. If something else holds that port, such as\na port forwarded from another machine, emulators boot but never come online. Free the port, or\nstart Pane with `ANDROID_ADB_SERVER_PORT` set to another port.\n\n## iOS from Windows and Linux\n\nA computer without Xcode runs iOS on a linked Mac. Link one once: on the Mac, open\n**Add a device → Computer** and choose **Copy link**; on this computer, open\n**Add a device → Computer** and paste it under **Or finish here** (or run\n`runpane link '<link>'`).\n\n`device_open` then uses the Mac pinned in **Settings → Devices → iOS devices run on**, or\nelse the first online Mac with Xcode, and its result says which Mac and why. A pinned Mac is\nalways used: when it is offline the call fails with `ERR_DEVICE_MAC_OFFLINE` and doesn't\nfall back. Every call goes over the routes saved computers already use (same network,\nTailscale or the Pane relay); the Mac accepts device calls only from your linked computers.\n\n`device_run` builds on the Mac without a clone or credentials there: it snapshots the\nworktree (uncommitted and untracked files included, ignored files left out), sends what\nchanged since the last run as a git bundle to a Pane checkout on the Mac, and runs the\ncommand in that checkout. Ignored build products such as `node_modules` and `Pods` stay\nthere between runs. Metro started with `--background` keeps running on the Mac until\n`device_close`, and serves the simulator on the Mac's own localhost. Archiving the Pane stops\nits jobs on the Mac and removes its checkout there.\n\n| Error | Means |\n| --- | --- |\n| `ERR_DEVICE_NO_MAC` | No Mac is linked. Link one, as above. Android works on this computer meanwhile |\n| `ERR_DEVICE_MAC_OFFLINE` | The Mac is asleep or Pane isn't running there. Wake it, or pick another Mac in Settings |\n| `ERR_DEVICE_MAC_OUTDATED` | The Mac's Pane predates devices. Update it |\n| `ERR_DEVICE_NEEDS_DESKTOP` | This computer runs headless Pane, which has no connections to saved computers. Use the desktop app here |\n| `ERR_DEVICE_MAC_NO_XCODE` | The Mac answers but has no Xcode with an iOS runtime. Install it there, or pick another Mac |\n| `ERR_DEVICE_MAC_TIMEOUT` | The Mac was still working when the call's time ran out (10 minutes for an open). Pass `--background` for long builds |\n\n## Sharing and resources\n\nBooted simulators are heavy, so Pane keeps few of them:\n\n- **A small pool per machine.** Pane makes its own devices (`Pane iPhone` on the newest iOS\n runtime you installed, `Pane_Android`) and reuses them; it makes another only when none\n fits. It uses one of your own devices only when an agent names it with `--device`.\n- **One booted device per platform** by default, shared between Panes by lease.\n **Settings → Devices → Simulators at once** raises it to four.\n- **Leases.** A Pane holds its device until `device_close`, archive, or 10 minutes with no\n device call and its tab on screen nowhere. When every device is held, `device_open` waits up\n to 60 seconds, then fails with `ERR_DEVICE_BUSY` naming the holder; **Take over** in the\n device tab moves the lease. When a device passes to another Pane, Pane uninstalls the apps\n the last Pane installed, without a reboot.\n- **Idle shutdown.** A lease that idles out shuts down a device Pane made or booted at once;\n a device you booted yourself keeps running. After `device_close` it stays warm for 10\n minutes. A running `device_run` command counts as use. The helpers stop when nothing is booted.\n- **Erase and delete.** Archiving the last Pane that used one of Pane's devices erases it;\n Pane's devices unused for 7 days are deleted. Pane never deletes your devices or runtimes.\n- **SimSlim.** With [simslim](https://github.com/MobAI-App/simslim) installed\n (`brew install mobai-app/tap/simslim`), Pane slims each of its iOS devices once, which cuts a\n booted simulator from about 4 GB to under 1 GB.\n\n`runpane devices usage --json` lists every simulator and emulator on the machine (including\nones made outside Pane, `paneMade: false`) with its OS, disk and, when booted, memory, plus the\ninstalled iOS runtimes and Android system images, the helpers' memory, and the build checkouts\nlinked computers sync here. `runpane devices free --idle --yes` shuts down unused Pane\ndevices; `--all` also deletes them and the checkouts no Pane holds a device for, and reports\nthe disk freed.\n\n## Phones and the browser app\n\nThe device tab shows on the phone apps and in the browser app as frames, about two a second,\nwith tap and Home. The live stream stays on the desktop. Chat tabs on the desktop and in the\nbrowser app show the device card; the native app shows an **Open** row.\n\n## Security\n\nThe device hub listens on loopback only and requires a token, which stays in Pane's main\nprocess: it never reaches a tab, a log, a tool result or an agent. The hub also records its\ntoken in a state file, which Pane keeps in its own data folder (`devices/hub-state`) and\ndeletes when the hub stops; the token guards the hub against other users of the computer.\nThe device tab's own channels refuse calls from agents. Device tools act only on\nthe calling tab's Pane, and refuse calls from outside a Pane tab. **Settings → Devices →\nAgent device tools** turns the tools off.\n"},{"path":"docs/EVEN_G2_GLASSES.md","title":"Use Pane from Even G2 glasses","text":"# Use Pane from Even G2 glasses\n\nThe Pane glasses app runs on [Even Realities G2](https://www.evenrealities.com) glasses, inside the\nEven Realities phone app. It shows every Pane Notify card from all your computers, lets you answer\nwith the R1 ring or your voice, and opens any Pane's live terminal so you can read it and dictate\ninto it.\n\nIt talks straight to each of your computers over Tailscale, or through each computer's own address when your phone paired with it by [QR code](QR_PAIRING.md).\n\n## What you need\n\n- G2 glasses (the R1 ring is optional; the temple touchpads do the same gestures).\n- The Even Realities app on your phone, and the Pane app ([iOS and Android](NATIVE_MOBILE.md)).\n- Each computer reachable from the Pane phone app in one of two ways:\n - paired with the phone by [QR code](QR_PAIRING.md); or\n - over Tailscale: Tailscale on the phone and the computer, signed in with the same login, and\n Pane's **Settings › Remote Access › Tailscale › Who can connect** set to **Only me** or **Everyone on\n tailnet** (on by default for the Pane that owns `~/.pane`).\n- Pane open on each computer.\n- For dictation and voice answers, a Deepgram key (live) or a fal key (recorded) on the computer\n you talk to: **Settings › Integrations › Voice transcription** on the computer, or **Settings › Voice** in the\n Pane phone app.\n\n## Install and pair\n\n1. In the Even Realities app, open **Even Hub** and install **Pane**.\n2. In the Pane phone app, open **Settings › Glasses** and tap **Pair glasses**. (To get there from a\n computer, scan the code in Pane's **Add a device › Wearables** with your phone.) The phone asks each\n of your computers (the ones on your Tailscale login and the ones it paired by QR code) for a\n one-time pairing secret and copies them as one code. The code works for 10 minutes and only once\n per computer. A computer the phone reaches both ways is paired once, over Tailscale, when its\n Tailscale name matches its name in Pane.\n3. Tap **Open Even app**, open Pane there, and tap **Paste**, then **Connect**.\n4. The glasses show **Pane · N computers**. Each computer now lists the glasses under\n **Settings › Remote Access › Phones and glasses**, named after your phone, with when they were last used.\n\nPair once; your other computers join on their own on launch and every 10 minutes. The glasses ask\none paired computer to get pairing secrets from your other Pane computers on Tailscale (yours, with\nWorkspaces on), then pair with them as with a pasted code. If that computer doesn't answer, or\ncouldn't reach a computer or has no password saved for it, the glasses ask the next paired\ncomputer. Each computer is asked at most once every 5 minutes. A computer that still can't join\ngets a dim row at the end of the home list with the reason; press it for what to do:\n\n| Row reads | Fix |\n|---|---|\n| update Pane there | Update Pane on that computer. It joins within 10 minutes. |\n| revoked here · pair from phone | The glasses were revoked there. Pair again from the Pane phone app: Settings › Glasses › Add computers. |\n| needs its password | Connect to that computer once from Pane on a paired computer, so it saves the password. |\n| Funnel is on | Turn Funnel off for port 8443 on that computer. |\n| not answering | Check that Pane is open there and Tailscale is on. |\n\nComputers reached only by QR code don't join on their own: tap **Add computers** in Settings ›\nGlasses after you pair the phone with a new one.\n\nA paired computer on an older Pane can't ask for the others; the glasses skip it until the next\n10-minute round, so once you update Pane there it asks within 10 minutes. You can still add\na computer by hand: tap **Add computers** in Settings › Glasses and paste the new code the same way.\nComputers that are offline are skipped and named on the screen.\n\n### The Even app's origin\n\nThe Even app serves the glasses app from `http://127.0.0.1`, on a port it picks each time it starts.\nPane accepts that origin on any port, so there is nothing to allow. A computer running an older\nPane refuses it and the glasses show **Allow this app on the computer**: update Pane on that\ncomputer. Allowing the origin on an older Pane lasts only until the Even app restarts on a new port.\n\n## Use it\n\n| Gesture | What it does |\n|---|---|\n| Swipe up / down | Move through a list or scroll a terminal half a page |\n| Press | Open or pick; in a terminal, open keys mode |\n| Double press | Back; on the home page, exit the app |\n| Hold, then release | Talk, then send at once: an answer on a card, input in a terminal, a new Session on home's first row |\n\nIn **keys mode** the gestures go to the terminal, one key at a time in the order you made them:\nswipe sends ↑ or ↓, press sends Enter and goes back to the output, double press leaves without sending anything, and hold opens a short list with\nEsc and Tab. You can't dictate in keys mode; leave it first.\n\n- **Home** is one list across every paired computer: questions first, newest first, then info\n cards, then every Session and Pane, newest activity first. Each row starts with its computer's OS logo (Apple,\n Windows or Linux; a plain monitor for a computer whose Pane is too old to say) and the first five\n letters of its name. The selected row starts with \">\" at full brightness. The header counts the\n questions waiting (\"All computers · 2 need you\") and confirms an answer you just sent. The list\n updates while it is open: a new Pane shows within about a second. Press a question to open its\n card (hold to answer it by voice), an info card to read its message, or a Session or Pane to open\n its terminal on its own computer. An info card you read and leave with double press drops off\n the list on these glasses; it stays on your phone and computers.\n- **A new Session**: home's first row reads \"+ New Session on studio-mac · hold to say it\". Hold\n it and say what the Session is for; the words appear as you speak. Release starts a Session on\n that computer with its default agent, your words as its purpose and its first words as its name,\n and opens it. Double press while listening cancels and starts nothing. The Session starts on the\n computer you last started one on from the glasses, else the computer of the last Pane you opened,\n else your first paired computer. If that computer is offline, or its Pane is too old to take a\n Session from the glasses, the glasses say so and start nothing.\n- **A computer that stops answering** keeps its rows, dimmed with its logo, reading \"offline since\n 9:14\". Pressing one says when it went away and offers Retry. A computer that has never answered\n gets one dim row of its own, and so does each computer that couldn't join (see Install and\n pair). When no computer answers and none has rows yet, home is one page\n that says so.\n- **A card** shows the asking Pane's last output lines (dimmed), the question, and the choices.\n A long question is cut at three lines; the **Read the whole question** row shows all of it.\n- **A terminal** shows the Pane's live screen, refreshed about once a second. Opening it marks the\n Pane viewed on that computer, as opening it there does. A stopped Pane starts its saved agent or command. The terminal hides an\n agent's input box and the status rows under it, so you read its output. Each swipe moves half a\n page: the half you just read stays on screen, dimmed. Swiping down to the end follows live again.\n Press opens keys mode, which shows the whole screen, input box included. The bottom line names\n the newest card from another Pane; double press goes home with its row selected.\n- **Menus**: when a terminal shows a menu Pane is certain of (a list numbered from 1 at the bottom\n of the screen with exactly one cursor mark, such as `❯`, `>` or `›`, under a prompt whose top is\n on screen), its choices appear as a list, under the last two lines above it: the question and\n what it asks about, such as the command to run. Swipe to a choice and press: Pane waits for any\n keys you pressed before, reads the screen again, and presses the choice's number, which Claude\n Code and Codex take as that answer wherever the cursor is. If anything in the prompt changed\n between the list showing and that read (the question, any row of the command, or any choice),\n it sends nothing, says \"The menu changed, so nothing was sent\", and opens keys mode. A menu that\n changes after the read, while the number is on its way, can still receive it. A menu still on\n screen a second after its number ignores numbers: keys mode opens so you answer it with arrows\n and Enter. Double press dismisses the list. Any other prompt,\n including one taller than the screen, is answered from keys mode.\n- **Going back** from a terminal or a card selects the row you opened. If it is gone, the row now\n in its place is selected.\n- **Dictation** types what you said into the Pane and presses Enter right away. A misheard line\n typed into a shell runs, so check the Pane before you talk into a plain shell. After you send,\n the view holds at your line while the reply grows below it, and the top line counts the lines\n still below (\"↓ 18 more\"). Swipe down to read on; the last swipe follows live again. If your line\n leaves the screen (the agent cleared it) or a menu appears, the view goes back to live.\n- **Keys need Pane on the computer to be up to date.** A computer on an older Pane refuses the\n first key, and the glasses say so: \"<computer>'s Pane can't take keys from the glasses yet.\"\n Update Pane there. Dictation still works.\n\n### Ambient mode\n\nAfter 30 s without a touch, the glasses go quiet over whatever screen is open. One dim line at the\ntop left names the computers with a card waiting, newest first (each computer's OS logo and the\nfirst five letters of its name, as in the list, at most three, then \"+N\"), and how many: \"studi build · 2 need you\", \"· 1 update\", or both.\nWith nothing waiting the display is dark. With no computer reachable it reads \"Can't reach your\ncomputers · Pane keeps trying\". While quiet, an open terminal stops reading its screen.\n\nA card that arrives while quiet shows as a banner for 15 s: its computer's OS logo, computer and Pane, up to two lines of\nit, and what you can do. Several cards that arrive close together share one banner on the newest\n(\"· 3 new\"), up for 15 s after the last. Untouched, the banner goes away and the quiet line counts\nthe card. A card answered elsewhere leaves the banner at once. While you use the glasses, new\ncards never pop up; they join the list as before.\n\nAny touch on the ring or a temple wakes the glasses to the screen you left, with a terminal read\nagain at once, and does nothing else: no row opens, no exit, no voice, and the release of a hold\nsends nothing. On a banner, the touch acts on its card:\n\n| Gesture on a banner | What it does |\n|---|---|\n| Press | Opens the card: a question its choices, an update its message |\n| Hold, then release | Answers a question by voice; on an update it only wakes |\n| Swipe or double press | Opens the list with the newest card selected |\n\nThe glasses never go quiet while you hold to talk or while a menu choice is being sent. Coming back to the app from the glasses menu opens it awake.\n\nAmbient mode is on by default. To turn it off, open Pane in the Even app on the phone and switch off\n**Ambient mode**; it applies at once and stays off after the app restarts. Off, the glasses behave as\nbefore: they stay on the screen you left and show no banners.\n\nWith the app closed, Pane's phone alerts still reach the glasses through the Even app's\nnotification mirroring, as the title only (\"planner has a question\").\n\n## Revoke\n\n- On the phone: **Settings › Glasses › Revoke Glasses** revokes them on every computer it can reach,\n and finishes the rest when they next answer.\n- On a computer: **Settings › Remote Access › Phones and glasses**, then **Revoke** next to the glasses for\n that computer only, or **Revoke on all my computers** for this computer and every computer of\n yours it can reach. It names the computers it could not reach, such as \"Not reached: laptop\n (offline)\", and offers **Retry on my other computers** while that page stays open.\n\nRevoking closes the glasses' connection to that computer within 5 seconds. A revoke sticks: your\nother computers can't add the glasses back to it, and the glasses list it as a dim row reading\n**revoked here · pair from phone**. Pairing the glasses again from the phone lifts the revoke on\neach computer it pairs.\n\nRevoke on every computer, from the phone or from **Revoke on all my computers**, when the glasses\nare lost. Two gaps remain:\n\n- A computer that was offline during the revoke still holds the glasses, and can add them to\n another of your computers until a revoke reaches it. That covers a computer you set up later,\n and one that answered the revoke without holding the glasses (for example, because Funnel was on\n there): a revoke marks only the computers that held them, and only those are listed under\n \"Revoked on\".\n- Pairing secrets that a computer already handed the glasses for your other computers stay usable\n there for up to 10 minutes after you revoke the glasses on it.\n\n## Security\n\nThe glasses app is a web page inside the Even app. Each computer lets it in only when all of these\nhold:\n\n- Over Tailscale, the request comes through Tailscale Serve on your tailnet with **your**\n Tailscale login. Other people on your tailnet are refused even with a valid glasses token.\n Funnel is never used: while Funnel is on for the computer's workspace port, glasses are refused\n there.\n- Through the computer's own address (QR pairing), only a phone paired with that computer can ask\n it for a pairing secret, so a glasses token there was issued through a phone you paired.\n- It carries this computer's **glasses token**: 256 random bits, one per pair of glasses, stored on\n the computer only as a hash. Tokens travel only in the `Authorization` header (and the voice\n WebSocket's subprotocol), never in a URL.\n- It comes from an **allowed origin**: the Even app's `http://127.0.0.1` on any port, or one the\n owner allowed in **Settings › Remote Access › Phones and glasses**, matched exactly except that a loopback\n origin matches on any port. Null, missing and wildcard origins are never accepted. A page served\n from `127.0.0.1` on your phone still needs a glasses token, which only the paired glasses hold.\n- Over Tailscale, the source is not **locked out**: 5 refused attempts in 10 minutes lock it out\n for a minute, doubling on each repeat up to an hour. Through the computer's own address every\n connection arrives from the computer's TLS listener, so refusals there are not counted, and no\n stranger can lock your glasses out. Each refusal is logged with the source and reason, never\n the token.\n\nA glasses token reaches only what the glasses use: listing Sessions and Panes, starting a Session\n(with only a one-line name and a purpose, at most one every 30 seconds; it runs the computer's\ndefault agent), reading and typing\ninto terminals, pressing one key at a time, dictation, and Notify. The keys are ↑, ↓, Enter, Esc,\nTab and the digits 1 to 9, one per request, and nothing else: text, two keys at once, Ctrl-C,\nCtrl-D, ← → and 0 are refused before they reach the terminal (`ERR_GLASSES_KEY_REFUSED`), logged\nwithout the input, and not counted toward the lockout. Dictation sends only the Pane and the\ntext: attachments and other submit options are dropped, and a request without text is refused\n(`ERR_GLASSES_SUBMIT_REFUSED`). These keys are enough to answer an agent's permission menu, so the\nglasses can approve what an agent asks to do. Opening a stopped Pane restarts its saved agent or command,\nin its own folder.\n\nThe token can also ask the computer to add these same glasses to your other computers. The\ncomputer finds them with its own Tailscale discovery (your login only, never other people's or\ntagged machines), skips any that already have the glasses, revoked them or have Funnel on, and\nasks each of the others, as you, for a pairing secret for the glasses' own name and phone id (the id of\nthe phone that paired them). Each computer makes its own secret and issues its own token, so no\ncomputer hands its tokens to another. Nothing in the request can pick the computers, the name or\nthe phone id, and the glasses may ask once\nevery 5 minutes. A password-protected computer is asked only when this computer has its password\nsaved; one whose Pane is too old to remember revokes is skipped.\n\nA glasses token cannot create a Pane, pair any device other than these same glasses on your other\ncomputers, reach anyone else's computer, change settings, write files, commit, run machine\ncommands, or choose what a terminal runs, and its event stream never carries terminal output.\n\nTyping into a terminal can run commands, so treat the glasses like your phone: whoever holds a\nworking token can type into your shells, from your tailnet or, for a computer paired by QR code,\nfrom anywhere. Through a computer's own address the glasses trust its public certificate; unlike\nthe Pane app, they don't check the computer's key. The Even app serves the glasses\napp's code, so a compromised Even build could read the token on your phone; revoke the glasses if\nyou lose the phone, and check **Last used** on each computer.\n\nThe pairing code on your clipboard holds one-time pairing secrets, not tokens, and expires after\n10 minutes.\n\n## Troubleshooting\n\n| On the glasses | Fix |\n|---|---|\n| Can't reach any computer | Turn Tailscale on in the phone's Tailscale app; for computers paired by QR code, check the phone's internet connection. The glasses reconnect on their own. |\n| Allow this app on the computer | Update Pane on that computer (see above). |\n| Not paired, or revoked | Pair again from Settings › Glasses in the Pane phone app. |\n| Locked out for N s | Wait. If you did not cause the refusals, revoke the glasses on that computer. |\n| Funnel is on | On the computer, run `tailscale funnel reset`, or turn Funnel off for port 8443. |\n| revoked here · pair from phone | That computer revoked the glasses. To use them there again, pair from Settings › Glasses in the Pane phone app. |\n| needs its password | The computer has a Workspaces password. Save it on one of your other computers by connecting to it once in **Settings › Remote Access**; that computer then adds the glasses. |\n| update Pane there | Update Pane on that computer. |\n| not answering | Start Pane on that computer and check that Tailscale is on there. The glasses try again within 10 minutes. |\n| Can't turn speech into text | Add a Deepgram or fal key on that computer. |\n| Deepgram rejected X's key, or X's Deepgram key isn't a valid key | On that computer, paste a current key from the Deepgram console in **Settings › Integrations › Voice transcription**. Pane checks it with Deepgram when you save. |\n| Lost the connection to X while listening | Hold to talk again. If it keeps happening, check Tailscale on the phone. |\n\n## For developers\n\nThe app lives in [`glasses/`](../glasses). Run the Even simulator against it and point a dev build of\nPane at it with `PANE_GLASSES_ORIGINS=http://localhost:5173` (an exact origin, comma separated for\nseveral; a loopback one covers every port). `glasses/dev/gallery.html` shows the screens the demo\ncan't reach, and `glasses/dev/ambient.html?at=35:q,60:answer` runs the demo with ambient mode on and\nraises or answers cards on a schedule (see the top of `glasses/dev/ambient.ts`). The host side is `main/src/daemon/glassesAccess.ts`; the shared pairing-code format is\n`shared/types/glasses.ts`.\n\nJoining other computers is `glasses/src/autoJoin.ts`; the host side is the `runpane:glasses:vouch`\ncommand. The home list is `glasses/src/homeList.ts`. The firmware list can't show images, so the app draws its\nown: six text rows beside two 28 × 120 px logo strips. A swipe rewrites the two rows that change; a\npage turn rewrites the rows and resends the strips. `LIST_MARKS = 'outline'` switches to the\nfallback: the firmware list with an outline shape per computer (○ □ △ ◇) and each away computer\nfolded into one row. Each swipe logs `[Pane glasses] swipe down → display ack 12 ms (2 text, 0 image)`\nto the WebView console, so swipe speed can be measured on real G2. `dev/gallery.html` shows the list\nwith every mark, an offline computer, computers that couldn't join, and the outline fallback.\n"},{"path":"docs/IMPORTING_FROM_ANOTHER_TOOL.md","title":"Importing from another tool","text":"# Importing from another tool\n\nPane can adopt a git worktree created by Conductor, another orchestrator, or by hand. An adopted Pane points at the existing directory while ownership stays with the tool that created it.\n\n## Adopt a worktree\n\nFirst save the base repository in Pane. Then adopt one of that repository's registered worktrees:\n\n```bash\nrunpane panes adopt \\\n --repo active \\\n --path /absolute/path/to/existing-worktree \\\n --name existing-work \\\n --agent codex \\\n --resume 00000000-0000-0000-0000-000000000000 \\\n --yes \\\n --json\n```\n\nUse `--dry-run` first to validate the path without creating a Pane. `--folder <name>` places the Pane in a top-level sidebar folder, and `--no-pinned` opts out of the default pin. The command resolves symlinks before storing the path and refuses directories that are not registered worktrees of the selected repository or are already registered in Pane.\n\nWhen `--resume` is present, Pane persists the agent session id and stages that agent's resume command in the terminal without pressing Enter. Review the command and press Enter when ready. Pass `--launch` to run it immediately. Do not drive the same transcript from two applications at the same time because both may append to the same transcript.\n\nThe JSON form supports the same fields:\n\n```json\n{\n \"repo\": \"active\",\n \"panes\": [\n {\n \"path\": \"/absolute/path/to/existing-worktree\",\n \"name\": \"existing-work\",\n \"folder\": \"in-review\",\n \"pinned\": true,\n \"tool\": { \"agent\": \"codex\" },\n \"resume\": \"00000000-0000-0000-0000-000000000000\",\n \"launch\": false\n }\n ]\n}\n```\n\nRun it with `runpane panes adopt --from-json panes.json --yes --json`.\n\n## Ownership and lifecycle\n\nPane stores `worktree_ownership: \"external\"` for adopted Panes. The sidebar labels them **External**, and `runpane panes list --json` returns `ownership: \"external\"` (ordinary Pane worktrees return `\"pane\"`). This marker is separate from main-repository mode and from the worktree name.\n\nPane never creates, file-syncs, builds, or recreates an external directory, and removes one only when asked. Archiving or permanently deleting an adopted Pane only removes Pane's record, unless you archive it with `runpane panes archive --pane <id> --remove-worktree`: that runs the same safety check as a Pane-managed worktree (uncommitted, untracked, and unpushed work block the archive without `--force`; untracked files under the root `.codex/`, `.claude/`, and `.agent-farm/` directories are ignored) and then removes the worktree. The local branch is kept. Deleting its saved project also leaves the directory and git worktree registration untouched. Restoring an adopted Pane whose directory has disappeared succeeds and displays `External worktree directory is missing`; Pane does not recreate it. Automatic checkpoint commits default to disabled for adopted Panes.\n\nOtherwise the tool that owns the worktree remains responsible for its archive and deletion lifecycle, and `runpane panes archive --dry-run --pane <id> --json` reports worktree cleanup as not applicable. Restoring an adopted Pane whose worktree was removed does not recreate it; `git worktree add <path> <branch>` does.\n\n## Imports from other tools\n\nTo bring sessions from Claude Code, Codex, Conductor, Paradev (formerly Superset), Herdr, Emdash, Orca or T3 Code in with their agents resumed, use Settings → AI & Agents → \"Bring sessions into Pane\" (see [Bring your existing sessions into Pane](SESSIONS.md#bring-your-existing-sessions-into-pane)). It adopts each idle checkout in place, as `panes adopt --resume` does. Pane already reads `conductor.json` for project scripts, but adoption deliberately does not run setup/build scripts.\n"},{"path":"docs/LOOPS.md","title":"Loops","text":"# Loops\n\nA loop runs an agent or command on a schedule. It runs in one of two places:\n\n- **A project.** Each run gets its own Pane (workspace) in a fresh worktree and\n branch, so the result of a nightly bug sweep or a weekly dependency check is\n ready to review like any other Pane.\n- **A Session.** Each run sends the loop's prompt to that Session's agent, with\n no new Pane, worktree or branch. Use it for a job that spans all your\n projects, such as a morning standup summary. See [Session loops](#session-loops).\n\nA project loop is a cron schedule plus the same request `runpane panes create`\ntakes:\n\n- the repository (`--repo`)\n- the agent (`--agent claude`, `codex` or `cursor`) or a custom command\n (`--tool-command`, such as `./scripts/nightly-report.sh` or `pnpm test`)\n- optional text typed into the agent or command after it starts (`--prompt\n <text>`, or `--prompt-file <path>` to read it from a file; `-` reads stdin)\n- a worktree and branch name template (`--worktree-name`, CLI and MCP only),\n `loop-<name>` by default. Each run adds its date and time, such as\n `loop-nightly-bug-sweep-20261024-0300`.\n\n## When to use a loop\n\nUse a loop for a large job that should run on a schedule: a nightly bug sweep,\na weekly docs audit, a Monday dependency check. Loops run at most once an hour.\n\nAn agent that needs to wait a few minutes, for CI or a review, sleeps and\nwakes with its own tools (such as a sleep command or its harness's wake-up\ntimer).\n\n## In the app\n\nOpen **Loops** in the sidebar, under Home and Pane Chat. The Loops page lists\nevery loop across your projects. Select one to see its schedule, next run, the\nstrip of its last 10 runs and a table of those runs. **+ New** and **Edit** open\na side drawer where you pick the project, what runs (Claude, Codex, Cursor or a\ncommand), and the schedule. Each run's branch is named after the loop, as\nabove.\n\nThe schedule works like Google Calendar's Repeat field. Pick **Hourly**,\n**Daily**, **Every weekday (Monday to Friday)**, **Weekly** (choose the days),\nor **Monthly** (choose the day of the month), then the time. The drawer shows\nthe schedule in words, such as \"Weekly on Mon, Wed, Fri at 9:00 AM\", the next\nthree run times and the cron it saves. **Custom cron** takes any five-field\ncron. Editing a loop opens its cron in the matching mode, or in Custom cron\nwhen no mode matches.\n\nA run's Pane shows a breadcrumb above its tabs (Loops › loop › run) that leads\nback to the loop, and a rail that switches between the loop's runs. Its\nDetails / Files / Changes sidebar starts closed; open it once and run Panes\nkeep it open.\n\n## From the CLI\n\nCreate a loop that starts Claude every day at 03:00:\n\n```bash\nrunpane loops create --repo active --name nightly-bug-sweep \\\n --cron \"0 3 * * *\" --agent claude \\\n --prompt \"Pick one bug from yesterday's issues, fix it, and open a PR.\" --yes\n```\n\nRun a custom command every Monday at 09:00:\n\n```bash\nrunpane loops create --repo my-app --name dependency-check \\\n --cron \"0 9 * * 1\" --tool-command \"./scripts/nightly-report.sh\" --yes\n```\n\nCheck a schedule before saving it. `--dry-run` prints the schedule in words and\nthe next run time, and saves nothing:\n\n```bash\nrunpane loops create --repo active --name docs-audit --cron \"0 16 * * 5\" \\\n --agent codex --prompt-file audit.md --dry-run\n```\n\nManage loops by id (`runpane loops list` shows it):\n\n```bash\nrunpane loops list\nrunpane loops update --loop <id> --cron \"0 4 * * *\" --yes\nrunpane loops run --loop <id> --yes\nrunpane loops pause --loop <id> --yes\nrunpane loops resume --loop <id> --yes\nrunpane loops delete --loop <id> --yes\n```\n\n`--repo` takes the same selectors as `panes create`: `active` (the repo\nselected in the app), a repo id, an exact path or a saved name. Commands that\nchange a loop need `--yes` when run from a script or agent; in a terminal they\nask first. `update` changes only the values you pass; `--agent` and\n`--tool-command` replace each other. Add `--json` to any command for\nmachine-readable output. The same commands are MCP tools: `loops_list`,\n`loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume` and\n`loops_delete`, in the default `core` toolset and the `loops` toolset (see\n[Pane MCP Server](PANE_MCP.md#toolsets)).\n\n## Session loops\n\nA Session loop targets a Session instead of a project. In the app, choose\n**Runs in: Session**, then pick **New Session for this loop** (named after the\nloop) or an existing Session. From the CLI, pass `--session` instead of `--repo`,\nwith a Session id, its name, or `new`:\n\n```bash\nrunpane loops create --session new --name morning-standup --cron \"0 9 * * 1-5\" \\\n --agent claude --prompt \"Summarize what changed across my projects since yesterday.\" --yes\n```\n\n- **Agent only.** A Session loop runs Claude, Codex or Cursor; it has no\n command, and it needs a prompt.\n- **Unattended for every message.** Saving the loop makes the Session's agent\n skip permission prompts, with the same launch flags as project runs (`claude\n --dangerously-skip-permissions`, `codex --yolo`, `cursor-agent --force\n --trust`). That holds for every message the Session gets, not only loop\n runs. A custom launch command gets the flags added after the agent's\n program; one Pane cannot change safely (a wrapper such as `sh -c`, an\n `env` or variable prefix, or `&&`, `;`, a pipe or a redirect) is refused\n when you save. Picking an agent other than the Session's switches the\n Session to it.\n- **The Session's folder is trusted.** When the Session's Claude runs on this\n machine, Pane answers its \"trust this folder\" prompt for the Session's own\n folder (see [Sessions](SESSIONS.md)). A WSL Session's Claude still asks on\n its first launch, and Codex can stop at its update menu when a new version\n is out; answer either once in the Session.\n- **Restart a running agent once.** An agent that is already running keeps\n the flags it started with. Until you exit it and start it again (it resumes\n the same conversation), runs are held and show as **needs attention**. Pane\n never restarts it for you.\n- **A run.** Pane starts the Session's agent if it is stopped, then sends the\n prompt to it. An agent busy with a turn gets the prompt queued after it. If\n the agent is stopped at a prompt of its own, or its launch exited back to\n the shell, the loop's prompt is not sent (Pane never types it into a shell)\n and the run shows as **needs attention**; open the Session and fix it.\n- **Kept runs.** The last 10 runs are listed. There is no run Pane to archive.\n\n## Rules\n\n- **Schedule.** One five-field cron expression, in the local time zone of the\n machine running Pane. `0 3 * * *` is \"Daily at 3:00 AM\"; `0 9 * * 1` is\n \"Weekly on Monday at 9:00 AM\". The app and `runpane loops` describe a\n schedule in these same words.\n- **At most once an hour.** Saving rejects a cron whose runs fall less than 60\n minutes apart.\n- **Pane must be running.** Runs start only while Pane is running on that\n machine.\n- **Missed runs.** A run up to 15 minutes late still starts, for example after\n the computer wakes from sleep. A later one is recorded as skipped. Missed runs\n are never caught up.\n- **Overlap.** A run starts even if the previous one is still going.\n- **Kept runs.** Pane keeps each loop's last 10 runs and archives older run\n Panes. A run Pane with unfinished work (a busy agent, unsent input, or\n uncommitted or unpushed changes) is not archived: its run stays in the loop's\n list with the note \"Kept because the run Pane has unfinished work\", so a loop can show more than 10 runs. Archive the Pane yourself\n when you're done; Pane tries again after each new run.\n- **Delete.** Deleting a loop stops its schedule. Its run Panes stay, as\n normal Panes.\n- **Pause.** A paused loop starts no scheduled runs. Resuming picks up at the\n next scheduled time.\n- **Permissions.** Runs are unattended, so Claude, Codex and Cursor runs skip\n their permission prompts. A `--tool-command` runs as written.\n- **Commands on Windows.** A `--tool-command` runs in Pane's terminal shell,\n which is Git Bash by default. Write it in bash, or call cmd with `//c`:\n `cmd //c echo hi > loop.txt` works. With `cmd /c`, Git Bash turns `/c` into a\n path, so cmd starts interactively and the run hangs.\n- **Folder trust.** Claude and Codex ask whether to trust a folder they have\n not seen, and each project run is a new worktree. A run stopped at that prompt shows\n as **needs attention**. Open the run and answer it, or open the project\n folder in the agent once and trust it so later runs start on their own. Pane\n answers a trust prompt only for a Session's own folder (see\n [Session loops](#session-loops)).\n- **Run now.** `runpane loops run` starts a run immediately, even while the\n loop is paused. The schedule stays the same, and the run counts toward the 10\n kept runs.\n\n## Runs\n\nEach project loop run is a new Pane in a fresh worktree branched from the\nrepository's default base branch. It appears as a normal Pane under its\nproject, and you review its work the way you review any Pane. A Session loop's\nruns happen in its Session; their `sessionId` is null.\n\n`runpane loops list --json` lists each loop's runs, newest first. A run's\n`status` is:\n\n- `started`: its Pane was created, or a Session loop's prompt was sent. For a\n project loop, `sessionId` is that Pane's id, so read its\n progress with `runpane agents status --pane <sessionId>`. When `error` is set\n too, something needed attention when the run started: the agent was stopped\n at a prompt such as folder trust, never became ready, or Pane could not\n confirm the prompt arrived. The app and plain `runpane loops list` show such\n a run as **needs attention**. On an older run, `error` can instead be the\n note that its Pane was kept for its unfinished work.\n- `failed`: the Pane could not be created, or the Session could not be\n reached; `error` says why.\n- `skipped`: the run came and went while Pane was not running or the computer\n was asleep.\n"},{"path":"docs/NATIVE_MOBILE.md","title":"Native Pane mobile companion","text":"# Native Pane mobile companion\n\n`mobile/` is a Capacitor companion that bundles `frontend/remote.html`; it never navigates a WebView to a remote host. Remote hosts are ordinary authenticated HTTP/SSE endpoints, so an arbitrary host never receives a privileged native bridge.\n\nEven G2 glasses pair from the native app's **Settings › Glasses**; see [Use Pane from Even G2 glasses](EVEN_G2_GLASSES.md).\n\n## Development\n\nUse patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x), and pnpm:\n\n```bash\npnpm mobile:sync\npnpm mobile:build:ios\npnpm mobile:build:android\n```\n\nThe first command builds the Remote Pane entrypoint and copies it to `mobile/www/` before syncing checked-in iOS and Android projects. iOS Simulator builds need Xcode. Android builds need `ANDROID_HOME` plus a JDK (Android Studio's bundled JBR is suitable).\n\nFor a first local Android build on macOS:\n\n```bash\nexport JAVA_HOME=\"/Applications/Android Studio.app/Contents/jbr/Contents/Home\"\nexport ANDROID_HOME=\"$HOME/Library/Android/sdk\"\n# Install the complete API 36 platform (including android.jar), build tools,\n# and accept its licenses in Android Studio's SDK Manager before this command.\n# Equivalent command-line setup when cmdline-tools is installed:\n# \"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager\" \"platforms;android-36\" \"build-tools;36.0.0\"\npnpm mobile:build:android\n```\n\n`mobile:build:ios` is a non-signing Simulator build. To run it, select a booted simulator in Xcode or use `xcrun simctl boot <device-udid>` first. It is not a substitute for a signed-device push test.\n\nProfiles and bearer tokens are in Keychain on iOS and EncryptedSharedPreferences on Android. Native profile removal makes a best-effort authenticated per-installation revoke before deleting the local bearer token; if the host is unreachable, rotate that host's pairing credential to revoke it server-side. Browser PWA storage remains browser `localStorage`.\n\nVoice dictation uses the transcription provider configured on the host. In the Expo app (`native/`), tapping the mic on a host without voice keys opens a sheet that asks for the one key the mode needs (live: Deepgram; recorded: fal), with OpenRouter as an optional key that cleans up the transcript. It saves them to the host through `remote:settings:update`, then starts recording. Saved keys show only as \"Set\", and Settings › Voice replaces them; see `native/README.md` (The composer). iOS declares its microphone purpose in `Info.plist`; Android declares `RECORD_AUDIO` and `MODIFY_AUDIO_SETTINGS`, which Capacitor requests when recording starts. Test both allowing and denying microphone access on a device before distributing a mobile build. The launcher icons reuse the existing opaque 1024px Pane artwork in `main/assets/icon.png`.\n\n## Push delivery operator setup\n\nPush is host-originated: killed-app delivery is an APNs alert (iOS) or FCM notification payload (Android), not a local notification or background JavaScript claim. The host sends the Pane or Session name and routing metadata; see the payload details below.\n\nFor iOS, register `com.dcouple.pane.mobile` (or your signed bundle identifier), enable Push Notifications, and add the capability in Xcode. Then give one host the APNs key in Settings → Integrations → iPhone notifications: choose the `.p8` file and enter the team ID. Pane shares it with your other hosts through your paired devices ([Shared integration keys](SHARED_CREDENTIALS.md)). A host can instead read it from its service environment, which wins over the shared key and is never shared:\n\n```bash\nPANE_APNS_TEAM_ID=... PANE_APNS_KEY_ID=... PANE_APNS_KEY_PATH=/secure/path/AuthKey.p8 PANE_APNS_TOPIC=com.dcouple.pane.mobile PANE_APNS_ENVIRONMENT=sandbox\n```\n\nThe phone's build decides which APNs endpoint accepts its token: an Expo dev client uses the sandbox, TestFlight and App Store builds use production. The host sends to the key's environment first (`PANE_APNS_ENVIRONMENT`, or the environment chosen in Integrations). When Apple answers `BadDeviceToken`, it tries the other endpoint once and remembers on that registration the one that accepted. It revokes the registration only when both refuse. Never place the `.p8` key in this repository, the app bundle, or a mobile build setting.\n\nPush needs Dcouple's APNs key, because only that key can send to the published app. A computer without it reports \"No Apple push key\" to the phone until the key reaches it.\n\n### Dcouple's credentials\n\nThese are the provider credentials Dcouple uses for `com.dcouple.pane.mobile`. Only paths and IDs are listed here; the files stay outside git.\n\n- **APNs:** team `FBM5YSF467`, key ID `DGM25BV23X` (team scoped, sandbox and production). The key file is `AuthKey_DGM25BV23X.p8`, kept at `~/.config/pane/apns/` (mode 600) on the machine that created it. Load it once in Settings → Integrations on one host, or copy it to a host outside the repo and set:\n\n ```bash\n PANE_APNS_TEAM_ID=FBM5YSF467\n PANE_APNS_KEY_ID=DGM25BV23X\n PANE_APNS_KEY_PATH=/secure/path/AuthKey_DGM25BV23X.p8\n PANE_APNS_TOPIC=com.dcouple.pane.mobile\n PANE_APNS_ENVIRONMENT=production # TestFlight and App Store builds; use sandbox for Expo dev-client builds\n ```\n\n A host launched as a service reads these from its service environment (systemd unit, launchd plist, or the shell that runs `pnpm daemon:headless`). `mobile:push-status` reports `APNs delivery is configured.` once they're valid.\nFor Android, create a Firebase Android app with the same application ID and download its real `google-services.json` (to `native/google-services.json` for the Expo app, or `mobile/android/app/google-services.json` for Capacitor; the checked-in `.example` is only a shape guide). The host then needs a way to call FCM as a sender service account. It supports two ways to do that:\n\n**Keyless (recommended).** The host impersonates a sender service account with the operator's own gcloud login, so no key file exists anywhere. This is the only option where the organization policy `iam.disableServiceAccountKeyCreation` is on. For the Pane project (`pane-pwa-preview`) the sender account already exists and has the Firebase Cloud Messaging API Admin role. Each operator needs two things:\n\n```bash\nSENDER=pane-push-sender@pane-pwa-preview.iam.gserviceaccount.com\n# Once, by a project owner: let this operator mint tokens for the sender, and nothing else.\ngcloud iam service-accounts add-iam-policy-binding \"$SENDER\" --project pane-pwa-preview \\\n --member=user:you@example.com --role=roles/iam.serviceAccountTokenCreator\n# On the host machine, as that operator: writes ~/.config/gcloud/application_default_credentials.json\ngcloud auth application-default login\n```\n\nThen set these in the host service environment:\n\n```bash\nPANE_FCM_IMPERSONATE_SERVICE_ACCOUNT=pane-push-sender@pane-pwa-preview.iam.gserviceaccount.com PANE_FCM_PROJECT_ID=pane-pwa-preview\n```\n\nFor each send, the host exchanges the refresh token from that login for a user access token, then calls the IAM Credentials API `generateAccessToken` for the sender with the `firebase.messaging` scope. It sends the message with that one-hour token. The login file is read from `GOOGLE_APPLICATION_CREDENTIALS` if that is set, otherwise from gcloud's default location. It must be an `authorized_user` login. Revoking the Token Creator binding, or running `gcloud auth application-default revoke`, stops delivery. Pane reports FCM as not configured when the login file is missing or unreadable.\n\nFor your own Firebase project, create a sender service account with `roles/firebasecloudmessaging.admin` on that project. Then grant Token Creator on that service account only, never at the project level.\n\n**Service-account key.** Where key creation is allowed, `PANE_FCM_SERVICE_ACCOUNT_PATH=/secure/path/service-account.json` still works and takes precedence over impersonation.\n\n**Through the relay.** A computer with neither APNs nor FCM keys sends its alerts through the relay it is connected to for [QR pairing](QR_PAIRING.md), which holds the Pane app's keys; the computer builds the same payload and the relay only signs and posts it, at most 60 alerts an hour per computer. The relay sends a phone's alerts only from a computer the phone confirmed: when the phone registers, the relay pushes it a silent grant for that computer, and the Pane app hands the grant back to that computer (`mobile:push-grant`), which sends it with each alert. A grant lasts 30 days, and the computer quietly gets a fresh one while the phone stays paired ([relay protocol](../relay/PROTOCOL.md#alerts)). Keys set on the computer always win.\n\nDo not commit any provider credential. CI gets the Firebase app config from the `PANE_ANDROID_GOOGLE_SERVICES_JSON` secret (see `native/README.md`); that file identifies the app and is not a sending credential.\n\nThe app registers with every computer it has saved, whether it paired by QR code, connected with a code or from Your Computers over Tailscale, and asks notification permission once, when the first computer reports that it can deliver. Notification setup runs independently of the terminal connection, so permission or provider errors leave remote terminal use available. Registration renewals preserve the installation's alert preferences and deduplication history. OS token registration and each provider network request time out after 15 seconds.\n\nPush-state writes merge with the latest host configuration inside the serialized config-write queue, so they cannot restore a concurrently revoked pairing. Hosts without registered mobile clients do not persist push state on every agent transition.\n\nAgent panels send alerts. A plain shell sends one only when a program in it reports its own blocked state ([Program status](PROGRAM_STATUS.md)), at most once a minute per tab. The name is the Session's for a Session's orchestrator, \"<Session> › <Pane>\" for a Pane associated with a Session, and the Pane's otherwise. A newly blocked agent sends \"<name> is blocked\" at once. A finished turn sends \"<name> needs your attention\" only for a turn a person started and only once: input ending in Enter through `terminal:input` (desktop, phone, remote web) or `runpane panels submit|input --source user` arms the panel, and the next finished turn disarms it. Turns an agent starts by itself (watchers, timers, `runpane` input without `--source user`) finish silently. A turn counts as finished when the agent showed its own working signal (title spinner or working chrome) and then stayed idle for 10 s; terminal output alone, such as typing or a redraw, never counts. Each Pane has one APNs collapse id and one FCM `tag`, so a newer alert replaces the older one. iOS stacks alerts by `thread-id`, the Session's workspace pane id (`sessionPaneId` in the payload) or the Pane's own id. Opening a Pane in the app removes its delivered alerts, and opening a Session also removes its workers'; Notify question alerts stay until the question is answered. Every send logs `[Pane mobile push]` with the platform, the kind and, on failure, the provider's status and reason. Tap metadata contains the client-local profile ID (including its host label, URL, and token suffix) and pane/panel IDs; no terminal output or full bearer token is sent. A tap is held in encrypted native storage until saved profiles load, then reconnects only to the matching saved profile, including when switching panels inside the selected pane. An unknown/deleted profile or pane produces an error without connecting to an unrecognized host. Push commands derive client identity from the authenticated request, ignoring caller-supplied identity arguments: a paired client's id, or `tailnet:<login>` when the phone reaches the computer over Tailscale Serve as the computer's owner. Another Tailscale user the computer lets in is refused with `ERR_MOBILE_PUSH_OWNER_REQUIRED`. A host with no live registration logs `[Pane mobile push] No phone is registered for alerts on this computer` when a Notify question opens.\n\n**Notify questions.** A Notify question still waiting about 90 seconds after it arrives sends one alert to each phone with Needs Input on; answering it, closing it or turning Approvals off first cancels the alert ([Alerts](PANE_NOTIFY.md#alerts)). The alert is titled with the Pane's name (the folder's, outside Pane) and saying only \"<name> has a question\". APNs alerts carry `notifyId`, `notifyUi` and a category: `pane.notify.approve`, `pane.notify.ask`, or `pane.notify.options` with `notifyChoices` and `mutable-content: 1` for 1 to 3 choices. A registration from Pane app 1.1+ (`notifyButtons: true`) gets Android data-only messages instead, and the app draws the alert with its buttons. When the question is answered elsewhere, the host sends a silent clear (`notifyClear`); older Android builds get the system alert and no clear. The phone answers from the alert's buttons through `notify:remote-command`, with the token from its secure storage, also from the lock screen and while the app isn't running. The app side, its iPhone notification service extension and how to test them are in `native/README.md` (Notify questions). Phones get this only from a new app build: the change is native, so it does not reach installed builds over the air.\n\nThe Expo app in `native/` also shows Autopilot when it is on for the computer: a bar on home's Needs you tile, its chat with decision cards, and full-screen approvals and documents, over the same host connection ([Autopilot on the phone](AUTOPILOT.md#on-the-phone-d-75-to-d-77), `native/README.md` (Autopilot)). The Capacitor shell does not.\n\nThe Expo app in `native/` uses the same host commands and payload. It registers the raw APNs/FCM device token, not an Expo push token, and routes taps and `pane-remote://` / `pane://pane/…` links as described in `native/README.md` (Notifications and links).\n\nProvider credentials, Apple signing, Firebase setup, and physical-device delivery cannot be validated by this repository alone. In Apple Developer, create an App ID matching the final bundle ID, enable Push Notifications, create an APNs auth key, and configure an App Store Connect record/signing team before TestFlight upload. In Google Play/Firebase, create the Android app and give the host a sender identity as described above. iOS Simulator builds do not prove APNs delivery; A Google Play system image in the Android emulator does receive real FCM messages, so the Android path can be checked end to end without a device. Missing host delivery configuration produces an actionable registration error while ordinary remote terminal use continues.\n"},{"path":"docs/PANE_MCP.md","title":"Pane MCP Server","text":"# Pane MCP Server\n\n`runpane mcp` is an MCP server that gives coding agents Pane's `runpane` commands as tools. With it, an agent in any repository can list saved repositories, create Panes, open panels, read terminal screens, and send input. Pane installs a `pane` skill in the user's home skill folders so agents can find the CLI and how to connect.\n\n## Automatic registration\n\nThe Pane desktop app registers the server for you. On launch, Pane adds a `pane` MCP server to your user-level config:\n\n- **Claude Code**: via `claude mcp add pane --scope user …`, which writes `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`).\n- **Codex**: a `[mcp_servers.pane]` table in `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`).\n- **Cursor**: a `mcpServers.pane` entry in `~/.cursor/mcp.json`. Pane detects Cursor from `~/.cursor`, `cursor`, `agent`, or `cursor-agent` on PATH.\n\nPackaged Pane also installs the on-demand `pane-manage-and-message-agents` user skill for detected Claude Code, Codex, and Cursor clients. Cursor uses `~/.cursor/skills/`; Claude Code and Codex use their user skill folders (including `$CLAUDE_CONFIG_DIR` and `$CODEX_HOME`). Pane leaves hand-added skills alone and removes only its own copy when registration is off. The same applies inside detected WSL distros. [Cursor documents `~/.cursor/skills/` as a user-level Agent Skills directory](https://cursor.com/docs/skills).\n\nPane registers only when it detects the corresponding client, and it manages only the entry it wrote:\n\n- It leaves other MCP servers and settings alone and never writes a second `pane` entry.\n- It rewrites its own entry when the app moves or updates.\n- A `pane` entry you added yourself (for example with `npx runpane mcp`) is left untouched, including when you turn the setting off. For Claude Code, Pane's entry is the one that runs `<Pane data dir>/mcp/runpane/dist/cli.js`. For Codex, it's the `[mcp_servers.pane]` table carrying the `# Managed by Pane` comment. For Cursor, it is the entry whose first argument is Pane's bundled runpane copy.\n- Pane edits `config.toml` as text, so your comments and formatting survive. It then parses the result and writes nothing unless the only change is Pane's own entry. Cursor JSON is parsed before editing; invalid JSON is left untouched. Writes are atomic and follow a symlinked config.\n\nOn Windows, Pane also registers inside each WSL distro that has a saved WSL repository. Agents there run the Windows Pane binary through WSL interop.\n\nThe registered command is the Pane executable in Node mode (`ELECTRON_RUN_AS_NODE=1`) running a copy of the runpane CLI at `<Pane data dir>/mcp/runpane/dist/cli.js`. No Node.js or npm install is needed. Only packaged builds register; a development build never touches your agent config.\n\nTo turn this off, open **Settings → AI & Agents** and switch off **Register Pane tools with Claude Code, Codex, and Cursor**. Pane then removes its entry from each config.\n\nRestart a running `claude` or `codex` session to pick up a new registration. In Cursor, start a new chat or use **Developer: Reload Window**. Check with `claude mcp list`, `codex mcp list`, or `agent mcp list`. Cursor CLI may require `agent mcp enable pane` to add the server to its local approved list; Pane leaves that trust decision to you.\n\n## Claude tabs Pane starts: one HTTP server\n\nClaude Code and Claude chat tabs that Pane starts reach the same tools over HTTP, served by the running Pane app, instead of each starting its own `runpane mcp` process:\n\n- Pane listens on `127.0.0.1` at a random port, path `/mcp` (streamable HTTP, stateless), on the same loopback listener as Claude's prompt hooks. It answers only loopback `Host` headers and loopback or absent `Origin` headers.\n- A tab whose agent uses this endpoint gets a random token, held in Pane's memory and in that tab's environment as `PANE_MCP_TOKEN`, with the URL in `PANE_MCP_URL`. Other tabs get neither. The token alone tells Pane which tab is calling; a tool call runs `runpane` with that tab's environment and folder, and Pane's own data folder (`PANE_DIR`), exactly as the tab's own stdio server would. A request without a live token gets `401`. Closing the tab, or its shell exiting, revokes the token, and a tab restart gets a new one. Tokens are never logged, written to disk, or put on a command line.\n- A Claude terminal launch gets `--mcp-config=<Pane data dir>/mcp/pane-http.json` (the agent config's `terminal.paneMcpConfigFlag`). That file names the `pane` server with `${PANE_MCP_URL}` and `Bearer ${PANE_MCP_TOKEN}`, which Claude reads from the tab's environment. Claude puts it in place of the user-level `pane` entry, so the agent sees one `pane` server. A command with `--strict-mcp-config` runs unchanged.\n- A Claude chat tab passes the same server, with the same two variables, in its ACP `session/new` request (`chat.paneMcpHttp`); the token is in the adapter's environment only.\n- Everything else keeps the user-level stdio server: Codex and Cursor tabs, WSL and SSH tabs, wrapped or preserved launch commands, and agents you start outside Pane. Codex merges a per-launch `-c mcp_servers.pane` into the user-level stdio table and then refuses to start, and its ACP adapter skips a session server whose name the config already defines. Cursor has no per-launch MCP option. Either would need a per-launch way to replace a same-named server.\n- Pane quits its tabs with itself, so after a restart each tab starts with a fresh token and URL.\n- Settings apply at once. With **Register Pane tools** off, new tabs get no token, and a running tab's calls get `403` until it restarts on stdio. A toolsets change applies to the next request.\n- Serving is stateless. A call ends, and its `runpane` process stops, when the agent drops the request; a separate `notifications/cancelled` message has no request to cancel. An agent that names itself only at `initialize` is named after the tab's agent, so `notify` keeps its long wait.\n\n## Claude plugin\n\nPane's Claude plugin (the [`claude-plugin/`](../claude-plugin/README.md) folder) gives Claude Code and Cowork the `pane` and `pane-manage-and-message-agents` skills and this server, started as `npx -y runpane@<pinned version> mcp --toolsets plugin`. The pinned runpane hands each call to the installed Pane's own CLI when that one is newer, so the tools follow the installed Pane.\n\nWhile the plugin is on in Claude Code's user settings (`enabledPlugins` has `pane@<marketplace>` set to `true`), Pane steps aside so Claude sees one Pane server and one copy of each skill:\n\n- On launch, Pane removes its own `pane` entry from Claude Code's user config and its own Claude copies of the two skills. If Pane is already running when you turn the plugin on, restart Pane so it removes them. After you turn the plugin off, restart Pane to bring them back. Codex and Cursor registration is unchanged.\n- Claude terminal tabs that Pane points at its HTTP server also deny the plugin's server (`deniedMcpServers`, `plugin:pane:pane`). Claude keeps only the last `--settings`, so the deny goes into the one settings file Pane already gives each Claude tab for its prompt hooks, merged with any settings the command passes (such as a Session's folder access). Chat tabs get the same deny in their session settings.\n\n## Toolsets\n\nA server that offers dozens of tools makes models, especially smaller ones, worse at choosing the right one. So by default the server serves a lean `core` toolset, and everything else is opt-in:\n\n| Toolset | Tools |\n|---|---|\n| `core` (default) | `agents_start`, `agents_status`, `agents_send`, `panels_create` (a new agent tab in an existing Pane), `panels_input` (exact keys, for menus and prompts), `panels_open` (show a page or file beside the agent), `repos_list`, `repos_add`, `repos_rename`, `panes_list`, `workspace_state`, `panes_git_status`, `panes_adopt`, `panes_rename`, `panes_archive`, `panes_restore`, `sessions_create`, `sessions_associate`, `sessions_pin`, `links_create`, `docs_search`, `docs_read`, `doctor`, `notify` (ask the person and wait for the answer), `secrets_request` (ask the person for a secret, saved as a [Pane secret](PANE_SECRETS.md); the value never comes back), `theme_read` and `theme_set` (restyle Pane itself with a [Custom theme](APPEARANCE.md#custom-theme), only when the person asks), the six device tools (`device_list`, `device_open`, `device_screenshot`, `device_act`, `device_run`, `device_close`; see [Devices](DEVICES.md)), the four `workspace` tools, and the seven loop tools (`loops_list`, `loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume`, `loops_delete`) |\n| `agents` | the three agent tasks, `workspace_state`, `watch` |\n| `panes` | create, adopt, list, archive, restore, pin, unpin, rename, focus, pause, resume, cost, run and stop the run script, move to a folder, `folders_list`, `folders_create` |\n| `panels` | create, open, list, output, screen, input, submit, submit-composer, wait, pause, resume, last-message, close |\n| `workspace` | `workspace_list`, `workspace_read`, `workspace_write`, `workspace_exec`: find your other machines, move files to and from them, and run commands there (see [Workspaces](RUNPANE_WORKSPACES.md)) |\n| `git` | status, commit, push, pull, fetch, rebase onto main, squash-rebase onto main, stash, stash-pop, soft reset (`panes_*`) |\n| `sessions` | the `sessions_*` tools (including `sessions_pause` and `sessions_resume`) and the three named-lock tools (`lock_acquire`, `lock_release`, `lock_list`) |\n| `loops` | `loops_list`, `loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume`, `loops_delete` (see [Loops](LOOPS.md)) |\n| `autopilot` | `autopilot_status`, `autopilot_waiting`, `autopilot_stack`, `autopilot_stack_push`, `autopilot_answer`, `autopilot_close`, `autopilot_rewrite`: Autopilot's (experimental) reads, its stack, and its actions on waiting items. `autopilot_stack_push` takes one `tab` per call (the CLI's `--tab` repeats). Only Autopilot's panel may act (`AUTOPILOT_ONLY`), and a permission prompt, or an answer or rewrite of a secret card, is refused with `AUTOPILOT_CANNOT_ANSWER` |\n| `repos` | the repository tools, including `repos_get` and `repos_update` (a repo's Project Settings: build, run and archive scripts, worktree folder) |\n| `devices` | the six device tools plus `device_usage` and `device_free`, which report and free what simulators use on this machine ([Devices](DEVICES.md)) |\n| `secrets` | `secrets_list`, `secrets_delete`. No tool sets or reads a value: agents use secrets through `runpane secrets exec` ([Pane secrets](PANE_SECRETS.md)) |\n| `docs`, `links`, `admin` | documentation, deep-link, and diagnostic tools |\n| `plugin` | `core` without the four `workspace` tools: what the [Claude plugin](#claude-plugin) serves |\n| `all` / `read` | every tool / every read-only tool |\n\nChoose with `runpane mcp --toolsets core,git` (comma-separated). `--read-only` keeps only read-only tools from whatever is selected. The Pane app registers `core` by default; **Settings → AI & Agents → Pane tools to register** switches it to `all`. Each command's toolsets live in the contract's `toolsets` field. A command's `cliOnlyFlags` stay out of its tool: over MCP, `doctor` diagnoses only, and `--fix` and `--report` run from the CLI.\n\n## The three agent jobs\n\nThe core set is built around the three jobs agents most often need, each finished in one call:\n\n- `agents_start`: starts the agent with the task, waits until it is ready, and returns the pane and panel ids and a `pane://` link. Pass `pane` to open it as a new tab in an existing Pane (review, audit, fix, QA); pass `repo` and `name` only for new work, which creates a Pane. Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it (`runpane doctor` has Pane's working rules).\n- `agents_status`: whether the agent is working, ready, blocked (waiting on a person), idle, or exited, plus its current screen.\n- `agents_send`: submits a follow-up and reports whether the agent took it or queued it behind its current turn (`delivery`), read from the agent's transcript where Pane can find it.\n\n## Asking the person: notify\n\n`notify` asks the person a question, or tells them something, on screen wherever they are, and returns their answer as the tool result. `ui` picks the look: `options` (1 to 9 `choices`; returns `{answer, note?}` with the chosen label), `approve` (returns `{approved, note?}`), `ask` (returns `{answer}`), or `info` (returns `{delivered}` at once). `choices`, `suggestions` and `action` are typed arrays and objects in the input schema. It needs no `yes`. When Pane is not running, Approvals is off, or the Pane is too old to have notify, it returns `{unavailable, next}` and the agent asks in its terminal instead.\n\nFor an API key, token or password, agents call `secrets_request`, never `notify` with `ask`. The person enters the value on a secret card, Pane saves it as a [Pane secret](PANE_SECRETS.md), and the result is only `{status: \"saved\", project, name}` or `{status: \"declined\"}`. When it returns `unavailable`, the agent asks the person to save the secret in Pane under Settings > Secrets.\n\nA question can wait for hours, and each client limits a tool call differently:\n\n- While any call runs, the server sends a `notifications/progress` about every minute when the request carried a progress token. That keeps Claude Code's 30-minute idle window open, over stdio and over Pane's HTTP endpoint alike.\n- Claude Code and Codex wait in one call. Pane's registration gives Codex a long per-server tool timeout.\n- Every other client, including Cursor's CLI (which ends each call after a fixed 60 seconds), gets `{waiting: true, id, next}` after about 50 seconds. The question stays on screen, and the agent calls `notify` again with `resume: <id>`. Pane ends this loop after 15 minutes without an answer and returns `unavailable`.\n\nThe server tells Pane which agent is asking (Claude, Codex, Cursor, or the client's own name) from the client's MCP name, and inside a Pane terminal the question names its Pane and panel. See [Pane Notify](PANE_NOTIFY.md).\n\n## Docs and links\n\n`docs_search` searches Pane's docs, `runpane` help, per-command context, and the Pane Chat skills installed in the Pane data directory. It returns short excerpts with paths. `docs_read` returns one path in full. Both work offline, and the same docs are listed as `runpane-docs:` MCP resources.\n\n`links_create` builds `pane://open?pane=<id>[&panel=<id>]`, `pane://open?repo=<id>`, or `pane://open?session=<id>`. Pane registers the `pane://` scheme on macOS, Windows, and Linux. Opening a link (from a browser, a terminal, or `links_open`) raises Pane and selects what it names. It never changes Pane state, and a link with any unexpected part is rejected.\n\n## Registering by hand\n\nWithout the desktop app, or for another MCP client, run the server from npm: `npx --yes runpane@latest mcp`. Add `--toolsets <names>` to choose tools.\n\n```bash\nclaude mcp add --scope user pane -- npx --yes runpane@latest mcp\ncodex mcp add pane -- npx --yes runpane@latest mcp\n```\n\nCursor (`~/.cursor/mcp.json`):\n\n```json\n{ \"mcpServers\": { \"pane\": { \"type\": \"stdio\", \"command\": \"npx\", \"args\": [\"--yes\", \"runpane@latest\", \"mcp\"] } } }\n```\n\nVS Code (`.vscode/mcp.json`, or run **MCP: Add Server**):\n\n```json\n{ \"servers\": { \"pane\": { \"type\": \"stdio\", \"command\": \"npx\", \"args\": [\"--yes\", \"runpane@latest\", \"mcp\"] } } }\n```\n\nAny other client that can launch a stdio server uses the same command and arguments.\n\n`agents_send` uses the target agent's composer state. For Codex, it queues with Tab while the agent is working and submits with Enter when ready. A send is confirmed only after the text leaves the composer; if it remains, the result includes a command to retry the appropriate key. `panels_submit_composer` with `strategy: auto` uses the same keys.\n\n`runpane mcp` is stdio only: it runs next to the Pane app on the same machine, with no OAuth. Pane's own HTTP endpoint serves only the tabs Pane starts on this machine. To drive a remote Pane, run the server on the remote host.\n\nThe Python package (`pipx run runpane`) does not include the MCP server, the docs search, or the agent tasks, because they need Node. From Python, those commands print the npm command and exit with status 2.\n\n## Manual test steps\n\nAutomated tests cover the registration and link logic on every OS. Check these by hand on a packaged build of each platform.\n\n**macOS, Windows, and Linux**\n\n1. Install and launch Pane, with Claude Code, Codex, and Cursor installed.\n2. Run `claude mcp list`, `codex mcp list`, and `agent mcp list`. Each lists `pane`. If Cursor asks for approval, run `agent mcp enable pane`; it should report ready with 37 core tools.\n3. In a fresh `claude` session, ask \"Use Pane to list my repos\". It calls `repos_list`.\n4. Quit and relaunch Pane. The Claude, Codex, and Cursor configs are unchanged.\n5. Turn off **Settings → AI & Agents → Register Pane tools with Claude Code, Codex, and Cursor**. `pane` is gone from all three configs, and the other entries are unchanged.\n6. Open a Claude tab in a Pane and type `/mcp`. It lists one `pane` server under built-in MCPs, and no `runpane mcp` process runs under that `claude`. Ask it to list Panes; it calls `panes_list` over HTTP.\n\n**pane:// links**\n\n1. Get a link: `runpane links create --pane <pane-id>`.\n2. With Pane running, open it from a browser or a terminal:\n - macOS: `open \"pane://open?pane=<pane-id>\"`\n - Windows: `start \"\" \"pane://open?pane=<pane-id>\"`\n - Linux: `xdg-open \"pane://open?pane=<pane-id>\"`\n3. Pane comes to the front on that Pane, and no second Pane window opens. On Windows and Linux, the extra process hands the link to the running Pane and exits.\n4. Quit Pane and open the link again. Pane starts and opens that Pane.\n5. Open `pane://open?pane=<pane-id>&archive=1`. Pane logs `Unknown pane link parameter: archive` and changes nothing.\n6. On Linux, check the handler: `xdg-mime query default x-scheme-handler/pane` names Pane's desktop file (AppImage and .deb).\n\n**Windows with WSL**\n\n1. Save a repository that lives in a WSL distro, with Claude Code, Codex, and Cursor installed inside that distro.\n2. Relaunch Pane. Inside the distro, `claude mcp list`, `codex mcp list`, and `agent mcp list` show `pane`, whose command is `/mnt/c/.../Pane.exe`.\n3. From a `claude` session inside the distro, ask \"Use Pane to list my repos\". The call reaches the Windows Pane.\n4. Turn the setting off. `pane` is gone from the distro's configs too.\n\n## Example prompts\n\n- \"Use Pane to start Claude on fixing the login redirect in the web repo, and give me a link to watch it.\"\n- \"How is the agent in my fix-login Pane doing? Does it need anything from me?\"\n- \"Tell the fix-login agent to also add a test for the redirect.\"\n- \"Which of my Panes have uncommitted or unpushed work?\"\n- \"How do I archive a Pane and get it back later? Check Pane's docs.\"\n\n## Not supported\n\n- Streaming. `watch --follow` and `watch --until-event` aren't offered; use `agents_status`, or `watch` with `timeoutMs`.\n- App settings. Agents can't read or change Pane's settings.\n- Permanently deleting Panes or removing repositories. Those stay in the app, where the user sees what goes.\n- Pagination (the full list is small).\n- Code or scripts run inside the MCP server itself. Agents run code in Pane terminals through `agents_start` and `agents_send`.\n\n## Protocol\n\nThe server uses the MCP TypeScript SDK v2, over stdio or (in Pane) streamable HTTP. It speaks MCP revision 2026-07-28, which has no handshake: `server/discover`, with the version and client capabilities carried on each request. It also accepts the 2025 `initialize` handshake that current Claude Code and Codex releases send, negotiating down to 2025-11-25.\n\nOver stdio, only JSON-RPC goes to stdout, the server exits when stdin closes, and cancelling a call (`notifications/cancelled`) stops the `runpane` process running it. Over Pane's HTTP endpoint, dropping the request does.\n\n## Tools\n\nTools are generated from [`contracts/runpane/contract.json`](../contracts/runpane/contract.json) when the server starts:\n\n- Every command that has result `jsonSchemas` becomes a tool. Spaces and hyphens in the name become underscores: `repos list` → `repos_list`, `panels submit-composer` → `panels_submit_composer`.\n- The tool's inputs are the flags from the command's `usage` lines and its `agentContext` arguments, in camelCase (`--timeout-ms` → `timeoutMs`). Flags that take a value are strings and flags without one are booleans, unless the `agentContext` argument declares a JSON `schema` (an enum, array, or object); array and object values reach the CLI as JSON (`--choices=[...]`). Daemon commands also accept `paneDir`. Positional `agentContext` arguments become string inputs too: `<machine>` and `<path>` go where the first usage line puts them, and `-- <command>` becomes `command`, passed after `--`.\n- The description combines the command's summary, details, and notes from `agentContext`. The title is `runpane <command>`.\n- The output schema is the command's `*Result` JSON schema. Every call runs `runpane <command> … --json` and returns its JSON output, both as `structuredContent` and as a text block for older clients. Mentions of `runpane <command>` in that output are rewritten to name the tool, except in `docs` and `workspace` tools, whose file contents and command output come back unchanged.\n- A non-zero exit returns a tool error (`isError: true`). A CLI failure reads as its message, a `Next:` line that names tools instead of CLI commands, and a `Code:` line; a command's own `ok: false` result comes back as its JSON. Bad arguments are tool errors too, so the model can correct them. An unknown tool name is a JSON-RPC Invalid Params error (`-32602`).\n- Annotations come from the contract. `readOnlyHint` is the inverse of `mutates`. A mutating tool is `destructiveHint: true` unless the command is marked `additive`. `idempotentHint` and `openWorldHint` follow the `idempotent` and `openWorld` fields.\n- Values are passed as `--flag=value`, so a value may start with `-` (for example `- [ ] item`).\n\nAdding or changing a command in the contract changes its tool. There is no per-tool code.\n\nA few flags are left out. `--json` is always passed. `--follow` and `--until-event` are omitted because a streaming or open-ended watch cannot return a single result; call `watch` with `timeoutMs` instead. Tools have no stdin, so pass exact terminal bytes in `text` (for example `\\u0003` for Ctrl-C) rather than `inputFile: \"-\"`.\n\n## Confirmation\n\nMutating tools keep the CLI's confirmation rule. Every command whose usage includes `--yes` gets a `yes` input; without `yes: true`, the call fails with the CLI's own refusal and changes nothing. `workspace_exec` and `workspace_write` have no `--yes` in the CLI, so the server asks for `yes: true` itself and refuses the call before anything runs. `notify`, `secrets_request`, `theme_set`, `report`, and the `sessions_*` and lock tools have no `yes`. Tools are also annotated with `readOnlyHint`, so clients can auto-approve read-only tools and prompt for the rest.\n\n## Agent guidance\n\nPane installs a managed `pane` skill under `~/.claude/skills/pane` (or `$CLAUDE_CONFIG_DIR/skills/pane`) and `~/.agents/skills/pane`, including saved WSL distros on Windows. It leaves any existing skill without Pane's marker alone, rewrites a copy an older Pane marked, and leaves a copy a newer Pane marked. The skill also covers what to do when tools look missing: the bundled CLI (`$PANE_RUNPANE_BIN`, `~/.pane/bin/runpane`) before `npx`, `runpane notify` when this server's tools are not loaded, and where Pane keeps its data. **Install Pane skill for agents** in Settings → AI & Agents controls the installation; turning it off removes Pane's copy.\n\n**Publish Pane instructions to AGENTS.md** is off by default. If enabled, Pane writes a marked block into the active repository's `AGENTS.md` with CLI and MCP setup instructions. Turning it off removes only Pane's marked block from saved repositories. On upgrade, Pane turns off the old default once and removes those blocks; a later opt-in is remembered. The full command catalog lives in MCP tools and `runpane agent-context`.\n"},{"path":"docs/PANE_NOTIFY.md","title":"Approvals (Pane Notify)","text":"# Approvals (Pane Notify)\n\nAgents ask you questions through Pane instead of waiting in their terminal.\nAn agent calls the `notify` MCP tool (or `runpane notify`), Pane shows the\nquestion wherever you are, even over your browser, and the agent gets your\nanswer as the tool's result. Inside Pane, everything that waits on you is in\n**Approvals**, filed under the Session it belongs to. `notify` is the agents'\nside of it, and keeps its name in the CLI, the MCP server and the code.\n\n## What an agent can send\n\n`notify` takes one `ui` value, which picks the card:\n\n| `ui` | Card | Result |\n| --- | --- | --- |\n| `options` | The question and 1 to 9 `choices` (`{label, detail?, recommended?}`), or 2 to 4 `questions` (`{title, choices}`, one pick each) instead. The strip shows four, then **More**. | `{answer, note?}` (`answers[]` too for several questions), or `{reply, picks?, id, next}` when the person typed something ([Replies](#replies-and-new-versions)) |\n| `approve` | Deny and Approve, plus a disclosure with the preformatted `detail`. `detailLabel` names the disclosure (up to 40 characters; default **Show details**). | `{approved, note?}` |\n| `ask` | A text field, with optional `suggestions` as chips above it. | `{answer}` |\n| `secret` | A masked field with **Save securely** and **Decline**. Created only by `runpane secrets request` (MCP `secrets_request`), never with `notify --ui`. The host saves the value as a [Pane secret](PANE_SECRETS.md) and drops it; it never reaches the agent, history or other screens. No Undo. | `{status: \"saved\", project, name}` or `{status: \"declined\"}` |\n| `info` | One line, with at most one `action` button (`{label, url}`). It returns at once and hides after a few seconds. | `{delivered: \"screen\" \\| \"inbox\"}` |\n\nEvery card takes a `title` (one line on the strip, wrapping to three) and an\noptional `context` shown under **Details** and in the round. A `context` that\nis a status file or a `needs_you` block, as JSON, never shows raw: Pane shows\nits question and `why`, adds its `files` as links, and turns an `ask` with no\n`suggestions` into an `options` card with the question's `options` as choices;\nother JSON shows one `summary`, `step` or `title` line, or none. On `--update`\nthe new context is read the same way, but the card keeps its `ui`, and its\nchoices and links unless the update passes them. Prose stays as written, even\nwhen it starts with `[` or `{`. Any card also\ntakes up to 6 `links` (`--links`), related files and pages shown as chips:\n`{label, path}` for a file on the asking machine (relative to its working\ndirectory), `{label, url}` for an http or https page, or `{label, approval}`\nfor another approval (its id or Q-n). Older Panes ignore them.\nIn Approvals, clicking a chip opens it as a tab beside the card: a file in an\neditor tab, a page in a browser tab, another approval in place, with **Back**.\n\nPane builds each approval's **Summary** from these fields (D-225), unless the\nasker linked its own `.html` Summary page (a worker's `--summary-file`, or\n`summary` in its `needs_you`). Agents write a card to read on its own: a\none-line title of about 80 to 100 characters, `context` of one or two sentences\non why it matters (up to 240 characters), 2 to 4 choices each with what it does\n(`detail`) and exactly one `recommended`, and links to every reference: files,\nPRs and other approvals. Every way of asking goes through one check\n(`main/src/services/notify/cardCheck.ts`): Pane refuses a title over 160\ncharacters or with a line break, and two recommended options in one question,\nand returns a warning for each softer miss, which `runpane notify` and\n`runpane report` print. An old paragraph card (the whole question in its title,\nwith no buttons) is first split by fixed rules into a title, options and\nlinks (`cardTidy.ts`); the card reads \"Tidied by Pane\" and **Show as sent**\nshows what the agent sent.\n\n**Which card.** Pane's approvals text (`main/src/services/approvalsRules.ts`,\n\"Asking the person in Pane\") is the one rule every Pane text carries: Claude's\nown card (AskUserQuestion) only for a quick question that answers the person's\nlatest message in the chat they are typing in and only steers that turn;\neverything else, including any worker's question in a Session, is an approval\ncard. Codex and other agents without a built-in card always use an approval.\n`main/src/services/approvalsRules.test.ts` fails when a copy drifts.\n\nWhen Approvals is off or Pane isn't running, the result is\n`{unavailable, next}` (\"Approvals are off in Pane.\") and the agent asks in its\nterminal as it does today.\nFor an API key, token or password, agents call `secrets_request` (or\n`runpane secrets request`), never `ask`. When that returns `unavailable`, the\nagent asks you to save the secret in Pane under Settings > Secrets.\n\n```sh\nrunpane notify --ui options --title \"Which session store should the refactor use?\" \\\n --choices '[{\"label\":\"Postgres table\",\"recommended\":true},{\"label\":\"Keep Redis\"}]' \\\n --links '[{\"label\":\"Plan\",\"path\":\"docs/plan.html\"},{\"label\":\"PR #12\",\"url\":\"https://github.com/acme/app/pull/12\"},{\"label\":\"Q-12\",\"approval\":\"Q-12\"}]'\n\n# Several questions in one card\nrunpane notify --ui options --title \"Q-20: How should the release train start?\" \\\n --questions '[{\"title\":\"Turn it on now?\",\"choices\":[{\"label\":\"Yes, turn it on\",\"recommended\":true},{\"label\":\"Not yet\"}]},{\"title\":\"How many trains?\",\"choices\":[{\"label\":\"One train\",\"recommended\":true},{\"label\":\"Two trains\"}]}]'\n```\n\n## Who asks: Sessions\n\nPane files each item under the Session its Pane belongs to (a Session's own\norchestrator tab is marked as the orchestrator). Items from a Pane in no\nSession go under \"Not in a Session\". Items Autopilot asks itself go under\n\"Autopilot\", marked \"written by Autopilot\" ([AUTOPILOT.md](AUTOPILOT.md)).\n\n- **Workers in a Session don't call `notify`.** Approvals come from the\n Session's orchestrator, not from the agents in its Panes. A worker reports\n blocked to its orchestrator (`runpane report --state blocked --question\n \"<question>\"`). That question is a card at once, with an answer box, and it\n rings once the orchestrator relays it or after 10 minutes, so the orchestrator\n first settles what the plan already answers. Your answer goes straight to the\n worker's tab (`answer: Q-n → <answer> (by you)`), even with the orchestrator\n down. A typed reply goes there too (`reply: Q-n → …`), and to the\n orchestrator that relayed it when the worker can't read it\n ([Replies](#replies-and-new-versions)). A worker's `notify` call isn't shown: it returns `unavailable`, \"Not shown to the\n person: in a Pane Session, only the orchestrator asks the person.\", with a\n `next` that says to report blocked. Claude's own permission and plan\n prompts and a chat tab's prompts on a worker tab are the tool asking, so\n they still reach you, filed under the Session.\n- **A Session orchestrator** keeps every item that waits on you posted to\n Approvals exactly once, titled with its Q-n and with the worker's files as\n links. It relays a worker's question into that card (`runpane notify --relays\n <item> ...`), which gains choices, context and links, then records the decision\n (`runpane inbox ack <item> --decision <D-n>`), and the card reads \"Recorded as\n D-n\". It posts its own items with `runpane notify ... --json`. Both run as\n background commands, so it stays free to talk: you can ask it about an item in\n its own tab while the card waits. The\n full rule is in the orchestrator guide\n (`runpane docs read --doc skills/pane-orchestration/SKILL.md`, \"What waits\n on the person\"). A second card from an orchestrator on the older rules keeps\n working for one release.\n- **Autopilot** asks with `notify` too, and can answer, close and rewrite items\n within its rules ([AUTOPILOT.md](AUTOPILOT.md)).\n- **Any other agent** calls `notify` as before.\n\nClaude's permission prompts and chat tab prompts (below) still come straight\nfrom the asking tab, filed under its Session.\n\n## Claude's own prompts\n\nClaude tabs Pane starts also ask their permission and plan prompts in Approvals,\nwithout the agent calling `notify`. The terminal shows the prompt as usual;\nthe first answer from the terminal, Approvals, the strip or the phone wins.\n\n- **Desktop Approvals** shows Claude's choices: Yes, each \"Yes, and don't ask\n again for …\" or \"Yes, and allow access to …\" that Claude suggests, and No.\n A note on No tells Claude what to do instead; without one, Claude stops and\n waits, as No does in the terminal. A plan shows its text with \"Yes, and\n auto-accept edits\", \"Yes, and manually approve edits\" and \"No, keep\n planning\".\n- **The phone** lists the prompt under home's **Needs you** with **Yes** and\n **No**, and its alert carries the same two buttons. The question's sheet has\n every choice.\n- **Answered in the terminal**: Pane closes the question and lists it in\n Done today as \"Answered in the terminal\".\n- **The whole command, plan or tool input** is on the card, so Yes never\n approves something you couldn't read. One over 32,000 characters is too long\n to show: its question offers no choices and says to answer in the terminal.\n- **After 10 minutes** Claude stops waiting on Pane. The question stays, says\n \"Claude is asking in the terminal now\" with **Open**, and loses its choices;\n answering in the terminal clears it. An answer still in its 3-second Undo\n hold then never reaches Claude, so it is dropped the same way.\n- **The first prompt** after an update adds a one-time note to Approvals.\n\nHow it works: each Claude launch gets an http `PermissionRequest` hook aimed\nat a loopback endpoint on the machine running it, with a token for that tab.\nClaude reads only the last `--settings` flag, so Pane writes one settings file\nper tab (owner-only, in `claude-prompts` under Pane's data folder) that merges\nits hooks with any `--settings` the command already passes, and launches with\nthat file instead. The file is written with this setting off too, for the\n`SessionStart` hook that tells Pane which conversation the tab is on\n([CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)). A command whose `--settings` Pane can't read, or a tab\nwhose settings file Pane can't write, launches unchanged. Wrapped launches, commands that don't start with `claude`, SSH tabs\nand WSL tabs keep their command, and their prompts stay in the terminal.\n\nTurn it off in **Settings → AI & Agents → Answer prompts from Pane**. Off\ntakes effect at once; a tab started while it was off picks it up when it\nrestarts.\n\n## Chat tab prompts\n\n[Chat tabs](CHAT_TABS.md) send their ACP approvals to Approvals too, with exactly\nthe choices the adapter sent (the phone's Yes and No are its allow and reject\nchoices). A question (ACP form) is asked one field at a time, titled \"(1 of 3)\"\nwith the field's title when it has more than one: single choice and yes/no as\noptions, multiple choice as free text naming the choices (comma-separated, with\neach choice as a chip), text and numbers as free text. A typed answer to a\nchoice fills the form's matching free-text field (AskUserQuestion's\n`question_0_custom`). The last field sends the whole form as one answer; \"Skip\nquestion\" declines it. The first answer wins: an answer from Approvals reaches\nthe agent, and a card the chat tab answered first closes as \"Answered in the\nchat\", along with the rest of its form. In Approvals the card shows beside the\nchat tab, which docks the same prompt above its composer.\n**Settings → AI & Agents → Answer prompts from Pane** turns this off too. A chat tab waiting on a prompt reports\n`blocked`, so phone alerts follow it like a terminal agent's.\n\n## Long waits\n\nA question waits until you answer it. How the call stays open depends on the\nclient:\n\n- **Claude Code and Codex** wait in one call. Claude Code moves a call that\n runs past about 2 minutes into a background task and ends its turn; your\n answer still reaches the agent when you send it. Pane's MCP server sends a\n progress notification every minute, and Pane registers the server with\n Codex using a 24-hour tool timeout.\n- **Cursor's CLI** ends every tool call after 60 seconds. About every 50\n seconds `notify` returns `{waiting: true, id, next}`, and the agent calls\n `notify` again with `resume: <id>`. The card doesn't change. After 15\n minutes without an answer the call returns `unavailable`. Cursor asks\n \"Run this MCP tool?\" before every call, resumes included; pick **Allowlist\n MCP Tool** once so a waiting agent doesn't stop at that prompt.\n\nIf the agent stops waiting (you interrupt it, it exits, or its call times out)\nand doesn't resume within 30 seconds, the item closes (\"closed: the asker stopped\nwaiting\"; see [When an approval goes away](#when-an-approval-goes-away)). Codex 0.164 doesn't tell Pane when you press Esc, so a question from a\nCodex panel also closes when that panel sits idle at its prompt for 10 seconds.\n\n## Where questions show\n\n- **Inside Pane: Approvals.** An **Approvals** row in the sidebar's top list,\n below Loops (directly below Autopilot when Autopilot is on), shows an amber count of the items waiting (none at zero);\n clicking it, or pressing ⌃⇧Space while Pane is in front, opens the Approvals\n screen in the main area, and clicking the row again returns you to the view\n you left. The sidebar keeps the Sessions list,\n Panes with a waiting item show an amber \"Waiting\", and each Session row\n shows an amber count of the approvals waiting from it. The row's count is the sum of every Session's count plus items not in a\n Session, across saved machines; in the one-machine sidebar its tooltip says\n how many of them wait on other machines. Beside\n it, the queue has **Waiting** and **Done today** tabs and a **Group by** menu,\n remembered per device: **Most recent** (the default) lists items flat, newest\n first, each row naming its Session and machine; **By Session** and **By\n project** group them, each group placed by its newest item; **Sidebar order**\n groups by Session in the order the sidebar shows them (the All machines\n arrangement when that's on), following a drag there, with Sessions the\n sidebar doesn't show last, newest first. Each group is boxed under a header\n with its name, machine mark and waiting count. Waiting sorts by when it was asked and Done today by when it was\n answered. A new item never moves the selection or the selected row. The\n list stays compact rows, each with a chip for \"Reading your reply…\",\n \"Getting more context…\" or \"Updated · ready again\". The selected item opens\n in **the approval column** beside the list (see below); its pager follows\n the list as grouped. The column's last tab is the chat where it was asked,\n live: an orchestrator's item shows the Session's orchestrator tab, so you\n can ask it about the item in its own composer; a worker's prompt or a\n standalone item shows the asking Pane's tabs, with **Open in Pane** (or\n **Open on <machine>** for another machine's item). Below about 1,100px wide,\n the list stacks above the column. After a pick, the column shows \"Sent:\n …\" with **Undo** for 3 seconds; the item then moves to **Done today**,\n which lists the last 24 hours, updates (`ui info`) included. Under Most\n recent, once a typed reply is with an agent, Waiting splits into **Waiting\n on you** and **With the agent**, each row naming who reads the reply. Inside Pane there is no\n floating strip and no Notify row in the sidebar.\n- **The approval column**: one tabbed column for an approval, the same on\n every surface. Its header pages through what's waiting (‹ n of N ›, dots, ←\n and → while it has focus) and ✕ closes it. Its tabs are **Decide** (the\n subtitle, each question with its why and options, recommended ones\n marked but none selected until you pick, the references and one reply box that grows up to half the\n column), **Summary** (one HTML page: the asker's own, an `.html` passed as a\n worker's `--summary-file` or `summary` in `needs_you`, else one Pane writes\n from the card and the worker's status file; it renders with scripts and\n network off, the same on the Mac, from another machine and on the phone),\n each linked file (in the document viewer), URL (in the\n in-app browser) or other approval (in place, with Back), and the chat where\n it was asked, left out when you're already in it. In a **Session**, the\n column lays over the Session's right split view without resizing it, and ✕\n (\"Back to <tab>\") shows the split again as it was; with no split open it\n opens a split of its own, and ✕ (\"Close split\") collapses it. There it is a\n focus stop of its own: Focus Right (⌘⌥→) and F6 move into it from the chat,\n the tab keys (⌘⇧[ ⌘⇧], ⌘⇧1-9) walk its tabs while it has focus, Focus Left\n or Esc go back to the chat's message box, and its active tab carries the\n accent only while it has focus, as a split's does. The right\n sidebar (Overview, Files, Changes) is never covered. The Session's title\n bar shows **Approvals n · n ready**, and a Session row's count in the\n sidebar opens the newest ready-again approval, or the first waiting one. A\n Session's orchestrator chat docks one compact card above its composer:\n who asks, the title and subtitle across the card, and a bottom row with ‹ n\n of m ›, the reference count, Summary and **Open**; its pager stays in step\n with the column's. The chat's own AskUserQuestion isn't docked: the chat\n already shows Claude's card, and Approvals and the phone keep the copy.\n **Send** closes the column, and a status line in the chat names the agent\n reading the reply (\"okta-sso-account is reading your reply to Q-42\"), then\n how it was taken, with **Reopen**. \"Taken as your answer\" shows only on that\n approval, its row and that line. The card open in the column has a darker\n grey outline and an **open** label. In **Autopilot**, the column covers the Stack (✕ \"Back to the\n Stack\"), and Autopilot's decision cards gain **Open**. In a Session and in\n Autopilot, the chat tab is live too: an orchestrator's item shows its\n Session, and a worker's or a Pane's item shows the tab that asked.\n- **The strip**: while Pane isn't in front, a borderless card at the bottom\n center of the screen with the pointer. It never takes keyboard focus when it\n appears; click a choice to answer, or click its text field to type. After\n you answer, it shows \"Sent to <agent>\" with **Undo** for 3 seconds before\n the agent gets it. Only one strip is ever on screen, oldest question first.\n **Open in Pane** brings Pane to the front on Approvals with that item\n selected.\n- **The round**: press ⌃⇧Space (Ctrl+Shift+Space on Windows and Linux) from\n any other app for a centered panel that works through the queue by\n keyboard: nothing starts chosen; number keys or arrows choose, ↵ sends,\n → skips, Tab adds a note (a note with no pick goes as a reply on its own),\n Esc closes.\n- **The menu bar or tray icon** shows an amber dot while questions wait. Its\n menu lists them and holds Show outside Pane, Pause for 1 hour, a way into\n Approvals, and its settings.\n\n**Keys on a card.** With the pointer over a card in Approvals, its keys work:\na choice's number answers it, Y approves, N starts a denial, and typing starts\nan ask's answer. Keys typed into a field (a terminal, a chat composer, a search\nbox) stay there, even with the pointer over a card. The floating strip over\nanother app takes keys once you click it, so typing in that app never answers\nby accident. Keys work whatever Pane's keyboard-shortcuts setting says. On\nApprovals, **More** (or **Details**, when choices have notes) opens the card in\nplace with every choice, its note and **Send**.\n\n✕ hides a question from the strip; it keeps waiting in Approvals.\nRight-click ✕ to bring it back in 10 minutes, in 1 hour, or when you next\nswitch to Pane. The clock at the bottom right of a card snoozes it for 3, 5\nor 15 minutes: it leaves the strip, then comes back in its place in the\nqueue, and Approvals shows it with its return time. The agent keeps\nwaiting through a snooze or reminder.\n\n## Where approvals are kept\n\nEach machine keeps one saved list: the `approvals` table in its `sessions.db`,\none row per item from any origin (`main/src/services/approvals/approvalStore.ts`).\nOrchestrators, workers (through a blocked report), Autopilot, Claude prompts and\nPane itself all post to it. An approval lives on the machine where its creator\nruns; devices read and answer it over the connection they already use, and\nnothing is copied (D-145, D-165). Open calls, the 3-second Undo hold and the\nalert timers stay in memory beside the table.\n\nAn item survives a restart, and an answer reaches its asker whether or not its\ncall is still open: an open call returns it, and otherwise Pane types `answer:\nQ-n → <answer> (by you)` into the asking tab once, when its agent is idle at\nits prompt and in the terminal's foreground process group. A wrapper and the\nagent it started share that group, so an agent-farm worker (`node\ntelemetry.mjs` running `claude`) qualifies. A shell, a nested shell, `ssh` or a\nREPL there keeps the answer owed, and the card reads \"not delivered to <tab>\nyet\" until it goes. Where Pane can't see what runs in the tab (Windows, WSL and\nthe PTY host), or the tab closed, the answer is never typed: the card reads\n\"not delivered to <tab>: <why>\" with Copy answer, and `runpane inbox` lists it\nas `undelivered`. The orchestrator passes on one Pane couldn't see to type; one\nwhose tab closed has no one left to tell. An\nasker that posts the same question again from the same tab (same Q-n or title)\njoins the waiting card instead of adding one.\n\nOn a machine's first start with this table, a one-time import moves\n`session-inbox.json` into it (`main/src/database/jsonStoreImport.ts`). It takes a\nbackup first (`session-inbox.json.before-import`), runs in one transaction with a\nmarker, and is safe to interrupt. The original file stays in place. If the import\nfails, Approvals says why, nothing is deleted, new approvals still work, and it\nretries on the next start.\n\n## Replies and new versions\n\nAn approval has one reply box. Picks alone are an answer, as before: the call\nreturns `{answer}`, or Pane types `answer: Q-20 → Yes, turn it on · One train\n(by you)`. Anything typed is a **reply**, which may be an answer or a question\nabout the approval. Pane doesn't decide which; the agent that reads it does\n(D-245, D-258).\n\n**The lines.** The reader's open call returns `{reply, picks?, id, replyId,\nnext}`. Only that call is given `replyId`: it is private to the call, kept\napart from the reply's own id, and in no snapshot, history or other screen. So\npassing it to `--took` and `--update` proves the caller is the reader, from a\nPane tab or a terminal outside Pane alike (D-294). With no open call, Pane types into the reader's\ntab, once, by the same rule as an answer:\n\n```text\nreply: Q-20 → \"Turn it on only if it can be undone\" (picked: Yes, turn it on · One train) (by you)\ncorrection: Q-20 → that was a question: \"…\" (by you)\ncorrection: Q-20 → that was your answer: \"…\" (by you)\n```\n\n`(picked: …)` is there only when something was picked. Picks keep their\nquestion's place: one left unpicked reads `—` (`picked: — · One train`), and\nthe result's `picks` holds `''` there. Without a Q-n the line names the title\nin quotes, and adds `[id <item id>]` before `(by you)`. Each reply has an id\nand is delivered once.\n\nOne reply at a time: while its reader is reading a reply (it has the line but\nhasn't run `--took`), a second typed reply is refused, with your words left in\nthe box; picks still answer. A reply still waiting for a busy tab is replaced\nby a newer one, and only the newer line is typed. The same rule holds on every\nsurface: the floating strip and the round send anything typed as a reply too,\nexcept on a permission prompt, whose note stays a note.\n\n**Who reads a reply**, in order:\n\n1. The asker: its open call, else its tab (a busy tab gets it when it's next\n idle).\n2. For a worker's question an orchestrator relayed, that orchestrator's tab.\n3. Autopilot, when it's on, in its chat tab.\n4. None: the approval reads \"No agent can read replies right now. You can\n still pick an option.\" The reply stays unread, and picks still answer.\n\nA reader that turns out gone passes the reply to the next one. A reply the\nasker or orchestrator hasn't taken after 10 minutes goes to Autopilot when\nAutopilot is on.\n\n**What the reader runs.** Only the reader may; anyone else gets\n`ERR_NOTIFY_NOT_READER` with a `next`. A worker in a Session may run both:\nthey aren't new asks.\n\n```sh\nrunpane notify --took Q-20 answer # records the reply (picks and text) as the answer\nrunpane notify --took Q-20 question # \"Getting more context…\" (--status \"<text>\" to say otherwise)\nrunpane notify --update Q-20 --asked \"Can it be undone?\" \\\n --what-changed \"Added the undo path to the context\" \\\n --context \"<new context>\" --choices '[{\"label\":\"Yes, with undo\",\"was\":\"Yes, turn it on\",\"recommended\":true},{\"label\":\"Not yet\"}]'\n```\n\n`--took` and `--update` take an item id or Q-n and no `--ui`. `--update` needs\n`--asked` (the person's question) and `--what-changed` (one line per change),\nand replaces whichever of `--title`, `--context`, `--choices`, `--questions`\nand `--links` it passes. A reworded choice carries `\"was\"`, its old label.\n`--update` then waits for the answer like any notify call (`waiting`,\n`unavailable` and `--return-after` work the same). It never adds a second\napproval.\n\n**Versions.** Each `--update` saves a new version on the same item: the\nquestion asked, What changed, who changed it and when. An item keeps at most 10\nversions; older ones fold into the oldest. They live in the item's saved JSON,\nso older items simply have none.\n\n**What the approval shows:**\n\n| State | Shows |\n| --- | --- |\n| Waiting, no reply | Waiting |\n| Reply delivered, not yet taken | \"<reader> is reading your reply…\", naming the reader for every kind (\"okta-sso-account\", \"The Doozy orchestrator\", \"Autopilot\") |\n| Taken as an answer | \"Taken as your answer\", with **It was a question** |\n| Taken as a question | \"Taken as a question: <reader> is getting more context\", with its status when the reader gave one, and **It was my answer** |\n| Updated | \"Updated · ready again\": your question quoted (\"You asked\"), What changed and by whom, choices marked NEW, REWORDED (the old label struck) or REMOVED, and a collapsed **Earlier version** |\n| No reader | \"No agent can read replies right now. You can still pick an option.\" |\n| A chat tab's built-in question | \"Sent to <agent>\": the typed reply is its answer, so there is no fix |\n| A chat tab's built-in question that takes only its choices | No reply box: pick one of its options |\n| Answered | Answered |\n\nThe fix is one click. **It was a question** sends the reader `correction: Q-n →\nthat was a question: \"…\"`, and the reader updates the approval. **It was my answer**\nrecords the reply as the answer and sends `correction: Q-n → that was your\nanswer: \"…\"`, and the reader acts on it. The pager skips items whose reply is\nbeing read or asked about. Permission prompts stay options only, with no reply\nbox.\n\n## When an approval goes away\n\nAn approval exists only while you can act on it and someone can take the answer\n(D-147). The machine that owns it decides.\n\n| Situation | What happens |\n| --- | --- |\n| Its Session is closed or archived | Closes within 5 s: \"closed: Session closed\", \"closed: Session archived\". |\n| Its asker is gone: its Pane archived or deleted, its tab closed, the worker sent a newer report, or a `notify` caller stopped waiting | Closes within 5 s of Pane learning it, with the reason: \"closed: the asking tab was closed\", \"closed: the worker moved on\", \"closed: the asker stopped waiting\". A sweep every 60 seconds catches anything missed. One exception: when only its tab closed and the orchestrator that relayed it, or Autopilot, can still read a reply for it, it stays open. |\n| Pane restarts | Items whose asking tab still exists stay waiting. |\n| Unanswered for 3 days | Stale: moved to a collapsed **Stale** group at the bottom of Waiting. It never rings or pushes again. |\n| You close one | One action on any card, with an optional reason. Its asker's open call returns \"The person closed this question.\", or `closed: Q-n (by you)` is typed into its tab. **Reopen** puts it back. |\n| You or Autopilot answered | Done today lists it for 24 hours. |\n\nThe store keeps answered and closed items 7 days for the record and for\norchestrators catching up on decisions (`runpane inbox`), then drops them. On the\nfirst start of a build with this table, a one-time cleanup closes every item\nwhose asker is gone (\"closed on upgrade: <reason>\"), and one summary card lists\nwhat's left, oldest first, with **Close all** and **Keep**.\n\n## Who asked, who acted\n\nEvery card names where it came from: \"workos-sso in Sales Skill · Mac mini\". This\nmachine's own items use its name from the machine picker, or no machine at all.\nEvery item is connected to its Session; outside one, to its Pane, or for\nAutopilot's own items to the Session it's about or Autopilot's chat. Opening it\nshows that, with its related files and documents.\n\nWhat happened to an item stays on it, on every device: \"Answered by Autopilot ·\nbecause D-22\", \"Closed by Autopilot: Session archived\", \"Closed: Session archived\",\n\"Rewritten by Autopilot from Q-7\", \"Recorded as D-147\". **Override** on an answer\nfrom Autopilot sends your answer to the asker as a correction (`correction: Q-n →\n<answer> (by you)`), recorded on the item. **Reopen** undoes a close by you or by\nAutopilot.\n\n## Alerts\n\nAlerts interrupt you on the device you're using (D-144):\n\n- **A computer rings** (the strip and the chime) only if it was used in the last\n 2 minutes with its screen unlocked, for its own items and other machines'. If\n two computers are both in use, both ring. In-Pane cards still show while Pane\n is in front.\n- **The phone** gets a push about 90 seconds after an approval arrives, only if\n it is still waiting. Answering it, closing it or turning Approvals off cancels\n the push.\n- A worker's question rings once its orchestrator relays it or after 10 minutes.\n- **An updated approval is quiet** (D-244): \"Updated · ready again\" shows as a\n notice on the computer in use, with no chime, plus its badges and counts. The\n phone gets a push only when no computer is in use. You started the follow-up,\n so it doesn't ring like a new approval.\n- A computer can ring only for machines it has saved. Autopilot's \"Can't see\"\n shows that gap, and the phone push still arrives.\n- **Show cards on** (Settings → Approvals) moves the strip, its window over\n other apps and the chime to one computer, for every machine it has saved.\n That computer still rings only while it's in use; when it's idle or locked\n the phone push is the backstop. Every other computer stays quiet while the\n picked one reads it, and keeps its Approvals list, counts, tray dot and\n answer-all shortcut. A computer the picked one can't read (it's off, asleep\n or disconnected, or it hasn't saved this computer) rings as if nothing were\n picked, and its Settings row says why. \"Reading\" means the picked computer\n holds a live connection to this one, as its owner or a paired device, naming\n itself by its install id (`machineId` in `config.json`; a `config.json`\n copied to another computer carries the same id, so delete the key there).\n A computer that has saved the picked one also checks its own connection:\n once that drops (about 20 seconds after the picked one sleeps or leaves the\n network), it alerts again. A computer closes its connections before it\n sleeps. The Settings row reads one of:\n - \"Cards pop up on <name>. They're still listed here.\": the picked computer\n reads this one, so this one stays quiet.\n - \"<name> hasn't added this computer, so this computer's cards still pop up\n here.\": this computer has saved the picked one and has seen it online for\n over a minute, but it doesn't read this one.\n - \"<name> isn't connected, so cards pop up here for now.\": anything else,\n such as off, asleep, just restarted, or not saved here.\n\n## Other screens and your phone\n\nThe machine running the agent keeps the one queue. Every screen connected to\nit shows its questions, and the first answer from any of them goes back to\nthe agent:\n\n- **A Pane desktop with saved machines** (Remote Access pairing or\n Workspaces) shows every saved machine's questions beside its own, whichever\n machine it is on: the strip over other apps, the round, the tray dot, the\n chime, Approvals, its sidebar count and the Waiting dots, within the\n [Alerts](#alerts) rules. Each card names its machine, and Approvals shows the\n machine's mark in its Session's group; beside it are that machine's Session\n name and linked documents, read from that machine, and **Open on <machine>**,\n which switches to that host instead of mounting a live Session view. A document\n that can't load is one line (\"<doc> isn't on the Mac mini anymore\", \"Couldn't\n reach the Mac mini\"), and the card stays answerable. An answer, Undo, ✕, snooze or → goes to the card's own\n machine and clears there; nothing switches. Open in Pane shows on this\n computer's cards and on the machine the desktop is on, where it opens the\n host's Pane in this window and leaves the host's own window where it is.\n- **Several screens at once**: the screen you answer on says \"Sent to\n <agent>\", every other one says \"Answered on <device>\", and all of them offer\n **Undo** for the 3 seconds before the agent gets the answer. ✕, snooze, the\n reminders and → in the round apply on every screen, except \"When I switch to\n Pane\", which waits for the Pane you used it on.\n- **Connection loss**: a machine that can't be reached collapses to one row,\n \"Mac mini offline · 4 waiting · they come back when the Mac mini is online\",\n since its cards can't be answered; the agents keep waiting. After reconnecting\n the screen shows what is waiting there now. Autopilot says \"<machine> offline\".\n- **Your phone**: the Pane app lists approvals on home's **Needs you** tile, in\n the same three sorts (chosen on its sort sheet), and an item opens above its\n Session's tabs and chat. A question still waiting after\n about 90 seconds sends one alert to every phone signed\n in to the host in the Pane app with notifications allowed and **Needs\n Input** on. The alert is titled with the Pane's name and says only \"<Pane>\n has a question\" (the folder name for a call from outside Pane); updates\n (`info`) send none. When the question is answered elsewhere or its agent\n stops waiting, the host sends a silent update so the phone can remove the\n alert, and an Undo makes it alert again. The host needs its usual phone\n credentials (`PANE_APNS_*` or the shared ones for iPhone, FCM for Android;\n see [NATIVE_MOBILE.md](NATIVE_MOBILE.md)); without them nothing is sent and\n the question still waits on every screen.\n- **A headless host** (`runpane install daemon`, remote setup, workspace\n hosts) has no screen of its own: it creates no strip window, tray icon or\n shortcut, and its questions show on every desktop that has it saved and on\n the phone. With none of them running, a question waits until one connects\n or answers.\n An update from it returns `delivered: \"inbox\"`; connected screens still show\n it on their strips.\n\nEach screen keeps its own Position, Show outside Pane, Sound, Show details, answer-all\nshortcut and Pause. The Approvals switch decides whether agents can ask, and it\nis one switch across your machines: turning it off returns `unavailable` to every\nwaiting agent on each machine and clears its questions from every screen. Show\ncards on is shared the same way.\n\n## Settings\n\n**Settings → Approvals** (the setting is still saved as `notify.enabled`):\n\n| Setting | Default |\n| --- | --- |\n| Approvals | On. Off hides the sidebar's Approvals row, expires open cards, returns `unavailable` (\"Approvals are off in Pane.\") to every waiting agent. Agents, Session orchestrators included, then ask in their own tab. Applies to all your machines ([how the switch travels](SHARED_CREDENTIALS.md#the-approvals-switch)). |\n| Show cards on | Whichever computer is in use. Or this computer, or a saved machine that has connected since Pane started: only that computer pops up cards and chimes ([Alerts](#alerts)). Applies to all your machines, saved as `notify.cardsOn`. |\n| Show outside Pane | On. It controls the floating cards over other apps. Off shows no floating card; inside Pane you answer from the Approvals row and screen, and the tray dot still shows. |\n| Position | Bottom center. Also top right or bottom right. |\n| Answer-all shortcut | ⌃⇧Space. Settings says so when another app already holds it. |\n| Updates hide after | 6 seconds |\n| Sound | On, for questions only |\n| Show details | Off. Cards open with details shown when on. Showing or hiding details on a card changes it. |\n\nOnly the Approvals switch and Show cards on are shared; the other settings here stay on each machine.\n\nPause for 1 hour (tray menu) hides strips and mutes sound while questions keep\nqueueing. Strips show over full-screen apps, during screen sharing, and with\nFocus or Do Not Disturb on; Pause is the way to quiet them.\n\n## What Pane tells agents\n\nWhile Approvals is on, Pane keeps a short block in each agent's user-level\ninstruction file, so every agent knows Pane is there and asks through `notify`:\n\n- Claude Code: `~/.claude/CLAUDE.md` (or `$CLAUDE_CONFIG_DIR/CLAUDE.md`)\n- Codex: `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md`). Agent Farm's\n Codex launches use a generated `CODEX_HOME` that links this file, so they\n read it too.\n- On Windows, the same two files in the home of each WSL distro a project\n runs in (`CLAUDE_CONFIG_DIR` and `CODEX_HOME` as that distro's login shell\n sets them). Pane writes them at launch and when you change the settings\n below; a distro that doesn't answer is shown as skipped and tried again at\n the next launch.\n\nThe block sits between `<!-- pane-notify:begin ... -->` and\n`<!-- pane-notify:end -->`. Pane writes it at first launch, since Approvals is\non by default. It has two parts:\n\n- **Pane:** when `PANE_SESSION_ID` is set, the agent is in a Pane terminal\n and should load the `pane` skill before using Pane. With the skill turned\n off (Settings → AI & Agents → Install Pane skill for agents), it points at\n `runpane agent-context --json` instead. If `runpane` isn't on `PATH`, the agent runs `$PANE_RUNPANE_BIN`\n (PowerShell: `& $env:PANE_RUNPANE_BIN`), or else the installed Pane's shim:\n `~/.pane/bin/runpane` on macOS and Linux,\n `C:/Users/<you>/.pane/bin/runpane.cmd` on Windows (forward slashes, so\n PowerShell, cmd and Git Bash all run it), and\n `/mnt/c/Users/<you>/.pane/bin/runpane` in WSL. The path is always the\n default data folder's, so a dev build with its own `PANE_DIR` never points\n your agents at its copy. Then comes Pane's model, the \"For agents\" part of\n the intro `runpane doctor` prints (Session, Pane, tab, `$PANE_SCRATCH_DIR`),\n and the rule to put scratch files in `$PANE_SCRATCH_DIR` rather than `/tmp`\n or the agent's own scratchpad. Both come from `agentContext.intro` and\n `agentContext.workspaceRules` in `contracts/runpane/contract.json`.\n- **Pane Notify:** call the `pane` MCP's `notify`, or `runpane notify` when\n that tool isn't loaded (for example under Agent Farm's strict MCP mode). It\n says which card to use (Claude's own card only for a quick question in the\n chat the person is typing in), who asks (in a Session, a worker reports\n blocked instead of calling `notify` and gets the answer in its tab), and to\n ask for a secret with `secrets_request`.\n\nHow to write a card (only what the agent can't find out itself, related\nquestions in one card, `info` rarely, written for someone who has lost the\nthread, with good and bad examples) and how to read a typed reply live in the\n`notify` command's notes. Pane prints them in the `notify` tool's description\nand in `runpane notify --help`, so agents read them when they ask, not in every\nrequest.\n\nPane writes only those lines, plus a line\nbreak before them when the file didn't end with one; the rest of the file keeps\nevery byte. It creates the file only when the agent's config folder exists and\nnever deletes it. It leaves alone a file that is a symlink or not a regular\nfile, isn't UTF-8, or has a stray marker, and one that another program keeps\nsaving while Pane writes. Settings → Approvals → Agent instructions shows each\nfile's state.\n\nTo remove the block, turn Approvals off in Settings → Approvals. Pane writes it\nagain when you turn Approvals back on, or at the next launch with Approvals on.\n\nThe `pane` MCP server's instructions say only to call `notify` instead of asking\nin the terminal. Claude Code gets that line, the agents intro and the scratch\nrule from its CLAUDE.md block, so while the block is there the server leaves\nall three out of its instructions to Claude Code. Cursor, which gets no user-level block, learns the rest from\nthe `notify` tool's description and the repository's managed `AGENTS.md` block,\nwhich also carries the secrets rule.\n\n## Linking a call to its Pane\n\nPane sets `PANE_SESSION_ID` and `PANE_PANEL_ID` in every terminal it opens.\nClaude Code passes them to MCP servers; Pane's registration forwards them for\nCodex (`env_vars`) and Cursor (`${env:NAME}`). A call from an agent outside\nPane still works: its card shows the folder name and hides Open in Pane.\n\n## Platforms\n\nmacOS, Windows and Linux on X11 show the strip over other apps. In a Wayland\nsession Pane runs as a native Wayland app and can't place a window over other\napps, so Show outside Pane is unavailable there (in Settings and the tray menu).\nQuestions show in Approvals inside Pane, with its sidebar count, Waiting dots and\nthe chime. The tray icon and its dot work; GNOME needs the AppIndicator\nextension, which Ubuntu turns on by default. On GNOME 46 (Ubuntu 24.04), which\nhas no global-shortcut portal, ⌃⇧Space doesn't reach Pane from other apps;\ninside Pane it opens Approvals.\n\nThe code: `main/src/services/notify/` (queue, windows, tray),\n`main/src/services/approvals/approvalStore.ts` (the store),\n`main/src/ipc/notify.ts` (including the `notify:remote-snapshot` and\n`notify:remote-command` commands and the `notify:shared-changed` event other\nscreens use), `main/src/daemon/mobilePushSender.ts` (the phone alert),\n`shared/types/notify.ts`, the renderer's Approvals screen\n(`frontend/src/components/approvals/`) and Notify card components, and the\n`frontend/notify.html` entry for the floating windows.\n"},{"path":"docs/PANE_SECRETS.md","title":"Pane secrets","text":"# Pane secrets\n\nPane secrets are named values, such as API keys, that any agent on your machines can\nuse without the value showing up in chat. A secret is addressed as\n`<project>/<NAME>`: the agent picks the project (`stripe`, `qa`, a repo's name) and\nthe name follows environment-variable rules, so it can be injected as-is.\n\nEvery host Pane syncs keys with keeps its own copy, so a secret works offline and on\nevery machine. Values stay in the OS store, never in `config.json`, the database,\nlogs, chat or MCP output.\n\n## Use a secret\n\nAgents and scripts use a secret only through `runpane secrets exec`, which starts a\ncommand with the values in its environment:\n\n```sh\nrunpane secrets exec --project stripe -- npm test # every stripe/* secret, under its own name\nrunpane secrets exec --project stripe --only STRIPE_KEY -- npm test\nrunpane secrets exec --project stripe --env API_KEY=STRIPE_KEY -- ./deploy.sh\nrunpane secrets exec --project gcp --file SERVICE_ACCOUNT -- ./upload.sh # env var holds a path to a 0600 temp file\n```\n\nThe values are read at call time, so a secret set a moment ago works in a running\nagent without a restart. Injected names override the caller's environment. `PATH`,\n`WORKTREE_PATH` and `PANE_*` are refused. A `--file` secret is written to a private\ntemp file that is deleted when the command exits.\n\nNo command prints a raw value: there is no `secrets get`. A value reaches a\ntranscript only if the command you run prints it.\n\n## Ask the person for a secret\n\n`runpane secrets request` (MCP: `secrets_request`) shows a masked card wherever the\nperson is, through [Notify](PANE_NOTIFY.md):\n\n```sh\nrunpane secrets request --project stripe --name STRIPE_SECRET_KEY \\\n --title \"Stripe test secret key\" --reason \"Run the webhook tests against Stripe's test mode.\"\n```\n\nThe person types the value and presses **Save securely**, or **Decline**. The card\nsays when saving replaces a value that already exists. The agent gets back\n`{\"status\":\"saved\",\"project\":\"stripe\",\"name\":\"STRIPE_SECRET_KEY\"}` or\n`{\"status\":\"declined\"}`, never the value, and then uses it with `secrets exec`.\n\nThe value is saved on the host the agent runs on, the moment it is answered. It\ntravels once, from the screen that answered to that host, over the same connection\nas any Notify answer. That host's own Notify history shows \"Saved as\nstripe/STRIPE_SECRET_KEY\"; other screens drop the card once it is answered. Secret\ncards have no Undo.\n\nThe card can be answered on the desktop and its floating strip, on another desktop\nshowing that host, and in the phone app, which uses a secure text field. A\nlock-screen alert only opens the app: it has no Reply field, because the system's\nreply input is not a secure field. Glasses show \"Answer on your phone or computer\".\n\n## Manage secrets\n\n| Where | What |\n| --- | --- |\n| Settings → Secrets | List by project with when and where each was set; Add, Replace and Delete. Values are never shown again. |\n| `runpane secrets list [--project P] [--json]` | Project, name, updated time and machine. MCP: `secrets_list` in the `secrets` toolset. |\n| `runpane secrets set --project P --name N --yes` | Reads the value from stdin only, so it never lands in your shell history or a process list. There is no MCP tool for it. |\n| `runpane secrets delete --project P --name N --yes` | MCP: `secrets_delete` in the `secrets` toolset. |\n\nA missing secret fails with `SECRET_NOT_FOUND` and the next step: request it, or\nopen Pane on a desktop connected to that machine so it syncs.\n\nSecrets are managed on the machine itself: `runpane workspace <machine> secrets …`\nis refused. From your own devices, run `runpane workspace <machine> exec -- runpane secrets …`\ninstead.\n\nA project's environment variables can point at a Pane secret instead of holding\ntheir own copy: see [Project environment variables](PROJECT_ENV_VARS.md).\n\n## Where values are stored\n\n| Host | Store |\n| --- | --- |\n| macOS | The login keychain: service `Pane` (or `Pane (<data directory>)` for a dev build's `PANE_DIR`), account `secret:<project>/<NAME>`. A value over 1 KB is kept in part items `secret:<project>/<NAME>#<id>.<n>`, which that account lists. |\n| Windows, desktop Linux | `secrets.json` in the Pane data directory, mode 0600, each value encrypted with the OS (DPAPI, or the desktop keyring) through Electron's safeStorage |\n| Linux without a keyring (a headless server) | The same 0600 file, as plain text. `runpane secrets list` on that host says so. |\n\nThe index of names, times and machines lives in `config.json` under `paneSecrets`.\nA delete removes the stored value first. If the keychain refuses, the secret stays\nsaved and listed, and the delete can be run again once the keychain is unlocked.\n\n## How secrets sync\n\nSecrets travel with [shared integration keys](SHARED_CREDENTIALS.md), under the same\nrules: a desktop or the phone that has more than one host saved carries them between\nhosts, in memory. The copy set most recently wins, and a deletion is recorded so an\nolder copy cannot bring the secret back. Sync runs when a secret changes and when a\nsaved host reconnects. A host that was offline keeps its copy until a device that\ncarries keys reaches it. Hosts from before secrets ignore them.\n\n## Who can read a secret\n\nAny agent, and any program running as you, on any of your hosts, can use every Pane\nsecret. That is the point: agents keep and share their own secrets across projects.\nThe safeguards stop accidental exposure; they don't sandbox anything. Setting \"Everyone on tailnet\" on\nany host gives everyone on the tailnet the same access.\n\n| Who or where | Can read values? | Why |\n| --- | --- | --- |\n| Any agent or process running as you on a host | Yes | runpane's local socket is mode 0600 with no token. On macOS, items trust `/usr/bin/security`. |\n| Every host Pane syncs to | Yes, holds a copy | Each saved host keeps a copy for offline use. |\n| Your paired phone | Relays, never stores | The same rule as shared keys: a paired device can already open terminals on the host. |\n| Teammates (other Tailscale logins on your tailnet), when any one of your hosts is set to \"Everyone on tailnet\" | Yes | Their `workspace exec` commands and the terminals they open there run as you, so they can read the keychain or `secrets.json`, run `runpane`, and reach every secret. Each synced host keeps a copy of your secrets, so that setting on any one host exposes them all. Pane refuses only their direct secret requests: secret cards, secret variables, chat tab keys, chat tab sign-in and [shared key sync](SHARED_CREDENTIALS.md), and their terminals and chat tabs start without secret variables or chat tab keys, including after the owner switches one of their terminals to chat. Keep \"Only me\" on every host unless you trust everyone on the tailnet with all your secrets. |\n| A Linux host without a keyring | At rest in a 0600 file, unencrypted | `runpane secrets list` on that host says so. |\n| Chat, MCP output, Notify history and broadcasts, push payloads, Pane logs, analytics, `sessions.db`, `config.json` | No | Pane never writes or returns a value to any of them. |\n| An agent's transcript and Pane's saved terminal scrollback | Only if the agent prints it | `exec` puts the value in a child's environment; if that command echoes it, the output goes wherever its output goes. |\n| Running processes | Yes, through the environment | `ps eww` shows a process's environment to the same user. |\n"},{"path":"docs/PROGRAM_STATUS.md","title":"Program status (OSC 7501)","text":"# Program status (OSC 7501)\n\nAny program running in a Pane terminal tab can tell Pane what it is doing by\nprinting one escape sequence. Pane shows that state as the tab's status cue\n(the dot on the tab and in the sidebar), the same cue it reads from an agent's\nscreen. A build, a deploy script or an\nagent that prints the sequence shows working, blocked or done in Pane with no\nPane-specific rules.\n\nThe sequence is the Program Status Protocol, revision 0.4, published by\nSuperlogical, which makes the Rex terminal:\n<https://www.superlogical.com/rex/docs/build/program-status>. The example below\nis the spec's own and needs bash or zsh (`\\e` is not POSIX `printf`).\n\n```sh\nstatus() {\n printf '\\e]7501;state=%s:msg=%s\\e\\\\' \"$1\" \"$(printf '%s' \"$2\" | base64 | tr -d '\\n')\"\n}\nstatus working \"Syncing photos\"\nrsync -a ~/Photos backup:/photos && status done \"Photos synced\" || status error \"rsync failed\"\n```\n\n## What Pane shows\n\n| `state` | Tab status cue |\n| --- | --- |\n| `working` | Working. |\n| `blocked` | Blocked: a red dot. When the tab becomes blocked, a desktop alert while Pane is in the background and a phone alert (at most one a minute per tab). In an agent tab, also `agent.blocked` in the Session journal. `msg` is the prompt line; `kind` (`permission`, `question`, `auth`) is in the status reason. |\n| `done`, `error` | Finished. While you're looking at another Pane, it shows the done cue until you open it. The record itself ends when you type in the tab. |\n| `idle` | Idle. |\n| `clear` | Removes the record, and the tab goes back to reading its screen. |\n\nThe status reason is `program_status:<state>`, with `:<kind>` for blocked\n(for example `program_status:blocked:auth`).\n\nA program can report several records with `id` (`build`, `build/test`). The tab\nshows the most urgent: blocked, then working, then error, done and idle; the\nlatest one wins within a state. `app` is inherited from the nearest parent\nrecord.\n\n## Precedence and lifetime\n\nA report outranks Pane's screen parsing and its output heuristics while the\nrecord lasts, with one exception: when the screen shows an agent waiting on\nyou (a permission or trust prompt) and the report isn't `blocked`, the tab\nshows blocked. Blocked is the most urgent state from either source. When no\nrecord is left, the tab reads its screen again.\n\n- `working`, `blocked` and `idle` end when the program exits (Pane's own shell\n is back in the foreground) or when an agent Pane recognizes takes the\n foreground after the report, as when a wrapper reports and then starts\n Claude. A full reset (`ESC c`) or a new shell prompt (OSC 133 `A`) ends them\n too.\n- `done` and `error` stay after the program exits and end when you type in the\n tab.\n- On Windows, in WSL, and with the separate PTY host setting on, Pane cannot\n see the foreground process, so `working`, `blocked` and `idle` don't end\n when the program exits. The other endings still apply.\n\n## Rules Pane follows\n\n- Pane reads reports in a terminal's own output only, so a program can change\n only the tab it prints in.\n- A malformed pair is skipped. A report without a known `state`, with a bad\n `id`, with base64 that does not decode, with control characters in `msg` or\n `title`, or over the spec's size limits changes nothing.\n- Pane removes format characters (direction overrides, zero-width and tag\n characters) and line separators from `msg` and `title` before showing them.\n- Pane answers the feature-detection query `ESC ] 7501 ; ? ESC \\` with\n `ESC ] 7501 ; ? ESC \\`. The reply repeats the query, as the spec defines.\n- `progress` is accepted and not shown.\n\nThe parser is `main/src/services/agentStatus/programStatus.ts`.\n"},{"path":"docs/PROJECT_ENV_VARS.md","title":"Project environment variables","text":"# Project environment variables\n\nA project can define environment variables that Pane sets in everything it starts\nfor that project's Panes: terminal panels, agent panels (Claude, Codex, Cursor or a\ncustom command), and the setup, run (Play) and archive scripts. Panes of other\nprojects never get them, and nothing is exported in your global shell.\n\nEdit them in **Project Settings → Environment Variables**. Changes apply to\nterminals and scripts started after you save; a terminal that is already open keeps\nthe environment it started with.\n\n## Plain text, Pane secret or keychain item\n\nEach variable is one of:\n\n| Source | What the project stores |\n| --- | --- |\n| Plain text | The value, in the Pane database |\n| Pane secret | Only the secret's address, `<project>/<NAME>`. The value lives in [Pane secrets](PANE_SECRETS.md), so every repo and agent that uses it shares one copy, synced to your other machines. |\n| macOS Keychain | Only the service and account of a generic-password item you already have (macOS hosts only) |\n\nFor a Pane secret row, type a value to create or replace that secret when you save;\nleave it empty to use the secret as it is. The project defaults to the repo's name\nand the secret's name to the variable's. Once saved, the value shows as `••••••••`\nwith a **Replace** button, and is never sent back to the Project Settings window.\n\nPane secrets and keychain values are read each time a process starts, so a changed\nsecret applies to the next terminal. A value is never written to the Pane database,\nlogs or analytics. Removing a variable, or deleting the project, leaves the Pane\nsecret or keychain item in place; delete a secret in Settings → Secrets.\n\nReferencing an item another app created (for example one Conductor stored) makes\nmacOS ask whether `security` may read it the first time; choose **Always Allow** so\nlater terminals open without asking. A read that waits more than 60 seconds is\ntreated as failed. Keychain variables work only when the Pane host runs macOS; on\nanother host saving one is refused with `KEYCHAIN_UNSUPPORTED`. Use a Pane secret\nthere.\n\n`runpane repos get` shows a repo's variables (plain values in full, the rest as\nreferences) and `runpane repos update --env '<json>' --env-remove NAME --yes`\nchanges them. It never takes a secret value: set one with `runpane secrets set` and\nreference it by project and name.\n\n### Who can read the value\n\nPane secrets and the keychain keep values out of your shell profile, Pane's files and\nother projects' Panes. They are not a sandbox:\n\n- Every process Pane starts for the project, including the agents, gets the value in\n its environment, and other processes running as your user can read a process's\n environment (for example with `ps eww`).\n- Any agent can use any Pane secret through `runpane secrets exec`\n ([who can read a secret](PANE_SECRETS.md#who-can-read-a-secret)).\n- On a host set to \"Everyone on tailnet\", a teammate's commands and terminals run as\n you and can reach every secret. Pane only keeps the secret and keychain variables\n out of the terminals and scripts they start.\n- An item you allowed with **Always Allow** trusts `/usr/bin/security`, so any\n process running as your user can read it without a prompt while the login\n keychain is unlocked.\n\n## Names and precedence\n\nNames use letters, digits and underscores and do not start with a digit. `PATH`,\n`WORKTREE_PATH` and anything starting with `PANE_` are reserved: Pane always sets\nthem itself, so a project cannot override them. A project variable overrides the\nsame name inherited from the environment Pane was started in, and the `TERM`,\n`COLORTERM` and `LANG` defaults Pane gives terminals. Your shell's startup files run\nafter that, so an `export` in `~/.zshrc` still wins inside a terminal.\n\nIn WSL projects the variables are added to `WSLENV`, so they reach the Linux shell.\n\n## When a value cannot be read\n\nThe terminal or script still starts, without that variable. After the shell's first\nprompt, the terminal shows a `[Pane]` line naming the variable, the secret or item,\nand the reason (a missing secret, a locked keychain); setup and archive scripts\nwrite the same line to the Pane's logs. The value is never printed. Set the secret\nin Settings → Secrets, fix the item in Keychain Access, or change the variable in\nProject Settings, then open a new terminal.\n\n## Example\n\nA repository's `.mcp.json` reads `${UIVERIFY_API_KEY}`. Add `UIVERIFY_API_KEY` to\nthat project as a Pane secret (type the value, or point it at a secret you already\nhave, such as `qa/UIVERIFY`), and every agent started in one of its Panes sees it,\nwhile other projects and your login shell do not.\n"},{"path":"docs/QR_PAIRING.md","title":"Add a device","text":"# Add a device\n\nPair a phone, a browser or another computer with Pane, on any network. No\naccount, no Tailscale, no port forwarding.\n\nOpen **Add a device** from **Settings › Remote Access**, from **Add a\ndevice…** in the sidebar's machine menu, or with **Pair a device** on Home,\nwhich opens on the **Phone** tab. It has four tabs:\n\n| Tab | What it does |\n|---|---|\n| **Phone** | Shows a QR code to scan with your phone. |\n| **Computer** | Copies a one-time link for another computer, a phone or a browser, or takes a link copied on another computer. |\n| **SSH** | Reaches a computer through your own SSH config and starts Pane there. See [SSH route](SELF_HOSTED_REMOTE_DAEMON.md#ssh-route). |\n| **Wearables** | Shows a QR code that opens the glasses screen in the Pane phone app. |\n\n## Pair a phone\n\n1. On the computer, open **Add a device › Phone**.\n2. Point your phone's camera at the code.\n3. Tap the link. It opens the Pane app, or Pane in the phone's browser when\n the app is not installed.\n\nThe iPhone app is in TestFlight. To get it, ask to join on\n[Discord](https://discord.gg/BdMyubeAZn); the dialog and the pairing page\nlink there.\n\nThe phone shows the computer's sessions a few seconds later. A QR code works\nonce and expires after 10 minutes; the dialog shows a new one after each use.\n\nPhone access is this computer's connection to Pane's relay, which phones,\nbrowsers and links use. Opening the Phone or Computer tab turns it on. If you close it before a code ever appears (for example after \"Can't reach ...\"), Pane turns phone access\nback off, so it doesn't keep retrying in the background.\n\nInside the Pane app you can also scan from **Settings › Add a machine**.\nThe app still accepts `pane-remote://` connection codes.\n\n## Link another computer\n\n1. On the first computer, open **Add a device › Computer**, pick how long the\n link lasts under **Expires after**, and choose **Copy link**.\n2. Send the link to the other computer and open it there in a browser. The\n page opens desktop Pane (**Open Pane**), which links the two.\n Or paste the link into **Add a device › Computer › Or finish here** on the\n other computer.\n3. The first computer shows **Linked with &lt;computer&gt;**. If you don't\n know that computer, choose **Not you? Unlink &lt;computer&gt;**. That undoes\n the link: your computers and the ones it brought stop reaching each other,\n and each group stays as it was before.\n\nOn a computer with no screen, run `runpane link '<link>'` instead. It asks\nbefore linking (see [When a link asks first](#when-a-link-asks-first)); in a\nscript, pass `--yes`.\n\nBoth computers need Pane open with phone access on, and the same relay.\nOpening **Add a device › Computer** on each turns phone access on. The same\nlink also works on a phone or in a browser, as a QR code does.\n\nA link works once. It expires after the time chosen when it was copied:\n\n| Made from | Expires after |\n|---|---|\n| **Add a device › Phone** (QR code) | 10 minutes |\n| **Add a device › Computer** (copied link) | 10 minutes, 1 hour (the default) or 24 hours |\n\n## Your computers\n\nLinking joins two groups of computers. Every computer in either group can\nthen reach every other one, on every route it has, and run agents there.\nAfter that:\n\n- a new phone that pairs with any one of them gets all of them;\n- each computer lists the others in **Settings › Remote Access › Computers**\n and the sidebar's machine menu, for ports and `runpane workspace`;\n- alerts from any of them reach every phone.\n\nA phone that already reaches computers links them with the new computer's\ngroup when it pairs, after asking (below).\n\n**Settings › Remote Access › Computers** shows each computer once, with a\npill for every route Pane can reach it on and a dot on the route in use.\nExpand a row to see its routes in order, drag them to reorder, add one with\n**Add route** (it opens **Add a device › Computer**), and see who linked it (\"Linked by Ana's iPhone\"). **Also linked** lists\ncomputers that reach this one but that this one doesn't list; link them back\nto reach them from here. **Settings › Remote Access › Phones and glasses**\nlists phones and glasses.\n\nA browser reaches the computer whose link it opened, plus the computers\nalready linked with it. A browser never links computers with each other: each\ncomputer's browser app keeps its own list.\n\n## When a link asks first\n\nA computer always asks before it uses a link, unless it already reaches the\ncomputer that made the link: once linked, that computer can run agents on it.\nA phone or browser asks when it already reaches computers and the link comes\nfrom a computer it doesn't reach yet. A phone or browser that reaches no\ncomputers yet pairs without asking, since pairing gives it access and nothing\nback. The prompt names the computers on both sides. The link's computer sends\nits own list, so that list never skips the prompt.\n\nThis holds on desktop Pane, the phone app, a browser and `runpane link`.\n**Not mine, cancel** links nothing, and the link stays unused for another\ndevice until it expires.\n\n## Routes\n\nPane reaches each computer by up to five routes, tried nearest first:\n\n| Route | How Pane gets it |\n|---|---|\n| **Same network** | The computer reports its private addresses. Pane tries one only when it is on a subnet of the computer trying it, so another home network or a WSL, Docker or VM adapter costs no wait. |\n| **Tailscale** | Both computers are on your tailnet. See [Workspaces](RUNPANE_WORKSPACES.md). |\n| **SSH** | **Add a device › SSH**. See [SSH route](SELF_HOSTED_REMOTE_DAEMON.md#ssh-route). |\n| **Public URL** | The computer has its own HTTPS address. See [Public URL](SELF_HOSTED_REMOTE_DAEMON.md#public-url). |\n| **Pane relay** | A link or QR code. Pane's servers pass the connection along. |\n\nEach computer reports its own routes when Pane connects to it, and Pane saves\nthem as \"found automatically\" when they are `https:` addresses. A link's\ncredential works on every route, so a found route needs no new pairing.\n\nEach route proves it reaches the right computer its own way. Pane relay and\nSame network routes check the computer's own key. A Tailscale route relies on\nTailscale's device identity, and a Public URL route on its HTTPS certificate:\nTailscale and your proxy end the encrypted connection with their own\ncertificates, so the computer's key never reaches the other side there. An SSH\nroute relies on SSH's host key check.\n\nPane connects on the first route that answers. When the connection goes\nsilent for 8 seconds, Pane checks the other routes and moves to the first that\nanswers, before the connection banner appears and without closing your Panes.\nWhen none answers, Pane reconnects as it always does, after 12 seconds without\na heartbeat. While\non a farther route, Pane checks the nearer ones every minute, and when the\nnetwork changes or the computer wakes, and moves back to the first that\nanswers.\n\n## How the relay connects\n\nEach computer gets its own address, `https://<id>.runpane.net`, with its own\ncertificate. The computer holds the private key; it never leaves the\ncomputer.\n\n- **Same Wi-Fi:** the Pane app and desktop Pane connect to the computer\n directly.\n- **Anywhere else:** Pane's servers in the central and western US, the EU\n and Asia pass the encrypted connection along without reading it. The Pane\n app and desktop also find a direct internet path when both networks allow\n it, the way Tailscale does.\n\nPane's servers see which computer a connection is for, IP addresses, timing\nand byte counts. They never see what you type, what your agents print, your\ntokens or your pages. On the relay, the Pane app and desktop also check each\ncomputer's key, so a certificate issued for the same name to anyone else is\nrefused.\n\n## What works\n\nEverything the Tailscale path does: terminals, agents and approvals, alerts\nwhen an agent needs you, dev server previews and HTML files on the phone, and\nthe files in a worktree. Another computer reaches the same computer for\nswitching to it, forwarded ports and `runpane workspace`, and glasses pair\nthrough a paired phone.\n\n## Pair glasses\n\nGlasses pair through the Pane phone app. **Add a device › Wearables** shows a\nQR code for `https://runpane.net/glasses` (your own relay's domain when you\nrun one). Scanning it with the phone opens **Settings › Glasses** in the Pane\napp; without the app, the page says how to get it. See\n[Even G2 glasses](EVEN_G2_GLASSES.md).\n\n## Share a computer with a teammate\n\nA teammate scans a fresh code from your computer, as you do. Their phone gets\nits own sign-in, listed under **Phones and glasses** by its name, and can do\nwhat yours does there, pairing glasses included. Because computers are linked,\nit also reaches every computer linked with this one, and, once they confirm,\nlinks this computer with any computer their phone already paired.\n**Remove › Remove from &lt;this computer&gt;** signs out only their phone,\nonly here; **Remove from all your computers** signs it out of\nevery computer it reached through yours.\n\n## Remove a phone or a computer\n\n- **Remove › Remove from &lt;this computer&gt;**, on a phone's row under\n **Phones and glasses**, signs it out of this computer only.\n- **Remove from all your computers** signs it out everywhere. Its open\n connections close within seconds. The Pane app shows **Pair again**; a\n browser says the computer removed it and to scan a new code on that\n computer.\n- Removing a phone also undoes the links it made: computers that phone linked\n stop reaching each other, along with the phones they shared it with. That\n keeps a lost or stolen phone from leaving a way back in. To link them again,\n pair one phone with each of them.\n- **Unlink from all your computers**, in a linked computer's expanded row,\n removes that computer from every computer's and phone's list, and the\n phones you paired through it lose access to it. The other computers in the\n group stay linked with each other. A computer also on your\n tailnet stays as a Tailscale row.\n- **Forget**, on a computer with no Pane relay route, removes it from this\n computer's list only.\n\n## When something goes wrong\n\n- **\"This code was already used\" or \"This code expired\":** scan the new code\n the computer shows, or copy a new link.\n- **\"Phone access is off on this computer\":** on the computer that opens the\n link, open **Add a device › Computer** once, then open the link again.\n- **\"&lt;computer&gt; is already linked here with a different key\":** that\n computer was reinstalled. Unlink it, then copy a new link.\n- **\"&lt;computer&gt; uses the relay … and this computer uses …\":** set both\n computers to the same relay.\n- **\"Reconnecting to &lt;computer&gt;…\":** every route failed. The app keeps\n retrying while it is open, at least every 5 seconds (once a minute after an\n hour without reaching it); nothing to do. On the same Wi-Fi it connects\n directly even when the internet is down.\n- **\"Asleep since 9:40\":** the computer is asleep. Wake it, or turn on Keep\n Awake.\n- **A browser on a Wi-Fi with no internet** can't reach the computer: a\n browser needs internet DNS. Open the Pane app instead.\n- **\"Phones can't connect: this computer's phone listener isn't running\":**\n another app (often a second Pane) holds the listener's port. Quit that app,\n or give the listener a free port in **Settings › Remote Access › Tailscale ›\n Advanced**. Until then the computer turns phones away.\n\n## Use your own relay\n\nRun a relay on your own machine and domain in a few minutes with Docker\n([Run your own relay](SELF_HOSTED_RELAY.md)), then set **Settings › Remote\nAccess › Phones and glasses › Relay address** to its domain. Pane connects\nthere instead of Pane's servers, and everything above works the same, on the\nsame Wi-Fi and from anywhere. Computers link only with computers on the same\nrelay.\n\n## Tailscale\n\nTailscale is one of the routes. **Settings › Remote Access › Tailscale** sets\nwho can connect over it, a password, hosts and connection codes. See\n[Workspaces](RUNPANE_WORKSPACES.md) and\n[Self-hosted remote daemon](SELF_HOSTED_REMOTE_DAEMON.md).\n"},{"path":"docs/RUNPANE_BUNDLED_CLI.md","title":"Bundled runpane on terminal PATH","text":"# Bundled runpane on terminal PATH\n\nEvery terminal Pane launches (Session orchestrators, agent panels, plain\nterminals, and run scripts) can call `runpane` without a global install. The\ncommand always matches the running Pane build. The installed app also adds the\nsame command to the end of your own `PATH`, so it works in any terminal.\n\n## How it works\n\n- `pnpm build:main` bundles `packages/runpane/src/cli.ts` into\n `main/dist/runpane/runpane.cjs` (`main/build-runpane-cli.js`). It ships\n inside the app with the rest of `main/dist`, and `pnpm dev` builds it\n through `pnpm build:main`. The bundle embeds its version and docs search\n index, so both still work after the single file is copied out of the app.\n- At startup (`createPaneDaemonHost`, which both the desktop app and the\n headless daemon use), Pane copies that file to `<PANE_DIR>/bin/runpane.cjs`\n and writes a `<PANE_DIR>/bin/runpane` shim (plus `runpane.cmd` on Windows).\n The shim runs the CLI with Pane's own Electron binary as Node\n (`ELECTRON_RUN_AS_NODE=1`) and defaults `PANE_DIR` to that Pane data\n directory. Files are rewritten only when their content changes. Pane never\n follows a symbolic link there or overwrites a file it did not write.\n- If that Electron binary is gone (a failed update, or the app was moved), the\n shim runs the CLI with `node` from `PATH` instead. Without `node`, it prints\n one line: reinstall Pane from https://runpane.com, or install Node.js and\n run `npx --yes runpane@latest update`. It exits 127 (`runpane.cmd`: 1). When Pane is not running,\n `runpane update` installs the latest release instead of updating in place,\n so it works in this state.\n- Beside it, `<PANE_DIR>/bin/pane-node` (plus `pane-node.cmd` on Windows)\n runs any script with the same binary as Node, or `node` from `PATH` when the\n binary is gone, so bundled skill scripts such as the Session status page\n renderer work on a machine without Node. In WSL it starts the Windows binary\n through interop and converts path arguments to Windows paths. On Linux, both\n shims use `$APPIMAGE` when Pane runs as an AppImage, since its `execPath` is\n a per-launch mount.\n- The shim checks only that the binary exists and is executable. If the\n binary exists but crashes on launch, `runpane` fails with it; run\n `npx --yes runpane@latest update` to reinstall Pane.\n- Terminal launches put `<PANE_DIR>/bin` first on `PATH` and export\n `PANE_RUNPANE_BIN` with the shim's absolute path. User startup files can\n rebuild `PATH`, so supported shells re-apply it afterwards:\n - **zsh:** `ZDOTDIR` points at `<PANE_DIR>/shell/zsh`. Each wrapper file\n sources the user's matching file from their own `ZDOTDIR` (or `$HOME`),\n then the last one moves `<PANE_DIR>/bin` to the front and restores the\n user's `ZDOTDIR`. A `precmd` hook keeps it first when tools such as direnv\n or nvm edit `PATH` before a prompt. History stays in the user's\n `.zsh_history`.\n - **bash:** `--rcfile <PANE_DIR>/shell/bash/rcfile` sources\n `/etc/bash.bashrc` and `~/.bashrc` (what an interactive non-login bash\n normally reads), then moves the directory to the front and adds a\n `PROMPT_COMMAND` hook.\n - **fish:** `--init-command` runs after the user's config and adds a\n `fish_prompt` handler.\n - **Other shells, Windows, run scripts, and `runpane workspace <machine> exec`:**\n `PATH` is prepended only. For exec this matters most: the command runs\n with Pane's own environment, which can predate the user `PATH` entry Pane\n adds at startup, and remote daemon hosts never get that entry (see\n [Every other terminal](#every-other-terminal)).\n - **WSL terminals:** see below.\n\n## WSL terminals\n\nOn Windows, WSL shells use the same `<PANE_DIR>/bin/runpane` shim, read\nfrom the distro as `/mnt/c/...`. Nothing is installed in the distro. Pane's\nWSL terminals put it first on `PATH`; in other WSL shells it comes from the\nWindows `PATH` (see [Every other terminal](#every-other-terminal)).\n\n- The daemon listens on a Windows named pipe, which Linux processes cannot\n open (a distro `node` gets `ENOENT`). So inside WSL (`WSL_DISTRO_NAME` is\n set) the shim runs Pane's Windows Electron binary through WSL interop, with\n `ELECTRON_RUN_AS_NODE` and `PANE_DIR` added to `WSLENV`. The CLI is then a\n Windows process on the same pipe as Windows terminals. A call takes about\n 0.4 s.\n- Pane already lists the terminal's `PANE_*` variables in `WSLENV`, so they\n reach the CLI. Its working directory is the Windows form of the shell's\n (`\\\\wsl.localhost\\<distro>\\...`, or `C:\\...` under `/mnt/c`).\n- The shim converts Linux paths to Windows paths with `wslpath -w`: an\n absolute `PANE_DIR`, the values of path flags such as `--file`,\n `--prompt-file` and `--pane-dir` (also in `--flag=value` form), and a\n path-like `--repo` value. Arguments after `--` pass through unchanged. The\n flag list is shared with the WSL Session bridge (`RUNPANE_PATH_FLAGS` in\n `main/src/utils/wslUtils.ts`).\n- WSL terminals start bash with `--rcfile <PANE_DIR>/shell/bash/wsl-rcfile`\n instead of `--login`. The rcfile reads the files a login bash reads\n (`/etc/profile`, then the first of `~/.bash_profile`, `~/.bash_login`,\n `~/.profile`), then puts the bin directory (via `/bin/wslpath -u`) first on\n `PATH`, exports `PANE_RUNPANE_BIN`, and adds a `PROMPT_COMMAND` hook. The\n shell is interactive but not a login shell, so use `exit`, not `logout`. If\n the distro cannot read the rcfile, the terminal starts `bash --login` as\n before.\n- With interop off, `runpane` prints how to turn it back on (`[interop]\n enabled=true` in `/etc/wsl.conf`) and exits 126.\n- If Pane's Electron binary is gone, `runpane` prints one line asking you to\n reinstall Pane and exits 127. There is no `node` fallback in WSL, because a\n distro `node` cannot open the named pipe.\n- A Windows command line is limited to 32,767 characters. Pass long text with\n a file flag such as `--prompt-file` instead of inline.\n- WSL Sessions keep their own `.pane-runtime/runpane` bridge, which runs the\n CLI through PowerShell and pins it to the Session\n ([SESSIONS.md](SESSIONS.md)).\n\n## Every other terminal\n\nAt startup, the installed Pane appends `<PANE_DIR>/bin` (normally\n`~/.pane/bin`) to the end of your own `PATH`. It appends rather than prepends,\nso a `runpane` you installed with npm comes first outside Pane; when it is the\nolder one, it runs Pane's CLI instead (see\n[Existing global installs](#existing-global-installs)).\n\n- **macOS and Linux:** Pane appends a block marked `pane-runpane-path v1` to\n the startup files of your login shell. The block adds the directory only if\n `PATH` does not already contain it.\n - zsh: `.zshenv`, which zsh reads in every shell, in your `ZDOTDIR` (as\n zsh reports it after `/etc/zshenv`) or else `~` (created if missing)\n - bash: `~/.bashrc`, plus on macOS the login file bash reads: the first of\n `~/.bash_profile`, `~/.bash_login` and `~/.profile` that exists. Pane\n creates `~/.bash_profile` only when none exists, because a new\n `~/.bash_profile` would stop bash reading the others.\n - fish: `$XDG_CONFIG_HOME/fish/conf.d/pane.fish` (default `~/.config`)\n - On macOS, that existing bash login file also gets the block when your\n login shell is not bash.\n\n Pane skips a file that is a symbolic link or already has the block, and\n keeps a file's permissions. If a file cannot be written, Pane logs it, tries\n the others, and retries it at the next start. New terminals pick it up; run\n `exec $SHELL -l` in an open one.\n- **Windows:** Pane appends the directory to your user `PATH`\n (`HKCU\\Environment\\Path`, no administrator rights), keeping the value's\n type (`REG_EXPAND_SZ` or `REG_SZ`), and broadcasts `WM_SETTINGCHANGE`.\n Terminals opened afterwards find `runpane`; already open ones keep their\n old `PATH`.\n- **WSL:** Pane writes nothing into the distro. WSL appends the Windows\n `PATH` by default, so every WSL shell finds Pane's shim at\n `/mnt/c/Users/<you>/.pane/bin/runpane`, and it reaches Windows Pane as\n described in [WSL terminals](#wsl-terminals). A `runpane` installed in the\n distro comes first on `PATH` there. When it is older than Windows Pane's\n CLI, it runs that shim; otherwise it runs itself and cannot reach Windows\n Pane.\n- **Remote daemon hosts** (`runpane install daemon`): unchanged. Only the\n desktop app edits `PATH`; on a server, install `runpane` with npm.\n\nPane changes each file, and the Windows `PATH`, at most once, and records\nwhat it changed in `<PANE_DIR>/bin/user-path.json`. Pane skips all of this when\n`PANE_DISABLE_OS_INTEGRATION=1` is set, when it runs with a non-default data\ndirectory (`--pane-dir`, `PANE_DIR` or `FOOZOL_DIR`), and in development\nbuilds.\n\nTo remove it, delete the lines from `# pane-runpane-path v1` through\n`# end pane-runpane-path v1` (or delete `pane.fish`). On Windows, remove the\n`.pane\\bin` entry under Settings > System > About > Advanced system settings >\nEnvironment Variables > User variables > Path. Pane does not add it again.\n\n## Existing global installs\n\nA globally installed `runpane` (`npm i -g runpane`) comes first in other\nterminals, because Pane appends its directory after it. Inside Pane terminals, Pane's shim resolves first because it\nmatches the running build's local-control contract. Use `$PANE_RUNPANE_BIN`\nto call it by absolute path.\n\nAn npm `runpane` older than Pane's CLI hands each invocation to Pane's CLI,\nwith the same arguments, stdin, stdout, stderr and exit code\n(`packages/runpane/src/managedCli.ts`):\n\n- Pane's CLI is the one in `<dir>/bin`, where `<dir>` is the invocation's\n `--pane-dir` (before any `--`), else `PANE_DIR`: the version pinned by\n `runpane update` in `runpane-override.json`, else the version line\n (`// runpane-version <version>`) that `main/build-runpane-cli.js` writes at\n the top of `runpane.cjs`. A pin whose runtime or entry point is gone does\n not count (Windows paths seen from WSL are left to the shim). Without `--pane-dir` or `PANE_DIR`, the npm CLI also\n looks for a Pane-managed shim on `PATH`, which is how a distro `runpane`\n finds Windows Pane's under WSL.\n- On macOS, Linux and WSL it runs the `runpane` shim with `/bin/sh`. On\n Windows it runs the pinned runtime and entry point directly, or\n `runpane.cjs` with its own Node, so no argument passes through `cmd.exe`.\n- The npm CLI runs itself when there is no Pane install, when it is the same\n version or newer, or when the hand-off cannot start.\n- The hand-off sets `RUNPANE_NO_HANDOFF=1` for the CLI it runs, so it happens\n at most once. Set it yourself to run a specific npm version. `runpane\n update` sets it for the version checks of the CLI it stages and installs.\n- Signals sent to the npm CLI's pid reach Pane's CLI once. From a terminal,\n Ctrl-C and Ctrl-\\ reach both through their shared process group; without a\n terminal on stdin, Pane's CLI runs in its own process group and the npm CLI\n forwards every signal.\n\n`runpane doctor` lists every `runpane` on `PATH` in resolution order, with its\nversion and origin (Pane-managed, npm global with its prefix, or other), under\n`cliInstalls` in `--json`. It warns, with the command that fixes it in `fix`:\n\n- `RUNPANE_STALE_INSTALL`: an npm install is older than Pane's CLI. Fix:\n `npm i -g --prefix <prefix> runpane@<version>`.\n- `RUNPANE_STALE_UNMANAGED`: a `runpane` that neither npm nor Pane installed\n comes before Pane's CLI and is older or of unknown version. Fix: remove it.\n- `RUNPANE_STALE_MANAGED`: another Pane-managed `runpane` on `PATH` is older\n than Pane's CLI. Fix: `<its dir>/bin/runpane update --pane-dir <its dir>`.\n- `RUNPANE_MANAGED_BEHIND`: an npm install or another Pane-managed `runpane`\n is newer than Pane's CLI. Fix: `<PANE_DIR>/bin/runpane update --pane-dir\n <PANE_DIR>`, which updates Pane's CLI (`runpane update` updates the CLI\n that runs it).\n\n`runpane doctor --fix` runs the `RUNPANE_STALE_INSTALL` fixes, reports each\nunder `fixed`, then checks again. It never removes a file. The Python CLI\npoints `--fix` at the npm CLI.\n\nSeveral Pane builds that share one `PANE_DIR` (for example a dev build and\nthe installed app, both on `~/.pane`) rewrite the same shim at startup; the\nmost recently started build wins. Use `PANE_DIR=~/.pane_test pnpm dev` to keep\nthem apart.\n"},{"path":"docs/RUNPANE_CLI_CONTRACT.md","title":"Runpane CLI Contract","text":"# Runpane CLI Contract\n\n<!-- Generated by scripts/generate-runpane-contract.js. Do not edit generated sections by hand. -->\n\n`runpane` is a thin installer and configurator for Pane. The npm and PyPI\npackages expose the same command contract and download the real Pane release\nartifact at command runtime.\n\nThe packages must not download, install, or configure Pane during package installation.\nWork starts only when a user runs `runpane ...`.\n\n## Maintainer Rules\n\n- Treat `contracts/runpane/contract.json` as the source of truth for both wrapper packages and generated docs.\n- Every command, flag, platform default, artifact-selection rule, and attribution rule change must be reflected in the contract.\n- The npm and PyPI wrappers must expose the same command behavior unless the contract explicitly documents a package-manager-specific difference.\n- Root `README.md` and package READMEs should lead with one guided quick-start command. Explicit commands, package-manager variants, and flags belong in an Advanced section.\n- Release version bumps must keep root `package.json`, `packages/runpane`, and `packages/runpane-py` versions in sync. Run `pnpm run check:runpane-package-versions` before release.\n- `pnpm run test:runpane-contract` must pass before changing wrapper command parsing, help output, platform defaults, release asset selection, or generated contract artifacts.\n- Token-based npm or PyPI publishing is a temporary fallback. Prefer trusted publishing once the package names are reserved and trusted publishers are configured.\n\n## Compatibility Floors\n\nThe npm wrapper requires Node.js `^22.23.4 || ^24.22.1 || ^26.12.1`, matching the root development baseline.\nThe CLI rejects unsupported runtimes before dispatching commands and before staging an independent updater runtime.\n\nThe Pane-managed CLI also accepts the audited Electron 43.8.3 / embedded Node 24.22.0 pair, whose CA backport passed actual TLS probes. This does not support standalone Node 24.22.0; independent updater runtimes must satisfy the standalone ranges.\n\nThe PyPI wrapper should run on Python `>=3.8` and newer. Keep runtime dependencies\nout of the wrapper unless a compatibility test covers the new dependency.\n\n## Public Terminology\n\n- `repo`: Saved Pane repository/project record\n- `pane`: User-visible Pane session\n- `tool`: Terminal-backed tab\n- `agent`: Built-in agent command template\n\n## Package Manager Entrypoints\n\nRecommended guided quick starts:\n\n```bash\nnpx --yes runpane@latest\nnpm i -g runpane && runpane setup\npipx run runpane\npython -m pip install runpane && python -m runpane setup\n```\n\nCanonical npm and Node commands:\n\n```bash\nnpx --yes runpane@latest\nnpx --yes runpane@latest setup\nnpx --yes runpane@latest install client\nnpx --yes runpane@latest install daemon --label \"My Server\"\npnpm dlx runpane@latest\npnpm dlx runpane@latest install daemon --label \"My Server\"\nnpm i -g runpane && runpane\nnpm i -g runpane && runpane setup\nnpm i -g runpane && runpane install daemon --label \"My Server\"\npnpm add -g runpane && runpane\npnpm add -g runpane && runpane setup\npnpm add -g runpane && runpane install daemon --label \"My Server\"\nyarn dlx runpane@latest install daemon --label \"My Server\"\nbunx runpane@latest install daemon --label \"My Server\"\n```\n\nCanonical Python commands:\n\n```bash\npipx run runpane\npipx run runpane setup\npython -m pip install runpane\nrunpane\nrunpane setup\npython -m runpane setup\nrunpane install daemon --label \"My Server\"\npipx install runpane\nrunpane\nrunpane setup\npipx run runpane install daemon --label \"My Server\"\nuvx runpane@latest\nuvx runpane@latest setup\nuvx runpane@latest install daemon --label \"My Server\"\npython -m runpane install daemon --label \"My Server\"\n```\n\nUse `pnpm dlx` for one-shot pnpm execution and `pnpm add -g` for persistent CLI installation.\nDo not document `pnpm install runpane` as the public CLI install path.\n\n## Commands\n\n```bash\nrunpane\nrunpane setup\nrunpane install\nrunpane install client\nrunpane install daemon\nrunpane update\nrunpane version\nrunpane doctor\nrunpane doctor --json\nrunpane daemon repair --pane-dir ~/.pane_remote --yes --json\nrunpane agent-context\nrunpane agent-context --command \"panes create\" --json\nrunpane mcp\nrunpane repos list --json\nrunpane repos add --path /path/to/repo --name Pane --yes --json\nrunpane repos get --repo Pane --json\nrunpane repos update --repo Pane --build-script \"pnpm install\" --run-script \"pnpm dev\" --worktree-folder ../pane-worktrees --yes --json\nrunpane repos update --repo Pane --clear run-script --yes --json\nrunpane repos update --repo Pane --env '[{\"key\":\"API_URL\",\"source\":\"plain\",\"value\":\"https://api.test\"},{\"key\":\"STRIPE_KEY\",\"source\":\"secret\",\"project\":\"stripe\",\"name\":\"STRIPE_SECRET_KEY\"}]' --env-remove OLD_TOKEN --yes --json\nrunpane repos rename --repo 3 --name Lev --yes --json\nrunpane secrets list --json\nprintf %s \"$VALUE\" | runpane secrets set --project stripe --name STRIPE_SECRET_KEY --yes\nrunpane secrets delete --project stripe --name STRIPE_SECRET_KEY --yes --json\nrunpane secrets exec --project stripe --only STRIPE_SECRET_KEY -- pnpm test:webhooks\nrunpane secrets request --project stripe --name STRIPE_SECRET_KEY --title \"Stripe test secret key\" --reason \"Run the webhook tests against Stripe test mode.\" --json\nrunpane panes list --repo active --json\nrunpane panes cost --pane <pane-id> --json\nrunpane panes create --repo active --name issue-252 --agent <agent> --prompt \"Kick off the discussion skill for issue 252\" --source agent --no-focus --wait-ready --yes --json\nrunpane panes create --from-json panes.json --yes --json\nrunpane panes archive --pane <pane-id> --source agent --yes --json\nrunpane panes rename --pane <pane-id> --name issue-393 --yes --json\nrunpane panels list --pane <pane-id> --json\nrunpane panels output --panel <panel-id> --limit 200 --json\nprintf 'Continue\\n' | runpane panels input --panel <panel-id> --input-file - --yes --json\nrunpane sessions list [--json] [--pane-dir <path>]\nrunpane sessions create --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions get --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions update --session <id|name> --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions pin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions unpin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions set-agent --session <id|name> --agent <codex|claude|cursor|opencode|pi> [--json] [--pane-dir <path>]\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane sessions detach --session <id|name> [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane sessions overview --session <id|name> [--json] [--pane-dir <path>]\nrunpane lock acquire --name testing-account --ttl 30m --wait 1800000 --note \"call QA\" --json\nrunpane lock release --name testing-account --json\nrunpane lock list --json\nrunpane loops create --repo active --name nightly-bug-sweep --cron \"0 3 * * *\" --agent claude --prompt \"Fix one bug from yesterday's issues\" --yes --json\nrunpane loops list --json\nrunpane loops run --loop <loop-id> --yes --json\nrunpane agents start --repo active --name fix-login --agent claude --prompt \"Fix the login redirect\" --yes --json\nrunpane agents start --pane <pane-id> --agent codex --prompt \"Review the PR from this branch and report findings\" --yes --json\nrunpane agents status --pane <pane-id> --json\nrunpane agents send --pane <pane-id> --text \"Also add a test\" --yes --json\nrunpane report --state ready --pr 747 --head fc5dce9 --summary-file /tmp/report.md --json\nrunpane panels last-message --panel <panel-id> --json\nrunpane panels conversation --conversation <id> --source resume --json\nrunpane panels close --panel <panel-id> --yes --json\nrunpane panels resume --panel <panel-id> --wait-ready --yes --json\nrunpane panels resume --session <id|name> --wait-ready --yes --json\nrunpane panes pause --pane <pane-id> --yes --json\nrunpane panes resume --pane <pane-id> --yes --json\nrunpane docs search --query \"archive a pane\" --json\nrunpane links create --pane <pane-id> --json\nrunpane panes git-status --pane <pane-id> --json\nrunpane help\nrunpane <command> --help\nrunpane watch --until-event\nrunpane watch --follow\nrunpane watch --session <id|name> --follow\nrunpane watch --session <id|name> --follow --ready-settle 1m --blocked-settle 15s --min-interval 2m\nrunpane pr watch [--pane <id>] --url <PR URL> [--head <full-sha>] [--json] [--pane-dir <path>]\nrunpane pr unwatch [--pane <id>] --url <PR URL> [--json] [--pane-dir <path>]\nrunpane pr list [--pane <id>] [--json] [--pane-dir <path>]\n```\n\n`runpane` with no arguments and `runpane setup` open an interactive wizard when stdin and stdout are TTYs. The remote-host wizard asks only for a name, then runs interactive Tailscale setup with automatic port selection; explicit install daemon flags remain available for SSH and manual URLs. In non-interactive shells or CI, both forms must print help, common commands, and agent discovery hints, then exit successfully instead of waiting for input.\n\n`runpane install` is an alias for `runpane install client`.\n\n`runpane install client` downloads the selected Pane desktop artifact and installs, opens, or launches it for the current platform.\n\n`runpane install daemon` downloads or installs Pane, resolves a stable Pane executable path, and spawns `<pane executable> --remote-setup <forwarded remote setup args>`.\n\nThe wrapper must stream Pane stdout/stderr without reformatting because `pane --remote-setup` prints the one-time `pane-remote://...` connection code.\n\n`runpane update` defaults to both app and active supported CLI, with independent supervision, staging, durable status, and explicit restoration outcomes. Prerequisites, status fields/exit codes, draft handling and manual recovery are documented in [Update recovery](UPDATE_RECOVERY.md).\n\n`runpane version` prints only wrapper package metadata and does not contact, launch, or focus the Pane app or daemon.\n\n`runpane doctor` opens with Pane's intro (\"For people\" and \"For agents\", the sentence about reaching the person following the Approvals setting) and the working rules (Session, Pane, Tab, Scratch), also in `--json` as `intro` and `workspaceRules`. It then checks platform support, release metadata reachability, download URL selection, installed Pane detection, daemon reachability, every `runpane` on `PATH` against the Pane-managed CLI, and remote-daemon hints. `--fix` updates npm installs of `runpane` older than the Pane-managed CLI to its version and never removes a file. Add `--json` for a machine-readable report that agents should run before mutating Pane state. Installed app version detection must be best-effort and must not launch, focus, or configure Pane; macOS wrappers read app bundle metadata instead of executing `Pane --version`.\n\n`runpane daemon repair` rewrites and restarts only the managed remote-daemon launcher/service. It never creates pairing credentials, changes tunnels, or downloads Pane; doctor only recommends it and never runs it automatically.\n\n`runpane agent-context` prints a brief, token-efficient command schema for coding agents without connecting to the Pane daemon.\n\n`runpane agent-context --command \"panes create\"` prints the detailed definition for one command. Add `--json` for machine-readable output. An unknown command exits 2 and lists the closest command names; with `--json` it prints `{ ok: false, code: \"unknown_command\", message, candidates }` on stdout.\n\n`runpane mcp` runs a stdio MCP server whose tools are generated from this contract: every command with result `jsonSchemas` becomes a tool that runs `runpane <command> --json` and returns its output. Only the npm package and the Pane app include it; the Python wrapper prints how to run it with Node and exits non-zero.\n\n`runpane repos list` connects to the running local Pane daemon and prints saved repository records.\n\n`runpane repos add` registers an existing git repository with the running local Pane daemon. It does not create directories or initialize git repositories by default.\n\n`runpane repos get` prints a saved repository's Project Settings. Each script shows its saved value, the fallback from the repository's config file, and the one Pane will run.\n\n`runpane repos update` changes a saved repository's Project Settings through the same save as the Project Settings dialog. It requires `--yes`, supports `--dry-run`, clears settings with `--clear`, and adds, replaces or removes project environment variables with `--env` and `--env-remove`.\n\n`runpane repos rename` trims and sets a saved repository's display name, the same rename as the repository settings in the app, and returns the updated repository record.\n\n`runpane secrets` manages Pane secrets: named values, addressed as `<project>/<NAME>`, that every machine saved in Pane keeps a copy of. `list` shows names, times and machines only. `set` reads the value from stdin. `delete` removes one everywhere. `exec` runs a command with secrets in its environment and returns its exit code. `request` asks the person on a masked Notify card and returns only `saved` or `declined`. No command prints a value, and the MCP server has no tool that sets or reads one. These commands run on the machine itself, so `runpane workspace <machine> secrets ...` is refused; use `runpane workspace <machine> exec -- runpane secrets ...`.\n\n`runpane panes list` lists Pane sessions, optionally scoped to one saved repository.\n\n`runpane panes cost` reports estimated token costs per Pane for the last 30 days, including per-model breakdowns and cache efficiency; unscoped output includes an Unattributed bucket that reconciles against workspace totals.\n\n`runpane panes create` connects to the running local Pane daemon, resolves the requested saved base repository, creates user-visible Pane sessions backed by Pane-managed worktrees/branches, opens terminal-backed tool tabs, and optionally sends initial input to the started tool. Built-in agent panes and `--source agent` default to background/no-focus unless `--focus` is passed. New Panes are pinned into the UI's favorite/pin set by default, except when the CLI runs inside a Session orchestrator (`PANE_ORCHESTRATION_SESSION_ID`), where child worktrees default to unpinned. Explicit `--pinned` / `--no-pinned` override creation defaults. First Session association clears an existing pin, including an explicit creation pin; use `panes pin` after association to pin a child. This avoids duplicating Session children in the global pinned list. Manual pins applied afterward are preserved. Panes created interactively in the Pane UI are unaffected. New Panes join the caller's Session automatically: the orchestrator's Session (`PANE_ORCHESTRATION_SESSION_ID`), or the open Session the calling tab's Pane belongs to; `--no-associate` opts out. A failed association is reported on the item and never undoes the Pane.\n\nFor `panes create --wait-ready` (and `panels create`, `panes adopt --launch`), ready means an identified agent at its own input box: declared with `--agent`, or detected from the command, its foreground process or its screen. A `--tool-command` that never shows a supported agent is not ready: `readiness.ok` is false with `readiness.reason.code` `no-agent-detected` after the timeout, or `command-exited` as soon as the command exits back to the shell, and nothing is typed into it. `agent-not-ready` means the agent was detected but its input box was not ready in time. CLI readiness is confirmed on consecutive polls. Codex also requires a recognized configured model or context footer below its live composer; its provisional startup composer is not ready. Hidden or unrecognized Codex status lines conservatively time out rather than prove readiness. Startup prompts return blocked with the prompt's own text in blocked.message and a suggestedCommand, and Pane never answers them, apart from Claude's folder trust for a Session's own folder: first-run trust and daemon dialogs and Agent Farm's `Trust this repository workspace? [y/N]` as blocked.kind=first-run-dialog; Codex's security setup banner and any other prompt, including a wrapper's or shell's `[y/N]` before the agent appears, as agent-prompt. A starting message blocked this way is held and sent once the prompt is answered and the agent's input box is ready. Every create with a starting message returns `initialInput`. Pane stages the text in the composer, presses the agent's submit key separately (Ctrl+Enter for Codex, declared or detected), and checks where it went: `initialInput.delivery` is `taken` or `queued` (from the agent's transcript or its screen), `in-composer`, or `unknown` (`argv` means a prompt was routed at launch; Pane gives the transcript up to 10 seconds before settling on unknown). `initialInput.verifiedSubmitted` is true exactly when it is `taken` or `queued`, and the create's `ok` is false unless a Claude or Codex starting message is verified. Cursor, OpenCode and Pi have no acceptance probe: their delivery stays `unknown` with a delivery.message saying so, `verification: unverifiable`, and `ok` follows readiness. Without `--wait-ready` the create returns at once with `initialInput.verifiedSubmitted: false`, a delivery.message saying the call did not wait, and a `panels wait` nextCommand; Pane still sends the message once the agent is identified and at its input box, and gives up without typing it if no supported agent appears within 30 seconds.\n\n`runpane panes archive` refreshes the configured upstream, reports exact unpushed commit evidence, and refuses unsafe archive operations unless `--force` is used. A branch whose upstream is gone counts as pushed when a merged GitHub pull request has HEAD as its head (`safetyCheck.mergedViaPr`). Add `--dry-run` to inspect the same evidence without archiving. `--remove-worktree` applies the same check and removal to an adopted worktree; local branches are always kept. Successful archives report `worktreeCleanup: completed` once the worktree is gone from its path and from git; `trashDeletion: pending` means its files are still being deleted in the background. `runpane panes archive --session <id|name> --merged` archives every Session Pane that is clean and pushed or merged, and reports a reason for each skipped Pane. Archive refuses a Pane with an agent mid-turn or waiting for an answer (`agent-busy`, listed in `safetyCheck.busyAgents`), or with a tab holding unsent composer text or unsaved editor edits (`unsent-input`, listed in `safetyCheck.unsentInput`), unless `--force` is used, and the Session sweep skips it. Add `--closed` to the sweep to also archive Panes whose PR closed without merging.\n\n`runpane panes rename` trims and updates a Pane's display name without changing its worktree, branch, panels, or focus, and returns the updated pane summary.\n\n`runpane panes focus` raises the Pane window and selects a Pane (and optionally one of its panels) exactly like clicking it in the UI. Because it steals the user's window focus, run it only on an explicit user request to open, focus, show, or switch to a Pane; never focus a Pane proactively, the same doctrine that keeps `panes create` background/no-focus for `--source agent`.\n\n`runpane panels open` opens a URL or a file from the Pane worktree as a tab in an existing Pane (default: the calling panel's Pane from `PANE_SESSION_ID`), in split view beside the agent unless `--tab` is passed. Files open in an editor tab with read-only previews for supported formats, and HTML opens as editable source; an existing tab showing the same target is reused. It brings the tab forward for clients already showing that Pane, and never raises or focuses the Pane window or switches anyone's Pane.\n\n`runpane panels close --panel <panel-id>` closes a tab exactly like closing it in Pane (a terminal tab's process stops) and never archives the Pane or touches its worktree. Only a tab an agent opened with `--source agent` can close; Pane records that opener, and `panels list` shows it as `openedBy`. It refuses, without closing, the person's tabs and every tab from before Pane recorded openers (`opened-by-user`), permanent tabs (`permanent`), an agent mid-turn or waiting for an answer (`agent-busy`), unsent composer text or unsaved editor edits (`unsent-input`), and a live tab whose input Pane cannot read, such as agents other than Claude and Codex or chat tabs (`input-unknown`). A refusal prints `{ ok: false, closed: false, refused: { code, message, next } }` and exits 1. A tab id that no longer exists returns `alreadyClosed: true`. `--dry-run` reports `wouldClose` and any refusal without closing. `--force` closes the tab anyway, as its close button does, for a stuck tab or one the person asked to close (`forced: true`); only a permanent tab still stays.\n\n`runpane panels list` lists tool panels inside one Pane session. Each panel with a saved agent session ID reports it as `resumeId`, with `resumeSource` (`agent-farm`, `configured`, or `agent`) naming the rule that reopens the conversation.\n\n`runpane panels output` reads bounded recent terminal output from one panel and strips common terminal control noise for agent use.\n\n`runpane panels input` sends exact input bytes to one terminal panel. Prefer `--input-file` for newlines, Ctrl-C, quotes, or shell-sensitive text.\n\n`runpane panes create --prompt` is an alias for `--initial-input`; request JSON and daemon payloads should use the canonical `initialInput` field.\n\n`runpane panes create --branch <name>` creates the Pane's worktree on exactly that new branch, slashes included (for example `agents/w5a`). The name is checked with `git check-ref-format --branch`, creation fails if the branch already exists, and Pane never renames it to make it unique. `--worktree-name` still names the directory and defaults to `--name`. `--base` is an alias for `--base-branch`, and `--prompt-file` for `--initial-input-file`. `panes create --base <ref> --branch <name> --prompt-file <file>` replaces `git worktree add` plus `panes adopt`. When the base is a remote-tracking branch (the default `origin/main`, or one named with `--base`), Pane fetches it first, waiting at most about 10 seconds, so the Pane starts at the remote's current tip. Each created item reports `base` (`ref`, `commit`, `refresh`); if the fetch fails the Pane still starts, from the local ref, and `base.notice` says so and how to catch up.\n\n`runpane panes adopt --launch` accepts `--prompt`, `--prompt-file`, `--wait-ready`, and `--ready-timeout-ms`, and reports `readiness`, `initialInput`, and `nextCommand` like `panes create`. A prompt without `--launch` is an error rather than being dropped.\n\nIf composer submission cannot be verified without risking a duplicate, the create item is unsuccessful with `initialInput.staged`, `initialInput.attempts`, `initialInput.blocked.kind: submission_unverified`, and an actionable `nextCommand`. The CLI-facing `--prompt` alias maps to this canonical `initialInput` result.\n\nWhen running from WSL while Pane is installed on Windows, a Linux-installed runpane cannot reach Pane: it looks for a missing `/tmp/pane-daemon.../daemon.sock`. Pane's own `runpane` (on PATH in Pane's WSL terminals, or `/mnt/c/Users/<you>/.pane/bin/runpane` from any WSL shell) runs the Windows CLI through WSL interop and converts path arguments. With a Pane build older than that shim, invoke the Windows wrapper through PowerShell from a Windows cwd, for example `powershell.exe -NoProfile -Command 'Set-Location $env:TEMP; runpane repos list --json'`.\n\n`runpane watch` waits for agent, Pane, panel, and PR events from the daemon journal without polling. `--follow` keeps watching with defaults tuned for an agent watching unattended (quiet, batched, and it ends itself after 3 hours with nothing happening); individual duration flags override these defaults. Cadence requires a named follow consumer; `--follow --since <generation>` has no consumer name and bypasses settling and batching. `--until-event` waits for one event worth waking for, prints it immediately without follow settling or batching, and exits 0. The defaults are listed in the contract under defaults.watch.\n\nA watch releases its pending slot when its client socket or named pipe disconnects. Re-arming the same named cursor takes over the previous request; the superseded watcher exits with a WATCH ERROR instead of competing for the cursor. Anonymous concurrent watchers retain the eight-wait limit. Each request also has a 125-second lease (slightly longer than the maximum 120-second long poll), so an abandoned request is reclaimed even if no disconnect arrives.\n\nThe desktop app treats one consumer name specially: while a `runpane watch --as dictate` request is in flight, and for 30 seconds after the last one ends, Pane skips its own \"needs your input\" and \"finished\" desktop notifications, because [Dictate](https://github.com/parsakhaz/open-dictate) shows those events on its pill. When that watcher stops, Pane's notifications come back. The CLI's flags and output are unchanged.\n\n`sessions list` list durable named orchestration Sessions.\n\n`sessions create` create a durable named orchestration Session and its hidden terminal owner.\n\n`sessions get` read one durable named orchestration Session.\n\n`sessions update` update a Session overview from structured JSON.\n\n`sessions pin` and `sessions unpin` set the Session pin star through the existing UI update path. Create JSON accepts `isPinned` (default false); update JSON preserves the pin when the field is omitted.\n\n`sessions set-agent` switch the durable terminal agent for a named Session.\n\n`sessions associate` associate a user-visible Pane with a named Session.\n\n`sessions detach` detach a Pane from a named Session.\n\n`sessions overview` read a live status, activity, git, and pull request overview for a named Session. Each panel in `panes[].panels[]` carries its own latest `runpane report` as `report`, so one call shows what every worker last reported and when (`reportedAt`, next to the panel's `state` and `lastActivityAt`). When a report's summary is a complete JSON object, such as a status file sent with `--summary-file`, `report.data` holds it exactly as the worker gave it; Pane never reads, renames or validates its fields. A summary that is not a JSON object (plain text, an array, a scalar or invalid JSON), is nested more than 64 levels deep, or was truncated (`summaryTruncated`), has no `data`. A panel that never reported has no `report`. `panes[].report` is still the newest report among the Pane's panels. Each panel also has `type` (`terminal`, `browser`, `editor`, `explorer`, `diff`, ...): a Pane linked whole lists every tab, with `explorer` and `diff` last, and a link that names tabs lists exactly those.\n\n`runpane lock acquire|release|list` coordinate a resource shared between agents, such as one test account. The caller's Pane and panel own the lock; it is scoped to the owner's Session (or global outside one), renews for the same owner, and is released on TTL expiry, owner panel exit, or owner Pane archive. `--wait` blocks in the daemon until the lock comes free.\n\n`runpane loops list|create|update|run|pause|resume|delete` manage loops (scheduled tasks): a cron schedule that starts a new Pane in a fresh worktree for each run, or sends a prompt to a Session's agent. Loops are for large recurring jobs and run at most once an hour; for short waits, agents use their harness's own sleep and wake. See [LOOPS.md](LOOPS.md).\n\n`runpane agents start|status|send` finish the three common agent jobs in one call each: start an agent on a task (a new tab in the work's Pane with `--pane <id>`, or a new Pane for new work), check on it, and send it a follow-up.\n\n`runpane report --state ready|blocked|failed|done` is how a worker hands back its result. It stores the latest report on the worker's panel (state, `--pr`, `--head`, up to 16,000 characters of `--summary` or `--summary-file`, and the `--question` a blocked worker needs answered), journals an opt-in `agent.report` watch event (`REPORT <pane-name> pane <pane-id> panel <panel-id> ready pr#747 fc5dce9`; it skips the `--min-interval` batch), records it as Session activity, and shows it in `agents status`, `panels list`, and `sessions overview` (each panel's own report as `panes[].panels[].report`, with a JSON object summary as `data`, and the Pane's newest as `panes[].report`). Inside a Pane terminal the panel comes from `PANE_SESSION_ID` and `PANE_PANEL_ID`; elsewhere pass `--pane` and `--panel`. It prints how many watches were waiting for the report and received it (`Delivered to 1 waiting watcher.`, `liveWatchers` in JSON). Zero means nobody was waiting right now, not that the report is lost: it stays on the panel, and a named-cursor watch receives it when it next waits.\n\n`runpane notify` asks the person a question, or tells them something, on screen wherever they are, and prints their answer: `--ui options` with 1 to 9 `--choices` returns `{answer, note?}` (the chosen label), or with 2 to 4 `--questions` (`[{title, choices}]`) one pick each, as `{answer, answers}`, `--ui approve` returns `{approved, note?}`, `--ui ask` returns `{answer}`, and `--ui info` returns `{delivered: \"screen\"|\"inbox\"}` at once. Any ui takes up to 6 `--links` (`{label, path}`, `{label, url}` or `{label, approval}` for another approval), shown as chips on the card. When the person types a reply it returns `{reply, picks?, id, next}` (or, with no open call, types a `reply:` line into the asking tab): the reply may answer the question or ask one. `runpane notify --took <id|Q-n> answer` records it as the answer; `--took <id|Q-n> question [--status <text>]` shows that the agent is getting more context, and `runpane notify --update <id|Q-n> --asked <text> --what-changed <text>` with any changed `--title`, `--context`, `--choices`, `--questions` or `--links` saves a new version and waits on it. `--took` prints `{took, id, next?}`. Only the reply's reader (the asker, the orchestrator that relayed it, or Autopilot) may run them. The call waits with no time limit. A `{waiting: true, id, next}` result means the wait should continue with `runpane notify --resume <id>`; `runpane mcp` asks for it only for clients whose tool calls time out. When Pane is not running or Notify is off it prints `{unavailable, next}` and exits 0, so the agent asks in its terminal. Invalid input fails before anything is shown, with a message naming the field. A Session orchestrator adds `--relays <item>` (an id from `runpane inbox`) to relay a worker's question: the same card gains the choices, context and links, the call waits on it as usual, and the answer also goes straight to the worker's tab. Autopilot's own item takes `--about-session <id|name>`, the Session it is about. It needs no `--yes`: asking the person is the point.\n\nWork sent to an agent through `runpane panels create`, `panes create` (with a prompt), or `panels submit` records that the sender waits for a `runpane report`, unless the request says `--source user` (Pane's own UI does) or `--no-expect-report`; `--expect-report` asks for one anyway. Typing into a tab never does. If the agent then goes ready or its panel exits without a report, Pane journals one opt-in `agent.report.missing` entry (`MISSING REPORT <pane-name> pane <pane-id> panel <panel-id> ready|exited`) whose `lastOutput` is the agent's last transcript reply or last screen lines; it skips the `--min-interval` batch and reaches only watchers that list it in `--kinds`. While the agent's screen shows background work (Claude's `· 1 shell` footer or a running background subagent row, Codex's `background terminal running` line), Pane waits and looks again every 10 seconds instead. `agent.blocked` entries carry `screenLines`, the prompt the agent waits on, and are journalled once a panel has stayed blocked for 2 seconds.\n\nThe orchestrator guide prescribes submit without `--wait`, followed by its named watch; use one completion consumer. As an optional CLI route, `--wait` on `runpane panels submit`, `panels create`, and `panes create` turns the expected report on and blocks on that panel until the first `agent.report`, `agent.report.missing`, `agent.blocked`, `panel.exited`, or `pane.gone`, then prints one line of JSON (`dispatchWaitResult`): the outcome, ids, the report's state, summary, `summaryPath`, PR and head, `screenLines` for a prompt, or `lastOutput` for a missing report, never the transcript. It exits 0 for a report, 3 missing, 4 blocked, 5 exited or gone, and 124 when `--timeout <duration>` passes. It follows the journal from the position the daemon took before delivering the work, so nothing that happens right after delivery is missed. It reuses watch --until-event and returns indeterminate (exit 6) if the journal epoch changes or retained history is lost; inspect the panel and inbox before retrying. Report-expected dispatches are serialized per panel and refused before writing while a result or missing-output collection is outstanding. A send with --no-expect-report is a reply (an answer, or an addition to the current work): it is delivered while a report is outstanding and leaves that expectation in place. Then watch for the original result.\n\n`runpane inbox [--session <id|name>] [--json]` lists what a Session's orchestrator has not acknowledged: reports, missing reports, and on-screen questions (a question clears itself once its panel moves on), plus `answers`, what its workers were told, kept 7 days; an answer with no `decision` still needs its D-n. `runpane inbox ack <item-id>...` or `--all --session <id|name>` clears items, and `runpane inbox ack <item-id>... --decision <D-n>` records the D-n, even on an item already cleared. An orchestrator runs it when it starts or resumes, to catch anything that finished while it was down; Pane never injects the inbox into its turns.\n\n`runpane panels resume --panel <panel-id>` restarts a stopped terminal panel in place, keeping its panel id: an agent panel relaunches with its resume command (Claude `--resume <session>`, `codex resume <session>`, Agent Farm `agent-farm run <profile> --resume <id>` with the ID Agent Farm printed; the result's `agentSessionId` names it), the same restart the app runs when it shows the panel, without taking focus. A running panel is left alone (`action: \"already-running\"`); one whose agent exited back to its shell is stopped, and resume runs its saved command again in that shell (`action: \"resumed\"`). If that command exits at once, `--wait-ready` returns `ok: false` with `reason.code: \"command-exited\"` and the error line it printed. `--panel` also resumes a paused tab. `--session <id|name>` or `--all-stopped` resumes every stopped agent panel in that scope and skips paused ones, `--concurrency` at a time (default 3), then, with `--wait-ready`, waits on the resumed panels together, and returns `{ resumed, alreadyRunning, failed, notReady, items[] }` with each panel's own result, readiness, and blocker or error. After a Pane restart, or once an agent exits back to its shell, stopped panels report `running: false` (`initialized` stays true while the shell lives) in `panels list`, `panels screen`, and `panels wait` (which returns `stopped: true` instead of timing out), and `nextCommand` points at `panels resume`. `runpane watch` reports them as `panel.stopped` (`STOPPED ...`) when `--kinds` lists that kind; other consumers and `workspace state` see `agent.unknown` with `running: false`, never `agent.ready`.\n\n`runpane panels pause --panel <panel-id>`, `panes pause --pane <pane-id>` and `sessions pause --session <id|name>` pause a tab, a Pane, or a Session's chat and Panes: Pane stops each terminal tab the way quitting does, without asking, keeps its agent's conversation, and marks it paused. Pause leaves a chat tab running: `panels pause --panel` on one fails with `ERR_RUNPANE_CHAT_NOT_PAUSABLE`, and `panes pause` and `sessions pause` leave its agent running and count it in `chatTabsNotPaused`. A paused terminal tab stays stopped through clicks, app restarts and updates until `panels resume --panel`, `panes resume` or `sessions resume` restarts it in its saved conversation. Each returns `{ action, scope, panelIds, unchanged, failed, chatTabsNotPaused, message, nextCommand }`. `panes list` reports a Pane's `paused` mark (`{ at, by: \"manual\" | \"auto\", idleHours? }`) and `inactiveSince`, the latest terminal output or input or chat agent activity in its tabs, or the last time the person selected it; `panels list` reports each tab's `paused`. Auto-pause also stops the agent of a chat tab idle for `chatIdleReleaseMinutes` (30 by default); opening the tab or sending it a message resumes it, and it reports no `panel.paused`. `runpane watch` reports `panel.paused` (`PAUSED ...`) and `panel.unpaused` (`UNPAUSED ...`) under `--follow`, to a Session-scoped watch, or when `--kinds` lists them.\n\n`runpane panels last-message --panel <panel-id>` reads a Claude or Codex agent's last reply from its transcript (up to `--limit` characters, default 20,000, keeping the end and reporting `truncated`). It never scrapes the screen: without a transcript it prints `{ ok: false, reason: \"transcript-unavailable\" }` and exits 1.\n\n`runpane panels conversation --conversation <id> [--source startup|resume|clear|compact]` records which conversation a terminal panel's agent is on (daemon action `runpane:panels:conversation`, request `{ panelId, paneId?, conversationId, source? }`, result `{ ok: true, paneId, panelId, conversationId, source?, sure }`; `sure` is true when the report came since the panel's agent started). It is not an `agent.report` event. The panel comes from `--panel` (with an optional `--pane`), else `PANE_PANEL_ID` and `PANE_SESSION_ID`, as for `runpane report`. `runpane panels conversation --hook` is the command for a Claude Code `SessionStart` hook: it reads the hook's JSON from stdin (`session_id`, `source`; at most 64 KiB, for at most 2 seconds), reports it for `PANE_PANEL_ID`, prints nothing on stdout or stderr, and always exits 0: outside Pane, on bad input, when Pane is not running, and with a Pane that predates the action. Without `--hook` it prints `Recorded conversation <id> for panel <panel-id>.` and fails like any other command.\n\nCommands with a contract `daemonAction` (the `panes` git, script, restore, and move commands, `folders list|create`, and `links open`) call the same Pane daemon channel as the matching button in the app and print `{ ok, data, error }`. Destructive ones add a pane:// `link` to review the Pane.\n\n`runpane links create` builds `pane://open?...` links; opening one in Pane selects what it names and never changes Pane state.\n\n`runpane docs search|read` search and read Pane docs, help, and installed Pane Chat skills offline. They ship in the npm package and the Pane app only.\n\n`runpane handoff` hands a task to another agent on this or another of your machines. The sending agent writes the note from `runpane handoff --template` (goal, current state, done and verified, in progress, next steps, decisions and constraints, open questions, how to verify, git state); `runpane handoff \"claude opus on parsas-macbook-pro\" --note-file ~/handoff.md` checks every section is filled in, requires the branch to be pushed (or pushes it with `--push`, never forcing), writes the note to that machine's `~/.pane/handoffs/` and starts the agent in a new Pane branched from the sender's branch. When the sender is a Pane tab running a Claude, Codex, Cursor or OpenCode session and the receiver is the same agent, the handoff carries that session: on another machine its files are copied into that machine's agent store and the receiver resumes the same id; on this machine the receiver resumes a fork, because two agents never resume one session on one machine. The receiver starts with no prompt, and the CLI runs the continuity check and reports JSON `continuity.result` `continued`, `inconclusive` (exit 0; `next` gives a probe question) or `not-continued` (exit 1; the receiver is kept and `next` gives the `--note-only` command). `--note-only`, a different agent, or a tab with no carried session starts a fresh agent with the note (`fresh-agent`). JSON `continuity` is `{ carried, result, agent, sessionId, resumedId, fork, files, bytes, checks: { resumedById, restartResumes, historyLoaded, originalUntouched?, originalAppended? }, reason, next }`: `sessionId` is the sender's session, `resumedId` the id the receiver resumes (the fork's on this machine), `checks` are the continuity checks (`historyLoaded` is null when there was nothing to compare; `originalUntouched` is set for forks), and a dry run sets `carried`, `sessionId`, `fork`, `files` and `bytes` with no `result`. After `continued` or `inconclusive` the sending agent ends its turn and makes no more changes on the branch. An OpenCode session travels as its export: `opencode export` on this machine, then `opencode import` inside the receiving repository there, and an OpenCode receiver is accepted only to continue an OpenCode session. A Cursor session is carried only to another machine, best effort since Cursor's store is undocumented: Cursor has no fork, and a copied chat still writes to the original, so on this machine the result is `not-continued` and nothing is started. A destination's agent store is assumed at its default location (`~/.claude`, `~/.codex`, `~/.cursor`); a copy already there is replaced only when the sender's holds all of it and no agent there runs it, otherwise nothing is copied and the result is `not-continued`. A destination Pane too old to resume a carried session is refused before anything is sent (`ERR_HANDOFF_RESUME_UNSUPPORTED`). From a Session's terminal it skips git and creates a Session with the same name, goal and agent on the other machine instead; a same-agent Session resumes the sender's conversation when first opened. The receiver reports back to the sender's panel.\n\n`runpane ask --agent <agent> --prompt \"<question>\"` asks one agent one read-only question and prints its answer, with no tab left behind: the agent's own headless mode runs once, on this machine or another one (`--machine`), in a saved repository (`--repo`, a WSL repository runs in WSL) or a Pane's worktree (`--pane`), with any model it accepts (`--model`). It can read files but not edit them or run shell commands; an agent with no such mode is refused (`ERR_ASK_UNSUPPORTED`). A missing agent, a sign-in error, an unknown model and a timeout each fail with the agent's own words and the next step. Use it for a second opinion or a question to another model; work that edits files goes to a tab.\n\n`runpane models` lists the models each installed agent offers, read from the agent's own list on every call, with its sign-in as the agent reports it. `--all` covers this machine, every saved machine and their WSL; `--agent` and `--search` narrow the rows. A machine that does not answer is one `unreachable` row; a list that can't be read is `list unavailable`.\n\n`runpane pr watch`: Register durable GitHub PR monitoring for a Pane.\n\n`runpane pr unwatch`: Remove a Pane’s explicit PR registration.\n\n`runpane pr list`: List PR registrations and stopped watches.\n\n`runpane autopilot status|waiting|stack` read Autopilot (experimental): its switch, run and stack, and its queue: every approval or question waiting on the person on every machine it can reach, grouped by Session, plus `offline` and `cantSee` machines. `runpane autopilot stack push (--item <id>|--file <path>|--url <url>|--session <id|name>) [--title <text>] [--note <text>] [--tab <path-or-url>]... [--next]` puts one entry on its stack; relative paths resolve against the caller's directory, and a new entry never replaces the one on screen. `runpane autopilot answer <id> (--choice <label>|--approve|--deny|--text <text>) [--note <text>] --because <why>`, `runpane autopilot close <id> --reason <why>` and `runpane autopilot rewrite <id> --ui <options|approve|ask> --title <text> [--context <text>] [--choices <json>] [--suggestions <json>] [--links <json>]` act on an item, on the machine that holds it, recorded \"by Autopilot\" on every device; the person can Override an answer and reopen a close. Only Autopilot may run them (`AUTOPILOT_ONLY`), and they refuse a permission prompt with `AUTOPILOT_CANNOT_ANSWER`. An item someone else already answered is refused with who did.\n\n## Command reference\n\nEvery command and its options, from `commands` in `contracts/runpane/contract.json`.\n\n- `help`: Show help for runpane or a specific command.\n- `setup`: Open the guided setup wizard for install, remote host setup, update, and diagnostics.\n- `install`: Install Pane on this machine or configure this machine as a remote daemon host.\n- `update`: Update both Pane and the invoked supported CLI through an independent helper.\n- `version`: Print the runpane wrapper version without contacting, launching, or focusing Pane.\n- `doctor`: Run platform, release, installed Pane, daemon reachability, runpane-on-PATH, and remote setup diagnostics.\n- `daemon repair`: Repair and restart the managed remote-daemon launcher without changing pairing or tunnel configuration.\n- `agents doctor`: Diagnose whether a built-in agent command is available in a Pane repository environment.\n- `agent-context`: Print token-efficient Pane command context for coding agents.\n- `mcp`: Run the Pane MCP server over stdio so coding agents can call runpane commands as tools.\n- `relay`: Run your own Pane relay: starts this platform's prebuilt pane-relay with your flags; init prints and checks the DNS records it needs.\n- `link`: Link this computer with the one that made a one-time link, so each can reach the other.\n- `repos list`: List repositories saved in the running Pane app.\n- `repos add`: Register an existing git repository with the running Pane app.\n- `repos get`: Show a saved repository's Project Settings and the scripts Pane will run.\n- `repos update`: Change a saved repository's Project Settings: scripts, worktree folder, name, IDE command, system prompt, and environment variables.\n- `repos rename`: Rename a repository saved in the running Pane app.\n- `secrets list`: List the Pane secrets on this machine: project, name, and when and where each was set. Never shows a value.\n- `secrets set`: Save a Pane secret, adding or replacing it. Reads the value from stdin.\n- `secrets delete`: Delete a Pane secret from this machine and, through sync, from your other machines.\n- `secrets exec`: Run a command with Pane secrets in its environment. Nothing prints a value.\n- `secrets request`: Ask the person for a secret on a masked card. Pane saves what they type as a Pane secret and never returns it.\n- `devices list`: List the phone simulators and emulators this Pane can open: platform, name, OS, machine, state, and which Pane holds each.\n- `devices open`: Boot a phone simulator or emulator for this Pane and show its live screen in a device tab beside the agent.\n- `devices screenshot`: Capture the screen of this Pane's open device as an image.\n- `devices act`: Run an agent-device command on this Pane's open device: open an app, snapshot -i for element refs, press @e3, fill, swipe, install, logs.\n- `devices run`: Run a command where this Pane's device runs, such as a build (npx expo run:ios) or Metro with --background.\n- `devices close`: Release this Pane's device (or, with --platform, only that one) and stop the commands device_run started. The device stays warm for 10 minutes.\n- `devices usage`: Report every simulator and emulator on this machine, and the memory and disk they, Pane's device tools and build checkouts use.\n- `devices free`: Shut down unused devices (--idle), or also delete every unused device Pane made and the build checkouts no Pane holds (--all).\n- `theme read`: Show Pane's own theme: what is selected, the Custom theme, every colour token with its current value, the stable selectors, and the guide for restyling Pane.\n- `theme set`: Restyle Pane itself, only when the person asks to change Pane's look: write the Custom theme (a base theme, colour tokens and CSS) and select it, or switch to another theme. Pane restyles within a second.\n- `theme reset`: Delete the Custom theme and go back to the theme it was built on.\n- `panes list`: List Pane sessions in a saved repository.\n- `panes cost`: Report estimated token cost per Pane, with per-model breakdown and cache efficiency.\n- `workspace state`: Read one workspace snapshot of every Pane and CLI panel.\n- `workspace list`: List your computers saved in Pane and the machines on your tailnet, one entry per computer, and whether each answers workspaces.\n- `workspace enable`: Put this machine's Pane on your tailnet for runpane workspace (the default when Tailscale is signed in).\n- `workspace disable`: Take this machine off runpane workspace and remove its tailscale serve handler on port 8443.\n- `workspace read`: Print a file from another of your machines; any path form works (C:\\..., /mnt/c/..., /home/..., ~/...).\n- `workspace write`: Write --content or stdin to a file on another of your machines, creating parent folders.\n- `workspace exec`: Run a command in another machine's shell and return stdout, stderr, the exit code, OS, and shell.\n- `handoff`: Hand your task to another agent on this or another machine: check your handoff note, make the branch reachable, send the note, and start the agent on it. A same-agent handoff from a Pane tab carries and resumes your own session (a fork on this machine) and checks it continued; otherwise a fresh agent starts with the note. From a Session's terminal, create the Session on another machine instead.\n- `ask`: Ask any agent and model one read-only question, on this or another machine, and get its answer: no tab is opened and nothing is left behind.\n- `models`: List the models each installed agent offers, on this machine, another one, or every saved machine, with what each agent reports about its sign-in. Read live on every call.\n- `watch`: Wait for workspace agent and Pane transitions using a daemon-held cursor.\n- `panes create`: Create a Pane (a new worktree) only when the work's branch has no Pane yet; for review, audit, fix or QA on existing work use `panels create --pane <id>`.\n- `panes adopt`: Adopt an existing externally managed git worktree as a Pane without changing the worktree.\n- `panes archive`: Archive a Pane (session) exactly like the UI Archive action, including safe removal of its Pane-managed git worktree, or archive every merged Pane in a Session.\n- `panes pin`: Declaratively pin a Pane; pinned is the Pane UI's favorite/pin star and repeated requests are idempotent.\n- `panes unpin`: Declaratively unpin a Pane; pinned is the Pane UI's favorite/pin star and repeated requests are idempotent.\n- `panes pause`: Pause a Pane: stop every terminal tab and keep their conversations until the Pane is resumed.\n- `panes resume`: Resume a paused Pane: restart its paused tabs in their saved conversations.\n- `panes rename`: Rename a Pane without changing its worktree, branch, panels, or focus.\n- `panes focus`: Raise the Pane window and select a Pane (and optionally one of its panels) on explicit user request.\n- `panels create`: Open a new agent or terminal tab inside an existing Pane, sharing its worktree. The default for review, QA, fixes and any other agent on work that already has a Pane.\n- `panels open`: Open a URL or file as a browser/editor tab in a Pane, in split view beside the agent by default.\n- `panels close`: Close a tab an agent opened, exactly like closing it in Pane; refuses the person's tabs, busy agents and unsent input unless --force.\n- `panels list`: List tool panels inside a Pane session.\n- `panels output`: Read recent terminal output from a panel.\n- `panels screen`: Read a compact current-screen view from a terminal panel.\n- `panels input`: Send input bytes to a terminal panel.\n- `panels submit`: Send and submit text to a terminal panel, including idle agent composers.\n- `panels submit-composer`: Submit an agent composer using the panel-appropriate key sequence.\n- `panels wait`: Wait for a terminal panel to initialize, become ready/idle, or contain text.\n- `panels resume`: Restart a stopped terminal panel in place, resuming its agent's conversation.\n- `panels pause`: Pause a terminal tab: stop its process and keep its agent's conversation until it is resumed.\n- `panels last-message`: Read an agent's last reply from its transcript, without scraping the screen.\n- `panels conversation`: Record which conversation a terminal panel's agent is on, so Switch to chat and restarts open that one. A Claude Code SessionStart hook runs it with --hook.\n- `panes git-status`: Read the git status of a Pane worktree: uncommitted, unpushed, and behind-main counts.\n- `panes commit`: Stage all changes in a Pane worktree and commit them.\n- `panes push`: Push a Pane branch to its remote.\n- `panes pull`: Pull the remote branch into a Pane worktree.\n- `panes rebase-main`: Rebase a Pane branch onto the latest main branch.\n- `panes restore`: Restore an archived Pane, recreating its worktree.\n- `panes squash-rebase`: Squash a Pane branch into one commit and rebase it onto main.\n- `panes stash`: Stash uncommitted changes in a Pane worktree.\n- `panes stash-pop`: Apply and drop the latest stash in a Pane worktree.\n- `panes soft-reset`: Undo the last commit in a Pane, keeping its changes staged.\n- `panes fetch`: Fetch the remote for a Pane worktree.\n- `panes run-script`: Run the repository's run script in a Pane.\n- `panes stop-script`: Stop the run script running in a Pane.\n- `panes move`: Move a Pane into a sidebar folder.\n- `folders list`: List the sidebar folders of a repository.\n- `folders create`: Create a sidebar folder in a repository.\n- `links create`: Build a pane:// link that opens a Pane, panel, repository, or Session in the Pane app.\n- `links open`: Open a pane:// link in the running Pane app.\n- `docs search`: Search Pane's docs, runpane help, and the Pane Chat skills.\n- `docs read`: Read one Pane doc, help topic, or skill in full.\n- `agents start`: Start an agent on a task and wait until it is ready: as a new tab in an existing Pane with --pane <id> (review, audit, fix, QA), or in a new Pane with --repo and --name for new work.\n- `agents status`: Check on an agent: whether it is working, ready, blocked, or idle, plus its current screen.\n- `agents send`: Send a follow-up message to an agent and confirm it was submitted.\n- `report`: Hand back a worker's structured report: state, PR, head commit, summary, and the question when blocked.\n- `notify`: Ask the person a question, or tell them something, wherever they are, and get their answer back.\n- `inbox`: List the reports, missing reports, and on-screen questions a Session's orchestrator has not acknowledged, and the answers its workers got.\n- `inbox ack`: Clear Session inbox items once they are handled, and record an answer's D-n.\n- `autopilot status`: Show Autopilot (experimental): whether it is on and running, whether Sentinel is on, its run, its stack, and what waits in each Session.\n- `autopilot waiting`: List every approval and question waiting on the person on every machine Autopilot can reach, grouped by Session, and the machines it can't reach. This is Autopilot's queue.\n- `autopilot stack`: List the entries on Autopilot's stack in order, and which one is on screen.\n- `autopilot stack push`: Put a waiting item, a document, a URL, or a Session on Autopilot's stack for the person to look at.\n- `autopilot answer`: Answer a waiting item as Autopilot, with why; delivered at once and recorded \"by Autopilot\". Never a permission prompt.\n- `autopilot close`: Close a waiting item as Autopilot, with why; its asker is told and the person can reopen it. Never a permission prompt.\n- `autopilot rewrite`: Close an unclear waiting item and re-ask it rewritten; the answer goes to the original asker.\n- `sessions list`: List durable named orchestration Sessions.\n- `sessions create`: Create a durable named orchestration Session and its hidden terminal owner; JSON isPinned sets the pin star (default false).\n- `sessions get`: Read one durable named orchestration Session.\n- `sessions update`: Update a Session overview from structured JSON; isPinned sets the UI pin star.\n- `sessions set-agent`: Switch the durable terminal agent for a named Session.\n- `sessions associate`: Associate a user-visible Pane with a named Session.\n- `sessions detach`: Detach a Pane from a named Session.\n- `sessions overview`: Read a live status, activity, git, and pull request overview for a named Session.\n- `lock acquire`: Acquire a named lock on a resource shared between agents, such as one test account, optionally waiting for it.\n- `lock release`: Release a named lock you hold, or force-release another owner's lock.\n- `lock list`: List held named locks, optionally only one Session's.\n- `sessions unpin`: Declaratively unpin a named Session using the UI pin state; repeated requests keep the requested state.\n- `sessions pin`: Declaratively pin a named Session using the UI pin state; repeated requests keep the requested state.\n- `sessions pause`: Pause a Session: stop the terminal tabs of its chat and every Pane in it, keeping their conversations. Chat tabs keep running.\n- `sessions resume`: Resume a paused Session: restart its chat and the paused tabs of its Panes.\n- `pr watch`: Register durable GitHub PR monitoring for a Pane.\n- `pr unwatch`: Remove a Pane’s explicit PR registration.\n- `pr list`: List PR registrations and stopped watches.\n- `loops list`: List loops (scheduled tasks) with their schedule, next run, and recent runs.\n- `loops create`: Create a loop: a cron schedule that starts a new Pane in a fresh worktree for each run, or sends a prompt to a Session's agent. Loops are for large recurring jobs and run at most once an hour; for short waits, use your agent harness's own sleep and wake.\n- `loops update`: Change a loop's repo or Session, name, schedule, agent or command, prompt, or worktree template. Loops are for large recurring jobs and run at most once an hour; for short waits, use your agent harness's own sleep and wake.\n- `loops run`: Start a run of a loop now. The schedule stays the same.\n- `loops pause`: Pause a loop: it starts no scheduled runs until resumed.\n- `loops resume`: Resume a paused loop from its next scheduled time.\n- `loops delete`: Delete a loop. It starts no more runs.\n\n```bash\nrunpane help [command]\nrunpane setup\nrunpane install [client|daemon] [options]\n runpane update [--pane-only | --cli-only] [--version <latest|vX.Y.Z>] [--pane-dir <path>] [--dry-run] [--wait] [--json]\n runpane update --status <operation-id> [--wait] [--pane-dir <path>] [--json]\nrunpane version [--pane-dir <path>]\nrunpane --version\nrunpane doctor [--json] [--pane-dir <path>] [--pane-path <path>] [--format <format>] [--verbose]\nrunpane doctor --fix [--json] [--pane-dir <path>]\nrunpane doctor --report [--title <text>] --body-file <path|-> [--yes] [--json]\nrunpane daemon repair [--pane-dir <path>] [--pane-path <path>] [--yes] [--json]\nrunpane agents doctor --agent <codex|claude|cursor|opencode|pi> [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane agent-context [--json]\nrunpane agent-context --command <command> [--json]\nrunpane mcp [--toolsets <name,...>] [--read-only]\nrunpane relay [pane-relay flags...]\nrunpane relay init --domain <relay domain> [--public-ip <IPv4>] [--resolver <ip[:port]>]\nrunpane link <link> [--yes] [--json] [--pane-dir <path>]\nrunpane repos list [--json] [--pane-dir <path>]\nrunpane repos add --path <path> [--name <name>] [--json] [--yes] [--pane-dir <path>]\nrunpane repos get [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane repos update --repo <selector> [--name <name>] [--build-script <script>] [--run-script <script>] [--archive-script <script>] [--worktree-folder <path>] [--open-ide-command <command>] [--system-prompt <text>] [--env <json>] [--env-remove <name,...>] [--clear <setting,...>] [--from-json <path|->] --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane repos rename --repo <selector> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets list [--project <project>] [--json] [--pane-dir <path>]\nrunpane secrets set --project <project> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets delete --project <project> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets exec --project <project> [--only <name,...>] [--env <VAR=NAME>]... [--file <name>]... [--pane-dir <path>] -- <command>...\nrunpane secrets request --project <project> --name <name> --title <text> --reason <text> [--json] [--pane-dir <path>]\nrunpane devices list [--json] [--pane-dir <path>]\nrunpane devices open --platform <ios|android> [--device <name-or-id>] [--json] [--pane-dir <path>]\nrunpane devices screenshot [--platform <ios|android>] [--json] [--pane-dir <path>]\nrunpane devices act [--platform <ios|android>] [--json] [--pane-dir <path>] -- <command>\nrunpane devices run [--platform <ios|android>] [--background] [--wait-ms <milliseconds>] [--json] [--pane-dir <path>] -- <command>\nrunpane devices close [--platform <ios|android>] [--json] [--pane-dir <path>]\nrunpane devices usage [--json] [--pane-dir <path>]\nrunpane devices free (--idle|--all) --yes [--json] [--pane-dir <path>]\nrunpane theme read [--json] [--pane-dir <path>]\nrunpane theme set [--base <theme>] [--colors <json>] [--css <text>] [--name <text>] [--json] [--pane-dir <path>]\nrunpane theme set --theme <id> [--json] [--pane-dir <path>]\nrunpane theme reset [--json] [--pane-dir <path>]\nrunpane panes list [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane panes cost [--repo <selector>] [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane workspace state [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane workspace list [--json] [--pane-dir <path>]\nrunpane workspace enable [--json] [--pane-dir <path>]\nrunpane workspace disable [--json] [--pane-dir <path>]\nrunpane workspace [<machine>] read <path> [--json]\nrunpane workspace [<machine>] write <path> [--content <text>] [--json]\nrunpane workspace <machine> exec [--cwd <path>] [--timeout-ms <ms>] [--json] -- <command>\nrunpane handoff --template\nrunpane handoff \"<destination>\" --note-file <path|-> [--machine <name>] [--agent <codex|claude|cursor|opencode|pi>] [--model <model>] [--effort <level>] [--repo <selector>] [--push] [--note-only] [--dry-run] [--json]\nrunpane ask --agent <claude|codex|cursor|opencode> (--prompt \"<question>\" | --prompt-file <path|->) [--model <model>] [--machine <name>] [--repo <selector> | --pane <pane-id>] [--timeout <duration>] [--json]\nrunpane models [--agent <codex|claude|cursor|opencode|pi>] [--search <text>] [--machine <name> | --all] [--json]\nrunpane watch [--follow|--until-event] [--session <id|name>|--pane <id>] [--json] [overrides]\nrunpane panes create --repo <selector> --name <name> --agent <codex|claude|cursor|opencode|pi> [--source user|agent] [--focus|--no-focus] [--base <ref>] [--branch <name>] [--prompt-file <path|->] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] [options] [--pane-dir <path>]\nrunpane panes create --repo <selector> --name <name> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--source user|agent] [--focus|--no-focus] [--base <ref>] [--branch <name>] [--prompt-file <path|->] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] [options] [--pane-dir <path>]\nrunpane panes create --from-json <path|-> [--yes] [--json] [--pane-dir <path>]\nrunpane panes adopt --repo <selector> --path <dir> --name <name> --agent <codex|claude|cursor|opencode|pi> [--resume <id>] [--folder <name>] [--launch [--prompt <text>|--prompt-file <path|->] [--wait-ready] [--ready-timeout-ms <ms>]] [--no-pinned] [--no-associate] [--dry-run] [--yes] [--json] [--pane-dir <path>]\nrunpane panes adopt --repo <selector> --path <dir> --name <name> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--folder <name>] [--launch [--prompt <text>|--prompt-file <path|->] [--wait-ready] [--ready-timeout-ms <ms>]] [--no-pinned] [--no-associate] [--dry-run] [--yes] [--json] [--pane-dir <path>]\nrunpane panes archive --pane <pane-id> [--source user|agent] [--force] [--remove-worktree] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane panes archive --session <id|name> --merged [--closed] [--remove-worktree] [--source user|agent] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane panes pin --pane <pane-id> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes unpin --pane <pane-id> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes pause --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes resume --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes rename --pane <pane-id> --name <new-name> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes focus --pane <pane-id> [--panel <panel-id>] --source user|agent --yes [--json] [--pane-dir <path>]\nrunpane panels create --pane <pane-id> --agent <codex|claude|cursor|opencode|pi> [--source user|agent] [--focus|--no-focus] [--wait-ready] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels create --pane <pane-id> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--title <title>] [--focus|--no-focus] [--wait-ready] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels open [--pane <pane-id>] (--url <url>|--file <path>) [--title <title>] [--split|--tab] [--focus|--no-focus] [--source user|agent] --yes [--json]\nrunpane panels close --panel <panel-id> [--dry-run] [--force] [--source user|agent] --yes [--json] [--pane-dir <path>]\nrunpane panels list --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane panels output --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels screen --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels input --panel <panel-id> (--text <text>|--keys <name,...>|--input-file <path|->) [--source user|agent] --yes [--json] [--pane-dir <path>]\nrunpane panels submit --panel <panel-id> (--text <text>|--input-file <path|->) [--as-file-pointer [--attach <file>]...] [--interrupt] [--source user|agent] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels submit-composer --panel <panel-id> [--strategy auto|codex-ctrl-enter|enter|tab] --yes [--json] [--pane-dir <path>]\nrunpane panels wait --panel <panel-id> [--for initialized|ready|idle|text] [--contains <text>] [--timeout-ms <ms>] [--interval-ms <ms>] [--json] [--pane-dir <path>]\nrunpane panels resume --panel <panel-id> [--wait-ready] [--ready-timeout-ms <ms>] --yes [--json] [--pane-dir <path>]\nrunpane panels resume (--session <id|name>|--all-stopped) [--wait-ready] [--ready-timeout-ms <ms>] [--concurrency <count>] --yes [--json] [--pane-dir <path>]\nrunpane panels pause --panel <panel-id> --yes [--json] [--pane-dir <path>]\nrunpane panels last-message --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels conversation --conversation <id> [--source startup|resume|clear|compact] [--panel <panel-id>] [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane panels conversation --hook [--pane-dir <path>]\nrunpane panes git-status --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane panes commit --pane <pane-id> --message <message> --yes [--json] [--pane-dir <path>]\nrunpane panes push --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes pull --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes rebase-main --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes restore --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes squash-rebase --pane <pane-id> --message <message> --yes [--json] [--pane-dir <path>]\nrunpane panes stash --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes stash-pop --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes soft-reset --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes fetch --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes run-script --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes stop-script --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes move --pane <pane-id> --folder <folder-id> --yes [--json] [--pane-dir <path>]\nrunpane folders list --repo <repo-id> [--json] [--pane-dir <path>]\nrunpane folders create --repo <repo-id> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane links create --pane <pane-id> [--panel <panel-id>] [--json]\nrunpane links create --repo <repo-id> [--json]\nrunpane links create --session <session-id> [--json]\nrunpane links open --url <pane-url> --yes [--json] [--pane-dir <path>]\nrunpane docs search --query <text> [--limit <count>] [--json]\nrunpane docs read --doc <path> [--json]\nrunpane agents start (--pane <pane-id> | --repo <selector> --name <name> [--base-branch <branch>]) (--agent <codex|claude|cursor|opencode|pi>|--tool-command <command>) --prompt <task> --yes [--json] [--pane-dir <path>]\nrunpane agents status (--pane <pane-id>|--panel <panel-id>) [--limit <count>] [--json] [--pane-dir <path>]\nrunpane agents send (--pane <pane-id>|--panel <panel-id>) --text <message> [--as-file-pointer] [--no-expect-report] --yes [--json] [--pane-dir <path>]\nrunpane report --state <ready|blocked|failed|done> [--pr <number>] [--head <sha>] [--summary <text>|--summary-file <path|->] [--question <text>] [--pane <pane-id> --panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane notify --ui <options|approve|ask|info> --title <text> [--context <text>] [--choices <json>] [--questions <json>] [--detail <text>] [--detail-label <text>] [--suggestions <json>] [--action <json>] [--links <json>] [--relays <item>] [--about-session <id|name>] [--json] [--pane-dir <path>]\nrunpane notify --took <id|Q-n> <answer|question> [--status <text>] [--json] [--pane-dir <path>]\nrunpane notify --update <id|Q-n> --asked <text> --what-changed <text> [--title <text>] [--context <text>] [--choices <json>] [--questions <json>] [--links <json>] [--json] [--pane-dir <path>]\nrunpane notify --resume <id> [--json] [--pane-dir <path>]\nrunpane inbox [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane inbox ack <item-id>... [--decision <D-n>] [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane inbox ack --all --session <id|name> [--json] [--pane-dir <path>]\nrunpane autopilot status [--json] [--pane-dir <path>]\nrunpane autopilot waiting [--json] [--pane-dir <path>]\nrunpane autopilot stack [--json] [--pane-dir <path>]\nrunpane autopilot stack push (--item <id> | --file <path> | --url <url> | --session <id|name>) [--title <text>] [--note <text>] [--tab <path-or-url>]... [--next] [--json] [--pane-dir <path>]\nrunpane autopilot answer <id> (--choice <label> | --approve | --deny | --text <text>) [--note <text>] --because <why> [--json] [--pane-dir <path>]\nrunpane autopilot close <id> --reason <why> [--json] [--pane-dir <path>]\nrunpane autopilot rewrite <id> --ui <options|approve|ask> --title <text> [--context <text>] [--choices <json>] [--suggestions <json>] [--links <json>] [--json] [--pane-dir <path>]\nrunpane sessions list [--json] [--pane-dir <path>]\nrunpane sessions create --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions get --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions update --session <id|name> --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions set-agent --session <id|name> --agent <codex|claude|cursor|opencode|pi> [--json] [--pane-dir <path>]\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane sessions detach --session <id|name> [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane sessions overview --session <id|name> [--json] [--pane-dir <path>]\nrunpane lock acquire --name <name> --ttl <duration> [--wait <milliseconds>] [--note <text>] [--pane <pane-id>] [--panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane lock release --name <name> [--force] [--session <id|name>] [--note <text>] [--pane <pane-id>] [--panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane lock list [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane sessions unpin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions pin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions pause --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions resume --session <id|name> [--json] [--pane-dir <path>]\nrunpane pr watch [--pane <id>] --url <PR URL> [--head <full-sha>] [--json] [--pane-dir <path>]\nrunpane pr unwatch [--pane <id>] --url <PR URL> [--json] [--pane-dir <path>]\nrunpane pr list [--pane <id>] [--json] [--pane-dir <path>]\nrunpane loops list [--json] [--pane-dir <path>]\nrunpane loops create (--repo <selector>|--session <id|name|new>) --name <name> --cron <expr> (--agent <claude|codex|cursor>|--tool-command <command>) [--prompt <text>|--prompt-file <path|->] [--worktree-name <template>] [--paused] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane loops update --loop <id> [--repo <selector>|--session <id|name|new>] [--name <name>] [--cron <expr>] [--agent <claude|codex|cursor>|--tool-command <command>] [--prompt <text>|--prompt-file <path|->] [--worktree-name <template>] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane loops run --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops pause --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops resume --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops delete --loop <id> --yes [--json] [--pane-dir <path>]\n```\n\n## Agent Context\n\nPane runs coding agents in parallel git worktrees. A Pane is a visible workspace for one feature or PR, with its own Pane-managed git worktree and branch; a panel is a terminal tab in a Pane and shares its worktree; an agent is a CLI process running in a panel.\n\nDoctor-first environment discovery:\n\n```bash\nrunpane doctor --json\n```\n\nBrief CLI context:\n\n```bash\nrunpane agent-context\nrunpane agent-context --json\n```\n\nDetailed command discovery:\n\n```bash\nrunpane agent-context --command <command> [--json]\n```\n\nBrief tools:\n\n- `doctor`: Report wrapper, platform, installed Pane, and daemon reachability before an agent mutates Pane state.\n- `agent-context`: Print token-efficient Pane command context for coding agents.\n- `agents doctor`: Check whether Codex or Claude is available in the repo environment Pane will use.\n- `repos list`: List repositories saved in the running Pane app.\n- `repos add`: Register an existing git repository with the running Pane app.\n- `repos get`: Show a saved repository's Project Settings and the scripts Pane will run.\n- `repos update`: Change a saved repository's Project Settings: scripts, worktree folder, name, IDE command, system prompt, and environment variables.\n- `repos rename`: Rename a repository saved in the running Pane app.\n- `secrets list`: List Pane secrets: project, name, time and machine. Never a value.\n- `secrets exec`: Run a command with Pane secrets in its environment.\n- `secrets request`: Ask the person for a secret on a masked card; returns saved or declined, never the value.\n- `panes list`: List Pane sessions, optionally scoped to a saved repository.\n- `panes cost`: Report estimated token cost per Pane, with per-model breakdown and cache efficiency.\n- `panes create`: Create a Pane (a new worktree) only when the work's branch has no Pane yet; for review, audit, fix or QA on existing work use `panels create --pane <id>`.\n- `panes archive`: Archive a Pane exactly like the UI Archive action, including safe removal of its Pane-managed git worktree, or archive every merged Pane in a Session.\n- `panes pin`: Declaratively pin a Pane (the Pane UI's favorite/pin star) without changing focus.\n- `panes unpin`: Declaratively unpin a Pane (the Pane UI's favorite/pin star) without changing focus.\n- `panes rename`: Rename a Pane without changing its worktree, branch, panels, or focus.\n- `panes focus`: Raise the Pane window and select a Pane (and optionally a panel) on explicit user request.\n- `panels create`: Open reviewer, QA, fix or helper agent tabs inside an existing Pane; they share that Pane's worktree. The default for any later agent on existing work.\n- `panels open`: Show the user an HTML page, plan, report, dev server URL, or file as a tab in split view beside the agent.\n- `panels close`: Close a tab an agent opened once it no longer matters; refuses the person's tabs, busy agents and unsent input.\n- `panels list`: List tool panels inside a Pane session.\n- `panels output`: Read recent terminal output from a panel.\n- `panels screen`: Read a compact current-screen view from a terminal panel.\n- `panels input`: Send input bytes to a terminal panel.\n- `panels submit`: Send text plus terminal Enter to a terminal panel.\n- `panels submit-composer`: Submit an agent composer with the key for its current state.\n- `panels wait`: Wait for terminal initialized, ready, idle, or text state with compact output.\n- `panels resume`: Restart a stopped terminal panel in place (same panel id), resuming its agent's conversation.\n- `watch`: Wait for workspace events from the durable daemon journal; follow uses conservative cadence and quiet expiry by default.\n- `notify`: Ask the person a question wherever they are and wait for the answer; prefer it to asking in the terminal.\n\nManaged AGENTS.md block body:\n\n```md\n## Pane\n\nThis repository is used with [Pane](https://runpane.com). Drive it with the CLI or the `pane` MCP server.\n\nPane: one per feature (one worktree, one branch). Before creating one, find the feature's Pane (`runpane panes list --json`, match the branch) and create one only when none exists. Tab: reviews, review reruns, QA, fixes and follow-ups for a feature go in new tabs in its Pane (`runpane panels create --pane <id>`), never a new Pane or a plain `git worktree`. With the MCP tools, open a tab with `panels_create`, or `agents_start` with `pane`.\n\nWhen you need the person (a choice, an approval, a short answer), call the `notify` MCP tool (or `runpane notify`) instead of asking in the terminal. If it returns `waiting`, call it again with `resume`; if it returns `unavailable`, ask in the terminal. Claude's own card (AskUserQuestion) is only for a quick question in the chat the person is typing in, about their latest message, that steers only this turn; everything else is an approval card, and Codex and other agents always use one. A worker in a Pane Session (`PANE_SESSION_DIR` set, `PANE_ORCHESTRATION_SESSION_ID` unset) doesn't call `notify`: it reports blocked to its orchestrator with `runpane report --state blocked --question \"<question>\"`. Its orchestrator relays that card with `runpane notify --relays <item> ...`, the answer goes straight to the worker's tab, and the orchestrator records it with `runpane inbox ack <item> --decision <D-n>`. For an API key, token or password, call `secrets_request` (or `runpane secrets request`), never `ask`; if that returns `unavailable`, ask the person to save it in Pane under Settings > Secrets.\n\nCLI: `npm i -g runpane` (or `npx --yes runpane@latest`), then `runpane doctor --json`. Full command reference: `runpane agent-context --json`.\n\nDevices: the `device_*` MCP tools (or `runpane devices`) open an iOS simulator or Android emulator as a tab in the calling Pane, then drive it. `runpane docs read --doc docs/DEVICES.md` has the rest.\n\nMCP: packaged Pane registers a stdio server named `pane` with Claude Code, Codex, and Cursor. Check the connection with `claude mcp list`, `codex mcp list`, or `agent mcp list`. Cursor may ask you to enable `pane` with `agent mcp enable pane`. If tools are missing, add it in the agent's MCP settings: Claude Code `claude mcp add --scope user pane -- npx --yes runpane@latest mcp`; Codex (`~/.codex/config.toml`) table `[mcp_servers.pane]` with `command = \"npx\"` and `args = [\"--yes\", \"runpane@latest\", \"mcp\"]`; Cursor (`~/.cursor/mcp.json`) uses `mcpServers.pane` with the same `npx` command and args; any other stdio client uses them too.\n```\n\n## Wrapper Flags\n\nThese flags are consumed by the wrapper:\n\n```bash\n--version <latest|vX.Y.Z>\n--download-dir <path>\n--pane-path <path>\n--format <auto|appimage|deb|dmg|zip|exe>\n--dry-run\n--yes (aliases: -y)\n--verbose\n```\n\nThe top-level `runpane --version` form prints the wrapper version. The install subcommand form `runpane install --version vX.Y.Z` selects a Pane release.\n\n## Local Control Flags\n\nThese flags are consumed by local daemon-control commands:\n\n```bash\n--pane-dir <path>\n--repo <selector>\n--pane <pane-id>\n--panel <panel-id>\n--path <path>\n--name <name>\n--worktree-name <name>\n--branch <name>\n--base-branch <ref> (aliases: --base)\n--folder <name>\n--resume <agent-session-id>\n--agent <codex|claude|cursor|opencode|pi>\n--tool-command <command>\n--title <title>\n--url <url>\n--file <path>\n--initial-input <text> (aliases: --prompt)\n--initial-input-file <path|-> (aliases: --prompt-file)\n--attach <file>\n--from-json <path|->\n--timeout-ms <milliseconds>\n--ready-timeout-ms <milliseconds>\n--concurrency <count>\n--limit <count>\n--for <initialized|ready|idle|text>\n--contains <text>\n--interval-ms <milliseconds>\n--text <text>\n--input-file <path|->\n--source <user|agent>\n--strategy <auto|codex-ctrl-enter|enter|tab>\n--as <consumer-name>\n--since <generation>\n--from <now|earliest>\n--kinds <kind,...>\n--name-contains <text>\n--exclude-pane <pane-id>\n--heartbeat <duration>\n--idle-after <duration>\n--expire-after <duration>\n--ready-settle <duration>\n--blocked-settle <duration>\n--min-interval <duration>\n--body-file <path|->\n--session <id|name>\n--ttl <duration>\n--wait <milliseconds>\n--timeout <duration>\n--note <text>\n--loop <id>\n--cron <expr>\n--message <message>\n--query <text>\n--doc <path>\n--toolsets <name,...>\n--keys <name,...>\n--state <ready|blocked|failed|done>\n--pr <number>\n--head <sha>\n--summary <text>\n--summary-file <path|->\n--question <text>\n--conversation <id>\n--cwd <path>\n--note-file <path|->\n--machine <name>\n--model <model>\n--effort <level>\n--build-script <script>\n--run-script <script>\n--archive-script <script>\n--worktree-folder <path>\n--open-ide-command <command>\n--system-prompt <text>\n--clear <setting,...>\n--env <VAR=NAME|json>\n--env-remove <name,...>\n--project <project>\n--only <name,...>\n--reason <text>\n--epoch <epoch>\n--ui <options|approve|ask|info>\n--context <text>\n--choices <json>\n--detail <text>\n--detail-label <text>\n--suggestions <json>\n--action <json>\n--links <json>\n--content <text>\n--agent-farm <profile>\n--arg <key=value>\n--item <id>\n--relays <item>\n--about-session <id|name>\n--questions <json>\n--took <id|Q-n>\n--took-as <answer|question>\n--status <text>\n--update <id|Q-n>\n--asked <text>\n--what-changed <text>\n--decision <D-n>\n--choice <label>\n--because <why>\n--colors <json>\n--css <text>\n--theme <id>\n--search <text>\n--platform <ios|android>\n--device <name-or-id>\n--wait-ms <milliseconds>\n--json\n--wait-ready\n--no-focus\n--focus\n--split\n--tab\n--pinned\n--no-pinned\n--no-associate\n--force\n--remove-worktree\n--merged\n--closed\n--launch\n--as-file-pointer\n--follow\n--until-event\n--ack-now\n--include-held-input\n--all-stopped\n--include-shells\n--no-held-input\n--self-test\n--report\n--fix\n--read-only\n--template\n--push\n--note-only\n--interrupt\n--expect-report\n--no-expect-report\n--all\n--paused\n--chat\n--next\n--approve\n--deny\n--hook\n--background\n--idle\n```\n\n`runpane doctor --json`, `runpane repos list`, `runpane panes ...`, and `runpane panels ...` commands use or describe the local framed daemon socket/pipe for a running Pane app. `--pane-dir` points the wrapper at a non-default Pane data directory, such as `PANE_DIR=~/.pane_test` in development. `runpane agent-context` is local/offline and can be used before Pane is running. `agent-context` and `version` accept and ignore `--pane-dir`, so one `--pane-dir` can be passed to every runpane command. In a Pane repository checkout, if `runpane` is not on PATH, build the local wrapper with `pnpm --filter runpane build` and run it with patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x), for example `node packages/runpane/dist/cli.js doctor --json`. From WSL, if the user runs Windows Pane, use Pane's own `runpane` (on PATH in Pane's WSL terminals, or `/mnt/c/Users/<you>/.pane/bin/runpane`), which reaches the Windows named-pipe daemon through WSL interop; older Pane builds need `powershell.exe -NoProfile -Command 'Set-Location $env:TEMP; runpane ...'`.\n\n## Daemon Passthrough Flags\n\n`runpane install daemon` forwards these flags to `pane --remote-setup`:\n\n```bash\n--label <name>\n--prefer-tunnel <tailscale|ssh|manual|auto>\n--channel <stable|nightly>\n--base-url <url>\n--pane-dir <path>\n--listen-port <port>\n--port <port>\n--repo-ref <ref>\n--auto-listen-port\n--interactive-tailscale-setup\n--no-install-service\n--no-tailscale-serve\n--print-only\n```\n\nUnknown daemon flags should be forwarded rather than dropped so newer Pane versions can extend `--remote-setup` without requiring an immediate wrapper release. Unknown flags for non-daemon commands should fail clearly.\n\n## Machine-Readable Schemas\n\nStable `--json` response schemas live in `contracts/runpane/contract.json` under `jsonSchemas`.\n\nA failed command exits 1 and prints its message and a `Next:` line to stderr. With `--json` it also prints `jsonSchemas.error` to stdout: `{ \"ok\": false, \"error\": { \"code\": \"...\", \"message\": \"...\", \"next\": \"...\" } }`. Branch on `code`; `next` is the step to take when one is known. A command whose result has its own `ok: false` shape, such as an archive refusal or `panels last-message` without a transcript, prints that result instead, and `watch` reports failures as WATCH ERROR lines with exit 2.\n\nOpenAPI should be generated later from the stable local HTTP/API subset of the same contract, not maintained as a second source of truth.\n\n## Download Attribution\n\nThe npm package uses `source=npm` for all npm-registry consumers, including `npx`, `pnpm dlx`, `yarn dlx`, `bunx`, and global npm/pnpm installs.\nThe PyPI package uses `source=pip` for all Python consumers, including pip, pipx, uvx, and `python -m runpane`.\nWrappers should prefer `https://runpane.com/api/download?platform=<platform>&arch=<arch>&format=<format>&version=<version>&channel=<channel>&source=<npm|pip>`.\nIf the website route cannot satisfy the download, wrappers may fall back to the matching GitHub release asset and print a warning that website attribution may be incomplete for that run.\nWrappers emit best-effort telemetry to `https://runpane.com/api/runpane/telemetry` for command failures, download request/success/failure, and GitHub fallback usage. Routine command starts and successes emit nothing. A command failure is a thrown error, or a non-zero exit from `install` or `update` (also when setup runs them); other exit codes are documented results (such as `panels wait` not ready or `doctor` findings) and emit nothing. Polling and status commands (`panes list`, `panels wait`, `watch`, `panes archive`, `workspace state`, `agents status`, `doctor`) emit no failure events, and neither does a `not_found` failure outside `install` and `update`. A failure event carries the command, `failure_stage`, `failure_category`, `exit_code` when known, and `error_code` (the code printed in the `--json` error). Both wrappers share a per-install limit in `<PANE_DIR>/runpane-wrapper-telemetry.json`: one failure event per cause per hour and at most 10 per hour.\nWrapper telemetry uses a persisted anonymous `install_id` in the form `install_<uuid>` and PostHog `distinct_id = install:<install_id>` so installs reporting failures or downloads can be counted with `count(DISTINCT properties.install_id)`; this is not a count of all CLI users.\nWrapper telemetry must be disabled in CI (`CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`, `CIRCLECI`, `TF_BUILD`, `JENKINS_URL`, `TEAMCITY_VERSION` or `CODEBUILD_BUILD_ID` set), when `DO_NOT_TRACK=1` or `RUNPANE_TELEMETRY_DISABLED` is set, and when the local config explicitly disables analytics. It must not include raw paths, labels, prompts, raw error text, or environment values.\nDesktop local control reports useful failures as `runpane_local_control_failed`; normal polling, wait deadlines, and optional agent unavailability emit nothing. Reports contain coarse operation and failure classification only, with a five-minute deduplication interval and a maximum of 20 per hour per app process. Handled CLI failures are ordinary events, not exceptions.\n\n## Publishing Credentials\n\nLocal implementation, build, and dry-run validation do not need npm or PyPI API tokens.\nRelease publishing should prefer npm Trusted Publishing and PyPI Trusted Publishing from GitHub Actions.\nFallback `NPM_TOKEN` or `PYPI_API_TOKEN` credentials may be used for first package reservation or manual publication only. They must be supplied through local environment variables or GitHub Actions secrets, never committed, and revoked or rotated after use.\n"},{"path":"docs/RUNPANE_WORKSPACES.md","title":"Workspaces: reach all your machines with runpane","text":"# Workspaces: reach all your machines with runpane\n\n`runpane workspace` lets your Macs, Windows PCs, and Linux machines read files, write files, run commands, and drive each other's Pane over the Tailscale network you already use, or over any route of a computer saved in Pane, such as one linked with a [one-time link](QR_PAIRING.md#link-another-computer). On Tailscale each request is trusted because Tailscale says which login it comes from, and a linked computer is trusted by the token it got when the two were linked. Your own login is always let in; a teammate's machine lets you in when its owner shares it with everyone on the tailnet.\n\nThe same listener powers codeless desktop remote mode: the sidebar's machine menu and Settings › Remote Access › **Computers** list the machines on your tailnet, including ones you have never connected to (a teammate's machine that accepts only its owner shows as \"Owner only\" and can't be picked), and picking one switches the desktop app to that machine with no `pane-remote://` code. A computer that is both on your tailnet and saved in Pane shows once, with a pill for each route. `runpane workspace` reaches the same machines. Who may connect is set under Settings › Remote Access › **Tailscale** › **Who can connect** (see [Who is trusted](#who-is-trusted)).\n\n**All machines**, the first item in the machine menu, fills the sidebar with the Sessions and Panes of this computer and every saved machine, live, each row marked with its machine. A repository on several machines shows as one project row, with a mark for each machine it is on: each host reads its projects' origin remote (`host/owner/repo`, so SSH and HTTPS clones match, whatever the folder is called), and a fork with a different origin is its own row. A project with no origin, or from a machine on an older Pane, joins a row by name. Opening a row on another machine switches the app to that machine and keeps the sidebar in All machines; pin, pause, resume, archive, rename and permission answers from a row's menu run on its machine without switching, and **Allow** first shows the request in the permission dialog. Archived and the collapsed sidebar show the machine you're on. Search covers every machine's rows. A machine that stops answering keeps its rows, dimmed, with when it went offline and **Retry**. Rows keep the order you give them: drag a Session (across machines) or a Pane (within its project), or move a focused row with Alt+Up/Down, and the arrangement is saved on this computer only, never on the machines it shows. The first time a machine answers, its rows join in that machine's own order, placed by the machine menu however late it answers; Sessions and Panes that appear after that go first, and agent status never moves a row. Projects and Sessions start closed; what you open and close is remembered on this computer. Picking one machine returns to its own sidebar, and the choice is kept across relaunch.\n\n```\nrunpane workspace list\nrunpane workspace <machine> read <path>\nrunpane workspace <machine> write <path> # content from stdin, or --content <text>\nrunpane workspace <machine> exec -- <command> # runs in that machine's shell\nrunpane workspace <machine> <runpane command> # e.g. sessions list --json\n```\n\n`<machine>` is the Tailscale machine name (`parsa-devbox`), a unique prefix (`devbox`), the MagicDNS name, or a Tailscale IP. A computer saved in Pane also answers to its name in lower case with dashes (`travel-laptop`), its Pane id, its install id, its relay id (the `<id>` in its `<id>.runpane.net` address) and the host name of any of its routes. `runpane workspace list --json` shows them under `ids`.\n\nEach computer is one entry. A computer saved in Pane is matched with its tailnet entry by its Tailscale route, or else by a name no other saved computer has, so two computers with the same name stay two entries. runpane reaches it on its routes in the order Pane saved them, adding Tailscale when the computer is on your tailnet without a saved Tailscale route. A route that doesn't connect within 2.5 seconds (1.5 seconds on the same network, and a same-network address is tried only when it is on one of this computer's subnets), whose Pane isn't running, or that refuses the credential gives way to the next. A request that reached a Pane never goes to a second route, so nothing runs twice. When the tailnet says the computer is offline (Tailscale signed out there), Tailscale is tried last. A saved computer works with Tailscale off.\n\n`runpane workspace list` shows your own machines first, then other people's machines on the tailnet labeled with their owner's login (`tylers-mac-mini (macOS, online, owner tbrownio@github)`). A saved computer lists its routes and the one that answered (`parsa-devbox (Windows, online) [Tailscale, Pane relay]: joined through Pane relay, shell bash`). Each machine decides who it lets in. A machine set to \"Only me\" refuses other logins, and the error says how its owner can change that. A path shaped like another OS's (`C:\\...` on a Mac) routes only to your own machines; reach someone else's machine by name.\n\nAgents can call them as MCP tools too: `workspace_list`, `workspace_read`, `workspace_write`, and `workspace_exec` are in the [Pane MCP server](PANE_MCP.md#toolsets)'s default toolset. `workspace_write` requires `content`, since a tool call has no stdin, and file contents and command output come back exactly as the CLI's `--json` prints them.\n\n## Link a computer from the command line\n\n`runpane link '<link>'` links this computer with the one that made a [one-time link](QR_PAIRING.md#link-another-computer), for a computer with no screen. Copy the link on the other computer (**Add a device › Computer**). Pane must be running here with phone access on. When both computers already have linked computers, it names both groups and asks before joining them; in a script or with `--json`, pass `--yes`, or it exits with `ERR_LINK_NEEDS_CONFIRM` and leaves the link unused. Then `runpane workspace list` shows the new computer.\n\nThese commands ship in the npm CLI (`npm i -g runpane`, or `npx --yes runpane@latest workspace list`). The Python package prints the workspaces status block but does not run them.\n\n`workspace <machine> <runpane command>` runs any command that talks to Pane, such as `sessions list`, `panes list`, or `workspace state`, against that machine's Pane. Commands that only make sense on the machine you type them on (`doctor`, `agent-context`, `mcp`, `docs`, `install`) are refused with the alternative: run them there with `runpane workspace <machine> exec -- 'runpane doctor'`.\n\n## Turning it on\n\nWorkspaces are on by default. When Tailscale is installed and signed in, the desktop Pane that owns `~/.pane` joins your tailnet as it starts:\n\n- It listens on `127.0.0.1` on a free port.\n- It runs `tailscale serve --bg --https=8443 http://127.0.0.1:<port>`, next to the remote daemon's port 443 handler if you have one.\n- Nothing is opened to the public internet, and no firewall rule is added. Serve is reachable only inside your tailnet.\n\nEvery `runpane --help`, `runpane doctor`, and `runpane agent-context` prints the current state:\n\n```\nWorkspaces: on (parsas-macbook-pro)\nOther machines: parsa-devbox (Windows, online), parsas-macbook-air (macOS, offline)\nReach them: runpane workspace <machine> read|write|exec|<command>\n```\n\nWhen workspaces are off, the first line says why and gives the one step that fixes it:\n\n| Reason | Fix |\n|---|---|\n| Tailscale is not installed | Install Tailscale from https://tailscale.com/download and sign in. |\n| Tailscale is signed out | Open Tailscale and sign in. |\n| This tailnet has HTTPS certificates turned off | Turn on HTTPS Certificates at https://login.tailscale.com/admin/dns. |\n| Pane is not running | Open Pane. |\n| Turned off with `runpane workspace disable` | `runpane workspace enable` |\n\nWhile the tailnet has HTTPS Certificates turned off, the desktop app shows a notice with a link to that setting. Turning it on writes machine names (`<machine>.<tailnet>.ts.net`) to the public Certificate Transparency log. The notice clears within a minute of the change, and `runpane workspace list` names the setting as the reason other machines are not reachable.\n\n`runpane workspace disable` removes the 8443 handler and keeps this machine off until `runpane workspace enable`. This machine can still reach your other machines while it is off. A Pane started with a different data directory (`PANE_DIR` or `--pane-dir`) stays off unless you run `runpane workspace enable` against it.\n\nPane must be running on a machine for others to reach it. Pane checks Tailscale again every minute, so signing in to Tailscale after Pane starts is enough. Serve handlers belong to one tailnet, so after you switch this machine to another tailnet Pane puts the 8443 handler back on the new one and reports the new URL within a minute.\n\n## Who is trusted\n\nTwo settings decide, in the **Access** group of Settings › Remote Access › **Tailscale**. Every request must pass both: its login is allowed by **visibility**, and, when **password protection** is on, it carries the password.\n\n| Visibility | Who can connect | |\n|---|---|---|\n| Off | Nobody without a pairing code. Same as `runpane workspace disable`. | |\n| Only me | Devices signed into this machine's own Tailscale login. | Default |\n| Everyone on tailnet | Anyone with an untagged device in the current tailnet. Pane warns before turning it on. | |\n\nPane learns the owner from the `Self` entry in `tailscale status --json`, and Serve adds a `Tailscale-User-Login` header to every request after removing any copy the caller sent. Under \"Everyone on tailnet\", the people on the tailnet are the owners of its untagged devices, re-read every minute; people a device was shared with from another tailnet (Tailscale's sharee nodes) are not among them, even though Serve signs their requests too.\n\nPassword protection is off by default. When it is on, every client must send the password, your own machines included; the desktop app asks for it once and saves it with that machine's connection. Pane stores only a scrypt hash of it, and only someone at the machine itself can change visibility or the password: remote clients are refused. `runpane workspace` sends the password the desktop app saved for that computer. To reach a password-protected machine from the CLI, connect to it once from Settings › Remote Access › Computers and enter the password.\n\n- Under \"Only me\", a device signed in as another Tailscale user, including a teammate's Mac shared into your tailnet, is refused.\n- A tagged device is refused: Serve sends no identity for it.\n- Pane answers only requests that arrive through Serve: Serve's target path carries a secret that changes every launch, and requests straight to the loopback port are refused. Another OS user on the same machine who can read `tailscale serve status` could learn it, so give other accounts on a joined machine only the trust you would give the owner.\n- Browsers are refused. A web page open on one of your devices could otherwise send requests that Serve signs with your login. Pane refuses any request that carries a browser `Origin`; the phone app's WebSockets, which always carry one, send a fixed value no browser can. The one exception is the Pane glasses app for Even G2: it needs your Tailscale login, a per-device glasses token, and the Even app's origin (built in) or one you allowed, and it reaches only the commands the glasses use. See [Even G2 glasses](EVEN_G2_GLASSES.md#security).\n- Integration keys are shared only with the owner's login, even under \"Everyone on tailnet\". See [Shared integration keys](SHARED_CREDENTIALS.md).\n- A teammate's `exec` commands and terminals run as you and can reach every Pane secret, and each synced host keeps a copy, so \"Everyone on tailnet\" on any one host exposes them all. Pane refuses only their direct secret requests (secret cards, secret variables, shared key sync). See [Who can read a secret](PANE_SECRETS.md#who-can-read-a-secret).\n- Any device signed in as you, your phone included, is trusted. `runpane workspace list` shows only Macs, Windows PCs, and Linux machines, but that is a listing choice, not a block.\n- Removing a device from Tailscale revokes it everywhere.\n- The same setting decides who opens the host's dev servers and HTML pages in the Remote Pane app's browser tabs, at their `https://<host>.ts.net:<n>` addresses. A page in a frame cannot send the password, so those pages are off while password protection is on. See [Browser tabs on the phone](SELF_HOSTED_REMOTE_DAEMON.md#browser-tabs-on-the-phone).\n\n## What `write` and `exec` can do\n\nEvery admitted login can also reach any port listening on the machine from desktop Pane, as [forwarded ports](SELF_HOSTED_REMOTE_DAEMON.md#forwarded-ports).\n\n`write` and `exec` give your agents SSH-level control of every joined machine, and so does anyone the machine's visibility lets in: under \"Everyone on tailnet\" that includes the other people on the tailnet. A local agent's permission prompts and sandbox see only `runpane workspace ... exec`, not what runs on the other machine. Turn workspaces off on any machine that should not accept this.\n\n## Workers on another machine join your Session\n\nA Session orchestrator on this computer can run workers on your other machines. `runpane workspace parsa-devbox panes create --repo \"Pane (win)\" --tool-command \"codex -m gpt-5.5\" --prompt \"...\" --json`, run from inside a Session, creates the Pane on that machine and adds it to this computer's Session; `association.machine` names the machine. Pick a saved WSL repository there to run the worker in WSL. Its `runpane report` states, blocked questions and tab exits reach this computer's `runpane watch --session`, Approvals and phone, and an answer you give goes back to its tab. `sessions overview` and the Session's Overview tab list it with its machine; a machine that doesn't answer shows its workers as unreachable.\n\nThe machine must be saved on this computer (the machine switcher > **Add a machine**): only saved machines send their workers' reports here, over the connection All machines already uses. Creating a Pane on an unsaved machine still works and returns `association.ok: false` with `ERR_MACHINE_NOT_SAVED`. Both machines need a Pane release with remote Session members; a machine on an older one returns `association.code: ERR_MACHINE_OLDER_PANE`, and its row says to update it. Reports sent while either computer was asleep or offline arrive when they reconnect, once each and in order.\n\n## Ask another model a question\n\n`runpane ask` asks any agent and model one read-only question and prints the answer. Nothing is left open: the agent's own headless mode runs once and exits.\n\n```bash\nrunpane ask --agent claude --model sonnet --prompt \"Is this migration safe to run twice?\" --repo Pane --json\nrunpane ask --agent codex --machine parsa-devbox --repo \"Pane (win)\" --prompt \"Why does this test fail on Windows?\"\nrunpane ask --agent opencode --model openrouter/deepseek/deepseek-chat --machine parsa-devbox --repo \"experiments (wsl)\" --prompt-file question.md\n```\n\n`--machine` runs it on another machine in your workspace, `--repo` in a saved repository there (a WSL repository runs in WSL) and `--pane` in a Pane's worktree. The agent can read files but not edit them, run shell commands or call MCP tools: Claude runs with only Read, Grep and Glob, Codex in its read-only sandbox without your Codex config, MCP servers or apps, Cursor in ask mode, and OpenCode's plan agent with edit, bash and every MCP tool denied. Pi has no such mode, so ask refuses it. `--json` prints the answer, agent, model, machine, environment, duration and cost when the agent reports one. A missing agent, a sign-in problem, an unknown model and a timeout (`--timeout`, 10 minutes by default) each fail with the agent's own words and what to do next. The MCP tool is `agents_ask`.\n\n`runpane models` lists the models each installed agent offers, from the agent's own list, with its sign-in in the agent's words. `--all` covers this computer, every saved machine and the WSL of each machine with a saved WSL repository; `--agent` and `--search` narrow it. Claude has no list command and takes `fable`, `opus`, `sonnet`, `haiku` or a full model name. To give a terminal worker a model, put the agent's model flag in `--tool-command`.\n\n## Hand a task to another machine\n\n`runpane handoff` uses workspaces to move a task to an agent on another of your machines. The sending agent writes a handoff note; the CLI checks it, makes sure the branch is pushed, and starts the agent there. When the sender is a Pane tab running Claude, Codex or Cursor and the receiver is the same agent, the agent's own session moves too:\n\n```\nrunpane handoff --template > ~/handoff.md # fill in every section\nrunpane handoff \"claude opus on parsas-macbook-pro\" --note-file ~/handoff.md --push\n```\n\nThe destination machine needs Pane running, the repository saved in Pane with a remote for the same GitHub repository, and its own `runpane` on PATH (otherwise it uses `npx runpane@latest`). The note lands in that machine's `~/.pane/handoffs/`, the agent starts in a new Pane branched from your branch, and it reports back to your panel with `runpane workspace <your machine> panels submit`. For a same-agent handoff the session's files are copied into that machine's agent store (`~/.claude`, `~/.codex` or `~/.cursor`, at their default locations), the receiver resumes that session with no prompt, and the CLI checks it continued before telling it where the session moved. The result is `continued`, `inconclusive` (ask the receiver what it was last working on), or `not-continued` (exit 1; the receiver is kept, and `--note-only` starts a fresh agent with the note if you choose). `--note-only`, a different agent, or no session to carry starts a fresh agent with the note. Carrying a Cursor chat to another machine is best effort; on the same machine it is not carried, since a copied Cursor chat still writes to the original. A copy already on the destination is replaced only when yours holds all of it and no agent there runs it; otherwise nothing is copied and the result is `not-continued`. A destination Pane too old to resume a carried session is refused before anything is sent. The note's sections are in the `handoff` skill's [note template](../main/src/services/paneChatBundle/skills/handoff/references/note-template.md).\n\nRun from a Session's terminal, whose folder is outside git, handoff moves the Session instead (the Session menu's **Move to machine…** asks the Session's agent to do this). It skips the git steps and pushes nothing, writes the note to the other machine's `~/.pane/handoffs/` the same way, and creates a Session there with the same name, goal and agent, whose next action is to read the note. With the same agent, the Session's agent session is copied there too and the new Session resumes that conversation when you first open it; the CLI can't check it until then, so it reports `inconclusive` and says what to check. The destination needs only Pane running with workspaces; no repository has to be saved there. The new Session waits for your first message, and the original stays where it is. A Session can't be handed off to the machine it is on. See [Move a Session to another machine](SESSIONS.md#move-a-session-to-another-machine).\n\n## Paths across Windows, WSL, and macOS\n\n`read`, `write`, and `exec --cwd` take any path form and translate it on the machine that runs the request, so agents do not need `cat` on one machine and `Get-Content` on another:\n\n- `C:\\Users\\me\\notes.md` and `/mnt/c/Users/me/notes.md` reach the same Windows file.\n- On Windows, WSL paths such as `/home/me/repo/README.md` are read through `\\\\wsl.localhost\\<distro>\\...` using the default distribution (the one `wsl -l -v` marks with `*`). Name another distribution with `\\\\wsl.localhost\\<distro>\\...`.\n- Inside WSL, `C:\\...` becomes `/mnt/c/...`, and runpane reads the tailnet from Windows' `tailscale.exe`.\n- `~` is the home directory of the machine that runs the request.\n\n`read` prints the file to stdout (`--json` returns `content` with `encoding` `utf8` or `base64`) and lists a directory's entries. `write` writes `--content <text>` or else stdin, creates missing parent folders, and replaces the file. `exec` runs in the shell Pane uses for terminals there (Git Bash or PowerShell on Windows, your default shell elsewhere), prints its stdout and stderr, ends with a line naming the machine, OS, shell, and exit code, and exits with the command's exit code. `--json` returns all of these fields. Pass the command as one quoted string (`exec -- 'grep \"a b\" notes.md'`): several words after `--` are joined with spaces. Without `--` (PowerShell drops it before npm's `runpane.ps1` sees it), the command starts at the first word that is not an exec option. That machine's own `runpane` comes first on `PATH`, so `exec -- 'runpane version'` works even where its user `PATH` lacks `~/.pane/bin`. A command that starts a background job returns when the shell exits, and `--timeout-ms` stops the whole process tree. If that tree cannot be stopped, the result says so (`stillRunning` in `--json`, \"may still be running\" in text).\n\n## Without a machine name\n\nWith no `<machine>`, `read`, `write`, and `exec --cwd` route a path that cannot exist on this machine to the one joined machine it fits. `C:\\...` on a Mac goes to your Windows machine; if several fit, runpane lists them and asks for a name. Any other path is this machine's: `read` and `write` hand it to this machine's Pane, so it follows the same rules as a named machine (`~`, directories, new parent folders), and Pane must be running here.\n\nOther commands help in the same way. When a file such as a `--from-json` or `--prompt-file` path is missing and looks like another machine's path, the error names the likely machine and the exact `runpane workspace <machine> read` command. When a Session is not found here, runpane checks your other online machines and names the one that has it.\n\n## Workspaces and pairing codes\n\nWorkspaces and the [self-hosted remote daemon](SELF_HOSTED_REMOTE_DAEMON.md) both use Tailscale Serve, for different jobs:\n\n| | Workspaces | Pairing codes (remote daemon) |\n|---|---|---|\n| For | Your own machines (runpane CLI and desktop remote mode), or your tailnet when you choose | Browsers, phones, and devices on another Tailscale account |\n| Trust | Tailscale login, by visibility, plus an optional password | A `pane-remote://` code per device |\n| Serves | The desktop Pane's `~/.pane` | The remote daemon's data directory, usually `~/.pane_remote` |\n| Port | 8443 | 443 |\n| Setup | None | `runpane setup` on the host, then paste the code |\n\nOn the workspace listener (port 8443), machine commands (`read`, `write`, `exec`) run for every request Pane admits there. On the other listeners they run only for a linked computer's token, never for a phone's or a `pane-remote://` code's token. On Pane relay and same-network routes, `runpane workspace` checks the computer's key before it sends the token.\n\n## Troubleshooting\n\n- When **Connect** fails, the desktop app shows a checklist naming the stage that failed and its fix; see [When a connection fails](SELF_HOSTED_REMOTE_DAEMON.md#when-a-connection-fails).\n- `runpane workspace list` shows each machine's state. \"Pane is not answering there\" means Pane is not running on that machine, its workspaces are off, or it runs a Pane version without workspaces.\n- `tailscale serve status` should list `https://<machine>.<tailnet>.ts.net:8443` proxying to `http://127.0.0.1:<port>`.\n- A Pane older than workspaces reports `Workspaces: off ... (this Pane is older than workspaces)`; update Pane.\n"},{"path":"docs/SELF_HOSTED_RELAY.md","title":"Run your own relay","text":"# Run your own relay\n\nPane's relay gives each of your computers an https address that works from\nany network, so phones, browsers and other computers reach them from\nanywhere. Run your own and your computers use your domain and your machine\ninstead of Pane's servers. Everything works the same: pairing, terminals,\npreviews, alerts, linked computers and direct paths. The relay is one\nopen-source binary, `pane-relay` ([`relay/`](../relay)); its wire protocol is\n[relay/PROTOCOL.md](../relay/PROTOCOL.md).\n\n## Start one in five minutes\n\nThis needs Pane 2.4.227 or later: that release is the first with the relay\nimage, `compose.yaml` and `runpane relay init`.\n\nYou need:\n\n- A Linux machine with a public IPv4 address and Docker with its Compose\n plugin ([install Docker](https://docs.docker.com/engine/install/)), such as\n a small cloud VM. This guide uses `203.0.113.10`; use your machine's public\n address, as its cloud console shows it.\n- A name for the relay under a domain whose DNS you manage, such as\n `relay.example.com`. The relay answers DNS for every name under it, so use\n a name you use for nothing else.\n\n1. **Open the ports.** In the machine's firewall or cloud security group,\n allow TCP 443 and UDP and TCP 53. Also allow UDP 7842, which helps devices\n find direct paths; without it they still connect.\n\n2. **Add two DNS records** at the DNS provider for `example.com`:\n\n | Name | Type | Value |\n | --- | --- | --- |\n | `relay-ns.example.com` | A | `203.0.113.10` |\n | `relay.example.com` | NS | `relay-ns.example.com` |\n\n Many providers want only the part before your domain in the Name field\n (`relay-ns`, `relay`). On Cloudflare, set the A record to **DNS only**\n (grey cloud); a proxied record breaks the delegation.\n\n `runpane relay init` prints these records, and every command below, with\n your own name and address. It needs Node.js 22 or later and runs on any\n machine. Its checks at the end fail until you finish step 3; that is\n expected.\n\n ```sh\n npx --yes runpane@latest relay init --domain relay.example.com --public-ip 203.0.113.10\n ```\n\n3. **Start the relay** on the machine. On Ubuntu and Debian, first free\n port 53: their `systemd-resolved` holds it for the machine's own lookups.\n This turns that listener off and keeps lookups working:\n\n ```sh\n sudo mkdir -p /etc/systemd/resolved.conf.d\n printf '[Resolve]\\nDNSStubListener=no\\n' | sudo tee /etc/systemd/resolved.conf.d/pane-relay.conf\n sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf\n sudo systemctl restart systemd-resolved\n ```\n\n Then, in an empty folder, use the lines `relay init` printed, or replace\n all three values with your own (`PANE_RELAY_NS` is the A record's name\n from step 2):\n\n ```sh\n curl -fsSLO https://github.com/greenfield-inc/Pane/releases/latest/download/compose.yaml\n printf '%s\\n' PANE_RELAY_DOMAIN=relay.example.com PANE_RELAY_PUBLIC_IP=203.0.113.10 PANE_RELAY_NS=relay-ns.example.com > .env\n docker compose up -d\n ```\n\n4. **Check it.** Run `relay init` again. Once DNS has spread (usually a few\n minutes), every line shows ✓ and it says the relay is ready:\n\n ```text\n Checks (DNS changes can take a few minutes; run this again after each step):\n ✓ relay-ns.example.com A 203.0.113.10\n ✓ relay.example.com NS relay-ns.example.com\n ✓ relay.example.com A 203.0.113.10, answered by the relay\n ✓ https://relay.example.com/healthz\n ```\n\n The relay gets its certificate from Let's Encrypt through its own DNS. The\n first one takes about a minute once DNS works; until then the last check\n says the certificate is not trusted yet, and `docker compose logs relay`\n shows `relay certificate issued` when it arrives. To check by hand:\n `curl https://relay.example.com/healthz` and\n `dig @203.0.113.10 relay.example.com A`.\n\n5. **Point Pane at it.** On each computer: **Settings › Remote Access › Phones and glasses ›\n Relay address**, enter `relay.example.com` and press Enter. The computer\n reconnects through your relay, gets a certificate for\n `<id>.relay.example.com`, and new QR codes use your domain. Phones paired\n through Pane's servers need a new scan, and computers link only with\n computers on the same relay.\n\n## Keep it running\n\nThe relay restarts with Docker. Each release's `compose.yaml` runs that\nrelease's image, so updating means downloading the new one and restarting:\n\n```sh\ncurl -fsSLO https://github.com/greenfield-inc/Pane/releases/latest/download/compose.yaml\ndocker compose up -d\n```\n\n`PANE_RELAY_VERSION` in `.env` picks another release instead, such as\n`PANE_RELAY_VERSION=2.4.227`; images start with 2.4.227. Certificates\nrenew on their own, without a restart, and live in the `pane-relay` Docker\nvolume.\n\nEvery `pane-relay` flag also reads an environment variable, so any other\nsetting goes in `.env` too, such as `PANE_RELAY_ACME_EMAIL` for a Let's\nEncrypt contact address. [relay/README.md](../relay/README.md#flags) lists\nthem all, including the connection and byte limits and the blocklist. Limits\ncount each client address, so a flood slows and refuses only the address it\ncomes from. Many computers behind one shared address, such as an office\nnetwork, may need a higher `--limit-agent-conns-per-min` and\n`--limit-new-ids-per-hour`.\n\n## Without Docker\n\n`runpane relay` runs `pane-relay` on macOS, Linux and Windows (x64 and\narm64) with Node.js 22 or later. It downloads the binary for its own version\nfrom the GitHub release once, checks it against the release's\n`pane-relay-sha256.txt` and keeps it in your cache folder\n(`~/.cache/runpane/relay`, `~/Library/Caches/runpane/relay` on macOS,\n`%LOCALAPPDATA%\\runpane\\relay` on Windows). Its flags, output and exit code\nare `pane-relay`'s. Ports 443 and 53 need root, or on Linux the\n`CAP_NET_BIND_SERVICE` capability. Free port 53 first as in step 3; passing\nyour `PATH` through `sudo` finds `npx` when Node.js came from nvm:\n\n```sh\nsudo env \"PATH=$PATH\" npx --yes runpane@latest relay \\\n --domain relay.example.com --public-ip 203.0.113.10 --ns relay-ns.example.com \\\n --dns 0.0.0.0:53 --direct-quic 0.0.0.0:7842 \\\n --acme-cache /var/lib/pane-relay/acme\n```\n\nThe release also carries each binary, `pane-relay-<platform>-<arch>`, to\ndownload yourself, and the container image is\n`ghcr.io/greenfield-inc/pane-relay`. To build from source, run\n`cargo build --release` in `relay/`, or `docker build -t pane-relay relay/`.\n\n`--acme-directory` points at another CA, such as Let's Encrypt staging\n(`https://acme-staging-v02.api.letsencrypt.org/directory`) while you try\nthings out. The relay's DNS publishes CAA records that allow only Let's\nEncrypt; with another CA, set `--caa-issuer` to its domain. `--cert` and `--key` take your own certificate instead. It must\ncover `relay.example.com` and `us.relay.relay.example.com`: each relay has a\nregion (`us` unless you set `--region`) and also answers at\n`<region>.relay.<your domain>`. `--direct-quic` is optional: it helps phones and computers find a\ndirect path to each other, and without it they still connect.\n\n## Two name servers\n\nSome registrars want two name servers, and a second relay that answers DNS\nkeeps your names resolving while one machine is down. Run two relays with\nDNS, say `us` at 203.0.113.10 and `eu` at 198.51.100.7, that share one\nsecret and tell each other about computers. Make the secret once, with\n`openssl rand -hex 32`.\n\nAt the DNS provider for `example.com`, add an A record for each machine and\npoint the NS records at both:\n\n| Name | Type | Value |\n| --- | --- | --- |\n| `relay-ns1.example.com` | A | `203.0.113.10` |\n| `relay-ns2.example.com` | A | `198.51.100.7` |\n| `relay.example.com` | NS | `relay-ns1.example.com` |\n| `relay.example.com` | NS | `relay-ns2.example.com` |\n\nThe `.env` on `us` (on `eu`, swap the region, the public address and the\nother relay's URL):\n\n```sh\nPANE_RELAY_DOMAIN=relay.example.com\nPANE_RELAY_REGION=us\nPANE_RELAY_PUBLIC_IP=203.0.113.10\nPANE_RELAY_REGION_IP=us=203.0.113.10,eu=198.51.100.7\nPANE_RELAY_NS=relay-ns1.example.com,relay-ns2.example.com\nPANE_RELAY_REGISTRY_URL=https://eu.relay.relay.example.com/v1/registry\nPANE_RELAY_REGISTRY_SECRET=<the secret>\n```\n\nEach relay sends every change to the other and re-sends its computers every\nminute, so both answer the same records. A further relay that doesn't answer DNS (started without `--dns`) lists\nboth in `--registry-url`:\n`https://us.relay.relay.example.com/v1/registry,https://eu.relay.relay.example.com/v1/registry`.\n\nThe first time, start `us` and wait for `relay certificate issued` in its\nlog before starting `eu`: relays reach each other over https, so the first\nneeds its certificate before the second can post to it.\n\n## Alerts\n\nTo deliver alerts to phones from computers that have no push keys, give the\nrelay the Pane app's keys: `--apns-key-path`, `--apns-key-id`,\n`--apns-team-id`, and `--fcm-service-account` (a service account JSON key).\nWithout them, set the keys on each computer instead\n([Native mobile](NATIVE_MOBILE.md)).\n\nOn Google Compute Engine, Android alerts need no key file: attach the sender\nservice account to the VM, give the VM the `cloud-platform` access scope, and\npass `--fcm-project <project id>`. The relay gets its tokens from the VM's\nmetadata server.\n\nA computer alerts only phones that confirmed it: the relay pushes each phone a\ngrant for the computer, and the Pane app hands it back to that computer\n([relay protocol](../relay/PROTOCOL.md#alerts)). Grants are signed with a key\nfrom `--registry-secret`. Without it, grants end when the relay restarts and\nphones confirm again the next time they connect.\n\n## Direct paths\n\nThe relay is also the meeting point for direct QUIC paths between a computer\nand its devices, at `https://us.relay.relay.example.com/` on the same port\n443. Pane learns this address from the relay (`directRelay` in\n`GET /v1/relays`), so there is nothing to configure.\n\n## What the relay sees\n\nWhich computer each connection is for (the TLS server name), IP addresses,\ntiming and byte counts. It never decrypts traffic: each computer ends TLS\nwith its own key. It logs no payloads, tokens or URLs. Packets on direct\npaths are encrypted between the two ends; the relay sees their iroh endpoint\nids, IP addresses and byte counts.\n"},{"path":"docs/SELF_HOSTED_REMOTE_DAEMON.md","title":"Self-Hosted Remote Daemon","text":"# Self-Hosted Remote Daemon\n\nThis guide covers running Pane on your own workstation, Mac mini, Linux box, or VM and connecting to it from the local Pane desktop app or the Remote Pane browser app with a connection code.\n\nTo pair a phone or another computer without Tailscale or a code, use a QR code or a one-time link instead: see [Add a device](QR_PAIRING.md). To reach a server you already reach over SSH, see [SSH route](#ssh-route).\n\nThe intended flow is:\n\n1. Run one setup command on the remote machine.\n2. Copy the generated `pane-remote://...` connection code.\n3. Paste it into desktop Pane under `Settings > Remote Access > Tailscale > Paste a connection code`, or open `https://runpane.com/app/` and paste it there.\n\nPane saves the profile and attempts to connect immediately. Local desktop mode is unchanged until a remote profile is imported and activated.\n\n## Workspaces or pairing codes?\n\nTo let machines on your tailnet reach each other from the runpane CLI, you do not need this guide or a code. [Workspaces](RUNPANE_WORKSPACES.md) put each desktop Pane on your tailnet automatically (port 8443) and trust your Tailscale login, plus everyone on the tailnet when a machine's owner allows it, so `runpane workspace <machine> read|write|exec|<command>` works between your Macs, Windows PCs, and Linux machines, and the desktop app's remote mode connects to them from the sidebar's machine menu or Settings › Remote Access › Computers. Use the remote daemon and pairing codes in this guide for browsers and phones, and for devices outside your tailnet. The remote daemon keeps port 443, and the two run side by side.\n\n## Guided quick start\n\nOn the host machine, run `npx --yes runpane@latest` in an interactive terminal.\nChoose **Set up a remote host**, enter a name (or press Enter),\nand follow the Tailscale installation/login prompts. The wizard picks an available\nport and prints a connection code. Sign your other device into the same Tailscale\nnetwork, then paste the code into Pane or [runpane.com/app](https://runpane.com/app/).\n\nIf the host later switches to another tailnet, Pane notices while it runs: within\na minute it re-creates the `:443` Serve forward on the new tailnet, and new codes\nuse the new address. Codes created before the switch still point at the old\ntailnet, so create a new one. If Pane cannot confirm the forward, it shows the\nerror and the `tailscale serve` command to run instead of creating a code.\n\nSSH and manual URL setups use the explicit commands below,\nand desktop Pane sets up an SSH host for you (see [SSH route](#ssh-route)).\nThe no-argument and `setup` commands print help in non-interactive shells; they\ndo not start a login prompt.\n\n## Creating a code in desktop Settings\n\nDesktop setup uses an installed, signed-in Tailscale client. If Tailscale is\nmissing, Pane shows installation instructions; use the setup terminal to install\nit. Tailscale discovery, Serve configuration and requested daemon service setup\nrun asynchronously so the desktop stays responsive while they finish.\n\n## One-Command Setup\n\nTo skip the wizard menu, run interactive remote setup directly:\n\n```bash\nnpx --yes runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\npnpm dlx runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\npipx run runpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\nuvx runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n```\n\nSSH tunnel mode:\n\n```bash\nnpx --yes runpane@latest install daemon --label \"VM\" --prefer-tunnel ssh\n```\n\nPersistent installs are also supported:\n\n```bash\nnpm i -g runpane\nrunpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n\npython -m pip install runpane\nrunpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n```\n\nFrom a source checkout:\n\n```bash\npnpm remote:setup -- --label \"VM\"\n```\n\nSSH tunnel mode:\n\n```bash\npnpm remote:setup -- --label \"VM\" --prefer-tunnel ssh\n```\n\nFor validation against a separate data directory:\n\n```bash\nPANE_DIR=/tmp/pane-remote-vm pnpm remote:setup -- --label \"VM\" --prefer-tunnel ssh --print-only\n```\n\nPackaged Pane builds can run the same setup path without opening a window:\n\n```bash\npane --remote-setup --label \"VM\"\n```\n\nOn displayless Linux hosts, prefer `runpane install daemon`; the npm and PyPI\nwrappers pass Electron's required headless flags automatically. For a direct\npackaged launch, pass them explicitly:\n\n```bash\npane --ozone-platform=headless --disable-gpu --remote-setup --label \"VM\"\n```\n\nThese must be command-line arguments: Electron picks its Ozone platform before\nthe app starts, so the environment variable `ELECTRON_OZONE_PLATFORM_HINT` no\nlonger works (removed in Electron 38, ignored from 39 on).\n\nThe wrappers are lightweight installers and configurators. They currently\ndownload the packaged Pane runtime because the daemon is not distributed as a\nseparate binary. AppImage installs therefore require FUSE; on Debian-based\nhosts, `--format deb` avoids the AppImage/FUSE requirement.\n\nIf Pane is already installed on the host, this is the most direct command:\n\n```bash\npane --remote-setup --label \"VM\" --prefer-tunnel tailscale\n```\n\nThe setup command:\n\n- detects Linux, macOS, or Windows host behavior\n- writes remote daemon config into one `PANE_DIR` (default `~/.pane_remote`)\n- enables the loopback listener on `127.0.0.1:42137`\n- creates a paired client record with a hashed token on the host\n- emits the raw token only inside the one-time `pane-remote://...` import code\n- attempts to install and start a user-level daemon service (on Linux, it also\n enables lingering so the service keeps running after you log out)\n- prints the manual daemon command if service setup is unavailable\n- detects Tailscale Serve where possible and otherwise prints an SSH local-forward command\n\nUseful options:\n\n```bash\npnpm remote:setup -- --help\npnpm remote:setup -- --channel nightly\npnpm remote:setup -- --pane-dir \"$HOME/.pane_remote\"\npnpm remote:setup -- --prefer-tunnel ssh\npnpm remote:setup -- --no-install-service\npnpm remote:setup -- --no-tailscale-serve\n```\n\n## Run Pane on a Cloud VM\n\nPane does not create or manage cloud machines. Create the VM yourself, then set\nit up as a Remote Pane host:\n\n1. Create an Ubuntu 24.04 VM with any provider. Size it for the agents and\n builds you plan to run. It only needs inbound SSH. The daemon listens on\n loopback, and you reach it through Tailscale or an SSH tunnel.\n2. SSH in as a regular user with `sudo`, not as `root`.\n3. Install what your agents need on the VM: `git`, patched Node.js 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) (for\n `npx`), and the agent CLIs you use, such as Claude Code or Codex. Sign in\n to each CLI on the VM. Agents run there, not on your laptop.\n4. Install Tailscale and join your tailnet:\n\n ```bash\n curl -fsSL https://tailscale.com/install.sh | sh\n sudo tailscale up\n ```\n\n5. Install Pane and create a connection code. `--format deb` installs the\n Debian package, so the host does not need FUSE:\n\n ```bash\n npx --yes runpane@latest install daemon --label \"Cloud VM\" --format deb\n ```\n\n6. Check that the daemon keeps running after you log out. It runs as a systemd\n user service, and setup turns on lingering (through passwordless `sudo` if\n needed) so the service outlives your SSH session. If the setup output says\n it could not, enable lingering yourself:\n\n ```bash\n sudo loginctl enable-linger \"$USER\"\n systemctl --user status pane-remote-daemon.service\n ```\n\n7. Paste the printed `pane-remote://...` code into desktop Pane (see\n [Import Locally](#import-locally)) or into `https://runpane.com/app/`.\n\nTo start, stop, or delete the VM, use your provider's console or CLI. If\nsomething fails, run `npx --yes runpane@latest doctor --json` on the VM and\ncheck [Troubleshooting](#troubleshooting).\n\n## Import Locally\n\nOn your local desktop machine:\n\n1. Open Pane.\n2. Go to `Settings > Remote Access > Tailscale` and click `Paste a connection code`.\n3. Paste the full `pane-remote://...` code into `Connection Code`.\n4. Click `Connect`.\n\nIf the tunnel is not reachable yet, Pane still saves the host and shows the connection error. Start the printed SSH/Tailscale tunnel and pick the saved host again from `Settings > Remote Access > Computers` or the sidebar's machine menu.\n\n## SSH route\n\nDesktop Pane can reach a computer through your own SSH config, start Pane's headless host there, and keep the tunnel up.\n\n1. Open `Settings > Remote Access > Add a device` (or `Add a device…` in the sidebar's machine menu) and pick the `SSH` tab.\n2. Pick a host from `~/.ssh/config`, or type one under `Another host` (`user@host` works).\n3. Click `Connect`.\n\nPane then:\n\n- connects with the system `ssh`, your config and your agent, and fails instead of asking for a password or host key. Your keys and passwords never leave this computer;\n- checks for Node.js 22 or later there;\n- runs `npx --yes runpane@latest install daemon --label \"<this computer>\" --prefer-tunnel ssh`, which installs Pane when it is missing and starts its headless host as a service;\n- forwards a local port to the host with `ssh -N -L` and saves the computer with an SSH route.\n\nThe computer appears in `Settings > Remote Access > Computers` with an SSH pill. When the SSH connection drops, Pane reconnects it with backoff for up to 5 minutes, and again the next time it uses the route. Each step that fails says why and what to run: `ssh <host>` must connect in a terminal without prompts, and a host without Node.js needs it installed first.\n\n## Public URL\n\nA computer behind your own HTTPS reverse proxy can name that address as a route.\n\n1. On that computer, open `Settings > Remote Access > Computers` and expand its own row (marked `This computer`).\n2. Enter the address in `Public URL`, such as `https://pane.example.com`, and click `Save`. It must be HTTPS.\n\nThe computer reports the address to every computer that connects to it, and they add a Public URL route (\"found automatically\"). Pane runs no tunnel service: the proxy and its certificate are yours. Point the proxy at Pane's host listener on loopback (port `42137` unless you changed it under `Settings > Remote Access > Tailscale > Advanced`), as in [Security Model](#security-model). Phone access turns that listener on.\n\n## Use the Mobile / Browser App\n\nThe same connection code works in the Remote Pane PWA:\n\n```text\nhttps://runpane.com/app/\n```\n\nUse the PWA for phone or tablet access to remote terminals, chats, browser tabs, files and diffs:\n\n1. Set up the remote host with Tailscale or a trusted HTTPS tunnel.\n2. Copy the full `pane-remote://...` code printed by setup.\n3. Open `https://runpane.com/app/` on the client device.\n4. Paste the code and connect.\n\nFor iPhone or iPad, open the URL in Safari, tap Share, then tap `Add to Home Screen`.\nFor Android, open the URL in Chrome, open the browser menu, then tap `Add to Home screen` or `Install app`.\n\nSSH tunnel mode is mainly useful from desktop clients. For mobile browser access, prefer Tailscale or Manual HTTPS so the phone can reach the daemon URL directly.\n\n### Browser tabs on the phone\n\nAdd Tool → Browser opens a browser tab on the phone. A new tab lists the host's listening ports, and the Ports button in the address bar opens the same list. Tap a `web` port to open it; `tcp` ports read \"desktop only\". The address bar is editable and reads the host's own address, such as `localhost:5173/ on <host>`. Copy URL copies the address the phone actually loads, and Open in Safari opens it outside the app. Use Open in Safari for sites that refuse to load in a frame, such as github.com: the tab cannot tell when that happens.\n\nHow a host page reaches the phone:\n\n- When a phone first opens a `web` port, Pane gives that port its own HTTPS address on the host's tailnet name, `https://<host>.ts.net:<n>`, with a `tailscale serve` handler; the tab shows the page under a second later. Pane picks `n` from 44300 up, so it never takes the dev server's own port number. Handlers exist only for opened ports because Tailscale drops its whole Serve config, other apps' handlers included, once a machine holds a few hundred.\n- Each handler points at a loopback preview proxy that checks the visitor's Tailscale login, sends the request to `localhost:<port>` as the dev server expects, carries live-reload WebSockets, and drops the headers that stop a page from loading in a frame.\n- HTML files opened in a browser tab (for example by `runpane panels open --url file://...`) load from one more Serve address, with the files beside them. Files outside the page's folder are refused.\n- A handler goes when its port stops listening, when Pane quits, and at the next launch after a crash. Quit spends at most 5 seconds removing them; a launch removes any it left. Pane changes only handlers it created: their targets start with `/pane-<hash of the Pane data directory>/`, so a dev build and the installed app never remove each other's.\n\nWho can open these pages: the devices that **Who can connect** admits (see [Who is trusted](RUNPANE_WORKSPACES.md#who-is-trusted)). Phone pages need that setting on, Tailscale running on the host, and the phone on the same tailnet. A page in a frame cannot send the machine's password, so phone pages are off while password protection is on. A refused device sees \"This page runs on &lt;host&gt;. Open it from a device signed in as &lt;login&gt;.\" A pairing code or SSH tunnel does not grant access to these pages: they need the phone on this tailnet, signed in with a login that setting admits. Navigation inside a page stays on the phone; the tab saves only the addresses you enter or pick.\n\nThe Pane phone app shows page tabs with an address row (back, forward, address, reload, Open in Safari) and loads them through the same phone addresses. When the files address is off or the phone can't reach it, the app reads an HTML file through its own connection instead (`panels:read-browser-file`), so a self-contained page opens over a pairing code too; pages that load other files from their folder need the phone address. Entering an address saves it to the tab. Each case that can't load names its reason: nothing listens on the port, phone pages are off on that computer (with its reason), the phone is not on Tailscale, the computer is offline, or its Pane predates phone pages.\n\n### Files on the phone\n\nEach pane's Explorer tab shows its worktree as a tree. Tap a text file to read and edit it; Save writes it to the host. The Diff tab lists the branch's changes with their counts and opens each file to its patch, read-only; a chat's **View diff** brings it forward. Text files over 1 MB, and binary files that are not images, PDFs, video or audio, stay on the desktop. Images, PDFs, video and audio of any size preview on the phone, and video seeks without downloading the whole file. Open in Safari opens a preview outside the app.\n\nIn the Pane phone app, Explorer lists the branch's changed files first, then opens one folder at a time with a path bar and search, and files are read-only: code with syntax colours, Markdown rendered or as source, and images up to 5 MB. Text over 1 MB and other binaries stay on the computer, with Copy path. Everything, images included, comes through the app's own connection, so it works over every connection the app supports. Editor tabs open their file in the same viewer. The Diff tab lists the branch's changes with their counts and shows each file's patch, and Run script tabs show the script's output live; both are read-only, so commit, revert and start or stop the script on the computer.\n\nBrowsing and editing go through the PWA's own connection, so they work over every connection the PWA supports. Previews load from the same Serve address as HTML files in browser tabs, so they need what [browser tabs on the phone](#browser-tabs-on-the-phone) need: Tailscale on the host, password protection off, and a phone signed in to a login that **Who can connect** admits. Without that, a preview explains why it cannot load. Files outside the worktree are refused.\n\n### Remote PWA Implementation Notes\n\nThe Remote Pane PWA is a browser runtime. It does not have `window.electronAPI`, so client-side PWA preferences must use browser-safe storage such as `localStorage` or explicit daemon adapter calls. Do not reuse desktop renderer preference stores that persist through Electron IPC unless the call path is guarded for browser mode.\n\n## Forwarded ports\n\nA desktop connected to a remote host reaches every port listening on the host as if it were local. Pane lists the host's ports on a new, empty browser tab and under the address bar's **Ports** button, and the desktop opens a matching listener on its own `127.0.0.1` and `::1` for each one. Only the desktop app sets up these listeners; the browser app and phones don't yet.\n\n- A browser tab at `localhost:5173` loads the host's dev server, live reload included. The address bar reads `localhost:5173` with **on &lt;host name&gt;**.\n- When something on the desktop already answers on 5173, the desktop uses the next free port, or any free port when the next 19 are taken too. The tab still reads `localhost:5173`, and the Ports list shows the local number as **here :5174**.\n- A tab never loads the desktop's own service in the host's place. While the host's Ports list is loading it waits, and when a port stops listening on the host it says the port isn't reachable, then loads once the port is back.\n- **Copy URL** copies the address that works on the desktop, for its system browser.\n- Clicking a `localhost` link in a terminal opens the host's server in your system browser, using the local port number if it moved. A link to a port that isn't forwarded right now doesn't open, so it never reaches the desktop's own service on that port.\n- When a port closes on the host, the desktop closes its listener. Disconnecting closes all of them.\n\nEach connection the desktop accepts travels over the Pane connection as a WebSocket to `/ports/<port>` on the host, which connects to `localhost:<port>` there. The host accepts it only with the same sign-in as every other request, and only for a port in its current list. Listeners stay on loopback on both machines.\n\nEvery client signed in to the host can reach these ports through that route: anyone holding a pairing code, and any Tailscale login that the Workspaces \"Who can connect\" setting allows. They reach every listening service, including databases that trust `localhost` and debugging ports such as a Node `--inspect` port, which runs code as you. Pane's own ports are forwarded too, and its remote API keeps its own sign-in. Forwarding can't be limited to some ports. If that is more access than you want, turn off the remote daemon listener in `Settings > Remote Access > Tailscale > Advanced` and set \"Who can connect\" to Off.\n\n## Security Model\n\n- The daemon listener only supports loopback hosts: `127.0.0.1`, `::1`, or `localhost`.\n- Direct public or LAN binding is intentionally rejected.\n- Use SSH local forwarding, Tailscale Serve, or a trusted HTTPS reverse proxy that forwards to loopback.\n- Treat the generated `pane-remote://...` code like a secret. It contains the bearer token needed by the local client.\n- Any signed-in client can open a TCP connection to any port listening on the host. See [Forwarded ports](#forwarded-ports).\n\nTailscale Serve example generated by setup:\n\n```bash\ntailscale serve --bg --tls-terminated-tcp=443 42137\n```\n\nSSH fallback generated by setup:\n\n```bash\nssh -N -L 42137:127.0.0.1:42137 user@your-host\n```\n\n## Manual Advanced Flow\n\nThe old manual flow still works and is useful for debugging.\n\n### 1. Choose the Host Data Directory\n\n```bash\nexport PANE_DIR=\"$HOME/.pane_remote\"\nmkdir -p \"$PANE_DIR\"\n```\n\nPane stores config and database files under that directory. The setup command, desktop app, and headless daemon must use the same `PANE_DIR`.\n\n### 2. Configure the Remote Listener\n\nLaunch Pane on the host against that directory:\n\n```bash\nPANE_DIR=\"$HOME/.pane_remote\" pnpm dev\n```\n\nIn `Settings > Remote Access > Tailscale > Advanced` (the `Advanced Remote Host` page):\n\n1. Enable `Enable remote daemon listener`.\n2. Keep `Listen Host` on `127.0.0.1`.\n3. Keep or change `Listen Port`, default `42137`.\n4. Leave `Require pairing / saved bearer tokens` enabled. Turned off, the\n listener answers only callers that address it as `127.0.0.1`, `localhost`\n or `[::1]` with no web page from another site behind them, and it still\n requires a token while phone access through the relay is on.\n5. Leave `Allow direct HTTP on loopback` enabled.\n6. Click `Apply Host Settings`.\n\n### 3. Create a Paired Connection\n\nFrom `Pairing tools` on the same page:\n\n1. Enter a label such as `Office Mac mini`.\n2. Enter the base URL the client will use after tunneling, for example `http://127.0.0.1:42137`.\n3. Click `Create Paired Profile`.\n\nPane adds a host-side allowed client record, adds a matching local profile, and shows the generated bearer token once.\n\n### 4. Start the Headless Daemon\n\n```bash\nPANE_DIR=\"$HOME/.pane_remote\" pnpm daemon:headless\n```\n\nOn success:\n\n```text\n[Pane daemon] Headless host ready on unix:<socket path>\n```\n\nOn Windows the endpoint is `pipe:<pipe name>`. This is the local control endpoint, not the remote listener port.\n\n### 5. Connect the Desktop Client\n\nUse `Paste a connection code` under `Settings > Remote Access > Tailscale` for a generated code, or use `Save existing remote profile` under `Tailscale > Advanced > Pairing tools` with:\n\n- label\n- base URL\n- bearer token\n\nClick `Save Remote Profile`, then pick the saved computer from `Settings > Remote Access > Computers` or the sidebar's machine menu.\n\n## Validation\n\nRecommended checks after connecting:\n\n1. Verify projects and sessions load in the client.\n2. Open a terminal-backed session and confirm output streaming works.\n3. Send terminal input and verify the remote runtime receives it.\n4. Resize a terminal and confirm the remote terminal resizes.\n5. Open a file and confirm read/write works.\n6. Check git status and commit/diff flows.\n7. Run an approve-mode command and confirm the permission dialog appears on the client.\n\n## When a connection fails\n\nWhen you connect to a host (a computer's row in Settings › Remote Access ›\nComputers, Paste a connection code, the sidebar's machine menu, or Retry), the\nmain area shows a checklist of\nthe connection's stages. The first stage that fails shows what went wrong and a\nfix. The same checklist appears when Pane gives up reconnecting after five\nminutes, and from **Retry now** on the \"Reconnecting to <machine>…\" banner. That\nbanner appears once the connection has been down for 10 seconds; until then\nthe workspace dims and the host dot pulses while Pane reconnects. A computer\nwith more than one route moves to the next route before the banner, so the\nbanner means every route failed. See [Routes](QR_PAIRING.md#routes).\n\nThe host's 5-second heartbeat decides whether a connection is alive: 12 seconds\nwithout one reconnects. One failed request fails only itself; three requests in\na row that get no answer reconnect. Reconnects wait 250 ms, 750 ms and 2 s, then\ndouble up to 30 s between tries. A computer linked through Pane's relay is\nretried at least every 5 seconds and never given up on while Pane is open.\n\n| Stage | Fails when | Fix |\n|---|---|---|\n| Tailscale on this computer (Tailscale machines only) | Tailscale is signed out or not installed here | Open Tailscale Setup, or Download Tailscale |\n| Host reachable | The host times out or its name does not resolve; a Tailscale machine is offline | Check that both computers are on the same network or tailnet |\n| Pane daemon running / Pane open | The host refuses the connection, or a proxy such as Tailscale Serve answers 502-504 | Start it, or Copy command |\n| Signed in | The host rejects this computer's token or password | Paste new code, or Enter password |\n| Versions match | The host runs a different Pane version (a warning; the workspace still loads) | Update it, or Update Pane on this computer |\n| Workspace loaded | The host answered but the workspace did not restore | Retry |\n\n**Start it** and **Update it** run one fixed command on the host over your own\nSSH config. They appear only when exactly one `Host` alias in `~/.ssh/config`\nmatches the host: its Tailscale machine name, or the first label of the host\nname in its address (`devbox` for `devbox.tail1234.ts.net`). Pane runs:\n\n```bash\nssh -o BatchMode=yes -o ConnectTimeout=10 <alias> \"$SHELL\" -lc '<command>'\n```\n\n`BatchMode` makes ssh fail instead of asking for a password, and the login\nshell puts `npx` on the `PATH`. With no single matching alias, or when ssh\nfails, the row offers **Copy command** so you can run the same command on the\nhost yourself:\n\n| Fix | Code host (daemon) | Tailscale machine (Pane app) |\n|---|---|---|\n| Start it | `npx --yes runpane@latest daemon repair --yes` | `open -a Pane` (macOS hosts only; otherwise open Pane there) |\n| Update it | `npx --yes runpane@latest update && npx --yes runpane@latest daemon repair --yes` | `npx --yes runpane@latest update` |\n\n`daemon repair` uses the default daemon data directory, `~/.pane_remote`. For a\nhost set up with another `--pane-dir`, run `runpane daemon repair --pane-dir\n<dir> --yes` there instead.\n\n## Troubleshooting\n\nStart with machine-readable environment diagnostics:\n\n```bash\nrunpane doctor --json\n```\n\nThe `remoteSetup` section reports stable diagnostic codes and recovery commands\nfor missing AppImage/FUSE support, Electron sandbox restrictions, and missing\nuser service management. `runpane install daemon` automatically supplies the\nLinux headless launch environment. Pane never disables the Electron sandbox\nautomatically; use `--no-sandbox` only when the host requires it and you accept\nthe security tradeoff.\n\n### Remote setup exits because X11 or `$DISPLAY` is missing\n\nUse `runpane install daemon`, or add `--ozone-platform=headless --disable-gpu`\nto a direct packaged launch. This failure occurs before Tailscale setup and does\nnot mean the daemon requires a graphical session. If you previously relied on\n`ELECTRON_OZONE_PLATFORM_HINT=headless`, switch to the flags: Electron removed\nthat variable in 38 and ignores it from 39 on.\n\n### The headless daemon starts but remote connect fails\n\nCheck:\n\n- the daemon uses the same `PANE_DIR` that setup wrote\n- the tunnel/proxy forwards to the same loopback port as the host config\n- the client profile base URL matches the client-side tunnel endpoint\n- the `pane-remote://...` code was not truncated\n\n### A remote action could not be confirmed\n\nPane's remote clients (desktop, browser, phone and glasses) retry a reviewed set\nof read-only requests and dictation cleanup after transient network or server\nfailures, on the reconnect schedule for up to five minutes. Authentication\nfailures stop immediately.\n\nA host on a current Pane runs each action once per request ID and says so when a\nclient connects (`deduplicatesRequestIds` in the `ready` event). It remembers\neach client's recent IDs and answers for ten minutes, in memory, up to 10,000\nper client; while a client is at that limit, the host refuses its new actions\nbefore running them and the client sends them again. Against such a\nhost, every action a client sends (terminal input, prompts, new panes and tabs,\nNotify answers) carries an ID. An action issued while the connection is\nreconnecting waits for it; one whose answer is lost is resent with the same ID\nuntil the host answers or five minutes pass since it was issued. Terminal\ninput keeps its order per terminal. Typing into a dimmed terminal is not queued.\n\nDelivery is unknown only when no answer arrives in that time: inspect the\ncurrent panes or terminal before submitting it again. An action that was never\nsent says so. Against an older host, actions other than chat sends (which the\nhost de-duplicates by operation ID) are sent once, as before.\n\nThe browser normally uses native EventSource for output. Its fetch fallback and\nthe desktop transport share one SSE text parser, accepting LF, CRLF, and CR line\nendings across chunks. Each transport decodes UTF-8 incrementally before parsing;\nreconnecting discards the previous stream's incomplete event. Terminal output\nresponses are applied only to the terminal instance that requested them, so a\nlate response cannot clear or write to a terminal disposed during a tab switch.\n\n### I changed host settings but nothing happened\n\nThe headless daemon watches config and starts or stops the remote transport based on saved host config. If behavior looks stale, restart the daemon once and verify the correct `PANE_DIR`.\n\n### Why can’t I bind to `0.0.0.0` or a LAN IP?\n\nThat is intentionally blocked. The current security model is loopback plus a secure exposure layer.\n\n### Why are some actions disabled in remote mode?\n\nSome actions operate on the local desktop client machine rather than the remote workspace. Pane currently disables or keeps local-only behavior for:\n\n- opening a local IDE from the client\n- revealing files in the client OS file manager\n- the native clipboard-image fallback path\n\n### Where does copied terminal text go?\n\nTo the clipboard of the machine you are sitting at. In remote mode, dragging to select text in a terminal copies it right away, with no Copy popover. Programs that copy with OSC 52, such as Claude Code, tmux, and vim, also copy to your machine. Programs in the terminal cannot read your clipboard through OSC 52.\n\n## Current Limitations\n\n- No account-based multi-tenant auth. For a hosted relay that needs no Tailscale, see [Add a device](QR_PAIRING.md)\n- No direct non-loopback listener support\n- No full live remote end-to-end CI harness yet\n# Mobile push notifications\n\nThe native companion registers an APNs/FCM token with every computer it has saved. With a paired bearer token, the registration is scoped to that paired client and revalidated before every send. Over Tailscale Serve with no code, only the computer's owner login can register; the registration is filed under `tailnet:<login>` and the phone's install id, checked when it registers, and lasts until the phone revokes it or the provider reports the token dead. One owner login keeps at most 10 live registrations per computer, dropping the oldest. The daemon sends attention alerts for `blocked` transitions and for settled `working → idle` transitions of turns a person started; controls can disable either category per device. See [Native mobile](NATIVE_MOBILE.md) for the operator-only credentials and signing setup.\n"},{"path":"docs/SESSIONS.md","title":"Sessions","text":"# Sessions\n\nSessions are named, ongoing Pane Chats where work intent lives. Each Session\nopens one chat, and its sidebar row can expand to show associated Panes. The\noptional overview keeps the Session name, associated Panes, and recent\nactivity together while the chat remains the focused work surface. A tab\nshares its parent Pane's worktree.\n\nIn the sidebar, `+` opens an agent picker, an optional Session name field, and\nan optional \"What is this Session for?\" field that becomes the Session's goal.\nPane remembers the chosen agent as the default for future Sessions while\nexisting Sessions keep their own agent. A blank name starts as `New chat` or\n`New chat 2` and is renamed once from the first message you send the Session\nagent; a name you type or set later is kept. Each new Session opens as one Pane\nChat and can be renamed later from the optional read-only overview. Expand a Session to see\nits associated Panes and open any Pane in its existing sidebar view.\n\nWith [chat tabs](CHAT_TABS.md) on (Settings → AI & Agents → Chat tabs), a new\nSession runs its orchestrator in a chat tab instead of a terminal for any agent\nchat tabs run (Claude, Codex, Cursor and OpenCode), from\nthe plain agent or the Session's `agent-farm run <profile>` launch, and sends its\nopening prompt once. Like every chat, finished turns fold to one row. A worker\nPane shows up as one line with **Open** while it is asking the person, and when\nit finished, failed or reported during the latest turn; the sidebar lists the rest. Workers the orchestrator\nstarts stay terminal tabs. Agent Farm's standard resume template\n(`{command} --resume {sessionId}`, which the dialog saves) doesn't stop a chat,\nsince a chat reopens through ACP. Sessions that resume or promote a terminal\nconversation, run in WSL, or use a truly custom resume command or a wrapper\nlaunch keep their terminal, and the Session's overview says why. A\nSession keeps the kind of tab it started with.\nA Session already running in a terminal can move to chat with\n**Switch to chat…** in the Session's right-click menu, which switches every\nterminal agent tab in it (see\n[CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)).\n\n**New** at the top of the sidebar opens one dialog with a Session/Pane toggle\non top and that kind's form below. When the desktop has saved other machines,\na **Machine** picker sits between them. It starts on the machine you last\ncreated on from this computer (the first time, the machine the app is on) and\ndims machines that are offline or still connecting; they can't be picked until\nthey answer. Repositories, branches, WSL distributions and agents come from the\npicked machine. Create runs there; Pane then switches to that machine and opens\nwhat you created. A Pane created on another machine starts at the repository\nlevel and does not join the Session you have open.\n\nThe Sessions section below the divider can be collapsed from its header; the\n`+` remains available while it is collapsed. Sessions are opened from this\nsection rather than from a duplicate top navigation shortcut.\n\nA Session is a persistent coordination conversation with its own scratch\nworkspace. Its default profile supports discussion, investigation, decisions,\nand delegation when authorized work benefits from it. No particular skill,\nticket system, model, or Agent Farm installation is required. Users can select\nskills and workflows without Pane imposing an implementation pipeline.\n\n## The Onboarding Session\n\nOn a new data folder, the default Session is named Onboarding. It is where a\nnew person starts: the first-run screen hands off to it (see [Bring your\nexisting sessions into Pane](#bring-your-existing-sessions-into-pane)), and its\nagent gives each later task a Session of its own. Archive it like any Session\nwhen you are done with it; Pane does not recreate it. Installs from before the\nfirst-run screen keep the name Pane Chat.\n\n## Upgrading from Pane Chat\n\nExisting Pane Chat opens under Sessions automatically, keeping its name and all\nagent conversations together. Switching agents resumes that agent's existing\npanel and history in the same stable private Session workspace. Opening the\nSession does not submit a prompt or authorize new work.\n\nEarlier development versions split old agent histories into supplemental\nSessions. Untouched imports with only generated workspace files and no competing\nconversation are reunited with the original Session. Imports with files, settings changes, or\nadditional conversations remain separate to preserve that work. Those retained\nSessions receive independent internal owners while keeping their names, folders,\npanel IDs, saved histories, and settings. Interrupted ownership moves resume on\nstartup; no transcript or workspace files are deleted by this migration.\n\n## Launch configuration and profile\n\nSessions use the same built-in launch presets and saved custom commands as\nordinary project/worktree panels, including custom arguments. The application\ndefault seeds new Sessions. Creating a Session remembers its launch command and\narguments for the next creation; cancelling, or a create Pane refuses, leaves that default unchanged.\nSelecting the agent default clears the remembered custom command. Each Session saves its own launch configuration\nand behavior profile. Changing defaults does not overwrite existing Sessions.\nLaunch changes take effect on the next explicit restart.\nUse **Edit behavior…** during creation or in Session settings to open the\nseparate profile editor. **Back** discards the draft; **Save behavior** applies it\nto the form, which is persisted when you create the Session or save settings.\n\nThe command, behavior profile, and saved task context have separate purposes.\nA command selects how the agent runs; a profile describes how it should behave;\nsaved goals, decisions, and next actions help it respond to later user input.\nCustom commands (including Agent Farm wrappers) retain their arguments. Pane\nonly adds native flags through compatible built-in adapters, an explicit custom\ncommand resume config, or Agent Farm's resume contract (see\n[Resuming custom launchers](#resuming-custom-launchers)). Wrappers keep control of\ninstruction discovery; apart from that one Agent Farm exception, Pane does not\ninfer flags from a wrapper name. A user command that explicitly starts work\nremains the user's choice.\n\nAn OpenCode Session runs `opencode` directly: its launch command may add\narguments, assignments or an `env NAME=value` prefix, but not a wrapper\n(`bash -c opencode`), a wrapped launch or a custom command resume. Pane refuses\nthose before anything starts, with `ERR_SESSION_OPENCODE_LAUNCH`. An app default\ncommand or custom resume that doesn't suit OpenCode is left out when a Session\nis created with the OpenCode agent. Pane resumes the conversation id OpenCode\nprints when it exits (`Continue opencode -s <id>`); a conversation still open\nwhen Pane quits has no saved id yet and starts fresh. Loops run Claude, Codex or\nCursor, so the Loop editor doesn't offer OpenCode Sessions.\n\nEach Session owns a stable folder at `<PANE_DIR>/sessions/<session-id>/` for\nnotes, plans, attachments, generated instructions, and artifacts. Renaming\nand reopening keep this folder. Archiving keeps it for 14 days (**Settings →\nWorktrees & Git → Keep archived folders**), then Pane deletes it, first moving\nany agent logs inside it to `<pane-dir>/agent-logs/` (see\n[The scratch folder](#the-scratch-folder)); restoring the Session before then\nkeeps it. A Session archived before this retention existed counts its 14 days\nfrom the first launch of the Pane version that added it. These folders are not Git worktrees or security sandboxes.\nProject implementation belongs in an appropriate Pane/worktree.\n\n## Windows and WSL runtimes\n\nOn Windows, **Create Session → Run agent in** appears directly below the agent\npicker when WSL reports installed distributions. Windows is the default on every\ncreation. Choose a named distribution to run the agent there; install the agent\ninside that distribution first. Cursor is available when WSL is selected.\nThe runtime and distribution belong to the Session and survive reopening,\napplication restart, and terminal supervisor restart. Only WSL Sessions carry a\n`runtime` (`\"wsl\"`); a Session on the native host omits it on every OS. Older\nrecords that stored `\"windows\"` for the native host lose the field when read.\nIf creation fails before publishing a terminal owner, Pane removes untouched\ngenerated files so the name can be retried; user files or edits prevent rollback.\n\nWSL Sessions retain their durable files under the Windows Pane data directory.\nTheir agent sees Linux paths such as `/mnt/c/Users/.../.pane/sessions/...`.\nThis uses Pane's existing Windows-to-WSL path conversion and requires the default\n`/mnt/<drive>` automount layout; custom `[automount] root` settings are not supported.\nGenerated `AGENTS.md` points to a Session-specific `runtime-context.md`; this\ncontext takes precedence over the shared Pane Chat routing instructions.\n\nEach WSL Session gets a managed `.pane-runtime/runpane` wrapper on PATH, also\navailable as `$PANE_RUNPANE_BIN`. It invokes this build's bundled Windows CLI via\nPowerShell interop from Windows TEMP, so the CLI can reach this Pane instance's\nnamed pipe. Arguments cross as JSON to preserve quotes and Unicode. Temporary\nfiles beside the bridge carry payloads without Windows command-line size limits\nand are removed when the call exits; stdin remains available to the CLI. File flags\naccept relative or absolute Linux paths (including `--flag=value`); `-` retains\nstdin semantics. `--repo` translates absolute Linux paths and explicit relative\npaths (`.`, `..`, `./...`, `../...`) while preserving repository names and IDs.\nPaths inside JSON request bodies must use Windows paths, and\nWindows paths returned by the CLI can be read in WSL after `wslpath -u` conversion.\nThe bridge pins `--pane-dir` to this instance and preserves the calling Session\nand panel identities. PowerShell is invoked by its mounted Windows path, so\n`appendWindowsPath=false` is supported. WSL interop must be enabled; a Linux-installed RunPane CLI\ncannot replace this bridge for a Windows daemon.\n\nFor CLI JSON creation, `runtime: \"wsl\"` and `wslDistribution: \"Ubuntu-24.04\"`\nselect an installed distribution; omitted runtime selects the native host.\n`runtime: \"windows\"` is still accepted as a legacy name for the native host and is\nnot stored.\n\n## Resuming custom launchers\n\nUse **Enable custom command resume** in Session launch settings or a saved custom\ncommand's editor. This is an explicit contract, independent of executable names.\nAgent Farm is the one exception, described in [Agent Farm](#agent-farm) below.\nChoose a session ID source and provide first-launch and resume templates:\n\n- **Claude:** Pane allocates a UUID and resumes it only when its transcript exists.\n- **Codex / Cursor:** Pane captures the native resume ID from terminal output.\n OpenCode does the same without this setting (see\n [Launch configuration and profile](#launch-configuration-and-profile)); OpenCode\n Sessions refuse custom command resume.\n- **Pane allocates an ID:** for other CLIs that accept a caller-provided ID.\n- **CLI reports its ID:** the CLI or wrapper prints a standalone newline-terminated\n `PANE_AGENT_SESSION_ID=your-session-id` line. IDs may contain letters, digits,\n periods, underscores, colons, and hyphens (up to 256 characters).\n\n`{command}` expands to the saved command; `{sessionId}` expands to the quoted ID.\nLeave the ID placeholder unquoted. For a launcher that forwards native arguments\nthrough `--`, Claude templates could be `{command} -- --session-id {sessionId}`\nand `{command} -- --resume {sessionId}`. Codex could use `{command}` initially\nand `{command} -- resume {sessionId}` on resume. These are user configuration\nexamples, not automatic wrapper detection. Other CLIs can use other syntax.\n\nThe configuration and ID persist with the panel. Without a captured ID, Pane\nuses the first-launch template instead of guessing a latest conversation. Saved\ncustom commands copy their resume settings into new panels; changing the saved\nshortcut does not change existing panels. Session settings support changing or\ndisabling the contract for that Session's next launch. No prompt is submitted just\nto resume. Old conversations whose IDs were never saved cannot be recovered\nautomatically; use an explicit resume command if you know their ID.\n\n### Agent Farm\n\nAgent Farm is the one launcher Pane recognizes by name, because Agent Farm\npublishes this contract for Pane: when `PANE_PANEL_ID` is set it prints\n`PANE_AGENT_SESSION_ID=<launch id>` once, before the agent starts, and documents\n`{command} --resume <id>` as the way to reopen that conversation. Pane keeps the\nfirst ID line of each launch and ignores later ones, which can only be agent\noutput. Every other wrapper still needs an explicit config.\n\nThe launch ID is only where the conversation started: `/clear` and `/resume`\nmove Claude to another one. Agent Farm's compiled Claude plugin therefore also\ncarries a `SessionStart` hook that runs `runpane panels conversation --hook` on\nstart, `/resume`, `/clear` and compact (D-269). Pane saves the reported\nconversation on the tab, ahead of the launch ID, so a restart resumes the\nconversation the tab was last on and Switch to chat opens it. The hook does\nnothing outside Pane and prints nothing. With an older Agent Farm there is no\nreport, and Switch to chat opens the folder's most recent conversation instead\n(see [CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)).\n\nA command counts when it is a single `agent-farm run <profile>` or\n`agent-farm agent <profile>`, optionally preceded by `VAR=value` assignments,\nwith no shell operators, no `--`, and no `--resume` of its own. `npx`, `pnpm dlx`\nand aliases do not count. Such a panel with no explicit config behaves as\n**CLI reports its ID** with templates `{command}` and\n`{command} --resume {sessionId}`: Pane saves the printed ID and relaunches with\nit. The editor says so under the unticked checkbox. An explicit config always\nwins: tick **Enable custom command resume** and set your own templates.\n\nA panel created before this rule usually has no saved ID. On its next relaunch Pane\nmakes one attempt to read the last `PANE_AGENT_SESSION_ID=` line from the\npanel's saved terminal buffer. Agent Farm older than 0.2.20 prints no ID, so\nthose panels relaunch fresh, as before.\n\nTo reopen an older conversation by hand, run\n`agent-farm run <profile> --resume <id>`. The ID is the launch ID (the\n`PANE_AGENT_SESSION_ID` value), shown as `resumeId` in\n`runpane panels list --json`. Agent Farm keeps launch records in\n`~/.local/state/agent-farm/launches/` for 90 days.\n\n## Session sidebar and archive\n\nPinned is the first sidebar category and can contain both Session chats and\nPanes. Right-click a Session, or use the ⋯ button that appears on hover, to pin or unpin it, or turn on **Start pinned** in\nCreate Session to pin it from the start. The dialog remembers that toggle for\nthe next Session (on the desktop in Pane's config, in the remote web app on\nthat device). The pin preference survives restarts; an archived Session stays\nout of Pinned until it is restored. RunPane can set the same preference with\n`sessions pin` or `sessions unpin --session <id|name>`. Create JSON accepts\n`isPinned` (default false), and update JSON accepts it without changing the\npreference when omitted.\n\nDrag a Session up or down in Pinned, in Sessions, or in the compact rail to\nchange its place; a line shows where it will land. With a Session row focused,\n**Alt+↑** and **Alt+↓** move it one place and a screen reader hears its new\nposition. A drag or keypress reorders only the list it starts in: Pinned\nSessions move among themselves, and a Session dragged across the Pinned line\nstays where it was. The order is saved on the host, so every desktop, the phone\nand `runpane sessions list` show it, and it survives restarts. New Sessions\nstart at the top. A host that has never saved an order lists Sessions newest\nfirst. A host running an older Pane cannot save an order: the list snaps back\nand the error says to update Pane on that host. Dragging a Session onto the\nworkspace still tiles it.\n\nIn the sidebar's **All machines** view, Sessions from every machine form one\nlist you arrange the same way, by drag or **Alt+↑**/**Alt+↓**. That arrangement\nis saved on the computer you are looking from, not on any machine it shows: two\ncomputers keep two arrangements, and each machine's own order (its one-computer\nview, the phone and `runpane sessions list`) is unchanged. The first time a\nmachine answers on this computer, its Sessions join the arrangement in that\nmachine's own order, after the Sessions of machines listed before it in the\nmachine menu, so a first look follows the menu however late each machine\nanswers. A Session that appears after that, such as\na new one, goes first whether or not you have moved anything; agent status and\nactivity never move a row.\n\nClick a Session row to open its chat, or find it by name in Search (`⌘⇧P` /\n`Ctrl+Shift+P`, or the Search field above **New**), which also has **New Session**. A Session with associated Panes shows a\nchevron that expands or collapses them; a Session without Panes shows none.\nEvery Session starts collapsed, including a new one and one that just got its\nfirst Pane, until you press its chevron. Opening the Session's chat, an agent\nadding Panes, or `runpane` focusing one of its Panes leaves it collapsed. Each\ndevice remembers the Sessions you opened, separately for each host: the\ndesktop in its own settings, the remote web app (PWA) in browser storage\n(`pane.remotePwa.expandedSessions@<host id>`). Opening a Session under Pinned\nopens it under Sessions too. The native iOS and Android app does not follow\nthis yet: its Sessions start expanded and it forgets on restart.\nChild Pane rows are indented beyond the Session chat icon and keep the ordinary\nPane actions. Create Pane, opened while a Session is showing, has an\n**Add to <Session>** checkbox, on by default, that files the new Pane under that\nSession. A Pane that belongs to a Session names it in the window title bar as\n\"<Session> › <Pane>\"; click the Session name to go back to it. To file an\nexisting Pane under a Session, right-click the Pane, choose\n**Add to Session**, then pick the Session. **Remove from <Session>** in the same\nmenu takes it out again; the Pane and its worktree are unchanged. Pinned Pane\nrows show the Pane name with its repository muted beside it. Single-line Pane rows omit change counts and PR numbers; the\noptional two-row layout shows those details below the title. Session and Pane\ncontext menus use compact widths.\n\nUnder each repository, drag a Pane up or down to change its place, or move a\nfocused Pane row with **Alt+↑** and **Alt+↓**; a line shows where it will land\nand a screen reader hears its new position. The order is saved on the machine\nthe Pane runs on (its `display_order`), so the phone shows it too, and agent\nactivity, renames and archiving other Panes never move a row. A new Pane lands\nat the top. **Sort** in the sidebar's **⋯** menu is an action on that machine:\n**Sort: Newest first** or **Sort: Oldest first** (the current one says\n*Current*) re-sorts every repository's Panes once by creation and sets where\nnew Panes land (top under Newest first, bottom\nunder Oldest first); drags made afterwards hold. A machine running an older\nPane cannot save a Pane order: the list snaps back and the error says to update\nPane on that host. Commands: `sessions:reorder-in-project` (`{ projectId,\npaneIds }`; the listed Panes trade the places they hold, unknown ids are\nignored, timestamps are kept), `sessions:sort-panes` (`{ order: \"newest\" |\n\"oldest\" }`) and `sessions:get-pane-order` (`{ newPanes: \"top\" | \"bottom\",\nchosen }`).\n\n### The Session row's icon\n\nA Session row's icon spins only while the Session really works, and is an empty\ngrey ring otherwise; it is never red (the amber approvals count and the expanded\nPane rows show what needs you). It spins once the orchestrator's agent tab, or\nan agent tab in one of the Session's Panes (not archived), has been mid-turn\nwithout a break for 10 s, and stops 10 s after the last one ends, so a short\nwake-up never shows. Mid-turn is stricter than a Pane's own status dot:\n\n- A terminal agent needs its working chrome on screen (the spinner in its title,\n its thinking or working line), and that screen must have changed in the last\n 15 s. Output alone (a dev server, typing, a redraw) never counts, and a frozen\n spinner stops counting.\n- A chat tab needs an open turn that sent an update in the last 5 minutes, or a\n tool call still running.\n- A tab waiting on `runpane watch`, `runpane panels wait`, `runpane notify` or\n `runpane secrets request` is waiting, not working. A chat tab counts as\n waiting only while the tool call it is running is that wait; one sent to the\n background doesn't hide its real turns. A terminal tab counts as waiting\n while any such call from it is open, so an orchestrator in a terminal tab\n with a background watch or card open doesn't spin the Session on its own;\n its workers do.\n- A permission prompt, a menu, a usage-limit screen, a plain shell, and anything\n Pane cannot tell, read as idle.\n\nThe host that runs the agents decides this once and tells every client, so the\nsidebar, All machines (each machine's Sessions by that machine) and the web and\nphone apps agree; while a client can't reach the host it shows the Session\nidle, and a reconnect reads it again. \"N working\" counts the Panes with\na working tab by the same rule. A machine that is offline, or too old to report\nit, shows its Sessions idle.\n\nThe experimental **Attention inbox** (Settings > Advanced > Experimental) turns\nthe Projects list into an Inbox of the Panes that need you: an agent waiting on\ninput or approval, an agent that completed a real turn since Pane started (it\nworked on a prompt and went idle; a freshly started agent does not count), or a\nPane that errored. Session child rows follow the same filter, and a Session row still\ncounts all of its Panes. A row leaves when its agent works again; opening it\ndoes not remove it. Hover a row and choose **Dismiss** (check mark) to hide it\nuntil its agent works again. The row under the Inbox counts the hidden Panes\n(\"3 running · 1 idle\") and **Show all** lists every Pane. Pinned rows are\nunchanged, and ⌘1–9 number the Inbox rows while it is shown.\n\nThe right sidebar has Overview, Files, and Changes tabs. When the Session\nfolder holds a status page at `session/index.html` (an orchestrator renders it\nthere from a status JSON with the `orchestrate-sessions` skill's bundled\nrenderer), Overview shows that page under a header with the Session name, Rename,\n**Open beside chat** (the page full-size in the split, in the tab already\nshowing it) and **Show Session details** (the record described next). Pane checks for\nthe page each time the Session refreshes. Links in the page to\n`pane://open?pane=<id>&panel=<id>` open that tab and show its oldest waiting\nquestion in Approvals, as Open in Pane does; other links open as a browser tab beside chat. A client connected to\na remote host shows the record only. Without a page, Overview shows the\nSession's blockers, goal, next step, and decisions when they are set, then its\nPanes and recent activity. Each Pane card lists the Session's tabs in that Pane\nwith their type icons: every tab when the Pane is linked whole, with Files and\nChanges last, or exactly the tabs a link names. Click a tab to open the Pane on\nit; Files and Changes open in the Pane's inspector. A Pane on another saved\nmachine ([workers on another machine](RUNPANE_WORKSPACES.md#workers-on-another-machine-join-your-session))\nshows \"On <machine>\" with its tabs' states as that machine reports them, or\n\"unreachable\" when it doesn't answer, or \"needs a Pane update\" when its Pane is\ntoo old to report here; its card is read-only and opens from All machines. Agent state changes stay out\nof Activity; the status dot shows them. Files browses the Session workspace.\nChanges summarizes the Session's Panes and opens a Pane for detailed review. The upper-right sidebar\nbutton shows or hides the selected tab. A single Session uses two rows at the\ntop: the window title bar shows its name and controls, and the tab strip sits\ndirectly below it. Session file clicks open editor tabs beside the agent tab in\nthat strip. These tabs can be selected and closed directly, and reopening a file\nrestores its tab.\n\n![Two-row Session header in Folio](screenshots/two-row-header-folio.png)\n\n![Two-row Session header in Walnut](screenshots/two-row-header-walnut.png)\n\nRight-click a Session, or use its ⋯ button, to archive it. Archiving a\nSession also archives every Pane associated with it, removing their\nworktrees. When a Pane has work in progress (an agent working or waiting for\nan answer, text typed but not sent, unsaved edits, or uncommitted or unpushed\nwork in its worktree), Pane first lists those Panes and asks: Keep them open\narchives the Session and the rest, Archive all archives them too, Cancel\nchanges nothing. With none, it archives without asking. An \"Archived · Undo\"\ntoast offers to restore the Session and the Panes it archived for a few\nseconds; Undo brings Panes back on their branches, not uncommitted changes.\nArchiving the open Session returns the desktop view to Home. The Session keeps\nits identity, conversation history, and Pane associations. Restore the\nSession from the sidebar’s Archived section, and its Panes from the Archived\nPanes list.\n\nThe Session update contract accepts `archived: true` or `archived: false`.\n`archived: true` archives the associated Panes on the host, whoever sends it\n(phone, `runpane sessions update`); a Pane with work in progress stays open.\n`runpane sessions update` reports what happened in `panes`: `archivedPaneIds`,\n`keptPanes` (with the block `code`) and `failedPanes` (with the `error`).\n\nThe desktop uses two channels. `orchestration-sessions:archive-preview` lists\nthe Panes an archive would take, each with the `blocked` code `runpane panes\narchive --pane` would refuse it with, and changes nothing.\n`orchestration-sessions:archive` takes the Panes the person approved,\n`{ archivePaneIds, forcePaneIds }`: it archives the Session and those Panes\nonly, checks `archivePaneIds` again (one that became unsafe stays open),\narchives `forcePaneIds` as chosen, and returns the same `archivedPaneIds`,\n`keptPanes` and `failedPanes` for the toast and Undo.\n\nList results retain archived records, in the saved order; active navigation\nfilters them. An archived Session keeps its place, so Undo or Restore puts it\nback where it was.\n\n`orchestration-sessions:reorder` takes `{ sessionIds }`. The listed Sessions\ntrade the places they already hold, so a list that shows only some Sessions\n(Pinned, or the active ones while others are archived) rearranges just those;\nunknown ids are ignored. It writes an optional `order` id list beside the\nSessions in `orchestration-sessions.json` (the store stays at version 1) and\nchanges no Session's revision, `updatedAt` or activity. An older Pane reading\nthe file ignores `order`, lists Sessions in its own default order, and drops it the next\ntime it writes. Archiving the selected Session chooses an available active\nSession or clears the selection if none remain. Restoring a Session does not\nreplace an unrelated selection.\n\n### Move a Session to another machine\n\nRight-click a Session, or use its ⋯ button, and choose **Move to machine…** to\ncontinue it on another machine. The dialog lists your Tailscale machines\nrunning Pane, except the one the Session is on, and your teammates' machines\nrunning Pane, shown with the owner's login after the name. A teammate's machine\nis a target only when its owner set Who can connect to Everyone on tailnet.\nMachines Pane can't reach, or that accept only their owner, are shown disabled\nwith the reason. If none can be reached, it says so:\nopen Pane on the other machine, or sign in to Tailscale. While you view a host\nconnected with a pairing code rather than over Tailscale, the item is disabled,\nbecause Pane can't tell which machine that is. In All machines, the same item\nis in each Session's menu and moves the Session from its own machine, without\nswitching to it; it is disabled, with the reason, while that machine isn't\nconnected or was paired with a code. Choosing a machine\nsends the Session's agent a prompt to hand the Session off with\n[`runpane handoff`](RUNPANE_WORKSPACES.md#hand-a-task-to-another-machine) and\nthe `handoff` skill.\n\nThe agent writes a handoff note, and handoff creates a Session on that machine\nwith the same name (numbered \"<name> 2\" if the name is taken), goal and agent.\nIts next action is to read the note, which handoff saved in that machine's\n`~/.pane/handoffs/`. When the new Session uses the same agent, the conversation\nmoves too: its agent session's files are copied to that machine, and the new\nSession resumes that conversation when you first open it. Check that it shows\nthe last message, and if that is unclear, ask it what it was last working on.\nWith a different agent, or `--note-only`, only the note moves and the new\nSession starts fresh from it. Like every Session, it waits for your first\nmessage: switch to that machine, open the Session, and send \"continue\". The\nSession folder and its Panes stay where they are, and the original Session is\nnot archived; archive it from the same menu when you are done with it, which\nalso archives its Panes on this machine.\n\n## Bring your existing sessions into Pane\n\nOn a new install, Pane's first-run screen asks two things before anything\nelse:\n\n1. **Which agent do you use?** Claude Code, Codex or Cursor, showing only the\n agents this computer supports. An agent whose CLI Pane can't find says \"Not\n found on this computer\", with an install link. The screen says Pane runs it\n with its permission prompts off, as Pane always launches these agents.\n When Claude Code then shows its one-time bypass-permissions warning in the\n Onboarding Session, Pane answers \"Yes, I accept\" in the terminal, and Claude\n records the acceptance itself. Pane never edits Claude's config files while\n Claude may be running. The pick becomes the Onboarding Session's agent and\n the default for new Sessions (Settings → AI & Agents).\n2. **Bring your N sessions into Pane?** Pane looks for sessions from Claude\n Code, Codex, Conductor, Paradev (formerly Superset), Herdr, Emdash, Orca\n and T3 Code on this computer and counts those running now or used in the last 7 days. Pane opens\n them in place and deletes nothing.\n\n**Yes** is the confirmation: the screen closes, the Onboarding Session opens,\nand its agent runs the `migrate-to-pane` skill below on that set with no list\nto confirm. It groups the work into one Session per workstream, says what a\nSession, a Pane and a tab are the first time it makes one, and ends by opening\na Start here page beside the chat. The page lists your workstreams, a receipt\nof what came over and what was left out (with why), what you can undo, the\nwords Pane uses, and 3 to 5 things to try next with prompts naming your own\nrepositories. The page is saved as `<PANE_DIR>/migrate-to-pane/start-here.html`.\n\n**Not now**, or nothing found, shows \"Open your project\" (your repositories, a\nfolder, a GitHub clone, or a sample repository). Opening one, or skipping, also\nlands in the Onboarding Session, whose agent makes a Start here page for that\nproject, without the receipt. Without Git, the screen shows only how to\ninstall it.\n\nSettings → AI & Agents → \"Bring sessions into Pane\" → **Find sessions** brings\nidle sessions in with one click at any time:\n\n- Pane reads each tool's session list locally (metadata only; SQLite stores\n from a temporary copy) and lists sessions active in the last 30 days, one row\n per tool. Sessions from the last 7 days are preselected, at most 3 per\n checkout; click a row to choose sessions. Paradev's sessions are read from\n `~/.paradev` and `~/.superset` (its folder before Paradev 2.0.4), or from\n `SUPERSET_HOME_DIR` when it is set.\n- **Bring them in** adopts each checkout in place as a Pane, with one tab per\n session resumed by the agent's own id. A transcript kept in a tool's own agent\n folder is first copied into your own Claude Code or Codex store.\n- Sessions still running elsewhere are listed but can't be chosen, and\n neither can other sessions in the same checkout; quit them and press **Check\n again**, or use the skill below, which forks them. A tab\n whose agent exits without resuming is closed and reported, and a new Pane\n whose sessions all failed is removed. A tab waiting at the agent's\n folder-trust prompt, or whose agent is still starting, stays open for you.\n- The card and the skill share the record below, so neither brings a session\n in twice.\n\nSay \"migrate to Pane\" in any Session, or Yes on the first-run screen, and the\n`migrate-to-pane` skill brings the conversations you already have in other\nagent tools (Claude Code, Codex, OpenCode, the Cursor agent, Conductor, or\nanything similar) into Pane tabs:\n\n- It reads session metadata on this machine, including WSL distros and agents\n running in other terminals or editors, and shows one list grouped by\n repository. Running sessions and those active in the last 7 days are\n preselected; older ones can be added. Nothing is created until you confirm.\n After a Yes on the first-run screen, it places that preselected set without\n showing the list.\n- An idle session's checkout is adopted in place (`runpane panes adopt\n --resume`); several sessions in one checkout become tabs in one Pane. A\n session still running elsewhere is forked with its own tool into a new Pane\n on a new branch, with your uncommitted and untracked files copied, and the\n original keeps running untouched.\n- Each tab is resumed by its agent's own resume-by-id and must pass the\n continuity check in the skill's `references/continuity.md` (same native\n session, a restart comes back to it, history loaded, original untouched)\n before it is reported as continued. A session that fails is reported as not\n continued with the reason and next step, never replaced by a fresh agent.\n- It keeps a record in `<PANE_DIR>/migrate-to-pane/record.json`, so running it\n again lists what is already in Pane and creates nothing twice. Archiving an\n adopted Pane keeps your checkout.\n\n## Session startup\n\nCreating, opening, restoring, restarting, or switching the agent in a Session\ndoes not submit a bootstrap message. The terminal waits for user input with\nits role, profile, and Pane capability instructions available. There is no\nautomatic greeting, diagnostic sweep, watcher setup, or continuation of a\nsaved next action. Reopening an already-running Session reconnects without\ninterrupting work the user has already authorized.\n\nThere are two exceptions, each at most once per Pane data directory.\n\nThe first time the Onboarding Session launches after the first-run screen,\nPane sends it one prompt, which says that Pane sent it and why. After Yes, the\nprompt tells the agent to bring in the sessions you said yes to; after Not now,\nto make a Start here page for the project you opened. The screen saves your\nanswer in the `onboarding_handoff` user preference (`migrate` or `project`).\nPane records the prompt in the `pane_chat_migrate_offer_sent` user preference\nonce a launch has sent it, so a restart or an agent switch never sends it\nagain. Installs that never showed the screen get no prompt. See\n[Bring your existing sessions into Pane](#bring-your-existing-sessions-into-pane).\n\nPane may also offer Pane Chat once, in a card over a Pane, after you have\ncreated at least two worktree Panes and used Pane on at least three days, if you\nhave never created a Session. \"Try it\" creates a Session named after the Pane's\nrepository, whose agent introduces itself, suggests two small tasks from that\nrepository, and waits for your answer before starting any Pane. Pane removes\nthat opening prompt from the Session once a launch has sent it, so a restart\nnever sends it again.\n\nPane may prepare instruction files and terminal infrastructure at startup;\nthat preparation does not require an agent turn. Unattended work and watchers\nare separate, explicitly authorized activities.\n\n## Shared tools and authority\n\nSession orchestrators and regular agent panels share RunPane's coordination\ncapabilities. Use `runpane doctor --json` and `runpane agent-context --json`\nwhen the task requires those capabilities, and discover individual schemas\nwith `runpane agent-context --command \"<command>\" --json`.\n\nAn associated worker completes its assignment and reports results or blockers\nto its owning Session. Reporting is participation. Creating workers, assigning\nwork, redirecting agents, or changing ownership requires a user request or an\nexplicitly delegated task with that authority. Existing authorization persists\nwithin its scope. An independent Pane works locally unless coordination is\nrequested. Tool availability does not authorize unrelated work or automatic\nsharing of other conversations.\n\n## One Pane per feature\n\n**Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it.** `runpane doctor` prints the full working rules.\n\nA feature here means one branch and its PR. A new Pane creates a worktree that\nchecks out the repository, installs dependencies and often builds, so it is\nexpensive, and creating several at once can freeze the machine. An\norchestrator creates a Pane with `runpane panes create` only when the work's\nbranch has no Pane yet: new work, or an existing PR with no Pane.\n\nPane enforces both: `panes create --branch` refuses a branch another Pane has\nchecked out (code `ERR_RUNPANE_BRANCH_HAS_PANE`, naming that Pane), and at most\n2 Panes run setup at once while the rest wait in line.\n\nEvery later agent for that feature runs inside its Pane as a new agent tab:\nimplementer, reviewer, follow-up reviewer, auditor, fix implementer and QA. Each tab is a\nfresh agent with its own context, sharing the Pane's worktree and branch:\n\n```text\nrunpane panels create --pane <feature-pane-id> --tool-command \"<agent command>\" --source agent --no-focus --wait-ready --yes --json\n```\n\nBefore `runpane panes create`, find the work's Pane with\n`runpane panes list --repo <repo> --json`, matching the PR's head branch\n(`gh pr view <n> --json headRefName`) against\n`git -C <worktreePath> branch --show-current`, and use it when it exists.\n\nTabs share one checkout. Only the implementer changes the branch or HEAD, one\nwriter at a time, and a fix tab starts only after the previous writer has\nstopped. Review, audit and QA tabs never run `git checkout`, `reset` or\n`stash`. Never create a Pane to review, audit, fix or QA work that already has\none. Keep the\nfeature's Pane until its PR merges or closes, so later tabs still have the\nworktree; archive it then.\n\n## Pane association before delegation\n\nManagement is a Pane-level relationship; tabs inherit the relationship and\nshare the Pane's worktree. Panes created or adopted with `runpane panes\ncreate` or `panes adopt` from inside a Session are associated with it in the\nsame call: from the orchestrator (the CLI reads `PANE_ORCHESTRATION_SESSION_ID`)\nor from any tab in a Pane that belongs to the open Session (Pane looks up the\ncalling tab, `$PANE_PANEL_ID`). Each result item reports `association: {\nsessionId, ok, error? }`, and `--no-associate` opts out. A failed association never undoes the new Pane. Before delegating to an\nexisting Pane, or when automatic association failed, the orchestrator\nassociates it explicitly. The supported command is:\n\n```text\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\n```\n\nVerify the result with `runpane sessions overview` and reuse an existing\nassociation. A Pane already managed by another Session is a conflict: do not\ndetach, reassign, or create a duplicate Pane. When a prompt is passed to `panes\ncreate`, check the item's `association.ok` right away. Keep a Pane attached through idle and completion; do not detach on\ncompletion. Archiving preserves the association.\n\nTo close out finished work, `runpane panes archive --session <id|name> --merged\n[--closed] [--remove-worktree] [--dry-run] --yes --json` archives each\nassociated Pane when all of these hold:\n\n- **Its PR is merged** (or, with `--closed`, closed without merging). Pane\n looks the PR up by the Pane's branch on GitHub (`pr`). An open PR is skipped\n as `pr-open`, because its review, fix and QA tabs still need the worktree.\n No PR, or without `--closed` a PR closed without merging, is skipped as\n `pr-not-merged`, so a worker that has pushed but not opened its PR keeps its\n Pane. A PR state GitHub can't confirm is skipped as `pr-status-unknown`.\n- **No agent in it is mid-turn.** A Pane with a working agent is kept as\n `agent-busy`; archiving would stop it. A Pane with a tab holding text typed\n but not sent, or an editor with unsaved edits, is kept as `unsent-input`;\n archiving would lose it. `runpane panes archive --pane <id>` checks the same.\n- **Its worktree holds no unsaved work.** It has no uncommitted or untracked\n changes, and every commit is on its upstream after a fresh `git fetch`, or,\n without an upstream, on a remote-tracking branch or the base branch. A\n failed fetch or unreadable worktree is skipped as `status-unknown`. This\n check runs after the PR lookup, right before the worktree is removed.\n\nEvery skipped Pane has a `skipped.code` and a message with the next step.\n`--remove-worktree` also removes adopted worktrees; local branches are always\nkept. Run it with `--dry-run` first.\n\n### Keeping a Session tidy\n\nThe generated Session instructions have their own \"Keep the Session tidy\"\nsection (`main/src/services/sessionTidyRules.ts`, used by the Session folder's\n`AGENTS.md` and the generated `pane-orchestrator` skill; the bundled\n`pane-orchestration` skill carries the same rules). The orchestrator cleans up\nas it goes without asking, and says in one line what it closed or archived:\n\n- It keeps one status document in the Session folder, updated in place, and\n links plans, PRs, mock-ups and reports from it. It opens a page beside the\n person only when they need to look at it now, and closes it once that's\n done.\n- It closes tabs it opened once they no longer matter, with\n `runpane panels close --panel <id> --yes --json`. Whether a tab still\n matters is its judgment; Pane refuses only closes that could lose work: a\n tab the person opened (any tab without an agent opener, including every tab\n from before openers were recorded), a permanent tab, an agent mid-turn, and\n unsent composer text. For a stuck worker, or a tab the person asks it to\n close, `--force` closes it anyway, as the tab's close button does (D-209).\n- It archives a feature's Pane after a clean `panes archive --pane <id>\n --dry-run --json` once its PR merged or closed, including right after a\n merge the person asked for. It keeps a Pane with unsaved work or a busy\n agent and says why. It never passes `--force` and never touches another\n Session's Panes or tabs.\n\n`/wrap-up` wraps up a Session in one step. Pane ships it as the bundled `wrap-up`\nskill and writes a copy into each Session folder, at\n`.claude/skills/wrap-up/SKILL.md` (Claude Code, typed as `/wrap-up`) and\n`.agents/skills/wrap-up/SKILL.md` (Codex, as `$wrap-up` or from `/skills`).\nThe Session's `AGENTS.md` points every orchestrator, Agent Farm's included, at\nit for \"wrap up\" in plain words. Workers in feature Panes start in their own\nworktree and don't get it. Pane rewrites the copies on launch unless you\nreplaced one with your own (it has no Pane marker). It:\n\n1. Takes stock: the work list, `sessions overview`, and each PR's live state\n from the archive sweep's dry run (the overview's PR state can lag a merge),\n sorting the Session's Panes into finished, parked (PR open, all pushed,\n nothing running), busy and unsafe (uncommitted or unpushed work).\n2. Tells you first, before archiving anything, about whatever needs your\n attention: uncommitted or unpushed work, open PRs, commits no review\n covered, agents still working and open work-list items. It posts this as\n an info notification and writes it in the conversation; it doesn't ask or\n wait.\n3. Stops its watchers, closes every tab it opened (the status document too),\n archives every Pane whose dry run is clean (parked ones too; their PRs stay\n open), keeps unsafe Panes, and marks the other open work-list items\n dropped. A worker still working keeps its Pane; once it finishes, its Pane\n is archived after a clean dry run.\n4. Ends with its report, always: what it archived, what it kept and why, the\n PRs still open and how to restore a Pane, ending with \"Nothing left to do\n in this Session.\"\n\nIt doesn't archive the Session: the Session stays open with the report in it,\nand you archive it from the sidebar when you're done. It never merges,\ncommits or pushes for a worker, forces, deletes a branch, closes a tab the\nperson opened, or touches anything outside the Session.\n\nBefore mutating, use `runpane agent-context --command 'sessions associate'\n--json` to confirm the wrapper supports the command. If an older global CLI\ndoes not, select and verify the app-compatible dev wrapper from the Pane\nruntime context before proceeding. Never silently continue without the\nassociation or substitute an unverified global/`npx` wrapper.\n\nSessions do not create worktrees and do not edit project implementation files.\nAn association identifies work that a Session coordinates; it does not grant\nimplementation authority by itself. Detach a Pane before assigning it to a\ndifferent Session.\n\n## Worker file access\n\nA worker's agent may be allowed to read only its working directories (Claude\nCode's `permissions.blockReadsOutsideWorkingDirectories`). Its brief and the\nSession files the brief points to must not sit outside them, or the worker\nstops on a permission prompt nobody is watching.\n\n**Briefs and attachments.** `--as-file-pointer` (`panes create`,\n`panels create`, `panels submit`, `agents send`) writes the prompt inside the\nPane's worktree, at `<worktree>/.pane/prompts/<timestamp>.md`, and sends the\none line `Read and follow .pane/prompts/<timestamp>.md`. The path is relative\nto the worktree, where the agent starts: given an absolute path, Claude Code\noften reads it with `cd <worktree>; cat <file>`, which its read check can't\nverify, so it asks. The result's `promptFile` is always absolute. Pane adds `/.pane/prompts/` to the\nrepository's `.git/info/exclude` (never a committed `.gitignore`), so the file\ncan't be committed. `--attach <file>` (repeatable; `panes create`,\n`panels create` and `panels submit`, with `--as-file-pointer`) copies each file\ninto `<worktree>/.pane/prompts/<timestamp>/` and sends\n`Read and follow <path> (attached: <copy>, ...)`, also worktree-relative; the\nresult lists the copies, absolute, in `attachments`. Attach mockups, plans or dispatch notes the worker needs\ninstead of pointing at the Session folder. Without a local git worktree (a\nfolder that is not the top of a checkout, a WSL repo) the file goes to\n`<pane-dir>/prompts/<pane-id>/` as before, and the pointer line names it by\nabsolute path.\n\n**The Session folder.** A Pane associated with a Session gets that Session's\nfolder (`<pane-dir>/sessions/<id>`) as `PANE_SESSION_DIR` in every tab created\nafter the association. The Session's own terminals get it too.\n`PANE_ORCHESTRATION_SESSION_ID` keeps its meaning: it is set only in the\nSession's own terminals, never in a worker's. Workers read the folder and never\nwrite it; the orchestrator is its only writer. What each built-in template gets:\n\n| Agent | Read access to the Session folder |\n| --- | --- |\n| Claude Code (`claude --dangerously-skip-permissions`) | Pane adds `--settings '{\"permissions\":{\"additionalDirectories\":[\"<folder>\"],\"deny\":[\"Edit(/<folder>/**)\"]}}'`. `additionalDirectories` (like `--add-dir`) makes the folder a working directory, which grants read and write; an `allow` rule alone does not lift `blockReadsOutsideWorkingDirectories`. The `Edit` deny rule takes the file tools' write access back (it covers Write too; Claude ignores `Write(path)` rules). Under bypass permissions Bash can still write anywhere, so the read-only rule is a guard, not a sandbox. The folder's `CLAUDE.md` is not loaded. Not added on Windows. At launch Pane merges this value into the tab's one settings file ([Claude's own prompts](PANE_NOTIFY.md#claudes-own-prompts)). |\n| Codex (`codex --yolo`) | Nothing to add: `--yolo` runs without a sandbox, and every Codex sandbox mode reads the whole disk. Codex's `--add-dir` grants write access, so Pane does not pass it. |\n| Cursor, OpenCode, Pi | Only `PANE_SESSION_DIR`. |\n| `--tool-command` wrappers (agent-farm) and custom commands | Only `PANE_SESSION_DIR`; the wrapper maps it to its harness's flag. |\n\nThe flag is fixed when the tab is created: a tab opened before its Pane was\nassociated has no `PANE_SESSION_DIR` until a new tab is created.\n\n### The scratch folder\n\nEvery tab Pane starts gets `PANE_SCRATCH_DIR`, a folder for the agent's\ntemporary files, clones, captures, downloads, logs and test instances (an\nisolated `PANE_DIR` and `HOME` for QA), so nothing lands in `/tmp` where\narchive never reaches it. Pane creates it when the first tab starts:\n\n| Pane | `PANE_SCRATCH_DIR` | Deleted |\n| --- | --- | --- |\n| A worktree Pane created (archive removes the worktree) | `<worktree>/.pane/scratch/`, hidden by the repository's `.git/info/exclude` | With the worktree, on archive |\n| A Pane on the main checkout or an adopted worktree | `<pane-dir>/scratch/<pane-id>/` | 14 days after archive |\n| A Session's own tabs | `<pane-dir>/scratch/<session-pane-id>/` | 14 days after the Session is archived |\n| A WSL project, or a WSL terminal of a worktree Pane created | `<pane-dir>/scratch/<pane-id>/`, as a `/mnt/c/...` path inside WSL | 14 days after archive |\n\nTabs on an SSH host get no `PANE_SCRATCH_DIR`: a folder on this machine means\nnothing on the remote one.\n\nPane never deletes a main checkout or an adopted worktree. The 14 days come\nfrom **Settings → Worktrees & Git → Keep archived folders**; restoring before\nthen keeps the folder. A permanently deleted Pane's scratch goes at the next\nexpiry pass. Pane records each archive time in\n`<pane-dir>/scratch/.archived/<pane-id>`, outside the folders agents write, and\nchecks again right before each delete that the Pane or Session is still archived. Scratch never blocks archive: its files are hidden from\ngit, so they are neither untracked nor uncommitted. `runpane panes archive\n--dry-run` lists the folder with its size, and the date it will be deleted when\nit is kept.\n\nBefore deleting a scratch or Session folder, Pane moves every agent log inside\nit (an agent run with its home there) to\n`<pane-dir>/agent-logs/<agent>/<pane-id>/`, finding them by each agent's\n`transcriptDirs` in the agents config. If a move fails, nothing is deleted.\nUsage & Limits reads `<pane-dir>/agent-logs/` beside `~/.claude/projects` and\n`~/.codex/sessions`. Pane only reads, moves or deletes a folder that sits\nexactly where Pane put it: a scratch folder that is a symbolic link or a\nWindows junction, or is reached through one, is left alone (a link is only\nunlinked), so Pane never moves or deletes anything in the agents' own folders\nin your home.\n\nWrite the folder's absolute path into the brief rather than\n`$PANE_SESSION_DIR`. Under `blockReadsOutsideWorkingDirectories` Claude Code\nasks before any Bash command whose variables it cannot check, so a worker that\nruns `echo $PANE_SESSION_DIR` or `cat \"$PANE_SESSION_DIR/...\"` stops on a\nprompt. The variable is for wrappers and scripts.\n\n## Stable interfaces\n\nThe shared record and service are:\n\n- `shared/types/orchestrationSession.ts`\n- `main/src/services/orchestrationSessionManager.ts`\n- `orchestration-sessions.json` below `PANE_DIR`\n\nThe store has no size or count limit. On load, Pane keeps every Session in the\nfile's `sessions` array that decodes, whatever the file's `version` says, and\ndrops any malformed Session, link or activity entry. An invalid\n`selectedSessionId` or `order` is dropped. Only a file that is not JSON loads\nwith no Sessions. If anything was dropped or repaired, Pane logs it and first\ncopies the file to `orchestration-sessions.json.corrupt-<timestamp>` beside it.\nThe original file stays as it was until the next write.\n\nEach Session keeps its newest 500 activity entries and 1000 inbox items. Set\n`retention` in `config.json` to change either:\n`\"retention\": { \"sessionActivity\": 500, \"sessionInbox\": 1000 }`. A missing or\ninvalid value uses the default.\n\nThe daemon and Electron IPC channels are:\n\n`orchestration-sessions:list`, `orchestration-sessions:select`,\n`orchestration-sessions:create`, `orchestration-sessions:get`,\n`orchestration-sessions:update`, `orchestration-sessions:archive-preview`, `orchestration-sessions:archive`, `orchestration-sessions:reorder`, `orchestration-sessions:set-agent`,\n`orchestration-sessions:associate`, `orchestration-sessions:detach`, and\n`orchestration-sessions:overview`.\n\nSelectors accept a stable Session ID or an exact Session name. Phone apps\nreleased before chat tabs crash on a tab kind they don't know, so clients that\nshow chat tabs pass `{ chatTabs: true }` as a second argument to\n`orchestration-sessions:create`, `orchestration-sessions:get` and `panels:list`\n(desktop, the PWA and current phone apps do). For any other client, `create`\nstarts the orchestrator in a terminal, `get` of a Session whose orchestrator is a\nchat tab fails with `CHAT_TAB_CLIENT_OUTDATED`, which says to update Pane on the\nphone, and `panels:list` leaves chat tabs out. The existing\n`pane-chat:*` channels remain compatibility endpoints for the imported legacy\nconversation.\n\nRunPane exposes the corresponding commands:\n\n```text\nrunpane sessions list --json\nrunpane sessions get --session <session-id-or-name> --json\nrunpane sessions overview --session <session-id-or-name> --json\nrunpane sessions create --from-json <path|-> --json\nrunpane sessions update --session <session-id-or-name> --from-json <path|-> --json\nrunpane sessions pin --session <session-id-or-name> --json\nrunpane sessions unpin --session <session-id-or-name> --json\nrunpane sessions set-agent --session <session-id-or-name> --agent <agent> --json\nrunpane sessions associate --session <session-id-or-name> --pane <pane-id> --json\nrunpane sessions detach --session <session-id-or-name> --pane <pane-id> --json\n```\n\n`sessions create` starts the Session's agent, as opening it in the app does.\nTo give it a first prompt, wait for the agent, then submit:\n\n```text\nrunpane panels wait --panel <panelId> --for ready --json\nrunpane panels submit --panel <panelId> --text \"<prompt>\" --yes --json\n```\n\nWhen a Session's Claude runs on this machine, Pane answers Claude's \"trust\nthis folder\" prompt for the Session's own folder, choosing \"Yes, I trust this\nfolder\" in the terminal, so the agent starts without a click. Pane answers\nonly when the Session launches a plain `claude …` command (the default, or a\ncustom one with no `cd`, wrapper or shell operator), only when the prompt shows\nexactly the Session folder, never a project, and only until Claude is first\nready. This is best effort: a prompt Pane does not recognize, or a folder path\nwith a space in it, stays on screen for you to answer. A WSL Session's Claude\nis not answered, so it asks on its first launch.\n\nUse `--from-json` for structured create and update input. Keep multiline\ncontext, evidence, links, and reports in the JSON file or stdin; do not put\nexternal text into shell source. Re-read mutation results and inspect the\noverview after associations or updates.\n\n### Session JSON shapes\n\n- `decisions` and `blockers` are arrays of strings.\n- `evidence` and `outputs` are arrays of links:\n `{\"label\", \"url\", \"addedAt\", \"kind\"?, \"provenance\"?}`. `url` starts with\n `https://`, `http://`, `file://` or `grain://`; `addedAt` is an ISO 8601\n date; `kind` is `evidence`, `output`, `ticket`, `pull-request` or `other`.\n- `report` (update only) is `{\"summary\", \"status\": \"reported\"|\"verified\",\n \"evidence\": [at least one link], \"reportedAt\", \"provenance\"}`; `null`\n clears it.\n- Arrays replace the stored value, so send the whole list.\n- A bad payload is refused whole with one `ERR_SESSION_PAYLOAD_INVALID` error\n that lists every problem (`outputs[0].addedAt: missing`, ...). The CLI\n checks it before calling Pane, and the daemon checks it again for clients\n such as `runpane-py` (`main/src/services/orchestrationSessionPayload.ts`).\n\n`runpane agent-context --command \"sessions update\"` prints the fields and a\ncomplete example.\n\n## Resume and refresh persisted context\n\nWhen responding to a user task that needs Session state, read\n`PANE_ORCHESTRATION_SESSION_ID` from the current environment. Pane exports this stable identity for\nSession panels, including agent resume paths that do not receive the original\nbootstrap input. Do not infer the Session from a terminal panel ID or from\nconversation text.\n\nWhen the variable is present and the task requires it, reload the saved record\nand then reconcile live\nPane, tab, branch, and evidence state:\n\n```text\nrunpane sessions get --session \"$PANE_ORCHESTRATION_SESSION_ID\" --json\nrunpane sessions overview --session \"$PANE_ORCHESTRATION_SESSION_ID\" --json\n```\n\nRun `get` to recover persisted intent and associations, and run `overview`\nwhen continuing a task after a resume or after a mutation. For workers, this variable does not identify a parent Session. Use `runpane\nsessions list --json` and Pane associations to resolve ownership; never infer\nit from the selected UI Session. Refresh associations before coordinating work. If the\nstable ID cannot be resolved, report the error before taking Session-specific\nactions.\n\n## Identity and overview\n\nEach orchestration Session has a stable ID, a hidden detached Pane session for\nits conversation, and one deterministic terminal panel for each supported\nagent. The imported legacy Pane Chat record retains its legacy internal IDs,\nresume IDs, and terminal buffers. New Session records must not reuse those\nidentities.\n\nLegacy Pane Chat keeps its agent histories together in one Session. Previously\nsplit imports are reunited only when untouched; retained independent imports\nreceive separate hidden owners so their workspace tools cannot cross Sessions.\n\nThe overview joins persisted intent with fresh Pane, tab, branch, worktree,\nagent, and available Git or pull request evidence. Working, idle, stopped,\nexited, missing, and archived states describe activity or availability. They\ndo not prove completion. A completion report must carry inspectable evidence,\nthe report timestamp, and provenance; new activity makes an older report\nstale.\n\n## Named locks for shared resources\n\nWhen several workers share one resource that only one of them may use at a\ntime, such as a test account whose \"approve guest\" banner any logged-in worker\ncan click, name a lock in their prompts. Each worker takes the lock before it\nuses the resource and gives it back after:\n\n```text\nrunpane lock acquire --name testing-account --ttl 30m --wait 1800000 --note \"call QA\" --json\n# ... use the shared account ...\nrunpane lock release --name testing-account --json\n```\n\n- **Owner.** The calling Pane and panel, from `PANE_SESSION_ID` and\n `PANE_PANEL_ID` (or explicit `--pane`/`--panel`). Outside a Pane terminal the\n owner is external and `--note` is required: it names the owner, so pass the\n same note to release.\n- **Scope.** A lock is scoped to the owner's Session when its Pane belongs to\n one (as the Session's orchestrator or an associated Pane), so two Sessions can\n each hold `testing-account`. A Pane outside any Session uses the global scope.\n The scope is fixed when the lock is first taken.\n- **Acquire.** Succeeds when the lock is free, expired, or already held by the\n same owner, which renews the TTL (`renewed: true`). Otherwise it returns\n `ok: false` with `heldBy` and `expiresAt` and exits 1. With `--wait` the call\n blocks in the daemon, which grants the lock to the oldest waiter as soon as it\n is released or expires; the CLI chains daemon calls of up to 120 seconds for\n longer waits.\n- **Release.** Only the owner can release a lock. `--force` releases another\n owner's lock, for example a stuck worker's; add `--session <id|name>` to\n name a Session-scoped lock from outside that Session.\n- **Automatic release.** Pane releases a lock when its TTL (at most 24h) runs\n out, when the owner panel's terminal exits or is closed, and when the owner\n Pane is archived. Quitting Pane does not release locks: the resumed agents\n still expect to hold them.\n- **Storage.** Locks are saved in `locks.json` below `PANE_DIR` with\n temp-and-rename writes, so they survive a daemon restart. Expired locks and\n locks whose owner Pane or panel is gone are dropped when the file loads.\n- **Visibility.** `runpane lock list [--session <id|name>]` lists held locks,\n and `sessions overview` includes `locks`: those scoped to the Session plus\n those its Panes hold.\n\nIf a worker interrupts a waiting `lock acquire`, the daemon may still grant it\nthe lock for up to two minutes; release it, or let the TTL expire.\n\n## Orchestrator guide\n\nThe mechanics of driving workers through Pane, for any orchestrator and any\nharness (a Pane Session, a Claude Code or Codex session in a Pane terminal, or\na wrapper such as Agent Farm), live in one place: the bundled\n[`pane-orchestration`](../main/src/services/paneChatBundle/skills/pane-orchestration/SKILL.md)\nskill. Any agent can read it with\n`runpane docs read --doc skills/pane-orchestration/SKILL.md`, and the home\n`pane` skill points there. It covers one Pane per feature, launching a worker\nas a Pane or tab (including `--tool-command` wrappers, `--initial-input-file\n--as-file-pointer`, `--wait-ready` and reading the delivery result), the one\nwait primitive (`runpane watch --session <S> --as <name> --until-event`) and\nwhat each wake means, worker reports and how a status file pairs with them,\nanswering workers, resuming after a restart or sleep, showing pages beside the\nperson, shared-checkout and port etiquette, handoff, cleanup, and what changes\nafter the next release. The sections below are the reference for each piece.\n\n## Session watcher\n\nWhen monitoring is authorized, use one durable, named watcher per Session. Do not start it merely because a Session opens. `--session` takes the Session ID\nor exact name, and the daemon follows every Pane associated with it:\n\n```text\nrunpane watch --session <session-id> --follow --json\n```\n\nThe daemon resolves the Session once per request and re-reads its\nassociations on every journal read. A Pane associated after the watcher\nstarts is included; a detached or archived Pane drops out, together with any\nline still held for it by `--ready-settle` or `--min-interval`. The Session's own\nhidden owner and orchestrator panels never appear, and an association limited\nto specific panels reports only those panels. There is no re-arm after\n`sessions associate` or `sessions detach`. `--session` cannot be combined with\n`--pane`, an unknown Session fails the watch, and a daemon\nthat predates `--session` fails it with `WATCH ERROR` instead of watching every\nPane.\n\nAfter a Pane restart, an agent panel whose process did not come back is\nreported once as `panel.stopped` (`STOPPED <pane-name> pane <pane-id> panel\n<panel-id>`, `running: false`), never as `agent.ready`. Restart it in place,\nwith the same panel ID and its conversation, using `runpane panels resume\n--panel <panel-id> --wait-ready --yes --json`, or every stopped agent panel of\nthe Session at once with `runpane panels resume --session <session-id>\n--wait-ready --yes --json`. A worker started with `agent-farm run <profile>`\nresumes with `--resume` and the launch ID Agent Farm printed, the same rule a\nrestart uses (see \"Agent Farm\" above). The bulk form restarts `--concurrency` panels at a\ntime (default 3), leaves running panels alone, waits on the resumed panels\ntogether, and returns one result per panel with its readiness, blocker, or\nerror; `--all-stopped` does the same for every Pane. It relaunches finished\nworkers too, so resume single panels when only some should continue. Both\nbulk forms skip paused tabs.\n\nPause stops a tab's process the way quitting Pane does, without asking, and\nkeeps its panel and conversation: `runpane panels pause --panel <panel-id>\n--yes`, `runpane panes pause --pane <pane-id> --yes`, or `runpane sessions\npause --session <session-id>` for the terminal tabs of the Session's chat and\nevery Pane in it. Pause leaves a chat tab running: the result counts it in\n`chatTabsNotPaused` and says so, and `panels pause` refuses one. Auto-pause\n(Settings > Pause) does stop the agent of a chat tab idle for\n`chatIdleReleaseMinutes` (30 by default), outside the Pane on screen and never\nwhile it works, holds a queued message or waits on the person. Opening the tab\nor sending it a message resumes it in its conversation, and it reports no\n`panel.paused`. A Session whose orchestrator is a chat tab therefore never reads as paused.\nA paused terminal tab stays stopped through clicks, app restarts and updates until\n`runpane panels resume --panel <panel-id>`, `runpane panes resume --pane\n<pane-id> --yes` or `runpane sessions resume --session <session-id>` restarts\nit in its conversation. The watch reports each paused tab once as\n`panel.paused` (`PAUSED <pane-name> pane <pane-id> panel <panel-id>`) and each\nresumed one as `panel.unpaused` (`UNPAUSED ...`), followed by its usual ready\nsignal. An orchestrator leaves paused workers paused unless the person asks.\nAny other start of a paused terminal tab (opening it, a retry, another machine)\nfails with `ERR_PANEL_PAUSED` and starts nothing.\n`runpane panes list --json` reports each Pane's `paused` mark (`{ at, by:\n\"manual\" | \"auto\", idleHours? }`) and `inactiveSince`, the latest terminal\noutput or input or chat agent activity in its tabs or the last time the person\nselected it;\n`runpane panels list` reports each tab's `paused`.\n\nIf a stopped panel's previous shell or agent process is still exiting, resume\nreturns a `still stopping` error instead of starting a second process. Retry\nafter the old processes exit. This also applies when bounded teardown could\nnot kill a process; bulk resume reports the error for that panel and continues\nwith the others. Archived Panes cannot be resumed, even if archive cleanup failed.\n\nMembership changes are journal entries: `pane.associated` (`JOINED <pane-name>\npane <pane-id> session <session-id>`) and `pane.detached` (`LEFT ...`). The\nSession manager emits them from `sessions associate` (only when the Pane was\nnot already a member) and `sessions detach`. A watch without `--session`\nreceives them only when `--kinds` lists them, so older clients never see an\nunknown kind. Cadence state is keyed by the Session rather than its current\nPanes, so held lines survive membership changes.\n\n### Watching a PR from any Pane\n\n```bash\nrunpane pr watch --pane <pane-id> --url https://github.com/owner/repo/pull/123 --head <full-sha> --json\nrunpane watch --pane <pane-id> --since <generation-returned-above> --epoch <epoch-returned-above> --until-event --json --kinds pr.checks,pr.conflicted,pr.base_changed,pr.base_deleted,pr.head,pr.review,pr.comment,pr.closed,pr.merged,pr.stopped,github.unavailable,github.recovered\nrunpane pr list --pane <pane-id> --json\nrunpane pr unwatch --pane <pane-id> --url https://github.com/owner/repo/pull/123 --json\n```\n\nInside a Pane, registration defaults to its `PANE_SESSION_ID`. Registration\nreturns `generation` and `epoch`; use both for the first wait, including events\nthat arrived between registration and arming. An identical active registration\nretry returns its original generation, including after daemon restart, so a\nlost response cannot skip an unread event. A new head pin or unwatch/re-register\nstarts a new registration. Process every returned NDJSON\nevent, then persist its `gen` and `epoch`. Rearm with `--since <gen> --epoch\n<epoch>`; use `--limit 1` for one event per invocation. Never reuse the initial\nregistration generation after delivering an event, and never combine `--as`\nwith `--since` or `--epoch`. A named cursor is a separate daemon-managed mode.\n\nOrdinary daemon restarts preserve the epoch and unread retained events. On\n`_reset` or `_dropped`, resynchronize current GitHub state before accepting\nsuccess, then persist the control record's `generation` and `epoch`. Ignore\n`replay`/`baseline` records as new events. Retention is bounded; a journal reset\ncannot recover lost history. A consumer crash before saving its cursor can\nreplay an event, so actions must be idempotent. Registration uses the full\nhost/repository/number identity. It pins success to `--head`, or the first\nobserved head; a new head emits `pr.head` and needs a fresh registration before\nsuccess can be reported. Read existing discussions before arming. A wake\nmeans inspect the change; it never authorizes merging.\n\nThe watch also reports when the ground under the PR moves. `pr.base_changed`\n(`BASE CHANGED`) fires when the base branch is retargeted, by a person or by\nGitHub after a stack parent merges and its branch is deleted; `base.from` and\n`base.to` name the old and new base. `pr.base_deleted` (`BASE DELETED`) fires\nwhen the base branch no longer exists; GitHub may close the PR right after.\nBoth arrive at once under `--follow`. When the PR below this one in a stack\nmerged with a merge commit and this PR now targets the branch it merged into,\nthe retarget is done: confirm the diff shows only this PR's commits and recheck\nrequired checks (`gh pr checks <number> --required`); do not rebase or push.\nAfter any other base change, rebase onto the new base and recheck CI.\n\nThe daemon batches up to 25 fingerprints per host every two minutes (plus up\nto ten seconds of jitter), reads details on changes and at a 30-minute\nbackstop, and keeps 10% of GitHub quota for interactive work. It uses `gh auth\ntoken` for cached authentication and direct GraphQL for reads. Session PR\nbranch discovery still uses Pane's existing `gh pr list` lookup.\n\nFailures emit immediately, even while other checks run. Success requires a\ncomplete, nonempty set of checks on the pinned head and all required checks\npassing (all checks when none are marked required). BLOCKED/UNKNOWN merge\nstatus conservatively withholds success, including when reviews are missing.\nFeedback from every account is included: agents and people can share a login.\nChecks passing is a signal to inspect the PR, not proof of complete readiness;\noptional failures can still produce a separate failure event. Merge/close,\neight non-rate-limit failures, or ten comment-only updates stop registration;\narchiving/deleting the Pane removes it. Rate limits pause instead of consuming\nthe failure budget. Outages and recovery are journal events.\n\nFingerprints include individual check outcomes and thread resolution state, so\nequal aggregate counts do not hide swaps or edits. When the fingerprint window\nis truncated (over 100 checks/discussion items or multiple comments in a review\nthread), the daemon reads details each round. Detail reads page through up to\n2,000 checks and retain the latest 100 comments, reviews, threads, and comments\nper thread. Truncated discussions emit `pr.review` with an incomplete-feedback\nreason and withhold success; read the full discussion on GitHub.\n\nBaselines and events are replaced atomically before readers wake. This prevents\na process crash from advancing a baseline without its event. Delivery remains\nbounded by journal retention and cursor acknowledgments; replay after a consumer\ncrash before acknowledgment is possible. This is not an exactly-once or\npower-loss durability guarantee.\n\n\nThe cursor defaults to `session-<uuid>`, where `<uuid>` is the UUID inside the\nSession ID: the Session `__orchestration_session_<uuid>__` uses\n`session-<uuid>`. Passing the name instead gives `session-<name>`. Cursor names\nmay be up to 128 characters (64 before this release); when runpane derives a\nname itself, such as this default or the `PANE_PANEL_ID` fallback, it shortens\none longer than 64 characters (or one with other characters) to\n`<prefix>-<first 12 hex characters of its sha256>`.\n\nA discussion-only Session has no follow watcher. On restart, retain the\n`session-<uuid>` cursor and capture a fresh output baseline before\ninterpreting notifications. After a reset (`_reset`), the baseline restates\ncurrent state: those JSON entries carry `replay: true` (and\n`changedWhileAway: true` after a daemon restart). A replayed `agent.ready` is\nnever READY; re-read `sessions overview` instead of acting on it. Lines mode\nprints only `CHANGED` for them. Return blocked and decision findings to the\nSession conversation. Terminal idle or exit remains activity evidence only.\n\n`--follow` has one default cadence: READY settles for 3 minutes, BLOCKED\nfor 30 seconds, and non-urgent events batch every 10 minutes. IDLE starts at\n10 minutes and backs off to 30 minutes, 1 hour, 3 hours, then daily. Heartbeats\nare off. WATCH OK prints once when armed; WATCH EXPIRED and exit 0 end a watch\nafter 3 quiet hours. Meaningful events reset expiry; IDLE and replay do not.\n\nIndividual duration overrides accept `30s`, `3m`, `3h`, or `0`: `--ready-settle`, `--blocked-settle`,\n`--min-interval`, `--idle-after`, `--expire-after`, `--heartbeat`, and\nwatch `--timeout-ms` (for example, `--until-event --timeout-ms 30s`).\n`--expire-after 0` disables natural expiry. Bare values retain milliseconds,\nexcept heartbeat's legacy seconds. `--json` selects NDJSON; otherwise lines.\n\n`--present` and `--profile` were removed. Use individual timing flags such as\n`--ready-settle 1m --blocked-settle 15s --min-interval 2m` to override the defaults.\n\n```bash\nrunpane watch --session <session-id> --follow --json\nrunpane watch --session <session-id> --follow --ready-settle 1m --blocked-settle 15s --min-interval 2m --json\nrunpane watch --pane <pane-id> --until-event --json\n```\n\nSession membership changes need no re-arm. Named cursors survive daemon\nrestarts; the journal and PR baselines are saved together. RESET/DROPPED mean\nrefresh the overview; replayed baseline entries never mean a new READY.\n`--until-event` waits for REPORT, BLOCKED, EXIT or GONE by default and exits 0\nwhen one arrives, immediately without follow settling or batching. A harness\nthat consumes a named follow stream gets its cadence; a process-exit waiter\nkeeps these immediate single-event semantics. Cadence requires a named consumer\n(explicit `--as` or the name assigned by follow). `--follow --since <generation>`\nhas no consumer name and also bypasses settling and batching. Named `--as`\ncannot be combined with numeric `--since`; switching only the wait mode does\nnot enable cadence for a numeric generation/epoch cursor.\nOverride `--kinds` for PR events. Its `--timeout-ms` is a\ntotal deadline (exit 124); under follow it bounds each daemon request.\n\nREPORT remains the completion signal: workers use `runpane report --state\nready|blocked|failed|done --summary-file <path>`, adding a PR/head and a question\nwhen blocked. READY alone is activity evidence. Read the full report with\n`runpane agents status --panel <id> --json`. Resume stopped workers in the same\npanel with `runpane panels resume --panel <id> --wait-ready --yes --json`.\n\nDo not pipe follow through `head` or `grep -m1` to wait. Run `--until-event` as\na supported background task, act on its events, then re-arm with its cursor\n(the [orchestrator guide](#orchestrator-guide) has the one wait command and\nwhat to do on each wake, timeout, reset and error).\nNever sleep-poll your own background task output. WATCH ERROR/nonzero exit\nmeans failure: re-read every worker's status, then re-arm once; a second\nfailure goes to `runpane doctor --report`. A superseded cursor means keep the\nreplacement. A normal expiry means re-arm with the next dispatch.\n\n\n## Worker reports\n\nWorkers hand back a structured report when they finish or get blocked. Every\nworker prompt ends with:\n\n```text\nWhen finished or blocked, run\nrunpane report --state <ready|blocked|failed|done> --pr <number> --head <sha> --summary-file <path>\n(add --question \"<question>\" when blocked).\n```\n\nInside a Pane terminal `runpane report` finds its own panel through\n`PANE_SESSION_ID` and `PANE_PANEL_ID`; elsewhere pass `--pane` and `--panel`.\n`--question` is required with `--state blocked`, `--pr` is a positive integer,\nand `--head` is 7 to 40 hex characters.\n\nThe daemon then:\n\n- keeps the latest report in the panel's custom state, so it survives a\n restart: `{ state, pr, head, summary, summaryPath, question, reportedAt }`,\n with up to 16,000 characters of summary (a longer one ends with a truncation\n marker and sets `summaryTruncated`);\n- journals an `agent.report` entry with the same fields (summary cut to 2,000\n characters), printed as `REPORT <pane-name> pane <pane-id> panel <panel-id>\n ready pr#747 fc5dce9` or `... blocked: <question>`. It skips the\n `--min-interval` batch. Only watchers that list `agent.report` in `--kinds`,\n and Session watches, receive it, because released CLIs reject journal kinds\n they don't know. It passes `--agents-only` (which `--follow` and\n `--until-event` imply) whatever panel sent it, so a report from a shell tab\n or a wrapper launch whose agent isn't detected yet still arrives;\n- appends a `report` activity (with the worker's `paneId` and `panelId`) to\n every Session the Pane is associated with, which makes an older Session\n report stale;\n- shows the report in `agents status`, `panels list`, and `sessions overview`.\n There each panel carries its own latest report as `panes[].panels[].report`,\n and `panes[].report` is the newest report among the Pane's panels, with its\n `panelId`. When the summary is a complete JSON object (a status file sent\n with `--summary-file`, say), the panel's `report.data` holds it exactly as\n given; a plain-text, array, scalar, invalid, truncated, or more than 64\n levels deep summary has no `data`;\n- returns `liveWatchers`, the number of watches that were waiting and received\n it. The CLI prints `Delivered to 1 waiting watcher.`; with no Session and\n nobody waiting it says the report is stored on the panel and that a\n named-cursor watch receives it when it next waits.\n\nThe orchestrator treats REPORT as the completion signal. A READY without a\nreport means look, and maybe nudge: `runpane panels last-message --panel\n<panel-id> --json` returns the agent's last reply from its Claude or Codex\ntranscript (never the screen; `transcript-unavailable` otherwise), and the\nworker can be asked to run `runpane report`.\n\nAn orchestrator whose harness wakes only when a process exits (Claude Code\nbackground Bash, Codex) waits with the one wait primitive from the\n[orchestrator guide](#orchestrator-guide): `runpane watch --session <S> --as\n<name> --until-event --json --kinds\nagent.report,agent.report.missing,agent.blocked,agent.ready,panel.exited,panel.stopped,panel.paused,pane.gone` (`--pane <pane-id>` outside a Session), run as a background\ntask and run again after each event. `--until-event` exits 0 on the first\nevent (124 at a `--timeout-ms` deadline, if you give one); a `RESET` and the caller's own panel never end\nthe wait. When a worker keeps richer state in a status file, it writes the file\nfirst and reports with `--summary-file <status file>`; the file is the truth\nand the report is the signal.\n\n### Dispatching with `--wait`\n\nThe [orchestrator guide](#orchestrator-guide) prescribes submission without\n`--wait`, followed by its named watch as the completion consumer. The CLI also\noffers an optional per-dispatch result for callers choosing that route instead:\n\n```text\nrunpane panels submit --panel <panel-id> --input-file <prompt-file> --as-file-pointer --wait --yes\n```\n\n`panels create` and `panes create` with a prompt take `--wait` too. `--wait`\nturns the expected report on and blocks on that panel until the first\n`agent.report`, `agent.report.missing`, `agent.blocked`, `panel.exited`, or\n`pane.gone`. It then prints one line of JSON (`dispatchWaitResult` in the\ncontract) and exits:\n\n| `outcome` | Exit | Carries |\n| --- | --- | --- |\n| `report` | 0 | `report`: state, summary, `summaryPath`, PR, head, question |\n| `missing` | 3 | `lastOutput` and `lastOutputSource` |\n| `blocked` | 4 | `screenLines`, the prompt the worker waits on |\n| `exited`, `gone` | 5 | `exitCode` or `reason` |\n| `indeterminate` | 6 | history was lost; inspect the panel and inbox before retrying |\n| `timeout` | 124 | after `--timeout <duration>` (`30m`, `2h`) |\n\nThe result never includes the transcript. The daemon stamps the result of\nevery create and submit with the journal generation and epoch it read before\ndelivering the work. `--wait` adapts the existing `watch --until-event` reader,\nfiltered to the Pane and panel. It reconnects after a daemon restart; a replaced\nor truncated journal returns an explicit indeterminate result (exit 6), since\nthe task's outcome can no longer be established from that history. Like\n`--until-event`, it is a single-event wait: it delivers at once, without\n`--follow`'s settling or batching, and since it exits on the event, a plain\nbackground task is enough (no line-delivering monitor). Claude\nCode wakes the orchestrator when the background call exits, and the line\narrives as the tool result. Report-expected work is serialized per panel: a\nnew dispatch is refused before writing while an expectation or missing-output\ncollection is outstanding. A send with `--no-expect-report` (`panels submit` or\n`agents send`) is a reply, such as an answer to the worker's question or an\naddition to its current work: it is delivered while a report is outstanding,\nand Pane keeps waiting for the original work's report.\nHeld starting input is reserved but does not count startup readiness as task\ncompletion; tracking activates immediately before the prompt's submit or launch.\n\n### Expected reports\n\nWork sent to an agent through runpane expects a `runpane report` back: a\n`panels submit` to an agent's panel, and a `panels create` or `panes create`\nthat carries a prompt. A request marked `--source user` (Pane's own UI marks\nits sends that way) expects none, and neither does typing into a tab, which\nnever goes through runpane. `--no-expect-report` sends fire-and-forget input;\n`--expect-report` asks for a report anyway, also from a plain shell panel.\n`shouldExpectReport()` in `main/src/ipc/runpane.ts` holds the rule. Pane saves `{ since }` per panel in `expected-reports.json` below `PANE_DIR`\n(results echo it as `expectedReport`); only the tracker writes that file, so\npanel-state writes cannot bring back a cleared expectation. When the agent then goes ready (`agent.ready`)\nor its panel exits without a report made at or after `since`, Pane journals\none `agent.report.missing` entry (`MISSING REPORT <pane-name> pane <pane-id>\npanel <panel-id> ready|exited`) and clears the expectation. The entry's\n`lastOutput` is the agent's last reply from its transcript, or else the last\n20 lines on its screen (`lastOutputSource: transcript|screen`), cut to 2,000\ncharacters with the end kept. A report clears the expectation.\n\nAn agent can end its turn while work it started keeps running. Pane reads\nthat from the screen: Claude Code counts running background shells in its\nfooter (`⏵⏵ bypass permissions on · 1 shell`) and lists each running\nbackground subagent under it (`◯ general-purpose <task> 14s`); Codex prints\n`1 background terminal running · /ps to view` above its prompt\n(`detectAgentBackgroundWork()` in `agentScreenSignature.ts`). While one shows,\na READY does not raise the missing report. Claude takes a new turn when the\nwork finishes, and that turn's READY decides. Codex doesn't, so Pane looks at\nthe screen again every 10 seconds while the panel stays ready, and raises\nonce nothing runs. An exit raises at once.\n\nLike\n`agent.report`, the kind reaches only watchers that list it in `--kinds` (a\nSession scope alone does not deliver it), and it skips the `--min-interval`\nbatch. The tracker is `main/src/services/expectedReports.ts`.\n\n### Autopilot's kinds\n\nAutopilot (experimental) waits with `runpane watch --as autopilot --kinds\nitem.created,item.answered,session.created,session.archived,orchestrator.turn_ended\n--until-event --json`. These kinds reach only watchers that list them in\n`--kinds` (a Session scope alone does not deliver them), so orchestrators'\nwatches never see them. `item.created` and `item.answered` (ITEM / ANSWERED)\nmark an approval or question starting or stopping waiting on the person; the\nentry carries `itemId` and the title in `reason`, after why it's news: \"No\nanswer (the asker stopped waiting): \" when its asker left, its receipt when it\nclosed (\"Closed by Autopilot: <why>: \", \"Closed: Session archived: \"), or\n\"Reopened by you, after …: \" when the person brought it back. Its `paneId` is the\nasking Pane. `session.created` and `session.archived` (SESSION NEW / SESSION\nARCHIVED) carry the Session and its own workspace Pane as `paneId`.\n`orchestrator.turn_ended` (TURN ENDED) marks a Session orchestrator going from\nworking to idle, chat tabs included. They come from\n`main/src/services/autopilot/autopilotEvents.ts`.\n\nEvery Session's fixed capability text has one rule for Autopilot: a message\nthat starts with `[From the person, via Autopilot]` carries the person's own\nquestion or instruction (a `/wrap-up` request included), and is never an\nanswer to an approval or a worker's question. A message that starts with\n`[From Autopilot]` is Autopilot's own; the orchestrator replies to whoever\nasked (\"To Autopilot:\"), and anything the person must decide still goes to\nthem as an approval. See [AUTOPILOT.md](AUTOPILOT.md).\n\n### Questions on screen\n\nPane's status detection (`main/src/services/agentStatus/manifests.ts`)\nclassifies a panel as blocked when its screen shows a live prompt waiting on\ninput: Claude's AskUserQuestion picker, permission prompts, folder trust, the\n\"Allow external CLAUDE.md file imports?\" dialog, and Codex's folder-trust,\nsign-in, approval and \"Update available\" screens. The journal records\n`agent.blocked` only once a panel has stayed blocked for 2 seconds\n(`BLOCKED_DEBOUNCE_MS` in `workspaceJournal.ts`), so a prompt-like line that\nflashes past in normal output never becomes BLOCKED. The entry carries\n`screenLines`: up to 20 non-empty lines of the screen region the prompt was\nmatched in. The agent does not need to report anything for this.\n\n### Session inbox\n\nPane keeps, per Session, what its orchestrator has not acknowledged:\nreports (`agent.report`), missing reports (`agent.report.missing`), and\nquestions on screen (`agent.blocked`, with `screenLines`). It is fed from the\njournal for every Pane associated with the Session (`main/src/services/sessionInbox.ts`)\nand saved with a journal epoch and replay watermark in the `approvals` table of\n`sessions.db`, one row per item; a blocked report shares its row with the\nquestion's card. A one-time import moved older `session-inbox.json` files there:\nthe file is backed up first as `session-inbox.json.before-import`, the original\nis left in place, and a failed import changes nothing and retries on the next\nstart. Restart replays committed events after the watermark, with\nstable item IDs, including a report whose inbox write failed. Acknowledgements\nand the watermark are saved together; replay does not resurrect handled items.\nRecovery is bounded by the journal's retention. If entries expired before\nprojection, or the journal was replaced, Pane logs the history loss explicitly;\nalready projected items remain available. A newer report replaces the panel's\nolder report or missing report; a blocked item goes once its panel moves on\n(busy, ready, exited, or reported). Each Session keeps its newest 1000 items\n(`retention.sessionInbox` in `config.json`).\n\n```text\nrunpane inbox --session <id|name> [--json] # defaults to $PANE_ORCHESTRATION_SESSION_ID\nrunpane inbox ack <item-id>... [--decision <D-n>] [--session <id|name>]\nrunpane inbox ack --all --session <id|name>\n```\n\n`runpane inbox` also lists `answers`: what the Session's workers were told, kept\n7 days. Human output prints each one with no decision as needing a D-n, and\n`runpane inbox ack <item> --decision <D-n>` records it, even on an item already\ncleared.\n\nAn orchestrator runs `runpane inbox` when it starts or resumes, to catch what\nfinished while it was down, its workers' unrecorded answers included. Pane never adds the inbox to the orchestrator's\nturns: worker output reaches it only as the result of a tool call it made.\n\n### What waits on the person: Approvals\n\nWhile Approvals is on (Settings → Approvals, saved as `notify.enabled`, on by\ndefault), a Session has one voice to the person: its orchestrator.\n\n- **Workers don't call `notify`.** Approvals come from the orchestrator, not\n from the agents in the Session's Panes. A worker in a Session's Pane gets\n `PANE_SESSION_DIR` and no `PANE_ORCHESTRATION_SESSION_ID`; Pane's\n instructions (the user-level Notify block and the `pane` home skill) tell\n such a worker to report blocked with\n `runpane report --state blocked --question \"<question>\"` instead. A\n worker's `notify` call isn't shown to the person; it returns `unavailable`\n with a `next` that says to report blocked.\n- **A worker's question is a card at once.** Its blocked report shows in\n Approvals straight away. From a JSON status file (even one the journal cut\n short) or a bare `needs_you` block, the card takes its question and `why` as\n context, its question's `options` as answer buttons (a `(recommended)`\n suffix marks the recommended one; several questions get an answer box), and\n its `files` as links. Other JSON shows one line (`summary`, `step` or\n `title`) or none, never the raw text; the file itself opens as the worker's\n status link. It rings once the orchestrator\n relays it or after 10 minutes, so the orchestrator first settles what the plan\n already answers (D-79). The answer goes straight to the asking tab, whether or\n not the orchestrator is running: `answer: Q-n → <answer> (by you)`, once its\n agent is at its prompt ([docs/PANE_NOTIFY.md](PANE_NOTIFY.md) has the rule).\n An answer Pane can't type shows in `runpane inbox` as `undelivered`; the\n orchestrator passes it on unless its tab closed. A relayed question stays\n open after its worker's tab closes, since its orchestrator can still read a\n reply to it (the reply goes to the orchestrator). The tab can\n also receive `closed: Q-n (by you)` and `correction: Q-n → <answer> (by you)`;\n workers and orchestrators treat those as the person's word.\n- **Typed replies.** Anything the person types on an approval arrives as\n `reply: Q-n → \"<their words>\" (picked: <picks>) (by you)` (or as the open\n call's `{reply, picks?, id, replyId, next}` result, whose `replyId` the\n reader passes to `--took` and `--update`). A worker's question's reply goes\n to the worker's tab; when the worker can't read it, to the orchestrator that\n relayed it; else to Autopilot. The reader decides whether it answers or asks:\n `runpane notify --took <id|Q-n> answer`, or `--took <id|Q-n> question`, then\n `runpane notify --update <id|Q-n> --asked \"<their question>\" --what-changed\n \"<one line per change>\"` with any changed fields. That saves a new version of\n the same approval (\"Updated · ready again\", at most 10 kept) and waits for the\n answer; nobody posts a second approval for it. `correction: Q-n → that was a\n question: \"…\"` and `correction: Q-n → that was your answer: \"…\"` are the\n person's fix of how it was taken. A worker may run `--took` and `--update`:\n they aren't new asks. [docs/PANE_NOTIFY.md](PANE_NOTIFY.md#replies-and-new-versions)\n has the lines, the reader order and what the approval shows.\n- **Orchestrator mode.** The generated orchestrator skill, the Session's\n `AGENTS.md` and the orchestrator guide\n (`paneChatBundle/skills/pane-orchestration/SKILL.md`, \"What waits on the\n person\") tell the orchestrator that only it asks the person; to keep a\n running list and keep the work moving; when the person asks about one\n thing while other work is open, to remind them and offer the next step; at\n the end of a turn, to have an approval waiting or be done. All three carry\n Pane's approvals text, \"Asking the person in Pane\"\n (`main/src/services/approvalsRules.ts`, also in the `pane` home skill): which\n card to use, what a card holds and how to read a reply\n ([PANE_NOTIFY.md](PANE_NOTIFY.md#what-an-agent-can-send)). These are\n instructions; Pane doesn't check turns, only cards.\n- **The orchestrator relays and posts.** The same three carry the posting rule: keep every item that waits on the person (a\n worker's needs_you or blocked question, a plan or design approval, a PR\n ready to merge, a next step only they can take) posted to Approvals exactly\n once, titled with its Q-n and with the worker's files and PR as `--links`.\n Post each one with `runpane notify ... --json` as a background command (in\n Claude Code, Bash with `run_in_background`), not the MCP `notify` tool,\n which returns `waiting` after a while, and never `AskUserQuestion`. A worker's question already has a card, so the orchestrator\n relays into it: `runpane notify --relays <item> ...`, with the id from `runpane\n inbox`, gives that card its choices, context and links and rings it, and the\n call waits on it as on any notify. The answer goes straight to the worker's\n tab, so the orchestrator doesn't forward it, except an answer `runpane inbox`\n lists as `undelivered` because Pane can't see what runs in the tab, which it\n passes on with `runpane panels submit` (one whose tab closed has no one left\n to tell). It\n records the decision with\n `runpane inbox ack <item> --decision <D-n>`, and the card reads \"Recorded as\n D-n\". The older way (post a second card, ack, forward the answer) keeps working\n for one release. The orchestrator stays free to talk about the item in its\n tab while the card waits. Stopping an item's background call drops its own\n stale item. On start, resume or wake it reconciles against the status files,\n its ledger and `runpane inbox`, and records any answer with no decision.\n Approvals survive a restart, and an asker that posts the same question again\n joins the waiting card. When `notify` returns `unavailable` because Approvals\n is off, it asks in its own tab as before.\n- **Filing.** Pane files each item under the Session its Pane belongs to, and\n marks items from the orchestrator's own tabs. Claude permission prompts and\n chat tab prompts still come straight from the asking tab and are filed under\n its Session.\n- **Closing with the Session.** Closing or archiving a Session closes the\n waiting items connected to it, workers' and orchestrators' alike, within 5 s\n (\"closed: Session closed\", \"closed: Session archived\"). A worker's newer report\n closes its older question (\"closed: the worker moved on\").\n\nSee [PANE_NOTIFY.md](PANE_NOTIFY.md) for the Approvals screen itself.\n\n## Skill contract\n\n`main/src/services/skillCacheManager.ts` installs the skills that ship in\n`main/src/services/paneChatBundle/` into\n`<PANE_DIR>/skills/pane-chat/skills/` and into the `.claude/skills/` and\n`.codex/skills/` folders of the data directory. It also generates the\n`pane-orchestrator` entry skill (plus a Cursor rule at\n`.cursor/rules/pane-orchestrator.mdc`), the runtime context, and the helper\nsubagents in `.claude/agents/` and `.codex/agents/`. A manifest\n(`skills/pane-chat/installed.json`) records what it installed and a hash of the\nbundle: startup skips the install when the hash is unchanged, and later installs\nreplace only the recorded entries. The bundled `wrap-up` skill is also copied\ninto each Session folder when it is prepared (see\n[Keeping a Session tidy](#keeping-a-session-tidy)).\n\nTo change Pane Chat behavior, edit the bundle or `buildPaneOrchestratorSkill()`\nin `skillCacheManager.ts`, then run `paneChatBundle.test.ts`.\n\nBundled workflow skills are available to Sessions and can be selected according\nto the user's task. The installed manifest lets Pane refresh its own skill files\nwithout replacing unrelated user skills.\n\n`shared/types/sessionProfile.ts` defines the generic default profile and shared\ncapability context. Generated guides and agent instruction files use this\ncontract. The legacy shared Cursor rule is not always applied; Session-specific\ninstructions belong to the Session's working directory. User-selected profiles\nand workflows determine behavior after the user supplies a task.\n\n## Terminal and Files\n\nEach Session has a collapsible **Terminal** dock and a **Files** button beside\nits agent tabs. The shell and file browser use the Session's workspace folder.\nSelecting a file opens an editor tab alongside the agent conversation. Panels\nare saved with the Session and reused when you reopen the tools; switching\nSessions keeps their shells and files separate.\n\nEvery Pane has the same dock: its first plain shell, titled **Terminal**, where\nthe setup progress notices appear. It is not a tool or agent tab. `runpane panels\nlist` marks it `dock: true`, and `runpane panes list` reports a Pane `running`\nonly while one of its tool or agent terminals is live, not for the dock alone.\n\n## Plans, pages, and split view\n\nAgents show pages and files with `runpane panels open --file <path>` or\n`--url <url>`. Files open in an editor tab with read-only previews for supported\nformats; HTML opens as editable source. Use `--url` with an HTTP, HTTPS or file\nURL for a live browser tab. By default the tab opens in split view:\nthe first one splits the stage to the right of the conversation, and later ones\njoin that side group as tabs. A page opened while you are looking at another\nSession or Pane is in that side group when you come back, without taking focus\nfrom the tab you left showing; tabs you have already arranged stay where you put\nthem.\n`--tab` opens it as a plain tab instead. Reopening the same file or URL reuses\nand reloads its tab; without `--tab`, a reopened tab that sits in the\nconversation's group moves to the side group. This works the same in Sessions\nand in worktree Panes.\n\nGenerated Session instructions ask the orchestrator to write plans, reports, and\nother documents as self-contained HTML files in its Session folder and link them\nfrom one status document. It opens one with `--url` (rendered) or `--file`\n(source) only when the person needs to look at it now; see\n[Keeping a Session tidy](#keeping-a-session-tidy).\nOpening a Session never submits a prompt or starts work just to write\na document.\n\nWhile the stage is split, each group has its own tab strip, including the agent\ntab in its group. For a single Session, the strips align directly below the\nwindow title bar. Closing the last tab in the side group returns to a single\ngroup. Layouts are saved with the Session.\n\nDrag any tab to rearrange the stage, as in a project Pane: drop it in the\nmiddle of a group to join that group, against an edge (the outer quarter) to\nsplit beside it, or between tabs on a strip to place it there. Dragging the\nlast tab out of a group closes that group. In tiled Sessions a tab moves only\nwithin its own Session.\n\n## Tiling Sessions side by side\n\n![Two Sessions tiled side by side, both streaming](screenshots/session-tiling.png)\n\nSessions tile with the same gesture as tabs, one level up. Drag a Session from\nits sidebar row — or by its title row once tiled — onto another Session and drop\nit against an edge to put the two beside each other; drop it in the middle to\nshow it in that slot instead. Edge bands are the outer quarter of the target,\nas they are for tabs, and the layout nests as deeply as you take it: a row of\nSessions with one of them split into a column is an ordinary shape, not a\nspecial case.\n\nBoth halves stay fully live. A tile that is not focused keeps its agent running\nand its output streaming; nothing is throttled or suspended, so a Session you\nare watching out of the corner of your eye is the same Session you were just\ntyping in. Each tile keeps its own tab splits, its own Terminal dock, its own\nFiles and Changes sidebar, and its own navigation.\n\nThe focused tile's Session is the selected one: its title row carries the focus\nring, and clicking a Session in the sidebar focuses its tile when it already has\none, or shows it in the focused tile when it does not. With one tile that is\nexactly the old behaviour — switching Sessions replaces the view.\n\nThe `X` on a tile's title row stops tiling that Session; the Session itself,\nits conversation and its panels are untouched, and the layout collapses back\naround the space. The last tile has no close button, since a window with no\nSession in it has nothing to show. Search carries the same commands\nfor the keyboard: focus the Session left, right, above or below, and stop tiling\nthe focused one.\n\nA layout belongs to the host it was built on, like the remembered location it\nsits beside: Session ids only mean anything on their own host, so switching\nhosts loads that host's layout and every tile is revalidated against the\nSessions that still exist there. Archiving or deleting a tiled Session retires\nits tile and collapses the split.\n\n## Reaching Pane and delegating work\n\nThe generated Session instructions tell the orchestrator how to reach\n`runpane` (PATH, then `$PANE_RUNPANE_BIN`, then the runtime context) and forbid\nsubstituting plain git worktrees or built-in subagents for delegated work; if\n`runpane` is unreachable the agent stops and reports it. Worktrees the\norchestrator creates or adopts with `runpane panes create` or `panes adopt`\nbecome the Session's children in the same call.\n\nEarlier development builds had an experimental progress view that rendered\n`progress.html` in a fixed side panel. It never shipped; Pane deletes its old\n`.pane-progress.json` switch and leaves any HTML files in place.\n\nNew worktrees launched from a Session default to unpinned. First association also\nclears a worktree's previous pin, including an explicit `--pinned` creation pin,\nso it appears as a Session child. Use `panes pin` manually afterward; repeated association does not undo that choice. Independent\nworktree defaults and existing historical pins are unchanged.\n\n### Generated instructions and Git\n\nSession instructions and documents live under `<PANE_DIR>/sessions/<id>/`,\noutside the project. While the Session agent shows its folder-trust prompt, a\nbanner across the top of the chat says the folder is Pane's own, holding the\nSession's notes and no project code. Session terminals and chats set `GIT_CEILING_DIRECTORIES` to\n`<PANE_DIR>/sessions`, so git run in a Session folder never picks up a repository\nabove it, such as a home directory tracked as a dotfiles repo. Do not configure\nPANE_DIR inside a project repository.\n\n### Move an existing chat to a Session\n\nRight-click a worktree and choose **Move chat to Session…**, then choose the chat\nif it has multiple agent tabs. You can also use **Move chat to Session** in the top\nbar of a selected Claude or Codex chat. Then enter a unique Session name, and choose **Move chat**. The agent must be idle\nand have a saved conversation ID. Pane stops the old terminal before transferring\nthe existing panel and resumes the same conversation from a private Session\nfolder. No initial prompt is submitted. The original worktree becomes a child;\nits branch, files, and uncommitted changes remain in place. Other tabs stay there.\n\nCursor and custom launch wrappers are not yet supported for promotion. Missing\nhistory, conflicting ownership, and active work are rejected before transfer.\nA durable Session record allows reopening to complete an interrupted transfer\nwithout copying the conversation. Terminal, Files, and split view\ncapabilities are the same as for a newly created Session.\n\nPromotion defaults to the worktree's current name.\n"},{"path":"docs/SETUP_EXPORT_IMPORT.md","title":"Export and import your Pane setup","text":"# Export and import your Pane setup\n\n**Settings › Import & Export**, after Privacy in the Settings sidebar, saves\nyour Pane setup to a file and loads it on another computer.\n\n## Export\n\nThe page lists nine sections, each with what it would save. Click a row to\nleave that section out, then click **Export…** and pick where to save\n`pane-setup-YYYY-MM-DD.json`. When it is saved, **Show in Finder** (**Show in\nfolder** on Windows and Linux) opens its folder.\n\n| Section | What it saves |\n| --- | --- |\n| Agent presets | Pane Chat agent, agent interface, the default Session command, resume, profile and pin, permission mode and model |\n| Custom commands | Every custom command: name, command and resume templates |\n| Run scripts | Each saved repository's Build Script, Run Commands and Archive Script, keyed by its `origin` remote |\n| Skills & MCP | Whether Pane's skill is installed and its MCP server registered, and the MCP toolsets |\n| Terminal shortcuts | Every terminal shortcut |\n| Custom links | Every custom link: label, pattern, URL template and on/off state |\n| Worktree file sync | Every file sync entry with a relative path |\n| Appearance | Appearance mode, themes, high contrast, UI scale, terminal font and size |\n| Preferences | The current value of each behavior toggle from General, Terminal, Notifications, Shortcuts, Worktrees & Git and Advanced, the keys you changed in Keyboard Shortcuts (importing them replaces your changed keys), new-Pane defaults (without the base branch), and the sidebar and `@terminal` choices |\n\n### What is never in the file\n\nThe file is built from a list of named settings, so anything not listed above\nis never written. That includes every API key and token Pane stores (Anthropic,\nOpenAI, fal, OpenRouter, Deepgram, APNs), shared credentials, Remote Pane and\nWorkspaces settings, analytics settings and identity, leaderboard, the Claude\nexecutable path, extra PATH entries, the preferred shell, start on login,\nPublish Pane instructions to AGENTS.md, developer and verbose modes, the\nDefault Open IDE Command, and each repository's path, worktree folder,\nOpen IDE Command and Project System Prompt. Notes, Loops and Sessions are not\npart of the setup.\n\nFree text can still hold a secret someone typed into it. As a second check,\nPane leaves out any command, resume template, script, Session profile or\nshortcut text or custom link URL template that looks like it holds one:\n\n- a key assignment such as `API_TOKEN=abc` or `password: x` (a variable\n reference such as `API_TOKEN=$API_TOKEN` is kept);\n- a flag with a value such as `--password x` or `--token=x` (`--token-file ./x`\n is kept);\n- an `Authorization` or `Cookie` header;\n- credentials in a URL (`postgres://user:pass@host`) or a secret in its query;\n- a well-known key prefix (`sk-`, `ghp_`, `github_pat_`, `xox`, `AKIA`).\n\nThe smallest unit is left out: one command, one shortcut, one custom link, one script of one\nrepository, or one setting. The card names each one and counts it on its row.\nThis check is best effort, so read the file before you share it.\n\nYour home folder is written as `~` in commands and scripts, so\n`/Users/ana/bin/serve` is saved as `~/bin/serve`.\n\n## Import\n\nClick **Import…** and choose a setup file. Nothing changes yet: the card shows\nwhat importing would change on this computer, section by section. Expand a row\nto see each item it adds or replaces, with the exact text of every command,\nresume template and script, each shortcut's key and on/off state, and, for a\nreplacement, what it was. A section with no changes is dimmed\nand can't be selected. Uncheck any section you don't want, then click\n**Import N sections**.\n\nImport adds and replaces. It never deletes:\n\n| Kind | Rule |\n| --- | --- |\n| Single settings | The file's value replaces this computer's when they differ |\n| Custom commands | Matched by name. A new name is added; the same name with a different command replaces it; commands only on this computer stay |\n| Terminal shortcuts | Matched by id, same rules. A shortcut whose key another shortcut here already uses comes in turned off, marked \"key in use\" |\n| Custom links | Matched by id, same rules. A link whose pattern or URL template has a problem still comes in, and the Links page shows the problem |\n| Worktree file sync | Matched by path, same rules |\n| Run scripts | See below |\n\nBecause nothing is deleted, a default shortcut or file sync entry you removed\non the first computer stays on the second one. Remove it there by hand.\n\nA leading `~/` or `~\\` in a command or script becomes this computer's home\nfolder, and the preview shows the result. Scripts are not translated between\noperating systems: when the file was written on another OS, the Run scripts row\nsays so (\"written on macOS\").\n\nImporting Skills & MCP does what the toggles in **AI & Agents** do: turning MCP\non registers Pane's server in your Claude Code, Codex and Cursor configs, and\nturning the skill on installs it in your home skill folders.\n\n### Run scripts\n\nEach repository in the file applies to every saved repository here whose\n`origin` remote has the same host and full repository path, whether it is\ncloned over SSH or HTTPS. `github.com/acme/web` does not match\n`gitlab.com/acme/web`, and `gitlab.com/team-a/tools/web` does not match\n`gitlab.com/team-b/tools/web`.\nA repository exported without a remote matches by name, and only when exactly\none repository here has that name.\n\n- Only scripts in the file are written; an empty script never clears yours.\n- A script the repository's own `pane.json` (or another\n [config file](CONFIG_FILES.md)) provides is skipped, so the team's file keeps\n working.\n- A repository that isn't saved in Pane on this computer is skipped and named.\n Import never creates repositories or clones them.\n\nBuild and archive scripts run on their own when a worktree is created or\narchived, which is why the preview shows their full text.\n\n### When a file is refused\n\nPane refuses a file that isn't JSON, isn't a Pane setup file, was written by a\nnewer Pane, is larger than 1 MB, or has a section in the wrong shape. The card\nsays why, that nothing changed, and what to do next. Sections and settings Pane\ndoesn't know are ignored, including any of the never-saved settings above added\nby hand.\n\nIf one step of an import fails, the sections before it stay imported and the\nrest are not. Importing the same file again is safe: anything already imported\nshows as no change.\n\n## Remote hosts\n\nWhile the window is connected to another computer through Remote Pane, the\ncard is disabled. Choose this computer in the sidebar's machine menu to\nexport or import this computer's setup.\n\n## For teams\n\nRun scripts a whole team should share belong in a committed\n[`pane.json`](CONFIG_FILES.md), which every clone picks up. A setup file is for\nmoving one person's setup.\n\n## File format\n\n```json\n{\n \"kind\": \"pane-setup\",\n \"version\": 1,\n \"exportedAt\": \"2026-10-26T22:40:00.000Z\",\n \"appVersion\": \"2.4.202\",\n \"platform\": \"darwin\",\n \"sections\": { \"agentPresets\": {}, \"customCommands\": [], \"runScripts\": [] }\n}\n```\n\n`sections` holds only the sections chosen on export. Inside each, fields keep\ntheir names from Pane's `config.json`; run scripts use `build_script`,\n`run_script` and `archive_script`, and Preferences also carries the\n`user_preferences` keys `auto_rename_sessions_to_pr`, `sidebar_pane_row_layout`,\n`sidebar_attention_inbox`, `at_terminal_paste_mode` and `at_terminal_line_count`.\nReaders ignore sections and keys they don't know, so a new section keeps\n`version: 1`; the version changes only for a breaking change. The code is in\n`main/src/services/setupTransfer.ts` and `shared/types/setupTransfer.ts`.\n"},{"path":"docs/SHARED_CREDENTIALS.md","title":"Shared integration keys","text":"# Shared integration keys\n\nSet an integration key once and every Pane host you use gets it. A key set on your Mac reaches your Windows PC, and a key you type in the iPhone app reaches every host the phone has saved.\n\n## Which keys\n\n| Key | Where you set it |\n| --- | --- |\n| Deepgram, fal, OpenRouter (voice dictation) | Settings → Integrations on a desktop, or the phone's voice setup |\n| APNs key for iPhone notifications | Settings → Integrations → iPhone notifications |\n| Anthropic, OpenAI | `anthropicApiKey`, `openaiApiKey` in the host's `config.json` |\n\nA key that exists only in a host's environment (for example `FAL_KEY` or the `PANE_APNS_*` variables) stays on that host and is never shared. On that host the environment value wins over a shared one. To get phone alerts from every computer, load the APNs key once in Settings → Integrations rather than only in one host's environment. The APNs endpoint follows the phone's build, not the key's environment ([Native mobile](NATIVE_MOBILE.md#push-delivery-operator-setup)).\n\n[Pane secrets](PANE_SECRETS.md) travel the same way, with the same rules, but their\nvalues stay in each host's keychain or secret file rather than `config.json`.\n\n## How keys travel\n\nHosts never contact each other on their own. A device that has more than one host saved, whether found over Tailscale, paired with a code, or paired by a [QR code or one-time link](QR_PAIRING.md), carries the keys between them:\n\n- **The iPhone app** syncs whenever it opens or returns to the foreground, after you save a key from the phone, and when a host reports that its settings changed. It relays the keys and keeps no copy.\n- **A desktop with another host saved** syncs when it starts, when a key changes on it, and when a saved host reports a change. Computers on your Tailscale login are saved the first time you switch to them, from the sidebar's machine menu or Settings › Remote Access › Computers. To link another computer, use Settings › Remote Access › Add a device › Computer. To pair with a code instead, create a connection code on the other host (Settings › Remote Access › Tailscale › Set Up Host) and paste it under Settings › Remote Access › Tailscale › Paste a connection code.\n\nSharing chains: if your Mac is paired with your Windows PC and the Windows PC with a Linux server, a key set on the Mac reaches the Linux server once both syncs have run.\n\nWhen two hosts disagree, the copy that was set most recently wins. Removing a key records when you removed it, so an older copy on another host does not bring it back. Settings → Integrations shows which host each key was set on and when.\n\nA host that is offline keeps its own copy and catches up on the next sync. Hosts running a Pane version from before key sharing are skipped.\n\n## The Approvals switch\n\nSettings → Approvals' on/off switch (`notify.enabled`) travels the same way, on the same syncs: read every reachable host, write the newest to those behind. A change here also tells hosts that saved this one, so they sync within seconds. It has its own commands (`notify:switch:get`, `notify:switch:apply`), only desktops carry it (not the iPhone app), and only on/off and Show cards on are shared: position, sound, shortcut and the rest stay on each machine.\n\nThe most recent change wins, by `notifyEnabledChangedAt` in `config.json`. A host applying another host's value keeps that host's time, so two hosts never trade values. A value with no time counts as time 0 and a missing value means on; at equal times off wins, so a machine turned off before sharing existed turns the others off when they first sync. A change made by hand in `config.json` while Pane runs counts as a change; one made while it's quit doesn't get a new time.\n\nHosts running a Pane version from before this are skipped without error; their keys still sync. The same people can reach it as the keys: the owner's login or a paired device.\n\nSettings → Approvals' Show cards on (`notify.cardsOn`: the picked machine's install id and name, or null for whichever computer is in use) rides the same commands with its own time, `notifyCardsOnChangedAt`. Each part merges on its own time, so changing one never overwrites the other; at equal times \"whichever computer is in use\" wins. A host from before Show cards on still syncs on/off: its answers carry no Show cards on, which never clears a pick, and it isn't written for Show cards on alone.\n\n## Who can read the keys\n\nOnly your own devices. Over Tailscale, a host answers a request for its keys only from its owner's Tailscale login, even when its workspace lets other people on the tailnet in, so a teammate's computer neither receives nor replaces your keys. With a connection code, the caller must present a valid pairing token, and the host refuses the request when it does not require pairing. Either device can already open terminals on that host, so sharing keys with it exposes nothing new.\n\nKeys are never written to logs or events. They are stored in each host's `config.json` in the Pane data directory, as before.\n\n## Stop sharing\n\nRemove the host from the device, or unpair it. On a host, revoke it under Settings › Remote Access › Tailscale › Set Up Host (the Set Up This Machine page) › Host status. On a desktop, expand the computer's row in Settings › Remote Access › Computers and choose Unlink from all your computers, or Forget. On the phone, remove the host. The keys already copied to each host stay there until you remove them, and removing a key on one host removes it from the others on the next sync.\n"},{"path":"docs/SSH_HOSTS.md","title":"SSH hosts","text":"# SSH hosts\n\nPane lists the hosts in your SSH config under **SSH hosts** in the sidebar. Click one and Pane opens a terminal tab that runs `ssh <host>` with your own `ssh`, keys and `ssh-agent`. You need no project, and no coding agent starts.\n\n## Add a host\n\nAny `Host` entry in your SSH config shows up:\n\n```\nHost mini\n HostName 192.168.1.20\n User me\n IdentityFile ~/.ssh/id_ed25519\n```\n\n## Open a host\n\nSSH tabs open in the **SSH view**, which takes the place of the main area, like Pane Chat.\n\n- **Click a host** to show its tab. If the host has no tab yet, Pane opens one.\n- **Right-click a host**, or hover it and click **+**, to open another tab on it.\n- A dot beside a host means it has an open tab.\n- With the sidebar collapsed to icons, the **SSH hosts** icon opens the SSH view. With no tab open, the view lists your hosts.\n\nEach tab is an ordinary Pane terminal. Pane starts its default shell (**Settings → Terminal → Default shell**) in your home folder and types `ssh <host>` into it. Password, passphrase and host-key prompts appear in the tab as they would in any terminal. When the connection ends or fails, you are back at a local prompt. After Pane restarts, your SSH tabs return in the SSH view, and each one runs `ssh <host>` again the first time you open it.\n\n## Which file Pane reads\n\n| System | File |\n| --- | --- |\n| macOS, Linux | `~/.ssh/config` |\n| Windows | `C:\\Users\\<you>\\.ssh\\config` |\n\nPane also reads the files that config pulls in with `Include`, the way `ssh` does: globs such as `Include conf.d/*` expand in sorted order, relative paths start from your `.ssh` folder, and `~` means your home folder. An `Include` counts only when it applies to every host: before the first `Host` or `Match` line, or under `Host *`. An `Include` inside a narrower `Host` or `Match` block applies only to that block's hosts, so `ssh` would not use its entries for a plain `ssh <host>`, and Pane does not list them. If a host from an included file is missing, move its `Include` line to the top of the config. Pane takes the home folder from your user account, as `ssh` does: on macOS and Linux changing `$HOME` does not move it, and on Windows it is the profile folder Windows records for your account.\n\nPane reads the files again on start, when its window comes back into focus, and when you expand the section. After editing the config in another app, switch back to Pane to see the change. After editing it in a Pane terminal, collapse and expand **SSH hosts**. A host you delete from the config stays in the list while it has an open tab, so you can return to that tab; it disappears once you close its tabs.\n\nPane opens only the config and its included files. It never opens, copies or uploads your keys; `ssh` reads them.\n\n## Which hosts appear\n\nEvery name on a `Host` line appears, in file order, so `Host web db` lists both `web` and `db`. Hosts from an included file appear where its `Include` line is. A repeated name appears once. Pane skips:\n\n- Patterns with `*`, `?` or `!`, such as `Host *` or `Host *.internal`.\n- Names that do not start with a letter, digit or `_`, or that contain characters other than letters, digits and `. _ @ : -`. Pane types the name into a shell, so it lists only names every shell passes to `ssh` unchanged; a leading `-` would be an `ssh` option and a leading `@` means something else in PowerShell.\n- Hosts that appear only in `Match` blocks, and the system-wide config (`/etc/ssh/ssh_config`, or `%ProgramData%\\ssh\\ssh_config` on Windows).\n\nIf a host is missing from the list, check it against these rules. A missing or unreadable config lists no hosts; an unreadable included file is skipped. With no hosts and no open SSH tabs, the section and its sidebar icon stay hidden.\n\n## Windows\n\nPane's default shell on Windows is Git Bash when it is installed, otherwise PowerShell or `cmd`. Each shell runs the first `ssh` on its PATH: usually Git's `ssh` in Git Bash, and Windows' OpenSSH client in PowerShell and `cmd` (an optional Windows feature that recent versions install by default). Both read `C:\\Users\\<you>\\.ssh\\config`.\n\nWindows' OpenSSH client refuses a private key that other accounts can read. Make the key readable only by you, replacing `id_ed25519` with your key file:\n\n```powershell\nicacls $env:USERPROFILE\\.ssh\\id_ed25519 /inheritance:r /grant:r \"$($env:USERNAME):R\"\n```\n\n## Remote Pane\n\nWhen this window controls Pane on another machine through [Remote Pane](SELF_HOSTED_REMOTE_DAEMON.md), the list shows the hosts in that machine's SSH config, and `ssh` runs there with that machine's keys and network.\n\nIf a host runs Pane itself, connect to it with Remote Pane. That gives you its projects, files, dev servers at `localhost` and running agents.\n\nThe phone app shows no SSH host list.\n"},{"path":"docs/STATE_MANAGEMENT.md","title":"State Management Guidelines","text":"# State Management Guidelines\n\n⚠️ **IMPORTANT**: Pane follows a targeted update pattern for state management to minimize unnecessary re-renders and network requests.\n\n## Overview\n\nPane uses a combination of Zustand stores, IPC events, and targeted updates to manage application state efficiently. The application prioritizes specific, targeted updates over global refreshes to improve performance and user experience.\n\nSession and project lists live in Zustand (`frontend/src/stores/sessionStore.ts` and related stores). Do not keep a parallel `projectsWithSessions` array in a tree component; `DraggableProjectTreeView` was removed.\n\n## Key Principles\n\n1. **Targeted Updates**: Always update only the specific data that changed\n2. **Event-Driven Updates**: Use IPC events to communicate changes between processes\n3. **Avoid Global Refreshes**: Never reload entire lists when only one item changes\n4. **Database as Source of Truth**: Frontend state should reflect backend state, not override it\n\n## State Update Patterns\n\n### Session Updates\n\n```typescript\n// ❌ BAD: Global refresh\nconst handleSessionCreated = () => {\n void loadSessions(); // Reloads everything\n};\n\n// ✅ GOOD: Targeted store update\nconst handleSessionCreated = (newSession: Session) => {\n useSessionStore.getState().addSession(newSession);\n};\n```\n\nIPC handlers in `useIPCEvents` already call `addSession` / `updateSession` / `deleteSession` on the store. Subscribe with selectors (`useSessionStore(s => s.sessions)`) instead of copying the list into local React state.\n\n### Project Updates\n\n```typescript\n// ❌ BAD: Reload all projects\nconst handleProjectDeleted = () => {\n fetchProjects(); // Network request for all projects\n};\n\n// ✅ GOOD: Remove from local state\nconst handleProjectDeleted = () => {\n setProjects(prev => prev.filter(p => p.id !== deletedId));\n};\n```\n\n## IPC Event Handling\n\nThe application uses IPC events to synchronize state between the main process and renderer:\n\n### Session Events\n\n- `session:created` - Add new session to appropriate project\n- `session:updated` - Update specific session properties\n- `session:deleted` - Remove session from project list\n\n### Project Events\n\n- `project:updated` - Update specific project properties\n\n## When Global Refreshes Are Acceptable\n\n- **Initial Load**: When component mounts for the first time\n- **User-Triggered Refresh**: When user explicitly requests a refresh\n- **Error Recovery**: After connection loss or critical errors\n- **Complex State Changes**: When multiple interdependent items change\n\n## Implementation Examples\n\n### ProjectSessionList.tsx\n\n- Reads sessions from Zustand `sessionStore`\n- IPC events patch the store; the tree re-renders from selectors\n- Avoids a local `projectsWithSessions` array that new-references on every status tick\n\n## Best Practices\n\n1. **Use Store Actions**: Call `useSessionStore.getState().addSession(...)` (or the matching action) from IPC handlers so every subscriber sees one update\n2. **Merge Updates**: When updating objects, spread existing properties to preserve data\n3. **Handle Edge Cases**: Always check if the item exists before updating\n4. **Log State Changes**: Add console logs for debugging state updates in development\n5. **Validate IPC Data**: Ensure IPC events contain expected data structure\n"},{"path":"docs/TERMINAL_FILE_LINKS.md","title":"Terminal file links","text":"# Terminal file links\n\nCtrl-click a detected file path (Cmd-click on macOS) to open its actions. Files\ninside the pane's worktree can open in an editor tab. Paths outside the worktree\nare labelled as such and cannot open in the worktree editor; local sessions can\nstill reveal them in the system file manager.\n\n`resolveTerminalPath` is shared by detected links and selected-text actions. It\nkeeps the absolute path for tooltips and native file-manager actions separate\nfrom the relative path required by `file:exists` and `openFileInEditor`. It\nnormalizes `.` and `..` segments and converts Linux paths to the worktree's WSL\nUNC namespace when appropriate.\n\n`terminal:getPathContext` gets the worktree and home directory from the session's\ndaemon host. WSL sessions read `HOME` asynchronously inside their distribution.\n`~/` is never inferred from the worktree. If home cannot be resolved, home-relative\nactions stay disabled. Remote sessions continue to disable native file-manager\nactions.\n\nThe xterm link-provider line number is one-based; the terminal buffer's\n`getLine` index is zero-based.\n\n## Custom links\n\nSettings › Links turns text matching your own regular expressions into links,\nsuch as issue keys opening your tracker. Each entry has a pattern and a URL\ntemplate that must start with `http://` or `https://`; `$0` inserts the whole\nmatch and `$1` to `$9` insert capture groups, URL-encoded. Cmd-click (Ctrl-click\non Windows and Linux) opens the link. File, URL and git links keep working\nalongside. Entries travel with Settings › Import & Export.\n\nPatterns run in a web worker (`frontend/src/utils/customLinkMatcher.ts`), one\nterminal row at a time with trailing padding trimmed. A row that takes longer\nthan `CUSTOM_LINK_MATCH_TIMEOUT_MS` stops the worker and gets no custom links,\nso a pattern that backtracks badly can't freeze the window.\n"},{"path":"docs/TIMESTAMP_HANDLING.md","title":"Timestamp Handling Guidelines","text":"# Timestamp Handling Guidelines\n\n⚠️ **IMPORTANT**: Proper timestamp handling is critical for the application to function correctly, especially for prompt duration calculations.\n\n## Overview\n\nPane uses timestamps throughout the application for tracking session activity, prompt execution times, and displaying time-based information. Due to the mix of SQLite database storage and JavaScript Date objects, special care must be taken to ensure timezone consistency.\n\n## Key Principles\n\n1. **Database Storage**: All timestamps are stored in UTC using SQLite's `CURRENT_TIMESTAMP` or `datetime()` functions\n2. **Frontend Display**: Timestamps are parsed as UTC and converted to local time only for display\n3. **Consistency**: Always use the timestamp utility functions instead of manual date parsing\n4. **Validation**: Always validate timestamps before using them in calculations\n\n## Timestamp Formats\n\n- **SQLite DATETIME**: `YYYY-MM-DD HH:MM:SS` (stored in UTC without timezone indicator)\n- **ISO 8601**: `YYYY-MM-DDTHH:MM:SS.sssZ` (with explicit UTC timezone)\n- **JavaScript Date**: Local timezone by default (be careful!)\n\n## Utility Functions\n\nPane provides timestamp utilities in both frontend and backend:\n\n### Backend (`main/src/utils/timestampUtils.ts`)\n\n```typescript\nimport { formatForDatabase, formatForDisplay, getTimeDifference, formatDuration, isValidTimestamp } from '../utils/timestampUtils';\n\nconst timestamp = formatForDatabase(); // ISO 8601 string, UTC\nconst displayTime = formatForDisplay(timestamp); // local time for display\nconst durationMs = getTimeDifference(start, end); // end defaults to now\nconst formatted = formatDuration(durationMs); // \"2m 34s\"\n```\n\n### Frontend (`frontend/src/utils/timestampUtils.ts`)\n\n```typescript\nimport { formatDistanceToNow, isValidTimestamp } from '../utils/timestampUtils';\n\nconst ago = formatDistanceToNow(timestamp); // \"5 minutes ago\"\n```\n\nThe frontend helpers call `new Date()` on their input, so pass them ISO strings\nwith a `Z` (or `Date` objects), never raw SQLite `YYYY-MM-DD HH:MM:SS` values.\n\n## Database Operations\n\nWhen working with timestamps in SQLite:\n\n```sql\n-- Use datetime() for UTC timestamps\nINSERT INTO prompt_markers (timestamp) VALUES (datetime('now'));\n\n-- When selecting, append 'Z' for proper UTC parsing\nSELECT datetime(timestamp) || 'Z' as timestamp FROM prompt_markers;\n\n-- For completion timestamps with NULL handling\nSELECT\n CASE\n WHEN completion_timestamp IS NOT NULL\n THEN datetime(completion_timestamp) || 'Z'\n ELSE NULL\n END as completion_timestamp\nFROM prompt_markers;\n```\n\n## Common Patterns\n\n### Creating a new timestamp\n\n```typescript\n// Backend - for database storage\nconst timestamp = formatForDatabase();\n\n// Frontend - for immediate use\nconst now = new Date();\n```\n\n### Tracking prompt execution time\n\n```typescript\n// When prompt starts\ndb.addPromptMarker(sessionId, promptText, outputIndex);\n\n// When prompt completes\ndb.updatePromptMarkerCompletion(sessionId);\n```\n\n### Calculating duration\n\n```typescript\n// With completion timestamp\nif (prompt.completion_timestamp) {\n const duration = getTimeDifference(prompt.timestamp, prompt.completion_timestamp);\n return formatDuration(duration);\n}\n\n// For ongoing prompts\nconst duration = getTimeDifference(prompt.timestamp); // Uses current time as end\nreturn formatDuration(duration) + ' (ongoing)';\n```\n\n## Common Pitfalls to Avoid\n\n### 1. Never parse SQLite timestamps directly with `new Date()`\n\n```typescript\n// ❌ WRONG - treats UTC as local time\nconst date = new Date(\"2024-01-01 12:00:00\");\n\n// ✅ CORRECT - select it with `datetime(col) || 'Z'` in SQL, or mark it as UTC first\nconst date = new Date(\"2024-01-01 12:00:00\".replace(' ', 'T') + 'Z');\n```\n\n### 2. Always validate timestamps before calculations\n\n```typescript\nif (!isValidTimestamp(timestamp)) {\n return 'Unknown duration';\n}\n```\n\n### 3. Be careful with timezone conversions\n\n```typescript\n// Database stores UTC, display shows local\nconst dbTime = \"2024-01-01 12:00:00\"; // UTC\nconst parsed = new Date(dbTime.replace(' ', 'T') + 'Z'); // parsed as UTC\nconst display = formatForDisplay(parsed); // Converts to local for display\n```\n\n### 4. Handle negative durations gracefully\n\n```typescript\nconst duration = endTime - startTime;\nif (duration < 0) {\n console.warn('Negative duration detected');\n return 'Invalid duration';\n}\n```\n\n## Testing Timestamp Code\n\nWhen testing timestamp-related features:\n\n1. Test with different timezones (especially negative UTC offsets)\n2. Test with daylight saving time transitions\n3. Test with very old and future timestamps\n4. Test with invalid/malformed timestamps\n5. Verify duration calculations are always positive\n"},{"path":"docs/TOOL_PANEL_SYSTEM.md","title":"Tool Panel System Implementation Guidelines","text":"# Tool Panel System Implementation Guidelines\n\n⚠️ **IMPORTANT**: The tool panel system implements a flexible, extensible architecture for managing multiple tool instances per session.\n\n## Architecture Overview\n\nThe tool panel system consists of several key components:\n\n1. **Panel Manager** (`main/src/services/panelManager.ts`): Central coordinator for panel lifecycle management\n2. **Terminal Panel Manager** (`main/src/services/terminalPanelManager.ts`): Specialized handler for terminal panel processes\n3. **Panel Event Bus** (`main/src/services/panelEventBus.ts`): Event communication system between panels\n4. **Panel Store** (`frontend/src/stores/panelStore.ts`): Frontend state management with Zustand\n5. **Panel Components**: React components for rendering different panel types\n\n## Key Implementation Principles\n\n- Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it (`runpane doctor` has Pane's working rules). A Pane owns one worktree and branch; panels (tabs) share it. Agents add review, QA and fix agents for existing work as new panels with `runpane panels create --pane <id>`, never as new Panes. See [Sessions](SESSIONS.md#one-pane-per-feature).\n\n1. **Lazy Initialization**: Panels are created in the database immediately but background processes (like terminal PTY) only start when the panel is first viewed\n2. **State Persistence**: All panel state including terminal scrollback, working directories, and configurations persist across application restarts\n3. **Memory Efficiency**: Inactive panels suspend rendering but maintain background processes\n4. **Event-Driven Updates**: Uses IPC events to synchronize state between main and renderer processes\n5. **Extensible Design**: Architecture supports future panel types beyond terminals\n\n## Panel Lifecycle\n\n1. **Creation**: User clicks \"Add Tool\" → Panel entry created in database → Added to UI\n2. **First View**: User clicks panel tab → Background process initializes → XTerm.js mounts\n3. **Switching**: User switches panels → Previous panel unmounts XTerm → New panel mounts\n4. **Background Operation**: Processes continue running even when panel is not visible\n5. **Deletion**: Panel closed → Process terminated → Database entry removed → UI updated\n\n## Terminal Panel Specifics\n\n- Each terminal panel spawns an independent PTY process using node-pty\n- Terminal metadata (cwd, dimensions, agent session) persists in `tool_panels.state` as JSON, ceilinged at 256 KB per panel and merged key by key inside SQLite\n- Terminal bytes (scrollback, serialized snapshot, alternate-screen frame) persist in `panel_buffers`, capped at 4 MB per panel with the oldest scrollback trimmed first\n- XTerm.js instances mount/unmount based on panel visibility to save memory\n- Working directories are maintained independently per panel\n- Command history and environment variables can be preserved across restarts\n- Each shell gets `PANE_PANEL_KIND`, set when it starts so shell startup files can branch on it: `dock` (the first\n plain shell, pinned to the bottom terminal dock), `shell` (another plain shell tab), `agent` (an agent CLI such as\n Claude Code or Codex) or `command` (any other launch command)\n- Cmd-click on macOS or Ctrl-click on Windows/Linux opens `pane://open?pane=<pane-id>&panel=<panel-id>` links in terminal output inside Pane. The panel parameter is optional.\n\n## Database Schema\n\n- `tool_panels` table stores panel configuration and state\n- `sessions.active_panel_id` is the last-used tab per session: the one any client picked most recently. A client with no memory of a Pane opens it there, and `runpane panels list` reports it as active\n- Foreign key constraints ensure panels are cleaned up when sessions are deleted\n\n## Event System\n\n- A client's tab click (`panels:set-active`), `runpane panes focus` and opening a Session view update `active_panel_id` and move no other client. A host- or agent-initiated activation (`runpane panels open`, `panels create`/`panes create` with focus, Pane Chat, new-Pane setup, run scripts) sends `panel:activeChanged` (`PanelActivationRequest`), which only clients already showing that Pane follow\n- The remote web and mobile app remembers its own Pane, Session and tab per host in browser storage. Each desktop remembers its own split and tabs per Pane in its local `ui_state` (`paneLayout.<pane id>[@<host profile id>]`) and its own Session in navigation memory; it opens a Pane on `active_panel_id` and the stored `panel_layout` only when it has no memory of it. Tabs missing from its memory join the primary group, except agent-opened ones (`metadata.openPlacement: 'split'`), which go to the side group, inactive\n- Terminal panels emit `terminal:command_executed`, `terminal:exit`, and `files:changed` events\n- Event bus routes events to subscribed panels (planned for future panel types)\n- Events support future inter-panel communication (e.g., diff panels reacting to file changes)\n\n## Implemented Panel Types\n\nThe tool panel system supports 11 panel types (`ToolPanelType` in `shared/types/panels.ts`):\n\n1. **Terminal** (`terminal`): PTY shells, several per pane. Agent CLIs such as\n Claude Code, Codex and Cursor Agent run in terminal panels\n (`TerminalPanelState.agentType` records which one).\n **Chat** (`chat`): any agent whose config has a `chat` section, over ACP,\n with no terminal; its state is\n `ChatPanelState` (`shared/types/chatTab.ts`) and only the host's chat runtime\n writes it. See [CHAT_TABS.md](CHAT_TABS.md).\n2. **Diff** (`diff`): git diff viewer. Singleton, permanent, worktrees only.\n3. **Explorer** (`explorer`): file tree.\n4. **Editor** (`editor`): Monaco editor, one tab per open file.\n5. **Logs** (`logs`): script execution output. Singleton.\n6. **Dashboard** (`dashboard`): project overview. Singleton, permanent,\n projects only.\n7. **Setup Tasks** (`setup-tasks`): project setup checklist. Singleton,\n permanent, projects only.\n8. **Browser** (`browser`): embedded browser. Worktrees only.\n9. **Notes** (`notes`): the Pane's notes. Singleton. Experimental: hidden\n until Settings → Advanced → Notes is on.\n10. **Device** (`device`): an iOS simulator or Android emulator's live screen,\n opened by `device_open`, not the + menu. See [DEVICES.md](DEVICES.md).\n\n## Panel Capabilities\n\nEach panel type has specific capabilities defined in `PANEL_CAPABILITIES`:\n\n- **requiresProcess**: Whether panel needs background process (terminal, logs)\n- **singleton**: Only one instance per session (diff, logs, dashboard, setup-tasks)\n- **permanent**: Cannot be closed by user (diff, dashboard, setup-tasks)\n- **canAppearInProjects**: Available in project view (all except diff and browser)\n- **canAppearInWorktrees**: Available in worktree sessions (all except dashboard, setup-tasks)\n- **canEmit**: Events this panel can produce\n- **canConsume**: Events this panel listens to\n\nExample: Diff panels are singleton + permanent + worktree-only, consuming `files:changed` and `terminal:command_executed` events to auto-refresh.\n\n### Named custom launch profiles\n\nIn a worktree's **Add Tool (+)** menu, choose **Add custom command…** and enter\nan optional **Name** alongside the command. **Save & launch** saves the profile\nand opens a terminal tab with that name. Leaving the name blank uses the first\nthree words of the command. Saved profiles are shared through app configuration.\nUse the pencil beside a saved profile to rename it; the menu and future tabs use\nthe new name. Existing tabs keep their titles. Hover a profile to see its full\nname and command.\n\nResume commands retain the original shell quoting and environment assignments when removing a launch prompt. Custom Claude launchers may choose a separate configuration directory; Pane trusts their recorded conversation IDs instead of checking the app configuration for their transcripts.\n"},{"path":"docs/UPDATE_RECOVERY.md","title":"Update prerequisites, status and recovery","text":"# Update prerequisites, status and recovery\n\n`runpane update` defaults to the running Pane app and the CLI that received the\ncommand, on the machine where the command runs. A remote host selected in the UI\ndoes not change that target. Use `--pane-only` or `--cli-only` for one component.\nThe Update button in Settings uses the app's built-in updater instead, and does\nnot need the prerequisites below; see [Built-in updater](#built-in-updater). When a prerequisite is missing, `runpane update`\nhands off to that built-in updater: the running Pane downloads the latest release,\nquits and installs it, and the command prints `\"mode\": \"in-app\"`. The handoff\nskips the checkpoint, snapshot and panel restoration described here, and it\nleaves an npm or pip CLI as it was (`cliUpdated: false`). It returns `\"phase\": \"installing\"` once the\ninstall starts; with `--wait` it returns `\"phase\": \"complete\"` only after the relaunched Pane\nreports the new version, and fails with `ERR_UPDATE_IN_APP_TIMEOUT` after 10 minutes. Pinned versions,\n`--pane-path`, `--cli-only` and `--dry-run` still report the refusal.\nRun `runpane update --dry-run --json` first to see the executable, data directory,\nCLI owner and supervisor capability without starting an update.\nWhen Pane is not running on the machine, for example because a failed update\nleft it unable to start, `runpane update` installs the requested release\n(latest by default) instead, like `runpane install`. If even `runpane` fails, see\n[Bundled runpane](RUNPANE_BUNDLED_CLI.md#how-it-works) for its fallback to `node`.\n\n## Built-in updater\n\nPackaged Pane on Windows, Linux and signed macOS installs checks for a new\nrelease at launch and every 4 hours and downloads it in the background. When\nthe download finishes, a **Restart to update** button appears above the sidebar\nfooter (a blue refresh icon when the sidebar is collapsed). After 5 minutes with\nno agent working or waiting for you, no run script running and no worktree being\nremoved, a toast offers **Tonight**, **Later** or **Restart now**:\n\n- **Restart now** quits Pane the normal way, installs the update and relaunches.\n The next launch resumes every interrupted agent in every project on its saved\n conversation, reopens the Pane that was open and skips the Resume dialog. It\n relaunches each agent with its resume command and types nothing into it. A\n Pane whose agent cannot resume stays interrupted and the toast says so; the\n Resume dialog offers it when it belongs to the active project.\n- **Later** hides the toast for 4 hours. The sidebar button stays.\n- **Tonight** restarts between 2:00 and 5:00 local time, once nothing has run for\n an hour and the keyboard and mouse have been idle for 30 minutes. To cancel,\n click the sidebar button (now **Restarts tonight**), then **Don't restart\n tonight**.\n\nClicking the sidebar button while something runs says what is running and offers\n**Restart anyway**. A macOS install whose signature cannot be verified downloads\nnothing in the background; its button reads **Update available** and opens the\nSoftware Update dialog. Turning off **Settings → General → Check for updates\nautomatically** stops the checks and the downloads, hides the button and\ncancels Tonight.\n\nTo test locally, serve a newer build from a generic feed and start a dev build\nwith `TEST_UPDATES=true UPDATE_SERVER_URL=<feed url>`. The dev build downloads\nfrom that feed and **Restart now** relaunches in place instead of installing.\nThese test-only variables shorten the timers: `PANE_TEST_UPDATE_IDLE_SECONDS`,\n`PANE_TEST_UPDATE_TONIGHT_IDLE_SECONDS`,\n`PANE_TEST_UPDATE_TONIGHT_INPUT_IDLE_SECONDS` and\n`PANE_TEST_UPDATE_TONIGHT_HOURS` (for example `0-24`).\n\n## Prerequisites\n\nBoth the running app and the requested app release must support continuity\nprotocol 1. No existing 2.4.182 release has the required `continuity.json`\nmanifest. To bootstrap this feature, install a continuity-capable release with\nits normal installer before using this path; installing the CLI alone does not\nadd support to an older running app. A requested older target without that manifest is refused before shutdown.\n\nUse an account that owns the app and CLI directories, in an interactive login\nwith launchd (macOS), Task Scheduler (Windows), or user systemd (Linux). The app\nmust be a packaged macOS bundle, Windows installation, or owned Linux AppImage.\nSystem package installations on Linux require their package manager. App updates\nrequire platform signature verification on macOS and Windows. The official\nWindows 2.4.182 installer is unsigned and is refused by this verifier.\n\nInstall standalone patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) and make it available on PATH to the process\nstarting the update. The helper copies this runtime before shutdown; Electron\ninside the app being replaced is insufficient. npm must also be available when\nupdating a JavaScript CLI. The supported CLI owners are:\n\n- Pane's managed CLI, normally under `<pane-dir>/bin`; an explicit CLI-only\n update remains selected when an older Pane next starts.\n- A writable global npm `runpane` installation in the prefix reported by its\n own npm. Local project packages and npx cache copies are refused.\n- The invoking Python environment's writable `runpane` package, with its own\n `python -m pip` available. Virtual environments, including pipx environments,\n and user-site installs are identified by their actual package paths. A pip\n dry run must accept the staged wheel. The Python wrapper also requires the\n continuity engine installed by Pane under the same `--pane-dir`; pip alone\n does not install that engine or Node.\n\nThe helper checks directory permissions, data/profile readability and free\nspace on each affected volume. Windows can exclusively lock live browser-profile\nfiles; their sizes are counted before shutdown, and the snapshot must successfully\nread them after clean shutdown before installation is allowed. It stages downloads\nbefore shutting down Pane.\n\nThe snapshot holds Pane's own state, not everything in the data folder: every\ntop-level file (config, databases, journals) and the folders Pane keeps state in\n(`PANE_STATE_FOLDERS` in `packages/runpane/src/updateCapacity.ts`). Folders Pane\nrebuilds or doesn't migrate (`bin`, `shell`, `projects`, the `agent-adapters`\nfolder older versions downloaded chat adapters into, and\nothers in `PANE_UNSNAPSHOTTED_FOLDERS`), git checkouts, and folders Pane does\nnot know are left out. Preflight lists the last two in `snapshotSkipped`, so a\ndry run shows them; back them up yourself if they matter. A test fails when the\ncode writes a top-level folder that is on neither list.\n\nThe CLI that requested an update may be answering a remote\n`runpane workspace <machine> exec` through the Pane it is about to stop. The\nhelper waits up to 60 seconds for that CLI to exit, and 2 seconds more, before\nstopping Pane, so the reply with the operation `id` arrives.\nA successful dry run checks local prerequisites; it does not download or prove\nthat the requested release passes artifact verification.\n\n## Status and exit codes\n\nKeep the operation's `id` and use the same `--pane-dir`:\n\n```sh\nrunpane update --json\nrunpane update --status <id> --pane-dir <path> --wait --json\n```\n\nThe status command reads the local journal even while Pane is stopped, provided\nthe invoking CLI and its runtime can still launch. If the normal command fails\nbecause the app or CLI was damaged, read `<pane-dir>/updates/<id>/status.json`\ndirectly in a text editor. On macOS/Linux, use\n`cat \"<pane-dir>/updates/<id>/status.json\"`; in PowerShell, use\n`Get-Content -Raw '<pane-dir>\\updates\\<id>\\status.json'`. Replace the placeholders\nwith the original data directory and operation ID. This read does not start or\nresume an update. If the ID was lost, inspect the directories under `updates`\nand match the journal's ID and host with `preflight.json`; do not guess ownership\nfrom timestamps alone. A missing or unreadable journal requires maintainer help.\n\nThe command's JSON\nobject has these fields; this result is documented here and is not currently a\nnamed schema in the agent contract's `jsonSchemas` collection.\n\n| Field | Meaning |\n| --- | --- |\n| `id`, `host`, `scope`, `version` | Operation identity, local machine, `both`/`pane`/`cli`, and requested or resolved release |\n| `phase` | Current stage or terminal outcome |\n| `completed` | Stages durably recorded as finished |\n| `appUpdated`, `cliUpdated` | Selected component installation finished; neither implies host or panel readiness |\n| `hostReachable` | Relaunched host passed version, identity and endpoint/auth checks; false for CLI-only updates |\n| `restored` | Per-panel `{panelId, outcome, reason}` records; `resumed`, `preserved`, or `needs-attention` |\n| `error` | Failure explanation, when present |\n| `updatedAt`, `helperPid` | Last recorded time and acknowledged helper PID; PID presence alone does not prove liveness |\n| `statusFile`, `next` | Journal location and command to inspect it again |\n\nStages are `accepted`, `stage`, `checkpoint`, `stop`, `snapshot`, `install`,\n`launch`, `health`, and `restore`. Terminal phases are `complete`, `failed`, and\n`needs-attention`. `complete` means all selected components and applicable health\nand restoration gates finished; preserved idle/blocked panels are intentional.\n`needs-attention` can mean a partially updated installation or individual panels\nrequiring manual action. Inspect the booleans, completed stages, error and every\npanel outcome together.\n\nExit 0 means the returned status is not a terminal failure. Without `--wait`, it\ncan still be in progress. `failed` and `needs-attention` return exit 1. Command or\npreflight errors also return nonzero. `--wait` has no overall timeout. Ctrl+C stops\nthe waiting caller, not the independent operation; inspect status before retrying.\nThere is no supported operation cancellation command. A fresh update runs\npreflight before checking locks. If preflight succeeds and another operation\nholds the lock, it returns that operation's status instead of starting another\ninstall.\nDuring downtime, preflight may fail before reaching the lock. Use `--status`\n(which bypasses preflight), or read the journal directly, to inspect recovery.\n\n## What happens to agent work and drafts\n\nOnly a panel recorded as actively working, with an exact conversation ID and a\nsupported resume command, is eligible to reopen. Built-in launch resolution\ncovers Claude, Codex, Cursor, native OpenCode and Pi. OpenCode requires a recorded\nvalid `ses_…` selector and an eligible direct launch command; incompatible Session\nwrappers or custom-resume settings are refused. Custom commands use their\neffective resume profile: an explicit template containing `{sessionId}`, or the\nderived profile for a recognized Agent Farm launch. Eligibility and command\nconstruction do not prove history exists or guarantee provider restoration:\n`resumed` requires fresh conversation-identity and readiness evidence from the\nrunning harness. An incompatible command or missing evidence yields\n`needs-attention`.\n\nReadiness requires an explicit adapter acknowledgment after the harness has\naccepted the exact conversation and is usable. The relaunched process receives\na fresh `PANE_UPDATE_RESUME_NONCE`. An adapter may emit one complete line\n`PANE_UPDATE_RESUME_READY=<nonce>:<actual-loaded-conversation-id>` only after that\nacceptance. The nonce binds the acknowledgment to this launch; an old marker,\nwrapper ID line, generic output, startup animation or CLI-ready timeout does not\nconfirm readiness. Login/trust blockers and command exit prevent success.\nDo not print this marker merely because a wrapper started or received a resume ID.\n\nThe built-in Claude/Codex/Cursor/OpenCode launch commands do not currently provide\nthis acknowledgment themselves; Pane has no vendor acknowledgment adapter for\nthem. Without an instrumented harness adapter and verification of the fresh\nchallenge plus actual loaded conversation ID, reopening these conversations\nreports `needs-attention`; inspect the live panel manually. Custom\nreported/generated commands, including Agent Farm, can integrate the same\nacknowledgment. A reported conversation ID alone is insufficient. The native QA\nadapter proves this protocol with a harmless process, not a vendor login or\nconversation acceptance.\n\nReopening the conversation does not submit the interrupted task again. The agent\nmay return to its prompt; review it and decide what to send. Idle, completed and\napproval-blocked work stays stopped. The updater sends no `continue`, prompt,\nqueued mutation, or draft input.\n\nA panel the update left stopped starts when you open it, like any stopped panel,\nonce the update has ended: it finished, its helper process exited, or the\ncomputer restarted since the update last made progress. Its agent reopens on its\nsaved conversation and nothing is typed into it. While the update is still\nrunning, opening the panel reports that it is waiting for the update; retry when\nthe update finishes.\n\nBefore shutdown, the checkpoint saves each panel's prior state, activity, launch\nprofile, conversation ID and launch/worktree/Session cwd. Unsubmitted composer\ntext detected in the terminal prevents automatic reopening. Inspect that panel's\n`priorState.screenText`, `initialInput` and `initialInputFile` in `checkpoint.json`\nfor the saved evidence. Screen text can contain other terminal content and is not\na promise of a complete editable draft. Recover and verify the intended text\nmanually before submitting anything. Do not share checkpoint files publicly.\n\n## Recovering an interrupted operation\n\nAll paths below use the same Pane data directory supplied with `--pane-dir`.\nThe operation directory is `<pane-dir>/updates/<id>/`:\n\n| File or directory | Purpose |\n| --- | --- |\n| `status.json`, `preflight.json`, `staged.json` | Progress, original executable/data/profile and CLI paths, staged package/backup paths |\n| `checkpoint.json`, `restoration.json` | Prior panel state and durable per-panel launch claims/outcomes |\n| `quiesced.json` | Original host's clean-shutdown acknowledgment |\n| `snapshot/data`, `snapshot/profile`, `snapshot/complete.json` | Pre-install copy; only the complete marker establishes a finished snapshot |\n\n### Inspecting the supervisor and remaining processes\n\nUse the operation ID from the journal. These commands inspect state; they do\nnot stop jobs or clear locks:\n\n| Platform | Supervisor and logs |\n| --- | --- |\n| macOS | `launchctl print \"gui/$(id -u)/com.pane.update.<id>\"`; read `<operation-directory>/supervisor.log` and `supervisor.plist` for the executable and arguments. |\n| Windows | `schtasks /Query /TN \"com.pane.update.<id>\" /V /FO LIST`; inspect `<operation-directory>/supervisor.xml`. Task Scheduler's History tab or the `Microsoft-Windows-TaskScheduler/Operational` event log may provide execution history if enabled. This adapter does not create a stdout/stderr log file. |\n| Linux | `systemctl --user status \"com.pane.update.<id>.service\"` and `journalctl --user -u \"com.pane.update.<id>.service\"`; transient units may already have been collected. |\n\nWindows relaunch can also create `com.pane.update.<id>-app`; inspect that task\nwhen present. A completed or missing supervisor is not proof that a child\ninstaller has exited. On macOS/Linux use `ps -axo pid,ppid,command`; on Windows\nuse `Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,ExecutablePath,CommandLine`\nin PowerShell. Compare full paths and arguments with this operation's staged\nruntime/helper, `staged.json` installer path and `preflight.json` installation.\nCheck helper children and installer processes separately; a reused PID, generic\nprocess name or stale Task Scheduler result is insufficient. If processes cannot\nbe attributed confidently, access is denied, or logs contradict the journal,\nleave locks and snapshots intact and ask a maintainer to inspect them.\n\n### Recovery steps\n\n1. Read status before starting another installer. If it is progressing, let it\n finish. If it stops progressing, inspect the helper supervisor and logs. A\n missing caller or terminal is expected; a PID alone is insufficient to decide\n the helper is dead. Do not remove locks while any helper/installer is active.\n2. For `failed` before shutdown, Pane remains available and the terminal operation\n releases its locks. Correct the reported preflight/staging problem and retry.\n3. For `needs-attention` with `hostReachable: true`, open the same installed Pane\n and inspect each panel outcome. Do not replay input whose delivery is unknown.\n Use the panel's normal explicit resume/restart control after reviewing its saved\n conversation and draft evidence. Already resumed panels must not be restarted\n merely because another panel needs attention.\n4. If Pane is stopped, use `preflight.json` to identify the exact executable,\n `paneDir` and `userData`. After establishing that no update helper/installer is\n still acting, launch that installation with `PANE_DIR` set to `paneDir` and\n `--user-data-dir=<userData>`. If the executable is missing or damaged, repair\n that same installation with the same or newer compatible official installer.\n Keep the operation directory and snapshot while diagnosing the failure.\n5. Never replace a migrated database with the old snapshot while the newer app is\n running. A rollback needs a compatible application and a complete data/profile\n snapshot restored together while all relevant processes are stopped. This\n updater does not automate or validate such a rollback. Get maintainer help\n when compatibility or installer state is uncertain.\n\nAn operation releases its locks when it ends `complete` or `failed`, or ends\n`needs-attention` after its `install` step completed (for example, a failed\nhealth check or panel restoration). The next `runpane update` also reclaims a\nlock left by such an operation. It runs in a new operation directory, so the\nold journal, checkpoint and snapshot stay in place.\n\nA `needs-attention` operation that stopped before or during `install` keeps\nits locks, because an installer child may still be running. A lock owned by an\noperation that has not ended is not reclaimed either. To recover, verify that no\noperation-owned helper or installer is running, then move aside only locks whose\n`owner.json` contains this exact operation ID. Lock directories are listed in\n`preflight.json` as `lockDirectory` and `additionalLockDirectories`. Do not\ninfer ownership from a reused PID. If recovery of a crashed lock cleanup is\nitself interrupted, its persistent cleanup claim also requires manual\ninspection; another caller will not steal it or report a new update as\ncompleted. Logout/reboot continuation is not guaranteed.\n"},{"path":"docs/UX_PRINCIPLES.md","title":"UX principles: progressive disclosure","text":"# UX principles: progressive disclosure\n\nGuidelines for Pane's UI design, informed by Linear and Claude Code CLI patterns.\n\n## Core Principles\n\n### 1. Prompt-First, Options-Second\n\nEvery interaction should lead with the primary action. For session creation, that's the prompt. For settings, that's the most common toggle. Everything else is secondary and should be layered behind progressive disclosure.\n\n**Do:** Auto-focus the primary input. Show one clear action.\n**Don't:** Present a wall of fields, cards, and sliders on first load.\n\n### 2. Opinionated Defaults Over Choice Overload\n\nProvide one good default rather than forcing a choice. Users interpret defaults as expert recommendations (the \"default effect\"). When 80%+ of users will pick the same option, make it the default and let the rest override.\n\n**Do:** Default to 1 session. Auto-generate names. Remember the last choice where a choice is needed.\n**Don't:** Present every agent as an equal-weight card that must be picked every time.\n\n### 3. The 80/20 Rule\n\nShow the 20% of features that 80% of users need. Hide the rest behind expandable sections, overflow menus, or context menus. Every visible element competes for attention.\n\n**Do:** Show prompt + create button. Put model selection, session count, branch config behind \"Session options.\"\n**Don't:** Show session count slider, tool cards, model dropdowns, and commit mode all at once.\n\n### 4. Minimal Status Indicators\n\nMatch Claude Code CLI's simplicity. Status should be informative without being distracting. Simple text beats animated spinners. A color-coded dot beats a pulsing badge with rotating icons.\n\n**Do:** Show `Thinking...` with subtle animated dots.\n**Don't:** Show spinning rings, bouncing dots, rotating icons cycling through 8 images, and 41 wacky status messages.\n\n### 5. Progressive, Not Hidden\n\nProgressive disclosure is not about hiding features — it's about layering them. Users should always see a clear affordance that more options exist (chevron, \"More options\" link, overflow menu icon).\n\n**Do:** Use `▸ Session options` with a chevron that expands to reveal fields.\n**Don't:** Remove the session count slider entirely. Don't bury settings with no visual indicator.\n\n## Patterns to Follow\n\n### Linear's \"One Good Way\"\n\nLinear deliberately constrains flexibility in favor of purpose-built workflows:\n- Issue creation needs only a **title** — everything else is optional\n- Smart pre-population (highlighted text auto-fills issue title)\n- Opinionated at the atomic level (labels and due dates are issue properties, not configurable)\n- Purpose-built over flexible\n\n**Pane equivalent:** Creating a pane needs nothing typed: the name is auto-generated, and the agent and prompt are optional.\n\n### Claude Code CLI's Minimalism\n\n- Shows simple `thinking...` during processing — no visual noise\n- Thinking content hidden by default, revealed via `Ctrl+O`\n- Status line is optional and customizable\n- Updates debounced at 300ms to prevent visual flicker\n\n**Pane equivalent:** Keep status dots simple. No animations unless state actually changes.\n\n### Collapsible Section Pattern\n\nUse for grouping secondary options:\n- Clear heading that describes what's inside\n- Chevron indicator (▸ collapsed, ▾ expanded)\n- Remember expansion state in user preferences\n- Keep disclosure levels below 3 (avoid nesting collapsibles inside collapsibles)\n\n### Overflow Menu Pattern\n\nUse when 3+ utility actions compete for toolbar space:\n- Keep the most-used action visible (with keyboard shortcut)\n- Group remaining actions behind `⋯` (MoreHorizontal) icon\n- Menu items should have icons + labels\n- Include state indicators where relevant (e.g., \"Sort: Newest first\")\n\n## When NOT to Simplify\n\nProgressive disclosure fails when critical information is hidden:\n- Never hide destructive actions behind progressive disclosure without confirmation\n- Don't hide information users need to make decisions (e.g., hiding that a session will use Codex instead of Claude)\n- Don't over-simplify settings that have security implications (API keys, permission modes)\n- If sales/engagement drops after hiding something, bring it back — trust trumps minimalism\n\n## Visual Design Principles\n\n### Reduce Visual Noise\n- Fewer colors, fewer animations, fewer competing elements\n- Use whitespace to create hierarchy\n- Sequential content flow (top-to-bottom)\n- One primary action per view\n\n### Animations\n- Only animate to communicate state changes (not for decoration)\n- Respect `prefers-reduced-motion` OS setting\n- Debounce status updates (300ms minimum)\n- Subtle > flashy. Text > spinners. Dots > bouncing balls.\n\n### Color\n- Use color sparingly and consistently for status:\n - Green: running/success\n - Yellow: waiting/attention needed\n - Red: error\n - Blue: new/unviewed activity\n - Gray: completed/inactive\n\n## References\n\n- [The Linear Method: Opinionated Software](https://www.figma.com/blog/the-linear-method-opinionated-software/)\n- [How we redesigned the Linear UI](https://linear.app/now/how-we-redesigned-the-linear-ui)\n- [Progressive disclosure in UX: Types and use cases (LogRocket)](https://blog.logrocket.com/ux-design/progressive-disclosure-ux-types-use-cases/)\n- [Designing for Progressive Disclosure (UXmatters)](https://www.uxmatters.com/mt/archives/2020/05/designing-for-progressive-disclosure.php)\n- [The Default Effect in UX](https://www.ux-bulletin.com/default-effect-in-ux/)\n- [Claude Code CLI Status Line Docs](https://code.claude.com/docs/en/statusline)\n"},{"path":"docs/assets/visual-style.md","title":"dcouple README visual language","text":"# dcouple README visual language\n\nUse a shared pixel-art world with a distinct setting for each product. The family\nreference is the [Agent Farm banner](https://github.com/greenfield-inc/agent-farm/blob/19f1fba8ef12050eef39c1b44e725c697b57b87b/docs/assets/agent-farm-banner.png).\n\n## Shared rules\n\n- Crisp coherent pixels, readable silhouettes, and isometric miniature scenes.\n- Charcoal midnight backgrounds, warm cream lettering, and soft lantern light.\n- Cream robots with dark faceplates and green eyes; clothes and props reflect their role.\n- Restrained foliage, wood, stone, and floating islands connect the settings.\n- Wide 3:1 banners: title left, scene right. Supporting images are roughly 2:1.\n- Use each project's own setting, props, and accent colors. Avoid repeating the same farm under a new title.\n- Keep technical labels and arrows accurate. Preserve real screenshots, demos, commands, and detailed diagrams.\n- Do not depict planned features as shipped, implicit sharing as public, or required human approval as automatic.\n- Keep alt text and text equivalents for information-bearing diagrams.\n\n## This repository\n\nA multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\n\nLocal reference: [pane-banner.png](pane-banner.png).\n\nSupply that banner as an image reference for future generation. Match its pixel\ntreatment, characters, lighting, and palette while adapting the scene to the\nsection. Save final assets in `docs/assets/` and add the prompt to the\ngeneration record below; inspect labels and readability at README display width\nbefore embedding. Use new filenames for experiments rather than overwriting\nchosen art.\n\n## Generation record\n\nGenerated with the built-in image-generation tool, using the Agent Farm banner as\nthe style reference.\n\n### pane-banner.png\n\nUse case: stylized-concept\nAsset type: GitHub README hero banner, 3:1 landscape.\nUse the provided Agent Farm banner as STYLE REFERENCE only. Same crisp coherent pixel-art game world, charcoal midnight opaque backdrop, warm cream chunky title type, soft lantern light, cream robots with dark faceplates and green eyes, restrained foliage on isometric floating islands. Keep readable silhouettes and generous negative space. Give this product its own props and accent palette. No blur, smooth 3D, photorealism, watermarks, fake screenshots, tiny illegible text or extra slogans.\nScene: a multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\nComposition: large title on left 45%, detailed but tidy scene on right 55%; safe margins. Exact title: \"PANE\". Use two lines for long titles. Only this title as text. Make a polished sibling identity within the dcouple family.\n\n### pane-workspaces.png\n\nUse case: infographic-diagram\nAsset type: GitHub README section illustration, 2:1 landscape.\nUse the provided Agent Farm banner as STYLE REFERENCE only. Same crisp coherent pixel-art game world, charcoal midnight opaque backdrop, warm cream chunky title type, soft lantern light, cream robots with dark faceplates and green eyes, restrained foliage on isometric floating islands. Keep readable silhouettes and generous negative space. Give this product its own props and accent palette. No blur, smooth 3D, photorealism, watermarks, fake screenshots, tiny illegible text or extra slogans.\nLocal identity: a multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\nDiagram: Three panels left to right with exact headings and body lines: \"Repository\" / \"Saved base repo\"; \"Pane\" / \"Worktree and branch\"; \"Panels\" / \"Terminals share the worktree\". Arrows from Repository to Pane to Panels. Illustrate a project folder, a separate workshop booth, then two small terminals within that same booth. All panels are conceptual, not an app screenshot. No implication that each panel gets its own worktree.\nLarge highly legible cream text on uncluttered dark areas; graphical precision and factual readability take priority over scenery. No large product title. Match the supplied family reference.\nInput images for the section illustration: first is the family style reference; second is this project's generated banner. Match the second image's character, props and accents.\n"},{"path":"docs/lint/anti-slop.md","title":"Anti-slop policy","text":"# Anti-slop policy\n\nPane vendors the 15 Oxlint rules from `dmmulroy/anti-slop` at commit\n`cd064fe602b5915ff35e1e1c20836ca9bcb3729a` in\n`tools/oxlint/anti-slop`. The snapshot is intentionally local so the rules run\ndeterministically and can be reviewed alongside the code they gate.\n\nThe original full-repository scan covered `frontend`, `main`,\n`packages/runpane`, `shared`, `tests`, `scripts`, all non-vendored `tools`, and\nevery Playwright config. It found 2,463 findings in 240 files. The cleanup\ncampaign reduced every rule to a zero baseline, so all 15 rules now block\nregressions in the root lint command.\n\n| Rule | Baseline findings/files | Lane | Reason |\n| --- | ---: | --- | --- |\n| `no-object-parameters` | 0/0 | blocking | Prevent new positional object bags without an explicit contract. |\n| `no-reflect-apply` | 0/0 | blocking | Prefer direct, typed calls over reflective dispatch. |\n| `no-unknown-type-aliases` | 0/0 | blocking | Prevent aliases that rename uncertainty instead of parsing it. |\n| `no-widen-then-assert` | 0/0 | blocking | Prevent discarding known types and recovering them with assertions. |\n| `no-reflect-get` | 4/1 | blocking | Reflective reads were replaced with declared or descriptor-based access. |\n| `no-chained-type-assertions` | 89/22 | blocking | Boundary contracts avoid type laundering through chained assertions. |\n| `no-conditional-empty-object-spread` | 34/16 | blocking | Optional fields are assembled explicitly. |\n| `no-known-value-widening` | 142/65 | blocking | Known values retain inferred or named domain types. |\n| `no-module-mocking` | 31/13 | blocking | Tests use explicit seams or real modules. |\n| `no-runtime-typeof` | 417/94 | blocking | Runtime boundaries use parsers, feature checks, or domain guards. |\n| `no-shape-in-symbol-names` | 18/1 | blocking | Symbols describe domain intent rather than structural shape. |\n| `no-unknown-parameters` | 250/64 | blocking | Uncertain input is parsed at its boundary, including unconstrained parser-only generic parameters. |\n| `no-unknown-returns` | 37/21 | blocking | Adapters return parsed domain values. |\n| `no-unsafe-dictionary-type` | 192/51 | blocking | Dictionary contracts use bounded keys or validated JSON objects. |\n| `require-safety-comment-for-type-assertion` | 1,249/177 | blocking | Remaining necessary assertions document their checked invariant. |\n\nRun `pnpm lint` for the blocking policy. `pnpm lint:ox:extra` and\n`pnpm lint:ox:extra:details` remain available as harness checks, but no rules\nremain in the advisory lane.\n\n## Root cause policy\n\nFor agent-written Pane code, the most important class is uncertainty that leaks\npast an I/O boundary and later becomes a widening or assertion. Ask: **is this\nchange fixing the root cause or a symptom?** The root fix parses IPC, daemon,\nfilesystem, process, or browser input once into a named domain type. A late\n`unknown` alias, representation ladder, dictionary, or assertion usually treats\nthe symptom. Blocking findings should guide that review.\n\nAny future anti-slop rule must reach a zero baseline for the full scope before\njoining the blocking configuration. Do not silence a class globally to make a\npromotion appear clean.\n\nThe root development toolchain requires patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) for the eMudhra CA\nfix. Oxlint's TypeScript plugin runs under the developer Node process. This does not change\nElectron 43's bundled Node 24 runtime, and the published `runpane` wrapper requires the same patched standalone Node ranges.\n\n`no-unknown-parameters` also reports an unconstrained function type parameter used directly as an input when an explicit return type and every other parameter omit it. Generic identities, callback relationships, relationships expressed by other generic constraints, constrained inputs, and inferred return contracts remain valid. Boundary parsers and output serializers should use `unknown` with a local explanation of the schema or transport contract, rather than a generic that hides an unvalidated input.\n"},{"path":"docs/lint/oxlint-overlap.md","title":"Oxlint and ESLint overlap","text":"# Oxlint and ESLint overlap\n\n`pnpm lint:ox` is the first blocking lane. ESLint remains blocking for rules\nwhose current Pane semantics are not reproduced by Oxlint 1.76.0, and continues\nto report the repository's existing warning-level checks. An ESLint rule is\ndisabled in `tools/eslint/oxlint-overlap.cjs` only when the explicit blocking\nOxlint rule below replaces it.\n\nThe 79 unique ESLint error-level rules were resolved from the frontend, main,\nand RunPane flat configs. Seventy-eight have blocking equivalents. `no-octal`\nhas no Oxlint 1.76.0 equivalent and therefore stays in ESLint.\n\n| ESLint rule | Blocking Oxlint rule | Scope/disposition |\n| --- | --- | --- |\n| `for-direction` | `eslint/for-direction` | common; moved |\n| `no-async-promise-executor` | `eslint/no-async-promise-executor` | common; moved |\n| `no-case-declarations` | `eslint/no-case-declarations` | common; moved |\n| `no-compare-neg-zero` | `eslint/no-compare-neg-zero` | common; moved |\n| `no-cond-assign` | `eslint/no-cond-assign` | common; moved |\n| `no-constant-binary-expression` | `eslint/no-constant-binary-expression` | common; moved |\n| `no-constant-condition` | `eslint/no-constant-condition` | common; moved |\n| `no-control-regex` | `eslint/no-control-regex` | common; moved |\n| `no-debugger` | `eslint/no-debugger` | common; moved |\n| `no-delete-var` | `eslint/no-delete-var` | common; moved |\n| `no-dupe-else-if` | `eslint/no-dupe-else-if` | common; moved |\n| `no-duplicate-case` | `eslint/no-duplicate-case` | common; moved |\n| `no-empty` | `eslint/no-empty` | frontend only; moved (main/RunPane warning retained) |\n| `no-empty-character-class` | `eslint/no-empty-character-class` | common; moved |\n| `no-empty-pattern` | `eslint/no-empty-pattern` | common; moved |\n| `no-empty-static-block` | `eslint/no-empty-static-block` | common; moved |\n| `no-ex-assign` | `eslint/no-ex-assign` | common; moved |\n| `no-extra-boolean-cast` | `eslint/no-extra-boolean-cast` | common; moved |\n| `no-fallthrough` | `eslint/no-fallthrough` | common; moved |\n| `no-global-assign` | `eslint/no-global-assign` | common; moved |\n| `no-invalid-regexp` | `eslint/no-invalid-regexp` | common; moved |\n| `no-irregular-whitespace` | `eslint/no-irregular-whitespace` | common; moved |\n| `no-loss-of-precision` | `eslint/no-loss-of-precision` | common; moved |\n| `no-misleading-character-class` | `eslint/no-misleading-character-class` | common; moved |\n| `no-nonoctal-decimal-escape` | `eslint/no-nonoctal-decimal-escape` | common; moved |\n| `no-octal` | — | common; retained in ESLint |\n| `no-prototype-builtins` | `eslint/no-prototype-builtins` | common; moved |\n| `no-regex-spaces` | `eslint/no-regex-spaces` | common; moved |\n| `no-self-assign` | `eslint/no-self-assign` | common; moved |\n| `no-shadow-restricted-names` | `eslint/no-shadow-restricted-names` | common; moved |\n| `no-sparse-arrays` | `eslint/no-sparse-arrays` | common; moved |\n| `no-unexpected-multiline` | `eslint/no-unexpected-multiline` | common; moved |\n| `no-unsafe-finally` | `eslint/no-unsafe-finally` | common; moved |\n| `no-unsafe-optional-chaining` | `eslint/no-unsafe-optional-chaining` | common; moved |\n| `no-unused-labels` | `eslint/no-unused-labels` | common; moved |\n| `no-unused-private-class-members` | `eslint/no-unused-private-class-members` | common; moved |\n| `no-useless-backreference` | `eslint/no-useless-backreference` | common; moved |\n| `no-useless-catch` | `eslint/no-useless-catch` | common; moved |\n| `no-var` | `eslint/no-var` | common; moved |\n| `prefer-const` | `eslint/prefer-const` | frontend only; moved (main/RunPane warning retained) |\n| `prefer-rest-params` | `eslint/prefer-rest-params` | common; moved |\n| `prefer-spread` | `eslint/prefer-spread` | common; moved |\n| `require-yield` | `eslint/require-yield` | common; moved |\n| `use-isnan` | `eslint/use-isnan` | common; moved |\n| `valid-typeof` | `eslint/valid-typeof` | common; moved |\n| `@typescript-eslint/ban-ts-comment` | `typescript/ban-ts-comment` | common; moved |\n| `@typescript-eslint/no-array-constructor` | `typescript/no-array-constructor` | common; moved |\n| `@typescript-eslint/no-duplicate-enum-values` | `typescript/no-duplicate-enum-values` | common; moved |\n| `@typescript-eslint/no-empty-object-type` | `typescript/no-empty-object-type` | common; moved |\n| `@typescript-eslint/no-explicit-any` | `typescript/no-explicit-any` | common; moved |\n| `@typescript-eslint/no-extra-non-null-assertion` | `typescript/no-extra-non-null-assertion` | common; moved |\n| `@typescript-eslint/no-misused-new` | `typescript/no-misused-new` | common; moved |\n| `@typescript-eslint/no-namespace` | `typescript/no-namespace` | common; moved |\n| `@typescript-eslint/no-non-null-asserted-optional-chain` | `typescript/no-non-null-asserted-optional-chain` | common; moved |\n| `@typescript-eslint/no-require-imports` | `typescript/no-require-imports` | frontend only; moved (main/RunPane warning retained) |\n| `@typescript-eslint/no-this-alias` | `typescript/no-this-alias` | common; moved |\n| `@typescript-eslint/no-unnecessary-type-constraint` | `typescript/no-unnecessary-type-constraint` | common; moved |\n| `@typescript-eslint/no-unsafe-declaration-merging` | `typescript/no-unsafe-declaration-merging` | common; moved |\n| `@typescript-eslint/no-unsafe-function-type` | `typescript/no-unsafe-function-type` | common; moved |\n| `@typescript-eslint/no-unused-expressions` | `typescript/no-unused-expressions` | common; moved |\n| `@typescript-eslint/no-wrapper-object-types` | `typescript/no-wrapper-object-types` | common; moved |\n| `@typescript-eslint/prefer-as-const` | `typescript/prefer-as-const` | common; moved |\n| `@typescript-eslint/prefer-namespace-keyword` | `typescript/prefer-namespace-keyword` | common; moved |\n| `@typescript-eslint/triple-slash-reference` | `typescript/triple-slash-reference` | common; moved |\n| `react-hooks/rules-of-hooks` | `react/rules-of-hooks` | frontend only; moved |\n| `jsx-a11y/alt-text` | `jsx-a11y/alt-text` | frontend only; moved |\n| `jsx-a11y/anchor-has-content` | `jsx-a11y/anchor-has-content` | frontend only; moved |\n| `jsx-a11y/aria-props` | `jsx-a11y/aria-props` | frontend only; moved |\n| `jsx-a11y/aria-proptypes` | `jsx-a11y/aria-proptypes` | frontend only; moved |\n| `jsx-a11y/aria-unsupported-elements` | `jsx-a11y/aria-unsupported-elements` | frontend only; moved |\n| `jsx-a11y/click-events-have-key-events` | `jsx-a11y/click-events-have-key-events` | frontend only; moved |\n| `jsx-a11y/heading-has-content` | `jsx-a11y/heading-has-content` | frontend only; moved |\n| `jsx-a11y/iframe-has-title` | `jsx-a11y/iframe-has-title` | frontend only; moved |\n| `jsx-a11y/no-access-key` | `jsx-a11y/no-access-key` | frontend only; moved |\n| `jsx-a11y/no-distracting-elements` | `jsx-a11y/no-distracting-elements` | frontend only; moved |\n| `jsx-a11y/no-static-element-interactions` | `jsx-a11y/no-static-element-interactions` | frontend only; moved with `onClick`/expression options |\n| `jsx-a11y/role-has-required-aria-props` | `jsx-a11y/role-has-required-aria-props` | frontend only; moved |\n| `jsx-a11y/role-supports-aria-props` | `jsx-a11y/role-supports-aria-props` | frontend only; moved |\n| `jsx-a11y/tabindex-no-positive` | `jsx-a11y/tabindex-no-positive` | frontend only; moved |\n\nBoth Oxlint configs disable the broad `correctness` category. This is\nintentional: the blocking contract is the explicit list above plus the 15\nzero-baseline anti-slop rules, rather than an unstable category preset.\n\nA Profiler-based render counter is deliberately deferred. Add one with the\nfirst named React subscription/render regression and a component test renderer\nthat can mount the affected Pane surface; React Scan supplies exploratory\nruntime evidence but is not a deterministic unit-test assertion.\n"},{"path":"docs/remote-daemon-lifecycle.md","title":"Remote Daemon Lifecycle","text":"# Remote Daemon Lifecycle\n\nThis is the implementation checklist for Remote Pane setup, teardown, and runtime switching. It exists to keep config writes, runtime controller actions, and renderer refreshes in sync.\n\n## Runtime Roles\n\n- Host lifecycle is owned by `PaneRemoteTransportController` and `remoteHostRuntimeStateStore`.\n- Client lifecycle is owned by `RemotePaneClientController`.\n- IPC handlers in `main/src/ipc/remoteDaemon.ts` orchestrate config writes and controller calls.\n- Renderer runtime changes are reconciled through `remote-daemon:resync-required`. Main sends `{ hostChanged: true }` when the active runtime changes; a reconnect to the same host sends it without a payload.\n- A resync refetches config, Panes, the active Pane's panels, repositories, Sessions and pinned Sessions, pending permission prompts, loaded archived Panes, archive progress, the host's terminal shells, and an open Usage view. When the host changed, it also leaves an open repository view, since repository ids are per host, loads that host's expanded repositories, opened Sessions and open Archived groups, and asks again about that host's interrupted Panes.\n- Expanded repositories are saved per host: this computer under `treeView.expandedProjects`, a remote host under `treeView.expandedProjects@<computer id>`.\n- Opened Sessions and open Archived groups are saved per host the same way, under `treeView.expandedSessions[@<computer id>]` and `treeView.expandedArchivedProjects[@<computer id>]`. A Session not in the opened list shows collapsed. Older `treeView.collapsedSessions[@<computer id>]` rows are no longer read and stay in `ui_state` unused.\n- Where the user was is saved per host too, under `navigation.lastLocation` / `navigation.lastLocation@<computer id>`: the active view, the open repository view's project id, and the open Pane. A switch clears the outgoing host's selection as above and then restores the incoming host's, validating every id against that host's freshly loaded repositories and Panes — anything archived or gone degrades to the home view, and the dead memory is overwritten rather than retried. `frontend/src/utils/hostNavigationMemory.ts` owns both halves; the renderer names the host on each read and write, because it can still be showing the outgoing host while main has already switched runtimes. Restoring selects one Pane, as a click would, and never revives every terminal once open on that host. The memory also holds this desktop's selected Session: launch and host switches both restore it, and the host's last-used Session is only the fallback when there is none. Another client's selection never moves it. The tabs and split inside each Pane are a separate per-Pane memory, `paneLayout.<pane id>` / `paneLayout.<pane id>@<computer id>` (`frontend/src/utils/paneLayoutMemory.ts`); the host's stored layout and active tab are the last used by any client and seed a Pane this desktop has not shown. Archiving or deleting a Pane drops its memory. At app startup the location memory reopens only one thing besides the Session: when this computer is the active host and the last Pane shown is live (not archived, folder present) with a chat tab in front (`ui-state:get-launch-chat`, `UIStateManager.getLaunchChat`), launch opens that Pane, as a click would, and focuses the chat's message box. Any other last view starts on Home. A launch with a remote host active, and the launch after a restart to update, keep their own restore.\n- The terminal shell picker reads and writes the active host's shell (`terminal:get-shell-settings`, `terminal:set-preferred-shell`). It appears only when that host runs Windows.\n- `pane:focus-requested` and `pane:open-link` are host events. `runpane panes focus` and `runpane panes create --focus` move only the desktop window attached to that host as its local host; a remote-mode client ignores them. A host- or agent-initiated tab activation (`panel:activeChanged`) moves only clients already showing that Pane, and a new Pane switches only the client whose request created it (`clientRequestId`, echoed on `session:created`). A pane:// link opened on a remote-mode client is resolved by its renderer against the active host.\n- Remote terminals ack output with `terminal:ack`. This window's ptyHost port reaches only local terminals.\n- The Remote Pane PWA keeps the same rules in the browser. When its event stream returns after a drop (network loss, or the native app resuming), it refetches Panes, the selected Pane's panels, Sessions, and loaded archived Panes. Connecting to a host or disconnecting clears all host-scoped state first: Panes, panels, Sessions, the open Session, archived Panes, open dialogs, and notification settings.\n\n## Lifecycle Matrix\n\n| Action | Main-process side effect | Renderer side effect |\n| --- | --- | --- |\n| Import connection and connect succeeds | Save the code as a route of its computer (or a new computer), activate it, set remote mode | Resync config, sessions, panels |\n| Import connection and connect fails | Save the route, keep current active runtime | No runtime resync |\n| Connect saved computer | Activate the computer before persisting remote mode | Resync config, sessions, panels |\n| Change route on the active computer | Reopen the event stream on the new route; no runtime switch | Reconnect resync (no `hostChanged`) |\n| Switch to local runtime | Disconnect active remote client, save local mode | Resync config, sessions, panels, clear stale active session |\n| Remove inactive computer, or its last route | Remove the computer | No runtime resync |\n| Remove active computer | Switch local, remove the computer, save local mode | Resync config, sessions, panels |\n| Enable or update host | Save host config, transport controller syncs to live or error | Host-state event updates UI |\n| Stop host | Save disabled host config, transport controller stops server | Host-state event updates UI |\n| Disconnect host clients | Drop matching SSE clients | Host-state event updates client count |\n| Revoke host client | Remove saved client record, drop matching SSE clients | Host-state event updates client count |\n\n## Guardrails\n\n- Saved computers live in `remoteDaemon.client.computers` (`shared/types/remoteComputers.ts`), one per computer with its routes in order; `client.activeProfileId` names a computer id. `client.profiles` is the pre-computers list, kept untouched for a downgrade and read only by the conversion.\n- Do not persist remote mode until the selected computer has successfully activated.\n- Failed import-connect saves the route but must not switch runtime or emit a renderer resync.\n- Connected remote clients are runtime state, not saved client records.\n- Current Pane Data hosting is live only while that Pane app is running.\n- Isolated daemon data can install a background service; Current Pane Data should not.\n\n## Terminal Input\n\nDesktop and browser clients send at most one terminal input request per panel at a time. Keys typed while a request is pending are combined into the next request, preserving their order without a separate round trip for every buffered key. A bare Escape always ends a combined request, because terminal apps read Escape followed by another key in the same write as an Alt shortcut. Different panels and other remote commands remain independent.\n\nAgainst a host that runs each request ID once (`deduplicatesRequestIds` in its `ready` event), each input request carries an ID. A request whose answer is lost, or that is caught by a reconnect or by the app going to the background, is resent with the same ID once the connection is back, and the queued input behind it follows in order. Callers are rejected once a request has waited five minutes for the connection.\n\nAgainst an older host, input requests are not retried. On failure, disconnect, or a ten-second input timeout, queued input is discarded and outstanding callers are rejected, because an interrupted request may already have reached the host.\n\n## Desktop media previews\n\nThe explorer's previews (images, PDFs, fonts, video, audio and the text formats) work from a remote desktop. The renderer still gets a `pane-media://preview/<token>` URL from its own main process; the grant records which host issued it, and a request after a host switch, or after a switch to local mode, gets 403. Each request goes to the host's `GET /media?sessionId=&filePath=` with the connection's usual authentication on that door, and its `Range` header passes through, so video and audio seek without downloading the whole file. The host checks that the path has a preview kind and resolves it through `file:getPath`, the same worktree and symlink boundary the host uses for its own previews, and answers 404 otherwise. Archive and SQLite listings use the daemon-owned `file:preview-list` command, so they run on the host too. \"Open with system app\" on a remote desktop downloads the whole file through the same route into a new temporary folder on that desktop and opens the copy, so edits in the system app do not reach the host. The copy keeps the host file name when that name is valid on every desktop OS, and is otherwise named `preview` plus the extension. A failed download or open removes the folder. While remote mode has no connected host, previews and Open fail; they never read the desktop's own files. \"Reveal in folder\" is available only on the host.\n\n## Desktop browser file previews\n\nBefore mounting a `file://` webview, the desktop renderer asks the local main process to prepare its session. In remote mode, an isolated in-memory Electron partition handles every file request through `panels:read-browser-file` on the existing authenticated remote connection. The original URL, including its filename, remains intact, so relative CSS, images, scripts and linked HTML pages resolve normally. Local-mode previews, like every other browser tab, use the shared `persist:pane-browser` store; Settings → Privacy → Clear browser data clears it on the computer showing the browser and is never forwarded to the host. This does not add browser panels to the Remote PWA.\n\nThe host reader requires an existing browser panel whose saved entry URL identifies a regular file. It serves regular files within that entry page's directory and descendants, with a 16 MiB limit per file. It checks canonical paths to reject traversal and symlinks/junctions outside that directory at validation time; it never lists directories. The host filesystem is trusted: these checks do not guarantee atomic containment against a host process maliciously replacing files or directories during a read. Thus opening a file shares its containing bundle directory with connected clients, not the entire worktree or disk. This endpoint has no caller-supplied root. File entry URLs are host-owned: HTTP command provenance is carried through async handlers, and the panel manager rejects remote attempts to create or retarget file previews (including through RunPane). Clients can update an unchanged entry but must open a new file on the host. The one exception is previewing a worktree HTML file: a remote desktop names the file and the host creates the browser tab for it, so links within that file's folder load through the reader above. Arbitrary `file://` URLs from a client stay refused.\n\nA host switch removes cached browser panels before asynchronous resync, so outgoing URLs and partitions cannot survive even when both hosts have identical panel IDs. Panel-list requests carry a host generation and refetch if their response belongs to an outgoing host. Incoming panel data recreates the guest and prepares its file session anew. While file preparation is unresolved, navigation does not mount a guest or persist URLs; starting preparation also cancels earlier pending URL writes. Remote file navigation is client-local and does not overwrite the host's saved entry URL. This keeps nested page navigation from changing the bundle boundary. If the host replaces the file entry with an HTTP(S) URL, the client returns to the shared browser store and ordinary navigation persistence, including when it was already viewing that HTTP page. Missing/deleted panels revoke reads; changing the connected profile or its base URL invalidates the previous session's requests, including responses already in flight. A failed fetch renders an error message and never falls back to the client's filesystem. For a file outside the entry page's directory, the message is the host's refusal: it names the file, that directory and the ways to fix the page. While the client is still connected to that host, the tab also shows that refusal under its address bar until its next page, so a refused stylesheet or script that the page never displays is still visible. Both desktop client and host need this version; an older host reports an unavailable preview.\n\nRun `pnpm build:main`, start the frontend with `pnpm --filter frontend dev`, then set `PANE_ELECTRON_E2E=1` and run `pnpm exec playwright test tests/remote-browser-files.spec.ts`. Set `PLAYWRIGHT_PORT` if using a different dev-server port. This opt-in Electron regression uses isolated temporary Pane data and a loopback host with the production HTTP/SSE transport. It verifies the actual BrowserPanel, CSS/image loads, linked-page navigation, the preserved filename, access denial and disconnect behavior, and saves `remote-client-rendered.png`. Linux requires a display (for example Xvfb).\n"},{"path":"docs/remote-terminal-flow-control.md","title":"Remote terminal output flow control","text":"# Remote terminal output flow control\n\nTerminal panels begin hidden until a client registers visibility with\n`terminal:setVisibility`. Hidden panels still stream to daemon subscribers and\nretain scrollback, but do not wait for renderer acknowledgements. A raw SSE\nsubscriber does not register visibility by merely opening `/events`.\n\nVisible panels pause their PTY at 100,000 unacknowledged characters and resume\nat 5,000. The five-second safety timeout abandons the stale acknowledgement\ncount before resuming; fresh output can still cross the high watermark and\npause again. This escape hatch prevents one lost acknowledgement from causing\nevery subsequent flush to wait five seconds. It does not disable backpressure\nfor a visible client that consistently fails to acknowledge output.\n\nAcknowledgements have no sequence or generation. After timeout recovery, a\ndelayed acknowledgement can temporarily reduce the fresh backlog count. Keeping\nforgiven debt would instead discard valid new acknowledgements when the old ones\nwere lost. Strict accounting across recovery would require a protocol change.\n\nDesktop clients connected to a remote host acknowledge processed output through\n`terminal:ack`, including when a PTY ID is known. Only local terminals can use\nthe local PTY host MessagePort. Clients attached to an already-running panel\ncan acknowledge by panel ID without receiving a new `terminal:ptyReady` event.\n\nAcknowledgement accounting is per terminal, not per viewer: one responsive\nviewer can release a pause even if another viewer is silent. Removing the last\nviewer clears pending flow control and resumes the PTY. Registered viewers\nsurvive a PTY host respawn, and attach/detach changes during an asynchronous spawn\nare applied to the replacement terminal.\n\nFocused regression checks:\n\n```sh\npnpm --filter main test run src/ptyHost/flowControl.test.ts src/services/terminalPanelManager.persistence.test.ts src/services/terminalPanelManager.test.ts\npnpm --filter frontend test src/utils/terminalAck.test.ts\n```\n"},{"path":"docs/troubleshooting/SETUP_TROUBLESHOOTING.md","title":"Setup Troubleshooting Guide","text":"# Setup Troubleshooting Guide\n\n## Python distutils Error\n\nIf you encounter this error during `pnpm run setup`:\n```\nModuleNotFoundError: No module named 'distutils'\n```\n\nThis happens because Python 3.12+ removed the `distutils` module that `node-gyp` depends on.\n\n### Quick Fix:\n```bash\nbrew install python-setuptools\n```\n\n### Alternative: Use Python 3.11 with pyenv\n\n```bash\nbrew install pyenv\npyenv install 3.11.9\npyenv global 3.11.9\n```\n\nThen run `pnpm run setup` again.\n\n## Other Common Issues\n\n### Modified terminal keys appear as escape-sequence text on Windows/WSL\n\nIf Alt+Up inserts `[1;3A`, Shift+Left inserts `[1;2D`, or F6 inserts `[17~`,\ncheck whether the application launched from WSL is actually a Windows executable.\nA Windows npm launcher can select `node.exe` even when invoked from a Linux shell.\n\nPane must honor ConPTY's `CSI ? 9001 h` request using xterm's\n`vtExtensions.win32InputMode`. Without it, a Windows console application reached\nthrough WSL can receive a complete VT sequence as individual character key\nrecords. A Linux raw-stdin reader can still receive the exact bytes correctly;\nthis symptom alone does not demonstrate split IPC messages or PTY writes.\nThe negotiated mode must also survive terminal snapshot restoration. The `@`\ninterceptor interprets Win32 key records locally and forwards unconsumed records\nunchanged. This handling applies to all terminal applications.\n\nThe browser regression suite is `tests/terminal-keyboard-input.spec.ts`; it checks\nwhole input messages for Alt+Up, Shift+Left, Shift+Up, and F6 with and without\nnegotiated Windows input mode. For transport diagnosis, compare a Linux raw-stdin\nreader with a Windows `ReadConsoleInputW` reader launched through WSL: compare\nbytes for the former and virtual keys/modifiers for the latter.\n\nSee Microsoft's [Win32 input protocol specification](https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md).\n\n### electron-rebuild failures\n- Ensure Xcode Command Line Tools are installed: `xcode-select --install`\n- Clear node_modules and reinstall: `rm -rf node_modules && pnpm install`\n\n### pnpm permission errors\n- Never use `sudo` with pnpm\n- Fix npm permissions: `npm config set prefix ~/.npm-global`\n\n## Windows Build Requirements\n\n### Spectre-mitigated Libraries Error\n\nIf you encounter this error during `pnpm run setup` on Windows:\n```\nLINK : fatal error LNK1181: cannot open input file 'MSVCRT.lib'\n```\n\nOr similar errors mentioning missing `.lib` files, this means you need to install the Spectre-mitigated libraries in Visual Studio.\n\n### Solution:\n\n1. **Install Visual Studio 2022** (Community Edition is free):\n - Download from [https://visualstudio.microsoft.com/](https://visualstudio.microsoft.com/)\n \n2. **Install Required Components**:\n - Open **Visual Studio Installer**\n - Click **Modify** on your Visual Studio 2022 installation\n - Go to the **Individual components** tab\n - Search for \"Spectre\" in the search box\n - Check the following components:\n - `MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)`\n - `MSVC v143 - VS 2022 C++ ARM64/ARM64EC Spectre-mitigated libs (Latest)` (if building for ARM64)\n - Click **Modify** to install\n\n3. **Restart your terminal** and run `pnpm run setup` again\n\n### Why is this needed?\n\nNode.js native modules on Windows are built with Visual Studio's C++ compiler. Recent security updates require Spectre-mitigated libraries to be installed separately. These libraries provide protection against Spectre vulnerability exploits.\n\n### Alternative: Use Pre-built Binaries\n\nIf you only need to run Pane, [download the Windows installer](https://runpane.com/api/download?version=latest&platform=windows&arch=x64&format=exe&source=gh-docs) instead of building from source. If runpane.com doesn't respond, get `Pane-x.x.x-Windows-x64.exe` (or `-arm64.exe`) from [GitHub Releases](https://github.com/greenfield-inc/Pane/releases/latest?utm_source=github).\n"},{"path":"docs/troubleshooting/WINDOWS_APP_HANG.md","title":"Windows freezes on startup or window focus","text":"# Windows freezes on startup or window focus\n\nA September 3, 2026 report described the latest version as \"lagging\" and \"freezing all the time.\" The reported investigation found a 250 MB `sessions.db`, approximately 200 MB of terminal history across 92 stopped sessions, an accidental Git repository at the Windows user profile root, and the isolated PTY host disabled. Windows recorded `AppHangTransient`.\n\n## Prevention\n\n- Startup loads only logs and browser panels that need restart cleanup. Terminal state is restored on demand when accessed, including history for stopped and archived sessions.\n- Workspace summaries exclude raw and serialized terminal buffers in SQLite before returning rows to JavaScript. Summary reads do not replace complete cached panel state or write reduced state back to disk.\n- Automatic Git status checks and filesystem watching skip the home directory, log a diagnostic, and report unknown Git status. Windows path comparison ignores case and normalizes separators and dot segments. Choose the actual project folder instead of `C:\\Users\\<user>`. Existing repository records and `.git` directories are not deleted.\n- New configurations no longer use the home directory as an implicit Git repository. Legacy home-directory `gitRepoPath` values are rejected by the migration accessor.\n- The isolated PTY host defaults to enabled on Windows, including existing configurations without a `usePtyHost` value. Explicit `false` values are preserved. Enable **Settings > Advanced > Use isolated PTY host** and restart Pane to change an existing opt-out. `PANE_USE_PTY_HOST=1` still forces it on for development.\n\nTerminal history remains on disk. The existing 21-day retention policy for archived sessions is unchanged, and no full `VACUUM` runs during startup. A large database file does not by itself mean all history is resident in the JavaScript heap.\n\n## Manual Windows verification\n\n1. Use an isolated `PANE_DIR` with a copy of a database containing many stopped and archived terminal panels. Launch Pane, inspect responsiveness and heap use, then reopen an old terminal and verify its history.\n2. In an isolated test profile with a home-directory Git repository, select a session whose worktree path is that home directory. Repeatedly blur/focus Pane. Confirm no recursive watcher or Git status scan starts, and check the diagnostic in the main-process log. Verify a normal project beneath the profile still refreshes.\n3. Start with a config missing `usePtyHost`: confirm the settings toggle is enabled and the supervisor forks on Windows. Repeat with explicit `false`, then enable the setting and restart.\n\nThe automated tests cover persistence, summary projections, path normalization, Git scan entry points, and platform defaults. They do not reproduce Windows `AppHangTransient` or validate a packaged Windows PTY host.\n"},{"path":"docs/troubleshooting/WINDOWS_CLAUDE_CODE_SPAWN.md","title":"Windows Claude Code Spawn Issue - RESOLVED","text":"# Windows Claude Code Spawn Issue - RESOLVED\n\n## Status: ✅ FIXED\n\nBoth issues have been resolved. Claude Code now spawns correctly on Windows.\n\n## Note: the original reproduction no longer applies\n\nThe failure described below was reproduced against a copy of Claude Code installed **inside\nPane's own `node_modules`** — Pane declared `@anthropic-ai/claude-code` as a dependency, so\n`Pane/node_modules/.bin/claude` existed and could win PATH resolution during development.\nThat dependency has since been removed (nothing ever imported it; Pane spawns the user's\nown CLI), so the specific `MODULE_NOT_FOUND` path shown below — resolving into Pane's pnpm\nstore — can no longer occur.\n\n**The fixes described here are still live and still required.** Both apply to any\nglobally installed `claude`:\n\n- npm/pnpm bin stubs are shell scripts on Windows, so `node-pty` cannot execute them\n directly (error code 193). The proactive Node.js fallback in `AbstractCliManager.ts`\n handles this.\n- Those stubs resolve their target through `$basedir`-relative paths, which break when the\n process is spawned with a worktree as `cwd`. `findCliNodeScript()` in `nodeFinder.ts`\n parses the stub and invokes the resolved `.js` file directly.\n\nRead the sections below as the rationale for that code. Only the reproduction environment\nis out of date.\n\n## Problem Summary\n\nClaude Code was failing to spawn properly on Windows when Pane runs it in a worktree directory different from where `@anthropic-ai/claude-code` is installed.\n\n## Root Cause Analysis\n\n### Issue 1: Error Code 193 (Fixed)\n\n**Error:** `Failed to spawn Claude Code: Cannot create process, error code: 193`\n\n**Cause:** Error code 193 on Windows means \"not a valid Win32 application\". This occurs when trying to execute a shell script (like npm bin stubs) directly via `node-pty` instead of through a shell or Node.js.\n\n**Fix Applied:** The PTY host classifies the spawn failure as `E193` (`classifySpawnError()` in `main/src/ptyHost/ptyHostMain.ts`). `AbstractCliManager.ts` matches the error message (`error code: 193` or `not a valid Win32 application`) and retries with the Node.js fallback.\n\n**Location:** `main/src/ptyHost/ptyHostMain.ts` and `main/src/services/panels/cli/AbstractCliManager.ts`\n\n### Issue 2: Module Not Found (Fixed)\n\n**Error:**\n```\nError: Cannot find module 'C:\\Users\\<user>\\<repo>\\worktrees\\@anthropic-ai\\claude-code\\cli.js'\n```\n\n**Cause:** The npm bin stub at `node_modules/.bin/claude` uses a relative path:\n```bash\nexec node \"$basedir/../@anthropic-ai/claude-code/cli.js\" \"$@\"\n```\n\nWhen the `cwd` is set to the worktree directory, the relative path resolves incorrectly.\n\n## Solution Applied\n\n### Fix 1: Proactive Windows Node.js Fallback\n\nOn Windows, we now proactively use the Node.js fallback instead of waiting for failures:\n\n```typescript\n// In spawnPtyProcess() at main/src/services/panels/cli/AbstractCliManager.ts\nif (os.platform() === 'win32') {\n this.logger?.verbose(`[${this.getCliToolName()}] Windows detected, using Node.js fallback proactively`);\n nodeFallbackTools.add(needsNodeFallbackKey);\n}\n```\n\nThis bypasses the problematic shell script execution entirely.\n\n### Fix 2: Enhanced pnpm Path Resolution\n\nThe `findCliNodeScript()` function in `main/src/utils/nodeFinder.ts` was enhanced to properly handle pnpm's node_modules structure:\n\n1. **Detects pnpm directory**: Checks for `node_modules/.pnpm` directory\n2. **Known package mappings**: Has specific mappings for Claude Code and Codex packages\n3. **Generic pnpm search**: Falls back to searching for any matching package\n4. **Proper path construction**: Correctly builds paths like:\n ```\n node_modules/.pnpm/@anthropic-ai+claude-code@2.0.0/node_modules/@anthropic-ai/claude-code/cli.js\n ```\n\n## Technical Details\n\n### npm Bin Stub Structure (Windows)\n\nThe file at `Pane/node_modules/.bin/claude` is a shell script that:\n1. Sets `NODE_PATH` with pnpm-specific paths\n2. Executes: `node \"$basedir/../@anthropic-ai/claude-code/cli.js\" \"$@\"`\n\nThe `$basedir` is the directory containing the script, but when node-pty spawns with a different `cwd`, the relative path resolution breaks.\n\n### Why the Proactive Approach?\n\nThe reactive fallback (catching error code 193) wasn't enough because:\n- The spawn could \"succeed\" from node-pty's perspective\n- But the process would exit immediately with code 1 (MODULE_NOT_FOUND)\n- By the time we knew it failed, it was too late to retry\n\nBy proactively using Node.js on Windows, we avoid the shell script entirely and directly invoke the CLI script with the correct absolute path.\n\n## Files Modified\n\n1. `main/src/services/panels/cli/AbstractCliManager.ts` - Added:\n - Proactive Windows Node.js fallback detection\n - Error code 193 message matching (reactive fallback)\n2. `main/src/ptyHost/ptyHostMain.ts` - `classifySpawnError()` reports error 193 as `E193`\n3. `main/src/utils/nodeFinder.ts` - Enhanced `findCliNodeScript()` with:\n - pnpm structure detection\n - Known package mappings for Claude Code and Codex\n - Generic pnpm package search\n - Standard npm path resolution\n\n## Debug Logs to Check\n\n- `backend-debug.log` - Look for:\n - `Windows detected, using Node.js fallback proactively`\n - `Detected pnpm structure`\n - `Found pnpm CLI script at:`\n - `Using Node.js:`\n\n## Test Commands\n\n```bash\n# Rebuild main process after changes\npnpm build:main\n\n# Run in dev mode\npnpm electron-dev\n\n# Check logs (PowerShell)\nSelect-String -Path backend-debug.log -Pattern \"Claude|spawn|pnpm|NodeFinder\"\n```\n"}]
1
+ [{"path":"docs/ADDING_NEW_CLI_TOOLS.md","title":"Adding a New CLI Agent Tool","text":"# Adding a New CLI Agent Tool\n\nAn agent in Pane is an entry in the agents config, `agents.entries` in\n`contracts/runpane/contract.json`. It runs in a `type: 'terminal'` ToolPanel\nwhose `customState.initialCommand` launches the CLI in a PTY, and, when its entry\nhas a `chat` section, in chat tabs over ACP ([CHAT_TABS.md](CHAT_TABS.md)).\nMenus, hotkeys, labels, command detection and chat tabs read the config, so a\nnew agent starts as one config entry. Terminal resume and status detection\nstill need code per agent. This guide uses the Cursor Agent CLI\n(`cursor-agent`, agent id `cursor`) as the worked example.\n\n## 0. Learn the CLI first\n\nBefore writing anything, verify against the real binary:\n\n- Launch command and permission-skip flags (`cursor-agent --force --trust`).\n- Whether it speaks ACP itself (`cursor-agent acp`), its oldest version that\n does, and how it signs in (`cursor-agent login`, or an API key variable).\n- Whether the prompt can be passed as a positional argument, including slash-prefixed\n input (Cursor: yes, unconditionally → argument delivery).\n- Session/resume mechanics (Cursor: `create-chat` pre-creates an id; `--resume <id>`;\n `--continue` for latest).\n- Screen frames for status detection: idle composer, working/spinner, approval\n prompts, first-run dialogs. Capture raw PTY bytes with a `pty` harness and distil\n them into test fixtures.\n- Whether the TUI uses the alternate screen and whether it repaints while idle.\n\n## 1. Add a config entry\n\nAdd the agent to `agents.entries` and its id to `enums.agents` in\n`contracts/runpane/contract.json`; the generator fails unless the two list the\nsame ids. The schema is `$defs/agent` and `$defs/agentChat` in\n`contracts/runpane/schema.json`.\n\n| Field | What it is |\n| --- | --- |\n| `title`, `label` | Full name (terminal tab titles) and short name (menus, chat headings) |\n| `icon` | Key into the clients' brand icon registry; an unknown key gets a generic icon |\n| `description` | One line for Settings → Agents |\n| `executables` | CLI names on PATH; the first launches, all of them identify the agent in a command or process |\n| `terminal.args`, `terminal.fullAccessArgs` | The terminal launch command is the first executable, then `fullAccessArgs`, then `args` |\n| `terminal.hotkey` | Default key for \"Add <title>\"; it must conflict with no other key |\n| `terminal.platforms` | Platforms the agent runs on, when not all |\n| `terminal.reportsConversation` | Pane's `SessionStart` hook reports the terminal's live conversation (Claude only) |\n| `terminal.paneMcpConfigFlag` | The flag that takes an MCP config file for one launch (`<flag>=<file>`) whose `pane` server replaces the user-level one; Pane's terminal tabs then reach its tools over HTTP. Set it only when a probe shows the CLI replaces, not duplicates, the user entry |\n| `terminal.promptArgument` | The CLI takes the starting message as a command argument. Without it, Pane types the message once the status manifest shows the agent's idle input box (below) |\n| `terminal.configDir` | The CLI's project config folder (`.claude`), copied into new worktrees by default |\n| `terminal.session` | How the CLI opens a saved conversation: `flag`, `minimumVersion` (the doctor checks `--help` for the flag), `idPattern`, `selectors` (flags with which a command picks its own conversation) and `paneChoosesId` (the flag also creates the conversation, so Pane picks the id) |\n| `install` | Install page `url` and install `command`, shown when the CLI is missing or too old |\n| `transcriptDirs` | Folders, relative to the home the CLI runs with, that hold its session transcripts. Before Pane deletes a folder it owns, it moves these out of it into `<pane-dir>/agent-logs/<agent>/` ([The scratch folder](SESSIONS.md#the-scratch-folder)) |\n| `signIn` | Arguments to the CLI that sign it in, run in a terminal tab when a chat agent advertises no terminal sign-in of its own; required with `chat` |\n| `models` | How the CLI takes a model (`flag`, and `effortFlag` or `effortConfig` for reasoning effort), its model `list` command and output `format`, or `aliases` when it has none, and its sign-in `status` command. `runpane handoff`, `runpane ask` and `runpane models` read it |\n| `ask` | One read-only headless turn for `runpane ask`: `args` that run a single turn and refuse edits and shell commands, any `env` it needs, and the `output` format its answer is read from. Leave it out unless a prompt asking the agent to write a file with its edit tool and with a shell command leaves the disk unchanged on macOS, Windows and WSL |\n| `onboarding` | Offered on the first-run screen |\n| `chat` | Present when chat tabs run the agent (below) |\n\n`chat` fields:\n\n| Field | What it is |\n| --- | --- |\n| `args` or `adapter` | Exactly one: arguments that start the CLI as an ACP agent (`[\"acp\"]`), or a bundled adapter package (pinned in `package.json`) with the variable that points it at the CLI |\n| `minimumVersion` | Oldest CLI version chat supports |\n| `apiKeyEnv` | Variables an API key saved in Settings is passed as |\n| `fullAccess` | `mode` (a session mode that never asks) or `args: true` (pass `terminal.fullAccessArgs` to the chat CLI); absent, Pane answers each approval with allow once |\n| `riskyModes` | Session modes in which the agent acts without asking; viewers mark them |\n| `terminalConversationsLoad` | A chat can load a conversation the agent's terminal started (Switch to chat) |\n| `paneMcpHttp` | Chat tabs pass Pane's MCP server over HTTP in `session/new`, and the agent uses it in place of its user-level `pane` server. Set it only when a probe shows that (Codex and Cursor keep theirs) |\n| `legacyClients` | Pane apps from before the agent catalog may show its chat tabs; leave it off for a new agent |\n| `registryIds` | ACP Registry ids this entry covers |\n\nThen:\n\n- Regenerate with `node scripts/generate-runpane-contract.js` (or `pnpm run\n generate-runpane-contract`) and commit every generated file, including\n `shared/types/generatedAgents.ts` and `docs/RUNPANE_CLI_CONTRACT.md`.\n- Update the hand-written `<codex|claude|cursor…>` usage strings in the\n contract, and the agent list `scripts/test-runpane-contract.js`\n (`checkAgentTemplateParity`) pins.\n- A new `chat.adapter` package also goes in `package.json` and `main/package.json`\n as an exact version, and in `ADAPTERS` in `scripts/verify-chat-adapters.js`.\n\nWhat derives from the entry with no further code:\n\n- Terminal launch presets, the toolbar pills and Add Tool menus on desktop,\n PWA and phone (`shared/constants/agentLaunchPresets.ts`).\n- The \"Add <title>\" shortcut and its default key\n (`shared/constants/keyboardShortcuts.ts`), so Keyboard Shortcuts, Help, the\n palette and the conflict check cover it.\n- Command and foreground-process detection: `AGENT_EXECUTABLES` and\n `CLI_AGENT_TYPES` in `main/src/services/agents/agentIdentity.ts`, and the\n `TerminalPanelState['agentType']` type.\n- Pane Chat and Sessions: `PaneChatAgent`, its labels\n (`PANE_CHAT_AGENT_LABELS`), panel ids and validators in\n `shared/types/paneChat.ts`.\n- `runpane --agent <id>`, the agent doctor's launch command and its `--help` check for `terminal.session.flag`.\n- How the starting message is delivered (`terminal.promptArgument`), and the\n default worktree file sync row (`terminal.configDir`).\n- For `terminal.session.paneChoosesId`: the launch and every relaunch add the\n flag with a Pane-chosen id (`agents/chosenSessionLaunch.ts`), the resume\n dialog, `--resume` checks and the update reopen read the same fields.\n- Chat tabs, for an entry with `chat`: launch, version check, API key, sign-in,\n full access, the host's agent catalog, Settings → Agents and Switch to chat.\n A Session orchestrator for it opens as a chat tab when chat tabs are on.\n- The Settings search alias (its label).\n\nCode never hard-codes an agent fact: an id, executable, session mode or\nminimum version as a string literal, or an env var name the config lists.\n`scripts/check-agent-names.mjs` (part of `pnpm lint`, so CI runs it) fails on\none outside `scripts/agent-names-allowlist.json`, which lists each exempt file\nwith its reason and the number of such literals it may hold. The count may only\nfall. The per-agent code below lives in files already on that list; a new\nliteral there means raising its count, which review sees.\n\n## 2. Terminal launch and resume\n\n`main/src/services/terminalPanelManager.ts` → `resolveCliLaunchCommand` gets a branch\nper agent that resumes differently: fresh launch (optionally with the prompt as a quoted argument), and\ninterrupted-resume (`wasInterrupted` + `agentSessionId`). Keep agent-specific string\nbuilding in a pure module next to `agents/cursorLaunch.ts` so it is unit-testable.\n\nIf the CLI owns its session ids, scrape them from PTY output via\n`captureAgentSessionId` (add an extractor to `extractAgentSessionId`'s dispatch). If\nlaunch readiness cannot key on first PTY byte (e.g. shell traffic precedes the TUI),\nadd a ready detector like `createCursorReadyDetector` and gate `signalCliReady` on it.\n\nOpenCode creates its own `ses_*` id on the first message and refuses `--session`\nfor an id it did not create, so a new conversation starts bare. Pane saves the id\nfrom the line OpenCode prints after leaving its TUI (`Continue opencode -s <id>`),\npersists it before the next spawn and resumes it with `--session`. Ids from Pane's\nearlier allocator (`ses_` + 32 lowercase hex) are dropped. Its idle composer gates readiness and\nonce-only stdin prompt delivery; wrapped commands remain opaque. RunPane doctor\nchecks the installed executable's session capability before reporting support.\n\nPi takes a caller-chosen id, so its entry sets `terminal.session.paneChoosesId`:\n`pi --session-id <id>` opens the working folder's session with that id and\ncreates it when there is none. Pane allocates a UUID for a direct `pi` launch,\nsaves it as the panel's `agentSessionId` and runs the same command on every\nrelaunch. A command that picks its own session (a `selectors` flag or its own\n`--session-id`), runs a subcommand (`pi auth login`), has a `--` or runs pi\nthrough a wrapper or shell syntax runs unchanged, and `--resume` is refused for\nit. Pi has no `promptArgument`: as an argument, pi reads a leading `@` as a\nfile to attach and sends a slash command to the model as text.\n\nA held starting message waits for positive evidence of the agent's own input\nbox: its manifest's `visibleIdle` rule, or the composer signature in\n`agentScreenSignature.ts` (Claude, Codex). An idle status alone is not enough,\nbecause a screen no rule recognizes also reads idle, and Enter there could\nanswer a prompt such as pi's project-trust question, whose first option is\nTrust. After 30 seconds without the input box, Pane records on the panel that\nit is holding the message and keeps holding it. `--wait-ready` waits for the\nsame input box. For an agent without `promptArgument`, `panels submit` (and so\n`agents send` and Notify's owed answers) types only when the manifest\nrecognizes the input box, idle (`visibleIdle`) or mid-turn (`visibleWorking`),\nand nothing blocks it. So a typed-message agent needs a `visibleIdle` rule, and\nblocked rules for every prompt or dialog that can replace its input box. Pi\nkeeps its footer and widgets below a dialog, so pi's `live_dialog` scans the\nwhole visible screen for a dialog frame: a border row, then the highlighted\noption (`→ `) or the key hint ending in `cancel`, then a border row. Such a\nframe anywhere reads blocked, which holds rather than guesses. Loops and handoff session\ncarrying do not offer pi yet.\n\n`main/src/services/agents/agentResume.ts` → `resolveResumeId` maps the agent to the\nresume id shown in the resume dialog. `sessionManager.resumeInterruptedSessions` and\nthe `index.ts` graceful-shutdown path are agent-generic once the classifier knows the\nbinary.\n\n## 3. Status manifest\n\n`main/src/services/agentStatus/manifests.ts`: write a `<TOOL>_MANIFEST` from captured\nfixtures and register it in `MANIFESTS_BY_AGENT`. Unknown agents fall back to\n`GENERIC_MANIFEST` (works, less precise). Keep blocker rules narrow and live-region\ngated so answered prompts in scrollback don't stick. Record the CLI version the\nfixtures came from.\n\n## 4. RunPane IPC\n\n`main/src/ipc/runpane.ts`:\n\n- `shouldUseArgumentDelivery`: argument delivery for an agent with\n `terminal.promptArgument` (Codex keeps slash commands typed).\n- `runAgentDoctor`: add fallback binary paths (`AGENT_FALLBACK_BIN_PATHS`) when the\n install dir is typically off the GUI PATH.\n\n## 5. Icons and worktree file sync\n\nAdd the brand icon to `frontend/src/components/ui/BrandIcons.tsx` and register\nit under the entry's `icon` key in `CLI_BRAND_ICONS`\n(`frontend/src/components/ui/brandIconRegistry.ts`), and a stand-in symbol in\nthe phone's `BRAND_ICONS` (`native/src/app/pane/[paneId]/new-panel.tsx`).\nWithout them the agent gets the generic icon.\n\nIf the CLI reads a project config folder (like `.cursor/`), set\n`terminal.configDir`; `DEFAULT_WORKTREE_FILE_SYNC_ENTRIES` in\n`shared/types/worktreeFileSync.ts` copies it into new worktrees.\n\n## 6. Sessions in a terminal\n\nA Session orchestrator in a terminal reuses the terminal's native conversation\nidentity and launch/resume support; do not allocate a second orchestrator\nidentity or replay a bootstrap prompt. Sessions emit generated `AGENTS.md`\ninstructions. OpenCode uses that existing context without new OpenCode\nskill/MCP installation and retains its default `opencode --auto` behavior:\nnon-denied operations are auto-approved, not sandboxed.\n\nOpenCode Session launches must be supported direct commands; wrappers and custom\nresume templates are rejected. Saved IDs restore history when it exists. Closing, archiving, switching, or PTY exit\ndoes not add a guarantee that shared-service work has stopped.\n\n## 7. Tests are the spec\n\nEvery step above lands test-first: `agentIdentity.test.ts`, `<tool>Launch.test.ts`,\n`terminalPanelManager.test.ts`, `agentResume.test.ts`, `manifests.test.ts` +\n`agentStatusPipeline.test.ts` (real captured bytes), `runpane.test.ts` (agent matrix +\ndoctor), `agentLaunchPresets.test.ts`, `keyboardShortcutCatalog.test.ts`,\n`scripts/test-runpane-contract.js`. For chat, run the chat tab suites against\nthe real CLI's ACP mode.\n\n## Agents launched through a wrapper\n\nPeople often start a supported agent through their own command, such as\n`agent-farm run free-range` or a shell script. The launch command then says\nnothing about the agent, but Pane still needs to know it, because composer\ndetection, `panels submit` staging, the agent-specific status manifest and the\nagent shown in `panels list` depend on the panel's `agentType`.\n\nManaged agent panels emit `agent.busy`, `agent.ready`, `agent.blocked`,\n`agent.unknown` and `agent.idle` events before identification. These reach the\ndefault agents-only workspace watch even without an `agentType`; ordinary shell\npanels do not emit them. For example, an Agent Farm variant picker can report\n`agent.blocked` before the agent starts. An untyped `panel.exited` is still\nfiltered by the agents-only watch.\n\nPane decides a terminal panel's agent in this order, and records the source in\n`TerminalPanelState.agentDetection`:\n\n1. **`declared`**: `--agent <id>` together with `--tool-command <command>` on\n `panes create`, `panes adopt` and `panels create`. On the wire this is\n `tool: { command, agentType }`. Here `--agent` means \"the agent this command\n runs\".\n2. **`command`**: the launch command's executable word, through\n `resolveAgentTypeFromCommand` in `main/src/services/agents/agentIdentity.ts`.\n3. **`process`**: the PTY's foreground process name, which node-pty reports as\n `pty.process`. Each entry's `executables` map to its agent. Pi sets its\n process title to `pi`, so an npm-installed pi is found here too.\n Claude Code's native installer runs `~/.local/share/claude/versions/<version>`,\n so it reports a bare version such as `2.1.283`. Pane resolves that name to an\n executable path with `ps` (or `/proc/<pid>/exe` on Linux) before trusting it.\n This source is skipped on Windows, WSL and ptyHost terminals, where node-pty\n cannot name the foreground program. A wrapper that stays in the foreground\n (for example a Node process that spawns the agent in its own process group)\n hides the agent from this check.\n4. **`screen`**: Claude's closed rule/`❯`/rule composer box, or Codex's\n `OpenAI Codex` header with its `›` prompt, or either agent's folder-trust\n screen: Claude's `Claude Code'll be able to read` with\n `Yes, I trust this folder`, or Codex's `Codex can read, edit, and run files here`\n with `Trust and continue`\n (`main/src/services/agents/agentScreenSignature.ts`). Pane adopts it only after\n two consecutive status polls match. It ignores the check while Pane's own\n shell is in the foreground, so an agent's last frame left above a shell\n prompt does not count.\n\nPane runs the process and screen checks on the agent-status poll\n(`TerminalPanelManager.pollAgentStatus`) until the panel's agent is known. Once\nit is known, Pane:\n\n- stores `agentType`, `agentDetection`, `launchCommand`, `isCliPanel: true` and\n `launchMode: 'wrapped'` on the panel's custom state;\n- switches the panel to that agent's status manifest;\n- restates the panel's current status with the identified agent attached.\n\nAgent-specific composer readiness and a starting message key off the identified\nagent, however it was identified. Pre-identification watch events and folder-trust\nidentification do not establish composer readiness:\n\n- `--wait-ready` (and `panels wait --for ready`) on a launched command matches\n only once the panel has an agent and that agent's own ready rule passes:\n Claude's composer, Codex's configured footer, the existing rules for the\n others. A wrapper's first output byte never counts. A command that shows no\n supported agent times out with `readiness.reason.code: no-agent-detected`;\n one that exits back to Pane's shell fails at once with `command-exited`\n (where the foreground process is known). A plain shell with no launch\n command is ready once it exists.\n- Prompts before the agent appears come back as `blocked` with their text:\n Agent Farm's `Trust this repository workspace? [y/N]`, and any `[y/N]` or\n similar last-line question a wrapper or shell asks, even when `--agent` was\n declared. Pane never answers them.\n- With `--wait-ready`, runpane owns the starting message: it claims the\n message at create, waits for readiness, stages the text and presses the\n detected agent's submit key separately (Ctrl+Enter for Codex), and verifies\n it like `panels submit`. Without `--wait-ready`, the terminal manager holds\n the message until the agent is identified and idle at its composer, then\n stages and submits it the same way. If no agent appears within 30 seconds\n (a blocking prompt restarts that wait), it records `initialInputError` and\n never types the message into the shell or the wrapper.\n- `[TerminalPanelManager] Starting message …` and `[Runpane] Starting message …`\n log lines mark each write and its outcome, with the agent, detection source,\n byte count, submit key and any `PANE_AGENT_SESSION_ID` the wrapper printed.\n They never include the message text.\n\n`launchMode: 'wrapped'` means the command is launched exactly as given.\n`resolveCliLaunchCommand` never adds `--session-id`, resume flags or a prompt\nargument to it. On restart, Pane runs the wrapper again, and the wrapper handles\nits own resume. The exceptions are a panel with an explicit custom command resume\nconfig and a recognized `agent-farm run|agent` command, which relaunch through\ntheir resume template (see\n[Resuming custom launchers](SESSIONS.md#resuming-custom-launchers)). For the same\nreason, `--resume` is rejected for wrapper commands.\n\nDirect OpenCode launches start without a selector, capture the session id from OpenCode's exit line (`opencode -s <id>`), resume it with `--session`, and use readiness-gated input. OpenCode refuses `--session` for an id it did not create, so Pane never invents one.\nNative selector insertion accepts literal direct commands and simple assignment or\n`env NAME=value` prefixes, not recognized shell wrappers or `env --` forms. Those\nforms fail before spawn; explicitly wrapped launches remain opaque.\nNative commands reject both `--continue` and `-c`, and reject OpenCode's\n`--prompt` argument because it would replay on every restore. Supply initial\ninput through Pane (or RunPane's `--prompt`) instead.\nOutside Pane Chat and named Sessions, wrapped OpenCode launches run unchanged;\nthe wrapper owns session selection and resume, just as it does for the other\nsupported agents. OpenCode Session launches reject wrappers and custom resume.\n\nA new agent works with wrappers once its config entry lists its executable\nnames (`executables`). Add a screen signature only if the agent's UI has a stable,\ndistinctive frame.\n\n## Delivery state and ghost text\n\n`panels submit`, `panels submit-composer`, `agents send` and create prompts\nreport `delivery: { state, evidence }` for Claude and Codex. The state comes\nfrom the agent's own transcript when Pane can find it\n(`main/src/services/agentTranscript/`):\n\n- Claude: `~/.claude/projects/<cwd, non-alphanumerics as '-'>/<session id>.jsonl`.\n Pane picks the session id (`--session-id`), except for wrapped launches, where\n it reads the worktree's recently written transcripts. A taken turn is a\n `type: \"user\"` entry. A message sent while Claude works is first a\n `queue-operation` `enqueue` entry, then a `user` entry once taken.\n- Codex: the newest rollout under `~/.codex/sessions/YYYY/MM/DD/` whose\n `session_meta.cwd` is the worktree, or the rollout named by the thread id once\n Pane knows it. A taken turn is a `response_item` user message. Codex writes a\n queued message only once it takes it, so `queued` comes from its screen\n (`Messages to be submitted after next tool call` / `↳ <message>`).\n\nThe reader tails each file from a byte offset, so polling a long transcript\nstays cheap. Without a transcript, the screen decides: a steadily empty composer\nis `taken`, text still in it is `in-composer`.\n\nThe terminal model splits each screen into typed cells and ghost cells: dim\n(SGR 2) or placeholder-grey text, which agents use for placeholders, prompt\nsuggestions and queued-message lists (`TerminalStateEmulator.getScreenText`).\nComposer detection reads only typed cells; `panels screen` reports the ghost\ntext in the composer as `composer.ghostText`. A new agent whose placeholder is\nneither dim nor mid-grey needs its own placeholder rule in\n`agentScreenSignature.ts`.\n"},{"path":"docs/ANALYTICS_INVARIANTS.md","title":"Analytics Invariants","text":"# Analytics Invariants\n\nThese rules keep Pane's PostHog funnel person-stitchable and privacy-safe. Pane\nturns product analytics on by default for new installs and for undecided\ninstalls whose config doesn't store analytics off.\nPrivacy Settings clearly discloses that default and provides the opt-out.\nExplicit choices from older versions must never be overwritten.\n\n## Bundled Executable Code\n\nImport the SDK through `posthog-js/dist/module.no-external` and keep\n`disable_external_dependency_loading` enabled. This is PostHog's\n[supported entry point for Electron](https://posthog.com/docs/libraries/js):\nexecutable configuration, session replay, surveys, and other remote extensions\ncannot load. All executable dependencies must come from the reviewed,\nlockfile-pinned build. Do not add a second import from the default SDK entry point.\n\nKeep `advanced_disable_flags` enabled. Pane uses no feature flags, and the SDK\nthen makes no `/array/<token>/config` or `/flags` requests. Those requests carry\nthe identity stored in localStorage, including after opt-out.\n\n## Identity Comes First\n\nResolve analytics identity in the main process before the renderer captures any\nanalytics disclosure or choice event.\n\nRequired ordering:\n\n1. Resolve GitHub CLI email, git email, or stable `install_id`.\n2. Persist the analytics identity in config.\n3. Capture `analytics_default_enabled` for an undecided install entering the\n default-on experiment.\n4. Capture `analytics_opted_in` or `analytics_opted_out` for explicit Settings\n choices.\n5. Capture `app_first_opened` and usage events only after the default or choice\n is applied.\n\nDo not flush queued usage until the initial default or stored choice has been\nresolved. Opting out must capture the choice marker directly, discard queued\nusage, and leave the PostHog SDK opted out.\n\n## Existing Choice Preservation\n\n`analytics_consent_shown=true` records an explicit choice made under the legacy\nopt-in dialog. Its stored `analytics.enabled` value is authoritative. The\n`analytics_default_applied` distinguishes installs already processed by the\nnew experiment from previously undecided installs.\n\nThe default-on experiment never replaces a stored `analytics.enabled: false`.\nWhen it finds `false` on an undecided install, it sends nothing, records\n`analytics_default_applied` and leaves analytics off. That `false` is usually a\nchoice, since a fresh install's default is `true`. Builds before 2026-08-31 also\nstored `false` by default, so an install that last ran one of them and never\nanswered the opt-in dialog stays off too: config can't tell the two apart.\n\n## Analytics Off Means Off\n\n`ConfigManager.isAnalyticsEnabled()` is the one gate for everything the main\nprocess sends: forwarded usage events, error reports, `app_closed` and the\ninstall heartbeat. It is off when any of these holds:\n\n- \"Allow product analytics\" is off (`analytics.enabled: false`).\n- `DO_NOT_TRACK=1` or a non-empty `RUNPANE_TELEMETRY_DISABLED` is set. The\n config the renderer receives then says `enabled: false` with\n `disabledByEnvironment: true` (`rendererConfig` in `main/src/ipc/config.ts`),\n so the renderer sends nothing, the default-on experiment waits, and Settings\n locks the switch with a note. config.json keeps its own value.\n- config.json exists but Pane has not read it since launch, because it is not\n JSON or a field fails to decode. Pane can't know whether it holds an off, so\n analytics stay off until the file reads, and the renderer receives\n `enabled: false`. The off is never saved: analytics writes made meanwhile\n (the install ID, identity) are dropped, so once the file reads, its\n analytics settings stand as they were.\n\n## Required Event Context\n\nEvery first-run funnel event must include:\n\n- `distinct_id`\n- `install_id`\n- `app_version`\n- `platform`\n- `identity_source`\n\nThe event should also set person properties when the identity is known\n(`personProperties` in `frontend/src/services/posthog.ts`):\n\n- `install_id`\n- `identity_source`\n- `github_username`\n- `github_email`\n- `git_email`\n- `git_email_sha256`\n- `git_user_name`\n- `app_version`\n- `platform`\n\nPrivacy Settings must disclose that analytics can be associated with locally\navailable GitHub or Git account details, including a username or email. Do not\ndescribe this telemetry as anonymous while those person properties are sent.\n\n## Opt-Out Is Still Identified\n\nCapture `analytics_opted_out` with identity context before disabling analytics.\nAfter that capture, discard queued usage events and keep analytics disabled.\n\nThis records who opted out without sending their later product usage. After\nopt-out, Pane sends no analytics requests, including the install heartbeat.\n\n## Install Heartbeat\n\nWhile analytics is on, the main process sends `app_heartbeat` at launch and\nevery 24 hours while Pane runs, so active installs stay countable\n(`startHeartbeat` in `main/src/services/analyticsManager.ts`). Each beat reads\nthe \"Allow product analytics\" setting, so turning it off stops the next beat. Its properties\nare exactly `distinct_id: install:<installId>`, `app_version`, `platform`, the\nenvironment tags below and `$process_person_profile: false`. It creates an install ID if the install has\nnone, and never sends `$set`, account or Git details. PostHog still shows it on\nan existing person already linked to that install ID, and derives location from\nthe request IP.\n\nOnly the installed app sends it: a packaged build on the default data directory\n(no `PANE_DIR`, `FOOZOL_DIR` or `--pane-dir`). Analytics off, `DO_NOT_TRACK=1`\nor a non-empty `RUNPANE_TELEMETRY_DISABLED` turns it off, as it does all analytics.\n\nSettings › Privacy discloses the payload. Adding a property means changing that\ncopy and this section in the same PR.\n\n## Environment Tags\n\n`app_heartbeat` and the events Pane captures itself (`capture`, direct\ncaptures such as `app_first_opened`, and main-process events such as\n`app_opened` forwarded through the renderer) say where Pane runs, so dashboards\ncan tell people apart from automated installs. Events the PostHog SDK generates\non its own, such as `$pageview` and `$autocapture`, don't carry them. They tag; they never drop an event. The main process detects them once\nper launch (`main/src/utils/analyticsEnvironment.ts`) and sends them on the\nanalytics identity, never saving them to config:\n\n| Property | Values |\n|---|---|\n| `ci` | a CI variable the runpane wrappers also check is set (the lists are kept equal by a test) |\n| `ci_provider` | `github_actions`, `gitlab`, `buildkite`, `circleci`, `azure_pipelines`, `jenkins`, `teamcity`, `codebuild`, `other` (bare `CI`), or `none` |\n| `container` | Linux only: `/.dockerenv`, `/run/.containerenv`, a `container` variable other than `flatpak`, or a Docker, Kubernetes, containerd, Podman or LXC cgroup. Toolbox, distrobox and devcontainers count too |\n| `display` | `native` on macOS and Windows; on Linux `wayland`, `x11`, `virtual` (the X server is Xvfb, except under Xpra or Chrome Remote Desktop, which people use) or `none` |\n| `in_wsl` | Linux under WSL (`WSL_DISTRO_NAME` or a Microsoft kernel). Not `wsl`: `onboarding_completed` already sends `wsl` for a WSL repository path |\n| `packaged` | a packaged build |\n| `custom_pane_dir` | started with `PANE_DIR`, `FOOZOL_DIR` or `--pane-dir` |\n| `automated` | `ci`, or a `virtual` or `none` display. A container alone isn't automated: people run Pane in toolbox or a devcontainer with their real display, and a CI container is caught by `ci` or its display |\n\nThey carry no paths, hostnames or environment values. Older app versions send\nnone of them, so treat a missing tag as unknown, not as a person. A Linux\nheadless daemon has no display, so it counts as automated.\n\n## Config Saves Preserve Analytics Fields\n\nRenderer settings updates must deep-merge analytics config instead of replacing\nit. In particular, do not drop the identity fields in `analytics`\n(`main/src/types/config.ts`):\n\n- `installId`\n- `distinctId`\n- `identitySource`\n- `githubUsername`, `githubEmail`, `gitEmail`, `gitEmailHash`, `gitUserName`\n\n## Attribution and Versioning\n\nWhen web attribution is present, emit attribution events with the same\n`distinct_id` and `install_id` as consent and usage events.\n\nApp version should come from the running app context and be attached to disclosure,\nfirst-open, usage, attribution, and close events. This lets PostHog distinguish\ncurrent users from older installs.\n\nThe app joins the web visitor id and the install id to the desktop id with\n`$create_alias`. PostHog merges the `alias` id into the `distinct_id` person and\nrefuses an `alias` id whose person is already identified, so the `alias` is\nalways the id that is new:\n\n- Web visitor id: `distinct_id` = desktop id, `alias` = web visitor id.\n- Install id, desktop id unchanged since the last launch (or first launch):\n `distinct_id` = desktop id, `alias` = `install:<id>`.\n- Install id, desktop id changed since the last launch: `distinct_id` =\n `install:<id>`, `alias` = new desktop id. The main process reads the stored\n desktop id before this launch overwrites it and passes it as\n `previousDistinctId`.\n- No install alias when the desktop id is `install:<id>`.\n\nThe SDK path (`posthog.alias(alias, original)`) and the direct HTTP path used\nwhen opting out send the same pairs.\n\n## Remote Pane Privacy\n\nRemote Pane analytics must use explicit sanitized events. Do not rely on\nautocapture for Remote Pane connection-code, token, host, or command surfaces.\nAny UI that renders or accepts `pane-remote://` codes, remote access tokens, or\nremote setup commands must include `ph-no-capture`.\n\nSSH host aliases from the user's SSH config never go into events or logs sent\noff the machine. The SSH hosts sidebar section and the SSH view carry\n`ph-no-capture`.\n\nRemote Pane events must never include:\n\n- connection codes\n- bearer tokens\n- token hashes\n- base URLs\n- hostnames or IP addresses\n- profile labels\n- client labels\n- device labels\n- raw error messages\n- local paths or Pane data directories\n- remote runtime ids\n\nAllowed properties should stay enum-like: `surface`, `role`, `flow`, `result`,\n`tunnel_preference`, `tunnel_kind`, `data_mode`, `client_kind`,\n`connection_mode`, `failure_stage`, `failure_category`, `failed_check`, and\nconnected-client count buckets.\n\n`failed_check` names the checklist row that failed. Connect checks send it on\n`remote_pane_client_connection_failed` with `failure_stage: connection_check`:\n`tailscale_here`, `host_offline`, `host_unreachable`, `pane_not_running`,\n`sign_in_rejected`, `password_required`, `owner_only`, `workspace_restore`.\nSet Up Host sends it on `remote_pane_host_setup_failed`: `setup_service`,\n`setup_port`, `setup_tailscale`, `setup_https`, `setup_code`, `setup_daemon`.\nThe sanitizer drops any other value.\n\n## Remote Pane Event Catalog\n\n| Event | Primary source | Funnel role |\n|---|---|---|\n| `remote_pane_host_setup_started` | `main/src/ipc/remoteDaemon.ts` | Host setup started |\n| `remote_pane_host_setup_succeeded` | `main/src/ipc/remoteDaemon.ts` | Host setup completed |\n| `remote_pane_host_setup_failed` | `main/src/ipc/remoteDaemon.ts`, `main/src/daemon/remoteTransportController.ts` | Host setup or transport failed |\n| `remote_pane_setup_terminal_opened` | `main/src/ipc/remoteDaemon.ts` | Setup command opened in terminal |\n| `remote_pane_connection_code_created` | `main/src/ipc/remoteDaemon.ts` | Host code created |\n| `remote_pane_connection_pair_created` | `main/src/ipc/remoteDaemon.ts` | Advanced paired profile created |\n| `remote_pane_connection_code_imported` | `main/src/ipc/remoteDaemon.ts` | Client imported code |\n| `remote_pane_connection_code_import_failed` | `main/src/ipc/remoteDaemon.ts` | Client import failed |\n| `remote_pane_client_connect_started` | `main/src/daemon/client/remotePaneClient.ts` | Desktop client connection started |\n| `remote_pane_client_connected` | `main/src/daemon/client/remotePaneClient.ts`, `main/src/daemon/httpApiServer.ts` | Desktop client connected |\n| `remote_pane_client_connection_failed` | `main/src/daemon/client/remotePaneClient.ts` | Desktop client initial connect or connection check failed; background state refreshes send nothing |\n| `remote_pane_client_disconnected` | `main/src/daemon/client/remotePaneClient.ts`, `main/src/daemon/httpApiServer.ts` | Desktop client disconnected |\n| `remote_pane_profile_deleted` | `main/src/ipc/remoteDaemon.ts` | Client profile removed |\n| `remote_pane_host_access_cleared` | `main/src/ipc/remoteDaemon.ts` | Host access revoked |\n| `remote_pane_host_clients_disconnected` | `main/src/ipc/remoteDaemon.ts` | Host disconnected clients |\n| `remote_pane_host_transport_started` | `main/src/daemon/remoteTransportController.ts` | Host transport live |\n| `remote_pane_host_transport_stopped` | `main/src/daemon/remoteTransportController.ts` | Host transport stopped |\n| `remote_pane_pwa_client_connected` | `main/src/daemon/httpApiServer.ts` | Browser/PWA client connected |\n| `remote_pane_pwa_client_disconnected` | `main/src/daemon/httpApiServer.ts` | Browser/PWA client disconnected |\n| `remote_pane_remote_runtime_used` | `main/src/daemon/client/remotePaneClient.ts` | Remote runtime actually used |\n\n## Failure Volume and Error Privacy\n\nKeep core desktop activity (`app_opened`, `app_closed`, `session_created`,\n`panel_switched`, `terminal_panel_created`). Neither wrapper emits routine\ncommand starts or successes. Preserve sanitized wrapper failures and download\nlifecycle events; honor explicit local analytics opt-out as well as CI,\n`DO_NOT_TRACK=1` and `RUNPANE_TELEMETRY_DISABLED`.\n\n`runpane_wrapper_command_failed` reports thrown errors, and non-zero exits from\n`install` or `update` only (also when setup runs them) (`runTrackedCommand` in\n`packages/runpane/src/cli.ts` and `run_tracked_command` in the pip `cli.py`).\nOther exit codes are documented results and send nothing. Polling and status\ncommands (`panes list`, `panels wait`, `watch`, `panes archive`,\n`workspace state`, `agents status`, `doctor`) send no failure events, and\nneither does a `not_found` failure outside `install` and `update`\n(`isExpectedFailure` in `packages/runpane/src/telemetry.ts`,\n`_is_expected_failure` in the pip `telemetry.py`). The event carries\n`error_code` (the code the `--json` error prints) and a `failure_category` read\nfrom that code and the message's first line. Both wrappers share\n`<PANE_DIR>/runpane-wrapper-telemetry.json`: one failure event per cause per\nhour and at most 10 failure events per hour per install.\n\nLocal control emits only `runpane_local_control_failed` for thrown failures or\nhandled `ok: false` results. Normal wait deadlines and optional agent\nunavailability are excluded. A `panes create` or `panels create` result reports\nits first failed item's error code, or why the agent was not ready\n(`no-agent-detected`, `agent-not-ready`, `command-exited`, `agent-blocked`,\n`readiness-timeout`) or that the starting message was not confirmed\n(`delivery-unverified`). `error_code` is one of those, a listed errno, or a\nPane `ERR_*` code; anything else is `unknown`. Its properties are `action`, `status`, `command_ok`,\n`failure_kind`, `error_type`, `error_code`, and `failure_category`, plus app version,\nplatform and Electron version. Each coarse operation/category/code combination\nreports at most once per five minutes, with an overall cap of 20 per hour per\napp process. Limits are in memory and reset on restart. Local logging remains\nindependent of analytics suppression.\n\nProduction ingestion drops legacy `runpane_wrapper_command_started`,\n`runpane_wrapper_command_succeeded`, and `runpane_local_control`. Keep the new\nfailure event name separate so useful failures survive these exclusions.\n\nPostHog `$exception` events are reserved for app errors: renderer global errors\nand unhandled rejections, React error boundaries, unexpected renderer crashes/OOM,\nmain uncaught exceptions, and shutdown errors. Console errors and handled CLI\nfailures never become exceptions. Exceptions have their own five-minute\ndeduplication and 20-per-hour cap. Both error event paths send directly from main\nthrough PostHog's capture API, with at most four concurrent requests and a 1.5s\ntimeout; neither waits for delivery. Errors obey analytics opt-out and use only\nthe existing install UUID identity, without person-profile updates, account\nproperties, SDK URL enrichment or persistent error storage.\n\nException payloads contain coarse source, built-in error type, allowlisted error\ncode/category, version/platform, a fixed message, and up to ten packaged app JS\nframes. Frames contain relative app filenames and numeric line/column offsets,\nnever absolute paths, function names or source context. Raw messages, causes,\nCLI argv, terminal contents, prompts, source code, repository paths, usernames,\nhome paths and environment values are excluded. Development/server URLs and\nexternal dependency frames are omitted. Restricted interactive-element\nautocapture and pageviews stay enabled, with text and attributes masked;\nautomatic exception capture is disabled. Session replay policy is unchanged.\n\nMain fatal capture uses `uncaughtExceptionMonitor`, preserving exit behavior.\nDelivery during process exit is best effort. Native main-process aborts and\nsegfaults cannot be captured by JavaScript; there is no minidump uploader or\nsource-map upload pipeline. Renderer process loss reports a coarse crash reason\nwithout a native stack. Native crash reporting remains a separate follow-up.\nPostHog's [Electron support request](https://github.com/PostHog/posthog/issues/43993)\ndoes not provide native Electron crash support. The payload follows the supported\n[manual exception schema](https://posthog.com/docs/error-tracking/installation/manual)\nfor JavaScript errors; this is not a replacement for native Electron crash reporting.\nSource-map symbolication is not wired or verified: current reports contain\npackaged JavaScript offsets only, and a future source-map upload integration must\nbe verified against a packaged build before claiming original TypeScript locations.\n\n## Test Coverage\n\nChanges to disclosure, analytics config, or first-run event ordering should update\nor add coverage in:\n\n- `main/src/services/analyticsIdentity.test.ts`\n- `main/src/services/analyticsManager.test.ts` (error events and the heartbeat)\n- `main/src/utils/analyticsEnvironment.test.ts` (environment tags)\n- `frontend/src/services/posthog.test.ts` (aliases and environment tags on events)\n- `tests/analytics-consent.spec.ts`\n\nThe Playwright test should verify both event order and payload shape, including\nSDK identity and interaction events, and reject external script, `/config` and\n`/flags` requests.\n"},{"path":"docs/APPEARANCE.md","title":"Appearance","text":"# Appearance\n\nPane can follow the operating system or stay on a fixed palette. **System** remembers one light palette and one dark palette and selects between them as the OS appearance changes. **Fixed** uses a third, independent palette. Switching modes never replaces any remembered selection.\n\nNew installations default to System with Folio for the light slot and Dusk (OLED) for the dark slot; the remembered Fixed palette is Folio. A saved appearance keeps whatever it holds, including the earlier defaults (Light (rounded) and Dark (sharp)); only missing or invalid fields take the new defaults. Existing configurations that only contain `theme` migrate to Fixed so their current palette remains exact. The legacy palette also seeds the matching System slot, while the opposite slot keeps its default.\n\nEither System slot accepts any palette: each picker lists every theme, so a dark palette can follow a light OS and the reverse. Slots are named for the OS appearance they follow, not for the palette's own base. Palettes are validated at load, renderer, IPC, and persistence boundaries; invalid stored fields are repaired independently and reported by the main process.\n\n## First paint\n\nAt startup the persisted config selects Electron's `nativeTheme` source. Main passes the four-field appearance snapshot through an argv argument and selects a cached, theme-specific BrowserWindow background colour. The preload decodes the snapshot synchronously; the HTML bootstrap resolves System against `prefers-color-scheme` and stamps the full class chain before React mounts. The provider then owns live OS updates, persistence, rollback, window controls, terminal, and editor updates. A versioned local cache and legacy `localStorage.theme` are fallback-only.\n\nOn Linux, System depends on the desktop environment and Chromium exposing `prefers-color-scheme`. Desktops that do not publish an appearance preference may remain on their reported default slot.\n\n## Custom theme\n\nAn agent can restyle Pane when the person asks (\"Tone down Pane's borders\"). It writes one Custom theme, `custom-theme.json` in Pane's data folder beside `config.json`, through `runpane theme set` or the `theme_set` MCP tool. Pane restyles the main window and notify cards within a second, terminal colours included, with no restart.\n\n```json\n{\n \"base\": \"dusk\",\n \"name\": \"Quiet Dusk\",\n \"colors\": { \"--color-border-primary\": \"#262b33\" },\n \"css\": \"[data-pane-part=\\\"tab\\\"] { border-radius: 8px !important; }\"\n}\n```\n\n- `base` is one of the 27 shipped themes. The Custom theme takes its light or dark family and fills every token it doesn't set.\n- `colors` sets `--color-*` tokens to hex, `rgb()` or `rgba()` values. `runpane theme read` lists every token with its current value.\n- `css` is up to 20,000 characters (the file up to 32 KB), applied after Pane's own styles.\n- `name` is optional and shows in Settings.\n\n`runpane theme set` merges colours into the current Custom theme (`null` removes one), replaces the CSS when `--css` is given, and selects Custom where the person sees it now: as the Fixed theme, or in the System slot of the base's family. `runpane theme set --theme <id>` switches to another theme and keeps the file. High contrast still wins over Custom colours for the tokens it sets.\n\n**Stable selectors.** CSS should target only `[data-pane-part=\"<name>\"]`: `app`, `sidebar`, `sidebar-pane`, `main`, `tab-bar`, `tab`, `panel`, `terminal`, `chat-message`, `chat-composer`, `button`, `input`, `dialog`, `settings`, `notify-card`. These stay across releases (a test keeps them). Tailwind classes, DOM shape and `data-testid` may change in any release. Terminal text is drawn on a canvas, so it takes colour tokens only.\n\n**No remote files.** Pane refuses CSS with `@import`, `src()`, `image-set()` or a `url()` that isn't a `data:` or `#id` address, and writes nothing. The renderer filters the parsed rules again and drops any declaration that could still fetch, such as an escaped `url(`.\n\n**Hand edits.** Pane reloads the file when it changes. An invalid file is ignored whole: Pane shows the base theme, and Settings > Appearance and `runpane theme read` give the reason.\n\n**Reset.** Each of these deletes the Custom theme and returns to its base: Settings > Appearance > Custom theme > Reset, View > Reset Custom Theme (macOS), `runpane theme reset` from any shell, or deleting the file. There is no readability check, so use one of these when a theme makes Pane hard to read.\n\nA setup export carries Custom as its base theme. Remote clients and the phone apps don't use the Custom theme.\n\n## App icon\n\n`pnpm generate-icons` renders the general app assets from\n`main/assets/icon-source.svg` and the macOS Dock assets from\n`main/assets/icon-macos-source.svg`. The macOS Dock PNG and bundle ICNS use the\nblack-sky landscape artwork inside a transparent 1024px canvas so its visible size\nmatches neighboring Dock icons. The simpler PNG, ICO, and favicons continue to\nserve Linux, Windows, and small web sizes. `pnpm dev` copies an updated Dock PNG\ninto the main-process build before launching Electron.\n"},{"path":"docs/ARCHITECTURE.md","title":"Pane architecture","text":"# Pane architecture\n\nThis is an index of how Pane fits together. It names the owning files; the code\nis the reference for details.\n\n## Renderer preference boundary\n\nUse `API.preferences.get(key)`, `getAll()`, and `set(key, value)` instead of generic IPC invokes. The preload's `preferences` methods validate host responses through `shared/types/preferences.ts` before returning values. A missing key returns `null`, an empty value remains `''`, and all preference values are strings. Failed or malformed responses reject; callers retain their existing loading/error handling. The frontend API forwards these typed values without parsing IPC envelopes again.\n\n## Words\n\n- **Repository (project):** a saved base git repo.\n- **Pane (session):** one feature or PR workspace. It normally owns one\n Pane-managed git worktree and branch.\n- **Panel:** a tab inside a pane. Types are `terminal`, `diff`, `explorer`,\n `editor`, `logs`, `dashboard`, `setup-tasks`, `browser` and `notes`\n (`shared/types/panels.ts`). Agent CLIs run in `terminal` panels.\n\n## Processes\n\n```\nrenderer (frontend/, React) ──IPC via preload──▶ main process (main/src)\n │ services, SQLite, git\nremote PWA / mobile ──HTTP + SSE──▶ daemon ◀──socket── runpane CLI\n │\n ptyHost (optional utility process)\n```\n\n- **Main process** (`main/src/index.ts`) owns native integration, git\n worktrees, CLI processes and persistence. Business logic lives in\n `main/src/services/`; IPC handlers live in `main/src/ipc/`.\n- **Preload** (`main/src/preload.ts`) is bundled with esbuild because the\n renderer is sandboxed (`scripts/verify-sandboxed-preload.js` checks it). It\n sends each invoke either to the main process or to the daemon, decided by\n `isDaemonOwnedChannel` in `shared/types/daemon.ts`. Keep ownership lists in\n that module, and run `pnpm build:main` to check the bundle still loads.\n- **Renderer** (`frontend/src`) is React with Zustand stores\n (`frontend/src/stores`). `frontend/index.html` is the desktop app;\n `frontend/remote.html` is the Remote PWA that `mobile/` also bundles. The\n desktop window shows on its first frame, the launch outline that an inline\n script in `index.html` draws before any app code loads: the title bar,\n sidebar and, when launch reopens a chat, that chat's message box, which the\n chat takes over as it mounts (`frontend/src/utils/launchOutline.ts`).\n- **Daemon** (`main/src/daemon`) serves the command registry over a local\n socket (a `pane-daemon-*` directory under the system temp directory, or a\n named pipe on Windows). The `runpane` CLI talks to it. For Remote Pane it also\n serves HTTP and SSE (`httpApiServer.ts`), and the same server, behind\n `tailscale serve` on port 8443, gives your other machines `runpane workspace`\n and codeless desktop remote mode (`workspaceHost.ts`,\n `services/tailnetMachines.ts`, [RUNPANE_WORKSPACES.md](RUNPANE_WORKSPACES.md)).\n Who it admits is the visibility and optional password in `auth.ts`.\n A desktop saves each computer it reaches once, with its routes in order\n (`shared/types/remoteComputers.ts`), and `daemon/client/remotePaneClient.ts`\n connects on the nearest route that answers ([Routes](QR_PAIRING.md#routes)).\n `pnpm daemon:headless` runs it\n without a window. Remote setup and lifecycle:\n [SELF_HOSTED_REMOTE_DAEMON.md](SELF_HOSTED_REMOTE_DAEMON.md) and\n [remote-daemon-lifecycle.md](remote-daemon-lifecycle.md).\n- **ptyHost** (`main/src/ptyHost`) runs PTYs in an Electron utility process.\n It is on by default on Windows (`usePtyHost` in `configManager.ts`), and\n `PANE_USE_PTY_HOST=1` turns it on elsewhere. Otherwise PTYs run in the main\n process. See [troubleshooting/WINDOWS_APP_HANG.md](troubleshooting/WINDOWS_APP_HANG.md).\n\n## Terminal output\n\nPTY output goes through `terminalPanelManager.ts`, which batches it and applies\nflow control. It feeds a headless xterm emulator (`terminalStateEmulator.ts`),\nwhose serialization restores a terminal when its panel is shown again, and\nstores capped scrollback in the `panel_buffers` table. The renderer draws with\nxterm.js in `frontend/src/components/panels/TerminalPanel.tsx`. The comment\nabove that component describes the activation lifecycle; read it before you\nchange how panels show, hide or refresh.\n\nAgent status (working, idle, blocked) is derived in\n`main/src/services/agentStatus/`, from each tab's screen or from the program's\nown OSC 7501 reports ([PROGRAM_STATUS.md](PROGRAM_STATUS.md)).\n\n## File previews\n\n`FileEditorView.tsx` routes editor tabs from the Files inspector, terminal links,\nand `runpane panels open --file` using `shared/utils/filePreview.ts`. Supported\nformats open read-only; ordinary code and text, HTML included, retain the editor\nand auto-save.\nImages, PDFs, fonts, video and audio load through `pane-media`, registered in\n`main/src/services/mediaPreview.ts`. A revocable URL grants access to one file;\neach request rechecks the existing worktree/symlink boundary through\n`file:getPath`. `mediaStream.ts` streams byte ranges from disk. File bodies do\nnot pass through text/base64 IPC. On a remote desktop, the URL is bound to the\nconnected host, and each request streams from the host's authenticated `/media`\nroute with the same boundary check and byte ranges. Archive and SQLite listings\n(`file:preview-list`) run on the host. \"Open with system app\" on a remote desktop\ncopies the file to a temporary folder on that desktop and opens the copy;\n\"Reveal in folder\" appears only on the host.\n\nHTML is not a preview format. Clicking an `.html`/`.htm` file in the Explorer,\nor its Eye button, opens it rendered in a browser tab: the tab already showing\nthat file, or else a new one (a tab showing anything else is never retargeted).\nThe \"Open HTML files\" setting (Settings → General) switches Explorer clicks to\neditable source, and an HTML file's right-click menu offers both \"Open preview\nin browser\" and \"Open as file\". A browser tab showing a worktree file offers\n\"View source\", and an HTML editor tab offers \"Preview\", which works like a click. `panels open --file` always\nopens the source; `--url file://...` renders.\n\nMarkdown, CSV/TSV and structured text fetch at most 1 MiB. Markdown renders\nwith a source toggle.\nTables display at most 500 data rows and 100 columns. JSON/JSONL are formatted;\nYAML/TOML retain source formatting in read-only Monaco with folding. Fonts use\na temporary FontFace specimen. Decode failures offer system open/reveal actions.\n\n`filePreviewListing.ts` lists ZIP central directories (up to 4 MiB) and TAR\nheaders without extraction, with at most 1,000 entries. ZIP64/split ZIP and\ncompressed TAR are unsupported; extended TAR names are not expanded. SQLite\nlists tables/views from a bounded temporary copy (32 MiB), opened read-only and\nremoved afterward. Nonempty WAL and rollback journals are refused before and\nafter copying beside the canonical target; hard-linked databases are refused\nbecause their recovery-file owner path is ambiguous. No source sidecars are\ncreated. Native schema inspection runs in\na child process with a 3-second deadline, a 1 MiB output cap and at most 1,000\ndisplayed entries. No table data queries are executed.\n\n`file:read` samples at most 8 KiB before decoding UTF-8. Binary files show a\nread-only notice, and `file:write` refuses to overwrite binary content as text.\nPreview components never enter the editable auto-save path, even on errors.\n\n## Data\n\n- The data directory is `~/.pane` for an installed app. `--pane-dir` or\n `PANE_DIR` overrides it (`main/src/utils/appDirectory.ts`).\n- `sessions.db` is SQLite in WAL mode. The base schema is\n `main/src/database/schema.sql`; later changes are inline migrations in\n `main/src/database/database.ts` that run at startup. These guarded upgrades inspect\n the existing schema (for example with `PRAGMA table_info` and `sqlite_master`);\n there is no migration-version table or numbered SQL-file runner. For schema\n changes, update the fresh-install schema and the guarded `runMigrations()`\n upgrade, preserving ordering across table rebuilds. Verify fresh and older\n databases in isolated tests; a standalone SQL file does not run an upgrade.\n- `config.json` holds app settings (`main/src/services/configManager.ts`,\n types in `main/src/types/config.ts`). It can be edited outside Pane while\n Pane runs: every save re-reads the file and writes only the keys it changes,\n a watcher reloads outside edits and emits `config-updated`, and a file that\n does not parse is never written over.\n- Worktrees go in `<repo>/worktrees/` unless the project sets another folder\n (`worktreeManager.ts`). A worktree on a remote-tracking base fetches that\n branch first (`worktreeBaseRefresh.ts`: capped at about 10 s, shared by\n concurrent creates, never fails the create). Every fetch (Fetch button,\n dashboard, branch list, new worktree, or an agent's `git fetch` or `git\n pull` in the active Pane, seen through its `FETCH_HEAD`) updates\n ahead/behind for the project's Panes, and the time under Fetch shows when\n the Pane's base branch was last fetched; `FETCH_HEAD` files seed that time\n at startup (`gitStatusManager.ts`).\n `worktreePoolManager.ts` keeps\n empty reserve worktrees on `_reserve/<hex>` branches so new panes open fast;\n a reserve is only claimed while its base ref still points at its commit.\n- Archive cleanup intents live in SQLite's `archive_cleanup_jobs`, atomically\n committed with the session archive flag. `ArchiveCleanupManager` resumes only\n those intents, validates physical directory/Git identity, and serializes work\n per repository with two global slots. Awaited, cooperative purge batches use\n Electron's `original-fs` and job-level busy retries. There are no detached\n deletion helpers or timed-out deletions left running. Failed jobs remain\n visible through ArchiveProgress; interrupted scripts require explicit skip\n on retry. Create/remove and pool background mutations share FIFO repository\n admission with no waiter timeout; archive scripts and purge run outside it.\n Known process trees are captured before committing intent. Teardown preserves\n PTY retirement cleanup, escalates freshly matched process identities, and\n verifies exit before touching files. Survivors remain in the job across\n restart and Retry; missing captures and snapshot errors fail closed.\n Process-table reads are confined to archive preparation/teardown/retry, each\n subprocess bounded to five seconds. Windows uses kernel start times and\n pinned process handles; POSIX revalidates start times before individual signals.\n Create/remove also check the cleanup path guard;\n Restore is blocked until cleanup completes. Quarantine lives under\n `<git-common-dir>/pane-archive-cleanup`, separate from legacy trash sweeps.\n- Per-repo setup, run and archive scripts come from `pane.json` and friends:\n [CONFIG_FILES.md](CONFIG_FILES.md).\n- Settings › Import & Export writes and reads an allowlisted setup file in main\n (`services/setupTransfer.ts`); the renderer applies it through Settings' own\n save calls: [SETUP_EXPORT_IMPORT.md](SETUP_EXPORT_IMPORT.md).\n- Per-project environment variables (`main/src/services/projectEnvVars.ts`) are\n read at spawn time by the terminal, script and legacy CLI spawners; Pane secret\n and keychain values are read then and never stored with the project:\n [PROJECT_ENV_VARS.md](PROJECT_ENV_VARS.md).\n- Pane secrets (`main/src/services/paneSecrets.ts`, `main/src/ipc/paneSecrets.ts`)\n keep an index in `config.json` and values in the keychain or a 0600 file\n (encrypted where the OS offers it), sync with the shared keys, and reach commands only through\n `runpane secrets exec`: [PANE_SECRETS.md](PANE_SECRETS.md).\n\n## Notes\n\nNotes is experimental and off by default: Settings → Advanced → Notes\n(`notesEnabled`). While it is off, Pane hides the Notes tab type, the add-tab\nentries and the terminal's Add to notes action, shows a one-line pointer to the\nsetting in a restored Notes tab, gives new terminals an empty `PANE_NOTES_FILE`,\nleaves the scoped-notes instruction out of user agent files, and removes scoped\nnotes from repository `AGENTS.md` and `CLAUDE.md` exports. Saved notes stay on\ndisk. Turning it on restores the UI, the instruction and repository exports\nright away; terminals opened while it was off need reopening to get\n`PANE_NOTES_FILE`.\n\nLocal Notes panels use `main/src/services/notes.ts` through `main/src/ipc/notes.ts`.\nCanonical documents live in `<PANE_DIR>/notes/notes.json`, outside disposable\nworktrees. A revision check rejects stale edits; writes atomically replace the\nstore. Promotion changes the canonical scope and retains references to earlier\nscopes. The Session view derives associated project notebooks from existing Pane\nassociations. Renderer recovery drafts retain edits when an autosave fails. The borderless\neditor inserts text/drawing blocks through inline plus or slash menus; the\nsettings cog holds promotion and deletion actions. Agent visibility is automatic\nwithin scope, with no sharing controls in the editor. Restoring an archived\nPane refreshes its derived context from current project notes.\n\n`noteExports.ts` derives marked instruction sections and drawing assets from saved\ndocuments. Excalidraw scenes remain editable JSON, with PNG previews and readable\nlabels in agent-facing Markdown. Global destinations are Claude's user\n`CLAUDE.md`, Codex's user `AGENTS.md` (or existing override), and Cursor's local\n`rules/pane-memories.mdc`. Cursor CLI also receives the generated memory through\na user `sessionStart` hook (`cursorNoteHook.ts`), preserving existing hooks.\nScoped content is exported outside repositories to\n`<PANE_DIR>/notes/contexts/<pane-id>.md`. While Notes is on, each new native Pane terminal receives\nits path through `PANE_NOTES_FILE`; the user-level integration tells agents to\nread that file before each turn. Project contexts contain only that project's\nnotes plus the current feature; Session contexts contain only Session notes.\nOrdinary saves leave repositories clean. The existing `managedAgentsMd` opt-in\nadditionally exports scoped notes into repository `AGENTS.md` and `CLAUDE.md`;\nturning it off removes those memory sections.\n\nExports preserve symlinks and permissions and replace files atomically. A store\nownership marker prevents a second Pane data directory from overwriting the\nfirst directory's user memory. Malformed marker pairs produce a visible error.\nChanging notebooks only reads data. Terminals predating this update need reopening\nto gain the context environment variable. After the first scoped note, start a\nnew agent conversation to load the scoped-reading instruction. Global-file changes refresh on Codex's next\nturn, Claude resume, or a new Cursor conversation in the tested CLI versions;\nupdating a file alone cannot erase context already read. Notes support native\nmacOS, Windows, and Linux installations; WSL agent exports report an unsupported\ndestination instead of claiming delivery. There is no cross-machine sync: the\n`notes:` commands are daemon-owned, so a desktop connected to another machine\nreads and writes that machine's notes. The notes reach a machine's agents only\nwhile Notes is on for that machine: its new terminals then read them through\n`PANE_NOTES_FILE`. While it is off, the Notes tab says \"Turn on Notes on\n<machine> so its agents read these\". Only the machine's owner may use its\nnotes; a teammate on a tailnet-shared workspace is refused. The glasses cannot\nreach them. A machine on a Pane\nwithout these commands gets \"Update Pane on <machine> to use its notes\" in its\nNotes tab.\n\n## Subsystems\n\n| Area | Owner | Doc |\n| --- | --- | --- |\n| Adding an agent CLI | `main/src/services/agents/` | [ADDING_NEW_CLI_TOOLS.md](ADDING_NEW_CLI_TOOLS.md) |\n| Panels | `panelManager.ts`, `shared/types/panels.ts` | [TOOL_PANEL_SYSTEM.md](TOOL_PANEL_SYSTEM.md) |\n| Chat tabs (ACP agents without a terminal) | `main/src/services/chatTabs/`, `main/src/ipc/chatTabs.ts`, `frontend/src/components/chatTab/` | [CHAT_TABS.md](CHAT_TABS.md) |\n| Machine health (disk, memory, cleanup, Resources) | `main/src/services/machineHealth/`, `main/src/ipc/resourceMonitor.ts`, `frontend/src/components/machineHealth/` | [MACHINE_HEALTH.md](MACHINE_HEALTH.md) |\n| Autopilot (experimental agent above every Session) | `main/src/services/autopilot/`, `main/src/ipc/autopilot.ts`, `frontend/src/components/autopilot/` | [AUTOPILOT.md](AUTOPILOT.md) |\n| Renderer updates | IPC events in `main/src/events.ts` | [STATE_MANAGEMENT.md](STATE_MANAGEMENT.md) |\n| Timestamps | `main/src/utils/timestampUtils.ts` | [TIMESTAMP_HANDLING.md](TIMESTAMP_HANDLING.md) |\n| Pane Chat and orchestration sessions | `paneChatManager.ts`, `skillCacheManager.ts`, `paneChatBundle/` | [SESSIONS.md](SESSIONS.md) |\n| Loops (scheduled tasks) | `main/src/services/loops/`, `main/src/ipc/loops.ts`, `shared/types/loop.ts` | [LOOPS.md](LOOPS.md) |\n| Approvals / Pane Notify (agent questions) | One saved list per machine, the `approvals` table in `sessions.db` (each item filed under its Session, Session-inbox items included), floating strip and round windows, tray icon in `main/src/services/notify/`; the in-Pane Approvals screen in `frontend/src/components/approvals/`; `main/src/ipc/notify.ts`, `shared/types/notify.ts`; the floating windows load `frontend/notify.html`. Desktops (one slot per saved machine, fed by `main/src/services/machineConnections.ts`) and phones read each host's queue over `notify:remote-snapshot`, `notify:remote-command` and the `notify:shared-changed` event; phone alerts go through `main/src/daemon/mobilePushSender.ts` | [PANE_NOTIFY.md](PANE_NOTIFY.md) |\n| Machine connections | `main/src/services/machineConnections.ts` holds the desktop's one connection to each saved machine; key and Pane secret sharing and the shared Approvals switch (`sharedCredentialSync.ts`) and the renderer use it; the sidebar's All machines view (`frontend/src/stores/allMachinesStore.ts`, `frontend/src/components/machines/AllMachinesSidebar.tsx`) reads every machine through it and re-reads one machine when its events arrive; its arrangement (row order and open rows) is a preference on the viewing computer (`sidebar_all_machines_layout`), never written to a machine it shows. Each host adds a `repository` identity (origin remote, normalised; `main/src/services/repositoryIdentity.ts`, read from git once per project path) to the projects in `sessions:get-all-with-projects`, and the view merges projects by it. A host's Pane order is the `sessions.display_order` column read highest first (`shared/utils/paneOrder.ts`), so Panes created before any arranging list newest first; `sessions:get-all-with-projects` serves Panes in that order. `main/src/ipc/machineConnections.ts` and `shared/types/machineConnections.ts` give the renderer `machines:list`, `machines:read` (list reads), `machines:run` (a short command list) and `machines:retry`, and push `machines:event` (events tagged with their machine, never terminal output) to windows that subscribe. This computer is the machine `local` | |\n| SSH hosts view | `sshConfigHosts.ts`, `ipc/sshHosts.ts`, `SshView.tsx` | [SSH_HOSTS.md](SSH_HOSTS.md) |\n| `runpane` CLI contract | `contracts/runpane/` | [RUNPANE_CLI_CONTRACT.md](RUNPANE_CLI_CONTRACT.md) |\n| Analytics | `analyticsManager.ts`, `frontend/src/services/posthog.ts` | [ANALYTICS_INVARIANTS.md](ANALYTICS_INVARIANTS.md) |\n| Themes | `frontend/src/styles/tokens/colors.css` | [APPEARANCE.md](APPEARANCE.md), [scripts/README.md](../scripts/README.md) |\n| Background checks (pause while nobody looks) | `main/src/services/backgroundActivity.ts` decides when Pane is away: nobody looking (no phone, remote desktop or glasses stream open, which a saved machine's Notify stream does not count as, and the screen locked or the window off screen) while the Settings › General › Power profile's condition holds (Balanced: locked, asleep or Low Power Mode; Battery saver: also on battery; Performance: never). While away, port reads (`listeningPorts.ts`) and usage indexing (`main/src/services/usage/`) pause and catch up on return; nothing an agent, Approvals or a phone push needs depends on it | |\n| Usage and cost | `main/src/services/usage/` | [usage/README.md](../main/src/services/usage/README.md) |\n| Mobile companion | `mobile/` | [NATIVE_MOBILE.md](NATIVE_MOBILE.md) |\n\n## Rules that follow from this design\n\n- Run project commands through the asynchronous `CommandRunner` and\n `CommandExecutor` (`main/src/utils/`). Await results through IPC and the\n lifecycle callers, drop results from stopped or replaced watchers, and\n serialize Spotlight checkouts with restoration.\n- For git status in WSL, watch from inside the distro: prefer `inotifywait`.\n Without it, Pane polls `git status` in the distro every five seconds while\n focused. Don't add Windows-side recursive watchers over `\\\\wsl.localhost` or\n `\\\\wsl$`.\n- Production builds must never include React Scan (`pnpm perf:scan` is dev\n only).\n\n### Chat tabs\n\n[Chat tabs](CHAT_TABS.md) are a panel kind (`chat`) whose agent runs through its\nACP adapter in a host-owned process (`main/src/services/chatTabs/`). The host\nsaves a secret-free launch and the ACP session ID, reloads the conversation on\nrestart, keeps a bounded transcript window with older messages paged from disk,\nand publishes `chat-tab:state` and `chat-tab:event` to every client. Clients\nsend `chat-tab:*` commands through the shared registry; none of them owns the\nprocess.\n\n"},{"path":"docs/AUTOPILOT.md","title":"Autopilot (experimental)","text":"# Autopilot (experimental)\n\nAutopilot is one always-running agent above every Session on a machine. Press\nStart and it analyzes everything first: every Session (open, running, idle,\nold), its Panes, workers and PRs, and every waiting item on every machine. It\nplans the order (unblock running work first, then keep active work moving,\nthen propose closing what is stale), groups the work into a few\n**workstreams** by Session, repo or feature with their approvals together,\nwrites the plan to `docs/plan.html`, and walks it. It puts each item on a\n**stack** beside its chat, one at a time, with the item's documents and app as\ntabs.\n\n**It drives the conversation (D-146).** Every Autopilot turn ends with the\nnext step it is taking or proposing; it never stops at \"I'll wait for you\".\nWhile the person hasn't answered, it carries on with what doesn't need them.\nIf its agent sits idle for 3 minutes while it runs (not paused, Sentinel off),\nPane wakes it with a hidden `[Pane · Carry on]` line, at most 3 times in a row\nuntil the person or an event starts a turn. Pause stops the driving until Go\non; turning Autopilot off stops it. It writes its own\ndocuments and approvals, passes your questions and instructions to\norchestrators, and asks orchestrators to `/wrap-up` finished work.\n\n**It works your approvals, within limits (D-149 to D-152).** See\n[What it does with approvals](#what-it-does-with-approvals-d-149-to-d-152).\nPermission prompts stay yours, and everything else it does is recorded \"by\nAutopilot\" with your Override or Reopen.\n\n## Turning it on\n\nSettings › Advanced › Experimental › **Autopilot**. It needs **Chat tabs** on\n(Settings › AI & Agents),\nbecause its agent is a chat tab on your own installed `claude` and its\nsign-in: with Chat tabs off, the switch can't be turned on (it can still be\nturned off). Turning it on adds an **Autopilot** row to the sidebar's top\nlist, below Loops and directly above Approvals, in the one-machine sidebar\nand in All machines alike. Opening\nAutopilot never starts an agent turn: it shows **Start**.\n\n- **Pause** stops it from bringing new items. **Go on** resumes it.\n- Turning it off stops the agent. Its run, stack and conversation are kept.\n Turning it on again picks up the same run.\n- **New Autopilot Session** starts a fresh run, with a new folder and an\n empty stack. The old run's documents stay where they were.\n- After Pane restarts, the current run shows Start again, with its stack and\n folder kept.\n\n## Your instructions (D-196)\n\nWhile Autopilot is on, Settings › **Autopilot** has a **Your instructions**\nbox: how you want it to work, for example \"group things by repo\", \"always ask\nbefore closing anything\", \"be brief\" or \"focus on Bloom first\". They are kept\nin a plain file on the machine Autopilot runs on,\n`<PANE_DIR>/autopilot/instructions.md`, which you or a script can edit too.\n\n- Autopilot reads them after Pane's own rules, labelled as yours: in its\n run's AGENTS.md (a section after Never) and in the Start line.\n- Saved while it runs, they reach it at once as a `[Pane · Instructions]`\n line (shown in its chat as \"Your instructions updated\"), and the box says\n **Applied**. An edit to the file itself is picked up the same way within a\n couple of seconds; while Autopilot is paused, it reaches it at **Go on**.\n While it is stopped the box says **Applies on next Start**.\n- They shape how it works but never override its hard limits: it never\n answers an approval or a permission prompt, and never merges, deletes,\n pushes or closes anything without your word.\n- **View built-in instructions** shows what they add to (AGENTS.md, the Start\n line and the pane-autopilot skill), read-only. **Reset** clears yours.\n- In Autopilot's chat you can say \"from now on, group things by repo\":\n Autopilot offers to add that line as its own approval, with the exact text,\n and adds it only when you approve.\n- Longer than 20,000 characters is refused with\n `AUTOPILOT_INSTRUCTIONS_TOO_LONG`, and nothing is saved.\n\nAutopilot is a paid feature (D-65). Every way it turns on or starts goes\nthrough one entitlement check\n(`main/src/services/autopilot/entitlement.ts`). For now it allows everyone,\nwith no account or network call. To check the refusal path, start a dev build\nwith `PANE_AUTOPILOT_ENTITLEMENT=denied`. Turning it on and Start then refuse\nwith `AUTOPILOT_NOT_ENTITLED`, and the switch can't be turned on.\n\n## Where its data lives\n\nAutopilot is not a Session. It has its own store, apart from Sessions, and\nSession cleanup and `/wrap-up` never touch it:\n\n```\n<PANE_DIR>/autopilot/\n current # the active run's id\n instructions.md # your own instructions (Settings › Autopilot), for every run\n runs/<run-id>/\n AGENTS.md # its instructions; points to the pane-autopilot skill\n CLAUDE.md # @AGENTS.md\n docs/ # every document Autopilot writes\n stack.json # the stack (references only: item ids, paths, URLs, Session ids)\n state.json # last state and where the walk is\n run.json\n log # one line per action, for people reading the folder\n```\n\nIts agent runs as a chat tab in a hidden, detached owner Pane\n(`__autopilot_owner_<run-id>`) whose workspace is the run folder. That Pane has\nno project, no Session record and no associations. Other machines' items show\non the stack, read live through the workspace. Nothing from them is copied\ninto the folder.\n\n## What it does with approvals (D-149 to D-152)\n\nThere is no setting for this: it is how Autopilot works, in its skill, and it\ntakes its cues from you (\"leave those to me\", \"handle the approvals\"). By\ndefault, Autopilot:\n\n| It… | Recorded on the item, on every device |\n| --- | --- |\n| surfaces approvals from every machine, grouped so you can talk them through | |\n| closes the ones that don't matter or that it judges stale; you can reopen them | \"Closed by Autopilot: <reason>\" |\n| may close an unclear one and re-ask it rewritten; the answer goes to the original asker | \"Closed by Autopilot: rewritten as …\" on the old one, \"Rewritten by Autopilot from Q-n\" on the new one |\n| answers only when the way forward is clear and the item relates to what it's working on with you, or when you tell it to handle approvals | \"Answered by Autopilot · because <D-n, document or your words>\", with **Override** |\n| reads a typed reply its asker can't (D-258): takes it as an answer with `runpane notify --took`, or as a question, then finds out and sends a new version with `runpane notify --update` ([Replies](PANE_NOTIFY.md#replies-and-new-versions)) | \"Autopilot is reading your reply…\", then \"Taken as your answer\" or \"Updated · ready again\" |\n| never answers a permission prompt, or types raw keys into another tab | refused in code ([The guard](#the-guard-d-149)) |\n\nAn answer is delivered at once, with no hold. Override sends your answer to the\nasker as a correction, recorded on the item. Sentinel follows the same rules.\n\n**Its queue (D-168).** Its watch tells it of approvals made outside its chat,\nand `runpane autopilot waiting` is the queue: read from each machine's table,\nwith no copy. It tells you a count and brings in one group at a time, related\nitems together; when a group is finished it brings the next. An item answered\nor closed elsewhere just leaves the queue.\n\n**Across machines (D-165).** An approval lives on the machine where its creator\nruns, and Autopilot's own on Autopilot's machine (from the phone, that's the\ndesktop the phone is talking to). Autopilot reads every connected machine, and\nits answers and closes go to the owner, which records them \"by Autopilot\"; a\nrewrite stays on the old item's machine. The owner takes the first answer or\nclose, so a later one, from another Autopilot or from you, is refused with\n\"already answered by …\" and changes nothing. A saved machine it can't reach\nshows as \"<machine> offline\", and an answer aimed at it is refused with nothing\nqueued. One of your Tailscale machines not saved here shows as \"Can't see:\n<machine>\": a machine reads only the machines it has saved, so add it there. An\nowner too old for these commands is reported as needing an update.\n\n## In the chat and on the right (D-91)\n\n- **The question lives in the chat.** Each item Autopilot brings is a\n decision card in its chat: what it is, its Q-n, Session and who asked; the\n question and its one-line why; and the options, the recommended one first\n and marked, each with its one-line detail. Choosing an option answers it.\n The same card shows on the phone. The card that is current shows in full;\n the others in a message are one line until you click them. If the current\n item isn't in any message in view, its card is docked above the composer.\n- **The right side shows only the current item's context**, as tabs: its\n documents (HTML renders as a page, any other file as text), the app (a\n URL), a Session's overview. It never holds the question or answer buttons.\n A page follows Pane's theme, not the Mac's (D-163): whenever the page's\n `prefers-color-scheme` differs from Pane's light or dark, Pane swaps dark and\n light in the page's `prefers-color-scheme` rules (`guestColorScheme.ts`), so\n a document with dark styles shows dark whenever Pane does. Script in the page\n that asks `matchMedia` still gets the Mac's answer. Pane never attaches a DevTools\n debugger for this: one that stays attached crashes Electron 43 when the page\n closes (electron/electron#53376, D-216); any debugger goes through\n `attachDebugger` (`main/src/services/debuggerLifetime.ts`).\n- **One at a time (D-71).** Items come in the order Autopilot puts them on\n its **stack**. New ones wait and never replace the current one. When you\n answer the current card, the next one becomes current and the right side\n follows it. **‹ ›**, **← →** (when you aren't typing) and the header chips\n step through everything on the stack.\n- The right side's header (what it is, its Session, its title, its tabs)\n never moves. Long text and banners scroll below it (D-72).\n- **What's waiting** lists every waiting item. Picking one makes it current.\n- Answering shows \"by you\" on the card, with the Approvals Undo window.\n\nAutopilot's own approvals are violet and marked \"written by Autopilot\". In\nthe Approvals screen they appear under an **Autopilot** group.\n\n## On the phone (D-75 to D-77)\n\nThe phone shows the same Autopilot as the computer it is on, over the\nhost connection (`autopilot:*` channels, the `autopilot:changed` event). There\nare no tabs on the phone.\n\n- **Home** has an **Autopilot** bar above **Needs you** while Autopilot is on\n for that computer. Before Start it reads \"Walk these with Autopilot\" and\n carries **Start**, which starts Autopilot and opens it; then it says Paused,\n or what it is walking, with how many items are open on the stack. A computer\n whose Pane predates Autopilot shows no bar.\n- **The Autopilot screen** is its chat tab, with the walk bar above it:\n Running or Paused, every Session with what waits in it (the current one\n violet), and **Pause** or **Go on**. Opening it never starts a turn: until\n Start it shows **Start**. Pane's `[Pane · Start]`-style lines show as short\n notices.\n- **Decision cards.** Each item Autopilot names in an `autopilot-items` block\n is a card in the chat (the same `shared/autopilotDecision.ts` model as the\n desktop card). Tapping an option answers it at once, through Approvals'\n path (`notify:remote-command`), so the computer sees it as soon as it lands;\n the card then shows the answer and its Undo window, and later\n \"by you · <Session> recorded it\". **More context and related docs** opens\n the approval full screen.\n- **The approval full screen**: \"‹ Chat\" and \"n of N · Session\" (n of N counts\n the items on the stack), the decision, then **More context** (\"Why I'm\n asking\", written by Autopilot, on its own items) and **Related docs**, which\n open and close. The answer buttons are fixed at the bottom: two options are\n buttons, more are picked above, an open question takes typed text.\n Answering goes back to the chat where you were.\n- **A document** opens full screen with nothing to answer, and \"‹ Back to Q-14\n to answer\" returns to the approval. HTML files are read through the phone's\n connection (`autopilot:read-doc` with `{ inline: true }`); a page loads the\n way page tabs do. Only files on the stack, in the run's folder, or linked\n from a waiting item open.\n- Phone builds without chat tabs (runtimes before 1.4) never show Autopilot:\n its owner Pane is hidden and they don't know its channels. Every 1.4 build\n gets this over the air. \"Try a demo\" has a sample Autopilot.\n\n## Sentinel Mode (package 7, D-93)\n\nA toggle in Autopilot's header (desktop and phone) for when you step away.\nTurning it on also starts Autopilot; the sidebar row reads \"Sentinel\" while it\nis on, and the walk bar says how many Sessions it keeps moving.\n\n- Every 5 minutes, while Autopilot is idle and not paused, Pane wakes it with a\n `[Pane · Sentinel check]` line (hidden in the chat).\n- It answers orchestrators' questions that a plan, a decision or a clear\n recommendation settles, citing the source; works approvals by the rules\n above; nudges a Session that has been quiet 10 minutes with open work (at\n most 2 per Session per hour, then it asks you); and sends everything else to\n you as its own approval, which pushes to your phone. It never answers\n permission prompts, merges, archives or creates Sessions.\n- Each call shows in the chat as it happens (an `autopilot-log` block) and goes\n in `docs/away-log.html`. Turning Sentinel off posts a **While you were\n away** card (`autopilot-away`) with **Tell a Session otherwise** and the log.\n So does opening Autopilot (the desktop view, Pane coming to the front on it,\n or the phone screen) with Sentinel left on, whenever its away log has calls\n you haven't seen, however short the time away: Pane sends `[Pane · Back]`\n (`autopilot:opened`), and the card covers the calls since the last one. No\n new calls, or a stopped Autopilot, sends nothing.\n- After a Pane restart Sentinel is off. Pane asks you, as a push, \"Sentinel\n stopped: Pane restarted\", with \"Turn Sentinel back on\".\n- If Autopilot's agent exits on its own (it crashes, or the CLI quits),\n Autopilot stops too: Sentinel goes off, the checks end, and the view shows\n Start again. When Sentinel was on, Pane pushes \"Autopilot stopped: its agent\n exited\", with \"Start again with Sentinel\".\n- The rules are instructions in the `pane-autopilot` skill; Pane runs only the\n toggle, the timer and the restart and exit questions. `autopilot:sentinel` (true or\n false) is the channel both screens use.\n\n## From a brain-dump to Sessions (D-92)\n\nGive Autopilot a pile of ideas and it sorts them into workstreams, writes\n`docs/workstreams.html` (each proposed Session with its ideas and first\nbrief, new or existing), and asks \"Start N workstreams?\" as its own\napproval. Only after you choose \"Create them\" does it create each Session\n(`runpane sessions create`, an orchestrator only) and send its first brief,\nmarked `[From Autopilot]`. It keeps at most 2 Sessions it created working at\nonce, and waits while the machine is busy. These limits are instructions in\nthe skill; Pane does not enforce them yet.\n\n## How the agent works\n\nAutopilot follows the Pane-shipped `pane-autopilot` skill\n(`main/src/services/paneChatBundle/skills/pane-autopilot/SKILL.md`). Its\ncontrols reach it as `[Pane · Start]`, `[Pane · Pause]`, `[Pane · Go on]`,\n`[Pane · Carry on]` and `[Pane · Instructions]` lines. It uses:\n\n- `runpane autopilot waiting --json`, its queue: every waiting item on every\n machine it can reach, this machine's by Session in sidebar order, with\n `quiet`, `stale` and `connected` on each, and the `offline` and `cantSee`\n machines.\n- `runpane autopilot answer <id> (--choice <label> | --approve | --deny |\n --text <text>) --because <why>`, `runpane autopilot close <id> --reason <why>`\n and `runpane autopilot rewrite <id> --ui ... --title ...`, on the machine that\n holds the item. Anyone but Autopilot is refused with `AUTOPILOT_ONLY`.\n- `runpane autopilot stack push --item <id> [--next]` to put an item on the\n stack. It also takes `--file`, `--url` or `--session` instead of `--item`.\n `--next` puts a higher Session's new item right after the one on screen\n (D-59, \"jumping back up\"). While paused, a push from Autopilot is refused\n with `AUTOPILOT_PAUSED`.\n- `runpane watch --as autopilot --kinds item.created,item.answered,session.created,session.archived,orchestrator.turn_ended --until-event --json`\n to wake on change, under its own cursor. See\n [SESSIONS.md](SESSIONS.md#autopilots-kinds).\n- `runpane panels submit` / `panels wait --for idle` / `panels last-message`\n to ask an orchestrator, with the message marked `[From the person, via\n Autopilot]`. Every Session's fixed capability text accepts such a message\n as the person's own question or instruction, `/wrap-up` included. It never\n counts as an answer to an approval, and answering one goes through `runpane\n autopilot answer`. Autopilot's own messages are marked\n `[From Autopilot]`; an orchestrator replies to whoever asked and still\n sends anything the person must decide to them as an approval.\n\nThe seven `runpane autopilot` commands are also MCP tools in the `autopilot`\ntoolset ([PANE_MCP.md](PANE_MCP.md)). With Autopilot off, all but `status` fail\nwith `AUTOPILOT_OFF`, saying how to turn it on;\n`status` reports `enabled: false` (its plain output also says how to turn it\non; `--json` gives only the state).\n\n## The guard (D-149)\n\nrunpane sends the caller's Pane and tab (`PANE_SESSION_ID`, `PANE_PANEL_ID`)\non every daemon request (`caller` on the request frame; older builds leave it\nout). Autopilot acts on approvals only through `runpane autopilot answer`,\n`close` and `rewrite`, which record it, and `runpane notify --took` and\n`--update` on a reply it reads; the machine that holds the item refuses\nthem for a permission prompt (`AUTOPILOT_CANNOT_ANSWER`), Claude tool permissions\nand Bypass changes included. A guard on the command registry refuses every other\nanswer route when the caller is Autopilot's tab or owner Pane, since those\nwould read as the person's:\n\n- `notify:remote-command` answer, undo, close, reopen and override, and dismiss,\n skip and remind (hiding or putting off a card is the person's call too)\n- `permission:respond`\n- `chat-tab:permission` and `chat-tab:answer` for any other tab\n- every raw-input route: `runpane:panels:input`, `terminal:input`,\n `terminal:paste-file`, `terminal:paste-image`, `panels:send-input`,\n `panels:send-terminal-input`, `sessions:input`, `sessions:send-terminal-input`\n- `runpane:panels:submit` and `submit-composer` to a tab with a waiting permission prompt\n\nSending a chat message to another chat tab (`chat-tab:send`) is allowed: it\nqueues a message and never answers that tab's pending prompt, whose own answer\nroutes are refused above.\n\nThe caller also travels with `runpane workspace <machine> ...` requests\n(`caller` on the `/invoke` body), so another machine's guard refuses the same\nroutes.\n\nPane's own UI, phones and other screens send no caller, so you are never refused. The check relies on\nthe environment Pane gives its agents. It stops Autopilot on every normal\nroute. It is not a security boundary against an agent that deliberately\nrewrites its own environment.\n\n## Code map\n\n| Part | Where |\n| --- | --- |\n| Manager, store, stack, entitlement, events | `main/src/services/autopilot/` |\n| Channels (`autopilot:*`, `runpane:autopilot:*`) and the guard | `main/src/ipc/autopilot.ts` |\n| Types | `shared/types/autopilot.ts` |\n| Desktop view, stack, sidebar row | `frontend/src/components/autopilot/` |\n| Settings › Autopilot (your instructions) | `frontend/src/components/settings/categories/AutopilotSettings.tsx` |\n| Phone: home's Autopilot bar, chat with cards, approval and document screens | `native/src/features/autopilot/`, routes in `native/src/app/autopilot/` |\n| CLI | `packages/runpane/src/autopilot.ts`, `packages/runpane-py/src/runpane/autopilot.py` |\n| Journeys (scripted agent) | `tests/autopilot.spec.ts` (`pnpm test:chat-tabs`) |\n"},{"path":"docs/BUILDING_ON_WINDOWS.md","title":"Building Pane on Windows","text":"# Building Pane on Windows\n\nThis document explains how to build Pane for Windows.\n\n> **Note:** The primary native modules (`@lydell/node-pty` and `better-sqlite3-multiple-ciphers`) have prebuilt binaries for Windows.\n\n## Quick Start\n\n```bash\n# Build for x64 (recommended for most users)\npnpm run build:win:x64\n\n# Build for ARM64\npnpm run build:win:arm64\n```\n\nOutput files will be in `dist-electron/`:\n- `Pane-{version}-Windows-x64.exe` - x64 installer\n- `Pane-{version}-Windows-arm64.exe` - ARM64 installer\n\n## Prerequisites\n\n1. **Node.js** - 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x)\n2. **pnpm** - v10\n3. **Python** - v3.x (for native module compilation)\n4. **Visual Studio Build Tools** - With C++ workload\n\n### Installing Visual Studio Build Tools\n\n```bash\n# Using winget\nwinget install Microsoft.VisualStudio.2022.BuildTools\n\n# Or download from:\n# https://visualstudio.microsoft.com/visual-cpp-build-tools/\n```\n\nMake sure to install the \"Desktop development with C++\" workload.\n\n## How the Build Works\n\nThe Windows build uses a custom script (`scripts/build-win.js`). It:\n\n1. Downloads the Electron prebuilt for `better-sqlite3-multiple-ciphers` for the target architecture, or compiles its pinned source with `@electron/rebuild` for that exact Electron version and architecture when the prebuilt is unavailable. The resulting PE architecture must match the target.\n2. When building for a different architecture than the host, installs the matching `@lydell/node-pty-win32-<arch>` prebuilt package.\n3. Builds the frontend and main process, injects build info, and generates notices.\n4. Runs electron-builder with native module rebuild disabled.\n5. Checks the icons in the packaged app.\n\n### Why These Steps\n\n#### better-sqlite3-multiple-ciphers Electron Prebuilt\n\n**Problem:** When using `pnpm install --ignore-scripts`, the `prebuild-install` postinstall script doesn't run, so the package gets the wrong binary (Node.js ABI instead of Electron ABI). This causes \"is not a valid Win32 application\" errors at runtime.\n\n**Solution:** The build script runs `prebuild-install` with the correct Electron runtime and version. If the upstream release lacks that ABI/architecture combination (for example Electron 43 / ABI 148 / Windows ARM64), it builds the pinned package from source using the existing `@electron/rebuild` tool. Install Visual Studio 2022 C++ build tools, including the ARM64 compiler when cross-compiling. A failed rebuild or mismatched PE architecture stops packaging; the script never substitutes a host-architecture binary.\n\n#### Cross-Architecture node-pty\n\n**Problem:** pnpm only installs the `@lydell/node-pty` platform package that matches the host architecture.\n\n**Solution:** For cross-architecture builds, the build script downloads the target platform package and links it into `node_modules`.\n\n#### Native Module Rebuild\n\n**Problem:** Rebuilding native modules for Electron can fail on Windows due to pnpm path issues.\n\n**Solution:** The build script disables npm rebuild (`--config.npmRebuild=false`) and relies on:\n- Downloaded or explicitly source-built Electron binaries for `better-sqlite3-multiple-ciphers`, checked against the target PE architecture\n- Prebuilt platform packages for `@lydell/node-pty` (no rebuild needed)\n\n## Manual Build Process\n\nIf the build script fails, you can try these manual steps:\n\n### Step 1: Install dependencies without running scripts\n\n```bash\npnpm install --ignore-scripts\n```\n\n### Step 2: Download Electron prebuilt for better-sqlite3\n\n```bash\n# Navigate to the better-sqlite3-multiple-ciphers package directory\ncd node_modules/.pnpm/better-sqlite3-multiple-ciphers@*/node_modules/better-sqlite3-multiple-ciphers\n\n# Download the Electron-compatible prebuilt (replace 43.8.3 with your Electron version)\nnpx prebuild-install --runtime electron --target 43.8.3 --arch x64 --verbose\n\n# Return to project root\ncd -\n```\n\n### Step 3: Build\n\n```bash\npnpm run build:frontend\npnpm run build:main\npnpm run inject-build-info\npnpm run generate-notices\npnpm exec electron-builder --win --x64 --publish never --config.npmRebuild=false\n```\n\n## Troubleshooting\n\n### Error: `node-gyp failed to rebuild`\n\nTry building with `--config.npmRebuild=false` to skip native module rebuild:\n```bash\npnpm exec electron-builder --win --x64 --publish never --config.npmRebuild=false\n```\n\n### Error: `better_sqlite3.node is not a valid Win32 application`\n\nThe better-sqlite3 native module was built for Node.js instead of Electron. Run the prebuild-install step:\n```bash\ncd node_modules/.pnpm/better-sqlite3-multiple-ciphers@*/node_modules/better-sqlite3-multiple-ciphers\nnpx prebuild-install --runtime electron --target 43.8.3 --arch x64 --verbose\n```\n\n### Native modules not working at runtime\n\nIf the app crashes due to native module issues:\n1. Ensure you're running on the same architecture you built for\n2. Verify the better-sqlite3 prebuilt was downloaded for Electron (see above)\n3. Check that Python and Visual Studio Build Tools are properly installed\n\n## Architecture Notes\n\n### x64 vs ARM64\n\n- **x64 build**: Works on both x64 and ARM64 Windows (ARM64 uses emulation)\n- **ARM64 build**: Native performance on ARM64, but requires ARM64 native modules\n\nFor most users, the x64 build is recommended as it works on all Windows machines.\n\n### Native Module Compatibility\n\nThe following native modules are used:\n- `better-sqlite3-multiple-ciphers` - SQLite database (has Windows Electron prebuilts)\n- `@lydell/node-pty` - Terminal emulation (has Windows x64 prebuilts, validate after each Electron major upgrade)\n\nPrebuilt availability depends on the Electron ABI and target architecture. SQLite falls back to source compilation when necessary; node-pty uses the matching platform package. The Windows ARM64 build workflow exercises the installer build, but running the ARM64 app still requires an ARM64 machine.\n\n## CI/CD\n\nFor CI/CD pipelines, use:\n```bash\nnode scripts/build-win.js x64\n```\n\nThis runs all of the steps above.\n"},{"path":"docs/CHAT_TABS.md","title":"Chat tabs","text":"# Chat tabs\n\nA chat tab runs a coding agent as a conversation, with no terminal. Pane is an\n[Agent Client Protocol](https://agentclientprotocol.com) (ACP) client. Any\nagent in the agents config with a `chat` section can run in a chat tab\n([Agents](#agents)): Claude and Codex through Pane's bundled ACP adapters,\nCursor and OpenCode as their own CLI in ACP mode. A chat tab stays a chat:\nthere is no move back into a terminal. A terminal agent tab can move the other\nway with **Switch to chat** (below). The *In a terminal* entries of the + menu\nopen terminal agent tabs, as before.\n\nA fresh install starts with chat tabs on. An existing install keeps the setting\nit had, so one that never turned them on stays off until you switch\n**Settings → AI & Agents → Chat tabs**. While they are off, the + menu has no chat\nentries and new Sessions open their orchestrator in a terminal. Open chat tabs keep working.\n\n## Opening one\n\n- **Desktop**: the + menu lists, under *New tab*, each chat agent installed on\n the Pane's machine, **Agent Farm profile…** and **More agents…** (which opens\n Settings → Agents), then *In a terminal*: the terminal agents and a plain\n Terminal. The menu reads the host's agent catalog again each time it opens,\n so an agent installed meanwhile shows up. The empty Pane screen offers the\n same.\n- **Remote PWA** and **phone**: *Add Tool* lists the host's installed chat\n agents and **Agent Farm profile…** first when the host has chat tabs on.\n- **Agent Farm profile…** asks for a profile name and optional arguments, one\n `key=value` per line, and opens the chat tab on the Pane's machine exactly as\n `--agent-farm <profile> --arg key=value` does. The name is typed, not picked:\n `agent-farm profiles list` prints no machine-readable list. An unknown profile\n shows Agent Farm's error in the dialog and opens nothing.\n- **runpane**: `runpane panels create --pane <id> --chat --agent <id>`, or\n `--agent-farm <profile> [--arg key=value …]` for an Agent Farm profile.\n With `--chat`, `--agent` takes any agent id; the host refuses one it cannot\n run. `--initial-input` is the first prompt, sent once.\n- **Sessions**: with chat tabs on, a new Session runs its orchestrator in a\n chat tab for any chat agent, Cursor and OpenCode included (see\n [SESSIONS.md](SESSIONS.md)).\n\n## Agents\n\nEach agent is an entry under `agents.entries` in `contracts/runpane/contract.json`\n(schema: `$defs/agent` and `$defs/agentChat` in `contracts/runpane/schema.json`).\nIts `chat` section says how its chat starts:\n\n| Agent | Runs as | Full access | Switch to chat |\n| --- | --- | --- | --- |\n| Claude | bundled `claude-agent-acp` running `claude` | session mode `bypassPermissions` | yes, sure of the conversation |\n| Codex | bundled `codex-acp` running `codex` | session mode `agent-full-access` | yes, most recent conversation |\n| Cursor | `cursor-agent acp` | launch flag `--force` | no |\n| OpenCode | `opencode acp` | Pane answers each approval | yes, most recent conversation |\n\nThe host's agent catalog (`chat-tab:agents`,\n`main/src/services/chatTabs/agentCatalog.ts`) lists the agents this machine can\nopen as chats, for every client: label, icon, whether the CLI is installed, its\ninstall page, who gives full access (the agent, or Pane), and whether **Switch\nto chat** works and why not. Capabilities (reopens chats, lists past chats,\nimages) and the version come from each agent's last ACP `initialize` reply,\nkept in `chat-agent-capabilities.json` in Pane's data folder, so an agent shows\nnone until its first chat starts. The desktop + menu, the empty Pane screen,\nthe PWA + menu and the phone's Add Tool sheet offer the installed ones.\n\n**Settings → Agents** lists every agent in the catalog with what it supports,\nits version once known, and an **Install** link for one that is not\ninstalled.\n\n## Agents from the ACP Registry\n\nBelow Pane's own agents, **Settings → Agents** lists the\n[ACP Registry](https://agentclientprotocol.com) (its URL is the agents\nconfig's `registryUrl`). Pane reads the index at most once an hour, when the\npage opens or an installed agent launches; **Refresh** on the page reads it now.\nIt keeps the last copy in `agent-registry/registry.json` in Pane's data folder.\nWith no copy and no connection, installed agents still show, with Remove.\n\n- **Listed**: agents published as a download for this computer or as an npm\n package. Agents published only for `uvx` are left out (Pane ships no Python\n toolchain), and so are ones a configured agent covers (its `chat.registryIds`).\n- **Install** puts the registry's current version in\n `agent-registry/agents/<id>/<version>/`. A download is checked against the\n sha256 the registry publishes and refused when it differs. A download with no\n checksum installs only after you confirm you trust it; later versions of that\n agent then install without asking again. An npm package installs\n with your own `npm` and runs with your own Node.js; without them the row says\n **Needs Node.js**. A failed install shows its error on that agent's row only.\n- **Updates**: an installed agent moves to the registry's newest version on its\n next launch, with no prompt, and the older version's folder is removed once the\n new one starts and no other tab still runs the old one. When the registry cannot be read or the update fails, the\n installed version runs.\n- Installed agents join the + menu after Pane's own agents, marked\n **Full access by Pane** (Pane answers each approval with allow once when full\n access is on). They have no terminal tab, so they have no Switch to chat.\n **Remove** deletes every version; it is refused while a chat tab runs the\n agent. An installed agent the registry stops offering stays in the list,\n marked **No longer listed**, so it can still be removed.\n- Installing or removing an agent is refused for a teammate's Pane: it runs code\n on the owner's machine.\n\n## Switching a terminal tab to chat\n\n**Switch to chat** (right-click a terminal agent tab, or the command palette)\ncontinues the terminal's conversation in a chat tab (D-129, D-184, D-229,\nD-282). It works for agents whose config sets `chat.terminalConversationsLoad`\n(Claude, Codex and OpenCode). It asks with one plain confirmation and never\nsends anything to your agent. The menu of a tab running any agent in the\ncatalog always shows it (D-337): with chat tabs off it is greyed out with\n**Turn on chat tabs** below it; for an agent whose chat can't load its\nterminal's conversations (Cursor) it is greyed out with that reason; and a chat\ntab shows it greyed out as already a chat. The command palette offers it only\nwhen the switch can run.\n\nRight-click a Session in the sidebar (or on All machines, where it runs on the\nSession's own machine) and choose **Switch to chat…** to switch every terminal\nagent tab in it: the orchestrator, and the agent tabs of each Pane in it (all of\na Pane's tabs when the whole Pane is in the Session, otherwise only the tabs\nadded to it). A dialog\nfirst lists the tabs that will switch and the ones it will skip, with why (busy\nmid-turn, a tab Pane isn't sure of the conversation for, which includes every\nterminal of an agent other than Claude, not an agent, a launch chat can't run). A Session switch opens\nonly conversations Pane is sure of; switch an unsure tab from its own menu to\nget the most recent one and **Pick another**. A Pane's terminal dock is\nnot a tab and isn't listed. Pane then switches them one at a time the same way\nas one tab, so a tab that fails is put back the way one tab's switch puts it\nback and the others carry on,\nand the dialog ends with a summary such as \"4 switched, 1 skipped: busy\". Each\ntab is checked again just before it switches; one that wasn't on the confirmed\nlist (busy then, or opened since) is left as it is. The item is always in the\nSession menu (D-337): it shows a spinner and \"Checking…\" while the Session's\nmachine looks, then greys out with why when nothing can switch (\"Nothing to\nswitch: 2 busy, 1 no saved conversation\", or \"Chat tabs are off on build-box\"). When chat\ntabs are off on this window's own host, **Turn on chat tabs** sits below it;\nit turns them on and closes the menu, and the menu checks again each time it\nopens.\n\n**Which conversation opens.** Only Claude's terminal reports its conversation\n(`terminal.reportsConversation` in its config). Pane learns it from Claude\nCode's `SessionStart` hook, which fires on start, `/resume`, `/clear` and\ncompact (D-269). Pane adds the hook to plain `claude` tabs through the tab's\n`--settings` file, and Agent Farm ships it in the plugin it compiles for every\nClaude it launches. The hook runs `runpane panels conversation --hook`, which\nrecords the conversation on the tab and as the one its next restart resumes.\nPane never asks the running Claude.\n\n- **Sure**: the hook reported since the terminal's current launch started. The\n chat loads that conversation with ACP `session/load`, with its history and no\n banner. If it has no messages yet, the chat starts new with a \"Started a new\n conversation\" note instead.\n- **Not sure**: no report from this launch (a terminal started before the update\n or by an older Agent Farm, WSL and SSH tabs) and every terminal of another\n agent (Codex, OpenCode). The chat\n lists the folder's conversations (ACP `session/list`), leaves out any open in\n another Pane tab on this machine, and opens the newest, with the banner\n \"Opened the most recent conversation here\" and **Pick another**. The terminal\n has just stopped, so its own conversation counts, and it is usually the one.\n With none left the chat starts new with a note; if listing fails (for example\n Codex signed out), or every one of the newest 2,000 is open elsewhere, it\n starts new and says why. Two chats opened at once never get the same one.\n\nNothing is touched when a turn is in progress (Pane asks you to wait or stop\nit) or when the launch can't be kept: the chat gets the plain agent, whose\nterminal full-access flags become the chat's full access, or the Agent Farm\nprofile and its args (a Session's own saved launch for its orchestrator). The\nagent's other default terminal flags (`terminal.args`, such as Cursor's\n`--trust`) are accepted and dropped. A `--model` flag becomes the chat's model,\nand Claude in a Session's Pane keeps its read-only Session folder access\n(`--settings` there, `claudeCode.options.settings` here). Any other flag or a\nwrapper command is refused by name.\n\nOtherwise Pane stops the terminal agent, opens the chat tab, then closes the\nterminal tab. The chat takes the terminal's exact place in the tab order and is\nselected. A Session's orchestrator becomes its chat tab.\n\nIf the chat fails after the terminal stopped, the dialog says what happened,\nwith **Try again** (the reason is also in Pane's log, as `[ChatTabs]`), and the\nchat tab is removed. When Pane was sure, the terminal restarts on that\nconversation (\"The chat couldn't open it … The terminal is back on the same\nconversation\"); if that restart fails too, it says the terminal is stopped and\nthe conversation is saved. When Pane wasn't sure, or the conversation had no\nmessages, the terminal stays stopped (\"The chat couldn't start\"), since a\nrestart could open the wrong conversation or start an empty one. A terminal\nrestarted in place redraws at once. In the rare case that the chat has the\nconversation but the Session could not move to it, or the terminal tab could not\nbe closed, the dialog says so and both tabs stay, since removing either could\nlose the Session's tab. Pane rebuilds no telemetry for the switch.\n\nA terminal Codex that runs through Codex's shared background service\n(`codex app-server daemon`) stays that thread's writer after the terminal stops,\nso loading it in chat fails with \"in use by another Codex client\".\n\n## Continuing a past conversation (/resume)\n\nAny chat tab can continue another conversation from its folder. Type `/resume`\n(the composer menu lists it as Pane's own, since Claude Code hides its `/resume`\nfrom chat and Codex has none) or press **Pick another** on the banner. The\npicker lists the folder's conversations newest first, with a filter. The tab's\nown is marked \"open here\"; one open in another Pane tab shows \"Open in tab …\"\nand can't be picked, so two processes never write one conversation. Picking one\nreloads the tab on it with its history; the tab keeps its Session. Picking is\nrefused while the agent is in the middle of a turn, and while messages wait in\nthe queue, since they were written for the current conversation (remove them or\nlet them send first). Pane lists up to the newest 2,000 conversations of a\nfolder; past that the picker says older ones aren't shown. A conversation running\noutside Pane (a plain shell `claude`) can't be detected and is listed like any\nother. The picker works in the desktop chat tab, the Autopilot view and the\nremote web app.\n\n## Where the agent runs, and sign-in\n\nThe agent runs on the tab's host: this computer for a local Pane, the other\nmachine for a Pane on a connected machine. Clients (desktop, PWA, phone) only\nshow the conversation and send messages.\n\nA chat tab always runs the person's installed, unmodified CLI, found on the\nsame PATH terminal agent tabs use (`main/src/services/chatTabs/launch.ts`). A\nbundled adapter gets it through the variable its config names\n(`chat.adapter.executableEnv`: `CLAUDE_CODE_EXECUTABLE` for Claude, `CODEX_PATH`\nfor Codex). An agent with `chat.args` runs as its own CLI with those arguments\n(`cursor-agent acp`, `opencode acp`). Pane never uses a bundled copy of an\nagent CLI, never reads, stores or relays an agent's login, and never copies one\nbetween machines.\n\n- **Not signed in**: the tab stops and says so, with **Sign in in\n Terminal**, which opens a terminal tab on that machine running the agent's\n advertised terminal sign-in (an agent running as its own CLI), or its\n executable with the config's `signIn` arguments (`claude auth login`,\n `codex login`). Press **Retry** after signing in. The tab never retries alone.\n- **Not installed**: the tab says so with the command that installs it.\n- **API key (optional)**: Settings → AI & Agents → *Chat tab sign-in* keeps one\n key per agent whose config names `chat.apiKeyEnv`, in the OS secure store on\n that machine (Electron `safeStorage`, `chat-tab-keys.json`, a map by agent\n id), and passes it only as those env variables (Claude `ANTHROPIC_API_KEY`;\n Codex `OPENAI_API_KEY` and `CODEX_API_KEY`; Cursor `CURSOR_API_KEY`). OpenCode\n takes none. A key is never synced or sent to clients.\n The key is the owner's: a teammate (another login on the tailnet, when the\n host is set to \"Everyone on tailnet\") cannot save or remove it, and a chat\n tab a teammate opens starts without it or the project's secret variables,\n including after the owner switches that teammate's terminal to chat.\n A teammate cannot run Sign in for a chat tab either. Saving a key needs Chat\n tabs on; removing one always works.\n\nChat tabs don't run in WSL projects or on SSH hosts.\n\n## Adapters and versions\n\nThe adapters ship inside Pane as exact dependencies in `package.json`:\n`claude-agent-acp` 0.100.0 and `codex-acp` 2.5.0. Nothing is downloaded.\n`scripts/verify-chat-adapters.js` fails a packaged build unless each bundled\nadapter starts and answers ACP `initialize`. A build missing its\nadapter says to reinstall Pane.\n\nBefore a chat tab starts, `checkAgentCli`\n(`main/src/services/agentChat/adapterSetup.ts`) checks that the installed CLI\nit will run, in the tab's folder and environment, is at least the agent's\n`chat.minimumVersion`: Claude Code 2.1.316, Codex 0.165.0, Cursor 2026.10.22,\nOpenCode 1.18.14. An older one stops the tab with the command that updates it.\nChange an adapter pin only with its agent's `chat.minimumVersion`, and after\nrunning the chat tab suites against it.\n\n## Full access\n\nFull access lets the agent act without asking (D-16). The agents config says\nhow each agent gets it:\n\n- **A session mode** (`chat.fullAccess.mode`: Claude `bypassPermissions`,\n Codex `agent-full-access`): the agent's own permission mode chip sets it.\n- **A launch flag** (`chat.fullAccess.args`: Cursor, whose terminal\n `fullAccessArgs` are `--force`): Pane adds a **Full access** On/Off setting\n to the composer's settings menu. Switching it restarts the agent with or\n without the flag, on the same conversation.\n- **Neither** (OpenCode): the same **Full access** setting. While it is on,\n Pane answers each approval request with the agent's allow-once option, never\n allow-always, and marks the step \"Approved by Pane\" (the mark lasts while\n the tab runs; a reopened conversation's history comes from the agent and has\n none). Switching it takes effect at once.\n\nFull access can't change during a turn. While Pane's Full access is on, the\ncomposer marks it in amber like a mode that never asks.\n\n## What the chat shows\n\n- Replies stream as markdown; thinking is collapsed.\n- The agent's steps are grouped by kind: *Explored 2 files, 1 search*,\n *Edit file +18 −4* with **View diff** (which opens Pane's diff view; a diff\n never renders in the thread by itself; the PWA and the phone bring the Pane's\n Diff tab forward, which shows the branch's changes read-only), *Run* with the command's output\n streaming in its own row, *Ran 9 commands*.\n- To-do lists from the agent's plan updates.\n- **Approvals** dock above the composer with exactly the choices the agent\n sent; keys 1 to 9 answer while the composer is empty. Typing a message\n instead sends it and, once Pane has it, declines the request. ExitPlanMode shows the\n plan itself. A step Pane approved under its own Full access is marked\n \"Approved by Pane\" ([Full access](#full-access)).\n- **Questions** (ACP form elicitation, such as Claude's AskUserQuestion) dock\n as a form. Pane declares `elicitation.form`; without it Claude turns\n AskUserQuestion off. Agents use it only for a quick question in this chat;\n anything else goes to an approval card\n ([PANE_NOTIFY.md](PANE_NOTIFY.md#what-an-agent-can-send), \"Which card\").\n- The composer is the input over one row of controls: attach image, the\n permission mode chip, then one menu showing model and effort together\n (\"Opus 5.5 · Medium\"; a trailing \"(recommended)\" and an effort of \"Default\"\n are left off the button, never from the menu). A mode that never asks\n (Bypass, Codex's Full access) shows its chip in amber, as does any mode chip\n while Pane's own Full access setting is on; an agent with no mode chip shows\n a small shield instead. The row never overflows a\n narrow column: the model label truncates and the mode chip drops to its icon\n first, while attach and send keep their size. In a window dragged very\n narrow the row drops the model button, then attach, and keeps send. That menu also holds every other setting the agent\n offers (such as Claude's Fast mode, Ultracode and Agent), each under its own\n name, and Pane's **Full access** for an agent without a full-access mode. Pane places a setting by its ACP category (`mode`, `model`,\n `thought_level`), or by its id when the agent sends none. At phone width\n (the phone app, and the PWA when the composer is under 480px) the row is\n sparer: **+**, then the model as plain text with its effort muted (\"Opus 5.5\n Medium\"), then send. The permission mode moves into that button's sheet as\n **Permissions**, below Model, Effort and the other settings; each choice shows\n a check and On/Off settings are switches. A mode that never asks (Bypass), or\n Pane's Full access when on, leaves a small shield on the row. The `/` menu lists\n the agent's own commands and skills, plus Pane's own **/clear**; **Stop** (or Esc in the composer) cancels the turn.\n- **Status bar** (D-222, D-253, D-267, D-276): one muted line just above the composer,\n items split by dots, each opening what it names:\n - **Context left** (\"Ctx 41%\", amber at 20% or less) opens the tokens used,\n a meter and **Clear conversation**; it is absent when the adapter reports no\n usage;\n - **Agents working** (\"3 working\"), in a Session orchestrator's chat and in\n Autopilot's: how many of the Session's agents are working right now (for\n Autopilot, across every Session it walks), counted from the Session\n overview: one per tab whose agent is working, so a Pane with an implementer\n and a reviewer both working counts two. Tabs waiting, idle or finished\n don't count, and the item is hidden when none is working. A change re-reads\n only the Session it names. It opens a list of each agent with its tab; a\n row opens that tab (the PWA opens its Pane);\n - **Pull request** (\"#1272 · Open\", the chat's Pane's PR) opens it on GitHub;\n the PWA reads it from the host's git status;\n - **Background tasks** (\"2 tasks\") lists them, with Stop where the adapter\n allows it;\n - **Queued messages** (\"2 queued\") moves focus to the queue.\n\n Items with nothing to say stay out. **…** picks which items show; the choice\n is remembered on this device (`pane-chat-status-items:v1` in local storage),\n and **Reset to default** brings all five back. While a turn runs the bar ends\n with the send-now keys. At phone width it is compact (the percentage and PR\n number alone) and scrolls sideways instead of wrapping. The phone app has no\n status bar yet.\n- **Enter goes to the chat** (D-328): with a chat tab on screen and focus on\n no control (the page, a split, a scroll surface such as the commit history),\n Enter moves focus into its message box. Opening a Pane or Session with Enter\n from the sidebar, or pressing Enter on a chat's tab, lands there too, even\n while the chat is still loading. With splits, Enter stays in its own split:\n it goes to the focused split's chat, and a chat's tab opens into that chat,\n never into another split's. Enter in a field, terminal, button, menu, picker\n or dialog keeps its own meaning.\n- **Queue and Send now** (D-211): a message sent while the agent works (Enter)\n waits in the queue, listed in the order it will be sent. Each queued message\n can be edited (its images are kept), removed, or sent now. **Send now**, or\n Cmd/Ctrl+Enter in the composer, puts the message first and interrupts the\n running turn (including one blocked on an approval or question), so it is\n sent as soon as the turn stops (`chat-tab:send` with `now`, `chat-tab:send-now`,\n `chat-tab:edit-queued`).\n- **/clear** (or **Clear** above the thread) ends the agent and starts a fresh\n conversation in the same tab, with the same agent, launch and settings\n (`chat-tab:clear`). It asks first while a turn runs; a turn cut off this way is\n marked failed. Queued messages are kept and go to the new conversation, which\n starts with a \"Cleared · 2:04 PM\" divider. A stopped tab refuses it, and\n Autopilot's chat does not offer it (its conversation holds what Start told it).\n- **Context and background work**: the view carries the adapter's last\n `usage_update` (`context: { used, size }`, from any agent that sends it) and the\n background tasks it runs (`tasks`, Claude's background shells and subagents;\n `chat-tab:stop-task` stops one). Usage is kept in memory, so a reopened chat has\n none until its next turn, and the status bar shows nothing rather than a guess.\n- **Copying**: message text can be selected and copied like any page. Each\n message and each finished response has a copy button (on hover with a mouse,\n always on touch) that copies what was written, as Markdown, without the\n agent's activity. **Copy conversation** above the thread copies the whole\n conversation, including messages scrolled out of the window, under **You:**\n and the agent's name, with each tool step as one short line and no raw output. Code blocks have their own copy button. On the\n phone app, each message has a copy action, and a long press on a reply copies\n it.\n- **Attachments** (desktop and PWA): drop photos and files anywhere on the chat,\n paste them into the composer, or pick them with **+**. An image the agent\n takes (PNG, JPEG, WebP or GIF up to 5 MB) is sent as an image. Any other file,\n up to 10 MB, is copied to the Pane's folder on the chat's machine under its own\n name (in a folder of its own, so two files with one name never collide), the same\n way a terminal tab's upload works (`terminal:paste-file`, so a remote host\n receives it too), and its path is sent with the message. Each attachment is a\n chip that can be removed before sending, and sending waits until every file\n has finished copying. Every refusal says why, and nothing is attached for it.\n The phone app keeps its **+** photo picker.\n- The composer does not show the machine: the window's machine picker does, and\n an approval from a remote machine names it.\n\nA chat shows the agent's text and pictures; what it did in between stays out of\nthe way (D-192). While a turn runs, one quiet line says what it's doing now\n(\"Running pnpm test\", \"Thinking\"). When it ends, its steps, thinking, to-do lists\nand notices fold into one row, \"Worked for 27s\", that opens to them.\n\nThe latest turn says when it finished (D-202): \"Worked for 27s · 2:04 PM\", or\n\"2:04 PM\" alone when it did nothing but answer. An older time reads \"Yesterday\n4:12 PM\" or \"Nov 3, 4:12 PM\", in the person's locale. Every other message shows\nits time on hover; on the phone, a long press shows it. A conversation reopened\nafter a restart keeps the times of its last 200 turns; older turns show none.\n\nThe conversation stays in the order things happened (D-193). Claude can start a\nturn by itself, for example when a background command finishes. Pane sees that\nthrough the adapter's `asyncTasks` capability: the tab shows as working, the turn\ngets its own row, and a message sent meanwhile waits in the queue until the turn\nends, like one sent during any other turn. Stop ends it.\n\nIn a Session orchestrator's chat, a worker Pane shows up as one line with\n**Open** when it finished or failed during the latest turn, once that turn has\nended (D-201, narrowed by D-223), for example \"approvals-global finished ·\n**Open**\". A worker's question reaches the person as an approval the\norchestrator relays (D-220), never as a line here. Other workers stay out of\nthe chat; the sidebar lists every Pane. This comes from Pane's own Session state\n(its Panes, their agent states and `runpane report`s), never from what the agent\nwrote.\n\nApprovals and questions are also asked in Pane's Approvals and on the phone (see\n[PANE_NOTIFY.md](PANE_NOTIFY.md)), a question form one field at a time. The\nfirst answer wins everywhere. In the chat, a form that asks several questions\n(Claude's AskUserQuestion with more than one, or any form with several fields)\ntakes them one at a time (D-230): \"1 of 2\", each question with its options and\nits Other box, Next and Back, and on the last one a review of the picks beside\n**Answer**. Every field is a question of its own, except a choice's optional\nOther box (keyed after the choice, such as `question_0_custom`, or titled\n\"Other\"), which stays with it. Number keys pick an option and Enter goes on,\nwith focus moving to each new question; **Skip** passes over one question, and\nskipping every one declines the form. A form with one question has no steps.\n\n## Restart and resume\n\nA chat tab saves its agent, its launch (plain agent with an optional session\nmode, or an Agent Farm profile and its args), its working folder and the ACP\nsession ID. It saves no env and no secret: env is rebuilt at every start, and an\nAgent Farm profile is printed again.\n\nAfter Pane restarts, a chat tab starts again when you open it (or on\n`runpane panels resume` / `resume-many`), loads its conversation (the adapter\nreplays the history) and shows it. A turn that was running when Pane closed is\nmarked *Stopped when Pane closed*; a message sent then continues the same\nconversation. If the agent exits, the tab shows why with **Restart**, which\nloads the same conversation.\n\nAuto-pause (Settings > Pause) stops the agent of a chat tab idle for\n`chatIdleReleaseMinutes` (30 by default), which frees its memory. It skips the\nPane on screen and a tab that is working, holds a queued message or waits on the\nperson. The paused tab keeps showing its conversation and controls; opening it,\nsending it a message or using its model, mode or `/resume` controls resumes the\nagent in the same conversation.\n\n## Cost\n\n- No process polling: Pane learns about the adapter's exit from its own events,\n and stops the adapter's whole process group when the tab closes.\n- No cap stops a conversation: the newest messages stay in memory (up to 1,000\n or 24 MiB per tab) and older ones go to a per-tab file under `chat-tabs/` in\n Pane's data folder, rebuilt at every start. Viewers keep a window of at most\n about 700 messages: **Earlier messages** pages older ones in\n (`chat-tab:history`) and drops the newest, **Newer messages** pages back\n down, and the jump-to-latest arrow returns to the live end.\n- Only the chat tab on screen renders. A hidden tab is unmounted and holds no\n transcript; showing it reads the newest window from the host once.\n- A streaming reply redraws at most once per stream frame (`STREAM_FRAME_MS` in\n `shared/constants/streamCadence.ts`, also the terminals' output interval when\n no one is typing), and its markdown is parsed block by block, so an update\n re-parses only the block being written. A reply with link definitions,\n footnotes or a raw HTML block that can span blank lines is parsed whole, and\n so is a reply shown after its turn ended, which keeps opening a long chat\n fast.\n- A queued message keeps only a preview in the tab's saved state; its full text\n and images wait in a file beside it until they are sent.\n- A tool step's update sends only the fields that changed; command output is sent\n as appends.\n\n## runpane on chat tabs\n\n`panels submit` sends an ACP prompt and returns an `acp-receipt` (queued while\nthe agent works). `panels wait` is ready when a turn ended and nothing is queued,\nand returns at once as blocked while an approval or question waits. A text\nwait (`--for text`) searches only what the agent writes after the wait starts,\nplus a reply still streaming then, never the person's prompts. `screen`\nand `output` read the transcript (`source: acpTranscript`), `last-message` the\nnewest reply, `report` is kept in the tab's state, and `resume` restarts the\nagent and loads the conversation. `panels input` and `submit-composer` fail with\n`CHAT_TAB_NO_TERMINAL`: a chat tab has no terminal. The agent gets the same\nenv as a terminal agent tab: `PANE_*`, so `runpane report` and `notify` work from\ninside it, the project's environment variables, and `GIT_CEILING_DIRECTORIES`\nfor a Session orchestrator.\n\n## Agent Farm profiles\n\nFor `--agent-farm`, Pane runs `agent-farm run <profile> --print-acp --acp-adapter\n<bundled adapter> [--arg key=value …]` at every start, spawns the printed `argv`\nwith the printed `env` added, sends the printed `session` on `session/new` and\n`session/load`, and selects the printed `mode` with `session/set_mode` after each.\nAgent Farm runs the adapter with plain Node, which can't read inside `app.asar`,\nso a packaged Pane passes a small launcher from `agent-adapters/` in its data\nfolder that starts the bundled adapter with Pane's Electron.\nA profile's harness must be an agent Pane runs through a bundled adapter\n(Claude or Codex).\nThe profile's model, effort, instructions with LAUNCH CONTEXT, skills,\nsubagents, MCP servers and telemetry come with it. The contract is Agent Farm's\nCONFIGURATION.md, *ACP sessions*.\n\n## Older clients\n\nPhone apps released before chat tabs would crash on a tab kind they don't know,\nand send no version. Clients pass what they can show: `{ chatTabs: true,\nchatAgents: true }` from this desktop, the PWA and the current phone app. A\nclient without `chatTabs` shows no chat tab; one without `chatAgents` shows\nonly chat tabs of agents whose config sets `chat.legacyClients` (Claude and\nCodex) (`clientShowsChatTab` in `main/src/ipc/panels.ts`). For a chat tab the\nclient can't show, `panels:list` leaves it out, a Session the client creates\nstarts its orchestrator in a terminal, and `orchestration-sessions:get` of a\nSession whose orchestrator is that chat tab fails with\n`CHAT_TAB_CLIENT_OUTDATED`, which says to update Pane on the phone (D-100).\n\n## Code\n\n| Part | Where |\n| --- | --- |\n| Agents config (generated by `node scripts/generate-runpane-contract.js`) | `contracts/runpane/contract.json` `agents`, `shared/types/generatedAgents.ts`, read through `shared/agents.ts` |\n| ACP Registry install (`chat-tab:registry`, `install-agent`, `remove-agent`) | `main/src/services/agentRegistry/`, `frontend/src/stores/agentRegistryStore.ts` |\n| Agent catalog (`chat-tab:agents`) | `main/src/services/chatTabs/agentCatalog.ts`, `frontend/src/stores/chatAgentsStore.ts`, `frontend/src/components/settings/categories/AgentsSettings.tsx` |\n| Host runtime, transcript, launcher, Agent Farm profiles, Notify bridge, Switch to chat | `main/src/services/chatTabs/` |\n| Commands (`chat-tab:*`) | `main/src/ipc/chatTabs.ts` |\n| runpane | `main/src/ipc/runpaneChatTabs.ts`, `main/src/ipc/runpane.ts` |\n| Shared types, presentation, decoders | `shared/types/chatTab.ts`, `shared/chatTabPresentation.ts`, `shared/chatTabPermissions.ts`, `shared/chatTabQuestions.ts`, `shared/types/chatTabDecoders.ts` |\n| Viewer (window, paging, catch-up), shared by every client | `shared/chatTabViewer.ts` |\n| Desktop and PWA UI | `frontend/src/components/chatTab/`, `frontend/src/remote/components/RemoteChatTab.tsx` |\n| Phone UI | `native/src/features/chatTab/` |\n\n## Testing\n\nTests never touch a real agent account. `main/src/services/chatTabs/testing/scriptedAgent.mjs`\nis a scripted ACP agent (each prompt's first word picks a behaviour: `permission`,\n`question`, `slow`, `crash`, `steps 6`, `edit`, `plan`, …), and `fakeAgentFarm.mjs`\nprints a `--print-acp` launch for it. An unpackaged Pane started with\n`PANE_CHAT_TEST_AGENT=<path to scriptedAgent.mjs>` runs it in every chat tab;\n`tests/chat-tabs.spec.ts` uses that for journeys J1 and J5: run it with\n`pnpm build:main && pnpm test:chat-tabs` (CI runs it in Functional Smoke (Electron)).\n"},{"path":"docs/CONFIG_FILES.md","title":"Config File Detection","text":"# Config File Detection\n\nPane automatically detects workspace configuration files at your repository root and uses them to provide default scripts for session setup, the Play button, and cleanup on archive. This lets teams share workspace configuration via git — commit the file, push, and every teammate gets the same setup.\n\n## Supported Files\n\nPane checks for these files in priority order. The first file found with at least one script defined wins:\n\n| Priority | File | Format | Origin |\n|----------|------|--------|--------|\n| 1 | `pane.json` | JSON | Pane's native format |\n| 2 | `conductor.json` | JSON | [Conductor.build](https://conductor.build) |\n| 3 | `.gitpod.yml` | YAML | [Gitpod](https://gitpod.io) |\n| 4 | `.devcontainer/devcontainer.json` | JSON | [Dev Containers](https://containers.dev) |\n\nIf none of these exist, Pane falls back to checking for `scripts/pane-run-script.js` in the worktree (the legacy auto-generated script).\n\n## pane.json\n\nThis is Pane's native config format. It follows the same schema as [conductor.json](https://docs.conductor.build/core/conductor-json), so teams using Conductor can switch to Pane without changing their config.\n\n### Schema\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\",\n \"archive\": \"pnpm cleanup\"\n },\n \"runScriptMode\": \"concurrent\"\n}\n```\n\nAll fields are optional.\n\n### Fields\n\n#### `scripts.setup`\n\nRuns automatically when a new worktree/session is created. Use for dependency installation, database setup, environment configuration, etc.\n\n**Examples:**\n```json\n\"setup\": \"npm install\"\n\"setup\": \"pnpm install && pnpm db:migrate\"\n\"setup\": \"bundle install && rails db:setup\"\n```\n\n#### `scripts.run`\n\nRuns when you click the **Play** button in the panel tab bar (or press Run Dev Server's key: `Cmd+Shift+D` on macOS, `Ctrl+Shift+D` on Windows and Linux). Use for starting dev servers, test watchers, or any long-running process.\n\nPane sets `PANE_PORT` to the first of a block of 10 ports picked from the pane's id (range 3000–8999), so dev servers in parallel panes rarely collide.\n\nSetup, run and archive scripts also get the project's environment variables, including Pane secret and keychain variables: see [PROJECT_ENV_VARS.md](PROJECT_ENV_VARS.md).\n\n**Examples:**\n```json\n\"run\": \"pnpm dev\"\n\"run\": \"npm run dev -- --port $PANE_PORT\"\n\"run\": \"concurrently \\\"npm run server\\\" \\\"npm run worker\\\"\"\n```\n\n#### `scripts.archive`\n\nRuns before a worktree is deleted when you archive a session. Use for cleaning up external resources — dropping test databases, revoking tokens, stopping background services.\n\n**Examples:**\n```json\n\"archive\": \"npm run db:teardown\"\n\"archive\": \"docker compose down\"\n```\n\n#### `runScriptMode`\n\nControls behavior when a new run script starts while one is already running.\n\n| Value | Behavior |\n|-------|----------|\n| `\"concurrent\"` | (Default) New script starts alongside existing ones |\n| `\"nonconcurrent\"` | Existing script is stopped before starting the new one |\n\n> **Note:** `runScriptMode` is detected but not yet enforced. This will be implemented in a future release.\n\n## How Scripts Map to Pane\n\nEach config file format maps to Pane's three lifecycle hooks differently:\n\n| Lifecycle | pane.json / conductor.json | .gitpod.yml | devcontainer.json |\n|-----------|---------------------------|-------------|-------------------|\n| **Setup** (worktree creation) | `scripts.setup` | First task's `init` | `postCreateCommand` |\n| **Run** (Play button) | `scripts.run` | First task's `command` | `postStartCommand` |\n| **Archive** (session deletion) | `scripts.archive` | — | — |\n\n## Override Model\n\nPane follows the same override model as Conductor:\n\n```\nProject Settings (UI) > Config File > Nothing\n```\n\n1. **If you set a value in Project Settings**, it always wins — the config file is ignored for that field\n2. **If Project Settings is empty**, Pane uses the config file value\n3. **If neither exists**, no script runs (except for the Play button, which falls back to Claude-generated setup)\n\nThis means config files provide **team-shared defaults** that individual users can override locally through the UI.\n\n### Per-Field Override\n\nEach script field is independent. You can override `run` in Project Settings while still using `setup` from `pane.json`:\n\n```\nBuild Script: empty → uses pane.json scripts.setup\nRun Commands: \"npm run dev:custom\" → overrides pane.json\nArchive Script: empty → uses pane.json scripts.archive\n```\n\n### From the CLI or MCP\n\nAgents read and change Project Settings with `runpane repos get` and `runpane repos update` (MCP tools `repos_get` and `repos_update`, in the opt-in `repos` toolset). `repos get` shows each script's saved value, the config-file fallback, and which one Pane will run:\n\n```bash\nrunpane repos get --repo my-app --json\n```\n\n```json\n\"runScript\": {\n \"value\": null,\n \"fallback\": { \"command\": \"pnpm dev\", \"source\": \"pane.json\" },\n \"effective\": { \"command\": \"pnpm dev\", \"source\": \"pane.json\" }\n}\n```\n\n`repos update` saves through the same path as the Project Settings dialog, so open Pane windows show the new values. `--clear` empties a field, and a cleared script falls back to the config file again:\n\n```bash\nrunpane repos update --repo my-app --run-script \"pnpm dev:custom\" --yes\nrunpane repos update --repo my-app --clear run-script --yes\n```\n\n`repos get` reads the config file at the repository root. At run time Pane reads it from each Pane's worktree, as the next section explains.\n\n## Branch-Local Config\n\nConfig files are read from the **session's worktree**, not the project root. This means:\n\n- If a branch modifies `pane.json`, that branch's sessions use the modified config\n- You can test config changes in a worktree before merging to main\n- Different branches can have different setup/run/archive scripts\n\n## Quick Start\n\n### 1. Create a `pane.json` in your repo root\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\"\n }\n}\n```\n\n### 2. Commit and push\n\n```bash\ngit add pane.json\ngit commit -m \"Add pane workspace config\"\ngit push\n```\n\n### 3. That's it\n\nWhen your teammates pull, Pane will automatically:\n- Run `pnpm install` when they create a new session\n- Run `pnpm dev` when they click Play\n- Show \"From pane.json\" in Project Settings so they know where the scripts come from\n\n### Already using another tool?\n\nIf your repo already has a `conductor.json`, `.gitpod.yml`, or `.devcontainer/devcontainer.json`, Pane will detect and use it automatically. No changes needed.\n\n### Moving your own scripts to another computer\n\nScripts saved in Project Settings live on one computer. **Settings › Import & Export** carries them, with the rest of your setup, to another one, and skips any script a repo's config file already provides. See [Export and import your Pane setup](SETUP_EXPORT_IMPORT.md).\n\n## Visibility\n\n### Project Settings\n\nWhen Pane detects a config file, Project Settings shows:\n- An info banner identifying which file was detected\n- \"From pane.json\" badges beneath empty script fields, previewing the command that will run\n- Updated tooltips explaining the fallback behavior\n\n### Play Button\n\nThe Play button tooltip shows exactly what will run and where it came from:\n- **With config:** \"Run: pnpm dev\" with \"from pane.json\" subtitle\n- **Without config:** \"Set up run script (via Claude)\" — launches AI-assisted setup\n\n## Examples\n\n### Node.js / TypeScript project\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install\",\n \"run\": \"pnpm dev\",\n \"archive\": \"rm -rf node_modules/.cache\"\n }\n}\n```\n\n### Python / Django project\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pip install -r requirements.txt && python manage.py migrate\",\n \"run\": \"python manage.py runserver 0.0.0.0:8000\",\n \"archive\": \"python manage.py flush --noinput\"\n }\n}\n```\n\n### Monorepo with multiple services\n\n```json\n{\n \"scripts\": {\n \"setup\": \"pnpm install --frozen-lockfile\",\n \"run\": \"concurrently \\\"pnpm --filter api dev\\\" \\\"pnpm --filter web dev\\\"\",\n \"archive\": \"docker compose -f docker-compose.test.yml down -v\"\n },\n \"runScriptMode\": \"nonconcurrent\"\n}\n```\n\n### Migrating from Conductor\n\nIf you already have a `conductor.json`, it works as-is — the schema is identical. You can optionally rename it to `pane.json`. If both files exist, `pane.json` wins.\n"},{"path":"docs/DEVICES.md","title":"Devices","text":"# Devices\n\nAny agent in a Pane can boot an iOS Simulator or an Android emulator, see it, drive it and\nbuild an app to it. The live screen opens in a device tab beside the agent, selected so it\ncomes to the front, and chat tabs show a card at the step that opened it. On Windows and Linux, iOS runs on a Mac you linked,\nwith no SSH setup.\n\n## The tools\n\nEvery agent gets six device tools through Pane's MCP server, and every terminal has the same\ncommands as `runpane devices`. Pane fills in the Pane, the device and the machine: after\n`device_open`, an agent never names them again.\n\n| Tool | Command | What it does |\n| --- | --- | --- |\n| `device_list` | `runpane devices list` | Devices this Pane can open: platform, name, OS, machine, state, and which Pane holds each |\n| `device_open` | `runpane devices open --platform ios` | Leases a device to this Pane, boots it and opens the device tab |\n| `device_screenshot` | `runpane devices screenshot` | The screen as an image (MCP) or a PNG path (CLI) |\n| `device_act` | `runpane devices act -- snapshot -i` | Runs an [agent-device](https://github.com/callstack/agent-device) command on the device |\n| `device_run` | `runpane devices run -- npx expo run:ios` | Runs a command where the device runs, such as a build, or Metro with `--background` |\n| `device_close` | `runpane devices close` | Ends the lease and stops the commands `device_run` started |\n\nA Pane can hold an iPhone and an Android emulator at once. `device_screenshot`, `device_act`,\n`device_run` and `device_close` act on the device it opened last; pass `--platform ios` or\n`--platform android` (the `platform` argument over MCP) to pick the other. `device_close`\nwithout a platform closes both.\n\nA typical session:\n\n```sh\nrunpane devices open --platform ios --json\nrunpane devices run --json -- npx expo run:ios\nrunpane devices act --json -- open com.example.app\nrunpane devices act --json -- snapshot -i # the screen's elements as @refs\nrunpane devices act --json -- press @e3 --settle\nrunpane devices screenshot --json\nrunpane devices close --json\n```\n\n`device_act` passes any agent-device command through (`help workflow` lists them), pinned to\nthe device this Pane holds. Flags that would pick another device, session or daemon\n(`--session`, `--device`, `--udid`, `--serial`, `--platform`) are refused, and so are the\ncommands that act on agent-device's shared daemon, sessions or connections (`daemon`,\n`session`, `connect`, `disconnect`, `proxy`, `batch`). Run batch steps as separate calls.\n\n## Setup\n\nNothing to install up front. On the first device call, Pane installs two pinned open-source\nhelpers with npm into its data folder (about a minute): Callstack's agent-device, which drives\ndevices for agents, and Expo's device hub, which boots devices and streams their screen. They\nrun on Pane's own Node, so your Node version doesn't matter, but npm must be on the PATH once.\n\n| Platform | Needs |\n| --- | --- |\n| iOS | A Mac with Xcode and an iOS runtime (Xcode > Settings > Components) |\n| Android | The Android SDK with its emulator, platform-tools and \"Android SDK Command-line Tools (latest)\" (Android Studio > SDK Manager > SDK Tools), and a system image |\n| Android on Linux | KVM (`/dev/kvm`) |\n\nPane never installs Xcode, the Android SDK, runtimes or system images; when one is missing,\nthe tool's error says what and where to get it. **Settings → Devices** shows what this\ncomputer has.\n\nAndroid emulators register with adb on port 5037. If something else holds that port, such as\na port forwarded from another machine, emulators boot but never come online. Free the port, or\nstart Pane with `ANDROID_ADB_SERVER_PORT` set to another port.\n\n## iOS from Windows and Linux\n\nA computer without Xcode runs iOS on a linked Mac. Link one once: on the Mac, open\n**Add a device → Computer** and choose **Copy link**; on this computer, open\n**Add a device → Computer** and paste it under **Or finish here** (or run\n`runpane link '<link>'`).\n\n`device_open` then uses the Mac pinned in **Settings → Devices → iOS devices run on**, or\nelse the first online Mac with Xcode, and its result says which Mac and why. A pinned Mac is\nalways used: when it is offline the call fails with `ERR_DEVICE_MAC_OFFLINE` and doesn't\nfall back. Every call goes over the routes saved computers already use (same network,\nTailscale or the Pane relay); the Mac accepts device calls only from your linked computers.\n\n`device_run` builds on the Mac without a clone or credentials there: it snapshots the\nworktree (uncommitted and untracked files included, ignored files left out), sends what\nchanged since the last run as a git bundle to a Pane checkout on the Mac, and runs the\ncommand in that checkout. Ignored build products such as `node_modules` and `Pods` stay\nthere between runs. Metro started with `--background` keeps running on the Mac until\n`device_close`, and serves the simulator on the Mac's own localhost. Archiving the Pane stops\nits jobs on the Mac and removes its checkout there.\n\n| Error | Means |\n| --- | --- |\n| `ERR_DEVICE_NO_MAC` | No Mac is linked. Link one, as above. Android works on this computer meanwhile |\n| `ERR_DEVICE_MAC_OFFLINE` | The Mac is asleep or Pane isn't running there. Wake it, or pick another Mac in Settings |\n| `ERR_DEVICE_MAC_OUTDATED` | The Mac's Pane predates devices. Update it |\n| `ERR_DEVICE_NEEDS_DESKTOP` | This computer runs headless Pane, which has no connections to saved computers. Use the desktop app here |\n| `ERR_DEVICE_MAC_NO_XCODE` | The Mac answers but has no Xcode with an iOS runtime. Install it there, or pick another Mac |\n| `ERR_DEVICE_MAC_TIMEOUT` | The Mac was still working when the call's time ran out (10 minutes for an open). Pass `--background` for long builds |\n\n## Sharing and resources\n\nBooted simulators are heavy, so Pane keeps few of them:\n\n- **A small pool per machine.** Pane makes its own devices (`Pane iPhone` on the newest iOS\n runtime you installed, `Pane_Android`) and reuses them; it makes another only when none\n fits. It uses one of your own devices only when an agent names it with `--device`.\n- **One booted device per platform** by default, shared between Panes by lease.\n **Settings → Devices → Simulators at once** raises it to four.\n- **Leases.** A Pane holds its device until `device_close`, archive, or 10 minutes with no\n device call and its tab on screen nowhere. When every device is held, `device_open` waits up\n to 60 seconds, then fails with `ERR_DEVICE_BUSY` naming the holder; **Take over** in the\n device tab moves the lease. When a device passes to another Pane, Pane uninstalls the apps\n the last Pane installed, without a reboot.\n- **Idle shutdown.** A lease that idles out shuts down a device Pane made or booted at once;\n a device you booted yourself keeps running. After `device_close` it stays warm for 10\n minutes. A running `device_run` command counts as use. The helpers stop when nothing is booted.\n- **Erase and delete.** Archiving the last Pane that used one of Pane's devices erases it;\n Pane's devices unused for 7 days are deleted. Pane never deletes your devices or runtimes.\n- **SimSlim.** With [simslim](https://github.com/MobAI-App/simslim) installed\n (`brew install mobai-app/tap/simslim`), Pane slims each of its iOS devices once, which cuts a\n booted simulator from about 4 GB to under 1 GB.\n\n`runpane devices usage --json` lists every simulator and emulator on the machine (including\nones made outside Pane, `paneMade: false`) with its OS, disk and, when booted, memory, plus the\ninstalled iOS runtimes and Android system images, the helpers' memory, and the build checkouts\nlinked computers sync here. `runpane devices free --idle --yes` shuts down unused Pane\ndevices; `--all` also deletes them and the checkouts no Pane holds a device for, and reports\nthe disk freed.\n\n## Phones and the browser app\n\nThe device tab shows on the phone apps and in the browser app as frames, about two a second,\nwith tap and Home. The live stream stays on the desktop. Chat tabs on the desktop and in the\nbrowser app show the device card; the native app shows an **Open** row.\n\n## Security\n\nThe device hub listens on loopback only and requires a token, which stays in Pane's main\nprocess: it never reaches a tab, a log, a tool result or an agent. The hub also records its\ntoken in a state file, which Pane keeps in its own data folder (`devices/hub-state`) and\ndeletes when the hub stops; the token guards the hub against other users of the computer.\nThe device tab's own channels refuse calls from agents. Device tools act only on\nthe calling tab's Pane, and refuse calls from outside a Pane tab. **Settings → Devices →\nAgent device tools** turns the tools off.\n"},{"path":"docs/EVEN_G2_GLASSES.md","title":"Use Pane from Even G2 glasses","text":"# Use Pane from Even G2 glasses\n\nThe Pane glasses app runs on [Even Realities G2](https://www.evenrealities.com) glasses, inside the\nEven Realities phone app. It shows every Pane Notify card from all your computers, lets you answer\nwith the R1 ring or your voice, and opens any Pane's live terminal so you can read it and dictate\ninto it.\n\nIt talks straight to each of your computers over Tailscale, or through each computer's own address when your phone paired with it by [QR code](QR_PAIRING.md).\n\n## What you need\n\n- G2 glasses (the R1 ring is optional; the temple touchpads do the same gestures).\n- The Even Realities app on your phone, and the Pane app ([iOS and Android](NATIVE_MOBILE.md)).\n- Each computer reachable from the Pane phone app in one of two ways:\n - paired with the phone by [QR code](QR_PAIRING.md); or\n - over Tailscale: Tailscale on the phone and the computer, signed in with the same login, and\n Pane's **Settings › Remote Access › Tailscale › Who can connect** set to **Only me** or **Everyone on\n tailnet** (on by default for the Pane that owns `~/.pane`).\n- Pane open on each computer.\n- For dictation and voice answers, a Deepgram key (live) or a fal key (recorded) on the computer\n you talk to: **Settings › Integrations › Voice transcription** on the computer, or **Settings › Voice** in the\n Pane phone app.\n\n## Install and pair\n\n1. In the Even Realities app, open **Even Hub** and install **Pane**.\n2. In the Pane phone app, open **Settings › Glasses** and tap **Pair glasses**. (To get there from a\n computer, scan the code in Pane's **Add a device › Wearables** with your phone.) The phone asks each\n of your computers (the ones on your Tailscale login and the ones it paired by QR code) for a\n one-time pairing secret and copies them as one code. The code works for 10 minutes and only once\n per computer. A computer the phone reaches both ways is paired once, over Tailscale, when its\n Tailscale name matches its name in Pane.\n3. Tap **Open Even app**, open Pane there, and tap **Paste**, then **Connect**.\n4. The glasses show **Pane · N computers**. Each computer now lists the glasses under\n **Settings › Remote Access › Phones and glasses**, named after your phone, with when they were last used.\n\nPair once; your other computers join on their own on launch and every 10 minutes. The glasses ask\none paired computer to get pairing secrets from your other Pane computers on Tailscale (yours, with\nWorkspaces on), then pair with them as with a pasted code. If that computer doesn't answer, or\ncouldn't reach a computer or has no password saved for it, the glasses ask the next paired\ncomputer. Each computer is asked at most once every 5 minutes. A computer that still can't join\ngets a dim row at the end of the home list with the reason; press it for what to do:\n\n| Row reads | Fix |\n|---|---|\n| update Pane there | Update Pane on that computer. It joins within 10 minutes. |\n| revoked here · pair from phone | The glasses were revoked there. Pair again from the Pane phone app: Settings › Glasses › Add computers. |\n| needs its password | Connect to that computer once from Pane on a paired computer, so it saves the password. |\n| Funnel is on | Turn Funnel off for port 8443 on that computer. |\n| not answering | Check that Pane is open there and Tailscale is on. |\n\nComputers reached only by QR code don't join on their own: tap **Add computers** in Settings ›\nGlasses after you pair the phone with a new one.\n\nA paired computer on an older Pane can't ask for the others; the glasses skip it until the next\n10-minute round, so once you update Pane there it asks within 10 minutes. You can still add\na computer by hand: tap **Add computers** in Settings › Glasses and paste the new code the same way.\nComputers that are offline are skipped and named on the screen.\n\n### The Even app's origin\n\nThe Even app serves the glasses app from `http://127.0.0.1`, on a port it picks each time it starts.\nPane accepts that origin on any port, so there is nothing to allow. A computer running an older\nPane refuses it and the glasses show **Allow this app on the computer**: update Pane on that\ncomputer. Allowing the origin on an older Pane lasts only until the Even app restarts on a new port.\n\n## Use it\n\n| Gesture | What it does |\n|---|---|\n| Swipe up / down | Move through a list or scroll a terminal half a page |\n| Press | Open or pick; in a terminal, open keys mode |\n| Double press | Back; on the home page, exit the app |\n| Hold, then release | Talk, then send at once: an answer on a card, input in a terminal, a new Session on home's first row |\n\nIn **keys mode** the gestures go to the terminal, one key at a time in the order you made them:\nswipe sends ↑ or ↓, press sends Enter and goes back to the output, double press leaves without sending anything, and hold opens a short list with\nEsc and Tab. You can't dictate in keys mode; leave it first.\n\n- **Home** is one list across every paired computer: questions first, newest first, then info\n cards, then every Session and Pane, newest activity first. Each row starts with its computer's OS logo (Apple,\n Windows or Linux; a plain monitor for a computer whose Pane is too old to say) and the first five\n letters of its name. The selected row starts with \">\" at full brightness. The header counts the\n questions waiting (\"All computers · 2 need you\") and confirms an answer you just sent. The list\n updates while it is open: a new Pane shows within about a second. Press a question to open its\n card (hold to answer it by voice), an info card to read its message, or a Session or Pane to open\n its terminal on its own computer. An info card you read and leave with double press drops off\n the list on these glasses; it stays on your phone and computers.\n- **A new Session**: home's first row reads \"+ New Session on studio-mac · hold to say it\". Hold\n it and say what the Session is for; the words appear as you speak. Release starts a Session on\n that computer with its default agent, your words as its purpose and its first words as its name,\n and opens it. Double press while listening cancels and starts nothing. The Session starts on the\n computer you last started one on from the glasses, else the computer of the last Pane you opened,\n else your first paired computer. If that computer is offline, or its Pane is too old to take a\n Session from the glasses, the glasses say so and start nothing.\n- **A computer that stops answering** keeps its rows, dimmed with its logo, reading \"offline since\n 9:14\". Pressing one says when it went away and offers Retry. A computer that has never answered\n gets one dim row of its own, and so does each computer that couldn't join (see Install and\n pair). When no computer answers and none has rows yet, home is one page\n that says so.\n- **A card** shows the asking Pane's last output lines (dimmed), the question, and the choices.\n A long question is cut at three lines; the **Read the whole question** row shows all of it.\n- **A terminal** shows the Pane's live screen, refreshed about once a second. Opening it marks the\n Pane viewed on that computer, as opening it there does. A stopped Pane starts its saved agent or command. The terminal hides an\n agent's input box and the status rows under it, so you read its output. Each swipe moves half a\n page: the half you just read stays on screen, dimmed. Swiping down to the end follows live again.\n Press opens keys mode, which shows the whole screen, input box included. The bottom line names\n the newest card from another Pane; double press goes home with its row selected.\n- **Menus**: when a terminal shows a menu Pane is certain of (a list numbered from 1 at the bottom\n of the screen with exactly one cursor mark, such as `❯`, `>` or `›`, under a prompt whose top is\n on screen), its choices appear as a list, under the last two lines above it: the question and\n what it asks about, such as the command to run. Swipe to a choice and press: Pane waits for any\n keys you pressed before, reads the screen again, and presses the choice's number, which Claude\n Code and Codex take as that answer wherever the cursor is. If anything in the prompt changed\n between the list showing and that read (the question, any row of the command, or any choice),\n it sends nothing, says \"The menu changed, so nothing was sent\", and opens keys mode. A menu that\n changes after the read, while the number is on its way, can still receive it. A menu still on\n screen a second after its number ignores numbers: keys mode opens so you answer it with arrows\n and Enter. Double press dismisses the list. Any other prompt,\n including one taller than the screen, is answered from keys mode.\n- **Going back** from a terminal or a card selects the row you opened. If it is gone, the row now\n in its place is selected.\n- **Dictation** types what you said into the Pane and presses Enter right away. A misheard line\n typed into a shell runs, so check the Pane before you talk into a plain shell. After you send,\n the view holds at your line while the reply grows below it, and the top line counts the lines\n still below (\"↓ 18 more\"). Swipe down to read on; the last swipe follows live again. If your line\n leaves the screen (the agent cleared it) or a menu appears, the view goes back to live.\n- **Keys need Pane on the computer to be up to date.** A computer on an older Pane refuses the\n first key, and the glasses say so: \"<computer>'s Pane can't take keys from the glasses yet.\"\n Update Pane there. Dictation still works.\n\n### Ambient mode\n\nAfter 30 s without a touch, the glasses go quiet over whatever screen is open. One dim line at the\ntop left names the computers with a card waiting, newest first (each computer's OS logo and the\nfirst five letters of its name, as in the list, at most three, then \"+N\"), and how many: \"studi build · 2 need you\", \"· 1 update\", or both.\nWith nothing waiting the display is dark. With no computer reachable it reads \"Can't reach your\ncomputers · Pane keeps trying\". While quiet, an open terminal stops reading its screen.\n\nA card that arrives while quiet shows as a banner for 15 s: its computer's OS logo, computer and Pane, up to two lines of\nit, and what you can do. Several cards that arrive close together share one banner on the newest\n(\"· 3 new\"), up for 15 s after the last. Untouched, the banner goes away and the quiet line counts\nthe card. A card answered elsewhere leaves the banner at once. While you use the glasses, new\ncards never pop up; they join the list as before.\n\nAny touch on the ring or a temple wakes the glasses to the screen you left, with a terminal read\nagain at once, and does nothing else: no row opens, no exit, no voice, and the release of a hold\nsends nothing. On a banner, the touch acts on its card:\n\n| Gesture on a banner | What it does |\n|---|---|\n| Press | Opens the card: a question its choices, an update its message |\n| Hold, then release | Answers a question by voice; on an update it only wakes |\n| Swipe or double press | Opens the list with the newest card selected |\n\nThe glasses never go quiet while you hold to talk or while a menu choice is being sent. Coming back to the app from the glasses menu opens it awake.\n\nAmbient mode is on by default. To turn it off, open Pane in the Even app on the phone and switch off\n**Ambient mode**; it applies at once and stays off after the app restarts. Off, the glasses behave as\nbefore: they stay on the screen you left and show no banners.\n\nWith the app closed, Pane's phone alerts still reach the glasses through the Even app's\nnotification mirroring, as the title only (\"planner has a question\").\n\n## Revoke\n\n- On the phone: **Settings › Glasses › Revoke Glasses** revokes them on every computer it can reach,\n and finishes the rest when they next answer.\n- On a computer: **Settings › Remote Access › Phones and glasses**, then **Revoke** next to the glasses for\n that computer only, or **Revoke on all my computers** for this computer and every computer of\n yours it can reach. It names the computers it could not reach, such as \"Not reached: laptop\n (offline)\", and offers **Retry on my other computers** while that page stays open.\n\nRevoking closes the glasses' connection to that computer within 5 seconds. A revoke sticks: your\nother computers can't add the glasses back to it, and the glasses list it as a dim row reading\n**revoked here · pair from phone**. Pairing the glasses again from the phone lifts the revoke on\neach computer it pairs.\n\nRevoke on every computer, from the phone or from **Revoke on all my computers**, when the glasses\nare lost. Two gaps remain:\n\n- A computer that was offline during the revoke still holds the glasses, and can add them to\n another of your computers until a revoke reaches it. That covers a computer you set up later,\n and one that answered the revoke without holding the glasses (for example, because Funnel was on\n there): a revoke marks only the computers that held them, and only those are listed under\n \"Revoked on\".\n- Pairing secrets that a computer already handed the glasses for your other computers stay usable\n there for up to 10 minutes after you revoke the glasses on it.\n\n## Security\n\nThe glasses app is a web page inside the Even app. Each computer lets it in only when all of these\nhold:\n\n- Over Tailscale, the request comes through Tailscale Serve on your tailnet with **your**\n Tailscale login. Other people on your tailnet are refused even with a valid glasses token.\n Funnel is never used: while Funnel is on for the computer's workspace port, glasses are refused\n there.\n- Through the computer's own address (QR pairing), only a phone paired with that computer can ask\n it for a pairing secret, so a glasses token there was issued through a phone you paired.\n- It carries this computer's **glasses token**: 256 random bits, one per pair of glasses, stored on\n the computer only as a hash. Tokens travel only in the `Authorization` header (and the voice\n WebSocket's subprotocol), never in a URL.\n- It comes from an **allowed origin**: the Even app's `http://127.0.0.1` on any port, or one the\n owner allowed in **Settings › Remote Access › Phones and glasses**, matched exactly except that a loopback\n origin matches on any port. Null, missing and wildcard origins are never accepted. A page served\n from `127.0.0.1` on your phone still needs a glasses token, which only the paired glasses hold.\n- Over Tailscale, the source is not **locked out**: 5 refused attempts in 10 minutes lock it out\n for a minute, doubling on each repeat up to an hour. Through the computer's own address every\n connection arrives from the computer's TLS listener, so refusals there are not counted, and no\n stranger can lock your glasses out. Each refusal is logged with the source and reason, never\n the token.\n\nA glasses token reaches only what the glasses use: listing Sessions and Panes, starting a Session\n(with only a one-line name and a purpose, at most one every 30 seconds; it runs the computer's\ndefault agent), reading and typing\ninto terminals, pressing one key at a time, dictation, and Notify. The keys are ↑, ↓, Enter, Esc,\nTab and the digits 1 to 9, one per request, and nothing else: text, two keys at once, Ctrl-C,\nCtrl-D, ← → and 0 are refused before they reach the terminal (`ERR_GLASSES_KEY_REFUSED`), logged\nwithout the input, and not counted toward the lockout. Dictation sends only the Pane and the\ntext: attachments and other submit options are dropped, and a request without text is refused\n(`ERR_GLASSES_SUBMIT_REFUSED`). These keys are enough to answer an agent's permission menu, so the\nglasses can approve what an agent asks to do. Opening a stopped Pane restarts its saved agent or command,\nin its own folder.\n\nThe token can also ask the computer to add these same glasses to your other computers. The\ncomputer finds them with its own Tailscale discovery (your login only, never other people's or\ntagged machines), skips any that already have the glasses, revoked them or have Funnel on, and\nasks each of the others, as you, for a pairing secret for the glasses' own name and phone id (the id of\nthe phone that paired them). Each computer makes its own secret and issues its own token, so no\ncomputer hands its tokens to another. Nothing in the request can pick the computers, the name or\nthe phone id, and the glasses may ask once\nevery 5 minutes. A password-protected computer is asked only when this computer has its password\nsaved; one whose Pane is too old to remember revokes is skipped.\n\nA glasses token cannot create a Pane, pair any device other than these same glasses on your other\ncomputers, reach anyone else's computer, change settings, write files, commit, run machine\ncommands, or choose what a terminal runs, and its event stream never carries terminal output.\n\nTyping into a terminal can run commands, so treat the glasses like your phone: whoever holds a\nworking token can type into your shells, from your tailnet or, for a computer paired by QR code,\nfrom anywhere. Through a computer's own address the glasses trust its public certificate; unlike\nthe Pane app, they don't check the computer's key. The Even app serves the glasses\napp's code, so a compromised Even build could read the token on your phone; revoke the glasses if\nyou lose the phone, and check **Last used** on each computer.\n\nThe pairing code on your clipboard holds one-time pairing secrets, not tokens, and expires after\n10 minutes.\n\n## Troubleshooting\n\n| On the glasses | Fix |\n|---|---|\n| Can't reach any computer | Turn Tailscale on in the phone's Tailscale app; for computers paired by QR code, check the phone's internet connection. The glasses reconnect on their own. |\n| Allow this app on the computer | Update Pane on that computer (see above). |\n| Not paired, or revoked | Pair again from Settings › Glasses in the Pane phone app. |\n| Locked out for N s | Wait. If you did not cause the refusals, revoke the glasses on that computer. |\n| Funnel is on | On the computer, run `tailscale funnel reset`, or turn Funnel off for port 8443. |\n| revoked here · pair from phone | That computer revoked the glasses. To use them there again, pair from Settings › Glasses in the Pane phone app. |\n| needs its password | The computer has a Workspaces password. Save it on one of your other computers by connecting to it once in **Settings › Remote Access**; that computer then adds the glasses. |\n| update Pane there | Update Pane on that computer. |\n| not answering | Start Pane on that computer and check that Tailscale is on there. The glasses try again within 10 minutes. |\n| Can't turn speech into text | Add a Deepgram or fal key on that computer. |\n| Deepgram rejected X's key, or X's Deepgram key isn't a valid key | On that computer, paste a current key from the Deepgram console in **Settings › Integrations › Voice transcription**. Pane checks it with Deepgram when you save. |\n| Lost the connection to X while listening | Hold to talk again. If it keeps happening, check Tailscale on the phone. |\n\n## For developers\n\nThe app lives in [`glasses/`](../glasses). Run the Even simulator against it and point a dev build of\nPane at it with `PANE_GLASSES_ORIGINS=http://localhost:5173` (an exact origin, comma separated for\nseveral; a loopback one covers every port). `glasses/dev/gallery.html` shows the screens the demo\ncan't reach, and `glasses/dev/ambient.html?at=35:q,60:answer` runs the demo with ambient mode on and\nraises or answers cards on a schedule (see the top of `glasses/dev/ambient.ts`). The host side is `main/src/daemon/glassesAccess.ts`; the shared pairing-code format is\n`shared/types/glasses.ts`.\n\nJoining other computers is `glasses/src/autoJoin.ts`; the host side is the `runpane:glasses:vouch`\ncommand. The home list is `glasses/src/homeList.ts`. The firmware list can't show images, so the app draws its\nown: six text rows beside two 28 × 120 px logo strips. A swipe rewrites the two rows that change; a\npage turn rewrites the rows and resends the strips. `LIST_MARKS = 'outline'` switches to the\nfallback: the firmware list with an outline shape per computer (○ □ △ ◇) and each away computer\nfolded into one row. Each swipe logs `[Pane glasses] swipe down → display ack 12 ms (2 text, 0 image)`\nto the WebView console, so swipe speed can be measured on real G2. `dev/gallery.html` shows the list\nwith every mark, an offline computer, computers that couldn't join, and the outline fallback.\n"},{"path":"docs/IMPORTING_FROM_ANOTHER_TOOL.md","title":"Importing from another tool","text":"# Importing from another tool\n\nPane can adopt a git worktree created by Conductor, another orchestrator, or by hand. An adopted Pane points at the existing directory while ownership stays with the tool that created it.\n\n## Adopt a worktree\n\nFirst save the base repository in Pane. Then adopt one of that repository's registered worktrees:\n\n```bash\nrunpane panes adopt \\\n --repo active \\\n --path /absolute/path/to/existing-worktree \\\n --name existing-work \\\n --agent codex \\\n --resume 00000000-0000-0000-0000-000000000000 \\\n --yes \\\n --json\n```\n\nUse `--dry-run` first to validate the path without creating a Pane. `--folder <name>` places the Pane in a top-level sidebar folder, and `--no-pinned` opts out of the default pin. The command resolves symlinks before storing the path and refuses directories that are not registered worktrees of the selected repository or are already registered in Pane.\n\nWhen `--resume` is present, Pane persists the agent session id and stages that agent's resume command in the terminal without pressing Enter. Review the command and press Enter when ready. Pass `--launch` to run it immediately. Do not drive the same transcript from two applications at the same time because both may append to the same transcript.\n\nThe JSON form supports the same fields:\n\n```json\n{\n \"repo\": \"active\",\n \"panes\": [\n {\n \"path\": \"/absolute/path/to/existing-worktree\",\n \"name\": \"existing-work\",\n \"folder\": \"in-review\",\n \"pinned\": true,\n \"tool\": { \"agent\": \"codex\" },\n \"resume\": \"00000000-0000-0000-0000-000000000000\",\n \"launch\": false\n }\n ]\n}\n```\n\nRun it with `runpane panes adopt --from-json panes.json --yes --json`.\n\n## Ownership and lifecycle\n\nPane stores `worktree_ownership: \"external\"` for adopted Panes. The sidebar labels them **External**, and `runpane panes list --json` returns `ownership: \"external\"` (ordinary Pane worktrees return `\"pane\"`). This marker is separate from main-repository mode and from the worktree name.\n\nPane never creates, file-syncs, builds, or recreates an external directory, and removes one only when asked. Archiving or permanently deleting an adopted Pane only removes Pane's record, unless you archive it with `runpane panes archive --pane <id> --remove-worktree`: that runs the same safety check as a Pane-managed worktree (uncommitted, untracked, and unpushed work block the archive without `--force`; untracked files under the root `.codex/`, `.claude/`, and `.agent-farm/` directories are ignored) and then removes the worktree. The local branch is kept. Deleting its saved project also leaves the directory and git worktree registration untouched. Restoring an adopted Pane whose directory has disappeared succeeds and displays `External worktree directory is missing`; Pane does not recreate it. Automatic checkpoint commits default to disabled for adopted Panes.\n\nOtherwise the tool that owns the worktree remains responsible for its archive and deletion lifecycle, and `runpane panes archive --dry-run --pane <id> --json` reports worktree cleanup as not applicable. Restoring an adopted Pane whose worktree was removed does not recreate it; `git worktree add <path> <branch>` does.\n\n## Imports from other tools\n\nTo bring sessions from Claude Code, Codex, Conductor, Paradev (formerly Superset), Herdr, Emdash, Orca or T3 Code in with their agents resumed, use Settings → AI & Agents → \"Bring sessions into Pane\" (see [Bring your existing sessions into Pane](SESSIONS.md#bring-your-existing-sessions-into-pane)). It adopts each idle checkout in place, as `panes adopt --resume` does. Pane already reads `conductor.json` for project scripts, but adoption deliberately does not run setup/build scripts.\n"},{"path":"docs/LOOPS.md","title":"Loops","text":"# Loops\n\nA loop runs an agent or command on a schedule. It runs in one of two places:\n\n- **A project.** Each run gets its own Pane (workspace) in a fresh worktree and\n branch, so the result of a nightly bug sweep or a weekly dependency check is\n ready to review like any other Pane.\n- **A Session.** Each run sends the loop's prompt to that Session's agent, with\n no new Pane, worktree or branch. Use it for a job that spans all your\n projects, such as a morning standup summary. See [Session loops](#session-loops).\n\nA project loop is a cron schedule plus the same request `runpane panes create`\ntakes:\n\n- the repository (`--repo`)\n- the agent (`--agent claude`, `codex` or `cursor`) or a custom command\n (`--tool-command`, such as `./scripts/nightly-report.sh` or `pnpm test`)\n- optional text typed into the agent or command after it starts (`--prompt\n <text>`, or `--prompt-file <path>` to read it from a file; `-` reads stdin)\n- a worktree and branch name template (`--worktree-name`, CLI and MCP only),\n `loop-<name>` by default. Each run adds its date and time, such as\n `loop-nightly-bug-sweep-20261024-0300`.\n\n## When to use a loop\n\nUse a loop for a large job that should run on a schedule: a nightly bug sweep,\na weekly docs audit, a Monday dependency check. Loops run at most once an hour.\n\nAn agent that needs to wait a few minutes, for CI or a review, sleeps and\nwakes with its own tools (such as a sleep command or its harness's wake-up\ntimer).\n\n## In the app\n\nOpen **Loops** in the sidebar, under Home and Pane Chat. The Loops page lists\nevery loop across your projects. Select one to see its schedule, next run, the\nstrip of its last 10 runs and a table of those runs. **+ New** and **Edit** open\na side drawer where you pick the project, what runs (Claude, Codex, Cursor or a\ncommand), and the schedule. Each run's branch is named after the loop, as\nabove.\n\nThe schedule works like Google Calendar's Repeat field. Pick **Hourly**,\n**Daily**, **Every weekday (Monday to Friday)**, **Weekly** (choose the days),\nor **Monthly** (choose the day of the month), then the time. The drawer shows\nthe schedule in words, such as \"Weekly on Mon, Wed, Fri at 9:00 AM\", the next\nthree run times and the cron it saves. **Custom cron** takes any five-field\ncron. Editing a loop opens its cron in the matching mode, or in Custom cron\nwhen no mode matches.\n\nA run's Pane shows a breadcrumb above its tabs (Loops › loop › run) that leads\nback to the loop, and a rail that switches between the loop's runs. Its\nDetails / Files / Changes sidebar starts closed; open it once and run Panes\nkeep it open.\n\n## From the CLI\n\nCreate a loop that starts Claude every day at 03:00:\n\n```bash\nrunpane loops create --repo active --name nightly-bug-sweep \\\n --cron \"0 3 * * *\" --agent claude \\\n --prompt \"Pick one bug from yesterday's issues, fix it, and open a PR.\" --yes\n```\n\nRun a custom command every Monday at 09:00:\n\n```bash\nrunpane loops create --repo my-app --name dependency-check \\\n --cron \"0 9 * * 1\" --tool-command \"./scripts/nightly-report.sh\" --yes\n```\n\nCheck a schedule before saving it. `--dry-run` prints the schedule in words and\nthe next run time, and saves nothing:\n\n```bash\nrunpane loops create --repo active --name docs-audit --cron \"0 16 * * 5\" \\\n --agent codex --prompt-file audit.md --dry-run\n```\n\nManage loops by id (`runpane loops list` shows it):\n\n```bash\nrunpane loops list\nrunpane loops update --loop <id> --cron \"0 4 * * *\" --yes\nrunpane loops run --loop <id> --yes\nrunpane loops pause --loop <id> --yes\nrunpane loops resume --loop <id> --yes\nrunpane loops delete --loop <id> --yes\n```\n\n`--repo` takes the same selectors as `panes create`: `active` (the repo\nselected in the app), a repo id, an exact path or a saved name. Commands that\nchange a loop need `--yes` when run from a script or agent; in a terminal they\nask first. `update` changes only the values you pass; `--agent` and\n`--tool-command` replace each other. Add `--json` to any command for\nmachine-readable output. The same commands are MCP tools: `loops_list`,\n`loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume` and\n`loops_delete`, in the default `core` toolset and the `loops` toolset (see\n[Pane MCP Server](PANE_MCP.md#toolsets)).\n\n## Session loops\n\nA Session loop targets a Session instead of a project. In the app, choose\n**Runs in: Session**, then pick **New Session for this loop** (named after the\nloop) or an existing Session. From the CLI, pass `--session` instead of `--repo`,\nwith a Session id, its name, or `new`:\n\n```bash\nrunpane loops create --session new --name morning-standup --cron \"0 9 * * 1-5\" \\\n --agent claude --prompt \"Summarize what changed across my projects since yesterday.\" --yes\n```\n\n- **Agent only.** A Session loop runs Claude, Codex or Cursor; it has no\n command, and it needs a prompt.\n- **Unattended for every message.** Saving the loop makes the Session's agent\n skip permission prompts, with the same launch flags as project runs (`claude\n --dangerously-skip-permissions`, `codex --yolo`, `cursor-agent --force\n --trust`). That holds for every message the Session gets, not only loop\n runs. A custom launch command gets the flags added after the agent's\n program; one Pane cannot change safely (a wrapper such as `sh -c`, an\n `env` or variable prefix, or `&&`, `;`, a pipe or a redirect) is refused\n when you save. Picking an agent other than the Session's switches the\n Session to it.\n- **The Session's folder is trusted.** When the Session's Claude runs on this\n machine, Pane answers its \"trust this folder\" prompt for the Session's own\n folder (see [Sessions](SESSIONS.md)). A WSL Session's Claude still asks on\n its first launch, and Codex can stop at its update menu when a new version\n is out; answer either once in the Session.\n- **Restart a running agent once.** An agent that is already running keeps\n the flags it started with. Until you exit it and start it again (it resumes\n the same conversation), runs are held and show as **needs attention**. Pane\n never restarts it for you.\n- **A run.** Pane starts the Session's agent if it is stopped, then sends the\n prompt to it. An agent busy with a turn gets the prompt queued after it. If\n the agent is stopped at a prompt of its own, or its launch exited back to\n the shell, the loop's prompt is not sent (Pane never types it into a shell)\n and the run shows as **needs attention**; open the Session and fix it.\n- **Kept runs.** The last 10 runs are listed. There is no run Pane to archive.\n\n## Rules\n\n- **Schedule.** One five-field cron expression, in the local time zone of the\n machine running Pane. `0 3 * * *` is \"Daily at 3:00 AM\"; `0 9 * * 1` is\n \"Weekly on Monday at 9:00 AM\". The app and `runpane loops` describe a\n schedule in these same words.\n- **At most once an hour.** Saving rejects a cron whose runs fall less than 60\n minutes apart.\n- **Pane must be running.** Runs start only while Pane is running on that\n machine.\n- **Missed runs.** A run up to 15 minutes late still starts, for example after\n the computer wakes from sleep. A later one is recorded as skipped. Missed runs\n are never caught up.\n- **Overlap.** A run starts even if the previous one is still going.\n- **Kept runs.** Pane keeps each loop's last 10 runs and archives older run\n Panes. A run Pane with unfinished work (a busy agent, unsent input, or\n uncommitted or unpushed changes) is not archived: its run stays in the loop's\n list with the note \"Kept because the run Pane has unfinished work\", so a loop can show more than 10 runs. Archive the Pane yourself\n when you're done; Pane tries again after each new run.\n- **Delete.** Deleting a loop stops its schedule. Its run Panes stay, as\n normal Panes.\n- **Pause.** A paused loop starts no scheduled runs. Resuming picks up at the\n next scheduled time.\n- **Permissions.** Runs are unattended, so Claude, Codex and Cursor runs skip\n their permission prompts. A `--tool-command` runs as written.\n- **Commands on Windows.** A `--tool-command` runs in Pane's terminal shell,\n which is Git Bash by default. Write it in bash, or call cmd with `//c`:\n `cmd //c echo hi > loop.txt` works. With `cmd /c`, Git Bash turns `/c` into a\n path, so cmd starts interactively and the run hangs.\n- **Folder trust.** Claude and Codex ask whether to trust a folder they have\n not seen, and each project run is a new worktree. A run stopped at that prompt shows\n as **needs attention**. Open the run and answer it, or open the project\n folder in the agent once and trust it so later runs start on their own. Pane\n answers a trust prompt only for a Session's own folder (see\n [Session loops](#session-loops)).\n- **Run now.** `runpane loops run` starts a run immediately, even while the\n loop is paused. The schedule stays the same, and the run counts toward the 10\n kept runs.\n\n## Runs\n\nEach project loop run is a new Pane in a fresh worktree branched from the\nrepository's default base branch. It appears as a normal Pane under its\nproject, and you review its work the way you review any Pane. A Session loop's\nruns happen in its Session; their `sessionId` is null.\n\n`runpane loops list --json` lists each loop's runs, newest first. A run's\n`status` is:\n\n- `started`: its Pane was created, or a Session loop's prompt was sent. For a\n project loop, `sessionId` is that Pane's id, so read its\n progress with `runpane agents status --pane <sessionId>`. When `error` is set\n too, something needed attention when the run started: the agent was stopped\n at a prompt such as folder trust, never became ready, or Pane could not\n confirm the prompt arrived. The app and plain `runpane loops list` show such\n a run as **needs attention**. On an older run, `error` can instead be the\n note that its Pane was kept for its unfinished work.\n- `failed`: the Pane could not be created, or the Session could not be\n reached; `error` says why.\n- `skipped`: the run came and went while Pane was not running or the computer\n was asleep.\n"},{"path":"docs/MACHINE_HEALTH.md","title":"Machine health","text":"# Machine health\n\nPane keeps the disk and memory of every machine it runs on healthy by itself,\nthe way a phone manages its storage. It watches free disk, memory pressure and\nevery process it started, removes its own leftovers, and asks before anything\nelse. Open **Resources** from the gauge icon in the sidebar's top bar, to the\nright of the machine switcher.\n\n## What Pane watches\n\nOnce a minute Pane samples:\n\n- **Free disk** on each volume that holds Pane's data folder, a project's\n worktrees, or the temp folder.\n- **Memory pressure**, from each OS's own signal (below).\n- **Every process Pane started**, with its memory and CPU, credited to its Pane\n and tab. A process that left its tab (its parent exited) is still credited\n through the `PANE_SESSION_ID`, `PANE_PANEL_ID` and `PANE_INSTANCE` variables\n Pane gives it, so another Pane instance on the same machine never claims it.\n\nNothing is stored: sizes and samples live in memory and start again when Pane\nrestarts. A storage scan runs in the background ten minutes after Pane starts,\nthen daily, when disk reaches the warning level (at most once an hour), and\nwhen you choose Measure now on the Resources page. Resources and the CLI show\nthe last scan right away and never wait for a new one.\n\n| | Warning | Critical |\n| --- | --- | --- |\n| Free disk | under 20 GB | under 5 GB |\n| Memory, macOS | kernel pressure level 2 (`kern.memorystatus_vm_pressure_level`) | level 4 |\n| Memory, Linux | PSI `some avg60` of 10% (`/proc/pressure/memory`) | 30% |\n| Memory, Linux without PSI, and Windows | under 10% of memory available | under 5% |\n\nA memory level counts after two samples in a row, so a moment's spike raises\nnothing. Change the disk figures in Settings › Machine health.\n\n## What Pane may delete\n\nEvery item belongs to one tier, and the tier decides whether Pane acts alone,\nasks, or only shows it.\n\n| Tier | Items | Rule |\n| --- | --- | --- |\n| 1 · automatic | Rollback copies and staged app copies of an update that a newer completed update replaced (the newest completed one always stays); Pane's own database migration backups once 30 days old and the database has opened cleanly since; archive cleanup jobs that failed (retried once a day) | Pane made it and nothing can use it now. Runs after each storage scan. Each run is listed under Recent cleanups. |\n| 2 · ask | Finished Panes (PR merged or closed, folder missing, or idle 14 days); folders at an archived Pane's path that git confirms were its worktree; agent temp folders of Panes that are gone, and agent temp items nobody touched for 2 days; scratch of paused Panes; pausing idle Panes under memory pressure; processes that left a Pane's tab; stopping or restarting a leaking process | A card or Resources lists each item with its size and reason. Archiving finished Panes, clearing agent temp, clearing paused scratch, removing archived Panes' folders and pausing idle Panes each have a switch in Settings › Machine health to do it automatically; every switch ships off. Pane never stops a process unless you choose to. |\n| 3 · show only | Worktrees Pane did not create; files in Pane's data folder Pane did not write (such as database copies made by repair agents); other tools' data (`~/.claude`, `~/.codex`, npm cache, pnpm store, Xcode simulators); WSL disk images | Shown with size, owner and the command that frees it. Pane never deletes them, and `runpane machine cleanup` refuses them. |\n\nBefore it touches anything, Pane checks again, right then:\n\n- It skips a Pane that is pinned, is the one you are looking at, has an agent\n working or waiting on you, has an open approval, or has uncommitted changes\n (agent setup folders such as `.claude/` don't count). A WSL Pane is checked\n inside its distro.\n- It skips any folder a running process is working in.\n- It skips an item it cannot check, such as when git or the process list fails,\n and says why.\n- It checks again that the item still belongs to whom the scan said: an agent\n temp folder a newer Pane now uses, or a folder created at an archived Pane's\n path after it was archived, is skipped.\n- It stops a process only if its pid and start time still match what Pane\n saw, so a reused pid is never hit.\n\nDeleting first moves the item into a `.pane-trash` folder beside it, after\nkeeping any agent transcripts in it as archive does. The delete then finishes\nin the background. If Pane stops mid-delete, the item is either still in place\nor in the trash, never half-removed, and the next start empties every\n`.pane-trash`. Freed space is measured from free disk before and after, so it\nis what the disk really got back.\n\nArchiving a finished Pane goes through the normal archive: its branch stays\nand Restore brings it back. A deleted file is gone once the delete finishes.\n\n## Cards\n\nPane raises five cards in Approvals, and inside the Pane window as a dialog.\nEach lists every item its action covers; Review in Resources lets you choose\nitem by item.\n\n- **Disk almost full**, with what Pane can free and Clean up.\n- **Memory is tight**, with what uses the most memory and Pause idle Panes\n (Panes idle 2 hours, with the same skips as auto-pause).\n- **A process keeps using more memory**, when one Pane process grew at least\n 500 MB and 50% across the last 30 minutes and set a new high in every\n 5-minute slice, named with its Pane and tab. Restart it (for a run script),\n Stop it, or Ignore for this process. On macOS Pane measures the memory footprint, as Activity Monitor\n does, because macOS compresses and swaps memory out of a process's resident\n size.\n- **Archive finished Panes**, each with why it is finished, or why it is\n skipped.\n- **Processes left behind**, when processes that left their tab belong to an\n archived or paused Pane: each with its name, command, Pane and memory. Stop\n them, or Keep them and Pane does not ask about those processes again.\n\n A program started with `&` in a Pane terminal stops when its Pane is paused\n or archived, as when you close a terminal. Programs that detach from the\n terminal (tmux, a database, an editor) keep running and reach this card. On\n macOS, Pane cannot read the variables of system programs such as `/bin/sleep`,\n so it does not credit those to a Pane.\n\nA card shows once and again only after 6 hours or when it gets worse; Not now\nholds it for 24 hours. When disk or memory turns critical, a desktop\nnotification also fires, following your notification settings. Ask an agent\nopens Pane Chat with the card's items.\n\n## Other machines\n\nThe Resources header switches between this computer and every machine you\nlinked. Each machine samples itself; Resources reads it over the link, and a\ncleanup you start runs on that machine, through its own checks, and its\nbuttons say \"Runs on\" that machine. A machine on an older Pane shows \"Update\nPane on this machine to see its health\", and an offline machine keeps its last\nnumbers with their age, with its buttons off. Each machine's cards also show\non every linked machine, titled with their machine's name.\n\n## For agents\n\n```sh\nrunpane machine health --json # levels, volumes, Pane processes and the tiered inventory\nrunpane machine cleanup --kind agent-temp # dry run: what would go, with sizes\nrunpane machine cleanup --kind update-snapshot --yes\n```\n\nClean up only through `runpane machine cleanup`: it applies the same tiers and\nchecks as the app, and it refuses tier 3. `--yes` on a tier 1 kind needs no\none's OK. For a tier 2 kind, show the person the dry-run list and total first,\nand run `--yes` only after they agree. The MCP tools are `machine_health`\nand `machine_cleanup` (toolset `machine`). Put QA roots, test instances and\ndownloads in the Pane's scratch folder (`$PANE_SCRATCH_DIR`) so they go when\nthe Pane is archived.\n\n## Per operating system\n\n| | macOS | Windows | Linux | WSL projects |\n| --- | --- | --- | --- | --- |\n| Memory signal | kernel pressure level | available memory | PSI, else MemAvailable | the Windows host's |\n| Process memory | footprint for leaks, resident size elsewhere | working set | resident size | resident size, read inside the distro |\n| Deleting `node_modules` frees | only blocks that changed: Pane clones node_modules with APFS, so the listed size is an upper bound | its full size | its full size (less on btrfs or XFS reflinks) | space inside the WSL disk image |\n\nThe WSL disk image (`ext4.vhdx`) grows and does not shrink by itself. Resources\nlists it in tier 3 with its size. To shrink it, run `wsl --shutdown`, then\ncompact the disk as Microsoft documents (`Optimize-VHD`, or `diskpart` with\n`compact vdisk`). Pane never runs these steps.\n\n## Testing\n\n`PANE_AGENT_TEMP_DIRS` (a path list) replaces the agent temp folders Pane\nreads, and `PANE_MEMORY_PRESSURE_TEST_LEVEL` (`ok`, `warning` or `critical`)\nsets the memory level one Pane instance reads, without signalling every app on\nthe machine. Use them only with an isolated `PANE_DIR`.\n"},{"path":"docs/NATIVE_MOBILE.md","title":"Native Pane mobile companion","text":"# Native Pane mobile companion\n\n`mobile/` is a Capacitor companion that bundles `frontend/remote.html`; it never navigates a WebView to a remote host. Remote hosts are ordinary authenticated HTTP/SSE endpoints, so an arbitrary host never receives a privileged native bridge.\n\nEven G2 glasses pair from the native app's **Settings › Glasses**; see [Use Pane from Even G2 glasses](EVEN_G2_GLASSES.md).\n\n## Development\n\nUse patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x), and pnpm:\n\n```bash\npnpm mobile:sync\npnpm mobile:build:ios\npnpm mobile:build:android\n```\n\nThe first command builds the Remote Pane entrypoint and copies it to `mobile/www/` before syncing checked-in iOS and Android projects. iOS Simulator builds need Xcode. Android builds need `ANDROID_HOME` plus a JDK (Android Studio's bundled JBR is suitable).\n\nFor a first local Android build on macOS:\n\n```bash\nexport JAVA_HOME=\"/Applications/Android Studio.app/Contents/jbr/Contents/Home\"\nexport ANDROID_HOME=\"$HOME/Library/Android/sdk\"\n# Install the complete API 36 platform (including android.jar), build tools,\n# and accept its licenses in Android Studio's SDK Manager before this command.\n# Equivalent command-line setup when cmdline-tools is installed:\n# \"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager\" \"platforms;android-36\" \"build-tools;36.0.0\"\npnpm mobile:build:android\n```\n\n`mobile:build:ios` is a non-signing Simulator build. To run it, select a booted simulator in Xcode or use `xcrun simctl boot <device-udid>` first. It is not a substitute for a signed-device push test.\n\nProfiles and bearer tokens are in Keychain on iOS and EncryptedSharedPreferences on Android. Native profile removal makes a best-effort authenticated per-installation revoke before deleting the local bearer token; if the host is unreachable, rotate that host's pairing credential to revoke it server-side. Browser PWA storage remains browser `localStorage`.\n\nVoice dictation uses the transcription provider configured on the host. In the Expo app (`native/`), tapping the mic on a host without voice keys opens a sheet that asks for the one key the mode needs (live: Deepgram; recorded: fal), with OpenRouter as an optional key that cleans up the transcript. It saves them to the host through `remote:settings:update`, then starts recording. Saved keys show only as \"Set\", and Settings › Voice replaces them; see `native/README.md` (The composer). iOS declares its microphone purpose in `Info.plist`; Android declares `RECORD_AUDIO` and `MODIFY_AUDIO_SETTINGS`, which Capacitor requests when recording starts. Test both allowing and denying microphone access on a device before distributing a mobile build. The launcher icons reuse the existing opaque 1024px Pane artwork in `main/assets/icon.png`.\n\n## Push delivery operator setup\n\nPush is host-originated: killed-app delivery is an APNs alert (iOS) or FCM notification payload (Android), not a local notification or background JavaScript claim. The host sends the Pane or Session name and routing metadata; see the payload details below.\n\nFor iOS, register `com.dcouple.pane.mobile` (or your signed bundle identifier), enable Push Notifications, and add the capability in Xcode. Then give one host the APNs key in Settings → Integrations → iPhone notifications: choose the `.p8` file and enter the team ID. Pane shares it with your other hosts through your paired devices ([Shared integration keys](SHARED_CREDENTIALS.md)). A host can instead read it from its service environment, which wins over the shared key and is never shared:\n\n```bash\nPANE_APNS_TEAM_ID=... PANE_APNS_KEY_ID=... PANE_APNS_KEY_PATH=/secure/path/AuthKey.p8 PANE_APNS_TOPIC=com.dcouple.pane.mobile PANE_APNS_ENVIRONMENT=sandbox\n```\n\nThe phone's build decides which APNs endpoint accepts its token: an Expo dev client uses the sandbox, TestFlight and App Store builds use production. The host sends to the key's environment first (`PANE_APNS_ENVIRONMENT`, or the environment chosen in Integrations). When Apple answers `BadDeviceToken`, it tries the other endpoint once and remembers on that registration the one that accepted. It revokes the registration only when both refuse. Never place the `.p8` key in this repository, the app bundle, or a mobile build setting.\n\nPush needs Dcouple's APNs key, because only that key can send to the published app. A computer without it reports \"No Apple push key\" to the phone until the key reaches it.\n\n### Dcouple's credentials\n\nThese are the provider credentials Dcouple uses for `com.dcouple.pane.mobile`. Only paths and IDs are listed here; the files stay outside git.\n\n- **APNs:** team `FBM5YSF467`, key ID `DGM25BV23X` (team scoped, sandbox and production). The key file is `AuthKey_DGM25BV23X.p8`, kept at `~/.config/pane/apns/` (mode 600) on the machine that created it. Load it once in Settings → Integrations on one host, or copy it to a host outside the repo and set:\n\n ```bash\n PANE_APNS_TEAM_ID=FBM5YSF467\n PANE_APNS_KEY_ID=DGM25BV23X\n PANE_APNS_KEY_PATH=/secure/path/AuthKey_DGM25BV23X.p8\n PANE_APNS_TOPIC=com.dcouple.pane.mobile\n PANE_APNS_ENVIRONMENT=production # TestFlight and App Store builds; use sandbox for Expo dev-client builds\n ```\n\n A host launched as a service reads these from its service environment (systemd unit, launchd plist, or the shell that runs `pnpm daemon:headless`). `mobile:push-status` reports `APNs delivery is configured.` once they're valid.\nFor Android, create a Firebase Android app with the same application ID and download its real `google-services.json` (to `native/google-services.json` for the Expo app, or `mobile/android/app/google-services.json` for Capacitor; the checked-in `.example` is only a shape guide). The host then needs a way to call FCM as a sender service account. It supports two ways to do that:\n\n**Keyless (recommended).** The host impersonates a sender service account with the operator's own gcloud login, so no key file exists anywhere. This is the only option where the organization policy `iam.disableServiceAccountKeyCreation` is on. For the Pane project (`pane-pwa-preview`) the sender account already exists and has the Firebase Cloud Messaging API Admin role. Each operator needs two things:\n\n```bash\nSENDER=pane-push-sender@pane-pwa-preview.iam.gserviceaccount.com\n# Once, by a project owner: let this operator mint tokens for the sender, and nothing else.\ngcloud iam service-accounts add-iam-policy-binding \"$SENDER\" --project pane-pwa-preview \\\n --member=user:you@example.com --role=roles/iam.serviceAccountTokenCreator\n# On the host machine, as that operator: writes ~/.config/gcloud/application_default_credentials.json\ngcloud auth application-default login\n```\n\nThen set these in the host service environment:\n\n```bash\nPANE_FCM_IMPERSONATE_SERVICE_ACCOUNT=pane-push-sender@pane-pwa-preview.iam.gserviceaccount.com PANE_FCM_PROJECT_ID=pane-pwa-preview\n```\n\nFor each send, the host exchanges the refresh token from that login for a user access token, then calls the IAM Credentials API `generateAccessToken` for the sender with the `firebase.messaging` scope. It sends the message with that one-hour token. The login file is read from `GOOGLE_APPLICATION_CREDENTIALS` if that is set, otherwise from gcloud's default location. It must be an `authorized_user` login. Revoking the Token Creator binding, or running `gcloud auth application-default revoke`, stops delivery. Pane reports FCM as not configured when the login file is missing or unreadable.\n\nFor your own Firebase project, create a sender service account with `roles/firebasecloudmessaging.admin` on that project. Then grant Token Creator on that service account only, never at the project level.\n\n**Service-account key.** Where key creation is allowed, `PANE_FCM_SERVICE_ACCOUNT_PATH=/secure/path/service-account.json` still works and takes precedence over impersonation.\n\n**Through the relay.** A computer with neither APNs nor FCM keys sends its alerts through the relay it is connected to for [QR pairing](QR_PAIRING.md), which holds the Pane app's keys; the computer builds the same payload and the relay only signs and posts it, at most 60 alerts an hour per computer. The relay sends a phone's alerts only from a computer the phone confirmed: when the phone registers, the relay pushes it a silent grant for that computer, and the Pane app hands the grant back to that computer (`mobile:push-grant`), which sends it with each alert. A grant lasts 30 days, and the computer quietly gets a fresh one while the phone stays paired ([relay protocol](../relay/PROTOCOL.md#alerts)). Keys set on the computer always win.\n\nDo not commit any provider credential. CI gets the Firebase app config from the `PANE_ANDROID_GOOGLE_SERVICES_JSON` secret (see `native/README.md`); that file identifies the app and is not a sending credential.\n\nThe app registers with every computer it has saved, whether it paired by QR code, connected with a code or from Your Computers over Tailscale, and asks notification permission once, when the first computer reports that it can deliver. Notification setup runs independently of the terminal connection, so permission or provider errors leave remote terminal use available. Registration renewals preserve the installation's alert preferences and deduplication history. OS token registration and each provider network request time out after 15 seconds.\n\nPush-state writes merge with the latest host configuration inside the serialized config-write queue, so they cannot restore a concurrently revoked pairing. Hosts without registered mobile clients do not persist push state on every agent transition.\n\nAgent panels send alerts. A plain shell sends one only when a program in it reports its own blocked state ([Program status](PROGRAM_STATUS.md)), at most once a minute per tab. The name is the Session's for a Session's orchestrator, \"<Session> › <Pane>\" for a Pane associated with a Session, and the Pane's otherwise. A newly blocked agent sends \"<name> is blocked\" at once. A finished turn sends \"<name> needs your attention\" only for a turn a person started and only once: input ending in Enter through `terminal:input` (desktop, phone, remote web) or `runpane panels submit|input --source user` arms the panel, and the next finished turn disarms it. Turns an agent starts by itself (watchers, timers, `runpane` input without `--source user`) finish silently. A turn counts as finished when the agent showed its own working signal (title spinner or working chrome) and then stayed idle for 10 s; terminal output alone, such as typing or a redraw, never counts. Each Pane has one APNs collapse id and one FCM `tag`, so a newer alert replaces the older one. iOS stacks alerts by `thread-id`, the Session's workspace pane id (`sessionPaneId` in the payload) or the Pane's own id. Opening a Pane in the app removes its delivered alerts, and opening a Session also removes its workers'; Notify question alerts stay until the question is answered. Every send logs `[Pane mobile push]` with the platform, the kind and, on failure, the provider's status and reason. Tap metadata contains the client-local profile ID (including its host label, URL, and token suffix) and pane/panel IDs; no terminal output or full bearer token is sent. A tap is held in encrypted native storage until saved profiles load, then reconnects only to the matching saved profile, including when switching panels inside the selected pane. An unknown/deleted profile or pane produces an error without connecting to an unrecognized host. Push commands derive client identity from the authenticated request, ignoring caller-supplied identity arguments: a paired client's id, or `tailnet:<login>` when the phone reaches the computer over Tailscale Serve as the computer's owner. Another Tailscale user the computer lets in is refused with `ERR_MOBILE_PUSH_OWNER_REQUIRED`. A host with no live registration logs `[Pane mobile push] No phone is registered for alerts on this computer` when a Notify question opens.\n\n**Notify questions.** A Notify question still waiting about 90 seconds after it arrives sends one alert to each phone with Needs Input on; answering it, closing it or turning Approvals off first cancels the alert ([Alerts](PANE_NOTIFY.md#alerts)). The alert is titled with the Pane's name (the folder's, outside Pane) and saying only \"<name> has a question\". APNs alerts carry `notifyId`, `notifyUi` and a category: `pane.notify.approve`, `pane.notify.ask`, or `pane.notify.options` with `notifyChoices` and `mutable-content: 1` for 1 to 3 choices. A registration from Pane app 1.1+ (`notifyButtons: true`) gets Android data-only messages instead, and the app draws the alert with its buttons. When the question is answered elsewhere, the host sends a silent clear (`notifyClear`); older Android builds get the system alert and no clear. The phone answers from the alert's buttons through `notify:remote-command`, with the token from its secure storage, also from the lock screen and while the app isn't running. The app side, its iPhone notification service extension and how to test them are in `native/README.md` (Notify questions). Phones get this only from a new app build: the change is native, so it does not reach installed builds over the air.\n\nThe Expo app in `native/` also shows Autopilot when it is on for the computer: a bar on home's Needs you tile, its chat with decision cards, and full-screen approvals and documents, over the same host connection ([Autopilot on the phone](AUTOPILOT.md#on-the-phone-d-75-to-d-77), `native/README.md` (Autopilot)). The Capacitor shell does not.\n\nThe Expo app in `native/` uses the same host commands and payload. It registers the raw APNs/FCM device token, not an Expo push token, and routes taps and `pane-remote://` / `pane://pane/…` links as described in `native/README.md` (Notifications and links).\n\nProvider credentials, Apple signing, Firebase setup, and physical-device delivery cannot be validated by this repository alone. In Apple Developer, create an App ID matching the final bundle ID, enable Push Notifications, create an APNs auth key, and configure an App Store Connect record/signing team before TestFlight upload. In Google Play/Firebase, create the Android app and give the host a sender identity as described above. iOS Simulator builds do not prove APNs delivery; A Google Play system image in the Android emulator does receive real FCM messages, so the Android path can be checked end to end without a device. Missing host delivery configuration produces an actionable registration error while ordinary remote terminal use continues.\n"},{"path":"docs/PANE_MCP.md","title":"Pane MCP Server","text":"# Pane MCP Server\n\n`runpane mcp` is an MCP server that gives coding agents Pane's `runpane` commands as tools. With it, an agent in any repository can list saved repositories, create Panes, open panels, read terminal screens, and send input. Pane installs a `pane` skill in the user's home skill folders so agents can find the CLI and how to connect.\n\n## Automatic registration\n\nThe Pane desktop app registers the server for you. On launch, Pane adds a `pane` MCP server to your user-level config:\n\n- **Claude Code**: via `claude mcp add pane --scope user …`, which writes `~/.claude.json` (or `$CLAUDE_CONFIG_DIR/.claude.json`).\n- **Codex**: a `[mcp_servers.pane]` table in `~/.codex/config.toml` (or `$CODEX_HOME/config.toml`).\n- **Cursor**: a `mcpServers.pane` entry in `~/.cursor/mcp.json`. Pane detects Cursor from `~/.cursor`, `cursor`, `agent`, or `cursor-agent` on PATH.\n\nPackaged Pane also installs the on-demand `pane-manage-and-message-agents` user skill for detected Claude Code, Codex, and Cursor clients. Cursor uses `~/.cursor/skills/`; Claude Code and Codex use their user skill folders (including `$CLAUDE_CONFIG_DIR` and `$CODEX_HOME`). Pane leaves hand-added skills alone and removes only its own copy when registration is off. The same applies inside detected WSL distros. [Cursor documents `~/.cursor/skills/` as a user-level Agent Skills directory](https://cursor.com/docs/skills).\n\nPane registers only when it detects the corresponding client, and it manages only the entry it wrote:\n\n- It leaves other MCP servers and settings alone and never writes a second `pane` entry.\n- It rewrites its own entry when the app moves or updates.\n- A `pane` entry you added yourself (for example with `npx runpane mcp`) is left untouched, including when you turn the setting off. For Claude Code, Pane's entry is the one that runs `<Pane data dir>/mcp/runpane/dist/cli.js`. For Codex, it's the `[mcp_servers.pane]` table carrying the `# Managed by Pane` comment. For Cursor, it is the entry whose first argument is Pane's bundled runpane copy.\n- Pane edits `config.toml` as text, so your comments and formatting survive. It then parses the result and writes nothing unless the only change is Pane's own entry. Cursor JSON is parsed before editing; invalid JSON is left untouched. Writes are atomic and follow a symlinked config.\n\nOn Windows, Pane also registers inside each WSL distro that has a saved WSL repository. Agents there run the Windows Pane binary through WSL interop.\n\nThe registered command is the Pane executable in Node mode (`ELECTRON_RUN_AS_NODE=1`) running a copy of the runpane CLI at `<Pane data dir>/mcp/runpane/dist/cli.js`. No Node.js or npm install is needed. Only packaged builds register; a development build never touches your agent config.\n\nTo turn this off, open **Settings → AI & Agents** and switch off **Register Pane tools with Claude Code, Codex, and Cursor**. Pane then removes its entry from each config.\n\nRestart a running `claude` or `codex` session to pick up a new registration. In Cursor, start a new chat or use **Developer: Reload Window**. Check with `claude mcp list`, `codex mcp list`, or `agent mcp list`. Cursor CLI may require `agent mcp enable pane` to add the server to its local approved list; Pane leaves that trust decision to you.\n\n## Claude tabs Pane starts: one HTTP server\n\nClaude Code and Claude chat tabs that Pane starts reach the same tools over HTTP, served by the running Pane app, instead of each starting its own `runpane mcp` process:\n\n- Pane listens on `127.0.0.1` at a random port, path `/mcp` (streamable HTTP, stateless), on the same loopback listener as Claude's prompt hooks. It answers only loopback `Host` headers and loopback or absent `Origin` headers.\n- A tab whose agent uses this endpoint gets a random token, held in Pane's memory and in that tab's environment as `PANE_MCP_TOKEN`, with the URL in `PANE_MCP_URL`. Other tabs get neither. The token alone tells Pane which tab is calling; a tool call runs `runpane` with that tab's environment and folder, and Pane's own data folder (`PANE_DIR`), exactly as the tab's own stdio server would. A request without a live token gets `401`. Closing the tab, or its shell exiting, revokes the token, and a tab restart gets a new one. Tokens are never logged, written to disk, or put on a command line.\n- A Claude terminal launch gets `--mcp-config=<Pane data dir>/mcp/pane-http.json` (the agent config's `terminal.paneMcpConfigFlag`). That file names the `pane` server with `${PANE_MCP_URL}` and `Bearer ${PANE_MCP_TOKEN}`, which Claude reads from the tab's environment. Claude puts it in place of the user-level `pane` entry, so the agent sees one `pane` server. A command with `--strict-mcp-config` runs unchanged.\n- A Claude chat tab passes the same server, with the same two variables, in its ACP `session/new` request (`chat.paneMcpHttp`); the token is in the adapter's environment only.\n- Everything else keeps the user-level stdio server: Codex and Cursor tabs, WSL and SSH tabs, wrapped or preserved launch commands, and agents you start outside Pane. Codex merges a per-launch `-c mcp_servers.pane` into the user-level stdio table and then refuses to start, and its ACP adapter skips a session server whose name the config already defines. Cursor has no per-launch MCP option. Either would need a per-launch way to replace a same-named server.\n- Pane quits its tabs with itself, so after a restart each tab starts with a fresh token and URL.\n- Settings apply at once. With **Register Pane tools** off, new tabs get no token, and a running tab's calls get `403` until it restarts on stdio. A toolsets change applies to the next request.\n- Serving is stateless. A call ends, and its `runpane` process stops, when the agent drops the request; a separate `notifications/cancelled` message has no request to cancel. An agent that names itself only at `initialize` is named after the tab's agent, so `notify` keeps its long wait.\n\n## Claude plugin\n\nPane's Claude plugin (the [`claude-plugin/`](../claude-plugin/README.md) folder) gives Claude Code and Cowork the `pane` and `pane-manage-and-message-agents` skills and this server, started as `npx -y runpane@<pinned version> mcp --toolsets plugin`. The pinned runpane hands each call to the installed Pane's own CLI when that one is newer, so the tools follow the installed Pane.\n\nWhile the plugin is on in Claude Code's user settings (`enabledPlugins` has `pane@<marketplace>` set to `true`), Pane steps aside so Claude sees one Pane server and one copy of each skill:\n\n- On launch, Pane removes its own `pane` entry from Claude Code's user config and its own Claude copies of the two skills. If Pane is already running when you turn the plugin on, restart Pane so it removes them. After you turn the plugin off, restart Pane to bring them back. Codex and Cursor registration is unchanged.\n- Claude terminal tabs that Pane points at its HTTP server also deny the plugin's server (`deniedMcpServers`, `plugin:pane:pane`). Claude keeps only the last `--settings`, so the deny goes into the one settings file Pane already gives each Claude tab for its prompt hooks, merged with any settings the command passes (such as a Session's folder access). Chat tabs get the same deny in their session settings.\n\n## Toolsets\n\nA server that offers dozens of tools makes models, especially smaller ones, worse at choosing the right one. So by default the server serves a lean `core` toolset, and everything else is opt-in:\n\n| Toolset | Tools |\n|---|---|\n| `core` (default) | `agents_start`, `agents_status`, `agents_send`, `panels_create` (a new agent tab in an existing Pane), `panels_input` (exact keys, for menus and prompts), `panels_open` (show a page or file beside the agent), `repos_list`, `repos_add`, `repos_rename`, `panes_list`, `workspace_state`, `panes_git_status`, `panes_adopt`, `panes_rename`, `panes_archive`, `panes_restore`, `sessions_create`, `sessions_associate`, `sessions_pin`, `links_create`, `docs_search`, `docs_read`, `doctor`, `notify` (ask the person and wait for the answer), `secrets_request` (ask the person for a secret, saved as a [Pane secret](PANE_SECRETS.md); the value never comes back), `theme_read` and `theme_set` (restyle Pane itself with a [Custom theme](APPEARANCE.md#custom-theme), only when the person asks), the six device tools (`device_list`, `device_open`, `device_screenshot`, `device_act`, `device_run`, `device_close`; see [Devices](DEVICES.md)), the four `workspace` tools, and the seven loop tools (`loops_list`, `loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume`, `loops_delete`) |\n| `agents` | the three agent tasks, `workspace_state`, `watch` |\n| `panes` | create, adopt, list, archive, restore, pin, unpin, rename, focus, pause, resume, cost, run and stop the run script, move to a folder, `folders_list`, `folders_create` |\n| `panels` | create, open, list, output, screen, input, submit, submit-composer, wait, pause, resume, last-message, close |\n| `workspace` | `workspace_list`, `workspace_read`, `workspace_write`, `workspace_exec`: find your other machines, move files to and from them, and run commands there (see [Workspaces](RUNPANE_WORKSPACES.md)) |\n| `git` | status, commit, push, pull, fetch, rebase onto main, squash-rebase onto main, stash, stash-pop, soft reset (`panes_*`) |\n| `sessions` | the `sessions_*` tools (including `sessions_pause` and `sessions_resume`) and the three named-lock tools (`lock_acquire`, `lock_release`, `lock_list`) |\n| `loops` | `loops_list`, `loops_create`, `loops_update`, `loops_run`, `loops_pause`, `loops_resume`, `loops_delete` (see [Loops](LOOPS.md)) |\n| `autopilot` | `autopilot_status`, `autopilot_waiting`, `autopilot_stack`, `autopilot_stack_push`, `autopilot_answer`, `autopilot_close`, `autopilot_rewrite`: Autopilot's (experimental) reads, its stack, and its actions on waiting items. `autopilot_stack_push` takes one `tab` per call (the CLI's `--tab` repeats). Only Autopilot's panel may act (`AUTOPILOT_ONLY`), and a permission prompt, or an answer or rewrite of a secret card, is refused with `AUTOPILOT_CANNOT_ANSWER` |\n| `repos` | the repository tools, including `repos_get` and `repos_update` (a repo's Project Settings: build, run and archive scripts, worktree folder) |\n| `devices` | the six device tools plus `device_usage` and `device_free`, which report and free what simulators use on this machine ([Devices](DEVICES.md)) |\n| `machine` | `machine_health` (disk and memory levels, the Panes using the most memory, leak warnings, and what Pane can free by tier) and `machine_cleanup` (lists one kind of tier 1 or 2 item, and deletes them with `yes: true`; tier 3 is refused with how to free it) |\n| `secrets` | `secrets_list`, `secrets_delete`. No tool sets or reads a value: agents use secrets through `runpane secrets exec` ([Pane secrets](PANE_SECRETS.md)) |\n| `docs`, `links`, `admin` | documentation, deep-link, and diagnostic tools |\n| `plugin` | `core` without the four `workspace` tools: what the [Claude plugin](#claude-plugin) serves |\n| `all` / `read` | every tool / every read-only tool |\n\nChoose with `runpane mcp --toolsets core,git` (comma-separated). `--read-only` keeps only read-only tools from whatever is selected. The Pane app registers `core` by default; **Settings → AI & Agents → Pane tools to register** switches it to `all`. Each command's toolsets live in the contract's `toolsets` field. A command's `cliOnlyFlags` stay out of its tool: over MCP, `doctor` diagnoses only, and `--fix` and `--report` run from the CLI.\n\n## The three agent jobs\n\nThe core set is built around the three jobs agents most often need, each finished in one call:\n\n- `agents_start`: starts the agent with the task, waits until it is ready, and returns the pane and panel ids and a `pane://` link. Pass `pane` to open it as a new tab in an existing Pane (review, audit, fix, QA); pass `repo` and `name` only for new work, which creates a Pane. Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it (`runpane doctor` has Pane's working rules).\n- `agents_status`: whether the agent is working, ready, blocked (waiting on a person), idle, or exited, plus its current screen.\n- `agents_send`: submits a follow-up and reports whether the agent took it or queued it behind its current turn (`delivery`), read from the agent's transcript where Pane can find it.\n\n## Asking the person: notify\n\n`notify` asks the person a question, or tells them something, on screen wherever they are, and returns their answer as the tool result. `ui` picks the look: `options` (1 to 9 `choices`; returns `{answer, note?}` with the chosen label), `approve` (returns `{approved, note?}`), `ask` (returns `{answer}`), or `info` (returns `{delivered}` at once). `choices`, `suggestions` and `action` are typed arrays and objects in the input schema. It needs no `yes`. When Pane is not running, Approvals is off, or the Pane is too old to have notify, it returns `{unavailable, next}` and the agent asks in its terminal instead.\n\nFor an API key, token or password, agents call `secrets_request`, never `notify` with `ask`. The person enters the value on a secret card, Pane saves it as a [Pane secret](PANE_SECRETS.md), and the result is only `{status: \"saved\", project, name}` or `{status: \"declined\"}`. When it returns `unavailable`, the agent asks the person to save the secret in Pane under Settings > Secrets.\n\nA question can wait for hours, and each client limits a tool call differently:\n\n- While any call runs, the server sends a `notifications/progress` about every minute when the request carried a progress token. That keeps Claude Code's 30-minute idle window open, over stdio and over Pane's HTTP endpoint alike.\n- Claude Code and Codex wait in one call. Pane's registration gives Codex a long per-server tool timeout.\n- Every other client, including Cursor's CLI (which ends each call after a fixed 60 seconds), gets `{waiting: true, id, next}` after about 50 seconds. The question stays on screen, and the agent calls `notify` again with `resume: <id>`. Pane ends this loop after 15 minutes without an answer and returns `unavailable`.\n\nThe server tells Pane which agent is asking (Claude, Codex, Cursor, or the client's own name) from the client's MCP name, and inside a Pane terminal the question names its Pane and panel. See [Pane Notify](PANE_NOTIFY.md).\n\n## Docs and links\n\n`docs_search` searches Pane's docs, `runpane` help, per-command context, and the Pane Chat skills installed in the Pane data directory. It returns short excerpts with paths. `docs_read` returns one path in full. Both work offline, and the same docs are listed as `runpane-docs:` MCP resources.\n\n`links_create` builds `pane://open?pane=<id>[&panel=<id>]`, `pane://open?repo=<id>`, or `pane://open?session=<id>`. Pane registers the `pane://` scheme on macOS, Windows, and Linux. Opening a link (from a browser, a terminal, or `links_open`) raises Pane and selects what it names. It never changes Pane state, and a link with any unexpected part is rejected.\n\n## Registering by hand\n\nWithout the desktop app, or for another MCP client, run the server from npm: `npx --yes runpane@latest mcp`. Add `--toolsets <names>` to choose tools.\n\n```bash\nclaude mcp add --scope user pane -- npx --yes runpane@latest mcp\ncodex mcp add pane -- npx --yes runpane@latest mcp\n```\n\nCursor (`~/.cursor/mcp.json`):\n\n```json\n{ \"mcpServers\": { \"pane\": { \"type\": \"stdio\", \"command\": \"npx\", \"args\": [\"--yes\", \"runpane@latest\", \"mcp\"] } } }\n```\n\nVS Code (`.vscode/mcp.json`, or run **MCP: Add Server**):\n\n```json\n{ \"servers\": { \"pane\": { \"type\": \"stdio\", \"command\": \"npx\", \"args\": [\"--yes\", \"runpane@latest\", \"mcp\"] } } }\n```\n\nAny other client that can launch a stdio server uses the same command and arguments.\n\n`agents_send` uses the target agent's composer state. For Codex, it queues with Tab while the agent is working and submits with Enter when ready. A send is confirmed only after the text leaves the composer; if it remains, the result includes a command to retry the appropriate key. `panels_submit_composer` with `strategy: auto` uses the same keys.\n\n`runpane mcp` is stdio only: it runs next to the Pane app on the same machine, with no OAuth. Pane's own HTTP endpoint serves only the tabs Pane starts on this machine. To drive a remote Pane, run the server on the remote host.\n\nThe Python package (`pipx run runpane`) does not include the MCP server, the docs search, or the agent tasks, because they need Node. From Python, those commands print the npm command and exit with status 2.\n\n## Manual test steps\n\nAutomated tests cover the registration and link logic on every OS. Check these by hand on a packaged build of each platform.\n\n**macOS, Windows, and Linux**\n\n1. Install and launch Pane, with Claude Code, Codex, and Cursor installed.\n2. Run `claude mcp list`, `codex mcp list`, and `agent mcp list`. Each lists `pane`. If Cursor asks for approval, run `agent mcp enable pane`; it should report ready with 37 core tools.\n3. In a fresh `claude` session, ask \"Use Pane to list my repos\". It calls `repos_list`.\n4. Quit and relaunch Pane. The Claude, Codex, and Cursor configs are unchanged.\n5. Turn off **Settings → AI & Agents → Register Pane tools with Claude Code, Codex, and Cursor**. `pane` is gone from all three configs, and the other entries are unchanged.\n6. Open a Claude tab in a Pane and type `/mcp`. It lists one `pane` server under built-in MCPs, and no `runpane mcp` process runs under that `claude`. Ask it to list Panes; it calls `panes_list` over HTTP.\n\n**pane:// links**\n\n1. Get a link: `runpane links create --pane <pane-id>`.\n2. With Pane running, open it from a browser or a terminal:\n - macOS: `open \"pane://open?pane=<pane-id>\"`\n - Windows: `start \"\" \"pane://open?pane=<pane-id>\"`\n - Linux: `xdg-open \"pane://open?pane=<pane-id>\"`\n3. Pane comes to the front on that Pane, and no second Pane window opens. On Windows and Linux, the extra process hands the link to the running Pane and exits.\n4. Quit Pane and open the link again. Pane starts and opens that Pane.\n5. Open `pane://open?pane=<pane-id>&archive=1`. Pane logs `Unknown pane link parameter: archive` and changes nothing.\n6. On Linux, check the handler: `xdg-mime query default x-scheme-handler/pane` names Pane's desktop file (AppImage and .deb).\n\n**Windows with WSL**\n\n1. Save a repository that lives in a WSL distro, with Claude Code, Codex, and Cursor installed inside that distro.\n2. Relaunch Pane. Inside the distro, `claude mcp list`, `codex mcp list`, and `agent mcp list` show `pane`, whose command is `/mnt/c/.../Pane.exe`.\n3. From a `claude` session inside the distro, ask \"Use Pane to list my repos\". The call reaches the Windows Pane.\n4. Turn the setting off. `pane` is gone from the distro's configs too.\n\n## Example prompts\n\n- \"Use Pane to start Claude on fixing the login redirect in the web repo, and give me a link to watch it.\"\n- \"How is the agent in my fix-login Pane doing? Does it need anything from me?\"\n- \"Tell the fix-login agent to also add a test for the redirect.\"\n- \"Which of my Panes have uncommitted or unpushed work?\"\n- \"How do I archive a Pane and get it back later? Check Pane's docs.\"\n\n## Not supported\n\n- Streaming. `watch --follow` and `watch --until-event` aren't offered; use `agents_status`, or `watch` with `timeoutMs`.\n- App settings. Agents can't read or change Pane's settings.\n- Permanently deleting Panes or removing repositories. Those stay in the app, where the user sees what goes.\n- Pagination (the full list is small).\n- Code or scripts run inside the MCP server itself. Agents run code in Pane terminals through `agents_start` and `agents_send`.\n\n## Protocol\n\nThe server uses the MCP TypeScript SDK v2, over stdio or (in Pane) streamable HTTP. It speaks MCP revision 2026-07-28, which has no handshake: `server/discover`, with the version and client capabilities carried on each request. It also accepts the 2025 `initialize` handshake that current Claude Code and Codex releases send, negotiating down to 2025-11-25.\n\nOver stdio, only JSON-RPC goes to stdout, the server exits when stdin closes, and cancelling a call (`notifications/cancelled`) stops the `runpane` process running it. Over Pane's HTTP endpoint, dropping the request does.\n\n## Tools\n\nTools are generated from [`contracts/runpane/contract.json`](../contracts/runpane/contract.json) when the server starts:\n\n- Every command that has result `jsonSchemas` becomes a tool. Spaces and hyphens in the name become underscores: `repos list` → `repos_list`, `panels submit-composer` → `panels_submit_composer`.\n- The tool's inputs are the flags from the command's `usage` lines and its `agentContext` arguments, in camelCase (`--timeout-ms` → `timeoutMs`). Flags that take a value are strings and flags without one are booleans, unless the `agentContext` argument declares a JSON `schema` (an enum, array, or object); array and object values reach the CLI as JSON (`--choices=[...]`). Daemon commands also accept `paneDir`. Positional `agentContext` arguments become string inputs too: `<machine>` and `<path>` go where the first usage line puts them, and `-- <command>` becomes `command`, passed after `--`.\n- The description combines the command's summary, details, and notes from `agentContext`. The title is `runpane <command>`.\n- The output schema is the command's `*Result` JSON schema. Every call runs `runpane <command> … --json` and returns its JSON output, both as `structuredContent` and as a text block for older clients. Mentions of `runpane <command>` in that output are rewritten to name the tool, except in `docs` and `workspace` tools, whose file contents and command output come back unchanged.\n- A non-zero exit returns a tool error (`isError: true`). A CLI failure reads as its message, a `Next:` line that names tools instead of CLI commands, and a `Code:` line; a command's own `ok: false` result comes back as its JSON. Bad arguments are tool errors too, so the model can correct them. An unknown tool name is a JSON-RPC Invalid Params error (`-32602`).\n- Annotations come from the contract. `readOnlyHint` is the inverse of `mutates`. A mutating tool is `destructiveHint: true` unless the command is marked `additive`. `idempotentHint` and `openWorldHint` follow the `idempotent` and `openWorld` fields.\n- Values are passed as `--flag=value`, so a value may start with `-` (for example `- [ ] item`).\n\nAdding or changing a command in the contract changes its tool. There is no per-tool code.\n\nA few flags are left out. `--json` is always passed. `--follow` and `--until-event` are omitted because a streaming or open-ended watch cannot return a single result; call `watch` with `timeoutMs` instead. Tools have no stdin, so pass exact terminal bytes in `text` (for example `\\u0003` for Ctrl-C) rather than `inputFile: \"-\"`.\n\n## Confirmation\n\nMutating tools keep the CLI's confirmation rule. Every command whose usage includes `--yes` gets a `yes` input; without `yes: true`, the call fails with the CLI's own refusal and changes nothing. `workspace_exec` and `workspace_write` have no `--yes` in the CLI, so the server asks for `yes: true` itself and refuses the call before anything runs. `notify`, `secrets_request`, `theme_set`, `report`, and the `sessions_*` and lock tools have no `yes`. `machine_cleanup` without `yes` is a dry run: it lists what it would delete and changes nothing. Tools are also annotated with `readOnlyHint`, so clients can auto-approve read-only tools and prompt for the rest.\n\n## Agent guidance\n\nPane installs a managed `pane` skill under `~/.claude/skills/pane` (or `$CLAUDE_CONFIG_DIR/skills/pane`) and `~/.agents/skills/pane`, including saved WSL distros on Windows. It leaves any existing skill without Pane's marker alone, rewrites a copy an older Pane marked, and leaves a copy a newer Pane marked. The skill also covers what to do when tools look missing: the bundled CLI (`$PANE_RUNPANE_BIN`, `~/.pane/bin/runpane`) before `npx`, `runpane notify` when this server's tools are not loaded, and where Pane keeps its data. **Install Pane skill for agents** in Settings → AI & Agents controls the installation; turning it off removes Pane's copy.\n\n**Publish Pane instructions to AGENTS.md** is off by default. If enabled, Pane writes a marked block into the active repository's `AGENTS.md` with CLI and MCP setup instructions. Turning it off removes only Pane's marked block from saved repositories. On upgrade, Pane turns off the old default once and removes those blocks; a later opt-in is remembered. The full command catalog lives in MCP tools and `runpane agent-context`.\n"},{"path":"docs/PANE_NOTIFY.md","title":"Approvals (Pane Notify)","text":"# Approvals (Pane Notify)\n\nAgents ask you questions through Pane instead of waiting in their terminal.\nAn agent calls the `notify` MCP tool (or `runpane notify`), Pane shows the\nquestion wherever you are, even over your browser, and the agent gets your\nanswer as the tool's result. Inside Pane, everything that waits on you is in\n**Approvals**, filed under the Session it belongs to. `notify` is the agents'\nside of it, and keeps its name in the CLI, the MCP server and the code.\n\n## What an agent can send\n\n`notify` takes one `ui` value, which picks the card:\n\n| `ui` | Card | Result |\n| --- | --- | --- |\n| `options` | The question and 1 to 9 `choices` (`{label, detail?, recommended?}`), or 2 to 4 `questions` (`{title, choices}`, one pick each) instead. The strip shows four, then **More**. | `{answer, note?}` (`answers[]` too for several questions), or `{reply, picks?, id, next}` when the person typed something ([Replies](#replies-and-new-versions)) |\n| `approve` | Deny and Approve, plus a disclosure with the preformatted `detail`. `detailLabel` names the disclosure (up to 40 characters; default **Show details**). | `{approved, note?}` |\n| `ask` | A text field, with optional `suggestions` as chips above it. | `{answer}` |\n| `secret` | A masked field with **Save securely** and **Decline**. Created only by `runpane secrets request` (MCP `secrets_request`), never with `notify --ui`. The host saves the value as a [Pane secret](PANE_SECRETS.md) and drops it; it never reaches the agent, history or other screens. No Undo. | `{status: \"saved\", project, name}` or `{status: \"declined\"}` |\n| `info` | One line, with at most one `action` button (`{label, url}`). It returns at once and hides after a few seconds. | `{delivered: \"screen\" \\| \"inbox\"}` |\n\nEvery card takes a `title` (one line on the strip, wrapping to three) and an\noptional `context` shown under **Details** and in the round. A `context` that\nis a status file or a `needs_you` block, as JSON, never shows raw: Pane shows\nits question and `why`, adds its `files` as links, and turns an `ask` with no\n`suggestions` into an `options` card with the question's `options` as choices;\nother JSON shows one `summary`, `step` or `title` line, or none. On `--update`\nthe new context is read the same way, but the card keeps its `ui`, and its\nchoices and links unless the update passes them. Prose stays as written, even\nwhen it starts with `[` or `{`. A card shows up to 6 links; when a status file's `files` add more, the context's\nlast line names the rest (`More links: …`). Any card also\ntakes up to 6 `links` (`--links`), related files and pages shown as chips:\n`{label, path}` for a file on the asking machine (relative to its working\ndirectory), `{label, url}` for an http or https page, or `{label, approval}`\nfor another approval (its id or Q-n). Older Panes ignore them.\nIn Approvals, clicking a chip opens it as a tab beside the card: a file in an\neditor tab, a page in a browser tab, another approval in place, with **Back**.\n\nPane builds each approval's **Summary** from these fields (D-225), unless the\nasker linked its own `.html` Summary page (a worker's `--summary-file`, or\n`summary` in its `needs_you`). Agents write a card to read on its own: a\none-line title of about 80 to 100 characters, `context` of one or two sentences\non why it matters (up to 240 characters), 2 to 4 choices each with what it does\n(`detail`) and exactly one `recommended`, and links to every reference: files,\nPRs and other approvals. Every way of asking goes through one check\n(`main/src/services/notify/cardCheck.ts`): Pane refuses a title over 160\ncharacters or with a line break, and two recommended options in one question,\nand returns a warning for each softer miss, which `runpane notify` and\n`runpane report` print. An old paragraph card (the whole question in its title,\nwith no buttons) is first split by fixed rules into a title, options and\nlinks (`cardTidy.ts`); the card reads \"Tidied by Pane\" and **Show as sent**\nshows what the agent sent.\n\n**Which card.** Pane's approvals text (`main/src/services/approvalsRules.ts`,\n\"Asking the person in Pane\") is the one rule every Pane text carries: Claude's\nown card (AskUserQuestion) only for a quick question that answers the person's\nlatest message in the chat they are typing in and only steers that turn;\neverything else, including any worker's question in a Session, is an approval\ncard. Codex and other agents without a built-in card always use an approval.\n`main/src/services/approvalsRules.test.ts` fails when a copy drifts.\n\nWhen Approvals is off or Pane isn't running, the result is\n`{unavailable, next}` (\"Approvals are off in Pane.\") and the agent asks in its\nterminal as it does today.\nFor an API key, token or password, agents call `secrets_request` (or\n`runpane secrets request`), never `ask`. When that returns `unavailable`, the\nagent asks you to save the secret in Pane under Settings > Secrets.\n\n```sh\nrunpane notify --ui options --title \"Which session store should the refactor use?\" \\\n --choices '[{\"label\":\"Postgres table\",\"recommended\":true},{\"label\":\"Keep Redis\"}]' \\\n --links '[{\"label\":\"Plan\",\"path\":\"docs/plan.html\"},{\"label\":\"PR #12\",\"url\":\"https://github.com/acme/app/pull/12\"},{\"label\":\"Q-12\",\"approval\":\"Q-12\"}]'\n\n# Several questions in one card\nrunpane notify --ui options --title \"Q-20: How should the release train start?\" \\\n --questions '[{\"title\":\"Turn it on now?\",\"choices\":[{\"label\":\"Yes, turn it on\",\"recommended\":true},{\"label\":\"Not yet\"}]},{\"title\":\"How many trains?\",\"choices\":[{\"label\":\"One train\",\"recommended\":true},{\"label\":\"Two trains\"}]}]'\n```\n\n## Who asks: Sessions\n\nPane files each item under the Session its Pane belongs to (a Session's own\norchestrator tab is marked as the orchestrator). Items from a Pane in no\nSession go under \"Not in a Session\". Items Autopilot asks itself go under\n\"Autopilot\", marked \"written by Autopilot\" ([AUTOPILOT.md](AUTOPILOT.md)).\n\n- **Workers in a Session don't call `notify`.** Approvals come from the\n Session's orchestrator, not from the agents in its Panes. A worker reports\n blocked to its orchestrator (`runpane report --state blocked --question\n \"<question>\"`). That question is a card at once, with an answer box, and it\n rings once the orchestrator relays it or after 10 minutes, so the orchestrator\n first settles what the plan already answers. Your answer goes straight to the\n worker's tab (`answer: Q-n → <answer> (by you)`), even with the orchestrator\n down. A typed reply goes there too (`reply: Q-n → …`), and to the\n orchestrator that relayed it when the worker can't read it\n ([Replies](#replies-and-new-versions)). A worker's `notify` call isn't shown: it returns `unavailable`, \"Not shown to the\n person: in a Pane Session, only the orchestrator asks the person.\", with a\n `next` that says to report blocked. Claude's own permission and plan\n prompts and a chat tab's prompts on a worker tab are the tool asking, so\n they still reach you, filed under the Session.\n- **A Session orchestrator** keeps every item that waits on you posted to\n Approvals exactly once, titled with its Q-n and with the worker's files as\n links. It relays a worker's question into that card (`runpane notify --relays\n <item> ...`), which gains choices, context and links, then records the decision\n (`runpane inbox ack <item> --decision <D-n>`), and the card reads \"Recorded as\n D-n\". It posts its own items with `runpane notify ... --json`. Both run as\n background commands, so it stays free to talk: you can ask it about an item in\n its own tab while the card waits. The\n full rule is in the orchestrator guide\n (`runpane docs read --doc skills/pane-orchestration/SKILL.md`, \"What waits\n on the person\"). A second card from an orchestrator on the older rules keeps\n working for one release.\n- **Autopilot** asks with `notify` too, and can answer, close and rewrite items\n within its rules ([AUTOPILOT.md](AUTOPILOT.md)).\n- **Any other agent** calls `notify` as before.\n\nClaude's permission prompts and chat tab prompts (below) still come straight\nfrom the asking tab, filed under its Session.\n\n## Claude's own prompts\n\nClaude tabs Pane starts also ask their permission and plan prompts in Approvals,\nwithout the agent calling `notify`. The terminal shows the prompt as usual;\nthe first answer from the terminal, Approvals, the strip or the phone wins.\n\n- **Desktop Approvals** shows Claude's choices: Yes, each \"Yes, and don't ask\n again for …\" or \"Yes, and allow access to …\" that Claude suggests, and No.\n A note on No tells Claude what to do instead; without one, Claude stops and\n waits, as No does in the terminal. A plan shows its text with \"Yes, and\n auto-accept edits\", \"Yes, and manually approve edits\" and \"No, keep\n planning\".\n- **The phone** lists the prompt under home's **Needs you** with **Yes** and\n **No**, and its alert carries the same two buttons. The question's sheet has\n every choice.\n- **Answered in the terminal**: Pane closes the question and lists it in\n Done today as \"Answered in the terminal\".\n- **The whole command, plan or tool input** is on the card, so Yes never\n approves something you couldn't read. One over 32,000 characters is too long\n to show: its question offers no choices and says to answer in the terminal.\n- **After 10 minutes** Claude stops waiting on Pane. The question stays, says\n \"Claude is asking in the terminal now\" with **Open**, and loses its choices;\n answering in the terminal clears it. An answer still in its 3-second Undo\n hold then never reaches Claude, so it is dropped the same way.\n- **The first prompt** after an update adds a one-time note to Approvals.\n\nHow it works: each Claude launch gets an http `PermissionRequest` hook aimed\nat a loopback endpoint on the machine running it, with a token for that tab.\nClaude reads only the last `--settings` flag, so Pane writes one settings file\nper tab (owner-only, in `claude-prompts` under Pane's data folder) that merges\nits hooks with any `--settings` the command already passes, and launches with\nthat file instead. The file is written with this setting off too, for the\n`SessionStart` hook that tells Pane which conversation the tab is on\n([CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)). A command whose `--settings` Pane can't read, or a tab\nwhose settings file Pane can't write, launches unchanged. Wrapped launches, commands that don't start with `claude`, SSH tabs\nand WSL tabs keep their command, and their prompts stay in the terminal.\n\nTurn it off in **Settings → AI & Agents → Answer prompts from Pane**. Off\ntakes effect at once; a tab started while it was off picks it up when it\nrestarts.\n\n## Chat tab prompts\n\n[Chat tabs](CHAT_TABS.md) send their ACP approvals to Approvals too, with exactly\nthe choices the adapter sent (the phone's Yes and No are its allow and reject\nchoices). A question (ACP form) is asked one field at a time, titled \"(1 of 3)\"\nwith the field's title when it has more than one: single choice and yes/no as\noptions, multiple choice as free text naming the choices (comma-separated, with\neach choice as a chip), text and numbers as free text. A typed answer to a\nchoice fills the form's matching free-text field (AskUserQuestion's\n`question_0_custom`). The last field sends the whole form as one answer; \"Skip\nquestion\" declines it. The first answer wins: an answer from Approvals reaches\nthe agent, and a card the chat tab answered first closes as \"Answered in the\nchat\", along with the rest of its form. In Approvals the card shows beside the\nchat tab, which docks the same prompt above its composer.\n**Settings → AI & Agents → Answer prompts from Pane** turns this off too. A chat tab waiting on a prompt reports\n`blocked`, so phone alerts follow it like a terminal agent's.\n\n## Long waits\n\nA question waits until you answer it. How the call stays open depends on the\nclient:\n\n- **Claude Code and Codex** wait in one call. Claude Code moves a call that\n runs past about 2 minutes into a background task and ends its turn; your\n answer still reaches the agent when you send it. Pane's MCP server sends a\n progress notification every minute, and Pane registers the server with\n Codex using a 24-hour tool timeout.\n- **Cursor's CLI** ends every tool call after 60 seconds. About every 50\n seconds `notify` returns `{waiting: true, id, next}`, and the agent calls\n `notify` again with `resume: <id>`. The card doesn't change. After 15\n minutes without an answer the call returns `unavailable`. Cursor asks\n \"Run this MCP tool?\" before every call, resumes included; pick **Allowlist\n MCP Tool** once so a waiting agent doesn't stop at that prompt.\n\nIf the agent stops waiting (you interrupt it, it exits, or its call times out)\nand doesn't resume within 30 seconds, the item closes (\"closed: the asker stopped\nwaiting\"; see [When an approval goes away](#when-an-approval-goes-away)). Codex 0.164 doesn't tell Pane when you press Esc, so a question from a\nCodex panel also closes when that panel sits idle at its prompt for 10 seconds.\n\n## Where questions show\n\n- **Inside Pane: Approvals.** An **Approvals** row in the sidebar's top list,\n below Loops (directly below Autopilot when Autopilot is on), shows an amber count of the items waiting (none at zero);\n clicking it, or pressing ⌃⇧Space while Pane is in front, opens the Approvals\n screen in the main area, and clicking the row again returns you to the view\n you left. The sidebar keeps the Sessions list,\n Panes with a waiting item show an amber \"Waiting\", and each Session row\n shows an amber count of the approvals waiting from it. The row's count is the sum of every Session's count plus items not in a\n Session, across saved machines; in the one-machine sidebar its tooltip says\n how many of them wait on other machines. Beside\n it, the queue has **Waiting** and **Done today** tabs and a **Group by** menu,\n remembered per device: **Most recent** (the default) lists items flat, newest\n first, each row naming its Session and machine; **By Session** and **By\n project** group them, each group placed by its newest item; **Sidebar order**\n groups by Session in the order the sidebar shows them (the All machines\n arrangement when that's on), following a drag there, with Sessions the\n sidebar doesn't show last, newest first. Each group is boxed under a header\n with its name, machine mark and waiting count. Waiting sorts by when it was asked and Done today by when it was\n answered. A new item never moves the selection or the selected row. The\n list stays compact rows, each with a chip for \"Reading your reply…\",\n \"Getting more context…\" or \"Updated · ready again\". The selected item opens\n in **the approval column** beside the list (see below); its pager follows\n the list as grouped. The column's last tab is the chat where it was asked,\n live: an orchestrator's item shows the Session's orchestrator tab, so you\n can ask it about the item in its own composer; a worker's prompt or a\n standalone item shows the asking Pane's tabs, with **Open in Pane** (or\n **Open on <machine>** for another machine's item). Below about 1,100px wide,\n the list stacks above the column. After a pick, the column shows \"Sent:\n …\" with **Undo** for 3 seconds; the item then moves to **Done today**,\n which lists the last 24 hours, updates (`ui info`) included. Under Most\n recent, once a typed reply is with an agent, Waiting splits into **Waiting\n on you** and **With the agent**, each row naming who reads the reply. Inside Pane there is no\n floating strip and no Notify row in the sidebar.\n- **The approval column**: one tabbed column for an approval, the same on\n every surface. Its header pages through what's waiting (‹ n of N ›, dots, ←\n and → while it has focus) and ✕ closes it. Its tabs are **Decide** (the\n subtitle, each question with its why and options, recommended ones\n marked but none selected until you pick, the references and one reply box that grows up to half the\n column), **Summary** (one HTML page: the asker's own, an `.html` passed as a\n worker's `--summary-file` or `summary` in `needs_you`, else one Pane writes\n from the card and the worker's status file; it renders with scripts and\n network off, the same on the Mac, from another machine and on the phone),\n each linked file (in the document viewer), URL (in the\n in-app browser) or other approval (in place, with Back), and the chat where\n it was asked, left out when you're already in it. In a **Session**, the\n column lays over the Session's right split view without resizing it, and ✕\n (\"Back to <tab>\") shows the split again as it was; with no split open it\n opens a split of its own, and ✕ (\"Close split\") collapses it. There it is a\n focus stop of its own: Focus Right (⌘⌥→) and F6 move into it from the chat,\n the tab keys (⌘⇧[ ⌘⇧], ⌘⇧1-9) walk its tabs while it has focus, Focus Left\n or Esc go back to the chat's message box, and its active tab carries the\n accent only while it has focus, as a split's does. The right\n sidebar (Overview, Files, Changes) is never covered. The Session's title\n bar shows **Approvals n · n ready**, and a Session row's count in the\n sidebar opens the newest ready-again approval, or the first waiting one. A\n Session's orchestrator chat docks one compact card above its composer:\n who asks, the title and subtitle across the card, and a bottom row with ‹ n\n of m ›, the reference count, Summary and **Open**; its pager stays in step\n with the column's. The chat's own AskUserQuestion isn't docked: the chat\n already shows Claude's card, and Approvals and the phone keep the copy.\n **Send** closes the column, and a status line in the chat names the agent\n reading the reply (\"okta-sso-account is reading your reply to Q-42\"), then\n how it was taken, with **Reopen**. \"Taken as your answer\" shows only on that\n approval, its row and that line. The card open in the column has a darker\n grey outline and an **open** label. In **Autopilot**, the column covers the Stack (✕ \"Back to the\n Stack\"), and Autopilot's decision cards gain **Open**. In a Session and in\n Autopilot, the chat tab is live too: an orchestrator's item shows its\n Session, and a worker's or a Pane's item shows the tab that asked.\n- **The strip**: while Pane isn't in front, a borderless card at the bottom\n center of the screen with the pointer. It never takes keyboard focus when it\n appears; click a choice to answer, or click its text field to type. After\n you answer, it shows \"Sent to <agent>\" with **Undo** for 3 seconds before\n the agent gets it. Only one strip is ever on screen, oldest question first.\n **Open in Pane** brings Pane to the front on Approvals with that item\n selected.\n- **The round**: press ⌃⇧Space (Ctrl+Shift+Space on Windows and Linux) from\n any other app for a centered panel that works through the queue by\n keyboard: nothing starts chosen; number keys or arrows choose, ↵ sends,\n → skips, Tab adds a note (a note with no pick goes as a reply on its own),\n Esc closes.\n- **The menu bar or tray icon** shows an amber dot while questions wait. Its\n menu lists them and holds Show outside Pane, Pause for 1 hour, a way into\n Approvals, and its settings.\n\n**Keys on a card.** With the pointer over a card in Approvals, its keys work:\na choice's number answers it, Y approves, N starts a denial, and typing starts\nan ask's answer. Keys typed into a field (a terminal, a chat composer, a search\nbox) stay there, even with the pointer over a card. The floating strip over\nanother app takes keys once you click it, so typing in that app never answers\nby accident. Keys work whatever Pane's keyboard-shortcuts setting says. On\nApprovals, **More** (or **Details**, when choices have notes) opens the card in\nplace with every choice, its note and **Send**.\n\n✕ hides a question from the strip; it keeps waiting in Approvals.\nRight-click ✕ to bring it back in 10 minutes, in 1 hour, or when you next\nswitch to Pane. The clock at the bottom right of a card snoozes it for 3, 5\nor 15 minutes: it leaves the strip, then comes back in its place in the\nqueue, and Approvals shows it with its return time. The agent keeps\nwaiting through a snooze or reminder.\n\n## Where approvals are kept\n\nEach machine keeps one saved list: the `approvals` table in its `sessions.db`,\none row per item from any origin (`main/src/services/approvals/approvalStore.ts`).\nOrchestrators, workers (through a blocked report), Autopilot, Claude prompts and\nPane itself all post to it. An approval lives on the machine where its creator\nruns; devices read and answer it over the connection they already use, and\nnothing is copied (D-145, D-165). Open calls, the 3-second Undo hold and the\nalert timers stay in memory beside the table.\n\nAn item survives a restart, and an answer reaches its asker whether or not its\ncall is still open: an open call returns it, and otherwise Pane types `answer:\nQ-n → <answer> (by you)` into the asking tab once, when its agent is idle at\nits prompt and in the terminal's foreground process group. A wrapper and the\nagent it started share that group, so an agent-farm worker (`node\ntelemetry.mjs` running `claude`) qualifies. A shell, a nested shell, `ssh` or a\nREPL there keeps the answer owed, and the card reads \"not delivered to <tab>\nyet\" until it goes. Where Pane can't see what runs in the tab (Windows, WSL and\nthe PTY host), or the tab closed, the answer is never typed: the card reads\n\"not delivered to <tab>: <why>\" with Copy answer, and `runpane inbox` lists it\nas `undelivered`. The orchestrator passes on one Pane couldn't see to type; one\nwhose tab closed has no one left to tell. An\nasker that posts the same question again from the same tab (same Q-n or title)\njoins the waiting card instead of adding one.\n\nOn a machine's first start with this table, a one-time import moves\n`session-inbox.json` into it (`main/src/database/jsonStoreImport.ts`). It takes a\nbackup first (`session-inbox.json.before-import`), runs in one transaction with a\nmarker, and is safe to interrupt. The original file stays in place. If the import\nfails, Approvals says why, nothing is deleted, new approvals still work, and it\nretries on the next start.\n\n## Replies and new versions\n\nAn approval has one reply box. Picks alone are an answer, as before: the call\nreturns `{answer}`, or Pane types `answer: Q-20 → Yes, turn it on · One train\n(by you)`. Anything typed is a **reply**, which may be an answer or a question\nabout the approval. Pane doesn't decide which; the agent that reads it does\n(D-245, D-258).\n\n**The lines.** The reader's open call returns `{reply, picks?, id, replyId,\nnext}`. Only that call is given `replyId`: it is private to the call, kept\napart from the reply's own id, and in no snapshot, history or other screen. So\npassing it to `--took` and `--update` proves the caller is the reader, from a\nPane tab or a terminal outside Pane alike (D-294). With no open call, Pane types into the reader's\ntab, once, by the same rule as an answer:\n\n```text\nreply: Q-20 → \"Turn it on only if it can be undone\" (picked: Yes, turn it on · One train) (by you)\ncorrection: Q-20 → that was a question: \"…\" (by you)\ncorrection: Q-20 → that was your answer: \"…\" (by you)\n```\n\n`(picked: …)` is there only when something was picked. Picks keep their\nquestion's place: one left unpicked reads `—` (`picked: — · One train`), and\nthe result's `picks` holds `''` there. Without a Q-n the line names the title\nin quotes, and adds `[id <item id>]` before `(by you)`. Each reply has an id\nand is delivered once.\n\nOne reply at a time: while its reader is reading a reply (it has the line but\nhasn't run `--took`), a second typed reply is refused, with your words left in\nthe box; picks still answer. A reply still waiting for a busy tab is replaced\nby a newer one, and only the newer line is typed. The same rule holds on every\nsurface: the floating strip and the round send anything typed as a reply too,\nexcept on a permission prompt, whose note stays a note.\n\n**Who reads a reply**, in order:\n\n1. The asker: its open call, else its tab (a busy tab gets it when it's next\n idle).\n2. For a worker's question an orchestrator relayed, that orchestrator's tab.\n3. Autopilot, when it's on, in its chat tab.\n4. None: the approval reads \"No agent can read replies right now. You can\n still pick an option.\" The reply stays unread, and picks still answer.\n\nA reader that turns out gone passes the reply to the next one. A reply the\nasker or orchestrator hasn't taken after 10 minutes goes to Autopilot when\nAutopilot is on.\n\n**What the reader runs.** Only the reader may; anyone else gets\n`ERR_NOTIFY_NOT_READER` with a `next`. A worker in a Session may run both:\nthey aren't new asks.\n\n```sh\nrunpane notify --took Q-20 answer # records the reply (picks and text) as the answer\nrunpane notify --took Q-20 question # \"Getting more context…\" (--status \"<text>\" to say otherwise)\nrunpane notify --update Q-20 --asked \"Can it be undone?\" \\\n --what-changed \"Added the undo path to the context\" \\\n --context \"<new context>\" --choices '[{\"label\":\"Yes, with undo\",\"was\":\"Yes, turn it on\",\"recommended\":true},{\"label\":\"Not yet\"}]'\n```\n\n`--took` and `--update` take an item id or Q-n and no `--ui`. `--update` needs\n`--asked` (the person's question) and `--what-changed` (one line per change),\nand replaces whichever of `--title`, `--context`, `--choices`, `--questions`\nand `--links` it passes. A reworded choice carries `\"was\"`, its old label.\n`--update` then waits for the answer like any notify call (`waiting`,\n`unavailable` and `--return-after` work the same). It never adds a second\napproval.\n\n**Versions.** Each `--update` saves a new version on the same item: the\nquestion asked, What changed, who changed it and when. An item keeps at most 10\nversions; older ones fold into the oldest. They live in the item's saved JSON,\nso older items simply have none.\n\n**What the approval shows:**\n\n| State | Shows |\n| --- | --- |\n| Waiting, no reply | Waiting |\n| Reply delivered, not yet taken | \"<reader> is reading your reply…\", naming the reader for every kind (\"okta-sso-account\", \"The Doozy orchestrator\", \"Autopilot\") |\n| Taken as an answer | \"Taken as your answer\", with **It was a question** |\n| Taken as a question | \"Taken as a question: <reader> is getting more context\", with its status when the reader gave one, and **It was my answer** |\n| Updated | \"Updated · ready again\": your question quoted (\"You asked\"), What changed and by whom, choices marked NEW, REWORDED (the old label struck) or REMOVED, and a collapsed **Earlier version** |\n| No reader | \"No agent can read replies right now. You can still pick an option.\" |\n| A chat tab's built-in question | \"Sent to <agent>\": the typed reply is its answer, so there is no fix |\n| A chat tab's built-in question that takes only its choices | No reply box: pick one of its options |\n| Answered | Answered |\n\nThe fix is one click. **It was a question** sends the reader `correction: Q-n →\nthat was a question: \"…\"`, and the reader updates the approval. **It was my answer**\nrecords the reply as the answer and sends `correction: Q-n → that was your\nanswer: \"…\"`, and the reader acts on it. The pager skips items whose reply is\nbeing read or asked about. Permission prompts stay options only, with no reply\nbox.\n\n## When an approval goes away\n\nAn approval exists only while you can act on it and someone can take the answer\n(D-147). The machine that owns it decides.\n\n| Situation | What happens |\n| --- | --- |\n| Its Session is closed or archived | Closes within 5 s: \"closed: Session closed\", \"closed: Session archived\". |\n| Its asker is gone: its Pane archived or deleted, its tab closed, the worker sent a newer report, or a `notify` caller stopped waiting | Closes within 5 s of Pane learning it, with the reason: \"closed: the asking tab was closed\", \"closed: the worker moved on\", \"closed: the asker stopped waiting\". A sweep every 60 seconds catches anything missed. One exception: when only its tab closed and the orchestrator that relayed it, or Autopilot, can still read a reply for it, it stays open. |\n| Pane restarts | Items whose asking tab still exists stay waiting. |\n| Unanswered for 3 days | Stale: moved to a collapsed **Stale** group at the bottom of Waiting. It never rings or pushes again. |\n| You close one | One action on any card, with an optional reason. Its asker's open call returns \"The person closed this question.\", or `closed: Q-n (by you)` is typed into its tab. **Reopen** puts it back. |\n| You or Autopilot answered | Done today lists it for 24 hours. |\n\nThe store keeps answered and closed items 7 days for the record and for\norchestrators catching up on decisions (`runpane inbox`), then drops them. On the\nfirst start of a build with this table, a one-time cleanup closes every item\nwhose asker is gone (\"closed on upgrade: <reason>\"), and one summary card lists\nwhat's left, oldest first, with **Close all** and **Keep**.\n\n## Who asked, who acted\n\nEvery card names where it came from: \"workos-sso in Sales Skill · Mac mini\". This\nmachine's own items use its name from the machine picker, or no machine at all.\nEvery item is connected to its Session; outside one, to its Pane, or for\nAutopilot's own items to the Session it's about or Autopilot's chat. Opening it\nshows that, with its related files and documents.\n\nWhat happened to an item stays on it, on every device: \"Answered by Autopilot ·\nbecause D-22\", \"Closed by Autopilot: Session archived\", \"Closed: Session archived\",\n\"Rewritten by Autopilot from Q-7\", \"Recorded as D-147\". **Override** on an answer\nfrom Autopilot sends your answer to the asker as a correction (`correction: Q-n →\n<answer> (by you)`), recorded on the item. **Reopen** undoes a close by you or by\nAutopilot.\n\n## Alerts\n\nAlerts interrupt you on the device you're using (D-144):\n\n- **A computer rings** (the strip and the chime) only if it was used in the last\n 2 minutes with its screen unlocked, for its own items and other machines'. If\n two computers are both in use, both ring. In-Pane cards still show while Pane\n is in front.\n- **The phone** gets a push about 90 seconds after an approval arrives, only if\n it is still waiting. Answering it, closing it or turning Approvals off cancels\n the push.\n- A worker's question rings once its orchestrator relays it or after 10 minutes.\n- **An updated approval is quiet** (D-244): \"Updated · ready again\" shows as a\n notice on the computer in use, with no chime, plus its badges and counts. The\n phone gets a push only when no computer is in use. You started the follow-up,\n so it doesn't ring like a new approval.\n- A computer can ring only for machines it has saved. Autopilot's \"Can't see\"\n shows that gap, and the phone push still arrives.\n- **Show cards on** (Settings → Approvals) moves the strip, its window over\n other apps and the chime to one computer, for every machine it has saved.\n That computer still rings only while it's in use; when it's idle or locked\n the phone push is the backstop. Every other computer stays quiet while the\n picked one reads it, and keeps its Approvals list, counts, tray dot and\n answer-all shortcut. A computer the picked one can't read (it's off, asleep\n or disconnected, or it hasn't saved this computer) rings as if nothing were\n picked, and its Settings row says why. \"Reading\" means the picked computer\n holds a live connection to this one, as its owner or a paired device, naming\n itself by its install id (`machineId` in `config.json`; a `config.json`\n copied to another computer carries the same id, so delete the key there).\n A computer that has saved the picked one also checks its own connection:\n once that drops (about 20 seconds after the picked one sleeps or leaves the\n network), it alerts again. A computer closes its connections before it\n sleeps. The Settings row reads one of:\n - \"Cards pop up on <name>. They're still listed here.\": the picked computer\n reads this one, so this one stays quiet.\n - \"<name> hasn't added this computer, so this computer's cards still pop up\n here.\": this computer has saved the picked one and has seen it online for\n over a minute, but it doesn't read this one.\n - \"<name> isn't connected, so cards pop up here for now.\": anything else,\n such as off, asleep, just restarted, or not saved here.\n\n## Other screens and your phone\n\nThe machine running the agent keeps the one queue. Every screen connected to\nit shows its questions, and the first answer from any of them goes back to\nthe agent:\n\n- **A Pane desktop with saved machines** (Remote Access pairing or\n Workspaces) shows every saved machine's questions beside its own, whichever\n machine it is on: the strip over other apps, the round, the tray dot, the\n chime, Approvals, its sidebar count and the Waiting dots, within the\n [Alerts](#alerts) rules. Each card names its machine, and Approvals shows the\n machine's mark in its Session's group; beside it are that machine's Session\n name and linked documents, read from that machine, and **Open on <machine>**,\n which switches to that host instead of mounting a live Session view. A document\n that can't load is one line (\"<doc> isn't on the Mac mini anymore\", \"Couldn't\n reach the Mac mini\"), and the card stays answerable. An answer, Undo, ✕, snooze or → goes to the card's own\n machine and clears there; nothing switches. Open in Pane shows on this\n computer's cards and on the machine the desktop is on, where it opens the\n host's Pane in this window and leaves the host's own window where it is.\n- **Several screens at once**: the screen you answer on says \"Sent to\n <agent>\", every other one says \"Answered on <device>\", and all of them offer\n **Undo** for the 3 seconds before the agent gets the answer. ✕, snooze, the\n reminders and → in the round apply on every screen, except \"When I switch to\n Pane\", which waits for the Pane you used it on.\n- **Connection loss**: a machine that can't be reached collapses to one row,\n \"Mac mini offline · 4 waiting · they come back when the Mac mini is online\",\n since its cards can't be answered; the agents keep waiting. After reconnecting\n the screen shows what is waiting there now. Autopilot says \"<machine> offline\".\n- **Your phone**: the Pane app lists approvals on home's **Needs you** tile, in\n the same three sorts (chosen on its sort sheet), and an item opens above its\n Session's tabs and chat. A question still waiting after\n about 90 seconds sends one alert to every phone signed\n in to the host in the Pane app with notifications allowed and **Needs\n Input** on. The alert is titled with the Pane's name and says only \"<Pane>\n has a question\" (the folder name for a call from outside Pane); updates\n (`info`) send none. When the question is answered elsewhere or its agent\n stops waiting, the host sends a silent update so the phone can remove the\n alert, and an Undo makes it alert again. The host needs its usual phone\n credentials (`PANE_APNS_*` or the shared ones for iPhone, FCM for Android;\n see [NATIVE_MOBILE.md](NATIVE_MOBILE.md)); without them nothing is sent and\n the question still waits on every screen.\n- **A headless host** (`runpane install daemon`, remote setup, workspace\n hosts) has no screen of its own: it creates no strip window, tray icon or\n shortcut, and its questions show on every desktop that has it saved and on\n the phone. With none of them running, a question waits until one connects\n or answers.\n An update from it returns `delivered: \"inbox\"`; connected screens still show\n it on their strips.\n\nEach screen keeps its own Position, Show outside Pane, Sound, Show details, answer-all\nshortcut and Pause. The Approvals switch decides whether agents can ask, and it\nis one switch across your machines: turning it off returns `unavailable` to every\nwaiting agent on each machine and clears its questions from every screen. Show\ncards on is shared the same way.\n\n## Settings\n\n**Settings → Approvals** (the setting is still saved as `notify.enabled`):\n\n| Setting | Default |\n| --- | --- |\n| Approvals | On. Off hides the sidebar's Approvals row, expires open cards, returns `unavailable` (\"Approvals are off in Pane.\") to every waiting agent. Agents, Session orchestrators included, then ask in their own tab. Applies to all your machines ([how the switch travels](SHARED_CREDENTIALS.md#the-approvals-switch)). |\n| Show cards on | Whichever computer is in use. Or this computer, or a saved machine that has connected since Pane started: only that computer pops up cards and chimes ([Alerts](#alerts)). Applies to all your machines, saved as `notify.cardsOn`. |\n| Show outside Pane | On. It controls the floating cards over other apps. Off shows no floating card; inside Pane you answer from the Approvals row and screen, and the tray dot still shows. |\n| Position | Bottom center. Also top right or bottom right. |\n| Answer-all shortcut | ⌃⇧Space. Settings says so when another app already holds it. |\n| Updates hide after | 6 seconds |\n| Sound | On, for questions only |\n| Show details | Off. Cards open with details shown when on. Showing or hiding details on a card changes it. |\n\nOnly the Approvals switch and Show cards on are shared; the other settings here stay on each machine.\n\nPause for 1 hour (tray menu) hides strips and mutes sound while questions keep\nqueueing. Strips show over full-screen apps, during screen sharing, and with\nFocus or Do Not Disturb on; Pause is the way to quiet them.\n\n## What Pane tells agents\n\nWhile Approvals is on, Pane keeps a short block in each agent's user-level\ninstruction file, so every agent knows Pane is there and asks through `notify`:\n\n- Claude Code: `~/.claude/CLAUDE.md` (or `$CLAUDE_CONFIG_DIR/CLAUDE.md`)\n- Codex: `~/.codex/AGENTS.md` (or `$CODEX_HOME/AGENTS.md`). Agent Farm's\n Codex launches use a generated `CODEX_HOME` that links this file, so they\n read it too.\n- On Windows, the same two files in the home of each WSL distro a project\n runs in (`CLAUDE_CONFIG_DIR` and `CODEX_HOME` as that distro's login shell\n sets them). Pane writes them at launch and when you change the settings\n below; a distro that doesn't answer is shown as skipped and tried again at\n the next launch.\n\nThe block sits between `<!-- pane-notify:begin ... -->` and\n`<!-- pane-notify:end -->`. Pane writes it at first launch, since Approvals is\non by default. It has two parts:\n\n- **Pane:** when `PANE_SESSION_ID` is set, the agent is in a Pane terminal\n and should load the `pane` skill before using Pane. With the skill turned\n off (Settings → AI & Agents → Install Pane skill for agents), it points at\n `runpane agent-context --json` instead. If `runpane` isn't on `PATH`, the agent runs `$PANE_RUNPANE_BIN`\n (PowerShell: `& $env:PANE_RUNPANE_BIN`), or else the installed Pane's shim:\n `~/.pane/bin/runpane` on macOS and Linux,\n `C:/Users/<you>/.pane/bin/runpane.cmd` on Windows (forward slashes, so\n PowerShell, cmd and Git Bash all run it), and\n `/mnt/c/Users/<you>/.pane/bin/runpane` in WSL. The path is always the\n default data folder's, so a dev build with its own `PANE_DIR` never points\n your agents at its copy. Then comes Pane's model, the \"For agents\" part of\n the intro `runpane doctor` prints (Session, Pane, tab, `$PANE_SCRATCH_DIR`),\n and the rule to put scratch files in `$PANE_SCRATCH_DIR` rather than `/tmp`\n or the agent's own scratchpad. Both come from `agentContext.intro` and\n `agentContext.workspaceRules` in `contracts/runpane/contract.json`.\n- **Pane Notify:** call the `pane` MCP's `notify`, or `runpane notify` when\n that tool isn't loaded (for example under Agent Farm's strict MCP mode). It\n says which card to use (Claude's own card only for a quick question in the\n chat the person is typing in), who asks (in a Session, a worker reports\n blocked instead of calling `notify` and gets the answer in its tab), and to\n ask for a secret with `secrets_request`.\n\nHow to write a card (only what the agent can't find out itself, related\nquestions in one card, `info` rarely, written for someone who has lost the\nthread, with good and bad examples) and how to read a typed reply live in the\n`notify` command's notes. Pane prints them in the `notify` tool's description\nand in `runpane notify --help`, so agents read them when they ask, not in every\nrequest.\n\nPane writes only those lines, plus a line\nbreak before them when the file didn't end with one; the rest of the file keeps\nevery byte. It creates the file only when the agent's config folder exists and\nnever deletes it. It leaves alone a file that is a symlink or not a regular\nfile, isn't UTF-8, or has a stray marker, and one that another program keeps\nsaving while Pane writes. Settings → Approvals → Agent instructions shows each\nfile's state.\n\nTo remove the block, turn Approvals off in Settings → Approvals. Pane writes it\nagain when you turn Approvals back on, or at the next launch with Approvals on.\n\nThe `pane` MCP server's instructions say only to call `notify` instead of asking\nin the terminal. Claude Code gets that line, the agents intro and the scratch\nrule from its CLAUDE.md block, so while the block is there the server leaves\nall three out of its instructions to Claude Code. Cursor, which gets no user-level block, learns the rest from\nthe `notify` tool's description and the repository's managed `AGENTS.md` block,\nwhich also carries the secrets rule.\n\n## Linking a call to its Pane\n\nPane sets `PANE_SESSION_ID` and `PANE_PANEL_ID` in every terminal it opens.\nClaude Code passes them to MCP servers; Pane's registration forwards them for\nCodex (`env_vars`) and Cursor (`${env:NAME}`). A call from an agent outside\nPane still works: its card shows the folder name and hides Open in Pane.\n\n## Platforms\n\nmacOS, Windows and Linux on X11 show the strip over other apps. In a Wayland\nsession Pane runs as a native Wayland app and can't place a window over other\napps, so Show outside Pane is unavailable there (in Settings and the tray menu).\nQuestions show in Approvals inside Pane, with its sidebar count, Waiting dots and\nthe chime. The tray icon and its dot work; GNOME needs the AppIndicator\nextension, which Ubuntu turns on by default. On GNOME 46 (Ubuntu 24.04), which\nhas no global-shortcut portal, ⌃⇧Space doesn't reach Pane from other apps;\ninside Pane it opens Approvals.\n\nThe code: `main/src/services/notify/` (queue, windows, tray),\n`main/src/services/approvals/approvalStore.ts` (the store),\n`main/src/ipc/notify.ts` (including the `notify:remote-snapshot` and\n`notify:remote-command` commands and the `notify:shared-changed` event other\nscreens use), `main/src/daemon/mobilePushSender.ts` (the phone alert),\n`shared/types/notify.ts`, the renderer's Approvals screen\n(`frontend/src/components/approvals/`) and Notify card components, and the\n`frontend/notify.html` entry for the floating windows.\n"},{"path":"docs/PANE_SECRETS.md","title":"Pane secrets","text":"# Pane secrets\n\nPane secrets are named values, such as API keys, that any agent on your machines can\nuse without the value showing up in chat. A secret is addressed as\n`<project>/<NAME>`: the agent picks the project (`stripe`, `qa`, a repo's name) and\nthe name follows environment-variable rules, so it can be injected as-is.\n\nEvery host Pane syncs keys with keeps its own copy, so a secret works offline and on\nevery machine. Values stay in the OS store, never in `config.json`, the database,\nlogs, chat or MCP output.\n\n## Use a secret\n\nAgents and scripts use a secret only through `runpane secrets exec`, which starts a\ncommand with the values in its environment:\n\n```sh\nrunpane secrets exec --project stripe -- npm test # every stripe/* secret, under its own name\nrunpane secrets exec --project stripe --only STRIPE_KEY -- npm test\nrunpane secrets exec --project stripe --env API_KEY=STRIPE_KEY -- ./deploy.sh\nrunpane secrets exec --project gcp --file SERVICE_ACCOUNT -- ./upload.sh # env var holds a path to a 0600 temp file\n```\n\nThe values are read at call time, so a secret set a moment ago works in a running\nagent without a restart. Injected names override the caller's environment. `PATH`,\n`WORKTREE_PATH` and `PANE_*` are refused. A `--file` secret is written to a private\ntemp file that is deleted when the command exits.\n\nNo command prints a raw value: there is no `secrets get`. A value reaches a\ntranscript only if the command you run prints it.\n\n## Ask the person for a secret\n\n`runpane secrets request` (MCP: `secrets_request`) shows a masked card wherever the\nperson is, through [Notify](PANE_NOTIFY.md):\n\n```sh\nrunpane secrets request --project stripe --name STRIPE_SECRET_KEY \\\n --title \"Stripe test secret key\" --reason \"Run the webhook tests against Stripe's test mode.\"\n```\n\nThe person types the value and presses **Save securely**, or **Decline**. The card\nsays when saving replaces a value that already exists. The agent gets back\n`{\"status\":\"saved\",\"project\":\"stripe\",\"name\":\"STRIPE_SECRET_KEY\"}` or\n`{\"status\":\"declined\"}`, never the value, and then uses it with `secrets exec`.\n\nThe value is saved on the host the agent runs on, the moment it is answered. It\ntravels once, from the screen that answered to that host, over the same connection\nas any Notify answer. That host's own Notify history shows \"Saved as\nstripe/STRIPE_SECRET_KEY\"; other screens drop the card once it is answered. Secret\ncards have no Undo.\n\nThe card can be answered on the desktop and its floating strip, on another desktop\nshowing that host, and in the phone app, which uses a secure text field. A\nlock-screen alert only opens the app: it has no Reply field, because the system's\nreply input is not a secure field. Glasses show \"Answer on your phone or computer\".\n\n## Manage secrets\n\n| Where | What |\n| --- | --- |\n| Settings → Secrets | List by project with when and where each was set; Add, Replace and Delete. Values are never shown again. |\n| `runpane secrets list [--project P] [--json]` | Project, name, updated time and machine. MCP: `secrets_list` in the `secrets` toolset. |\n| `runpane secrets set --project P --name N --yes` | Reads the value from stdin only, so it never lands in your shell history or a process list. There is no MCP tool for it. |\n| `runpane secrets delete --project P --name N --yes` | MCP: `secrets_delete` in the `secrets` toolset. |\n\nA missing secret fails with `SECRET_NOT_FOUND` and the next step: request it, or\nopen Pane on a desktop connected to that machine so it syncs.\n\nSecrets are managed on the machine itself: `runpane workspace <machine> secrets …`\nis refused. From your own devices, run `runpane workspace <machine> exec -- runpane secrets …`\ninstead.\n\nA project's environment variables can point at a Pane secret instead of holding\ntheir own copy: see [Project environment variables](PROJECT_ENV_VARS.md).\n\n## Where values are stored\n\n| Host | Store |\n| --- | --- |\n| macOS | The login keychain: service `Pane` (or `Pane (<data directory>)` for a dev build's `PANE_DIR`), account `secret:<project>/<NAME>`. A value over 1 KB is kept in part items `secret:<project>/<NAME>#<id>.<n>`, which that account lists. |\n| Windows, desktop Linux | `secrets.json` in the Pane data directory, mode 0600, each value encrypted with the OS (DPAPI, or the desktop keyring) through Electron's safeStorage |\n| Linux without a keyring (a headless server) | The same 0600 file, as plain text. `runpane secrets list` on that host says so. |\n\nThe index of names, times and machines lives in `config.json` under `paneSecrets`.\nA delete removes the stored value first. If the keychain refuses, the secret stays\nsaved and listed, and the delete can be run again once the keychain is unlocked.\n\n## How secrets sync\n\nSecrets travel with [shared integration keys](SHARED_CREDENTIALS.md), under the same\nrules: a desktop or the phone that has more than one host saved carries them between\nhosts, in memory. The copy set most recently wins, and a deletion is recorded so an\nolder copy cannot bring the secret back. Sync runs when a secret changes and when a\nsaved host reconnects. A host that was offline keeps its copy until a device that\ncarries keys reaches it. Hosts from before secrets ignore them.\n\n## Who can read a secret\n\nAny agent, and any program running as you, on any of your hosts, can use every Pane\nsecret. That is the point: agents keep and share their own secrets across projects.\nThe safeguards stop accidental exposure; they don't sandbox anything. Setting \"Everyone on tailnet\" on\nany host gives everyone on the tailnet the same access.\n\n| Who or where | Can read values? | Why |\n| --- | --- | --- |\n| Any agent or process running as you on a host | Yes | runpane's local socket is mode 0600 with no token. On macOS, items trust `/usr/bin/security`. |\n| Every host Pane syncs to | Yes, holds a copy | Each saved host keeps a copy for offline use. |\n| Your paired phone | Relays, never stores | The same rule as shared keys: a paired device can already open terminals on the host. |\n| Teammates (other Tailscale logins on your tailnet), when any one of your hosts is set to \"Everyone on tailnet\" | Yes | Their `workspace exec` commands and the terminals they open there run as you, so they can read the keychain or `secrets.json`, run `runpane`, and reach every secret. Each synced host keeps a copy of your secrets, so that setting on any one host exposes them all. Pane refuses only their direct secret requests: secret cards, secret variables, chat tab keys, chat tab sign-in and [shared key sync](SHARED_CREDENTIALS.md), and their terminals and chat tabs start without secret variables or chat tab keys, including after the owner switches one of their terminals to chat. Keep \"Only me\" on every host unless you trust everyone on the tailnet with all your secrets. |\n| A Linux host without a keyring | At rest in a 0600 file, unencrypted | `runpane secrets list` on that host says so. |\n| Chat, MCP output, Notify history and broadcasts, push payloads, Pane logs, analytics, `sessions.db`, `config.json` | No | Pane never writes or returns a value to any of them. |\n| An agent's transcript and Pane's saved terminal scrollback | Only if the agent prints it | `exec` puts the value in a child's environment; if that command echoes it, the output goes wherever its output goes. |\n| Running processes | Yes, through the environment | `ps eww` shows a process's environment to the same user. |\n"},{"path":"docs/PROGRAM_STATUS.md","title":"Program status (OSC 7501)","text":"# Program status (OSC 7501)\n\nAny program running in a Pane terminal tab can tell Pane what it is doing by\nprinting one escape sequence. Pane shows that state as the tab's status cue\n(the dot on the tab and in the sidebar), the same cue it reads from an agent's\nscreen. A build, a deploy script or an\nagent that prints the sequence shows working, blocked or done in Pane with no\nPane-specific rules.\n\nThe sequence is the Program Status Protocol, revision 0.4, published by\nSuperlogical, which makes the Rex terminal:\n<https://www.superlogical.com/rex/docs/build/program-status>. The example below\nis the spec's own and needs bash or zsh (`\\e` is not POSIX `printf`).\n\n```sh\nstatus() {\n printf '\\e]7501;state=%s:msg=%s\\e\\\\' \"$1\" \"$(printf '%s' \"$2\" | base64 | tr -d '\\n')\"\n}\nstatus working \"Syncing photos\"\nrsync -a ~/Photos backup:/photos && status done \"Photos synced\" || status error \"rsync failed\"\n```\n\n## What Pane shows\n\n| `state` | Tab status cue |\n| --- | --- |\n| `working` | Working. |\n| `blocked` | Blocked: a red dot. When the tab becomes blocked, a desktop alert while Pane is in the background and a phone alert (at most one a minute per tab). In an agent tab, also `agent.blocked` in the Session journal. `msg` is the prompt line; `kind` (`permission`, `question`, `auth`) is in the status reason. |\n| `done`, `error` | Finished. While you're looking at another Pane, it shows the done cue until you open it. The record itself ends when you type in the tab. |\n| `idle` | Idle. |\n| `clear` | Removes the record, and the tab goes back to reading its screen. |\n\nThe status reason is `program_status:<state>`, with `:<kind>` for blocked\n(for example `program_status:blocked:auth`).\n\nA program can report several records with `id` (`build`, `build/test`). The tab\nshows the most urgent: blocked, then working, then error, done and idle; the\nlatest one wins within a state. `app` is inherited from the nearest parent\nrecord.\n\n## Precedence and lifetime\n\nA report outranks Pane's screen parsing and its output heuristics while the\nrecord lasts, with one exception: when the screen shows an agent waiting on\nyou (a permission or trust prompt) and the report isn't `blocked`, the tab\nshows blocked. Blocked is the most urgent state from either source. When no\nrecord is left, the tab reads its screen again.\n\n- `working`, `blocked` and `idle` end when the program exits (Pane's own shell\n is back in the foreground) or when an agent Pane recognizes takes the\n foreground after the report, as when a wrapper reports and then starts\n Claude. A full reset (`ESC c`) or a new shell prompt (OSC 133 `A`) ends them\n too.\n- `done` and `error` stay after the program exits and end when you type in the\n tab.\n- On Windows, in WSL, and with the separate PTY host setting on, Pane cannot\n see the foreground process, so `working`, `blocked` and `idle` don't end\n when the program exits. The other endings still apply.\n\n## Rules Pane follows\n\n- Pane reads reports in a terminal's own output only, so a program can change\n only the tab it prints in.\n- A malformed pair is skipped. A report without a known `state`, with a bad\n `id`, with base64 that does not decode, with control characters in `msg` or\n `title`, or over the spec's size limits changes nothing.\n- Pane removes format characters (direction overrides, zero-width and tag\n characters) and line separators from `msg` and `title` before showing them.\n- Pane answers the feature-detection query `ESC ] 7501 ; ? ESC \\` with\n `ESC ] 7501 ; ? ESC \\`. The reply repeats the query, as the spec defines.\n- `progress` is accepted and not shown.\n\nThe parser is `main/src/services/agentStatus/programStatus.ts`.\n"},{"path":"docs/PROJECT_ENV_VARS.md","title":"Project environment variables","text":"# Project environment variables\n\nA project can define environment variables that Pane sets in everything it starts\nfor that project's Panes: terminal panels, agent panels (Claude, Codex, Cursor or a\ncustom command), and the setup, run (Play) and archive scripts. Panes of other\nprojects never get them, and nothing is exported in your global shell.\n\nEdit them in **Project Settings → Environment Variables**. Changes apply to\nterminals and scripts started after you save; a terminal that is already open keeps\nthe environment it started with.\n\n## Plain text, Pane secret or keychain item\n\nEach variable is one of:\n\n| Source | What the project stores |\n| --- | --- |\n| Plain text | The value, in the Pane database |\n| Pane secret | Only the secret's address, `<project>/<NAME>`. The value lives in [Pane secrets](PANE_SECRETS.md), so every repo and agent that uses it shares one copy, synced to your other machines. |\n| macOS Keychain | Only the service and account of a generic-password item you already have (macOS hosts only) |\n\nFor a Pane secret row, type a value to create or replace that secret when you save;\nleave it empty to use the secret as it is. The project defaults to the repo's name\nand the secret's name to the variable's. Once saved, the value shows as `••••••••`\nwith a **Replace** button, and is never sent back to the Project Settings window.\n\nPane secrets and keychain values are read each time a process starts, so a changed\nsecret applies to the next terminal. A value is never written to the Pane database,\nlogs or analytics. Removing a variable, or deleting the project, leaves the Pane\nsecret or keychain item in place; delete a secret in Settings → Secrets.\n\nReferencing an item another app created (for example one Conductor stored) makes\nmacOS ask whether `security` may read it the first time; choose **Always Allow** so\nlater terminals open without asking. A read that waits more than 60 seconds is\ntreated as failed. Keychain variables work only when the Pane host runs macOS; on\nanother host saving one is refused with `KEYCHAIN_UNSUPPORTED`. Use a Pane secret\nthere.\n\n`runpane repos get` shows a repo's variables (plain values in full, the rest as\nreferences) and `runpane repos update --env '<json>' --env-remove NAME --yes`\nchanges them. It never takes a secret value: set one with `runpane secrets set` and\nreference it by project and name.\n\n### Who can read the value\n\nPane secrets and the keychain keep values out of your shell profile, Pane's files and\nother projects' Panes. They are not a sandbox:\n\n- Every process Pane starts for the project, including the agents, gets the value in\n its environment, and other processes running as your user can read a process's\n environment (for example with `ps eww`).\n- Any agent can use any Pane secret through `runpane secrets exec`\n ([who can read a secret](PANE_SECRETS.md#who-can-read-a-secret)).\n- On a host set to \"Everyone on tailnet\", a teammate's commands and terminals run as\n you and can reach every secret. Pane only keeps the secret and keychain variables\n out of the terminals and scripts they start.\n- An item you allowed with **Always Allow** trusts `/usr/bin/security`, so any\n process running as your user can read it without a prompt while the login\n keychain is unlocked.\n\n## Names and precedence\n\nNames use letters, digits and underscores and do not start with a digit. `PATH`,\n`WORKTREE_PATH` and anything starting with `PANE_` are reserved: Pane always sets\nthem itself, so a project cannot override them. A project variable overrides the\nsame name inherited from the environment Pane was started in, and the `TERM`,\n`COLORTERM` and `LANG` defaults Pane gives terminals. Your shell's startup files run\nafter that, so an `export` in `~/.zshrc` still wins inside a terminal.\n\nIn WSL projects the variables are added to `WSLENV`, so they reach the Linux shell.\n\n## When a value cannot be read\n\nThe terminal or script still starts, without that variable. After the shell's first\nprompt, the terminal shows a `[Pane]` line naming the variable, the secret or item,\nand the reason (a missing secret, a locked keychain); setup and archive scripts\nwrite the same line to the Pane's logs. The value is never printed. Set the secret\nin Settings → Secrets, fix the item in Keychain Access, or change the variable in\nProject Settings, then open a new terminal.\n\n## Example\n\nA repository's `.mcp.json` reads `${UIVERIFY_API_KEY}`. Add `UIVERIFY_API_KEY` to\nthat project as a Pane secret (type the value, or point it at a secret you already\nhave, such as `qa/UIVERIFY`), and every agent started in one of its Panes sees it,\nwhile other projects and your login shell do not.\n"},{"path":"docs/QR_PAIRING.md","title":"Add a device","text":"# Add a device\n\nPair a phone, a browser or another computer with Pane, on any network. No\naccount, no Tailscale, no port forwarding.\n\nOpen **Add a device** from **Settings › Remote Access**, from **Add a\ndevice…** in the sidebar's machine menu, or with **Pair a device** on Home,\nwhich opens on the **Phone** tab. It has four tabs:\n\n| Tab | What it does |\n|---|---|\n| **Phone** | Shows a QR code to scan with your phone. |\n| **Computer** | Copies a one-time link for another computer, a phone or a browser, or takes a link copied on another computer. |\n| **SSH** | Reaches a computer through your own SSH config and starts Pane there. See [SSH route](SELF_HOSTED_REMOTE_DAEMON.md#ssh-route). |\n| **Wearables** | Shows a QR code that opens the glasses screen in the Pane phone app. |\n\n## Pair a phone\n\n1. On the computer, open **Add a device › Phone**.\n2. Point your phone's camera at the code.\n3. Tap the link. It opens the Pane app, or Pane in the phone's browser when\n the app is not installed.\n\nThe iPhone app is in TestFlight. To get it, ask to join on\n[Discord](https://discord.gg/BdMyubeAZn); the dialog and the pairing page\nlink there.\n\nThe phone shows the computer's sessions a few seconds later. A QR code works\nonce and expires after 10 minutes; the dialog shows a new one after each use.\n\nPhone access is this computer's connection to Pane's relay, which phones,\nbrowsers and links use. Opening the Phone or Computer tab turns it on. If you close it before a code ever appears (for example after \"Can't reach ...\"), Pane turns phone access\nback off, so it doesn't keep retrying in the background.\n\nInside the Pane app you can also scan from **Settings › Add a machine**.\nThe app still accepts `pane-remote://` connection codes.\n\n## Link another computer\n\n1. On the first computer, open **Add a device › Computer**, pick how long the\n link lasts under **Expires after**, and choose **Copy link**.\n2. Send the link to the other computer and open it there in a browser. The\n page opens desktop Pane (**Open Pane**), which links the two.\n Or paste the link into **Add a device › Computer › Or finish here** on the\n other computer.\n3. The first computer shows **Linked with &lt;computer&gt;**. If you don't\n know that computer, choose **Not you? Unlink &lt;computer&gt;**. That undoes\n the link: your computers and the ones it brought stop reaching each other,\n and each group stays as it was before.\n\nOn a computer with no screen, run `runpane link '<link>'` instead. It asks\nbefore linking (see [When a link asks first](#when-a-link-asks-first)); in a\nscript, pass `--yes`.\n\nBoth computers need Pane open with phone access on, and the same relay.\nOpening **Add a device › Computer** on each turns phone access on. The same\nlink also works on a phone or in a browser, as a QR code does.\n\nA link works once. It expires after the time chosen when it was copied:\n\n| Made from | Expires after |\n|---|---|\n| **Add a device › Phone** (QR code) | 10 minutes |\n| **Add a device › Computer** (copied link) | 10 minutes, 1 hour (the default) or 24 hours |\n\n## Your computers\n\nLinking joins two groups of computers. Every computer in either group can\nthen reach every other one, on every route it has, and run agents there.\nAfter that:\n\n- a new phone that pairs with any one of them gets all of them;\n- each computer lists the others in **Settings › Remote Access › Computers**\n and the sidebar's machine menu, for ports and `runpane workspace`;\n- alerts from any of them reach every phone.\n\nA phone that already reaches computers links them with the new computer's\ngroup when it pairs, after asking (below).\n\n**Settings › Remote Access › Computers** shows each computer once, with a\npill for every route Pane can reach it on and a dot on the route in use.\nExpand a row to see its routes in order, drag them to reorder, add one with\n**Add route** (it opens **Add a device › Computer**), and see who linked it (\"Linked by Ana's iPhone\"). **Also linked** lists\ncomputers that reach this one but that this one doesn't list; link them back\nto reach them from here. **Settings › Remote Access › Phones and glasses**\nlists phones and glasses.\n\nA browser reaches the computer whose link it opened, plus the computers\nalready linked with it. A browser never links computers with each other: each\ncomputer's browser app keeps its own list.\n\n## When a link asks first\n\nA computer always asks before it uses a link, unless it already reaches the\ncomputer that made the link: once linked, that computer can run agents on it.\nA phone or browser asks when it already reaches computers and the link comes\nfrom a computer it doesn't reach yet. A phone or browser that reaches no\ncomputers yet pairs without asking, since pairing gives it access and nothing\nback. The prompt names the computers on both sides. The link's computer sends\nits own list, so that list never skips the prompt.\n\nThis holds on desktop Pane, the phone app, a browser and `runpane link`.\n**Not mine, cancel** links nothing, and the link stays unused for another\ndevice until it expires.\n\n## Routes\n\nPane reaches each computer by up to five routes, tried nearest first:\n\n| Route | How Pane gets it |\n|---|---|\n| **Same network** | The computer reports its private addresses. Pane tries one only when it is on a subnet of the computer trying it, so another home network or a WSL, Docker or VM adapter costs no wait. |\n| **Tailscale** | Both computers are on your tailnet. See [Workspaces](RUNPANE_WORKSPACES.md). |\n| **SSH** | **Add a device › SSH**. See [SSH route](SELF_HOSTED_REMOTE_DAEMON.md#ssh-route). |\n| **Public URL** | The computer has its own HTTPS address. See [Public URL](SELF_HOSTED_REMOTE_DAEMON.md#public-url). |\n| **Pane relay** | A link or QR code. Pane's servers pass the connection along. |\n\nEach computer reports its own routes when Pane connects to it, and Pane saves\nthem as \"found automatically\" when they are `https:` addresses. A link's\ncredential works on every route, so a found route needs no new pairing.\n\nEach route proves it reaches the right computer its own way. Pane relay and\nSame network routes check the computer's own key. A Tailscale route relies on\nTailscale's device identity, and a Public URL route on its HTTPS certificate:\nTailscale and your proxy end the encrypted connection with their own\ncertificates, so the computer's key never reaches the other side there. An SSH\nroute relies on SSH's host key check.\n\nPane connects on the first route that answers. When the connection goes\nsilent for 8 seconds, Pane checks the other routes and moves to the first that\nanswers, before the connection banner appears and without closing your Panes.\nWhen none answers, Pane reconnects as it always does, after 12 seconds without\na heartbeat. While\non a farther route, Pane checks the nearer ones every minute, and when the\nnetwork changes or the computer wakes, and moves back to the first that\nanswers.\n\n## How the relay connects\n\nEach computer gets its own address, `https://<id>.runpane.net`, with its own\ncertificate. The computer holds the private key; it never leaves the\ncomputer.\n\n- **Same Wi-Fi:** the Pane app and desktop Pane connect to the computer\n directly.\n- **Anywhere else:** Pane's servers in the central and western US, the EU\n and Asia pass the encrypted connection along without reading it. The Pane\n app and desktop also find a direct internet path when both networks allow\n it, the way Tailscale does.\n\nPane's servers see which computer a connection is for, IP addresses, timing\nand byte counts. They never see what you type, what your agents print, your\ntokens or your pages. On the relay, the Pane app and desktop also check each\ncomputer's key, so a certificate issued for the same name to anyone else is\nrefused.\n\n## What works\n\nEverything the Tailscale path does: terminals, agents and approvals, alerts\nwhen an agent needs you, dev server previews and HTML files on the phone, and\nthe files in a worktree. Another computer reaches the same computer for\nswitching to it, forwarded ports and `runpane workspace`, and glasses pair\nthrough a paired phone.\n\n## Pair glasses\n\nGlasses pair through the Pane phone app. **Add a device › Wearables** shows a\nQR code for `https://runpane.net/glasses` (your own relay's domain when you\nrun one). Scanning it with the phone opens **Settings › Glasses** in the Pane\napp; without the app, the page says how to get it. See\n[Even G2 glasses](EVEN_G2_GLASSES.md).\n\n## Share a computer with a teammate\n\nA teammate scans a fresh code from your computer, as you do. Their phone gets\nits own sign-in, listed under **Phones and glasses** by its name, and can do\nwhat yours does there, pairing glasses included. Because computers are linked,\nit also reaches every computer linked with this one, and, once they confirm,\nlinks this computer with any computer their phone already paired.\n**Remove › Remove from &lt;this computer&gt;** signs out only their phone,\nonly here; **Remove from all your computers** signs it out of\nevery computer it reached through yours.\n\n## Remove a phone or a computer\n\n- **Remove › Remove from &lt;this computer&gt;**, on a phone's row under\n **Phones and glasses**, signs it out of this computer only.\n- **Remove from all your computers** signs it out everywhere. Its open\n connections close within seconds. The Pane app shows **Pair again**; a\n browser says the computer removed it and to scan a new code on that\n computer.\n- Removing a phone also undoes the links it made: computers that phone linked\n stop reaching each other, along with the phones they shared it with. That\n keeps a lost or stolen phone from leaving a way back in. To link them again,\n pair one phone with each of them.\n- **Unlink from all your computers**, in a linked computer's expanded row,\n removes that computer from every computer's and phone's list, and the\n phones you paired through it lose access to it. The other computers in the\n group stay linked with each other. A computer also on your\n tailnet stays as a Tailscale row.\n- **Forget**, on a computer with no Pane relay route, removes it from this\n computer's list only.\n\n## When something goes wrong\n\n- **\"This code was already used\" or \"This code expired\":** scan the new code\n the computer shows, or copy a new link.\n- **\"Phone access is off on this computer\":** on the computer that opens the\n link, open **Add a device › Computer** once, then open the link again.\n- **\"&lt;computer&gt; is already linked here with a different key\":** that\n computer was reinstalled. Unlink it, then copy a new link.\n- **\"&lt;computer&gt; uses the relay … and this computer uses …\":** set both\n computers to the same relay.\n- **\"Reconnecting to &lt;computer&gt;…\":** every route failed. The app keeps\n retrying while it is open, at least every 5 seconds (once a minute after an\n hour without reaching it); nothing to do. On the same Wi-Fi it connects\n directly even when the internet is down.\n- **\"Asleep since 9:40\":** the computer is asleep. Wake it, or turn on Keep\n Awake.\n- **A browser on a Wi-Fi with no internet** can't reach the computer: a\n browser needs internet DNS. Open the Pane app instead.\n- **\"Phones can't connect: this computer's phone listener isn't running\":**\n another app (often a second Pane) holds the listener's port. Quit that app,\n or give the listener a free port in **Settings › Remote Access › Tailscale ›\n Advanced**. Until then the computer turns phones away.\n\n## Use your own relay\n\nRun a relay on your own machine and domain in a few minutes with Docker\n([Run your own relay](SELF_HOSTED_RELAY.md)), then set **Settings › Remote\nAccess › Phones and glasses › Relay address** to its domain. Pane connects\nthere instead of Pane's servers, and everything above works the same, on the\nsame Wi-Fi and from anywhere. Computers link only with computers on the same\nrelay.\n\n## Tailscale\n\nTailscale is one of the routes. **Settings › Remote Access › Tailscale** sets\nwho can connect over it, a password, hosts and connection codes. See\n[Workspaces](RUNPANE_WORKSPACES.md) and\n[Self-hosted remote daemon](SELF_HOSTED_REMOTE_DAEMON.md).\n"},{"path":"docs/RUNPANE_BUNDLED_CLI.md","title":"Bundled runpane on terminal PATH","text":"# Bundled runpane on terminal PATH\n\nEvery terminal Pane launches (Session orchestrators, agent panels, plain\nterminals, and run scripts) can call `runpane` without a global install. The\ncommand always matches the running Pane build. The installed app also adds the\nsame command to the end of your own `PATH`, so it works in any terminal.\n\n## How it works\n\n- `pnpm build:main` bundles `packages/runpane/src/cli.ts` into\n `main/dist/runpane/runpane.cjs` (`main/build-runpane-cli.js`). It ships\n inside the app with the rest of `main/dist`, and `pnpm dev` builds it\n through `pnpm build:main`. The bundle embeds its version and docs search\n index, so both still work after the single file is copied out of the app.\n- At startup (`createPaneDaemonHost`, which both the desktop app and the\n headless daemon use), Pane copies that file to `<PANE_DIR>/bin/runpane.cjs`\n and writes a `<PANE_DIR>/bin/runpane` shim (plus `runpane.cmd` on Windows).\n The shim runs the CLI with Pane's own Electron binary as Node\n (`ELECTRON_RUN_AS_NODE=1`) and defaults `PANE_DIR` to that Pane data\n directory. Files are rewritten only when their content changes. Pane never\n follows a symbolic link there or overwrites a file it did not write.\n- If that Electron binary is gone (a failed update, or the app was moved), the\n shim runs the CLI with `node` from `PATH` instead. Without `node`, it prints\n one line: reinstall Pane from https://runpane.com, or install Node.js and\n run `npx --yes runpane@latest update`. It exits 127 (`runpane.cmd`: 1). When Pane is not running,\n `runpane update` installs the latest release instead of updating in place,\n so it works in this state.\n- Beside it, `<PANE_DIR>/bin/pane-node` (plus `pane-node.cmd` on Windows)\n runs any script with the same binary as Node, or `node` from `PATH` when the\n binary is gone, so bundled skill scripts such as the Session status page\n renderer work on a machine without Node. In WSL it starts the Windows binary\n through interop and converts path arguments to Windows paths. On Linux, both\n shims use `$APPIMAGE` when Pane runs as an AppImage, since its `execPath` is\n a per-launch mount.\n- The shim checks only that the binary exists and is executable. If the\n binary exists but crashes on launch, `runpane` fails with it; run\n `npx --yes runpane@latest update` to reinstall Pane.\n- Terminal launches put `<PANE_DIR>/bin` first on `PATH` and export\n `PANE_RUNPANE_BIN` with the shim's absolute path. User startup files can\n rebuild `PATH`, so supported shells re-apply it afterwards:\n - **zsh:** `ZDOTDIR` points at `<PANE_DIR>/shell/zsh`. Each wrapper file\n sources the user's matching file from their own `ZDOTDIR` (or `$HOME`),\n then the last one moves `<PANE_DIR>/bin` to the front and restores the\n user's `ZDOTDIR`. A `precmd` hook keeps it first when tools such as direnv\n or nvm edit `PATH` before a prompt. History stays in the user's\n `.zsh_history`.\n - **bash:** `--rcfile <PANE_DIR>/shell/bash/rcfile` sources\n `/etc/bash.bashrc` and `~/.bashrc` (what an interactive non-login bash\n normally reads), then moves the directory to the front and adds a\n `PROMPT_COMMAND` hook.\n - **fish:** `--init-command` runs after the user's config and adds a\n `fish_prompt` handler.\n - **Other shells, Windows, run scripts, and `runpane workspace <machine> exec`:**\n `PATH` is prepended only. For exec this matters most: the command runs\n with Pane's own environment, which can predate the user `PATH` entry Pane\n adds at startup, and remote daemon hosts never get that entry (see\n [Every other terminal](#every-other-terminal)).\n - **WSL terminals:** see below.\n\n## WSL terminals\n\nOn Windows, WSL shells use the same `<PANE_DIR>/bin/runpane` shim, read\nfrom the distro as `/mnt/c/...`. Nothing is installed in the distro. Pane's\nWSL terminals put it first on `PATH`; in other WSL shells it comes from the\nWindows `PATH` (see [Every other terminal](#every-other-terminal)).\n\n- The daemon listens on a Windows named pipe, which Linux processes cannot\n open (a distro `node` gets `ENOENT`). So inside WSL (`WSL_DISTRO_NAME` is\n set) the shim runs Pane's Windows Electron binary through WSL interop, with\n `ELECTRON_RUN_AS_NODE` and `PANE_DIR` added to `WSLENV`. The CLI is then a\n Windows process on the same pipe as Windows terminals. A call takes about\n 0.4 s.\n- Pane already lists the terminal's `PANE_*` variables in `WSLENV`, so they\n reach the CLI. Its working directory is the Windows form of the shell's\n (`\\\\wsl.localhost\\<distro>\\...`, or `C:\\...` under `/mnt/c`).\n- The shim converts Linux paths to Windows paths with `wslpath -w`: an\n absolute `PANE_DIR`, the values of path flags such as `--file`,\n `--prompt-file` and `--pane-dir` (also in `--flag=value` form), and a\n path-like `--repo` value. Arguments after `--` pass through unchanged. The\n flag list is shared with the WSL Session bridge (`RUNPANE_PATH_FLAGS` in\n `main/src/utils/wslUtils.ts`).\n- WSL terminals start bash with `--rcfile <PANE_DIR>/shell/bash/wsl-rcfile`\n instead of `--login`. The rcfile reads the files a login bash reads\n (`/etc/profile`, then the first of `~/.bash_profile`, `~/.bash_login`,\n `~/.profile`), then puts the bin directory (via `/bin/wslpath -u`) first on\n `PATH`, exports `PANE_RUNPANE_BIN`, and adds a `PROMPT_COMMAND` hook. The\n shell is interactive but not a login shell, so use `exit`, not `logout`. If\n the distro cannot read the rcfile, the terminal starts `bash --login` as\n before.\n- With interop off, `runpane` prints how to turn it back on (`[interop]\n enabled=true` in `/etc/wsl.conf`) and exits 126.\n- If Pane's Electron binary is gone, `runpane` prints one line asking you to\n reinstall Pane and exits 127. There is no `node` fallback in WSL, because a\n distro `node` cannot open the named pipe.\n- A Windows command line is limited to 32,767 characters. Pass long text with\n a file flag such as `--prompt-file` instead of inline.\n- WSL Sessions keep their own `.pane-runtime/runpane` bridge, which runs the\n CLI through PowerShell and pins it to the Session\n ([SESSIONS.md](SESSIONS.md)).\n\n## Every other terminal\n\nAt startup, the installed Pane appends `<PANE_DIR>/bin` (normally\n`~/.pane/bin`) to the end of your own `PATH`. It appends rather than prepends,\nso a `runpane` you installed with npm comes first outside Pane; when it is the\nolder one, it runs Pane's CLI instead (see\n[Existing global installs](#existing-global-installs)).\n\n- **macOS and Linux:** Pane appends a block marked `pane-runpane-path v1` to\n the startup files of your login shell. The block adds the directory only if\n `PATH` does not already contain it.\n - zsh: `.zshenv`, which zsh reads in every shell, in your `ZDOTDIR` (as\n zsh reports it after `/etc/zshenv`) or else `~` (created if missing)\n - bash: `~/.bashrc`, plus on macOS the login file bash reads: the first of\n `~/.bash_profile`, `~/.bash_login` and `~/.profile` that exists. Pane\n creates `~/.bash_profile` only when none exists, because a new\n `~/.bash_profile` would stop bash reading the others.\n - fish: `$XDG_CONFIG_HOME/fish/conf.d/pane.fish` (default `~/.config`)\n - On macOS, that existing bash login file also gets the block when your\n login shell is not bash.\n\n Pane skips a file that is a symbolic link or already has the block, and\n keeps a file's permissions. If a file cannot be written, Pane logs it, tries\n the others, and retries it at the next start. New terminals pick it up; run\n `exec $SHELL -l` in an open one.\n- **Windows:** Pane appends the directory to your user `PATH`\n (`HKCU\\Environment\\Path`, no administrator rights), keeping the value's\n type (`REG_EXPAND_SZ` or `REG_SZ`), and broadcasts `WM_SETTINGCHANGE`.\n Terminals opened afterwards find `runpane`; already open ones keep their\n old `PATH`.\n- **WSL:** Pane writes nothing into the distro. WSL appends the Windows\n `PATH` by default, so every WSL shell finds Pane's shim at\n `/mnt/c/Users/<you>/.pane/bin/runpane`, and it reaches Windows Pane as\n described in [WSL terminals](#wsl-terminals). A `runpane` installed in the\n distro comes first on `PATH` there. When it is older than Windows Pane's\n CLI, it runs that shim; otherwise it runs itself and cannot reach Windows\n Pane.\n- **Remote daemon hosts** (`runpane install daemon`): unchanged. Only the\n desktop app edits `PATH`; on a server, install `runpane` with npm.\n\nPane changes each file, and the Windows `PATH`, at most once, and records\nwhat it changed in `<PANE_DIR>/bin/user-path.json`. Pane skips all of this when\n`PANE_DISABLE_OS_INTEGRATION=1` is set, when it runs with a non-default data\ndirectory (`--pane-dir`, `PANE_DIR` or `FOOZOL_DIR`), and in development\nbuilds.\n\nTo remove it, delete the lines from `# pane-runpane-path v1` through\n`# end pane-runpane-path v1` (or delete `pane.fish`). On Windows, remove the\n`.pane\\bin` entry under Settings > System > About > Advanced system settings >\nEnvironment Variables > User variables > Path. Pane does not add it again.\n\n## Existing global installs\n\nA globally installed `runpane` (`npm i -g runpane`) comes first in other\nterminals, because Pane appends its directory after it. Inside Pane terminals, Pane's shim resolves first because it\nmatches the running build's local-control contract. Use `$PANE_RUNPANE_BIN`\nto call it by absolute path.\n\nAn npm `runpane` older than Pane's CLI hands each invocation to Pane's CLI,\nwith the same arguments, stdin, stdout, stderr and exit code\n(`packages/runpane/src/managedCli.ts`):\n\n- Pane's CLI is the one in `<dir>/bin`, where `<dir>` is the invocation's\n `--pane-dir` (before any `--`), else `PANE_DIR`: the version pinned by\n `runpane update` in `runpane-override.json`, else the version line\n (`// runpane-version <version>`) that `main/build-runpane-cli.js` writes at\n the top of `runpane.cjs`. A pin whose runtime or entry point is gone does\n not count (Windows paths seen from WSL are left to the shim). Without `--pane-dir` or `PANE_DIR`, the npm CLI also\n looks for a Pane-managed shim on `PATH`, which is how a distro `runpane`\n finds Windows Pane's under WSL.\n- On macOS, Linux and WSL it runs the `runpane` shim with `/bin/sh`. On\n Windows it runs the pinned runtime and entry point directly, or\n `runpane.cjs` with its own Node, so no argument passes through `cmd.exe`.\n- The npm CLI runs itself when there is no Pane install, when it is the same\n version or newer, or when the hand-off cannot start.\n- The hand-off sets `RUNPANE_NO_HANDOFF=1` for the CLI it runs, so it happens\n at most once. Set it yourself to run a specific npm version. `runpane\n update` sets it for the version checks of the CLI it stages and installs.\n- Signals sent to the npm CLI's pid reach Pane's CLI once. From a terminal,\n Ctrl-C and Ctrl-\\ reach both through their shared process group; without a\n terminal on stdin, Pane's CLI runs in its own process group and the npm CLI\n forwards every signal.\n\n`runpane doctor` lists every `runpane` on `PATH` in resolution order, with its\nversion and origin (Pane-managed, npm global with its prefix, or other), under\n`cliInstalls` in `--json`. It warns, with the command that fixes it in `fix`:\n\n- `RUNPANE_STALE_INSTALL`: an npm install is older than Pane's CLI. Fix:\n `npm i -g --prefix <prefix> runpane@<version>`.\n- `RUNPANE_STALE_UNMANAGED`: a `runpane` that neither npm nor Pane installed\n comes before Pane's CLI and is older or of unknown version. Fix: remove it.\n- `RUNPANE_STALE_MANAGED`: another Pane-managed `runpane` on `PATH` is older\n than Pane's CLI. Fix: `<its dir>/bin/runpane update --pane-dir <its dir>`.\n- `RUNPANE_MANAGED_BEHIND`: an npm install or another Pane-managed `runpane`\n is newer than Pane's CLI. Fix: `<PANE_DIR>/bin/runpane update --pane-dir\n <PANE_DIR>`, which updates Pane's CLI (`runpane update` updates the CLI\n that runs it).\n\n`runpane doctor --fix` runs the `RUNPANE_STALE_INSTALL` fixes, reports each\nunder `fixed`, then checks again. It never removes a file. The Python CLI\npoints `--fix` at the npm CLI.\n\nSeveral Pane builds that share one `PANE_DIR` (for example a dev build and\nthe installed app, both on `~/.pane`) rewrite the same shim at startup; the\nmost recently started build wins. Use `PANE_DIR=~/.pane_test pnpm dev` to keep\nthem apart.\n"},{"path":"docs/RUNPANE_CLI_CONTRACT.md","title":"Runpane CLI Contract","text":"# Runpane CLI Contract\n\n<!-- Generated by scripts/generate-runpane-contract.js. Do not edit generated sections by hand. -->\n\n`runpane` is a thin installer and configurator for Pane. The npm and PyPI\npackages expose the same command contract and download the real Pane release\nartifact at command runtime.\n\nThe packages must not download, install, or configure Pane during package installation.\nWork starts only when a user runs `runpane ...`.\n\n## Maintainer Rules\n\n- Treat `contracts/runpane/contract.json` as the source of truth for both wrapper packages and generated docs.\n- Every command, flag, platform default, artifact-selection rule, and attribution rule change must be reflected in the contract.\n- The npm and PyPI wrappers must expose the same command behavior unless the contract explicitly documents a package-manager-specific difference.\n- Root `README.md` and package READMEs should lead with one guided quick-start command. Explicit commands, package-manager variants, and flags belong in an Advanced section.\n- Release version bumps must keep root `package.json`, `packages/runpane`, and `packages/runpane-py` versions in sync. Run `pnpm run check:runpane-package-versions` before release.\n- `pnpm run test:runpane-contract` must pass before changing wrapper command parsing, help output, platform defaults, release asset selection, or generated contract artifacts.\n- Token-based npm or PyPI publishing is a temporary fallback. Prefer trusted publishing once the package names are reserved and trusted publishers are configured.\n\n## Compatibility Floors\n\nThe npm wrapper requires Node.js `^22.23.4 || ^24.22.1 || ^26.12.1`, matching the root development baseline.\nThe CLI rejects unsupported runtimes before dispatching commands and before staging an independent updater runtime.\n\nThe Pane-managed CLI also accepts the audited Electron 43.8.3 / embedded Node 24.22.0 pair, whose CA backport passed actual TLS probes. This does not support standalone Node 24.22.0; independent updater runtimes must satisfy the standalone ranges.\n\nThe PyPI wrapper should run on Python `>=3.8` and newer. Keep runtime dependencies\nout of the wrapper unless a compatibility test covers the new dependency.\n\n## Public Terminology\n\n- `repo`: Saved Pane repository/project record\n- `pane`: User-visible Pane session\n- `tool`: Terminal-backed tab\n- `agent`: Built-in agent command template\n\n## Package Manager Entrypoints\n\nRecommended guided quick starts:\n\n```bash\nnpx --yes runpane@latest\nnpm i -g runpane && runpane setup\npipx run runpane\npython -m pip install runpane && python -m runpane setup\n```\n\nCanonical npm and Node commands:\n\n```bash\nnpx --yes runpane@latest\nnpx --yes runpane@latest setup\nnpx --yes runpane@latest install client\nnpx --yes runpane@latest install daemon --label \"My Server\"\npnpm dlx runpane@latest\npnpm dlx runpane@latest install daemon --label \"My Server\"\nnpm i -g runpane && runpane\nnpm i -g runpane && runpane setup\nnpm i -g runpane && runpane install daemon --label \"My Server\"\npnpm add -g runpane && runpane\npnpm add -g runpane && runpane setup\npnpm add -g runpane && runpane install daemon --label \"My Server\"\nyarn dlx runpane@latest install daemon --label \"My Server\"\nbunx runpane@latest install daemon --label \"My Server\"\n```\n\nCanonical Python commands:\n\n```bash\npipx run runpane\npipx run runpane setup\npython -m pip install runpane\nrunpane\nrunpane setup\npython -m runpane setup\nrunpane install daemon --label \"My Server\"\npipx install runpane\nrunpane\nrunpane setup\npipx run runpane install daemon --label \"My Server\"\nuvx runpane@latest\nuvx runpane@latest setup\nuvx runpane@latest install daemon --label \"My Server\"\npython -m runpane install daemon --label \"My Server\"\n```\n\nUse `pnpm dlx` for one-shot pnpm execution and `pnpm add -g` for persistent CLI installation.\nDo not document `pnpm install runpane` as the public CLI install path.\n\n## Commands\n\n```bash\nrunpane\nrunpane setup\nrunpane install\nrunpane install client\nrunpane install daemon\nrunpane update\nrunpane version\nrunpane doctor\nrunpane doctor --json\nrunpane daemon repair --pane-dir ~/.pane_remote --yes --json\nrunpane agent-context\nrunpane agent-context --command \"panes create\" --json\nrunpane mcp\nrunpane repos list --json\nrunpane repos add --path /path/to/repo --name Pane --yes --json\nrunpane repos get --repo Pane --json\nrunpane repos update --repo Pane --build-script \"pnpm install\" --run-script \"pnpm dev\" --worktree-folder ../pane-worktrees --yes --json\nrunpane repos update --repo Pane --clear run-script --yes --json\nrunpane repos update --repo Pane --env '[{\"key\":\"API_URL\",\"source\":\"plain\",\"value\":\"https://api.test\"},{\"key\":\"STRIPE_KEY\",\"source\":\"secret\",\"project\":\"stripe\",\"name\":\"STRIPE_SECRET_KEY\"}]' --env-remove OLD_TOKEN --yes --json\nrunpane repos rename --repo 3 --name Lev --yes --json\nrunpane secrets list --json\nprintf %s \"$VALUE\" | runpane secrets set --project stripe --name STRIPE_SECRET_KEY --yes\nrunpane secrets delete --project stripe --name STRIPE_SECRET_KEY --yes --json\nrunpane secrets exec --project stripe --only STRIPE_SECRET_KEY -- pnpm test:webhooks\nrunpane secrets request --project stripe --name STRIPE_SECRET_KEY --title \"Stripe test secret key\" --reason \"Run the webhook tests against Stripe test mode.\" --json\nrunpane panes list --repo active --json\nrunpane panes cost --pane <pane-id> --json\nrunpane panes create --repo active --name issue-252 --agent <agent> --prompt \"Kick off the discussion skill for issue 252\" --source agent --no-focus --wait-ready --yes --json\nrunpane panes create --from-json panes.json --yes --json\nrunpane panes archive --pane <pane-id> --source agent --yes --json\nrunpane panes rename --pane <pane-id> --name issue-393 --yes --json\nrunpane panels list --pane <pane-id> --json\nrunpane panels output --panel <panel-id> --limit 200 --json\nprintf 'Continue\\n' | runpane panels input --panel <panel-id> --input-file - --yes --json\nrunpane sessions list [--json] [--pane-dir <path>]\nrunpane sessions create --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions get --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions update --session <id|name> --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions pin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions unpin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions set-agent --session <id|name> --agent <codex|claude|cursor|opencode|pi> [--json] [--pane-dir <path>]\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane sessions detach --session <id|name> [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane sessions overview --session <id|name> [--json] [--pane-dir <path>]\nrunpane lock acquire --name testing-account --ttl 30m --wait 1800000 --note \"call QA\" --json\nrunpane lock release --name testing-account --json\nrunpane lock list --json\nrunpane machine health --json\nrunpane machine cleanup --kind update-snapshot --json\nrunpane machine cleanup --kind update-snapshot --yes --json\nrunpane loops create --repo active --name nightly-bug-sweep --cron \"0 3 * * *\" --agent claude --prompt \"Fix one bug from yesterday's issues\" --yes --json\nrunpane loops list --json\nrunpane loops run --loop <loop-id> --yes --json\nrunpane agents start --repo active --name fix-login --agent claude --prompt \"Fix the login redirect\" --yes --json\nrunpane agents start --pane <pane-id> --agent codex --prompt \"Review the PR from this branch and report findings\" --yes --json\nrunpane agents status --pane <pane-id> --json\nrunpane agents send --pane <pane-id> --text \"Also add a test\" --yes --json\nrunpane report --state ready --pr 747 --head fc5dce9 --summary-file /tmp/report.md --json\nrunpane panels last-message --panel <panel-id> --json\nrunpane panels conversation --conversation <id> --source resume --json\nrunpane panels close --panel <panel-id> --yes --json\nrunpane panels resume --panel <panel-id> --wait-ready --yes --json\nrunpane panels resume --session <id|name> --wait-ready --yes --json\nrunpane panes pause --pane <pane-id> --yes --json\nrunpane panes resume --pane <pane-id> --yes --json\nrunpane docs search --query \"archive a pane\" --json\nrunpane links create --pane <pane-id> --json\nrunpane panes git-status --pane <pane-id> --json\nrunpane help\nrunpane <command> --help\nrunpane watch --until-event\nrunpane watch --follow\nrunpane watch --session <id|name> --follow\nrunpane watch --session <id|name> --follow --ready-settle 1m --blocked-settle 15s --min-interval 2m\nrunpane pr watch [--pane <id>] --url <PR URL> [--head <full-sha>] [--json] [--pane-dir <path>]\nrunpane pr unwatch [--pane <id>] --url <PR URL> [--json] [--pane-dir <path>]\nrunpane pr list [--pane <id>] [--json] [--pane-dir <path>]\n```\n\n`runpane` with no arguments and `runpane setup` open an interactive wizard when stdin and stdout are TTYs. The remote-host wizard asks only for a name, then runs interactive Tailscale setup with automatic port selection; explicit install daemon flags remain available for SSH and manual URLs. In non-interactive shells or CI, both forms must print help, common commands, and agent discovery hints, then exit successfully instead of waiting for input.\n\n`runpane install` is an alias for `runpane install client`.\n\n`runpane install client` downloads the selected Pane desktop artifact and installs, opens, or launches it for the current platform.\n\n`runpane install daemon` downloads or installs Pane, resolves a stable Pane executable path, and spawns `<pane executable> --remote-setup <forwarded remote setup args>`.\n\nThe wrapper must stream Pane stdout/stderr without reformatting because `pane --remote-setup` prints the one-time `pane-remote://...` connection code.\n\n`runpane update` defaults to both app and active supported CLI, with independent supervision, staging, durable status, and explicit restoration outcomes. Prerequisites, status fields/exit codes, draft handling and manual recovery are documented in [Update recovery](UPDATE_RECOVERY.md).\n\n`runpane version` prints only wrapper package metadata and does not contact, launch, or focus the Pane app or daemon.\n\n`runpane doctor` opens with Pane's intro (\"For people\" and \"For agents\", the sentence about reaching the person following the Approvals setting) and the working rules (Session, Pane, Tab, Scratch), also in `--json` as `intro` and `workspaceRules`. It then checks platform support, release metadata reachability, download URL selection, installed Pane detection, daemon reachability, every `runpane` on `PATH` against the Pane-managed CLI, and remote-daemon hints. `--fix` updates npm installs of `runpane` older than the Pane-managed CLI to its version and never removes a file. Add `--json` for a machine-readable report that agents should run before mutating Pane state. Installed app version detection must be best-effort and must not launch, focus, or configure Pane; macOS wrappers read app bundle metadata instead of executing `Pane --version`.\n\n`runpane daemon repair` rewrites and restarts only the managed remote-daemon launcher/service. It never creates pairing credentials, changes tunnels, or downloads Pane; doctor only recommends it and never runs it automatically.\n\n`runpane agent-context` prints a brief, token-efficient command schema for coding agents without connecting to the Pane daemon.\n\n`runpane agent-context --command \"panes create\"` prints the detailed definition for one command. Add `--json` for machine-readable output. An unknown command exits 2 and lists the closest command names; with `--json` it prints `{ ok: false, code: \"unknown_command\", message, candidates }` on stdout.\n\n`runpane mcp` runs a stdio MCP server whose tools are generated from this contract: every command with result `jsonSchemas` becomes a tool that runs `runpane <command> --json` and returns its output. Only the npm package and the Pane app include it; the Python wrapper prints how to run it with Node and exits non-zero.\n\n`runpane repos list` connects to the running local Pane daemon and prints saved repository records.\n\n`runpane repos add` registers an existing git repository with the running local Pane daemon. It does not create directories or initialize git repositories by default.\n\n`runpane repos get` prints a saved repository's Project Settings. Each script shows its saved value, the fallback from the repository's config file, and the one Pane will run.\n\n`runpane repos update` changes a saved repository's Project Settings through the same save as the Project Settings dialog. It requires `--yes`, supports `--dry-run`, clears settings with `--clear`, and adds, replaces or removes project environment variables with `--env` and `--env-remove`.\n\n`runpane repos rename` trims and sets a saved repository's display name, the same rename as the repository settings in the app, and returns the updated repository record.\n\n`runpane secrets` manages Pane secrets: named values, addressed as `<project>/<NAME>`, that every machine saved in Pane keeps a copy of. `list` shows names, times and machines only. `set` reads the value from stdin. `delete` removes one everywhere. `exec` runs a command with secrets in its environment and returns its exit code. `request` asks the person on a masked Notify card and returns only `saved` or `declined`. No command prints a value, and the MCP server has no tool that sets or reads one. These commands run on the machine itself, so `runpane workspace <machine> secrets ...` is refused; use `runpane workspace <machine> exec -- runpane secrets ...`.\n\n`runpane panes list` lists Pane sessions, optionally scoped to one saved repository.\n\n`runpane panes cost` reports estimated token costs per Pane for the last 30 days, including per-model breakdowns and cache efficiency; unscoped output includes an Unattributed bucket that reconciles against workspace totals.\n\n`runpane panes create` connects to the running local Pane daemon, resolves the requested saved base repository, creates user-visible Pane sessions backed by Pane-managed worktrees/branches, opens terminal-backed tool tabs, and optionally sends initial input to the started tool. Built-in agent panes and `--source agent` default to background/no-focus unless `--focus` is passed. New Panes are pinned into the UI's favorite/pin set by default, except when the CLI runs inside a Session orchestrator (`PANE_ORCHESTRATION_SESSION_ID`), where child worktrees default to unpinned. Explicit `--pinned` / `--no-pinned` override creation defaults. First Session association clears an existing pin, including an explicit creation pin; use `panes pin` after association to pin a child. This avoids duplicating Session children in the global pinned list. Manual pins applied afterward are preserved. Panes created interactively in the Pane UI are unaffected. New Panes join the caller's Session automatically: the orchestrator's Session (`PANE_ORCHESTRATION_SESSION_ID`), or the open Session the calling tab's Pane belongs to; `--no-associate` opts out. A failed association is reported on the item and never undoes the Pane.\n\nFor `panes create --wait-ready` (and `panels create`, `panes adopt --launch`), ready means an identified agent at its own input box: declared with `--agent`, or detected from the command, its foreground process or its screen. A `--tool-command` that never shows a supported agent is not ready: `readiness.ok` is false with `readiness.reason.code` `no-agent-detected` after the timeout, or `command-exited` as soon as the command exits back to the shell, and nothing is typed into it. `agent-not-ready` means the agent was detected but its input box was not ready in time. CLI readiness is confirmed on consecutive polls. Codex also requires a recognized configured model or context footer below its live composer; its provisional startup composer is not ready. Hidden or unrecognized Codex status lines conservatively time out rather than prove readiness. Startup prompts return blocked with the prompt's own text in blocked.message and a suggestedCommand, and Pane never answers them, apart from Claude's folder trust for a Session's own folder: first-run trust and daemon dialogs and Agent Farm's `Trust this repository workspace? [y/N]` as blocked.kind=first-run-dialog; Codex's security setup banner and any other prompt, including a wrapper's or shell's `[y/N]` before the agent appears, as agent-prompt. A starting message blocked this way is held and sent once the prompt is answered and the agent's input box is ready. Every create with a starting message returns `initialInput`. Pane stages the text in the composer, presses the agent's submit key separately (Ctrl+Enter for Codex, declared or detected), and checks where it went: `initialInput.delivery` is `taken` or `queued` (from the agent's transcript or its screen), `in-composer`, or `unknown` (`argv` means a prompt was routed at launch; Pane gives the transcript up to 10 seconds before settling on unknown). `initialInput.verifiedSubmitted` is true exactly when it is `taken` or `queued`, and the create's `ok` is false unless a Claude or Codex starting message is verified. Cursor, OpenCode and Pi have no acceptance probe: their delivery stays `unknown` with a delivery.message saying so, `verification: unverifiable`, and `ok` follows readiness. Without `--wait-ready` the create returns at once with `initialInput.verifiedSubmitted: false`, a delivery.message saying the call did not wait, and a `panels wait` nextCommand; Pane still sends the message once the agent is identified and at its input box, and gives up without typing it if no supported agent appears within 30 seconds.\n\n`runpane panes archive` refreshes the configured upstream, reports exact unpushed commit evidence, and refuses unsafe archive operations unless `--force` is used. A branch whose upstream is gone counts as pushed when a merged GitHub pull request has HEAD as its head (`safetyCheck.mergedViaPr`). Add `--dry-run` to inspect the same evidence without archiving. `--remove-worktree` applies the same check and removal to an adopted worktree; local branches are always kept. Successful archives report `worktreeCleanup: completed` once the worktree is gone from its path and from git; `trashDeletion: pending` means its files are still being deleted in the background. `runpane panes archive --session <id|name> --merged` archives every Session Pane that is clean and pushed or merged, and reports a reason for each skipped Pane. Archive refuses a Pane with an agent mid-turn or waiting for an answer (`agent-busy`, listed in `safetyCheck.busyAgents`), or with a tab holding unsent composer text or unsaved editor edits (`unsent-input`, listed in `safetyCheck.unsentInput`), unless `--force` is used, and the Session sweep skips it. Add `--closed` to the sweep to also archive Panes whose PR closed without merging.\n\n`runpane panes rename` trims and updates a Pane's display name without changing its worktree, branch, panels, or focus, and returns the updated pane summary.\n\n`runpane panes focus` raises the Pane window and selects a Pane (and optionally one of its panels) exactly like clicking it in the UI. Because it steals the user's window focus, run it only on an explicit user request to open, focus, show, or switch to a Pane; never focus a Pane proactively, the same doctrine that keeps `panes create` background/no-focus for `--source agent`.\n\n`runpane panels open` opens a URL or a file from the Pane worktree as a tab in an existing Pane (default: the calling panel's Pane from `PANE_SESSION_ID`), in split view beside the agent unless `--tab` is passed. Files open in an editor tab with read-only previews for supported formats, and HTML opens as editable source; an existing tab showing the same target is reused. It brings the tab forward for clients already showing that Pane, and never raises or focuses the Pane window or switches anyone's Pane.\n\n`runpane panels close --panel <panel-id>` closes a tab exactly like closing it in Pane (a terminal tab's process stops) and never archives the Pane or touches its worktree. Only a tab an agent opened with `--source agent` can close; Pane records that opener, and `panels list` shows it as `openedBy`. It refuses, without closing, the person's tabs and every tab from before Pane recorded openers (`opened-by-user`), permanent tabs (`permanent`), an agent mid-turn or waiting for an answer (`agent-busy`), unsent composer text or unsaved editor edits (`unsent-input`), and a live tab whose input Pane cannot read, such as agents other than Claude and Codex or chat tabs (`input-unknown`). A refusal prints `{ ok: false, closed: false, refused: { code, message, next } }` and exits 1. A tab id that no longer exists returns `alreadyClosed: true`. `--dry-run` reports `wouldClose` and any refusal without closing. `--force` closes the tab anyway, as its close button does, for a stuck tab or one the person asked to close (`forced: true`); only a permanent tab still stays.\n\n`runpane panels list` lists tool panels inside one Pane session. Each panel with a saved agent session ID reports it as `resumeId`, with `resumeSource` (`agent-farm`, `configured`, or `agent`) naming the rule that reopens the conversation.\n\n`runpane panels output` reads bounded recent terminal output from one panel and strips common terminal control noise for agent use.\n\n`runpane panels input` sends exact input bytes to one terminal panel. Prefer `--input-file` for newlines, Ctrl-C, quotes, or shell-sensitive text.\n\n`runpane panes create --prompt` is an alias for `--initial-input`; request JSON and daemon payloads should use the canonical `initialInput` field.\n\n`runpane panes create --branch <name>` creates the Pane's worktree on exactly that new branch, slashes included (for example `agents/w5a`). The name is checked with `git check-ref-format --branch`, creation fails if the branch already exists, and Pane never renames it to make it unique. `--worktree-name` still names the directory and defaults to `--name`. `--base` is an alias for `--base-branch`, and `--prompt-file` for `--initial-input-file`. `panes create --base <ref> --branch <name> --prompt-file <file>` replaces `git worktree add` plus `panes adopt`. When the base is a remote-tracking branch (the default `origin/main`, or one named with `--base`), Pane fetches it first, waiting at most about 10 seconds, so the Pane starts at the remote's current tip. Each created item reports `base` (`ref`, `commit`, `refresh`); if the fetch fails the Pane still starts, from the local ref, and `base.notice` says so and how to catch up.\n\n`runpane panes adopt --launch` accepts `--prompt`, `--prompt-file`, `--wait-ready`, and `--ready-timeout-ms`, and reports `readiness`, `initialInput`, and `nextCommand` like `panes create`. A prompt without `--launch` is an error rather than being dropped.\n\nIf composer submission cannot be verified without risking a duplicate, the create item is unsuccessful with `initialInput.staged`, `initialInput.attempts`, `initialInput.blocked.kind: submission_unverified`, and an actionable `nextCommand`. The CLI-facing `--prompt` alias maps to this canonical `initialInput` result.\n\nWhen running from WSL while Pane is installed on Windows, a Linux-installed runpane cannot reach Pane: it looks for a missing `/tmp/pane-daemon.../daemon.sock`. Pane's own `runpane` (on PATH in Pane's WSL terminals, or `/mnt/c/Users/<you>/.pane/bin/runpane` from any WSL shell) runs the Windows CLI through WSL interop and converts path arguments. With a Pane build older than that shim, invoke the Windows wrapper through PowerShell from a Windows cwd, for example `powershell.exe -NoProfile -Command 'Set-Location $env:TEMP; runpane repos list --json'`.\n\n`runpane watch` waits for agent, Pane, panel, and PR events from the daemon journal without polling. `--follow` keeps watching with defaults tuned for an agent watching unattended (quiet, batched, and it ends itself after 3 hours with nothing happening); individual duration flags override these defaults. Cadence requires a named follow consumer; `--follow --since <generation>` has no consumer name and bypasses settling and batching. `--until-event` waits for one event worth waking for, prints it immediately without follow settling or batching, and exits 0. The defaults are listed in the contract under defaults.watch.\n\nA watch releases its pending slot when its client socket or named pipe disconnects. Re-arming the same named cursor takes over the previous request; the superseded watcher exits with a WATCH ERROR instead of competing for the cursor. Anonymous concurrent watchers retain the eight-wait limit. Each request also has a 125-second lease (slightly longer than the maximum 120-second long poll), so an abandoned request is reclaimed even if no disconnect arrives.\n\nThe desktop app treats one consumer name specially: while a `runpane watch --as dictate` request is in flight, and for 30 seconds after the last one ends, Pane skips its own \"needs your input\" and \"finished\" desktop notifications, because [Dictate](https://github.com/parsakhaz/open-dictate) shows those events on its pill. When that watcher stops, Pane's notifications come back. The CLI's flags and output are unchanged.\n\n`sessions list` list durable named orchestration Sessions.\n\n`sessions create` create a durable named orchestration Session and its hidden terminal owner.\n\n`sessions get` read one durable named orchestration Session.\n\n`sessions update` update a Session overview from structured JSON.\n\n`sessions pin` and `sessions unpin` set the Session pin star through the existing UI update path. Create JSON accepts `isPinned` (default false); update JSON preserves the pin when the field is omitted.\n\n`sessions set-agent` switch the durable terminal agent for a named Session.\n\n`sessions associate` associate a user-visible Pane with a named Session.\n\n`sessions detach` detach a Pane from a named Session.\n\n`sessions overview` read a live status, activity, git, and pull request overview for a named Session. Each panel in `panes[].panels[]` carries its own latest `runpane report` as `report`, so one call shows what every worker last reported and when (`reportedAt`, next to the panel's `state` and `lastActivityAt`). When a report's summary is a complete JSON object, such as a status file sent with `--summary-file`, `report.data` holds it exactly as the worker gave it; Pane never reads, renames or validates its fields. A summary that is not a JSON object (plain text, an array, a scalar or invalid JSON), is nested more than 64 levels deep, or was truncated (`summaryTruncated`), has no `data`. A panel that never reported has no `report`. `panes[].report` is still the newest report among the Pane's panels. Each panel also has `type` (`terminal`, `browser`, `editor`, `explorer`, `diff`, ...): a Pane linked whole lists every tab, with `explorer` and `diff` last, and a link that names tabs lists exactly those.\n\n`runpane lock acquire|release|list` coordinate a resource shared between agents, such as one test account. The caller's Pane and panel own the lock; it is scoped to the owner's Session (or global outside one), renews for the same owner, and is released on TTL expiry, owner panel exit, or owner Pane archive. `--wait` blocks in the daemon until the lock comes free.\n\n`runpane machine health` shows this machine's disk and memory levels, the Panes using the most memory, leak warnings, and the disk space Pane can free by tier. `runpane machine cleanup --kind <kind>` lists one kind of tier 1 or 2 item (a dry run) and deletes them with `--yes`; tier 3 items are not Pane's, so it refuses them and says how to free them. Agents free disk only through this command, never with rm.\n\n`runpane loops list|create|update|run|pause|resume|delete` manage loops (scheduled tasks): a cron schedule that starts a new Pane in a fresh worktree for each run, or sends a prompt to a Session's agent. Loops are for large recurring jobs and run at most once an hour; for short waits, agents use their harness's own sleep and wake. See [LOOPS.md](LOOPS.md).\n\n`runpane agents start|status|send` finish the three common agent jobs in one call each: start an agent on a task (a new tab in the work's Pane with `--pane <id>`, or a new Pane for new work), check on it, and send it a follow-up.\n\n`runpane report --state ready|blocked|failed|done` is how a worker hands back its result. It stores the latest report on the worker's panel (state, `--pr`, `--head`, up to 16,000 characters of `--summary` or `--summary-file`, and the `--question` a blocked worker needs answered), journals an opt-in `agent.report` watch event (`REPORT <pane-name> pane <pane-id> panel <panel-id> ready pr#747 fc5dce9`; it skips the `--min-interval` batch), records it as Session activity, and shows it in `agents status`, `panels list`, and `sessions overview` (each panel's own report as `panes[].panels[].report`, with a JSON object summary as `data`, and the Pane's newest as `panes[].report`). Inside a Pane terminal the panel comes from `PANE_SESSION_ID` and `PANE_PANEL_ID`; elsewhere pass `--pane` and `--panel`. It prints how many watches were waiting for the report and received it (`Delivered to 1 waiting watcher.`, `liveWatchers` in JSON). Zero means nobody was waiting right now, not that the report is lost: it stays on the panel, and a named-cursor watch receives it when it next waits.\n\n`runpane notify` asks the person a question, or tells them something, on screen wherever they are, and prints their answer: `--ui options` with 1 to 9 `--choices` returns `{answer, note?}` (the chosen label), or with 2 to 4 `--questions` (`[{title, choices}]`) one pick each, as `{answer, answers}`, `--ui approve` returns `{approved, note?}`, `--ui ask` returns `{answer}`, and `--ui info` returns `{delivered: \"screen\"|\"inbox\"}` at once. Any ui takes up to 6 `--links` (`{label, path}`, `{label, url}` or `{label, approval}` for another approval), shown as chips on the card. When the person types a reply it returns `{reply, picks?, id, next}` (or, with no open call, types a `reply:` line into the asking tab): the reply may answer the question or ask one. `runpane notify --took <id|Q-n> answer` records it as the answer; `--took <id|Q-n> question [--status <text>]` shows that the agent is getting more context, and `runpane notify --update <id|Q-n> --asked <text> --what-changed <text>` with any changed `--title`, `--context`, `--choices`, `--questions` or `--links` saves a new version and waits on it. `--took` prints `{took, id, next?}`. Only the reply's reader (the asker, the orchestrator that relayed it, or Autopilot) may run them. The call waits with no time limit. A `{waiting: true, id, next}` result means the wait should continue with `runpane notify --resume <id>`; `runpane mcp` asks for it only for clients whose tool calls time out. When Pane is not running or Notify is off it prints `{unavailable, next}` and exits 0, so the agent asks in its terminal. Invalid input fails before anything is shown, with a message naming the field. A Session orchestrator adds `--relays <item>` (an id from `runpane inbox`) to relay a worker's question: the same card gains the choices, context and links, the call waits on it as usual, and the answer also goes straight to the worker's tab. Autopilot's own item takes `--about-session <id|name>`, the Session it is about. It needs no `--yes`: asking the person is the point.\n\nWork sent to an agent through `runpane panels create`, `panes create` (with a prompt), or `panels submit` records that the sender waits for a `runpane report`, unless the request says `--source user` (Pane's own UI does) or `--no-expect-report`; `--expect-report` asks for one anyway. Typing into a tab never does. If the agent then goes ready or its panel exits without a report, Pane journals one opt-in `agent.report.missing` entry (`MISSING REPORT <pane-name> pane <pane-id> panel <panel-id> ready|exited`) whose `lastOutput` is the agent's last transcript reply or last screen lines; it skips the `--min-interval` batch and reaches only watchers that list it in `--kinds`. While the agent's screen shows background work (Claude's `· 1 shell` footer or a running background subagent row, Codex's `background terminal running` line), Pane waits and looks again every 10 seconds instead. `agent.blocked` entries carry `screenLines`, the prompt the agent waits on, and are journalled once a panel has stayed blocked for 2 seconds.\n\nThe orchestrator guide prescribes submit without `--wait`, followed by its named watch; use one completion consumer. As an optional CLI route, `--wait` on `runpane panels submit`, `panels create`, and `panes create` turns the expected report on and blocks on that panel until the first `agent.report`, `agent.report.missing`, `agent.blocked`, `panel.exited`, or `pane.gone`, then prints one line of JSON (`dispatchWaitResult`): the outcome, ids, the report's state, summary, `summaryPath`, PR and head, `screenLines` for a prompt, or `lastOutput` for a missing report, never the transcript. It exits 0 for a report, 3 missing, 4 blocked, 5 exited or gone, and 124 when `--timeout <duration>` passes. It follows the journal from the position the daemon took before delivering the work, so nothing that happens right after delivery is missed. It reuses watch --until-event and returns indeterminate (exit 6) if the journal epoch changes or retained history is lost; inspect the panel and inbox before retrying. Report-expected dispatches are serialized per panel and refused before writing while a result or missing-output collection is outstanding. A send with --no-expect-report is a reply (an answer, or an addition to the current work): it is delivered while a report is outstanding and leaves that expectation in place. Then watch for the original result.\n\n`runpane inbox [--session <id|name>] [--json]` lists what a Session's orchestrator has not acknowledged: reports, missing reports, and on-screen questions (a question clears itself once its panel moves on), plus `answers`, what its workers were told, kept 7 days; an answer with no `decision` still needs its D-n. `runpane inbox ack <item-id>...` or `--all --session <id|name>` clears items, and `runpane inbox ack <item-id>... --decision <D-n>` records the D-n, even on an item already cleared. An orchestrator runs it when it starts or resumes, to catch anything that finished while it was down; Pane never injects the inbox into its turns.\n\n`runpane panels resume --panel <panel-id>` restarts a stopped terminal panel in place, keeping its panel id: an agent panel relaunches with its resume command (Claude `--resume <session>`, `codex resume <session>`, Agent Farm `agent-farm run <profile> --resume <id>` with the ID Agent Farm printed; the result's `agentSessionId` names it), the same restart the app runs when it shows the panel, without taking focus. A running panel is left alone (`action: \"already-running\"`); one whose agent exited back to its shell is stopped, and resume runs its saved command again in that shell (`action: \"resumed\"`). If that command exits at once, `--wait-ready` returns `ok: false` with `reason.code: \"command-exited\"` and the error line it printed. `--panel` also resumes a paused tab. `--session <id|name>` or `--all-stopped` resumes every stopped agent panel in that scope and skips paused ones, `--concurrency` at a time (default 3), then, with `--wait-ready`, waits on the resumed panels together, and returns `{ resumed, alreadyRunning, failed, notReady, items[] }` with each panel's own result, readiness, and blocker or error. After a Pane restart, or once an agent exits back to its shell, stopped panels report `running: false` (`initialized` stays true while the shell lives) in `panels list`, `panels screen`, and `panels wait` (which returns `stopped: true` instead of timing out), and `nextCommand` points at `panels resume`. `runpane watch` reports them as `panel.stopped` (`STOPPED ...`) when `--kinds` lists that kind; other consumers and `workspace state` see `agent.unknown` with `running: false`, never `agent.ready`.\n\n`runpane panels pause --panel <panel-id>`, `panes pause --pane <pane-id>` and `sessions pause --session <id|name>` pause a tab, a Pane, or a Session's chat and Panes: Pane stops each terminal tab the way quitting does, without asking, keeps its agent's conversation, and marks it paused. Pause leaves a chat tab running: `panels pause --panel` on one fails with `ERR_RUNPANE_CHAT_NOT_PAUSABLE`, and `panes pause` and `sessions pause` leave its agent running and count it in `chatTabsNotPaused`. A paused terminal tab stays stopped through clicks, app restarts and updates until `panels resume --panel`, `panes resume` or `sessions resume` restarts it in its saved conversation. Each returns `{ action, scope, panelIds, unchanged, failed, chatTabsNotPaused, message, nextCommand }`. `panes list` reports a Pane's `paused` mark (`{ at, by: \"manual\" | \"auto\", idleHours? }`) and `inactiveSince`, the latest terminal output or input or chat agent activity in its tabs, or the last time the person selected it; `panels list` reports each tab's `paused`. Auto-pause also stops the agent of a chat tab idle for `chatIdleReleaseMinutes` (30 by default); opening the tab or sending it a message resumes it, and it reports no `panel.paused`. `runpane watch` reports `panel.paused` (`PAUSED ...`) and `panel.unpaused` (`UNPAUSED ...`) under `--follow`, to a Session-scoped watch, or when `--kinds` lists them.\n\n`runpane panels last-message --panel <panel-id>` reads a Claude or Codex agent's last reply from its transcript (up to `--limit` characters, default 20,000, keeping the end and reporting `truncated`). It never scrapes the screen: without a transcript it prints `{ ok: false, reason: \"transcript-unavailable\" }` and exits 1.\n\n`runpane panels conversation --conversation <id> [--source startup|resume|clear|compact]` records which conversation a terminal panel's agent is on (daemon action `runpane:panels:conversation`, request `{ panelId, paneId?, conversationId, source? }`, result `{ ok: true, paneId, panelId, conversationId, source?, sure }`; `sure` is true when the report came since the panel's agent started). It is not an `agent.report` event. The panel comes from `--panel` (with an optional `--pane`), else `PANE_PANEL_ID` and `PANE_SESSION_ID`, as for `runpane report`. `runpane panels conversation --hook` is the command for a Claude Code `SessionStart` hook: it reads the hook's JSON from stdin (`session_id`, `source`; at most 64 KiB, for at most 2 seconds), reports it for `PANE_PANEL_ID`, prints nothing on stdout or stderr, and always exits 0: outside Pane, on bad input, when Pane is not running, and with a Pane that predates the action. Without `--hook` it prints `Recorded conversation <id> for panel <panel-id>.` and fails like any other command.\n\nCommands with a contract `daemonAction` (the `panes` git, script, restore, and move commands, `folders list|create`, and `links open`) call the same Pane daemon channel as the matching button in the app and print `{ ok, data, error }`. Destructive ones add a pane:// `link` to review the Pane.\n\n`runpane links create` builds `pane://open?...` links; opening one in Pane selects what it names and never changes Pane state.\n\n`runpane docs search|read` search and read Pane docs, help, and installed Pane Chat skills offline. They ship in the npm package and the Pane app only.\n\n`runpane handoff` hands a task to another agent on this or another of your machines. The sending agent writes the note from `runpane handoff --template` (goal, current state, done and verified, in progress, next steps, decisions and constraints, open questions, how to verify, git state); `runpane handoff \"claude opus on parsas-macbook-pro\" --note-file ~/handoff.md` checks every section is filled in, requires the branch to be pushed (or pushes it with `--push`, never forcing), writes the note to that machine's `~/.pane/handoffs/` and starts the agent in a new Pane branched from the sender's branch. When the sender is a Pane tab running a Claude, Codex, Cursor or OpenCode session and the receiver is the same agent, the handoff carries that session: on another machine its files are copied into that machine's agent store and the receiver resumes the same id; on this machine the receiver resumes a fork, because two agents never resume one session on one machine. The receiver starts with no prompt, and the CLI runs the continuity check and reports JSON `continuity.result` `continued`, `inconclusive` (exit 0; `next` gives a probe question) or `not-continued` (exit 1; the receiver is kept and `next` gives the `--note-only` command). `--note-only`, a different agent, or a tab with no carried session starts a fresh agent with the note (`fresh-agent`). JSON `continuity` is `{ carried, result, agent, sessionId, resumedId, fork, files, bytes, checks: { resumedById, restartResumes, historyLoaded, originalUntouched?, originalAppended? }, reason, next }`: `sessionId` is the sender's session, `resumedId` the id the receiver resumes (the fork's on this machine), `checks` are the continuity checks (`historyLoaded` is null when there was nothing to compare; `originalUntouched` is set for forks), and a dry run sets `carried`, `sessionId`, `fork`, `files` and `bytes` with no `result`. After `continued` or `inconclusive` the sending agent ends its turn and makes no more changes on the branch. An OpenCode session travels as its export: `opencode export` on this machine, then `opencode import` inside the receiving repository there, and an OpenCode receiver is accepted only to continue an OpenCode session. A Cursor session is carried only to another machine, best effort since Cursor's store is undocumented: Cursor has no fork, and a copied chat still writes to the original, so on this machine the result is `not-continued` and nothing is started. A destination's agent store is assumed at its default location (`~/.claude`, `~/.codex`, `~/.cursor`); a copy already there is replaced only when the sender's holds all of it and no agent there runs it, otherwise nothing is copied and the result is `not-continued`. A destination Pane too old to resume a carried session is refused before anything is sent (`ERR_HANDOFF_RESUME_UNSUPPORTED`). From a Session's terminal it skips git and creates a Session with the same name, goal and agent on the other machine instead; a same-agent Session resumes the sender's conversation when first opened. The receiver reports back to the sender's panel.\n\n`runpane ask --agent <agent> --prompt \"<question>\"` asks one agent one read-only question and prints its answer, with no tab left behind: the agent's own headless mode runs once, on this machine or another one (`--machine`), in a saved repository (`--repo`, a WSL repository runs in WSL) or a Pane's worktree (`--pane`), with any model it accepts (`--model`). It can read files but not edit them or run shell commands; an agent with no such mode is refused (`ERR_ASK_UNSUPPORTED`). A missing agent, a sign-in error, an unknown model and a timeout each fail with the agent's own words and the next step. Use it for a second opinion or a question to another model; work that edits files goes to a tab.\n\n`runpane models` lists the models each installed agent offers, read from the agent's own list on every call, with its sign-in as the agent reports it. `--all` covers this machine, every saved machine and their WSL; `--agent` and `--search` narrow the rows. A machine that does not answer is one `unreachable` row; a list that can't be read is `list unavailable`.\n\n`runpane pr watch`: Register durable GitHub PR monitoring for a Pane.\n\n`runpane pr unwatch`: Remove a Pane’s explicit PR registration.\n\n`runpane pr list`: List PR registrations and stopped watches.\n\n`runpane autopilot status|waiting|stack` read Autopilot (experimental): its switch, run and stack, and its queue: every approval or question waiting on the person on every machine it can reach, grouped by Session, plus `offline` and `cantSee` machines. `runpane autopilot stack push (--item <id>|--file <path>|--url <url>|--session <id|name>) [--title <text>] [--note <text>] [--tab <path-or-url>]... [--next]` puts one entry on its stack; relative paths resolve against the caller's directory, and a new entry never replaces the one on screen. `runpane autopilot answer <id> (--choice <label>|--approve|--deny|--text <text>) [--note <text>] --because <why>`, `runpane autopilot close <id> --reason <why>` and `runpane autopilot rewrite <id> --ui <options|approve|ask> --title <text> [--context <text>] [--choices <json>] [--suggestions <json>] [--links <json>]` act on an item, on the machine that holds it, recorded \"by Autopilot\" on every device; the person can Override an answer and reopen a close. Only Autopilot may run them (`AUTOPILOT_ONLY`), and they refuse a permission prompt with `AUTOPILOT_CANNOT_ANSWER`. An item someone else already answered is refused with who did.\n\n## Command reference\n\nEvery command and its options, from `commands` in `contracts/runpane/contract.json`.\n\n- `help`: Show help for runpane or a specific command.\n- `setup`: Open the guided setup wizard for install, remote host setup, update, and diagnostics.\n- `install`: Install Pane on this machine or configure this machine as a remote daemon host.\n- `update`: Update both Pane and the invoked supported CLI through an independent helper.\n- `version`: Print the runpane wrapper version without contacting, launching, or focusing Pane.\n- `doctor`: Run platform, release, installed Pane, daemon reachability, runpane-on-PATH, and remote setup diagnostics.\n- `daemon repair`: Repair and restart the managed remote-daemon launcher without changing pairing or tunnel configuration.\n- `agents doctor`: Diagnose whether a built-in agent command is available in a Pane repository environment.\n- `agent-context`: Print token-efficient Pane command context for coding agents.\n- `mcp`: Run the Pane MCP server over stdio so coding agents can call runpane commands as tools.\n- `relay`: Run your own Pane relay: starts this platform's prebuilt pane-relay with your flags; init prints and checks the DNS records it needs.\n- `link`: Link this computer with the one that made a one-time link, so each can reach the other.\n- `repos list`: List repositories saved in the running Pane app.\n- `repos add`: Register an existing git repository with the running Pane app.\n- `repos get`: Show a saved repository's Project Settings and the scripts Pane will run.\n- `repos update`: Change a saved repository's Project Settings: scripts, worktree folder, name, IDE command, system prompt, and environment variables.\n- `repos rename`: Rename a repository saved in the running Pane app.\n- `secrets list`: List the Pane secrets on this machine: project, name, and when and where each was set. Never shows a value.\n- `secrets set`: Save a Pane secret, adding or replacing it. Reads the value from stdin.\n- `secrets delete`: Delete a Pane secret from this machine and, through sync, from your other machines.\n- `secrets exec`: Run a command with Pane secrets in its environment. Nothing prints a value.\n- `secrets request`: Ask the person for a secret on a masked card. Pane saves what they type as a Pane secret and never returns it.\n- `devices list`: List the phone simulators and emulators this Pane can open: platform, name, OS, machine, state, and which Pane holds each.\n- `devices open`: Boot a phone simulator or emulator for this Pane and show its live screen in a device tab beside the agent.\n- `devices screenshot`: Capture the screen of this Pane's open device as an image.\n- `devices act`: Run an agent-device command on this Pane's open device: open an app, snapshot -i for element refs, press @e3, fill, swipe, install, logs.\n- `devices run`: Run a command where this Pane's device runs, such as a build (npx expo run:ios) or Metro with --background.\n- `devices close`: Release this Pane's device (or, with --platform, only that one) and stop the commands device_run started. The device stays warm for 10 minutes.\n- `devices usage`: Report every simulator and emulator on this machine, and the memory and disk they, Pane's device tools and build checkouts use.\n- `devices free`: Shut down unused devices (--idle), or also delete every unused device Pane made and the build checkouts no Pane holds (--all).\n- `theme read`: Show Pane's own theme: what is selected, the Custom theme, every colour token with its current value, the stable selectors, and the guide for restyling Pane.\n- `theme set`: Restyle Pane itself, only when the person asks to change Pane's look: write the Custom theme (a base theme, colour tokens and CSS) and select it, or switch to another theme. Pane restyles within a second.\n- `theme reset`: Delete the Custom theme and go back to the theme it was built on.\n- `panes list`: List Pane sessions in a saved repository.\n- `panes cost`: Report estimated token cost per Pane, with per-model breakdown and cache efficiency.\n- `workspace state`: Read one workspace snapshot of every Pane and CLI panel.\n- `workspace list`: List your computers saved in Pane and the machines on your tailnet, one entry per computer, and whether each answers workspaces.\n- `workspace enable`: Put this machine's Pane on your tailnet for runpane workspace (the default when Tailscale is signed in).\n- `workspace disable`: Take this machine off runpane workspace and remove its tailscale serve handler on port 8443.\n- `workspace read`: Print a file from another of your machines; any path form works (C:\\..., /mnt/c/..., /home/..., ~/...).\n- `workspace write`: Write --content or stdin to a file on another of your machines, creating parent folders.\n- `workspace exec`: Run a command in another machine's shell and return stdout, stderr, the exit code, OS, and shell.\n- `handoff`: Hand your task to another agent on this or another machine: check your handoff note, make the branch reachable, send the note, and start the agent on it. A same-agent handoff from a Pane tab carries and resumes your own session (a fork on this machine) and checks it continued; otherwise a fresh agent starts with the note. From a Session's terminal, create the Session on another machine instead.\n- `ask`: Ask any agent and model one read-only question, on this or another machine, and get its answer: no tab is opened and nothing is left behind.\n- `models`: List the models each installed agent offers, on this machine, another one, or every saved machine, with what each agent reports about its sign-in. Read live on every call.\n- `watch`: Wait for workspace agent and Pane transitions using a daemon-held cursor.\n- `panes create`: Create a Pane (a new worktree) only when the work's branch has no Pane yet; for review, audit, fix or QA on existing work use `panels create --pane <id>`.\n- `panes adopt`: Adopt an existing externally managed git worktree as a Pane without changing the worktree.\n- `panes archive`: Archive a Pane (session) exactly like the UI Archive action, including safe removal of its Pane-managed git worktree, or archive every merged Pane in a Session.\n- `panes pin`: Declaratively pin a Pane; pinned is the Pane UI's favorite/pin star and repeated requests are idempotent.\n- `panes unpin`: Declaratively unpin a Pane; pinned is the Pane UI's favorite/pin star and repeated requests are idempotent.\n- `panes pause`: Pause a Pane: stop every terminal tab and keep their conversations until the Pane is resumed.\n- `panes resume`: Resume a paused Pane: restart its paused tabs in their saved conversations.\n- `panes rename`: Rename a Pane without changing its worktree, branch, panels, or focus.\n- `panes focus`: Raise the Pane window and select a Pane (and optionally one of its panels) on explicit user request.\n- `panels create`: Open a new agent or terminal tab inside an existing Pane, sharing its worktree. The default for review, QA, fixes and any other agent on work that already has a Pane.\n- `panels open`: Open a URL or file as a browser/editor tab in a Pane, in split view beside the agent by default.\n- `panels close`: Close a tab an agent opened, exactly like closing it in Pane; refuses the person's tabs, busy agents and unsent input unless --force.\n- `panels list`: List tool panels inside a Pane session.\n- `panels output`: Read recent terminal output from a panel.\n- `panels screen`: Read a compact current-screen view from a terminal panel.\n- `panels input`: Send input bytes to a terminal panel.\n- `panels submit`: Send and submit text to a terminal panel, including idle agent composers.\n- `panels submit-composer`: Submit an agent composer using the panel-appropriate key sequence.\n- `panels wait`: Wait for a terminal panel to initialize, become ready/idle, or contain text.\n- `panels resume`: Restart a stopped terminal panel in place, resuming its agent's conversation.\n- `panels pause`: Pause a terminal tab: stop its process and keep its agent's conversation until it is resumed.\n- `panels last-message`: Read an agent's last reply from its transcript, without scraping the screen.\n- `panels conversation`: Record which conversation a terminal panel's agent is on, so Switch to chat and restarts open that one. A Claude Code SessionStart hook runs it with --hook.\n- `panes git-status`: Read the git status of a Pane worktree: uncommitted, unpushed, and behind-main counts.\n- `panes commit`: Stage all changes in a Pane worktree and commit them.\n- `panes push`: Push a Pane branch to its remote.\n- `panes pull`: Pull the remote branch into a Pane worktree.\n- `panes rebase-main`: Rebase a Pane branch onto the latest main branch.\n- `panes restore`: Restore an archived Pane, recreating its worktree.\n- `panes squash-rebase`: Squash a Pane branch into one commit and rebase it onto main.\n- `panes stash`: Stash uncommitted changes in a Pane worktree.\n- `panes stash-pop`: Apply and drop the latest stash in a Pane worktree.\n- `panes soft-reset`: Undo the last commit in a Pane, keeping its changes staged.\n- `panes fetch`: Fetch the remote for a Pane worktree.\n- `panes run-script`: Run the repository's run script in a Pane.\n- `panes stop-script`: Stop the run script running in a Pane.\n- `panes move`: Move a Pane into a sidebar folder.\n- `folders list`: List the sidebar folders of a repository.\n- `folders create`: Create a sidebar folder in a repository.\n- `links create`: Build a pane:// link that opens a Pane, panel, repository, or Session in the Pane app.\n- `links open`: Open a pane:// link in the running Pane app.\n- `docs search`: Search Pane's docs, runpane help, and the Pane Chat skills.\n- `docs read`: Read one Pane doc, help topic, or skill in full.\n- `agents start`: Start an agent on a task and wait until it is ready: as a new tab in an existing Pane with --pane <id> (review, audit, fix, QA), or in a new Pane with --repo and --name for new work.\n- `agents status`: Check on an agent: whether it is working, ready, blocked, or idle, plus its current screen.\n- `agents send`: Send a follow-up message to an agent and confirm it was submitted.\n- `report`: Hand back a worker's structured report: state, PR, head commit, summary, and the question when blocked.\n- `notify`: Ask the person a question, or tell them something, wherever they are, and get their answer back.\n- `inbox`: List the reports, missing reports, and on-screen questions a Session's orchestrator has not acknowledged, and the answers its workers got.\n- `inbox ack`: Clear Session inbox items once they are handled, and record an answer's D-n.\n- `autopilot status`: Show Autopilot (experimental): whether it is on and running, whether Sentinel is on, its run, its stack, and what waits in each Session.\n- `autopilot waiting`: List every approval and question waiting on the person on every machine Autopilot can reach, grouped by Session, and the machines it can't reach. This is Autopilot's queue.\n- `autopilot stack`: List the entries on Autopilot's stack in order, and which one is on screen.\n- `autopilot stack push`: Put a waiting item, a document, a URL, or a Session on Autopilot's stack for the person to look at.\n- `autopilot answer`: Answer a waiting item as Autopilot, with why; delivered at once and recorded \"by Autopilot\". Never a permission prompt.\n- `autopilot close`: Close a waiting item as Autopilot, with why; its asker is told and the person can reopen it. Never a permission prompt.\n- `autopilot rewrite`: Close an unclear waiting item and re-ask it rewritten; the answer goes to the original asker.\n- `sessions list`: List durable named orchestration Sessions.\n- `sessions create`: Create a durable named orchestration Session and its hidden terminal owner; JSON isPinned sets the pin star (default false).\n- `sessions get`: Read one durable named orchestration Session.\n- `sessions update`: Update a Session overview from structured JSON; isPinned sets the UI pin star.\n- `sessions set-agent`: Switch the durable terminal agent for a named Session.\n- `sessions associate`: Associate a user-visible Pane with a named Session.\n- `sessions detach`: Detach a Pane from a named Session.\n- `sessions overview`: Read a live status, activity, git, and pull request overview for a named Session.\n- `lock acquire`: Acquire a named lock on a resource shared between agents, such as one test account, optionally waiting for it.\n- `lock release`: Release a named lock you hold, or force-release another owner's lock.\n- `lock list`: List held named locks, optionally only one Session's.\n- `machine health`: Show this machine's disk and memory levels, the Panes using the most memory, leak warnings, and the disk space Pane can free, by tier.\n- `machine cleanup`: Free disk space that Pane made: list one kind of tier 1 or 2 item with its size (a dry run), or delete them with --yes.\n- `sessions unpin`: Declaratively unpin a named Session using the UI pin state; repeated requests keep the requested state.\n- `sessions pin`: Declaratively pin a named Session using the UI pin state; repeated requests keep the requested state.\n- `sessions pause`: Pause a Session: stop the terminal tabs of its chat and every Pane in it, keeping their conversations. Chat tabs keep running.\n- `sessions resume`: Resume a paused Session: restart its chat and the paused tabs of its Panes.\n- `pr watch`: Register durable GitHub PR monitoring for a Pane.\n- `pr unwatch`: Remove a Pane’s explicit PR registration.\n- `pr list`: List PR registrations and stopped watches.\n- `loops list`: List loops (scheduled tasks) with their schedule, next run, and recent runs.\n- `loops create`: Create a loop: a cron schedule that starts a new Pane in a fresh worktree for each run, or sends a prompt to a Session's agent. Loops are for large recurring jobs and run at most once an hour; for short waits, use your agent harness's own sleep and wake.\n- `loops update`: Change a loop's repo or Session, name, schedule, agent or command, prompt, or worktree template. Loops are for large recurring jobs and run at most once an hour; for short waits, use your agent harness's own sleep and wake.\n- `loops run`: Start a run of a loop now. The schedule stays the same.\n- `loops pause`: Pause a loop: it starts no scheduled runs until resumed.\n- `loops resume`: Resume a paused loop from its next scheduled time.\n- `loops delete`: Delete a loop. It starts no more runs.\n\n```bash\nrunpane help [command]\nrunpane setup\nrunpane install [client|daemon] [options]\n runpane update [--pane-only | --cli-only] [--version <latest|vX.Y.Z>] [--pane-dir <path>] [--dry-run] [--wait] [--json]\n runpane update --status <operation-id> [--wait] [--pane-dir <path>] [--json]\nrunpane version [--pane-dir <path>]\nrunpane --version\nrunpane doctor [--json] [--pane-dir <path>] [--pane-path <path>] [--format <format>] [--verbose]\nrunpane doctor --fix [--json] [--pane-dir <path>]\nrunpane doctor --report [--title <text>] --body-file <path|-> [--yes] [--json]\nrunpane daemon repair [--pane-dir <path>] [--pane-path <path>] [--yes] [--json]\nrunpane agents doctor --agent <codex|claude|cursor|opencode|pi> [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane agent-context [--json]\nrunpane agent-context --command <command> [--json]\nrunpane mcp [--toolsets <name,...>] [--read-only]\nrunpane relay [pane-relay flags...]\nrunpane relay init --domain <relay domain> [--public-ip <IPv4>] [--resolver <ip[:port]>]\nrunpane link <link> [--yes] [--json] [--pane-dir <path>]\nrunpane repos list [--json] [--pane-dir <path>]\nrunpane repos add --path <path> [--name <name>] [--json] [--yes] [--pane-dir <path>]\nrunpane repos get [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane repos update --repo <selector> [--name <name>] [--build-script <script>] [--run-script <script>] [--archive-script <script>] [--worktree-folder <path>] [--open-ide-command <command>] [--system-prompt <text>] [--env <json>] [--env-remove <name,...>] [--clear <setting,...>] [--from-json <path|->] --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane repos rename --repo <selector> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets list [--project <project>] [--json] [--pane-dir <path>]\nrunpane secrets set --project <project> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets delete --project <project> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane secrets exec --project <project> [--only <name,...>] [--env <VAR=NAME>]... [--file <name>]... [--pane-dir <path>] -- <command>...\nrunpane secrets request --project <project> --name <name> --title <text> --reason <text> [--json] [--pane-dir <path>]\nrunpane devices list [--json] [--pane-dir <path>]\nrunpane devices open --platform <ios|android> [--device <name-or-id>] [--json] [--pane-dir <path>]\nrunpane devices screenshot [--platform <ios|android>] [--json] [--pane-dir <path>]\nrunpane devices act [--platform <ios|android>] [--json] [--pane-dir <path>] -- <command>\nrunpane devices run [--platform <ios|android>] [--background] [--wait-ms <milliseconds>] [--json] [--pane-dir <path>] -- <command>\nrunpane devices close [--platform <ios|android>] [--json] [--pane-dir <path>]\nrunpane devices usage [--json] [--pane-dir <path>]\nrunpane devices free (--idle|--all) --yes [--json] [--pane-dir <path>]\nrunpane theme read [--json] [--pane-dir <path>]\nrunpane theme set [--base <theme>] [--colors <json>] [--css <text>] [--name <text>] [--json] [--pane-dir <path>]\nrunpane theme set --theme <id> [--json] [--pane-dir <path>]\nrunpane theme reset [--json] [--pane-dir <path>]\nrunpane panes list [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane panes cost [--repo <selector>] [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane workspace state [--repo <selector>] [--json] [--pane-dir <path>]\nrunpane workspace list [--json] [--pane-dir <path>]\nrunpane workspace enable [--json] [--pane-dir <path>]\nrunpane workspace disable [--json] [--pane-dir <path>]\nrunpane workspace [<machine>] read <path> [--json]\nrunpane workspace [<machine>] write <path> [--content <text>] [--json]\nrunpane workspace <machine> exec [--cwd <path>] [--timeout-ms <ms>] [--json] -- <command>\nrunpane handoff --template\nrunpane handoff \"<destination>\" --note-file <path|-> [--machine <name>] [--agent <codex|claude|cursor|opencode|pi>] [--model <model>] [--effort <level>] [--repo <selector>] [--push] [--note-only] [--dry-run] [--json]\nrunpane ask --agent <claude|codex|cursor|opencode> (--prompt \"<question>\" | --prompt-file <path|->) [--model <model>] [--machine <name>] [--repo <selector> | --pane <pane-id>] [--timeout <duration>] [--json]\nrunpane models [--agent <codex|claude|cursor|opencode|pi>] [--search <text>] [--machine <name> | --all] [--json]\nrunpane watch [--follow|--until-event] [--session <id|name>|--pane <id>] [--json] [overrides]\nrunpane panes create --repo <selector> --name <name> --agent <codex|claude|cursor|opencode|pi> [--source user|agent] [--focus|--no-focus] [--base <ref>] [--branch <name>] [--prompt-file <path|->] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] [options] [--pane-dir <path>]\nrunpane panes create --repo <selector> --name <name> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--source user|agent] [--focus|--no-focus] [--base <ref>] [--branch <name>] [--prompt-file <path|->] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] [options] [--pane-dir <path>]\nrunpane panes create --from-json <path|-> [--yes] [--json] [--pane-dir <path>]\nrunpane panes adopt --repo <selector> --path <dir> --name <name> --agent <codex|claude|cursor|opencode|pi> [--resume <id>] [--folder <name>] [--launch [--prompt <text>|--prompt-file <path|->] [--wait-ready] [--ready-timeout-ms <ms>]] [--no-pinned] [--no-associate] [--dry-run] [--yes] [--json] [--pane-dir <path>]\nrunpane panes adopt --repo <selector> --path <dir> --name <name> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--folder <name>] [--launch [--prompt <text>|--prompt-file <path|->] [--wait-ready] [--ready-timeout-ms <ms>]] [--no-pinned] [--no-associate] [--dry-run] [--yes] [--json] [--pane-dir <path>]\nrunpane panes archive --pane <pane-id> [--source user|agent] [--force] [--remove-worktree] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane panes archive --session <id|name> --merged [--closed] [--remove-worktree] [--source user|agent] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane panes pin --pane <pane-id> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes unpin --pane <pane-id> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes pause --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes resume --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes rename --pane <pane-id> --name <new-name> --yes [--dry-run] [--json] [--pane-dir <path>]\nrunpane panes focus --pane <pane-id> [--panel <panel-id>] --source user|agent --yes [--json] [--pane-dir <path>]\nrunpane panels create --pane <pane-id> --agent <codex|claude|cursor|opencode|pi> [--source user|agent] [--focus|--no-focus] [--wait-ready] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels create --pane <pane-id> --tool-command <command> [--agent <codex|claude|cursor|opencode|pi>] [--title <title>] [--focus|--no-focus] [--wait-ready] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels open [--pane <pane-id>] (--url <url>|--file <path>) [--title <title>] [--split|--tab] [--focus|--no-focus] [--source user|agent] --yes [--json]\nrunpane panels close --panel <panel-id> [--dry-run] [--force] [--source user|agent] --yes [--json] [--pane-dir <path>]\nrunpane panels list --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane panels output --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels screen --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels input --panel <panel-id> (--text <text>|--keys <name,...>|--input-file <path|->) [--source user|agent] --yes [--json] [--pane-dir <path>]\nrunpane panels submit --panel <panel-id> (--text <text>|--input-file <path|->) [--as-file-pointer [--attach <file>]...] [--interrupt] [--source user|agent] [--expect-report|--no-expect-report] [--wait [--timeout <duration>]] --yes [--json] [--pane-dir <path>]\nrunpane panels submit-composer --panel <panel-id> [--strategy auto|codex-ctrl-enter|enter|tab] --yes [--json] [--pane-dir <path>]\nrunpane panels wait --panel <panel-id> [--for initialized|ready|idle|text] [--contains <text>] [--timeout-ms <ms>] [--interval-ms <ms>] [--json] [--pane-dir <path>]\nrunpane panels resume --panel <panel-id> [--wait-ready] [--ready-timeout-ms <ms>] --yes [--json] [--pane-dir <path>]\nrunpane panels resume (--session <id|name>|--all-stopped) [--wait-ready] [--ready-timeout-ms <ms>] [--concurrency <count>] --yes [--json] [--pane-dir <path>]\nrunpane panels pause --panel <panel-id> --yes [--json] [--pane-dir <path>]\nrunpane panels last-message --panel <panel-id> [--limit <count>] [--json] [--pane-dir <path>]\nrunpane panels conversation --conversation <id> [--source startup|resume|clear|compact] [--panel <panel-id>] [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane panels conversation --hook [--pane-dir <path>]\nrunpane panes git-status --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane panes commit --pane <pane-id> --message <message> --yes [--json] [--pane-dir <path>]\nrunpane panes push --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes pull --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes rebase-main --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes restore --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes squash-rebase --pane <pane-id> --message <message> --yes [--json] [--pane-dir <path>]\nrunpane panes stash --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes stash-pop --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes soft-reset --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes fetch --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes run-script --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes stop-script --pane <pane-id> --yes [--json] [--pane-dir <path>]\nrunpane panes move --pane <pane-id> --folder <folder-id> --yes [--json] [--pane-dir <path>]\nrunpane folders list --repo <repo-id> [--json] [--pane-dir <path>]\nrunpane folders create --repo <repo-id> --name <name> --yes [--json] [--pane-dir <path>]\nrunpane links create --pane <pane-id> [--panel <panel-id>] [--json]\nrunpane links create --repo <repo-id> [--json]\nrunpane links create --session <session-id> [--json]\nrunpane links open --url <pane-url> --yes [--json] [--pane-dir <path>]\nrunpane docs search --query <text> [--limit <count>] [--json]\nrunpane docs read --doc <path> [--json]\nrunpane agents start (--pane <pane-id> | --repo <selector> --name <name> [--base-branch <branch>]) (--agent <codex|claude|cursor|opencode|pi>|--tool-command <command>) --prompt <task> --yes [--json] [--pane-dir <path>]\nrunpane agents status (--pane <pane-id>|--panel <panel-id>) [--limit <count>] [--json] [--pane-dir <path>]\nrunpane agents send (--pane <pane-id>|--panel <panel-id>) --text <message> [--as-file-pointer] [--no-expect-report] --yes [--json] [--pane-dir <path>]\nrunpane report --state <ready|blocked|failed|done> [--pr <number>] [--head <sha>] [--summary <text>|--summary-file <path|->] [--question <text>] [--pane <pane-id> --panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane notify --ui <options|approve|ask|info> --title <text> [--context <text>] [--choices <json>] [--questions <json>] [--detail <text>] [--detail-label <text>] [--suggestions <json>] [--action <json>] [--links <json>] [--relays <item>] [--about-session <id|name>] [--json] [--pane-dir <path>]\nrunpane notify --took <id|Q-n> <answer|question> [--status <text>] [--json] [--pane-dir <path>]\nrunpane notify --update <id|Q-n> --asked <text> --what-changed <text> [--title <text>] [--context <text>] [--choices <json>] [--questions <json>] [--links <json>] [--json] [--pane-dir <path>]\nrunpane notify --resume <id> [--json] [--pane-dir <path>]\nrunpane inbox [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane inbox ack <item-id>... [--decision <D-n>] [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane inbox ack --all --session <id|name> [--json] [--pane-dir <path>]\nrunpane autopilot status [--json] [--pane-dir <path>]\nrunpane autopilot waiting [--json] [--pane-dir <path>]\nrunpane autopilot stack [--json] [--pane-dir <path>]\nrunpane autopilot stack push (--item <id> | --file <path> | --url <url> | --session <id|name>) [--title <text>] [--note <text>] [--tab <path-or-url>]... [--next] [--json] [--pane-dir <path>]\nrunpane autopilot answer <id> (--choice <label> | --approve | --deny | --text <text>) [--note <text>] --because <why> [--json] [--pane-dir <path>]\nrunpane autopilot close <id> --reason <why> [--json] [--pane-dir <path>]\nrunpane autopilot rewrite <id> --ui <options|approve|ask> --title <text> [--context <text>] [--choices <json>] [--suggestions <json>] [--links <json>] [--json] [--pane-dir <path>]\nrunpane sessions list [--json] [--pane-dir <path>]\nrunpane sessions create --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions get --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions update --session <id|name> --from-json <path|-> [--json] [--pane-dir <path>]\nrunpane sessions set-agent --session <id|name> --agent <codex|claude|cursor|opencode|pi> [--json] [--pane-dir <path>]\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\nrunpane sessions detach --session <id|name> [--pane <pane-id>] [--json] [--pane-dir <path>]\nrunpane sessions overview --session <id|name> [--json] [--pane-dir <path>]\nrunpane lock acquire --name <name> --ttl <duration> [--wait <milliseconds>] [--note <text>] [--pane <pane-id>] [--panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane lock release --name <name> [--force] [--session <id|name>] [--note <text>] [--pane <pane-id>] [--panel <panel-id>] [--json] [--pane-dir <path>]\nrunpane lock list [--session <id|name>] [--json] [--pane-dir <path>]\nrunpane machine health [--json] [--pane-dir <path>]\nrunpane machine cleanup --kind <kind> [--yes] [--json] [--pane-dir <path>]\nrunpane sessions unpin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions pin --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions pause --session <id|name> [--json] [--pane-dir <path>]\nrunpane sessions resume --session <id|name> [--json] [--pane-dir <path>]\nrunpane pr watch [--pane <id>] --url <PR URL> [--head <full-sha>] [--json] [--pane-dir <path>]\nrunpane pr unwatch [--pane <id>] --url <PR URL> [--json] [--pane-dir <path>]\nrunpane pr list [--pane <id>] [--json] [--pane-dir <path>]\nrunpane loops list [--json] [--pane-dir <path>]\nrunpane loops create (--repo <selector>|--session <id|name|new>) --name <name> --cron <expr> (--agent <claude|codex|cursor>|--tool-command <command>) [--prompt <text>|--prompt-file <path|->] [--worktree-name <template>] [--paused] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane loops update --loop <id> [--repo <selector>|--session <id|name|new>] [--name <name>] [--cron <expr>] [--agent <claude|codex|cursor>|--tool-command <command>] [--prompt <text>|--prompt-file <path|->] [--worktree-name <template>] [--dry-run] --yes [--json] [--pane-dir <path>]\nrunpane loops run --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops pause --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops resume --loop <id> --yes [--json] [--pane-dir <path>]\nrunpane loops delete --loop <id> --yes [--json] [--pane-dir <path>]\n```\n\n## Agent Context\n\nPane runs coding agents in parallel git worktrees. A Pane is a visible workspace for one feature or PR, with its own Pane-managed git worktree and branch; a panel is a terminal tab in a Pane and shares its worktree; an agent is a CLI process running in a panel.\n\nDoctor-first environment discovery:\n\n```bash\nrunpane doctor --json\n```\n\nBrief CLI context:\n\n```bash\nrunpane agent-context\nrunpane agent-context --json\n```\n\nDetailed command discovery:\n\n```bash\nrunpane agent-context --command <command> [--json]\n```\n\nBrief tools:\n\n- `doctor`: Report wrapper, platform, installed Pane, and daemon reachability before an agent mutates Pane state.\n- `agent-context`: Print token-efficient Pane command context for coding agents.\n- `agents doctor`: Check whether Codex or Claude is available in the repo environment Pane will use.\n- `repos list`: List repositories saved in the running Pane app.\n- `repos add`: Register an existing git repository with the running Pane app.\n- `repos get`: Show a saved repository's Project Settings and the scripts Pane will run.\n- `repos update`: Change a saved repository's Project Settings: scripts, worktree folder, name, IDE command, system prompt, and environment variables.\n- `repos rename`: Rename a repository saved in the running Pane app.\n- `secrets list`: List Pane secrets: project, name, time and machine. Never a value.\n- `secrets exec`: Run a command with Pane secrets in its environment.\n- `secrets request`: Ask the person for a secret on a masked card; returns saved or declined, never the value.\n- `panes list`: List Pane sessions, optionally scoped to a saved repository.\n- `panes cost`: Report estimated token cost per Pane, with per-model breakdown and cache efficiency.\n- `panes create`: Create a Pane (a new worktree) only when the work's branch has no Pane yet; for review, audit, fix or QA on existing work use `panels create --pane <id>`.\n- `panes archive`: Archive a Pane exactly like the UI Archive action, including safe removal of its Pane-managed git worktree, or archive every merged Pane in a Session.\n- `panes pin`: Declaratively pin a Pane (the Pane UI's favorite/pin star) without changing focus.\n- `panes unpin`: Declaratively unpin a Pane (the Pane UI's favorite/pin star) without changing focus.\n- `panes rename`: Rename a Pane without changing its worktree, branch, panels, or focus.\n- `panes focus`: Raise the Pane window and select a Pane (and optionally a panel) on explicit user request.\n- `panels create`: Open reviewer, QA, fix or helper agent tabs inside an existing Pane; they share that Pane's worktree. The default for any later agent on existing work.\n- `panels open`: Show the user an HTML page, plan, report, dev server URL, or file as a tab in split view beside the agent.\n- `panels close`: Close a tab an agent opened once it no longer matters; refuses the person's tabs, busy agents and unsent input.\n- `panels list`: List tool panels inside a Pane session.\n- `panels output`: Read recent terminal output from a panel.\n- `panels screen`: Read a compact current-screen view from a terminal panel.\n- `panels input`: Send input bytes to a terminal panel.\n- `panels submit`: Send text plus terminal Enter to a terminal panel.\n- `panels submit-composer`: Submit an agent composer with the key for its current state.\n- `panels wait`: Wait for terminal initialized, ready, idle, or text state with compact output.\n- `panels resume`: Restart a stopped terminal panel in place (same panel id), resuming its agent's conversation.\n- `watch`: Wait for workspace events from the durable daemon journal; follow uses conservative cadence and quiet expiry by default.\n- `notify`: Ask the person a question wherever they are and wait for the answer; prefer it to asking in the terminal.\n\nManaged AGENTS.md block body:\n\n```md\n## Pane\n\nThis repository is used with [Pane](https://runpane.com). Drive it with the CLI or the `pane` MCP server.\n\nPane: one per feature (one worktree, one branch). Before creating one, find the feature's Pane (`runpane panes list --json`, match the branch) and create one only when none exists. Tab: reviews, review reruns, QA, fixes and follow-ups for a feature go in new tabs in its Pane (`runpane panels create --pane <id>`), never a new Pane or a plain `git worktree`. With the MCP tools, open a tab with `panels_create`, or `agents_start` with `pane`.\n\nWhen you need the person (a choice, an approval, a short answer), call the `notify` MCP tool (or `runpane notify`) instead of asking in the terminal. If it returns `waiting`, call it again with `resume`; if it returns `unavailable`, ask in the terminal. Claude's own card (AskUserQuestion) is only for a quick question in the chat the person is typing in, about their latest message, that steers only this turn; everything else is an approval card, and Codex and other agents always use one. A worker in a Pane Session (`PANE_SESSION_DIR` set, `PANE_ORCHESTRATION_SESSION_ID` unset) doesn't call `notify`: it reports blocked to its orchestrator with `runpane report --state blocked --question \"<question>\"`. Its orchestrator relays that card with `runpane notify --relays <item> ...`, the answer goes straight to the worker's tab, and the orchestrator records it with `runpane inbox ack <item> --decision <D-n>`. For an API key, token or password, call `secrets_request` (or `runpane secrets request`), never `ask`; if that returns `unavailable`, ask the person to save it in Pane under Settings > Secrets.\n\nTo free disk or memory, run `runpane machine health` and delete only with `runpane machine cleanup` (a dry run until `--yes`), never `rm`. Put QA roots and test instances in the Pane's scratch folder (`$PANE_SCRATCH_DIR`).\n\nCLI: `npm i -g runpane` (or `npx --yes runpane@latest`), then `runpane doctor --json`. Full command reference: `runpane agent-context --json`.\n\nDevices: the `device_*` MCP tools (or `runpane devices`) open an iOS simulator or Android emulator as a tab in the calling Pane, then drive it. `runpane docs read --doc docs/DEVICES.md` has the rest.\n\nMCP: packaged Pane registers a stdio server named `pane` with Claude Code, Codex, and Cursor. Check the connection with `claude mcp list`, `codex mcp list`, or `agent mcp list`. Cursor may ask you to enable `pane` with `agent mcp enable pane`. If tools are missing, add it in the agent's MCP settings: Claude Code `claude mcp add --scope user pane -- npx --yes runpane@latest mcp`; Codex (`~/.codex/config.toml`) table `[mcp_servers.pane]` with `command = \"npx\"` and `args = [\"--yes\", \"runpane@latest\", \"mcp\"]`; Cursor (`~/.cursor/mcp.json`) uses `mcpServers.pane` with the same `npx` command and args; any other stdio client uses them too.\n```\n\n## Wrapper Flags\n\nThese flags are consumed by the wrapper:\n\n```bash\n--version <latest|vX.Y.Z>\n--download-dir <path>\n--pane-path <path>\n--format <auto|appimage|deb|dmg|zip|exe>\n--dry-run\n--yes (aliases: -y)\n--verbose\n```\n\nThe top-level `runpane --version` form prints the wrapper version. The install subcommand form `runpane install --version vX.Y.Z` selects a Pane release.\n\n## Local Control Flags\n\nThese flags are consumed by local daemon-control commands:\n\n```bash\n--pane-dir <path>\n--repo <selector>\n--pane <pane-id>\n--panel <panel-id>\n--path <path>\n--name <name>\n--worktree-name <name>\n--branch <name>\n--base-branch <ref> (aliases: --base)\n--folder <name>\n--resume <agent-session-id>\n--agent <codex|claude|cursor|opencode|pi>\n--tool-command <command>\n--title <title>\n--url <url>\n--file <path>\n--initial-input <text> (aliases: --prompt)\n--initial-input-file <path|-> (aliases: --prompt-file)\n--attach <file>\n--from-json <path|->\n--timeout-ms <milliseconds>\n--ready-timeout-ms <milliseconds>\n--concurrency <count>\n--limit <count>\n--for <initialized|ready|idle|text>\n--contains <text>\n--interval-ms <milliseconds>\n--text <text>\n--input-file <path|->\n--source <user|agent>\n--strategy <auto|codex-ctrl-enter|enter|tab>\n--as <consumer-name>\n--since <generation>\n--from <now|earliest>\n--kinds <kind,...>\n--name-contains <text>\n--exclude-pane <pane-id>\n--heartbeat <duration>\n--idle-after <duration>\n--expire-after <duration>\n--ready-settle <duration>\n--blocked-settle <duration>\n--min-interval <duration>\n--body-file <path|->\n--session <id|name>\n--ttl <duration>\n--wait <milliseconds>\n--timeout <duration>\n--note <text>\n--loop <id>\n--cron <expr>\n--message <message>\n--query <text>\n--doc <path>\n--toolsets <name,...>\n--keys <name,...>\n--state <ready|blocked|failed|done>\n--pr <number>\n--head <sha>\n--summary <text>\n--summary-file <path|->\n--question <text>\n--conversation <id>\n--cwd <path>\n--note-file <path|->\n--machine <name>\n--model <model>\n--effort <level>\n--build-script <script>\n--run-script <script>\n--archive-script <script>\n--worktree-folder <path>\n--open-ide-command <command>\n--system-prompt <text>\n--clear <setting,...>\n--env <VAR=NAME|json>\n--env-remove <name,...>\n--project <project>\n--only <name,...>\n--reason <text>\n--epoch <epoch>\n--ui <options|approve|ask|info>\n--context <text>\n--choices <json>\n--detail <text>\n--detail-label <text>\n--suggestions <json>\n--action <json>\n--links <json>\n--content <text>\n--agent-farm <profile>\n--arg <key=value>\n--item <id>\n--relays <item>\n--about-session <id|name>\n--questions <json>\n--took <id|Q-n>\n--took-as <answer|question>\n--status <text>\n--update <id|Q-n>\n--asked <text>\n--what-changed <text>\n--decision <D-n>\n--choice <label>\n--because <why>\n--colors <json>\n--css <text>\n--theme <id>\n--search <text>\n--platform <ios|android>\n--device <name-or-id>\n--wait-ms <milliseconds>\n--kind <kind>\n--json\n--wait-ready\n--no-focus\n--focus\n--split\n--tab\n--pinned\n--no-pinned\n--no-associate\n--force\n--remove-worktree\n--merged\n--closed\n--launch\n--as-file-pointer\n--follow\n--until-event\n--ack-now\n--include-held-input\n--all-stopped\n--include-shells\n--no-held-input\n--self-test\n--report\n--fix\n--read-only\n--template\n--push\n--note-only\n--interrupt\n--expect-report\n--no-expect-report\n--all\n--paused\n--chat\n--next\n--approve\n--deny\n--hook\n--background\n--idle\n```\n\n`runpane doctor --json`, `runpane repos list`, `runpane panes ...`, and `runpane panels ...` commands use or describe the local framed daemon socket/pipe for a running Pane app. `--pane-dir` points the wrapper at a non-default Pane data directory, such as `PANE_DIR=~/.pane_test` in development. `runpane agent-context` is local/offline and can be used before Pane is running. `agent-context` and `version` accept and ignore `--pane-dir`, so one `--pane-dir` can be passed to every runpane command. In a Pane repository checkout, if `runpane` is not on PATH, build the local wrapper with `pnpm --filter runpane build` and run it with patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x), for example `node packages/runpane/dist/cli.js doctor --json`. From WSL, if the user runs Windows Pane, use Pane's own `runpane` (on PATH in Pane's WSL terminals, or `/mnt/c/Users/<you>/.pane/bin/runpane`), which reaches the Windows named-pipe daemon through WSL interop; older Pane builds need `powershell.exe -NoProfile -Command 'Set-Location $env:TEMP; runpane ...'`.\n\n## Daemon Passthrough Flags\n\n`runpane install daemon` forwards these flags to `pane --remote-setup`:\n\n```bash\n--label <name>\n--prefer-tunnel <tailscale|ssh|manual|auto>\n--channel <stable|nightly>\n--base-url <url>\n--pane-dir <path>\n--listen-port <port>\n--port <port>\n--repo-ref <ref>\n--auto-listen-port\n--interactive-tailscale-setup\n--no-install-service\n--no-tailscale-serve\n--print-only\n```\n\nUnknown daemon flags should be forwarded rather than dropped so newer Pane versions can extend `--remote-setup` without requiring an immediate wrapper release. Unknown flags for non-daemon commands should fail clearly.\n\n## Machine-Readable Schemas\n\nStable `--json` response schemas live in `contracts/runpane/contract.json` under `jsonSchemas`.\n\nA failed command exits 1 and prints its message and a `Next:` line to stderr. With `--json` it also prints `jsonSchemas.error` to stdout: `{ \"ok\": false, \"error\": { \"code\": \"...\", \"message\": \"...\", \"next\": \"...\" } }`. Branch on `code`; `next` is the step to take when one is known. A command whose result has its own `ok: false` shape, such as an archive refusal or `panels last-message` without a transcript, prints that result instead, and `watch` reports failures as WATCH ERROR lines with exit 2.\n\nOpenAPI should be generated later from the stable local HTTP/API subset of the same contract, not maintained as a second source of truth.\n\n## Download Attribution\n\nThe npm package uses `source=npm` for all npm-registry consumers, including `npx`, `pnpm dlx`, `yarn dlx`, `bunx`, and global npm/pnpm installs.\nThe PyPI package uses `source=pip` for all Python consumers, including pip, pipx, uvx, and `python -m runpane`.\nWrappers should prefer `https://runpane.com/api/download?platform=<platform>&arch=<arch>&format=<format>&version=<version>&channel=<channel>&source=<npm|pip>`.\nIf the website route cannot satisfy the download, wrappers may fall back to the matching GitHub release asset and print a warning that website attribution may be incomplete for that run.\nWrappers emit best-effort telemetry to `https://runpane.com/api/runpane/telemetry` for command failures, download request/success/failure, and GitHub fallback usage. Routine command starts and successes emit nothing. A command failure is a thrown error, or a non-zero exit from `install` or `update` (also when setup runs them); other exit codes are documented results (such as `panels wait` not ready or `doctor` findings) and emit nothing. Polling and status commands (`panes list`, `panels wait`, `watch`, `panes archive`, `workspace state`, `agents status`, `doctor`) emit no failure events, and neither does a `not_found` failure outside `install` and `update`. A failure event carries the command, `failure_stage`, `failure_category`, `exit_code` when known, and `error_code` (the code printed in the `--json` error). Both wrappers share a per-install limit in `<PANE_DIR>/runpane-wrapper-telemetry.json`: one failure event per cause per hour and at most 10 per hour.\nWrapper telemetry uses a persisted anonymous `install_id` in the form `install_<uuid>` and PostHog `distinct_id = install:<install_id>` so installs reporting failures or downloads can be counted with `count(DISTINCT properties.install_id)`; this is not a count of all CLI users.\nWrapper telemetry must be disabled in CI (`CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`, `CIRCLECI`, `TF_BUILD`, `JENKINS_URL`, `TEAMCITY_VERSION` or `CODEBUILD_BUILD_ID` set), when `DO_NOT_TRACK=1` or `RUNPANE_TELEMETRY_DISABLED` is set, and when the local config explicitly disables analytics. It must not include raw paths, labels, prompts, raw error text, or environment values.\nDesktop local control reports useful failures as `runpane_local_control_failed`; normal polling, wait deadlines, and optional agent unavailability emit nothing. Reports contain coarse operation and failure classification only, with a five-minute deduplication interval and a maximum of 20 per hour per app process. Handled CLI failures are ordinary events, not exceptions.\n\n## Publishing Credentials\n\nLocal implementation, build, and dry-run validation do not need npm or PyPI API tokens.\nRelease publishing should prefer npm Trusted Publishing and PyPI Trusted Publishing from GitHub Actions.\nFallback `NPM_TOKEN` or `PYPI_API_TOKEN` credentials may be used for first package reservation or manual publication only. They must be supplied through local environment variables or GitHub Actions secrets, never committed, and revoked or rotated after use.\n"},{"path":"docs/RUNPANE_WORKSPACES.md","title":"Workspaces: reach all your machines with runpane","text":"# Workspaces: reach all your machines with runpane\n\n`runpane workspace` lets your Macs, Windows PCs, and Linux machines read files, write files, run commands, and drive each other's Pane over the Tailscale network you already use, or over any route of a computer saved in Pane, such as one linked with a [one-time link](QR_PAIRING.md#link-another-computer). On Tailscale each request is trusted because Tailscale says which login it comes from, and a linked computer is trusted by the token it got when the two were linked. Your own login is always let in; a teammate's machine lets you in when its owner shares it with everyone on the tailnet.\n\nThe same listener powers codeless desktop remote mode: the sidebar's machine menu and Settings › Remote Access › **Computers** list the machines on your tailnet, including ones you have never connected to (a teammate's machine that accepts only its owner shows as \"Owner only\" and can't be picked), and picking one switches the desktop app to that machine with no `pane-remote://` code. A computer that is both on your tailnet and saved in Pane shows once, with a pill for each route. `runpane workspace` reaches the same machines. Who may connect is set under Settings › Remote Access › **Tailscale** › **Who can connect** (see [Who is trusted](#who-is-trusted)).\n\n**All machines**, the first item in the machine menu, fills the sidebar with the Sessions and Panes of this computer and every saved machine, live, each row marked with its machine. A repository on several machines shows as one project row, with a mark for each machine it is on: each host reads its projects' origin remote (`host/owner/repo`, so SSH and HTTPS clones match, whatever the folder is called), and a fork with a different origin is its own row. A project with no origin, or from a machine on an older Pane, joins a row by name. Opening a row on another machine switches the app to that machine and keeps the sidebar in All machines; pin, pause, resume, archive, rename and permission answers from a row's menu run on its machine without switching, and **Allow** first shows the request in the permission dialog. Archived and the collapsed sidebar show the machine you're on. Search covers every machine's rows. A machine that stops answering keeps its rows, dimmed, with when it went offline and **Retry**. Rows keep the order you give them: drag a Session (across machines) or a Pane (within its project), or move a focused row with Alt+Up/Down, and the arrangement is saved on this computer only, never on the machines it shows. The first time a machine answers, its rows join in that machine's own order, placed by the machine menu however late it answers; Sessions and Panes that appear after that go first, and agent status never moves a row. Projects and Sessions start closed; what you open and close is remembered on this computer. Picking one machine returns to its own sidebar, and the choice is kept across relaunch.\n\n```\nrunpane workspace list\nrunpane workspace <machine> read <path>\nrunpane workspace <machine> write <path> # content from stdin, or --content <text>\nrunpane workspace <machine> exec -- <command> # runs in that machine's shell\nrunpane workspace <machine> <runpane command> # e.g. sessions list --json\n```\n\n`<machine>` is the Tailscale machine name (`parsa-devbox`), a unique prefix (`devbox`), the MagicDNS name, or a Tailscale IP. A computer saved in Pane also answers to its name in lower case with dashes (`travel-laptop`), its Pane id, its install id, its relay id (the `<id>` in its `<id>.runpane.net` address) and the host name of any of its routes. `runpane workspace list --json` shows them under `ids`.\n\nEach computer is one entry. A computer saved in Pane is matched with its tailnet entry by its Tailscale route, or else by a name no other saved computer has, so two computers with the same name stay two entries. runpane reaches it on its routes in the order Pane saved them, adding Tailscale when the computer is on your tailnet without a saved Tailscale route. A route that doesn't connect within 2.5 seconds (1.5 seconds on the same network, and a same-network address is tried only when it is on one of this computer's subnets), whose Pane isn't running, or that refuses the credential gives way to the next. A request that reached a Pane never goes to a second route, so nothing runs twice. When the tailnet says the computer is offline (Tailscale signed out there), Tailscale is tried last. A saved computer works with Tailscale off.\n\n`runpane workspace list` shows your own machines first, then other people's machines on the tailnet labeled with their owner's login (`tylers-mac-mini (macOS, online, owner tbrownio@github)`). A saved computer lists its routes and the one that answered (`parsa-devbox (Windows, online) [Tailscale, Pane relay]: joined through Pane relay, shell bash`). Each machine decides who it lets in. A machine set to \"Only me\" refuses other logins, and the error says how its owner can change that. A path shaped like another OS's (`C:\\...` on a Mac) routes only to your own machines; reach someone else's machine by name.\n\nAgents can call them as MCP tools too: `workspace_list`, `workspace_read`, `workspace_write`, and `workspace_exec` are in the [Pane MCP server](PANE_MCP.md#toolsets)'s default toolset. `workspace_write` requires `content`, since a tool call has no stdin, and file contents and command output come back exactly as the CLI's `--json` prints them.\n\n## Link a computer from the command line\n\n`runpane link '<link>'` links this computer with the one that made a [one-time link](QR_PAIRING.md#link-another-computer), for a computer with no screen. Copy the link on the other computer (**Add a device › Computer**). Pane must be running here with phone access on. When both computers already have linked computers, it names both groups and asks before joining them; in a script or with `--json`, pass `--yes`, or it exits with `ERR_LINK_NEEDS_CONFIRM` and leaves the link unused. Then `runpane workspace list` shows the new computer.\n\nThese commands ship in the npm CLI (`npm i -g runpane`, or `npx --yes runpane@latest workspace list`). The Python package prints the workspaces status block but does not run them.\n\n`workspace <machine> <runpane command>` runs any command that talks to Pane, such as `sessions list`, `panes list`, or `workspace state`, against that machine's Pane. Commands that only make sense on the machine you type them on (`doctor`, `agent-context`, `mcp`, `docs`, `install`) are refused with the alternative: run them there with `runpane workspace <machine> exec -- 'runpane doctor'`.\n\n## Turning it on\n\nWorkspaces are on by default. When Tailscale is installed and signed in, the desktop Pane that owns `~/.pane` joins your tailnet as it starts:\n\n- It listens on `127.0.0.1` on a free port.\n- It runs `tailscale serve --bg --https=8443 http://127.0.0.1:<port>`, next to the remote daemon's port 443 handler if you have one.\n- Nothing is opened to the public internet, and no firewall rule is added. Serve is reachable only inside your tailnet.\n\nEvery `runpane --help`, `runpane doctor`, and `runpane agent-context` prints the current state:\n\n```\nWorkspaces: on (parsas-macbook-pro)\nOther machines: parsa-devbox (Windows, online), parsas-macbook-air (macOS, offline)\nReach them: runpane workspace <machine> read|write|exec|<command>\n```\n\nWhen workspaces are off, the first line says why and gives the one step that fixes it:\n\n| Reason | Fix |\n|---|---|\n| Tailscale is not installed | Install Tailscale from https://tailscale.com/download and sign in. |\n| Tailscale is signed out | Open Tailscale and sign in. |\n| This tailnet has HTTPS certificates turned off | Turn on HTTPS Certificates at https://login.tailscale.com/admin/dns. |\n| Pane is not running | Open Pane. |\n| Turned off with `runpane workspace disable` | `runpane workspace enable` |\n\nWhile the tailnet has HTTPS Certificates turned off, the desktop app shows a notice with a link to that setting. Turning it on writes machine names (`<machine>.<tailnet>.ts.net`) to the public Certificate Transparency log. The notice clears within a minute of the change, and `runpane workspace list` names the setting as the reason other machines are not reachable.\n\n`runpane workspace disable` removes the 8443 handler and keeps this machine off until `runpane workspace enable`. This machine can still reach your other machines while it is off. A Pane started with a different data directory (`PANE_DIR` or `--pane-dir`) stays off unless you run `runpane workspace enable` against it.\n\nPane must be running on a machine for others to reach it. Pane checks Tailscale again every minute, so signing in to Tailscale after Pane starts is enough. Serve handlers belong to one tailnet, so after you switch this machine to another tailnet Pane puts the 8443 handler back on the new one and reports the new URL within a minute.\n\n## Who is trusted\n\nTwo settings decide, in the **Access** group of Settings › Remote Access › **Tailscale**. Every request must pass both: its login is allowed by **visibility**, and, when **password protection** is on, it carries the password.\n\n| Visibility | Who can connect | |\n|---|---|---|\n| Off | Nobody without a pairing code. Same as `runpane workspace disable`. | |\n| Only me | Devices signed into this machine's own Tailscale login. | Default |\n| Everyone on tailnet | Anyone with an untagged device in the current tailnet. Pane warns before turning it on. | |\n\nPane learns the owner from the `Self` entry in `tailscale status --json`, and Serve adds a `Tailscale-User-Login` header to every request after removing any copy the caller sent. Under \"Everyone on tailnet\", the people on the tailnet are the owners of its untagged devices, re-read every minute; people a device was shared with from another tailnet (Tailscale's sharee nodes) are not among them, even though Serve signs their requests too.\n\nPassword protection is off by default. When it is on, every client must send the password, your own machines included; the desktop app asks for it once and saves it with that machine's connection. Pane stores only a scrypt hash of it, and only someone at the machine itself can change visibility or the password: remote clients are refused. `runpane workspace` sends the password the desktop app saved for that computer. To reach a password-protected machine from the CLI, connect to it once from Settings › Remote Access › Computers and enter the password.\n\n- Under \"Only me\", a device signed in as another Tailscale user, including a teammate's Mac shared into your tailnet, is refused.\n- A tagged device is refused: Serve sends no identity for it.\n- Pane answers only requests that arrive through Serve: Serve's target path carries a secret that changes every launch, and requests straight to the loopback port are refused. Another OS user on the same machine who can read `tailscale serve status` could learn it, so give other accounts on a joined machine only the trust you would give the owner.\n- Browsers are refused. A web page open on one of your devices could otherwise send requests that Serve signs with your login. Pane refuses any request that carries a browser `Origin`; the phone app's WebSockets, which always carry one, send a fixed value no browser can. The one exception is the Pane glasses app for Even G2: it needs your Tailscale login, a per-device glasses token, and the Even app's origin (built in) or one you allowed, and it reaches only the commands the glasses use. See [Even G2 glasses](EVEN_G2_GLASSES.md#security).\n- Integration keys are shared only with the owner's login, even under \"Everyone on tailnet\". See [Shared integration keys](SHARED_CREDENTIALS.md).\n- A teammate's `exec` commands and terminals run as you and can reach every Pane secret, and each synced host keeps a copy, so \"Everyone on tailnet\" on any one host exposes them all. Pane refuses only their direct secret requests (secret cards, secret variables, shared key sync). See [Who can read a secret](PANE_SECRETS.md#who-can-read-a-secret).\n- Any device signed in as you, your phone included, is trusted. `runpane workspace list` shows only Macs, Windows PCs, and Linux machines, but that is a listing choice, not a block.\n- Removing a device from Tailscale revokes it everywhere.\n- The same setting decides who opens the host's dev servers and HTML pages in the Remote Pane app's browser tabs, at their `https://<host>.ts.net:<n>` addresses. A page in a frame cannot send the password, so those pages are off while password protection is on. See [Browser tabs on the phone](SELF_HOSTED_REMOTE_DAEMON.md#browser-tabs-on-the-phone).\n\n## What `write` and `exec` can do\n\nEvery admitted login can also reach any port listening on the machine from desktop Pane, as [forwarded ports](SELF_HOSTED_REMOTE_DAEMON.md#forwarded-ports).\n\n`write` and `exec` give your agents SSH-level control of every joined machine, and so does anyone the machine's visibility lets in: under \"Everyone on tailnet\" that includes the other people on the tailnet. A local agent's permission prompts and sandbox see only `runpane workspace ... exec`, not what runs on the other machine. Turn workspaces off on any machine that should not accept this.\n\n## Workers on another machine join your Session\n\nA Session orchestrator on this computer can run workers on your other machines. `runpane workspace parsa-devbox panes create --repo \"Pane (win)\" --tool-command \"codex -m gpt-5.5\" --prompt \"...\" --json`, run from inside a Session, creates the Pane on that machine and adds it to this computer's Session; `association.machine` names the machine. Pick a saved WSL repository there to run the worker in WSL. Its `runpane report` states, blocked questions and tab exits reach this computer's `runpane watch --session`, Approvals and phone, and an answer you give goes back to its tab. `sessions overview` and the Session's Overview tab list it with its machine; a machine that doesn't answer shows its workers as unreachable.\n\nThe machine must be saved on this computer (the machine switcher > **Add a device…**): only saved machines send their workers' reports here, over the connection All machines already uses. Creating a Pane on an unsaved machine still works and returns `association.ok: false` with `ERR_MACHINE_NOT_SAVED`. Both machines need a Pane release with remote Session members; a machine on an older one returns `association.code: ERR_MACHINE_OLDER_PANE`, and its row says to update it. Reports sent while either computer was asleep or offline arrive when they reconnect, once each and in order.\n\n## Ask another model a question\n\n`runpane ask` asks any agent and model one read-only question and prints the answer. Nothing is left open: the agent's own headless mode runs once and exits.\n\n```bash\nrunpane ask --agent claude --model sonnet --prompt \"Is this migration safe to run twice?\" --repo Pane --json\nrunpane ask --agent codex --machine parsa-devbox --repo \"Pane (win)\" --prompt \"Why does this test fail on Windows?\"\nrunpane ask --agent opencode --model openrouter/deepseek/deepseek-chat --machine parsa-devbox --repo \"experiments (wsl)\" --prompt-file question.md\n```\n\n`--machine` runs it on another machine in your workspace, `--repo` in a saved repository there (a WSL repository runs in WSL) and `--pane` in a Pane's worktree. The agent can read files but not edit them, run shell commands or call MCP tools: Claude runs with only Read, Grep and Glob, Codex in its read-only sandbox without your Codex config, MCP servers or apps, Cursor in ask mode, and OpenCode's plan agent with edit, bash and every MCP tool denied. Pi has no such mode, so ask refuses it. `--json` prints the answer, agent, model, machine, environment, duration and cost when the agent reports one. A missing agent, a sign-in problem, an unknown model and a timeout (`--timeout`, 10 minutes by default) each fail with the agent's own words and what to do next. The MCP tool is `agents_ask`.\n\n`runpane models` lists the models each installed agent offers, from the agent's own list, with its sign-in in the agent's words. `--all` covers this computer, every saved machine and the WSL of each machine with a saved WSL repository; `--agent` and `--search` narrow it. Claude has no list command and takes `fable`, `opus`, `sonnet`, `haiku` or a full model name. To give a terminal worker a model, put the agent's model flag in `--tool-command`.\n\n## Hand a task to another machine\n\n`runpane handoff` uses workspaces to move a task to an agent on another of your machines. The sending agent writes a handoff note; the CLI checks it, makes sure the branch is pushed, and starts the agent there. When the sender is a Pane tab running Claude, Codex or Cursor and the receiver is the same agent, the agent's own session moves too:\n\n```\nrunpane handoff --template > ~/handoff.md # fill in every section\nrunpane handoff \"claude opus on parsas-macbook-pro\" --note-file ~/handoff.md --push\n```\n\nThe destination machine needs Pane running, the repository saved in Pane with a remote for the same GitHub repository, and its own `runpane` on PATH (otherwise it uses `npx runpane@latest`). The note lands in that machine's `~/.pane/handoffs/`, the agent starts in a new Pane branched from your branch, and it reports back to your panel with `runpane workspace <your machine> panels submit`. For a same-agent handoff the session's files are copied into that machine's agent store (`~/.claude`, `~/.codex` or `~/.cursor`, at their default locations), the receiver resumes that session with no prompt, and the CLI checks it continued before telling it where the session moved. The result is `continued`, `inconclusive` (ask the receiver what it was last working on), or `not-continued` (exit 1; the receiver is kept, and `--note-only` starts a fresh agent with the note if you choose). `--note-only`, a different agent, or no session to carry starts a fresh agent with the note. Carrying a Cursor chat to another machine is best effort; on the same machine it is not carried, since a copied Cursor chat still writes to the original. A copy already on the destination is replaced only when yours holds all of it and no agent there runs it; otherwise nothing is copied and the result is `not-continued`. A destination Pane too old to resume a carried session is refused before anything is sent. The note's sections are in the `handoff` skill's [note template](../main/src/services/paneChatBundle/skills/handoff/references/note-template.md).\n\nRun from a Session's terminal, whose folder is outside git, handoff moves the Session instead (the Session menu's **Move to machine…** asks the Session's agent to do this). It skips the git steps and pushes nothing, writes the note to the other machine's `~/.pane/handoffs/` the same way, and creates a Session there with the same name, goal and agent, whose next action is to read the note. With the same agent, the Session's agent session is copied there too and the new Session resumes that conversation when you first open it; the CLI can't check it until then, so it reports `inconclusive` and says what to check. The destination needs only Pane running with workspaces; no repository has to be saved there. The new Session waits for your first message, and the original stays where it is. A Session can't be handed off to the machine it is on. See [Move a Session to another machine](SESSIONS.md#move-a-session-to-another-machine).\n\n## Paths across Windows, WSL, and macOS\n\n`read`, `write`, and `exec --cwd` take any path form and translate it on the machine that runs the request, so agents do not need `cat` on one machine and `Get-Content` on another:\n\n- `C:\\Users\\me\\notes.md` and `/mnt/c/Users/me/notes.md` reach the same Windows file.\n- On Windows, WSL paths such as `/home/me/repo/README.md` are read through `\\\\wsl.localhost\\<distro>\\...` using the default distribution (the one `wsl -l -v` marks with `*`). Name another distribution with `\\\\wsl.localhost\\<distro>\\...`.\n- Inside WSL, `C:\\...` becomes `/mnt/c/...`, and runpane reads the tailnet from Windows' `tailscale.exe`.\n- `~` is the home directory of the machine that runs the request.\n\n`read` prints the file to stdout (`--json` returns `content` with `encoding` `utf8` or `base64`) and lists a directory's entries. `write` writes `--content <text>` or else stdin, creates missing parent folders, and replaces the file. `exec` runs in the shell Pane uses for terminals there (Git Bash or PowerShell on Windows, your default shell elsewhere), prints its stdout and stderr, ends with a line naming the machine, OS, shell, and exit code, and exits with the command's exit code. `--json` returns all of these fields. Pass the command as one quoted string (`exec -- 'grep \"a b\" notes.md'`): several words after `--` are joined with spaces. Without `--` (PowerShell drops it before npm's `runpane.ps1` sees it), the command starts at the first word that is not an exec option. That machine's own `runpane` comes first on `PATH`, so `exec -- 'runpane version'` works even where its user `PATH` lacks `~/.pane/bin`. A command that starts a background job returns when the shell exits, and `--timeout-ms` stops the whole process tree. If that tree cannot be stopped, the result says so (`stillRunning` in `--json`, \"may still be running\" in text).\n\n## Without a machine name\n\nWith no `<machine>`, `read`, `write`, and `exec --cwd` route a path that cannot exist on this machine to the one joined machine it fits. `C:\\...` on a Mac goes to your Windows machine; if several fit, runpane lists them and asks for a name. Any other path is this machine's: `read` and `write` hand it to this machine's Pane, so it follows the same rules as a named machine (`~`, directories, new parent folders), and Pane must be running here.\n\nOther commands help in the same way. When a file such as a `--from-json` or `--prompt-file` path is missing and looks like another machine's path, the error names the likely machine and the exact `runpane workspace <machine> read` command. When a Session is not found here, runpane checks your other online machines and names the one that has it.\n\n## Workspaces and pairing codes\n\nWorkspaces and the [self-hosted remote daemon](SELF_HOSTED_REMOTE_DAEMON.md) both use Tailscale Serve, for different jobs:\n\n| | Workspaces | Pairing codes (remote daemon) |\n|---|---|---|\n| For | Your own machines (runpane CLI and desktop remote mode), or your tailnet when you choose | Browsers, phones, and devices on another Tailscale account |\n| Trust | Tailscale login, by visibility, plus an optional password | A `pane-remote://` code per device |\n| Serves | The desktop Pane's `~/.pane` | The remote daemon's data directory, usually `~/.pane_remote` |\n| Port | 8443 | 443 |\n| Setup | None | `runpane setup` on the host, then paste the code |\n\nOn the workspace listener (port 8443), machine commands (`read`, `write`, `exec`) run for every request Pane admits there. On the other listeners they run only for a linked computer's token, never for a phone's or a `pane-remote://` code's token. On Pane relay and same-network routes, `runpane workspace` checks the computer's key before it sends the token.\n\n## Troubleshooting\n\n- When **Connect** fails, the desktop app shows a checklist naming the stage that failed and its fix; see [When a connection fails](SELF_HOSTED_REMOTE_DAEMON.md#when-a-connection-fails).\n- `runpane workspace list` shows each machine's state. \"Pane is not answering there\" means Pane is not running on that machine, its workspaces are off, or it runs a Pane version without workspaces.\n- `tailscale serve status` should list `https://<machine>.<tailnet>.ts.net:8443` proxying to `http://127.0.0.1:<port>`.\n- A Pane older than workspaces reports `Workspaces: off ... (this Pane is older than workspaces)`; update Pane.\n"},{"path":"docs/SELF_HOSTED_RELAY.md","title":"Run your own relay","text":"# Run your own relay\n\nPane's relay gives each of your computers an https address that works from\nany network, so phones, browsers and other computers reach them from\nanywhere. Run your own and your computers use your domain and your machine\ninstead of Pane's servers. Everything works the same: pairing, terminals,\npreviews, alerts, linked computers and direct paths. The relay is one\nopen-source binary, `pane-relay` ([`relay/`](../relay)); its wire protocol is\n[relay/PROTOCOL.md](../relay/PROTOCOL.md).\n\n## Start one in five minutes\n\nThis needs Pane 2.4.227 or later: that release is the first with the relay\nimage, `compose.yaml` and `runpane relay init`.\n\nYou need:\n\n- A Linux machine with a public IPv4 address and Docker with its Compose\n plugin ([install Docker](https://docs.docker.com/engine/install/)), such as\n a small cloud VM. This guide uses `203.0.113.10`; use your machine's public\n address, as its cloud console shows it.\n- A name for the relay under a domain whose DNS you manage, such as\n `relay.example.com`. The relay answers DNS for every name under it, so use\n a name you use for nothing else.\n\n1. **Open the ports.** In the machine's firewall or cloud security group,\n allow TCP 443 and UDP and TCP 53. Also allow UDP 7842, which helps devices\n find direct paths; without it they still connect.\n\n2. **Add two DNS records** at the DNS provider for `example.com`:\n\n | Name | Type | Value |\n | --- | --- | --- |\n | `relay-ns.example.com` | A | `203.0.113.10` |\n | `relay.example.com` | NS | `relay-ns.example.com` |\n\n Many providers want only the part before your domain in the Name field\n (`relay-ns`, `relay`). On Cloudflare, set the A record to **DNS only**\n (grey cloud); a proxied record breaks the delegation.\n\n `runpane relay init` prints these records, and every command below, with\n your own name and address. It needs Node.js 22 or later and runs on any\n machine. Its checks at the end fail until you finish step 3; that is\n expected.\n\n ```sh\n npx --yes runpane@latest relay init --domain relay.example.com --public-ip 203.0.113.10\n ```\n\n3. **Start the relay** on the machine. On Ubuntu and Debian, first free\n port 53: their `systemd-resolved` holds it for the machine's own lookups.\n This turns that listener off and keeps lookups working:\n\n ```sh\n sudo mkdir -p /etc/systemd/resolved.conf.d\n printf '[Resolve]\\nDNSStubListener=no\\n' | sudo tee /etc/systemd/resolved.conf.d/pane-relay.conf\n sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf\n sudo systemctl restart systemd-resolved\n ```\n\n Then, in an empty folder, use the lines `relay init` printed, or replace\n all three values with your own (`PANE_RELAY_NS` is the A record's name\n from step 2):\n\n ```sh\n curl -fsSLO https://github.com/greenfield-inc/Pane/releases/latest/download/compose.yaml\n printf '%s\\n' PANE_RELAY_DOMAIN=relay.example.com PANE_RELAY_PUBLIC_IP=203.0.113.10 PANE_RELAY_NS=relay-ns.example.com > .env\n docker compose up -d\n ```\n\n4. **Check it.** Run `relay init` again. Once DNS has spread (usually a few\n minutes), every line shows ✓ and it says the relay is ready:\n\n ```text\n Checks (DNS changes can take a few minutes; run this again after each step):\n ✓ relay-ns.example.com A 203.0.113.10\n ✓ relay.example.com NS relay-ns.example.com\n ✓ relay.example.com A 203.0.113.10, answered by the relay\n ✓ https://relay.example.com/healthz\n ```\n\n The relay gets its certificate from Let's Encrypt through its own DNS. The\n first one takes about a minute once DNS works; until then the last check\n says the certificate is not trusted yet, and `docker compose logs relay`\n shows `relay certificate issued` when it arrives. To check by hand:\n `curl https://relay.example.com/healthz` and\n `dig @203.0.113.10 relay.example.com A`.\n\n5. **Point Pane at it.** On each computer: **Settings › Remote Access › Phones and glasses ›\n Relay address**, enter `relay.example.com` and press Enter. The computer\n reconnects through your relay, gets a certificate for\n `<id>.relay.example.com`, and new QR codes use your domain. Phones paired\n through Pane's servers need a new scan, and computers link only with\n computers on the same relay.\n\n## Keep it running\n\nThe relay restarts with Docker. Each release's `compose.yaml` runs that\nrelease's image, so updating means downloading the new one and restarting:\n\n```sh\ncurl -fsSLO https://github.com/greenfield-inc/Pane/releases/latest/download/compose.yaml\ndocker compose up -d\n```\n\n`PANE_RELAY_VERSION` in `.env` picks another release instead, such as\n`PANE_RELAY_VERSION=2.4.227`; images start with 2.4.227. Certificates\nrenew on their own, without a restart, and live in the `pane-relay` Docker\nvolume.\n\nEvery `pane-relay` flag also reads an environment variable, so any other\nsetting goes in `.env` too, such as `PANE_RELAY_ACME_EMAIL` for a Let's\nEncrypt contact address. [relay/README.md](../relay/README.md#flags) lists\nthem all, including the connection and byte limits and the blocklist. Limits\ncount each client address, so a flood slows and refuses only the address it\ncomes from. Many computers behind one shared address, such as an office\nnetwork, may need a higher `--limit-agent-conns-per-min` and\n`--limit-new-ids-per-hour`.\n\n## Without Docker\n\n`runpane relay` runs `pane-relay` on macOS, Linux and Windows (x64 and\narm64) with Node.js 22 or later. It downloads the binary for its own version\nfrom the GitHub release once, checks it against the release's\n`pane-relay-sha256.txt` and keeps it in your cache folder\n(`~/.cache/runpane/relay`, `~/Library/Caches/runpane/relay` on macOS,\n`%LOCALAPPDATA%\\runpane\\relay` on Windows). Its flags, output and exit code\nare `pane-relay`'s. Ports 443 and 53 need root, or on Linux the\n`CAP_NET_BIND_SERVICE` capability. Free port 53 first as in step 3; passing\nyour `PATH` through `sudo` finds `npx` when Node.js came from nvm:\n\n```sh\nsudo env \"PATH=$PATH\" npx --yes runpane@latest relay \\\n --domain relay.example.com --public-ip 203.0.113.10 --ns relay-ns.example.com \\\n --dns 0.0.0.0:53 --direct-quic 0.0.0.0:7842 \\\n --acme-cache /var/lib/pane-relay/acme\n```\n\nThe release also carries each binary, `pane-relay-<platform>-<arch>`, to\ndownload yourself, and the container image is\n`ghcr.io/greenfield-inc/pane-relay`. To build from source, run\n`cargo build --release` in `relay/`, or `docker build -t pane-relay relay/`.\n\n`--acme-directory` points at another CA, such as Let's Encrypt staging\n(`https://acme-staging-v02.api.letsencrypt.org/directory`) while you try\nthings out. The relay's DNS publishes CAA records that allow only Let's\nEncrypt; with another CA, set `--caa-issuer` to its domain. `--cert` and `--key` take your own certificate instead. It must\ncover `relay.example.com` and `us.relay.relay.example.com`: each relay has a\nregion (`us` unless you set `--region`) and also answers at\n`<region>.relay.<your domain>`. `--direct-quic` is optional: it helps phones and computers find a\ndirect path to each other, and without it they still connect.\n\n## Two name servers\n\nSome registrars want two name servers, and a second relay that answers DNS\nkeeps your names resolving while one machine is down. Run two relays with\nDNS, say `us` at 203.0.113.10 and `eu` at 198.51.100.7, that share one\nsecret and tell each other about computers. Make the secret once, with\n`openssl rand -hex 32`.\n\nAt the DNS provider for `example.com`, add an A record for each machine and\npoint the NS records at both:\n\n| Name | Type | Value |\n| --- | --- | --- |\n| `relay-ns1.example.com` | A | `203.0.113.10` |\n| `relay-ns2.example.com` | A | `198.51.100.7` |\n| `relay.example.com` | NS | `relay-ns1.example.com` |\n| `relay.example.com` | NS | `relay-ns2.example.com` |\n\nThe `.env` on `us` (on `eu`, swap the region, the public address and the\nother relay's URL):\n\n```sh\nPANE_RELAY_DOMAIN=relay.example.com\nPANE_RELAY_REGION=us\nPANE_RELAY_PUBLIC_IP=203.0.113.10\nPANE_RELAY_REGION_IP=us=203.0.113.10,eu=198.51.100.7\nPANE_RELAY_NS=relay-ns1.example.com,relay-ns2.example.com\nPANE_RELAY_REGISTRY_URL=https://eu.relay.relay.example.com/v1/registry\nPANE_RELAY_REGISTRY_SECRET=<the secret>\n```\n\nEach relay sends every change to the other and re-sends its computers every\nminute, so both answer the same records. A further relay that doesn't answer DNS (started without `--dns`) lists\nboth in `--registry-url`:\n`https://us.relay.relay.example.com/v1/registry,https://eu.relay.relay.example.com/v1/registry`.\n\nThe first time, start `us` and wait for `relay certificate issued` in its\nlog before starting `eu`: relays reach each other over https, so the first\nneeds its certificate before the second can post to it.\n\n## Alerts\n\nTo deliver alerts to phones from computers that have no push keys, give the\nrelay the Pane app's keys: `--apns-key-path`, `--apns-key-id`,\n`--apns-team-id`, and `--fcm-service-account` (a service account JSON key).\nWithout them, set the keys on each computer instead\n([Native mobile](NATIVE_MOBILE.md)).\n\nOn Google Compute Engine, Android alerts need no key file: attach the sender\nservice account to the VM, give the VM the `cloud-platform` access scope, and\npass `--fcm-project <project id>`. The relay gets its tokens from the VM's\nmetadata server.\n\nA computer alerts only phones that confirmed it: the relay pushes each phone a\ngrant for the computer, and the Pane app hands it back to that computer\n([relay protocol](../relay/PROTOCOL.md#alerts)). Grants are signed with a key\nfrom `--registry-secret`. Without it, grants end when the relay restarts and\nphones confirm again the next time they connect.\n\n## Direct paths\n\nThe relay is also the meeting point for direct QUIC paths between a computer\nand its devices, at `https://us.relay.relay.example.com/` on the same port\n443. Pane learns this address from the relay (`directRelay` in\n`GET /v1/relays`), so there is nothing to configure.\n\n## What the relay sees\n\nWhich computer each connection is for (the TLS server name), IP addresses,\ntiming and byte counts. It never decrypts traffic: each computer ends TLS\nwith its own key. It logs no payloads, tokens or URLs. Packets on direct\npaths are encrypted between the two ends; the relay sees their iroh endpoint\nids, IP addresses and byte counts.\n"},{"path":"docs/SELF_HOSTED_REMOTE_DAEMON.md","title":"Self-Hosted Remote Daemon","text":"# Self-Hosted Remote Daemon\n\nThis guide covers running Pane on your own workstation, Mac mini, Linux box, or VM and connecting to it from the local Pane desktop app or the Remote Pane browser app with a connection code.\n\nTo pair a phone or another computer without Tailscale or a code, use a QR code or a one-time link instead: see [Add a device](QR_PAIRING.md). To reach a server you already reach over SSH, see [SSH route](#ssh-route).\n\nThe intended flow is:\n\n1. Run one setup command on the remote machine.\n2. Copy the generated `pane-remote://...` connection code.\n3. Paste it into desktop Pane under `Settings > Remote Access > Tailscale > Paste a connection code`, or open `https://runpane.com/app/` and paste it there.\n\nPane saves the profile and attempts to connect immediately. Local desktop mode is unchanged until a remote profile is imported and activated.\n\n## Workspaces or pairing codes?\n\nTo let machines on your tailnet reach each other from the runpane CLI, you do not need this guide or a code. [Workspaces](RUNPANE_WORKSPACES.md) put each desktop Pane on your tailnet automatically (port 8443) and trust your Tailscale login, plus everyone on the tailnet when a machine's owner allows it, so `runpane workspace <machine> read|write|exec|<command>` works between your Macs, Windows PCs, and Linux machines, and the desktop app's remote mode connects to them from the sidebar's machine menu or Settings › Remote Access › Computers. Use the remote daemon and pairing codes in this guide for browsers and phones, and for devices outside your tailnet. The remote daemon keeps port 443, and the two run side by side.\n\n## Guided quick start\n\nOn the host machine, run `npx --yes runpane@latest` in an interactive terminal.\nChoose **Set up a remote host**, enter a name (or press Enter),\nand follow the Tailscale installation/login prompts. The wizard picks an available\nport and prints a connection code. Sign your other device into the same Tailscale\nnetwork, then paste the code into Pane or [runpane.com/app](https://runpane.com/app/).\n\nIf the host later switches to another tailnet, Pane notices while it runs: within\na minute it re-creates the `:443` Serve forward on the new tailnet, and new codes\nuse the new address. Codes created before the switch still point at the old\ntailnet, so create a new one. If Pane cannot confirm the forward, it shows the\nerror and the `tailscale serve` command to run instead of creating a code.\n\nSSH and manual URL setups use the explicit commands below,\nand desktop Pane sets up an SSH host for you (see [SSH route](#ssh-route)).\nThe no-argument and `setup` commands print help in non-interactive shells; they\ndo not start a login prompt.\n\n## Creating a code in desktop Settings\n\nDesktop setup uses an installed, signed-in Tailscale client. If Tailscale is\nmissing, Pane shows installation instructions; use the setup terminal to install\nit. Tailscale discovery, Serve configuration and requested daemon service setup\nrun asynchronously so the desktop stays responsive while they finish.\n\n## One-Command Setup\n\nTo skip the wizard menu, run interactive remote setup directly:\n\n```bash\nnpx --yes runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\npnpm dlx runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\npipx run runpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\nuvx runpane@latest install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n```\n\nSSH tunnel mode:\n\n```bash\nnpx --yes runpane@latest install daemon --label \"VM\" --prefer-tunnel ssh\n```\n\nPersistent installs are also supported:\n\n```bash\nnpm i -g runpane\nrunpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n\npython -m pip install runpane\nrunpane install daemon --interactive-tailscale-setup --auto-listen-port --label \"VM\"\n```\n\nFrom a source checkout:\n\n```bash\npnpm remote:setup -- --label \"VM\"\n```\n\nSSH tunnel mode:\n\n```bash\npnpm remote:setup -- --label \"VM\" --prefer-tunnel ssh\n```\n\nFor validation against a separate data directory:\n\n```bash\nPANE_DIR=/tmp/pane-remote-vm pnpm remote:setup -- --label \"VM\" --prefer-tunnel ssh --print-only\n```\n\nPackaged Pane builds can run the same setup path without opening a window:\n\n```bash\npane --remote-setup --label \"VM\"\n```\n\nOn displayless Linux hosts, prefer `runpane install daemon`; the npm and PyPI\nwrappers pass Electron's required headless flags automatically. For a direct\npackaged launch, pass them explicitly:\n\n```bash\npane --ozone-platform=headless --disable-gpu --remote-setup --label \"VM\"\n```\n\nThese must be command-line arguments: Electron picks its Ozone platform before\nthe app starts, so the environment variable `ELECTRON_OZONE_PLATFORM_HINT` no\nlonger works (removed in Electron 38, ignored from 39 on).\n\nThe wrappers are lightweight installers and configurators. They currently\ndownload the packaged Pane runtime because the daemon is not distributed as a\nseparate binary. AppImage installs therefore require FUSE; on Debian-based\nhosts, `--format deb` avoids the AppImage/FUSE requirement.\n\nIf Pane is already installed on the host, this is the most direct command:\n\n```bash\npane --remote-setup --label \"VM\" --prefer-tunnel tailscale\n```\n\nThe setup command:\n\n- detects Linux, macOS, or Windows host behavior\n- writes remote daemon config into one `PANE_DIR` (default `~/.pane_remote`)\n- enables the loopback listener on `127.0.0.1:42137`\n- creates a paired client record with a hashed token on the host\n- emits the raw token only inside the one-time `pane-remote://...` import code\n- attempts to install and start a user-level daemon service (on Linux, it also\n enables lingering so the service keeps running after you log out)\n- prints the manual daemon command if service setup is unavailable\n- detects Tailscale Serve where possible and otherwise prints an SSH local-forward command\n\nUseful options:\n\n```bash\npnpm remote:setup -- --help\npnpm remote:setup -- --channel nightly\npnpm remote:setup -- --pane-dir \"$HOME/.pane_remote\"\npnpm remote:setup -- --prefer-tunnel ssh\npnpm remote:setup -- --no-install-service\npnpm remote:setup -- --no-tailscale-serve\n```\n\n## Run Pane on a Cloud VM\n\nPane does not create or manage cloud machines. Create the VM yourself, then set\nit up as a Remote Pane host:\n\n1. Create an Ubuntu 24.04 VM with any provider. Size it for the agents and\n builds you plan to run. It only needs inbound SSH. The daemon listens on\n loopback, and you reach it through Tailscale or an SSH tunnel.\n2. SSH in as a regular user with `sudo`, not as `root`.\n3. Install what your agents need on the VM: `git`, patched Node.js 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) (for\n `npx`), and the agent CLIs you use, such as Claude Code or Codex. Sign in\n to each CLI on the VM. Agents run there, not on your laptop.\n4. Install Tailscale and join your tailnet:\n\n ```bash\n curl -fsSL https://tailscale.com/install.sh | sh\n sudo tailscale up\n ```\n\n5. Install Pane and create a connection code. `--format deb` installs the\n Debian package, so the host does not need FUSE:\n\n ```bash\n npx --yes runpane@latest install daemon --label \"Cloud VM\" --format deb\n ```\n\n6. Check that the daemon keeps running after you log out. It runs as a systemd\n user service, and setup turns on lingering (through passwordless `sudo` if\n needed) so the service outlives your SSH session. If the setup output says\n it could not, enable lingering yourself:\n\n ```bash\n sudo loginctl enable-linger \"$USER\"\n systemctl --user status pane-remote-daemon.service\n ```\n\n7. Paste the printed `pane-remote://...` code into desktop Pane (see\n [Import Locally](#import-locally)) or into `https://runpane.com/app/`.\n\nTo start, stop, or delete the VM, use your provider's console or CLI. If\nsomething fails, run `npx --yes runpane@latest doctor --json` on the VM and\ncheck [Troubleshooting](#troubleshooting).\n\n## Import Locally\n\nOn your local desktop machine:\n\n1. Open Pane.\n2. Go to `Settings > Remote Access > Tailscale` and click `Paste a connection code`.\n3. Paste the full `pane-remote://...` code into `Connection Code`.\n4. Click `Connect`.\n\nIf the tunnel is not reachable yet, Pane still saves the host and shows the connection error. Start the printed SSH/Tailscale tunnel and pick the saved host again from `Settings > Remote Access > Computers` or the sidebar's machine menu.\n\n## SSH route\n\nDesktop Pane can reach a computer through your own SSH config, start Pane's headless host there, and keep the tunnel up.\n\n1. Open `Settings > Remote Access > Add a device` (or `Add a device…` in the sidebar's machine menu) and pick the `SSH` tab.\n2. Pick a host from `~/.ssh/config`, or type one under `Another host` (`user@host` works).\n3. Click `Connect`.\n\nPane then:\n\n- connects with the system `ssh`, your config and your agent, and fails instead of asking for a password or host key. Your keys and passwords never leave this computer;\n- checks for Node.js 22 or later there;\n- runs `npx --yes runpane@latest install daemon --label \"<this computer>\" --prefer-tunnel ssh`, which installs Pane when it is missing and starts its headless host as a service;\n- forwards a local port to the host with `ssh -N -L` and saves the computer with an SSH route.\n\nThe computer appears in `Settings > Remote Access > Computers` with an SSH pill. When the SSH connection drops, Pane reconnects it with backoff for up to 5 minutes, and again the next time it uses the route. Each step that fails says why and what to run: `ssh <host>` must connect in a terminal without prompts, and a host without Node.js needs it installed first.\n\n## Public URL\n\nA computer behind your own HTTPS reverse proxy can name that address as a route.\n\n1. On that computer, open `Settings > Remote Access > Computers` and expand its own row (marked `This computer`).\n2. Enter the address in `Public URL`, such as `https://pane.example.com`, and click `Save`. It must be HTTPS.\n\nThe computer reports the address to every computer that connects to it, and they add a Public URL route (\"found automatically\"). Pane runs no tunnel service: the proxy and its certificate are yours. Point the proxy at Pane's host listener on loopback (port `42137` unless you changed it under `Settings > Remote Access > Tailscale > Advanced`), as in [Security Model](#security-model). Phone access turns that listener on.\n\n## Use the Mobile / Browser App\n\nThe same connection code works in the Remote Pane PWA:\n\n```text\nhttps://runpane.com/app/\n```\n\nUse the PWA for phone or tablet access to remote terminals, chats, browser tabs, files and diffs:\n\n1. Set up the remote host with Tailscale or a trusted HTTPS tunnel.\n2. Copy the full `pane-remote://...` code printed by setup.\n3. Open `https://runpane.com/app/` on the client device.\n4. Paste the code and connect.\n\nFor iPhone or iPad, open the URL in Safari, tap Share, then tap `Add to Home Screen`.\nFor Android, open the URL in Chrome, open the browser menu, then tap `Add to Home screen` or `Install app`.\n\nSSH tunnel mode is mainly useful from desktop clients. For mobile browser access, prefer Tailscale or Manual HTTPS so the phone can reach the daemon URL directly.\n\n### Browser tabs on the phone\n\nAdd Tool → Browser opens a browser tab on the phone. A new tab lists the host's listening ports, and the Ports button in the address bar opens the same list. Tap a `web` port to open it; `tcp` ports read \"desktop only\". The address bar is editable and reads the host's own address, such as `localhost:5173/ on <host>`. Copy URL copies the address the phone actually loads, and Open in Safari opens it outside the app. Use Open in Safari for sites that refuse to load in a frame, such as github.com: the tab cannot tell when that happens.\n\nHow a host page reaches the phone:\n\n- When a phone first opens a `web` port, Pane gives that port its own HTTPS address on the host's tailnet name, `https://<host>.ts.net:<n>`, with a `tailscale serve` handler; the tab shows the page under a second later. Pane picks `n` from 44300 up, so it never takes the dev server's own port number. Handlers exist only for opened ports because Tailscale drops its whole Serve config, other apps' handlers included, once a machine holds a few hundred.\n- Each handler points at a loopback preview proxy that checks the visitor's Tailscale login, sends the request to `localhost:<port>` as the dev server expects, carries live-reload WebSockets, and drops the headers that stop a page from loading in a frame.\n- HTML files opened in a browser tab (for example by `runpane panels open --url file://...`) load from one more Serve address, with the files beside them. Files outside the page's folder are refused.\n- A handler goes when its port stops listening, when Pane quits, and at the next launch after a crash. Quit spends at most 5 seconds removing them; a launch removes any it left. Pane changes only handlers it created: their targets start with `/pane-<hash of the Pane data directory>/`, so a dev build and the installed app never remove each other's.\n\nWho can open these pages: the devices that **Who can connect** admits (see [Who is trusted](RUNPANE_WORKSPACES.md#who-is-trusted)). Phone pages need that setting on, Tailscale running on the host, and the phone on the same tailnet. A page in a frame cannot send the machine's password, so phone pages are off while password protection is on. A refused device sees \"This page runs on &lt;host&gt;. Open it from a device signed in as &lt;login&gt;.\" A pairing code or SSH tunnel does not grant access to these pages: they need the phone on this tailnet, signed in with a login that setting admits. Navigation inside a page stays on the phone; the tab saves only the addresses you enter or pick.\n\nThe Pane phone app shows page tabs with an address row (back, forward, address, reload, Open in Safari) and loads them through the same phone addresses. When the files address is off or the phone can't reach it, the app reads an HTML file through its own connection instead (`panels:read-browser-file`), so a self-contained page opens over a pairing code too; pages that load other files from their folder need the phone address. Entering an address saves it to the tab. Each case that can't load names its reason: nothing listens on the port, phone pages are off on that computer (with its reason), the phone is not on Tailscale, the computer is offline, or its Pane predates phone pages.\n\n### Files on the phone\n\nEach pane's Explorer tab shows its worktree as a tree. Tap a text file to read and edit it; Save writes it to the host. The Diff tab lists the branch's changes with their counts and opens each file to its patch, read-only; a chat's **View diff** brings it forward. Text files over 1 MB, and binary files that are not images, PDFs, video or audio, stay on the desktop. Images, PDFs, video and audio of any size preview on the phone, and video seeks without downloading the whole file. Open in Safari opens a preview outside the app.\n\nIn the Pane phone app, Explorer lists the branch's changed files first, then opens one folder at a time with a path bar and search, and files are read-only: code with syntax colours, Markdown rendered or as source, and images up to 5 MB. Text over 1 MB and other binaries stay on the computer, with Copy path. Everything, images included, comes through the app's own connection, so it works over every connection the app supports. Editor tabs open their file in the same viewer. The Diff tab lists the branch's changes with their counts and shows each file's patch, and Run script tabs show the script's output live; both are read-only, so commit, revert and start or stop the script on the computer.\n\nBrowsing and editing go through the PWA's own connection, so they work over every connection the PWA supports. Previews load from the same Serve address as HTML files in browser tabs, so they need what [browser tabs on the phone](#browser-tabs-on-the-phone) need: Tailscale on the host, password protection off, and a phone signed in to a login that **Who can connect** admits. Without that, a preview explains why it cannot load. Files outside the worktree are refused.\n\n### Remote PWA Implementation Notes\n\nThe Remote Pane PWA is a browser runtime. It does not have `window.electronAPI`, so client-side PWA preferences must use browser-safe storage such as `localStorage` or explicit daemon adapter calls. Do not reuse desktop renderer preference stores that persist through Electron IPC unless the call path is guarded for browser mode.\n\n## Forwarded ports\n\nA desktop connected to a remote host reaches every port listening on the host as if it were local. Pane lists the host's ports on a new, empty browser tab and under the address bar's **Ports** button, and the desktop opens a matching listener on its own `127.0.0.1` and `::1` for each one. Only the desktop app sets up these listeners; the browser app and phones don't yet.\n\n- A browser tab at `localhost:5173` loads the host's dev server, live reload included. The address bar reads `localhost:5173` with **on &lt;host name&gt;**.\n- When something on the desktop already answers on 5173, the desktop uses the next free port, or any free port when the next 19 are taken too. The tab still reads `localhost:5173`, and the Ports list shows the local number as **here :5174**.\n- A tab never loads the desktop's own service in the host's place. While the host's Ports list is loading it waits, and when a port stops listening on the host it says the port isn't reachable, then loads once the port is back.\n- **Copy URL** copies the address that works on the desktop, for its system browser.\n- Clicking a `localhost` link in a terminal opens the host's server in your system browser, using the local port number if it moved. A link to a port that isn't forwarded right now doesn't open, so it never reaches the desktop's own service on that port.\n- When a port closes on the host, the desktop closes its listener. Disconnecting closes all of them.\n\nEach connection the desktop accepts travels over the Pane connection as a WebSocket to `/ports/<port>` on the host, which connects to `localhost:<port>` there. The host accepts it only with the same sign-in as every other request, and only for a port in its current list. Listeners stay on loopback on both machines.\n\nEvery client signed in to the host can reach these ports through that route: anyone holding a pairing code, and any Tailscale login that the Workspaces \"Who can connect\" setting allows. They reach every listening service, including databases that trust `localhost` and debugging ports such as a Node `--inspect` port, which runs code as you. Pane's own ports are forwarded too, and its remote API keeps its own sign-in. Forwarding can't be limited to some ports. If that is more access than you want, turn off the remote daemon listener in `Settings > Remote Access > Tailscale > Advanced` and set \"Who can connect\" to Off.\n\n## Security Model\n\n- The daemon listener only supports loopback hosts: `127.0.0.1`, `::1`, or `localhost`.\n- Direct public or LAN binding is intentionally rejected.\n- Use SSH local forwarding, Tailscale Serve, or a trusted HTTPS reverse proxy that forwards to loopback.\n- Treat the generated `pane-remote://...` code like a secret. It contains the bearer token needed by the local client.\n- Any signed-in client can open a TCP connection to any port listening on the host. See [Forwarded ports](#forwarded-ports).\n\nTailscale Serve example generated by setup:\n\n```bash\ntailscale serve --bg --tls-terminated-tcp=443 42137\n```\n\nSSH fallback generated by setup:\n\n```bash\nssh -N -L 42137:127.0.0.1:42137 user@your-host\n```\n\n## Manual Advanced Flow\n\nThe old manual flow still works and is useful for debugging.\n\n### 1. Choose the Host Data Directory\n\n```bash\nexport PANE_DIR=\"$HOME/.pane_remote\"\nmkdir -p \"$PANE_DIR\"\n```\n\nPane stores config and database files under that directory. The setup command, desktop app, and headless daemon must use the same `PANE_DIR`.\n\n### 2. Configure the Remote Listener\n\nLaunch Pane on the host against that directory:\n\n```bash\nPANE_DIR=\"$HOME/.pane_remote\" pnpm dev\n```\n\nIn `Settings > Remote Access > Tailscale > Advanced` (the `Advanced Remote Host` page):\n\n1. Enable `Enable remote daemon listener`.\n2. Keep `Listen Host` on `127.0.0.1`.\n3. Keep or change `Listen Port`, default `42137`.\n4. Leave `Require pairing / saved bearer tokens` enabled. Turned off, the\n listener answers only callers that address it as `127.0.0.1`, `localhost`\n or `[::1]` with no web page from another site behind them, and it still\n requires a token while phone access through the relay is on.\n5. Leave `Allow direct HTTP on loopback` enabled.\n6. Click `Apply Host Settings`.\n\n### 3. Create a Paired Connection\n\nFrom `Pairing tools` on the same page:\n\n1. Enter a label such as `Office Mac mini`.\n2. Enter the base URL the client will use after tunneling, for example `http://127.0.0.1:42137`.\n3. Click `Create Paired Profile`.\n\nPane adds a host-side allowed client record, adds a matching local profile, and shows the generated bearer token once.\n\n### 4. Start the Headless Daemon\n\n```bash\nPANE_DIR=\"$HOME/.pane_remote\" pnpm daemon:headless\n```\n\nOn success:\n\n```text\n[Pane daemon] Headless host ready on unix:<socket path>\n```\n\nOn Windows the endpoint is `pipe:<pipe name>`. This is the local control endpoint, not the remote listener port.\n\n### 5. Connect the Desktop Client\n\nUse `Paste a connection code` under `Settings > Remote Access > Tailscale` for a generated code, or use `Save existing remote profile` under `Tailscale > Advanced > Pairing tools` with:\n\n- label\n- base URL\n- bearer token\n\nClick `Save Remote Profile`, then pick the saved computer from `Settings > Remote Access > Computers` or the sidebar's machine menu.\n\n## Validation\n\nRecommended checks after connecting:\n\n1. Verify projects and sessions load in the client.\n2. Open a terminal-backed session and confirm output streaming works.\n3. Send terminal input and verify the remote runtime receives it.\n4. Resize a terminal and confirm the remote terminal resizes.\n5. Open a file and confirm read/write works.\n6. Check git status and commit/diff flows.\n7. Run an approve-mode command and confirm the permission dialog appears on the client.\n\n## When a connection fails\n\nWhen you connect to a host (a computer's row in Settings › Remote Access ›\nComputers, Paste a connection code, the sidebar's machine menu, or Retry), the\nmain area shows a checklist of\nthe connection's stages. The first stage that fails shows what went wrong and a\nfix. The same checklist appears when Pane gives up reconnecting after five\nminutes, and from **Retry now** on the \"Reconnecting to <machine>…\" banner. That\nbanner appears once the connection has been down for 10 seconds; until then\nthe workspace dims and the host dot pulses while Pane reconnects. A computer\nwith more than one route moves to the next route before the banner, so the\nbanner means every route failed. See [Routes](QR_PAIRING.md#routes).\n\nThe host's 5-second heartbeat decides whether a connection is alive: 12 seconds\nwithout one reconnects. One failed request fails only itself; three requests in\na row that get no answer reconnect. Reconnects wait 250 ms, 750 ms and 2 s, then\ndouble up to 30 s between tries. A computer linked through Pane's relay is\nretried at least every 5 seconds and never given up on while Pane is open.\n\n| Stage | Fails when | Fix |\n|---|---|---|\n| Tailscale on this computer (Tailscale machines only) | Tailscale is signed out or not installed here | Open Tailscale Setup, or Download Tailscale |\n| Host reachable | The host times out or its name does not resolve; a Tailscale machine is offline | Check that both computers are on the same network or tailnet |\n| Pane daemon running / Pane open | The host refuses the connection, or a proxy such as Tailscale Serve answers 502-504 | Start it, or Copy command |\n| Signed in | The host rejects this computer's token or password | Paste new code, or Enter password |\n| Versions match | The host runs a different Pane version (a warning; the workspace still loads) | Update it, or Update Pane on this computer |\n| Workspace loaded | The host answered but the workspace did not restore | Retry |\n\n**Start it** and **Update it** run one fixed command on the host over your own\nSSH config. They appear only when exactly one `Host` alias in `~/.ssh/config`\nmatches the host: its Tailscale machine name, or the first label of the host\nname in its address (`devbox` for `devbox.tail1234.ts.net`). Pane runs:\n\n```bash\nssh -o BatchMode=yes -o ConnectTimeout=10 <alias> \"$SHELL\" -lc '<command>'\n```\n\n`BatchMode` makes ssh fail instead of asking for a password, and the login\nshell puts `npx` on the `PATH`. With no single matching alias, or when ssh\nfails, the row offers **Copy command** so you can run the same command on the\nhost yourself:\n\n| Fix | Code host (daemon) | Tailscale machine (Pane app) |\n|---|---|---|\n| Start it | `npx --yes runpane@latest daemon repair --yes` | `open -a Pane` (macOS hosts only; otherwise open Pane there) |\n| Update it | `npx --yes runpane@latest update && npx --yes runpane@latest daemon repair --yes` | `npx --yes runpane@latest update` |\n\n`daemon repair` uses the default daemon data directory, `~/.pane_remote`. For a\nhost set up with another `--pane-dir`, run `runpane daemon repair --pane-dir\n<dir> --yes` there instead.\n\n## Troubleshooting\n\nStart with machine-readable environment diagnostics:\n\n```bash\nrunpane doctor --json\n```\n\nThe `remoteSetup` section reports stable diagnostic codes and recovery commands\nfor missing AppImage/FUSE support, Electron sandbox restrictions, and missing\nuser service management. `runpane install daemon` automatically supplies the\nLinux headless launch environment. Pane never disables the Electron sandbox\nautomatically; use `--no-sandbox` only when the host requires it and you accept\nthe security tradeoff.\n\n### Remote setup exits because X11 or `$DISPLAY` is missing\n\nUse `runpane install daemon`, or add `--ozone-platform=headless --disable-gpu`\nto a direct packaged launch. This failure occurs before Tailscale setup and does\nnot mean the daemon requires a graphical session. If you previously relied on\n`ELECTRON_OZONE_PLATFORM_HINT=headless`, switch to the flags: Electron removed\nthat variable in 38 and ignores it from 39 on.\n\n### The headless daemon starts but remote connect fails\n\nCheck:\n\n- the daemon uses the same `PANE_DIR` that setup wrote\n- the tunnel/proxy forwards to the same loopback port as the host config\n- the client profile base URL matches the client-side tunnel endpoint\n- the `pane-remote://...` code was not truncated\n\n### A remote action could not be confirmed\n\nPane's remote clients (desktop, browser, phone and glasses) retry a reviewed set\nof read-only requests and dictation cleanup after transient network or server\nfailures, on the reconnect schedule for up to five minutes. Authentication\nfailures stop immediately.\n\nA host on a current Pane runs each action once per request ID and says so when a\nclient connects (`deduplicatesRequestIds` in the `ready` event). It remembers\neach client's recent IDs and answers for ten minutes, in memory, up to 10,000\nper client; while a client is at that limit, the host refuses its new actions\nbefore running them and the client sends them again. Against such a\nhost, every action a client sends (terminal input, prompts, new panes and tabs,\nNotify answers) carries an ID. An action issued while the connection is\nreconnecting waits for it; one whose answer is lost is resent with the same ID\nuntil the host answers or five minutes pass since it was issued. Terminal\ninput keeps its order per terminal. Typing into a dimmed terminal is not queued.\n\nDelivery is unknown only when no answer arrives in that time: inspect the\ncurrent panes or terminal before submitting it again. An action that was never\nsent says so. Against an older host, actions other than chat sends (which the\nhost de-duplicates by operation ID) are sent once, as before.\n\nThe browser normally uses native EventSource for output. Its fetch fallback and\nthe desktop transport share one SSE text parser, accepting LF, CRLF, and CR line\nendings across chunks. Each transport decodes UTF-8 incrementally before parsing;\nreconnecting discards the previous stream's incomplete event. Terminal output\nresponses are applied only to the terminal instance that requested them, so a\nlate response cannot clear or write to a terminal disposed during a tab switch.\n\n### I changed host settings but nothing happened\n\nThe headless daemon watches config and starts or stops the remote transport based on saved host config. If behavior looks stale, restart the daemon once and verify the correct `PANE_DIR`.\n\n### Why can’t I bind to `0.0.0.0` or a LAN IP?\n\nThat is intentionally blocked. The current security model is loopback plus a secure exposure layer.\n\n### Why are some actions disabled in remote mode?\n\nSome actions operate on the local desktop client machine rather than the remote workspace. Pane currently disables or keeps local-only behavior for:\n\n- opening a local IDE from the client\n- revealing files in the client OS file manager\n- the native clipboard-image fallback path\n\n### Where does copied terminal text go?\n\nTo the clipboard of the machine you are sitting at. In remote mode, dragging to select text in a terminal copies it right away, with no Copy popover. Programs that copy with OSC 52, such as Claude Code, tmux, and vim, also copy to your machine. Programs in the terminal cannot read your clipboard through OSC 52.\n\n## Current Limitations\n\n- No account-based multi-tenant auth. For a hosted relay that needs no Tailscale, see [Add a device](QR_PAIRING.md)\n- No direct non-loopback listener support\n- No full live remote end-to-end CI harness yet\n# Mobile push notifications\n\nThe native companion registers an APNs/FCM token with every computer it has saved. With a paired bearer token, the registration is scoped to that paired client and revalidated before every send. Over Tailscale Serve with no code, only the computer's owner login can register; the registration is filed under `tailnet:<login>` and the phone's install id, checked when it registers, and lasts until the phone revokes it or the provider reports the token dead. One owner login keeps at most 10 live registrations per computer, dropping the oldest. The daemon sends attention alerts for `blocked` transitions and for settled `working → idle` transitions of turns a person started; controls can disable either category per device. See [Native mobile](NATIVE_MOBILE.md) for the operator-only credentials and signing setup.\n"},{"path":"docs/SESSIONS.md","title":"Sessions","text":"# Sessions\n\nSessions are named, ongoing Pane Chats where work intent lives. Each Session\nopens one chat, and its sidebar row can expand to show associated Panes. The\noptional overview keeps the Session name, associated Panes, and recent\nactivity together while the chat remains the focused work surface. A tab\nshares its parent Pane's worktree.\n\nIn the sidebar, `+` opens an agent picker, an optional Session name field, and\nan optional \"What is this Session for?\" field that becomes the Session's goal.\nPane remembers the chosen agent as the default for future Sessions while\nexisting Sessions keep their own agent. A blank name starts as `New chat` or\n`New chat 2` and is renamed once from the first message you send the Session\nagent; a name you type or set later is kept. Each new Session opens as one Pane\nChat and can be renamed later from the optional read-only overview. Expand a Session to see\nits associated Panes and open any Pane in its existing sidebar view.\n\nWith [chat tabs](CHAT_TABS.md) on (Settings → AI & Agents → Chat tabs), a new\nSession runs its orchestrator in a chat tab instead of a terminal for any agent\nchat tabs run (Claude, Codex, Cursor and OpenCode), from\nthe plain agent or the Session's `agent-farm run <profile>` launch, and sends its\nopening prompt once. Like every chat, finished turns fold to one row. A worker\nPane shows up as one line with **Open** while it is asking the person, and when\nit finished, failed or reported during the latest turn; the sidebar lists the rest. Workers the orchestrator\nstarts stay terminal tabs. Agent Farm's standard resume template\n(`{command} --resume {sessionId}`, which the dialog saves) doesn't stop a chat,\nsince a chat reopens through ACP. Sessions that resume or promote a terminal\nconversation, run in WSL, or use a truly custom resume command or a wrapper\nlaunch keep their terminal, and the Session's overview says why. A\nSession keeps the kind of tab it started with.\nA Session already running in a terminal can move to chat with\n**Switch to chat…** in the Session's right-click menu, which switches every\nterminal agent tab in it (see\n[CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)).\n\n**New** at the top of the sidebar opens one dialog with a Session/Pane toggle\non top and that kind's form below. When the desktop has saved other machines,\na **Machine** picker sits between them. It starts on the machine you last\ncreated on from this computer (the first time, the machine the app is on) and\ndims machines that are offline or still connecting; they can't be picked until\nthey answer. Repositories, branches, WSL distributions and agents come from the\npicked machine. Create runs there; Pane then switches to that machine and opens\nwhat you created. A Pane created on another machine starts at the repository\nlevel and does not join the Session you have open.\n\nThe Sessions section below the divider can be collapsed from its header; the\n`+` remains available while it is collapsed. Sessions are opened from this\nsection rather than from a duplicate top navigation shortcut.\n\nA Session is a persistent coordination conversation with its own scratch\nworkspace. Its default profile supports discussion, investigation, decisions,\nand delegation when authorized work benefits from it. No particular skill,\nticket system, model, or Agent Farm installation is required. Users can select\nskills and workflows without Pane imposing an implementation pipeline.\n\n## The Onboarding Session\n\nOn a new data folder, the default Session is named Onboarding. It is where a\nnew person starts: the first-run screen hands off to it (see [Bring your\nexisting sessions into Pane](#bring-your-existing-sessions-into-pane)), and its\nagent gives each later task a Session of its own. Archive it like any Session\nwhen you are done with it; Pane does not recreate it. Installs from before the\nfirst-run screen keep the name Pane Chat.\n\n## Upgrading from Pane Chat\n\nExisting Pane Chat opens under Sessions automatically, keeping its name and all\nagent conversations together. Switching agents resumes that agent's existing\npanel and history in the same stable private Session workspace. Opening the\nSession does not submit a prompt or authorize new work.\n\nEarlier development versions split old agent histories into supplemental\nSessions. Untouched imports with only generated workspace files and no competing\nconversation are reunited with the original Session. Imports with files, settings changes, or\nadditional conversations remain separate to preserve that work. Those retained\nSessions receive independent internal owners while keeping their names, folders,\npanel IDs, saved histories, and settings. Interrupted ownership moves resume on\nstartup; no transcript or workspace files are deleted by this migration.\n\n## Launch configuration and profile\n\nSessions use the same built-in launch presets and saved custom commands as\nordinary project/worktree panels, including custom arguments. The application\ndefault seeds new Sessions. Creating a Session remembers its launch command and\narguments for the next creation; cancelling, or a create Pane refuses, leaves that default unchanged.\nSelecting the agent default clears the remembered custom command. Each Session saves its own launch configuration\nand behavior profile. Changing defaults does not overwrite existing Sessions.\nLaunch changes take effect on the next explicit restart.\nUse **Edit behavior…** during creation or in Session settings to open the\nseparate profile editor. **Back** discards the draft; **Save behavior** applies it\nto the form, which is persisted when you create the Session or save settings.\n\nThe command, behavior profile, and saved task context have separate purposes.\nA command selects how the agent runs; a profile describes how it should behave;\nsaved goals, decisions, and next actions help it respond to later user input.\nCustom commands (including Agent Farm wrappers) retain their arguments. Pane\nonly adds native flags through compatible built-in adapters, an explicit custom\ncommand resume config, or Agent Farm's resume contract (see\n[Resuming custom launchers](#resuming-custom-launchers)). Wrappers keep control of\ninstruction discovery; apart from that one Agent Farm exception, Pane does not\ninfer flags from a wrapper name. A user command that explicitly starts work\nremains the user's choice.\n\nAn OpenCode Session runs `opencode` directly: its launch command may add\narguments, assignments or an `env NAME=value` prefix, but not a wrapper\n(`bash -c opencode`), a wrapped launch or a custom command resume. Pane refuses\nthose before anything starts, with `ERR_SESSION_OPENCODE_LAUNCH`. An app default\ncommand or custom resume that doesn't suit OpenCode is left out when a Session\nis created with the OpenCode agent. Pane resumes the conversation id OpenCode\nprints when it exits (`Continue opencode -s <id>`); a conversation still open\nwhen Pane quits has no saved id yet and starts fresh. Loops run Claude, Codex or\nCursor, so the Loop editor doesn't offer OpenCode Sessions.\n\nEach Session owns a stable folder at `<PANE_DIR>/sessions/<session-id>/` for\nnotes, plans, attachments, generated instructions, and artifacts. Renaming\nand reopening keep this folder. Archiving keeps it for 14 days (**Settings →\nWorktrees & Git → Keep archived folders**), then Pane deletes it, first moving\nany agent logs inside it to `<pane-dir>/agent-logs/` (see\n[The scratch folder](#the-scratch-folder)); restoring the Session before then\nkeeps it. A Session archived before this retention existed counts its 14 days\nfrom the first launch of the Pane version that added it. These folders are not Git worktrees or security sandboxes.\nProject implementation belongs in an appropriate Pane/worktree.\n\n## Windows and WSL runtimes\n\nOn Windows, **Create Session → Run agent in** appears directly below the agent\npicker when WSL reports installed distributions. Windows is the default on every\ncreation. Choose a named distribution to run the agent there; install the agent\ninside that distribution first. Cursor is available when WSL is selected.\nThe runtime and distribution belong to the Session and survive reopening,\napplication restart, and terminal supervisor restart. Only WSL Sessions carry a\n`runtime` (`\"wsl\"`); a Session on the native host omits it on every OS. Older\nrecords that stored `\"windows\"` for the native host lose the field when read.\nIf creation fails before publishing a terminal owner, Pane removes untouched\ngenerated files so the name can be retried; user files or edits prevent rollback.\n\nWSL Sessions retain their durable files under the Windows Pane data directory.\nTheir agent sees Linux paths such as `/mnt/c/Users/.../.pane/sessions/...`.\nThis uses Pane's existing Windows-to-WSL path conversion and requires the default\n`/mnt/<drive>` automount layout; custom `[automount] root` settings are not supported.\nGenerated `AGENTS.md` points to a Session-specific `runtime-context.md`; this\ncontext takes precedence over the shared Pane Chat routing instructions.\n\nEach WSL Session gets a managed `.pane-runtime/runpane` wrapper on PATH, also\navailable as `$PANE_RUNPANE_BIN`. It invokes this build's bundled Windows CLI via\nPowerShell interop from Windows TEMP, so the CLI can reach this Pane instance's\nnamed pipe. Arguments cross as JSON to preserve quotes and Unicode. Temporary\nfiles beside the bridge carry payloads without Windows command-line size limits\nand are removed when the call exits; stdin remains available to the CLI. File flags\naccept relative or absolute Linux paths (including `--flag=value`); `-` retains\nstdin semantics. `--repo` translates absolute Linux paths and explicit relative\npaths (`.`, `..`, `./...`, `../...`) while preserving repository names and IDs.\nPaths inside JSON request bodies must use Windows paths, and\nWindows paths returned by the CLI can be read in WSL after `wslpath -u` conversion.\nThe bridge pins `--pane-dir` to this instance and preserves the calling Session\nand panel identities. PowerShell is invoked by its mounted Windows path, so\n`appendWindowsPath=false` is supported. WSL interop must be enabled; a Linux-installed RunPane CLI\ncannot replace this bridge for a Windows daemon.\n\nFor CLI JSON creation, `runtime: \"wsl\"` and `wslDistribution: \"Ubuntu-24.04\"`\nselect an installed distribution; omitted runtime selects the native host.\n`runtime: \"windows\"` is still accepted as a legacy name for the native host and is\nnot stored.\n\n## Resuming custom launchers\n\nUse **Enable custom command resume** in Session launch settings or a saved custom\ncommand's editor. This is an explicit contract, independent of executable names.\nAgent Farm is the one exception, described in [Agent Farm](#agent-farm) below.\nChoose a session ID source and provide first-launch and resume templates:\n\n- **Claude:** Pane allocates a UUID and resumes it only when its transcript exists.\n- **Codex / Cursor:** Pane captures the native resume ID from terminal output.\n OpenCode does the same without this setting (see\n [Launch configuration and profile](#launch-configuration-and-profile)); OpenCode\n Sessions refuse custom command resume.\n- **Pane allocates an ID:** for other CLIs that accept a caller-provided ID.\n- **CLI reports its ID:** the CLI or wrapper prints a standalone newline-terminated\n `PANE_AGENT_SESSION_ID=your-session-id` line. IDs may contain letters, digits,\n periods, underscores, colons, and hyphens (up to 256 characters).\n\n`{command}` expands to the saved command; `{sessionId}` expands to the quoted ID.\nLeave the ID placeholder unquoted. For a launcher that forwards native arguments\nthrough `--`, Claude templates could be `{command} -- --session-id {sessionId}`\nand `{command} -- --resume {sessionId}`. Codex could use `{command}` initially\nand `{command} -- resume {sessionId}` on resume. These are user configuration\nexamples, not automatic wrapper detection. Other CLIs can use other syntax.\n\nThe configuration and ID persist with the panel. Without a captured ID, Pane\nuses the first-launch template instead of guessing a latest conversation. Saved\ncustom commands copy their resume settings into new panels; changing the saved\nshortcut does not change existing panels. Session settings support changing or\ndisabling the contract for that Session's next launch. No prompt is submitted just\nto resume. Old conversations whose IDs were never saved cannot be recovered\nautomatically; use an explicit resume command if you know their ID.\n\n### Agent Farm\n\nAgent Farm is the one launcher Pane recognizes by name, because Agent Farm\npublishes this contract for Pane: when `PANE_PANEL_ID` is set it prints\n`PANE_AGENT_SESSION_ID=<launch id>` once, before the agent starts, and documents\n`{command} --resume <id>` as the way to reopen that conversation. Pane keeps the\nfirst ID line of each launch and ignores later ones, which can only be agent\noutput. Every other wrapper still needs an explicit config.\n\nThe launch ID is only where the conversation started: `/clear` and `/resume`\nmove Claude to another one. Agent Farm's compiled Claude plugin therefore also\ncarries a `SessionStart` hook that runs `runpane panels conversation --hook` on\nstart, `/resume`, `/clear` and compact (D-269). Pane saves the reported\nconversation on the tab, ahead of the launch ID, so a restart resumes the\nconversation the tab was last on and Switch to chat opens it. The hook does\nnothing outside Pane and prints nothing. With an older Agent Farm there is no\nreport, and Switch to chat opens the folder's most recent conversation instead\n(see [CHAT_TABS.md](CHAT_TABS.md#switching-a-terminal-tab-to-chat)).\n\nA command counts when it is a single `agent-farm run <profile>` or\n`agent-farm agent <profile>`, optionally preceded by `VAR=value` assignments,\nwith no shell operators, no `--`, and no `--resume` of its own. `npx`, `pnpm dlx`\nand aliases do not count. Such a panel with no explicit config behaves as\n**CLI reports its ID** with templates `{command}` and\n`{command} --resume {sessionId}`: Pane saves the printed ID and relaunches with\nit. The editor says so under the unticked checkbox. An explicit config always\nwins: tick **Enable custom command resume** and set your own templates.\n\nA panel created before this rule usually has no saved ID. On its next relaunch Pane\nmakes one attempt to read the last `PANE_AGENT_SESSION_ID=` line from the\npanel's saved terminal buffer. Agent Farm older than 0.2.20 prints no ID, so\nthose panels relaunch fresh, as before.\n\nTo reopen an older conversation by hand, run\n`agent-farm run <profile> --resume <id>`. The ID is the launch ID (the\n`PANE_AGENT_SESSION_ID` value), shown as `resumeId` in\n`runpane panels list --json`. Agent Farm keeps launch records in\n`~/.local/state/agent-farm/launches/` for 90 days.\n\n## Session sidebar and archive\n\nPinned is the first sidebar category and can contain both Session chats and\nPanes. Right-click a Session, or use the ⋯ button that appears on hover, to pin or unpin it, or turn on **Start pinned** in\nCreate Session to pin it from the start. The dialog remembers that toggle for\nthe next Session (on the desktop in Pane's config, in the remote web app on\nthat device). The pin preference survives restarts; an archived Session stays\nout of Pinned until it is restored. RunPane can set the same preference with\n`sessions pin` or `sessions unpin --session <id|name>`. Create JSON accepts\n`isPinned` (default false), and update JSON accepts it without changing the\npreference when omitted.\n\nDrag a Session up or down in Pinned, in Sessions, or in the compact rail to\nchange its place; a line shows where it will land. With a Session row focused,\n**Alt+↑** and **Alt+↓** move it one place and a screen reader hears its new\nposition. A drag or keypress reorders only the list it starts in: Pinned\nSessions move among themselves, and a Session dragged across the Pinned line\nstays where it was. The order is saved on the host, so every desktop, the phone\nand `runpane sessions list` show it, and it survives restarts. New Sessions\nstart at the top. A host that has never saved an order lists Sessions newest\nfirst. A host running an older Pane cannot save an order: the list snaps back\nand the error says to update Pane on that host. Dragging a Session onto the\nworkspace still tiles it.\n\nIn the sidebar's **All machines** view, Sessions from every machine form one\nlist you arrange the same way, by drag or **Alt+↑**/**Alt+↓**. That arrangement\nis saved on the computer you are looking from, not on any machine it shows: two\ncomputers keep two arrangements, and each machine's own order (its one-computer\nview, the phone and `runpane sessions list`) is unchanged. The first time a\nmachine answers on this computer, its Sessions join the arrangement in that\nmachine's own order, after the Sessions of machines listed before it in the\nmachine menu, so a first look follows the menu however late each machine\nanswers. A Session that appears after that, such as\na new one, goes first whether or not you have moved anything; agent status and\nactivity never move a row.\n\nClick a Session row to open its chat, or find it by name in Search (`⌘⇧P` /\n`Ctrl+Shift+P`, or the Search field above **New**), which also has **New Session**. A Session with associated Panes shows a\nchevron that expands or collapses them; a Session without Panes shows none.\nEvery Session starts collapsed, including a new one and one that just got its\nfirst Pane, until you press its chevron. Opening the Session's chat, an agent\nadding Panes, or `runpane` focusing one of its Panes leaves it collapsed. Each\ndevice remembers the Sessions you opened, separately for each host: the\ndesktop in its own settings, the remote web app (PWA) in browser storage\n(`pane.remotePwa.expandedSessions@<host id>`). Opening a Session under Pinned\nopens it under Sessions too. The native iOS and Android app does not follow\nthis yet: its Sessions start expanded and it forgets on restart.\nChild Pane rows are indented beyond the Session chat icon and keep the ordinary\nPane actions. Create Pane, opened while a Session is showing, has an\n**Add to <Session>** checkbox, on by default, that files the new Pane under that\nSession. A Pane that belongs to a Session names it in the window title bar as\n\"<Session> › <Pane>\"; click the Session name to go back to it. To file an\nexisting Pane under a Session, right-click the Pane, choose\n**Add to Session**, then pick the Session. **Remove from <Session>** in the same\nmenu takes it out again; the Pane and its worktree are unchanged. Pinned Pane\nrows show the Pane name with its repository muted beside it. Single-line Pane rows omit change counts and PR numbers; the\noptional two-row layout shows those details below the title. Session and Pane\ncontext menus use compact widths.\n\nUnder each repository, drag a Pane up or down to change its place, or move a\nfocused Pane row with **Alt+↑** and **Alt+↓**; a line shows where it will land\nand a screen reader hears its new position. The order is saved on the machine\nthe Pane runs on (its `display_order`), so the phone shows it too, and agent\nactivity, renames and archiving other Panes never move a row. A new Pane lands\nat the top. **Sort** in the sidebar's **⋯** menu is an action on that machine:\n**Sort: Newest first** or **Sort: Oldest first** (the current one says\n*Current*) re-sorts every repository's Panes once by creation and sets where\nnew Panes land (top under Newest first, bottom\nunder Oldest first); drags made afterwards hold. A machine running an older\nPane cannot save a Pane order: the list snaps back and the error says to update\nPane on that host. Commands: `sessions:reorder-in-project` (`{ projectId,\npaneIds }`; the listed Panes trade the places they hold, unknown ids are\nignored, timestamps are kept), `sessions:sort-panes` (`{ order: \"newest\" |\n\"oldest\" }`) and `sessions:get-pane-order` (`{ newPanes: \"top\" | \"bottom\",\nchosen }`).\n\n### The Session row's icon\n\nA Session row's icon spins only while the Session really works, and is an empty\ngrey ring otherwise; it is never red (the amber approvals count and the expanded\nPane rows show what needs you). It spins once the orchestrator's agent tab, or\nan agent tab in one of the Session's Panes (not archived), has been mid-turn\nwithout a break for 10 s, and stops 10 s after the last one ends, so a short\nwake-up never shows. Mid-turn is stricter than a Pane's own status dot:\n\n- A terminal agent needs its working chrome on screen (the spinner in its title,\n its thinking or working line), and that screen must have changed in the last\n 15 s. Output alone (a dev server, typing, a redraw) never counts, and a frozen\n spinner stops counting.\n- A chat tab needs an open turn that sent an update in the last 5 minutes, or a\n tool call still running.\n- A tab waiting on `runpane watch`, `runpane panels wait`, `runpane notify` or\n `runpane secrets request` is waiting, not working. A chat tab counts as\n waiting only while the tool call it is running is that wait; one sent to the\n background doesn't hide its real turns. A terminal tab counts as waiting\n while any such call from it is open, so an orchestrator in a terminal tab\n with a background watch or card open doesn't spin the Session on its own;\n its workers do.\n- A permission prompt, a menu, a usage-limit screen, a plain shell, and anything\n Pane cannot tell, read as idle.\n\nThe host that runs the agents decides this once and tells every client, so the\nsidebar, All machines (each machine's Sessions by that machine) and the web and\nphone apps agree; while a client can't reach the host it shows the Session\nidle, and a reconnect reads it again. \"N working\" counts the Panes with\na working tab by the same rule. A machine that is offline, or too old to report\nit, shows its Sessions idle.\n\nThe experimental **Attention inbox** (Settings > Advanced > Experimental) turns\nthe Projects list into an Inbox of the Panes that need you: an agent waiting on\ninput or approval, an agent that completed a real turn since Pane started (it\nworked on a prompt and went idle; a freshly started agent does not count), or a\nPane that errored. Session child rows follow the same filter, and a Session row still\ncounts all of its Panes. A row leaves when its agent works again; opening it\ndoes not remove it. Hover a row and choose **Dismiss** (check mark) to hide it\nuntil its agent works again. The row under the Inbox counts the hidden Panes\n(\"3 running · 1 idle\") and **Show all** lists every Pane. Pinned rows are\nunchanged, and ⌘1–9 number the Inbox rows while it is shown.\n\nThe right sidebar has Overview, Files, and Changes tabs. When the Session\nfolder holds a status page at `session/index.html` (an orchestrator renders it\nthere from a status JSON with the `orchestrate-sessions` skill's bundled\nrenderer), Overview shows that page under a header with the Session name, Rename,\n**Open beside chat** (the page full-size in the split, in the tab already\nshowing it) and **Show Session details** (the record described next). Pane checks for\nthe page each time the Session refreshes. Links in the page to\n`pane://open?pane=<id>&panel=<id>` open that tab and show its oldest waiting\nquestion in Approvals, as Open in Pane does; other links open as a browser tab beside chat. A client connected to\na remote host shows the record only. Without a page, Overview shows the\nSession's blockers, goal, next step, and decisions when they are set, then its\nPanes and recent activity. Each Pane card lists the Session's tabs in that Pane\nwith their type icons: every tab when the Pane is linked whole, with Files and\nChanges last, or exactly the tabs a link names. Click a tab to open the Pane on\nit; Files and Changes open in the Pane's inspector. A Pane on another saved\nmachine ([workers on another machine](RUNPANE_WORKSPACES.md#workers-on-another-machine-join-your-session))\nshows \"On <machine>\" with its tabs' states as that machine reports them, or\n\"unreachable\" when it doesn't answer, or \"needs a Pane update\" when its Pane is\ntoo old to report here; its card is read-only and opens from All machines. Agent state changes stay out\nof Activity; the status dot shows them. Files browses the Session workspace.\nChanges summarizes the Session's Panes and opens a Pane for detailed review. The upper-right sidebar\nbutton shows or hides the selected tab. A single Session uses two rows at the\ntop: the window title bar shows its name and controls, and the tab strip sits\ndirectly below it. Session file clicks open editor tabs beside the agent tab in\nthat strip. These tabs can be selected and closed directly, and reopening a file\nrestores its tab.\n\n![Two-row Session header in Folio](screenshots/two-row-header-folio.png)\n\n![Two-row Session header in Walnut](screenshots/two-row-header-walnut.png)\n\nRight-click a Session, or use its ⋯ button, to archive it. Archiving a\nSession also archives every Pane associated with it, removing their\nworktrees. When a Pane has work in progress (an agent working or waiting for\nan answer, text typed but not sent, unsaved edits, or uncommitted or unpushed\nwork in its worktree), Pane first lists those Panes and asks: Keep them open\narchives the Session and the rest, Archive all archives them too, Cancel\nchanges nothing. With none, it archives without asking. An \"Archived · Undo\"\ntoast offers to restore the Session and the Panes it archived for a few\nseconds; Undo brings Panes back on their branches, not uncommitted changes.\nArchiving the open Session returns the desktop view to Home. The Session keeps\nits identity, conversation history, and Pane associations. Restore the\nSession from the sidebar’s Archived section, and its Panes from the Archived\nPanes list.\n\nThe Session update contract accepts `archived: true` or `archived: false`.\n`archived: true` archives the associated Panes on the host, whoever sends it\n(phone, `runpane sessions update`); a Pane with work in progress stays open.\n`runpane sessions update` reports what happened in `panes`: `archivedPaneIds`,\n`keptPanes` (with the block `code`) and `failedPanes` (with the `error`).\n\nThe desktop uses two channels. `orchestration-sessions:archive-preview` lists\nthe Panes an archive would take, each with the `blocked` code `runpane panes\narchive --pane` would refuse it with, and changes nothing.\n`orchestration-sessions:archive` takes the Panes the person approved,\n`{ archivePaneIds, forcePaneIds }`: it archives the Session and those Panes\nonly, checks `archivePaneIds` again (one that became unsafe stays open),\narchives `forcePaneIds` as chosen, and returns the same `archivedPaneIds`,\n`keptPanes` and `failedPanes` for the toast and Undo.\n\nList results retain archived records, in the saved order; active navigation\nfilters them. An archived Session keeps its place, so Undo or Restore puts it\nback where it was.\n\n`orchestration-sessions:reorder` takes `{ sessionIds }`. The listed Sessions\ntrade the places they already hold, so a list that shows only some Sessions\n(Pinned, or the active ones while others are archived) rearranges just those;\nunknown ids are ignored. It writes an optional `order` id list beside the\nSessions in `orchestration-sessions.json` (the store stays at version 1) and\nchanges no Session's revision, `updatedAt` or activity. An older Pane reading\nthe file ignores `order`, lists Sessions in its own default order, and drops it the next\ntime it writes. Archiving the selected Session chooses an available active\nSession or clears the selection if none remain. Restoring a Session does not\nreplace an unrelated selection.\n\n### Move a Session to another machine\n\nRight-click a Session, or use its ⋯ button, and choose **Move to machine…** to\ncontinue it on another machine. The dialog lists your Tailscale machines\nrunning Pane, except the one the Session is on, and your teammates' machines\nrunning Pane, shown with the owner's login after the name. A teammate's machine\nis a target only when its owner set Who can connect to Everyone on tailnet.\nMachines Pane can't reach, or that accept only their owner, are shown disabled\nwith the reason. If none can be reached, it says so:\nopen Pane on the other machine, or sign in to Tailscale. While you view a host\nconnected with a pairing code rather than over Tailscale, the item is disabled,\nbecause Pane can't tell which machine that is. In All machines, the same item\nis in each Session's menu and moves the Session from its own machine, without\nswitching to it; it is disabled, with the reason, while that machine isn't\nconnected or was paired with a code. Choosing a machine\nsends the Session's agent a prompt to hand the Session off with\n[`runpane handoff`](RUNPANE_WORKSPACES.md#hand-a-task-to-another-machine) and\nthe `handoff` skill.\n\nThe agent writes a handoff note, and handoff creates a Session on that machine\nwith the same name (numbered \"<name> 2\" if the name is taken), goal and agent.\nIts next action is to read the note, which handoff saved in that machine's\n`~/.pane/handoffs/`. When the new Session uses the same agent, the conversation\nmoves too: its agent session's files are copied to that machine, and the new\nSession resumes that conversation when you first open it. Check that it shows\nthe last message, and if that is unclear, ask it what it was last working on.\nWith a different agent, or `--note-only`, only the note moves and the new\nSession starts fresh from it. Like every Session, it waits for your first\nmessage: switch to that machine, open the Session, and send \"continue\". The\nSession folder and its Panes stay where they are, and the original Session is\nnot archived; archive it from the same menu when you are done with it, which\nalso archives its Panes on this machine.\n\n## Bring your existing sessions into Pane\n\nOn a new install, Pane's first-run screen asks two things before anything\nelse:\n\n1. **Which agent do you use?** Claude Code, Codex or Cursor, showing only the\n agents this computer supports. An agent whose CLI Pane can't find says \"Not\n found on this computer\", with an install link. The screen says Pane runs it\n with its permission prompts off, as Pane always launches these agents.\n When Claude Code then shows its one-time bypass-permissions warning in the\n Onboarding Session, Pane answers \"Yes, I accept\" in the terminal, and Claude\n records the acceptance itself. Pane never edits Claude's config files while\n Claude may be running. The pick becomes the Onboarding Session's agent and\n the default for new Sessions (Settings → AI & Agents).\n2. **Bring your N sessions into Pane?** Pane looks for sessions from Claude\n Code, Codex, Conductor, Paradev (formerly Superset), Herdr, Emdash, Orca\n and T3 Code on this computer and counts those running now or used in the last 7 days. Pane opens\n them in place and deletes nothing.\n\n**Yes** is the confirmation: the screen closes, the Onboarding Session opens,\nand its agent runs the `migrate-to-pane` skill below on that set with no list\nto confirm. It groups the work into one Session per workstream, says what a\nSession, a Pane and a tab are the first time it makes one, and ends by opening\na Start here page beside the chat. The page lists your workstreams, a receipt\nof what came over and what was left out (with why), what you can undo, the\nwords Pane uses, and 3 to 5 things to try next with prompts naming your own\nrepositories. The page is saved as `<PANE_DIR>/migrate-to-pane/start-here.html`.\n\n**Not now**, or nothing found, shows \"Open your project\" (your repositories, a\nfolder, a GitHub clone, or a sample repository). Opening one, or skipping, also\nlands in the Onboarding Session, whose agent makes a Start here page for that\nproject, without the receipt. Without Git, the screen shows only how to\ninstall it.\n\nSettings → AI & Agents → \"Bring sessions into Pane\" → **Find sessions** brings\nidle sessions in with one click at any time:\n\n- Pane reads each tool's session list locally (metadata only; SQLite stores\n from a temporary copy) and lists sessions active in the last 30 days, one row\n per tool. Sessions from the last 7 days are preselected, at most 3 per\n checkout; click a row to choose sessions. Paradev's sessions are read from\n `~/.paradev` and `~/.superset` (its folder before Paradev 2.0.4), or from\n `SUPERSET_HOME_DIR` when it is set.\n- **Bring them in** adopts each checkout in place as a Pane, with one tab per\n session resumed by the agent's own id. A transcript kept in a tool's own agent\n folder is first copied into your own Claude Code or Codex store.\n- Sessions still running elsewhere are listed but can't be chosen, and\n neither can other sessions in the same checkout; quit them and press **Check\n again**, or use the skill below, which forks them. A tab\n whose agent exits without resuming is closed and reported, and a new Pane\n whose sessions all failed is removed. A tab waiting at the agent's\n folder-trust prompt, or whose agent is still starting, stays open for you.\n- The card and the skill share the record below, so neither brings a session\n in twice.\n\nSay \"migrate to Pane\" in any Session, or Yes on the first-run screen, and the\n`migrate-to-pane` skill brings the conversations you already have in other\nagent tools (Claude Code, Codex, OpenCode, the Cursor agent, Conductor, or\nanything similar) into Pane tabs:\n\n- It reads session metadata on this machine, including WSL distros and agents\n running in other terminals or editors, and shows one list grouped by\n repository. Running sessions and those active in the last 7 days are\n preselected; older ones can be added. Nothing is created until you confirm.\n After a Yes on the first-run screen, it places that preselected set without\n showing the list.\n- An idle session's checkout is adopted in place (`runpane panes adopt\n --resume`); several sessions in one checkout become tabs in one Pane. A\n session still running elsewhere is forked with its own tool into a new Pane\n on a new branch, with your uncommitted and untracked files copied, and the\n original keeps running untouched.\n- Each tab is resumed by its agent's own resume-by-id and must pass the\n continuity check in the skill's `references/continuity.md` (same native\n session, a restart comes back to it, history loaded, original untouched)\n before it is reported as continued. A session that fails is reported as not\n continued with the reason and next step, never replaced by a fresh agent.\n- It keeps a record in `<PANE_DIR>/migrate-to-pane/record.json`, so running it\n again lists what is already in Pane and creates nothing twice. Archiving an\n adopted Pane keeps your checkout.\n\n## Session startup\n\nCreating, opening, restoring, restarting, or switching the agent in a Session\ndoes not submit a bootstrap message. The terminal waits for user input with\nits role, profile, and Pane capability instructions available. There is no\nautomatic greeting, diagnostic sweep, watcher setup, or continuation of a\nsaved next action. Reopening an already-running Session reconnects without\ninterrupting work the user has already authorized.\n\nThere are two exceptions, each at most once per Pane data directory.\n\nThe first time the Onboarding Session launches after the first-run screen,\nPane sends it one prompt, which says that Pane sent it and why. After Yes, the\nprompt tells the agent to bring in the sessions you said yes to; after Not now,\nto make a Start here page for the project you opened. The screen saves your\nanswer in the `onboarding_handoff` user preference (`migrate` or `project`).\nPane records the prompt in the `pane_chat_migrate_offer_sent` user preference\nonce a launch has sent it, so a restart or an agent switch never sends it\nagain. Installs that never showed the screen get no prompt. See\n[Bring your existing sessions into Pane](#bring-your-existing-sessions-into-pane).\n\nPane may also offer Pane Chat once, in a card over a Pane, after you have\ncreated at least two worktree Panes and used Pane on at least three days, if you\nhave never created a Session. \"Try it\" creates a Session named after the Pane's\nrepository, whose agent introduces itself, suggests two small tasks from that\nrepository, and waits for your answer before starting any Pane. Pane removes\nthat opening prompt from the Session once a launch has sent it, so a restart\nnever sends it again.\n\nPane may prepare instruction files and terminal infrastructure at startup;\nthat preparation does not require an agent turn. Unattended work and watchers\nare separate, explicitly authorized activities.\n\n## Shared tools and authority\n\nSession orchestrators and regular agent panels share RunPane's coordination\ncapabilities. Use `runpane doctor --json` and `runpane agent-context --json`\nwhen the task requires those capabilities, and discover individual schemas\nwith `runpane agent-context --command \"<command>\" --json`.\n\nAn associated worker completes its assignment and reports results or blockers\nto its owning Session. Reporting is participation. Creating workers, assigning\nwork, redirecting agents, or changing ownership requires a user request or an\nexplicitly delegated task with that authority. Existing authorization persists\nwithin its scope. An independent Pane works locally unless coordination is\nrequested. Tool availability does not authorize unrelated work or automatic\nsharing of other conversations.\n\n## One Pane per feature\n\n**Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it.** `runpane doctor` prints the full working rules.\n\nA feature here means one branch and its PR. A new Pane creates a worktree that\nchecks out the repository, installs dependencies and often builds, so it is\nexpensive, and creating several at once can freeze the machine. An\norchestrator creates a Pane with `runpane panes create` only when the work's\nbranch has no Pane yet: new work, or an existing PR with no Pane.\n\nPane enforces both: `panes create --branch` refuses a branch another Pane has\nchecked out (code `ERR_RUNPANE_BRANCH_HAS_PANE`, naming that Pane), and at most\n2 Panes run setup at once while the rest wait in line.\n\nEvery later agent for that feature runs inside its Pane as a new agent tab:\nimplementer, reviewer, follow-up reviewer, auditor, fix implementer and QA. Each tab is a\nfresh agent with its own context, sharing the Pane's worktree and branch:\n\n```text\nrunpane panels create --pane <feature-pane-id> --tool-command \"<agent command>\" --source agent --no-focus --wait-ready --yes --json\n```\n\nBefore `runpane panes create`, find the work's Pane with\n`runpane panes list --repo <repo> --json`, matching the PR's head branch\n(`gh pr view <n> --json headRefName`) against\n`git -C <worktreePath> branch --show-current`, and use it when it exists.\n\nTabs share one checkout. Only the implementer changes the branch or HEAD, one\nwriter at a time, and a fix tab starts only after the previous writer has\nstopped. Review, audit and QA tabs never run `git checkout`, `reset` or\n`stash`. Never create a Pane to review, audit, fix or QA work that already has\none. Keep the\nfeature's Pane until its PR merges or closes, so later tabs still have the\nworktree; archive it then.\n\n## Pane association before delegation\n\nManagement is a Pane-level relationship; tabs inherit the relationship and\nshare the Pane's worktree. Panes created or adopted with `runpane panes\ncreate` or `panes adopt` from inside a Session are associated with it in the\nsame call: from the orchestrator (the CLI reads `PANE_ORCHESTRATION_SESSION_ID`)\nor from any tab in a Pane that belongs to the open Session (Pane looks up the\ncalling tab, `$PANE_PANEL_ID`). Each result item reports `association: {\nsessionId, ok, error? }`, and `--no-associate` opts out. A failed association never undoes the new Pane. Before delegating to an\nexisting Pane, or when automatic association failed, the orchestrator\nassociates it explicitly. The supported command is:\n\n```text\nrunpane sessions associate --session <id|name> --pane <pane-id> [--json] [--pane-dir <path>]\n```\n\nVerify the result with `runpane sessions overview` and reuse an existing\nassociation. A Pane already managed by another Session is a conflict: do not\ndetach, reassign, or create a duplicate Pane. When a prompt is passed to `panes\ncreate`, check the item's `association.ok` right away. Keep a Pane attached through idle and completion; do not detach on\ncompletion. Archiving preserves the association.\n\nTo close out finished work, `runpane panes archive --session <id|name> --merged\n[--closed] [--remove-worktree] [--dry-run] --yes --json` archives each\nassociated Pane when all of these hold:\n\n- **Its PR is merged** (or, with `--closed`, closed without merging). Pane\n looks the PR up by the Pane's branch on GitHub (`pr`). An open PR is skipped\n as `pr-open`, because its review, fix and QA tabs still need the worktree.\n No PR, or without `--closed` a PR closed without merging, is skipped as\n `pr-not-merged`, so a worker that has pushed but not opened its PR keeps its\n Pane. A PR state GitHub can't confirm is skipped as `pr-status-unknown`.\n- **No agent in it is mid-turn.** A Pane with a working agent is kept as\n `agent-busy`; archiving would stop it. A Pane with a tab holding text typed\n but not sent, or an editor with unsaved edits, is kept as `unsent-input`;\n archiving would lose it. `runpane panes archive --pane <id>` checks the same.\n- **Its worktree holds no unsaved work.** It has no uncommitted or untracked\n changes, and every commit is on its upstream after a fresh `git fetch`, or,\n without an upstream, on a remote-tracking branch or the base branch. A\n failed fetch or unreadable worktree is skipped as `status-unknown`. This\n check runs after the PR lookup, right before the worktree is removed.\n\nEvery skipped Pane has a `skipped.code` and a message with the next step.\n`--remove-worktree` also removes adopted worktrees; local branches are always\nkept. Run it with `--dry-run` first.\n\n### Keeping a Session tidy\n\nThe generated Session instructions have their own \"Keep the Session tidy\"\nsection (`main/src/services/sessionTidyRules.ts`, used by the Session folder's\n`AGENTS.md` and the generated `pane-orchestrator` skill; the bundled\n`pane-orchestration` skill carries the same rules). The orchestrator cleans up\nas it goes without asking, and says in one line what it closed or archived:\n\n- It keeps one status document in the Session folder, updated in place, and\n links plans, PRs, mock-ups and reports from it. It opens a page beside the\n person only when they need to look at it now, and closes it once that's\n done.\n- It closes tabs it opened once they no longer matter, with\n `runpane panels close --panel <id> --yes --json`. Whether a tab still\n matters is its judgment; Pane refuses only closes that could lose work: a\n tab the person opened (any tab without an agent opener, including every tab\n from before openers were recorded), a permanent tab, an agent mid-turn, and\n unsent composer text. For a stuck worker, or a tab the person asks it to\n close, `--force` closes it anyway, as the tab's close button does (D-209).\n- It archives a feature's Pane after a clean `panes archive --pane <id>\n --dry-run --json` once its PR merged or closed, including right after a\n merge the person asked for. It keeps a Pane with unsaved work or a busy\n agent and says why. It never passes `--force` and never touches another\n Session's Panes or tabs.\n\n`/wrap-up` wraps up a Session in one step. Pane ships it as the bundled `wrap-up`\nskill and writes a copy into each Session folder, at\n`.claude/skills/wrap-up/SKILL.md` (Claude Code, typed as `/wrap-up`) and\n`.agents/skills/wrap-up/SKILL.md` (Codex, as `$wrap-up` or from `/skills`).\nThe Session's `AGENTS.md` points every orchestrator, Agent Farm's included, at\nit for \"wrap up\" in plain words. Workers in feature Panes start in their own\nworktree and don't get it. Pane rewrites the copies on launch unless you\nreplaced one with your own (it has no Pane marker). It:\n\n1. Takes stock: the work list, `sessions overview`, and each PR's live state\n from the archive sweep's dry run (the overview's PR state can lag a merge),\n sorting the Session's Panes into finished, parked (PR open, all pushed,\n nothing running), busy and unsafe (uncommitted or unpushed work).\n2. Tells you first, before archiving anything, about whatever needs your\n attention: uncommitted or unpushed work, open PRs, commits no review\n covered, agents still working and open work-list items. It posts this as\n an info notification and writes it in the conversation; it doesn't ask or\n wait.\n3. Stops its watchers, closes every tab it opened (the status document too),\n archives every Pane whose dry run is clean (parked ones too; their PRs stay\n open), keeps unsafe Panes, and marks the other open work-list items\n dropped. A worker still working keeps its Pane; once it finishes, its Pane\n is archived after a clean dry run.\n4. Ends with its report, always: what it archived, what it kept and why, the\n PRs still open and how to restore a Pane, ending with \"Nothing left to do\n in this Session.\"\n\nIt doesn't archive the Session: the Session stays open with the report in it,\nand you archive it from the sidebar when you're done. It never merges,\ncommits or pushes for a worker, forces, deletes a branch, closes a tab the\nperson opened, or touches anything outside the Session.\n\nBefore mutating, use `runpane agent-context --command 'sessions associate'\n--json` to confirm the wrapper supports the command. If an older global CLI\ndoes not, select and verify the app-compatible dev wrapper from the Pane\nruntime context before proceeding. Never silently continue without the\nassociation or substitute an unverified global/`npx` wrapper.\n\nSessions do not create worktrees and do not edit project implementation files.\nAn association identifies work that a Session coordinates; it does not grant\nimplementation authority by itself. Detach a Pane before assigning it to a\ndifferent Session.\n\n## Worker file access\n\nA worker's agent may be allowed to read only its working directories (Claude\nCode's `permissions.blockReadsOutsideWorkingDirectories`). Its brief and the\nSession files the brief points to must not sit outside them, or the worker\nstops on a permission prompt nobody is watching.\n\n**Briefs and attachments.** `--as-file-pointer` (`panes create`,\n`panels create`, `panels submit`, `agents send`) writes the prompt inside the\nPane's worktree, at `<worktree>/.pane/prompts/<timestamp>.md`, and sends the\none line `Read and follow .pane/prompts/<timestamp>.md`. The path is relative\nto the worktree, where the agent starts: given an absolute path, Claude Code\noften reads it with `cd <worktree>; cat <file>`, which its read check can't\nverify, so it asks. The result's `promptFile` is always absolute. Pane adds `/.pane/prompts/` to the\nrepository's `.git/info/exclude` (never a committed `.gitignore`), so the file\ncan't be committed. `--attach <file>` (repeatable; `panes create`,\n`panels create` and `panels submit`, with `--as-file-pointer`) copies each file\ninto `<worktree>/.pane/prompts/<timestamp>/` and sends\n`Read and follow <path> (attached: <copy>, ...)`, also worktree-relative; the\nresult lists the copies, absolute, in `attachments`. Attach mockups, plans or dispatch notes the worker needs\ninstead of pointing at the Session folder. Without a local git worktree (a\nfolder that is not the top of a checkout, a WSL repo) the file goes to\n`<pane-dir>/prompts/<pane-id>/` as before, and the pointer line names it by\nabsolute path.\n\n**The Session folder.** A Pane associated with a Session gets that Session's\nfolder (`<pane-dir>/sessions/<id>`) as `PANE_SESSION_DIR` in every tab created\nafter the association. The Session's own terminals get it too.\n`PANE_ORCHESTRATION_SESSION_ID` keeps its meaning: it is set only in the\nSession's own terminals, never in a worker's. Workers read the folder and never\nwrite it; the orchestrator is its only writer. What each built-in template gets:\n\n| Agent | Read access to the Session folder |\n| --- | --- |\n| Claude Code (`claude --dangerously-skip-permissions`) | Pane adds `--settings '{\"permissions\":{\"additionalDirectories\":[\"<folder>\"],\"deny\":[\"Edit(/<folder>/**)\"]}}'`. `additionalDirectories` (like `--add-dir`) makes the folder a working directory, which grants read and write; an `allow` rule alone does not lift `blockReadsOutsideWorkingDirectories`. The `Edit` deny rule takes the file tools' write access back (it covers Write too; Claude ignores `Write(path)` rules). Under bypass permissions Bash can still write anywhere, so the read-only rule is a guard, not a sandbox. The folder's `CLAUDE.md` is not loaded. Not added on Windows. At launch Pane merges this value into the tab's one settings file ([Claude's own prompts](PANE_NOTIFY.md#claudes-own-prompts)). |\n| Codex (`codex --yolo`) | Nothing to add: `--yolo` runs without a sandbox, and every Codex sandbox mode reads the whole disk. Codex's `--add-dir` grants write access, so Pane does not pass it. |\n| Cursor, OpenCode, Pi | Only `PANE_SESSION_DIR`. |\n| `--tool-command` wrappers (agent-farm) and custom commands | Only `PANE_SESSION_DIR`; the wrapper maps it to its harness's flag. |\n\nThe flag is fixed when the tab is created: a tab opened before its Pane was\nassociated has no `PANE_SESSION_DIR` until a new tab is created.\n\n### The scratch folder\n\nEvery tab Pane starts gets `PANE_SCRATCH_DIR`, a folder for the agent's\ntemporary files, clones, captures, downloads, logs and test instances (an\nisolated `PANE_DIR` and `HOME` for QA), so nothing lands in `/tmp` where\narchive never reaches it. Pane creates it when the first tab starts:\n\n| Pane | `PANE_SCRATCH_DIR` | Deleted |\n| --- | --- | --- |\n| A worktree Pane created (archive removes the worktree) | `<worktree>/.pane/scratch/`, hidden by the repository's `.git/info/exclude` | With the worktree, on archive |\n| A Pane on the main checkout or an adopted worktree | `<pane-dir>/scratch/<pane-id>/` | 14 days after archive |\n| A Session's own tabs | `<pane-dir>/scratch/<session-pane-id>/` | 14 days after the Session is archived |\n| A WSL project, or a WSL terminal of a worktree Pane created | `<pane-dir>/scratch/<pane-id>/`, as a `/mnt/c/...` path inside WSL | 14 days after archive |\n\nTabs on an SSH host get no `PANE_SCRATCH_DIR`: a folder on this machine means\nnothing on the remote one.\n\nPane never deletes a main checkout or an adopted worktree. The 14 days come\nfrom **Settings → Worktrees & Git → Keep archived folders**; restoring before\nthen keeps the folder. A permanently deleted Pane's scratch goes at the next\nexpiry pass. Pane records each archive time in\n`<pane-dir>/scratch/.archived/<pane-id>`, outside the folders agents write, and\nchecks again right before each delete that the Pane or Session is still archived. Scratch never blocks archive: its files are hidden from\ngit, so they are neither untracked nor uncommitted. `runpane panes archive\n--dry-run` lists the folder with its size, and the date it will be deleted when\nit is kept.\n\nBefore deleting a scratch or Session folder, Pane moves every agent log inside\nit (an agent run with its home there) to\n`<pane-dir>/agent-logs/<agent>/<pane-id>/`, finding them by each agent's\n`transcriptDirs` in the agents config. If a move fails, nothing is deleted.\nUsage & Limits reads `<pane-dir>/agent-logs/` beside `~/.claude/projects` and\n`~/.codex/sessions`. Pane only reads, moves or deletes a folder that sits\nexactly where Pane put it: a scratch folder that is a symbolic link or a\nWindows junction, or is reached through one, is left alone (a link is only\nunlinked), so Pane never moves or deletes anything in the agents' own folders\nin your home.\n\nWrite the folder's absolute path into the brief rather than\n`$PANE_SESSION_DIR`. Under `blockReadsOutsideWorkingDirectories` Claude Code\nasks before any Bash command whose variables it cannot check, so a worker that\nruns `echo $PANE_SESSION_DIR` or `cat \"$PANE_SESSION_DIR/...\"` stops on a\nprompt. The variable is for wrappers and scripts.\n\n## Stable interfaces\n\nThe shared record and service are:\n\n- `shared/types/orchestrationSession.ts`\n- `main/src/services/orchestrationSessionManager.ts`\n- `orchestration-sessions.json` below `PANE_DIR`\n\nThe store has no size or count limit. On load, Pane keeps every Session in the\nfile's `sessions` array that decodes, whatever the file's `version` says, and\ndrops any malformed Session, link or activity entry. An invalid\n`selectedSessionId` or `order` is dropped. Only a file that is not JSON loads\nwith no Sessions. If anything was dropped or repaired, Pane logs it and first\ncopies the file to `orchestration-sessions.json.corrupt-<timestamp>` beside it.\nThe original file stays as it was until the next write.\n\nEach Session keeps its newest 500 activity entries and 1000 inbox items. Set\n`retention` in `config.json` to change either:\n`\"retention\": { \"sessionActivity\": 500, \"sessionInbox\": 1000 }`. A missing or\ninvalid value uses the default.\n\nThe daemon and Electron IPC channels are:\n\n`orchestration-sessions:list`, `orchestration-sessions:select`,\n`orchestration-sessions:create`, `orchestration-sessions:get`,\n`orchestration-sessions:update`, `orchestration-sessions:archive-preview`, `orchestration-sessions:archive`, `orchestration-sessions:reorder`, `orchestration-sessions:set-agent`,\n`orchestration-sessions:associate`, `orchestration-sessions:detach`, and\n`orchestration-sessions:overview`.\n\nSelectors accept a stable Session ID or an exact Session name. Phone apps\nreleased before chat tabs crash on a tab kind they don't know, so clients that\nshow chat tabs pass `{ chatTabs: true }` as a second argument to\n`orchestration-sessions:create`, `orchestration-sessions:get` and `panels:list`\n(desktop, the PWA and current phone apps do). For any other client, `create`\nstarts the orchestrator in a terminal, `get` of a Session whose orchestrator is a\nchat tab fails with `CHAT_TAB_CLIENT_OUTDATED`, which says to update Pane on the\nphone, and `panels:list` leaves chat tabs out. The existing\n`pane-chat:*` channels remain compatibility endpoints for the imported legacy\nconversation.\n\nRunPane exposes the corresponding commands:\n\n```text\nrunpane sessions list --json\nrunpane sessions get --session <session-id-or-name> --json\nrunpane sessions overview --session <session-id-or-name> --json\nrunpane sessions create --from-json <path|-> --json\nrunpane sessions update --session <session-id-or-name> --from-json <path|-> --json\nrunpane sessions pin --session <session-id-or-name> --json\nrunpane sessions unpin --session <session-id-or-name> --json\nrunpane sessions set-agent --session <session-id-or-name> --agent <agent> --json\nrunpane sessions associate --session <session-id-or-name> --pane <pane-id> --json\nrunpane sessions detach --session <session-id-or-name> --pane <pane-id> --json\n```\n\n`sessions create` starts the Session's agent, as opening it in the app does.\nTo give it a first prompt, wait for the agent, then submit:\n\n```text\nrunpane panels wait --panel <panelId> --for ready --json\nrunpane panels submit --panel <panelId> --text \"<prompt>\" --yes --json\n```\n\nWhen a Session's Claude runs on this machine, Pane answers Claude's \"trust\nthis folder\" prompt for the Session's own folder, choosing \"Yes, I trust this\nfolder\" in the terminal, so the agent starts without a click. Pane answers\nonly when the Session launches a plain `claude …` command (the default, or a\ncustom one with no `cd`, wrapper or shell operator), only when the prompt shows\nexactly the Session folder, never a project, and only until Claude is first\nready. This is best effort: a prompt Pane does not recognize, or a folder path\nwith a space in it, stays on screen for you to answer. A WSL Session's Claude\nis not answered, so it asks on its first launch.\n\nUse `--from-json` for structured create and update input. Keep multiline\ncontext, evidence, links, and reports in the JSON file or stdin; do not put\nexternal text into shell source. Re-read mutation results and inspect the\noverview after associations or updates.\n\n### Session JSON shapes\n\n- `decisions` and `blockers` are arrays of strings.\n- `evidence` and `outputs` are arrays of links:\n `{\"label\", \"url\", \"addedAt\", \"kind\"?, \"provenance\"?}`. `url` starts with\n `https://`, `http://`, `file://` or `grain://`; `addedAt` is an ISO 8601\n date; `kind` is `evidence`, `output`, `ticket`, `pull-request` or `other`.\n- `report` (update only) is `{\"summary\", \"status\": \"reported\"|\"verified\",\n \"evidence\": [at least one link], \"reportedAt\", \"provenance\"}`; `null`\n clears it.\n- Arrays replace the stored value, so send the whole list.\n- A bad payload is refused whole with one `ERR_SESSION_PAYLOAD_INVALID` error\n that lists every problem (`outputs[0].addedAt: missing`, ...). The CLI\n checks it before calling Pane, and the daemon checks it again for clients\n such as `runpane-py` (`main/src/services/orchestrationSessionPayload.ts`).\n\n`runpane agent-context --command \"sessions update\"` prints the fields and a\ncomplete example.\n\n## Resume and refresh persisted context\n\nWhen responding to a user task that needs Session state, read\n`PANE_ORCHESTRATION_SESSION_ID` from the current environment. Pane exports this stable identity for\nSession panels, including agent resume paths that do not receive the original\nbootstrap input. Do not infer the Session from a terminal panel ID or from\nconversation text.\n\nWhen the variable is present and the task requires it, reload the saved record\nand then reconcile live\nPane, tab, branch, and evidence state:\n\n```text\nrunpane sessions get --session \"$PANE_ORCHESTRATION_SESSION_ID\" --json\nrunpane sessions overview --session \"$PANE_ORCHESTRATION_SESSION_ID\" --json\n```\n\nRun `get` to recover persisted intent and associations, and run `overview`\nwhen continuing a task after a resume or after a mutation. For workers, this variable does not identify a parent Session. Use `runpane\nsessions list --json` and Pane associations to resolve ownership; never infer\nit from the selected UI Session. Refresh associations before coordinating work. If the\nstable ID cannot be resolved, report the error before taking Session-specific\nactions.\n\n## Identity and overview\n\nEach orchestration Session has a stable ID, a hidden detached Pane session for\nits conversation, and one deterministic terminal panel for each supported\nagent. The imported legacy Pane Chat record retains its legacy internal IDs,\nresume IDs, and terminal buffers. New Session records must not reuse those\nidentities.\n\nLegacy Pane Chat keeps its agent histories together in one Session. Previously\nsplit imports are reunited only when untouched; retained independent imports\nreceive separate hidden owners so their workspace tools cannot cross Sessions.\n\nThe overview joins persisted intent with fresh Pane, tab, branch, worktree,\nagent, and available Git or pull request evidence. Working, idle, stopped,\nexited, missing, and archived states describe activity or availability. They\ndo not prove completion. A completion report must carry inspectable evidence,\nthe report timestamp, and provenance; new activity makes an older report\nstale.\n\n## Named locks for shared resources\n\nWhen several workers share one resource that only one of them may use at a\ntime, such as a test account whose \"approve guest\" banner any logged-in worker\ncan click, name a lock in their prompts. Each worker takes the lock before it\nuses the resource and gives it back after:\n\n```text\nrunpane lock acquire --name testing-account --ttl 30m --wait 1800000 --note \"call QA\" --json\n# ... use the shared account ...\nrunpane lock release --name testing-account --json\n```\n\n- **Owner.** The calling Pane and panel, from `PANE_SESSION_ID` and\n `PANE_PANEL_ID` (or explicit `--pane`/`--panel`). Outside a Pane terminal the\n owner is external and `--note` is required: it names the owner, so pass the\n same note to release.\n- **Scope.** A lock is scoped to the owner's Session when its Pane belongs to\n one (as the Session's orchestrator or an associated Pane), so two Sessions can\n each hold `testing-account`. A Pane outside any Session uses the global scope.\n The scope is fixed when the lock is first taken.\n- **Acquire.** Succeeds when the lock is free, expired, or already held by the\n same owner, which renews the TTL (`renewed: true`). Otherwise it returns\n `ok: false` with `heldBy` and `expiresAt` and exits 1. With `--wait` the call\n blocks in the daemon, which grants the lock to the oldest waiter as soon as it\n is released or expires; the CLI chains daemon calls of up to 120 seconds for\n longer waits.\n- **Release.** Only the owner can release a lock. `--force` releases another\n owner's lock, for example a stuck worker's; add `--session <id|name>` to\n name a Session-scoped lock from outside that Session.\n- **Automatic release.** Pane releases a lock when its TTL (at most 24h) runs\n out, when the owner panel's terminal exits or is closed, and when the owner\n Pane is archived. Quitting Pane does not release locks: the resumed agents\n still expect to hold them.\n- **Storage.** Locks are saved in `locks.json` below `PANE_DIR` with\n temp-and-rename writes, so they survive a daemon restart. Expired locks and\n locks whose owner Pane or panel is gone are dropped when the file loads.\n- **Visibility.** `runpane lock list [--session <id|name>]` lists held locks,\n and `sessions overview` includes `locks`: those scoped to the Session plus\n those its Panes hold.\n\nIf a worker interrupts a waiting `lock acquire`, the daemon may still grant it\nthe lock for up to two minutes; release it, or let the TTL expire.\n\n## Orchestrator guide\n\nThe mechanics of driving workers through Pane, for any orchestrator and any\nharness (a Pane Session, a Claude Code or Codex session in a Pane terminal, or\na wrapper such as Agent Farm), live in one place: the bundled\n[`pane-orchestration`](../main/src/services/paneChatBundle/skills/pane-orchestration/SKILL.md)\nskill. Any agent can read it with\n`runpane docs read --doc skills/pane-orchestration/SKILL.md`, and the home\n`pane` skill points there. It covers one Pane per feature, launching a worker\nas a Pane or tab (including `--tool-command` wrappers, `--initial-input-file\n--as-file-pointer`, `--wait-ready` and reading the delivery result), the one\nwait primitive (`runpane watch --session <S> --as <name> --until-event`) and\nwhat each wake means, worker reports and how a status file pairs with them,\nanswering workers, resuming after a restart or sleep, showing pages beside the\nperson, shared-checkout and port etiquette, handoff, cleanup, and what changes\nafter the next release. The sections below are the reference for each piece.\n\n## Session watcher\n\nWhen monitoring is authorized, use one durable, named watcher per Session. Do not start it merely because a Session opens. `--session` takes the Session ID\nor exact name, and the daemon follows every Pane associated with it:\n\n```text\nrunpane watch --session <session-id> --follow --json\n```\n\nThe daemon resolves the Session once per request and re-reads its\nassociations on every journal read. A Pane associated after the watcher\nstarts is included; a detached or archived Pane drops out, together with any\nline still held for it by `--ready-settle` or `--min-interval`. The Session's own\nhidden owner and orchestrator panels never appear, and an association limited\nto specific panels reports only those panels. There is no re-arm after\n`sessions associate` or `sessions detach`. `--session` cannot be combined with\n`--pane`, an unknown Session fails the watch, and a daemon\nthat predates `--session` fails it with `WATCH ERROR` instead of watching every\nPane.\n\nAfter a Pane restart, an agent panel whose process did not come back is\nreported once as `panel.stopped` (`STOPPED <pane-name> pane <pane-id> panel\n<panel-id>`, `running: false`), never as `agent.ready`. Restart it in place,\nwith the same panel ID and its conversation, using `runpane panels resume\n--panel <panel-id> --wait-ready --yes --json`, or every stopped agent panel of\nthe Session at once with `runpane panels resume --session <session-id>\n--wait-ready --yes --json`. A worker started with `agent-farm run <profile>`\nresumes with `--resume` and the launch ID Agent Farm printed, the same rule a\nrestart uses (see \"Agent Farm\" above). The bulk form restarts `--concurrency` panels at a\ntime (default 3), leaves running panels alone, waits on the resumed panels\ntogether, and returns one result per panel with its readiness, blocker, or\nerror; `--all-stopped` does the same for every Pane. It relaunches finished\nworkers too, so resume single panels when only some should continue. Both\nbulk forms skip paused tabs.\n\nPause stops a tab's process the way quitting Pane does, without asking, and\nkeeps its panel and conversation: `runpane panels pause --panel <panel-id>\n--yes`, `runpane panes pause --pane <pane-id> --yes`, or `runpane sessions\npause --session <session-id>` for the terminal tabs of the Session's chat and\nevery Pane in it. Pause leaves a chat tab running: the result counts it in\n`chatTabsNotPaused` and says so, and `panels pause` refuses one. Auto-pause\n(Settings > Pause) does stop the agent of a chat tab idle for\n`chatIdleReleaseMinutes` (30 by default), outside the Pane on screen and never\nwhile it works, holds a queued message or waits on the person. Opening the tab\nor sending it a message resumes it in its conversation, and it reports no\n`panel.paused`. A Session whose orchestrator is a chat tab therefore never reads as paused.\nA paused terminal tab stays stopped through clicks, app restarts and updates until\n`runpane panels resume --panel <panel-id>`, `runpane panes resume --pane\n<pane-id> --yes` or `runpane sessions resume --session <session-id>` restarts\nit in its conversation. The watch reports each paused tab once as\n`panel.paused` (`PAUSED <pane-name> pane <pane-id> panel <panel-id>`) and each\nresumed one as `panel.unpaused` (`UNPAUSED ...`), followed by its usual ready\nsignal. An orchestrator leaves paused workers paused unless the person asks.\nAny other start of a paused terminal tab (opening it, a retry, another machine)\nfails with `ERR_PANEL_PAUSED` and starts nothing.\n`runpane panes list --json` reports each Pane's `paused` mark (`{ at, by:\n\"manual\" | \"auto\", idleHours? }`) and `inactiveSince`, the latest terminal\noutput or input or chat agent activity in its tabs or the last time the person\nselected it;\n`runpane panels list` reports each tab's `paused`.\n\nIf a stopped panel's previous shell or agent process is still exiting, resume\nreturns a `still stopping` error instead of starting a second process. Retry\nafter the old processes exit. This also applies when bounded teardown could\nnot kill a process; bulk resume reports the error for that panel and continues\nwith the others. Archived Panes cannot be resumed, even if archive cleanup failed.\n\nMembership changes are journal entries: `pane.associated` (`JOINED <pane-name>\npane <pane-id> session <session-id>`) and `pane.detached` (`LEFT ...`). The\nSession manager emits them from `sessions associate` (only when the Pane was\nnot already a member) and `sessions detach`. A watch without `--session`\nreceives them only when `--kinds` lists them, so older clients never see an\nunknown kind. Cadence state is keyed by the Session rather than its current\nPanes, so held lines survive membership changes.\n\n### Watching a PR from any Pane\n\n```bash\nrunpane pr watch --pane <pane-id> --url https://github.com/owner/repo/pull/123 --head <full-sha> --json\nrunpane watch --pane <pane-id> --since <generation-returned-above> --epoch <epoch-returned-above> --until-event --json --kinds pr.checks,pr.conflicted,pr.base_changed,pr.base_deleted,pr.head,pr.review,pr.comment,pr.closed,pr.merged,pr.stopped,github.unavailable,github.recovered\nrunpane pr list --pane <pane-id> --json\nrunpane pr unwatch --pane <pane-id> --url https://github.com/owner/repo/pull/123 --json\n```\n\nInside a Pane, registration defaults to its `PANE_SESSION_ID`. Registration\nreturns `generation` and `epoch`; use both for the first wait, including events\nthat arrived between registration and arming. An identical active registration\nretry returns its original generation, including after daemon restart, so a\nlost response cannot skip an unread event. A new head pin or unwatch/re-register\nstarts a new registration. Process every returned NDJSON\nevent, then persist its `gen` and `epoch`. Rearm with `--since <gen> --epoch\n<epoch>`; use `--limit 1` for one event per invocation. Never reuse the initial\nregistration generation after delivering an event, and never combine `--as`\nwith `--since` or `--epoch`. A named cursor is a separate daemon-managed mode.\n\nOrdinary daemon restarts preserve the epoch and unread retained events. On\n`_reset` or `_dropped`, resynchronize current GitHub state before accepting\nsuccess, then persist the control record's `generation` and `epoch`. Ignore\n`replay`/`baseline` records as new events. Retention is bounded; a journal reset\ncannot recover lost history. A consumer crash before saving its cursor can\nreplay an event, so actions must be idempotent. Registration uses the full\nhost/repository/number identity. It pins success to `--head`, or the first\nobserved head; a new head emits `pr.head` and needs a fresh registration before\nsuccess can be reported. Read existing discussions before arming. A wake\nmeans inspect the change; it never authorizes merging.\n\nThe watch also reports when the ground under the PR moves. `pr.base_changed`\n(`BASE CHANGED`) fires when the base branch is retargeted, by a person or by\nGitHub after a stack parent merges and its branch is deleted; `base.from` and\n`base.to` name the old and new base. `pr.base_deleted` (`BASE DELETED`) fires\nwhen the base branch no longer exists; GitHub may close the PR right after.\nBoth arrive at once under `--follow`. When the PR below this one in a stack\nmerged with a merge commit and this PR now targets the branch it merged into,\nthe retarget is done: confirm the diff shows only this PR's commits and recheck\nrequired checks (`gh pr checks <number> --required`); do not rebase or push.\nAfter any other base change, rebase onto the new base and recheck CI.\n\nThe daemon batches up to 25 fingerprints per host every two minutes (plus up\nto ten seconds of jitter), reads details on changes and at a 30-minute\nbackstop, and keeps 10% of GitHub quota for interactive work. It uses `gh auth\ntoken` for cached authentication and direct GraphQL for reads. Session PR\nbranch discovery still uses Pane's existing `gh pr list` lookup.\n\nFailures emit immediately, even while other checks run. Success requires a\ncomplete, nonempty set of checks on the pinned head and all required checks\npassing (all checks when none are marked required). BLOCKED/UNKNOWN merge\nstatus conservatively withholds success, including when reviews are missing.\nFeedback from every account is included: agents and people can share a login.\nChecks passing is a signal to inspect the PR, not proof of complete readiness;\noptional failures can still produce a separate failure event. Merge/close,\neight non-rate-limit failures, or ten comment-only updates stop registration;\narchiving/deleting the Pane removes it. Rate limits pause instead of consuming\nthe failure budget. Outages and recovery are journal events.\n\nFingerprints include individual check outcomes and thread resolution state, so\nequal aggregate counts do not hide swaps or edits. When the fingerprint window\nis truncated (over 100 checks/discussion items or multiple comments in a review\nthread), the daemon reads details each round. Detail reads page through up to\n2,000 checks and retain the latest 100 comments, reviews, threads, and comments\nper thread. Truncated discussions emit `pr.review` with an incomplete-feedback\nreason and withhold success; read the full discussion on GitHub.\n\nBaselines and events are replaced atomically before readers wake. This prevents\na process crash from advancing a baseline without its event. Delivery remains\nbounded by journal retention and cursor acknowledgments; replay after a consumer\ncrash before acknowledgment is possible. This is not an exactly-once or\npower-loss durability guarantee.\n\n\nThe cursor defaults to `session-<uuid>`, where `<uuid>` is the UUID inside the\nSession ID: the Session `__orchestration_session_<uuid>__` uses\n`session-<uuid>`. Passing the name instead gives `session-<name>`. Cursor names\nmay be up to 128 characters (64 before this release); when runpane derives a\nname itself, such as this default or the `PANE_PANEL_ID` fallback, it shortens\none longer than 64 characters (or one with other characters) to\n`<prefix>-<first 12 hex characters of its sha256>`.\n\nA discussion-only Session has no follow watcher. On restart, retain the\n`session-<uuid>` cursor and capture a fresh output baseline before\ninterpreting notifications. After a reset (`_reset`), the baseline restates\ncurrent state: those JSON entries carry `replay: true` (and\n`changedWhileAway: true` after a daemon restart). A replayed `agent.ready` is\nnever READY; re-read `sessions overview` instead of acting on it. Lines mode\nprints only `CHANGED` for them. Return blocked and decision findings to the\nSession conversation. Terminal idle or exit remains activity evidence only.\n\n`--follow` has one default cadence: READY settles for 3 minutes, BLOCKED\nfor 30 seconds, and non-urgent events batch every 10 minutes. IDLE starts at\n10 minutes and backs off to 30 minutes, 1 hour, 3 hours, then daily. Heartbeats\nare off. WATCH OK prints once when armed; WATCH EXPIRED and exit 0 end a watch\nafter 3 quiet hours. Meaningful events reset expiry; IDLE and replay do not.\n\nIndividual duration overrides accept `30s`, `3m`, `3h`, or `0`: `--ready-settle`, `--blocked-settle`,\n`--min-interval`, `--idle-after`, `--expire-after`, `--heartbeat`, and\nwatch `--timeout-ms` (for example, `--until-event --timeout-ms 30s`).\n`--expire-after 0` disables natural expiry. Bare values retain milliseconds,\nexcept heartbeat's legacy seconds. `--json` selects NDJSON; otherwise lines.\n\n`--present` and `--profile` were removed. Use individual timing flags such as\n`--ready-settle 1m --blocked-settle 15s --min-interval 2m` to override the defaults.\n\n```bash\nrunpane watch --session <session-id> --follow --json\nrunpane watch --session <session-id> --follow --ready-settle 1m --blocked-settle 15s --min-interval 2m --json\nrunpane watch --pane <pane-id> --until-event --json\n```\n\nSession membership changes need no re-arm. Named cursors survive daemon\nrestarts; the journal and PR baselines are saved together. RESET/DROPPED mean\nrefresh the overview; replayed baseline entries never mean a new READY.\n`--until-event` waits for REPORT, BLOCKED, EXIT or GONE by default and exits 0\nwhen one arrives, immediately without follow settling or batching. A harness\nthat consumes a named follow stream gets its cadence; a process-exit waiter\nkeeps these immediate single-event semantics. Cadence requires a named consumer\n(explicit `--as` or the name assigned by follow). `--follow --since <generation>`\nhas no consumer name and also bypasses settling and batching. Named `--as`\ncannot be combined with numeric `--since`; switching only the wait mode does\nnot enable cadence for a numeric generation/epoch cursor.\nOverride `--kinds` for PR events. Its `--timeout-ms` is a\ntotal deadline (exit 124); under follow it bounds each daemon request.\n\nREPORT remains the completion signal: workers use `runpane report --state\nready|blocked|failed|done --summary-file <path>`, adding a PR/head and a question\nwhen blocked. READY alone is activity evidence. Read the full report with\n`runpane agents status --panel <id> --json`. Resume stopped workers in the same\npanel with `runpane panels resume --panel <id> --wait-ready --yes --json`.\n\nDo not pipe follow through `head` or `grep -m1` to wait. Run `--until-event` as\na supported background task, act on its events, then re-arm with its cursor\n(the [orchestrator guide](#orchestrator-guide) has the one wait command and\nwhat to do on each wake, timeout, reset and error).\nNever sleep-poll your own background task output. WATCH ERROR/nonzero exit\nmeans failure: re-read every worker's status, then re-arm once; a second\nfailure goes to `runpane doctor --report`. A superseded cursor means keep the\nreplacement. A normal expiry means re-arm with the next dispatch.\n\n\n## Worker reports\n\nWorkers hand back a structured report when they finish or get blocked. Every\nworker prompt ends with:\n\n```text\nWhen finished or blocked, run\nrunpane report --state <ready|blocked|failed|done> --pr <number> --head <sha> --summary-file <path>\n(add --question \"<question>\" when blocked).\n```\n\nInside a Pane terminal `runpane report` finds its own panel through\n`PANE_SESSION_ID` and `PANE_PANEL_ID`; elsewhere pass `--pane` and `--panel`.\n`--question` is required with `--state blocked`, `--pr` is a positive integer,\nand `--head` is 7 to 40 hex characters.\n\nThe daemon then:\n\n- keeps the latest report in the panel's custom state, so it survives a\n restart: `{ state, pr, head, summary, summaryPath, question, reportedAt }`,\n with up to 16,000 characters of summary (a longer one ends with a truncation\n marker and sets `summaryTruncated`);\n- journals an `agent.report` entry with the same fields (summary cut to 2,000\n characters), printed as `REPORT <pane-name> pane <pane-id> panel <panel-id>\n ready pr#747 fc5dce9` or `... blocked: <question>`. It skips the\n `--min-interval` batch. Only watchers that list `agent.report` in `--kinds`,\n and Session watches, receive it, because released CLIs reject journal kinds\n they don't know. It passes `--agents-only` (which `--follow` and\n `--until-event` imply) whatever panel sent it, so a report from a shell tab\n or a wrapper launch whose agent isn't detected yet still arrives;\n- appends a `report` activity (with the worker's `paneId` and `panelId`) to\n every Session the Pane is associated with, which makes an older Session\n report stale;\n- shows the report in `agents status`, `panels list`, and `sessions overview`.\n There each panel carries its own latest report as `panes[].panels[].report`,\n and `panes[].report` is the newest report among the Pane's panels, with its\n `panelId`. When the summary is a complete JSON object (a status file sent\n with `--summary-file`, say), the panel's `report.data` holds it exactly as\n given; a plain-text, array, scalar, invalid, truncated, or more than 64\n levels deep summary has no `data`;\n- returns `liveWatchers`, the number of watches that were waiting and received\n it. The CLI prints `Delivered to 1 waiting watcher.`; with no Session and\n nobody waiting it says the report is stored on the panel and that a\n named-cursor watch receives it when it next waits.\n\nThe orchestrator treats REPORT as the completion signal. A READY without a\nreport means look, and maybe nudge: `runpane panels last-message --panel\n<panel-id> --json` returns the agent's last reply from its Claude or Codex\ntranscript (never the screen; `transcript-unavailable` otherwise), and the\nworker can be asked to run `runpane report`.\n\nAn orchestrator whose harness wakes only when a process exits (Claude Code\nbackground Bash, Codex) waits with the one wait primitive from the\n[orchestrator guide](#orchestrator-guide): `runpane watch --session <S> --as\n<name> --until-event --json --kinds\nagent.report,agent.report.missing,agent.blocked,agent.ready,panel.exited,panel.stopped,panel.paused,pane.gone` (`--pane <pane-id>` outside a Session), run as a background\ntask and run again after each event. `--until-event` exits 0 on the first\nevent (124 at a `--timeout-ms` deadline, if you give one); a `RESET` and the caller's own panel never end\nthe wait. When a worker keeps richer state in a status file, it writes the file\nfirst and reports with `--summary-file <status file>`; the file is the truth\nand the report is the signal.\n\n### Dispatching with `--wait`\n\nThe [orchestrator guide](#orchestrator-guide) prescribes submission without\n`--wait`, followed by its named watch as the completion consumer. The CLI also\noffers an optional per-dispatch result for callers choosing that route instead:\n\n```text\nrunpane panels submit --panel <panel-id> --input-file <prompt-file> --as-file-pointer --wait --yes\n```\n\n`panels create` and `panes create` with a prompt take `--wait` too. `--wait`\nturns the expected report on and blocks on that panel until the first\n`agent.report`, `agent.report.missing`, `agent.blocked`, `panel.exited`, or\n`pane.gone`. It then prints one line of JSON (`dispatchWaitResult` in the\ncontract) and exits:\n\n| `outcome` | Exit | Carries |\n| --- | --- | --- |\n| `report` | 0 | `report`: state, summary, `summaryPath`, PR, head, question |\n| `missing` | 3 | `lastOutput` and `lastOutputSource` |\n| `blocked` | 4 | `screenLines`, the prompt the worker waits on |\n| `exited`, `gone` | 5 | `exitCode` or `reason` |\n| `indeterminate` | 6 | history was lost; inspect the panel and inbox before retrying |\n| `timeout` | 124 | after `--timeout <duration>` (`30m`, `2h`) |\n\nThe result never includes the transcript. The daemon stamps the result of\nevery create and submit with the journal generation and epoch it read before\ndelivering the work. `--wait` adapts the existing `watch --until-event` reader,\nfiltered to the Pane and panel. It reconnects after a daemon restart; a replaced\nor truncated journal returns an explicit indeterminate result (exit 6), since\nthe task's outcome can no longer be established from that history. Like\n`--until-event`, it is a single-event wait: it delivers at once, without\n`--follow`'s settling or batching, and since it exits on the event, a plain\nbackground task is enough (no line-delivering monitor). Claude\nCode wakes the orchestrator when the background call exits, and the line\narrives as the tool result. Report-expected work is serialized per panel: a\nnew dispatch is refused before writing while an expectation or missing-output\ncollection is outstanding. A send with `--no-expect-report` (`panels submit` or\n`agents send`) is a reply, such as an answer to the worker's question or an\naddition to its current work: it is delivered while a report is outstanding,\nand Pane keeps waiting for the original work's report.\nHeld starting input is reserved but does not count startup readiness as task\ncompletion; tracking activates immediately before the prompt's submit or launch.\n\n### Expected reports\n\nWork sent to an agent through runpane expects a `runpane report` back: a\n`panels submit` to an agent's panel, and a `panels create` or `panes create`\nthat carries a prompt. A request marked `--source user` (Pane's own UI marks\nits sends that way) expects none, and neither does typing into a tab, which\nnever goes through runpane. `--no-expect-report` sends fire-and-forget input;\n`--expect-report` asks for a report anyway, also from a plain shell panel.\n`shouldExpectReport()` in `main/src/ipc/runpane.ts` holds the rule. Pane saves `{ since }` per panel in `expected-reports.json` below `PANE_DIR`\n(results echo it as `expectedReport`); only the tracker writes that file, so\npanel-state writes cannot bring back a cleared expectation. When the agent then goes ready (`agent.ready`)\nor its panel exits without a report made at or after `since`, Pane journals\none `agent.report.missing` entry (`MISSING REPORT <pane-name> pane <pane-id>\npanel <panel-id> ready|exited`) and clears the expectation. The entry's\n`lastOutput` is the agent's last reply from its transcript, or else the last\n20 lines on its screen (`lastOutputSource: transcript|screen`), cut to 2,000\ncharacters with the end kept. A report clears the expectation.\n\nAn agent can end its turn while work it started keeps running. Pane reads\nthat from the screen: Claude Code counts running background shells in its\nfooter (`⏵⏵ bypass permissions on · 1 shell`) and lists each running\nbackground subagent under it (`◯ general-purpose <task> 14s`); Codex prints\n`1 background terminal running · /ps to view` above its prompt\n(`detectAgentBackgroundWork()` in `agentScreenSignature.ts`). While one shows,\na READY does not raise the missing report. Claude takes a new turn when the\nwork finishes, and that turn's READY decides. Codex doesn't, so Pane looks at\nthe screen again every 10 seconds while the panel stays ready, and raises\nonce nothing runs. An exit raises at once.\n\nLike\n`agent.report`, the kind reaches only watchers that list it in `--kinds` (a\nSession scope alone does not deliver it), and it skips the `--min-interval`\nbatch. The tracker is `main/src/services/expectedReports.ts`.\n\n### Autopilot's kinds\n\nAutopilot (experimental) waits with `runpane watch --as autopilot --kinds\nitem.created,item.answered,session.created,session.archived,orchestrator.turn_ended\n--until-event --json`. These kinds reach only watchers that list them in\n`--kinds` (a Session scope alone does not deliver them), so orchestrators'\nwatches never see them. `item.created` and `item.answered` (ITEM / ANSWERED)\nmark an approval or question starting or stopping waiting on the person; the\nentry carries `itemId` and the title in `reason`, after why it's news: \"No\nanswer (the asker stopped waiting): \" when its asker left, its receipt when it\nclosed (\"Closed by Autopilot: <why>: \", \"Closed: Session archived: \"), or\n\"Reopened by you, after …: \" when the person brought it back. Its `paneId` is the\nasking Pane. `session.created` and `session.archived` (SESSION NEW / SESSION\nARCHIVED) carry the Session and its own workspace Pane as `paneId`.\n`orchestrator.turn_ended` (TURN ENDED) marks a Session orchestrator going from\nworking to idle, chat tabs included. They come from\n`main/src/services/autopilot/autopilotEvents.ts`.\n\nEvery Session's fixed capability text has one rule for Autopilot: a message\nthat starts with `[From the person, via Autopilot]` carries the person's own\nquestion or instruction (a `/wrap-up` request included), and is never an\nanswer to an approval or a worker's question. A message that starts with\n`[From Autopilot]` is Autopilot's own; the orchestrator replies to whoever\nasked (\"To Autopilot:\"), and anything the person must decide still goes to\nthem as an approval. See [AUTOPILOT.md](AUTOPILOT.md).\n\n### Questions on screen\n\nPane's status detection (`main/src/services/agentStatus/manifests.ts`)\nclassifies a panel as blocked when its screen shows a live prompt waiting on\ninput: Claude's AskUserQuestion picker, permission prompts, folder trust, the\n\"Allow external CLAUDE.md file imports?\" dialog, and Codex's folder-trust,\nsign-in, approval and \"Update available\" screens. The journal records\n`agent.blocked` only once a panel has stayed blocked for 2 seconds\n(`BLOCKED_DEBOUNCE_MS` in `workspaceJournal.ts`), so a prompt-like line that\nflashes past in normal output never becomes BLOCKED. The entry carries\n`screenLines`: up to 20 non-empty lines of the screen region the prompt was\nmatched in. The agent does not need to report anything for this.\n\n### Session inbox\n\nPane keeps, per Session, what its orchestrator has not acknowledged:\nreports (`agent.report`), missing reports (`agent.report.missing`), and\nquestions on screen (`agent.blocked`, with `screenLines`). It is fed from the\njournal for every Pane associated with the Session (`main/src/services/sessionInbox.ts`)\nand saved with a journal epoch and replay watermark in the `approvals` table of\n`sessions.db`, one row per item; a blocked report shares its row with the\nquestion's card. A one-time import moved older `session-inbox.json` files there:\nthe file is backed up first as `session-inbox.json.before-import`, the original\nis left in place, and a failed import changes nothing and retries on the next\nstart. Restart replays committed events after the watermark, with\nstable item IDs, including a report whose inbox write failed. Acknowledgements\nand the watermark are saved together; replay does not resurrect handled items.\nRecovery is bounded by the journal's retention. If entries expired before\nprojection, or the journal was replaced, Pane logs the history loss explicitly;\nalready projected items remain available. A newer report replaces the panel's\nolder report or missing report; a blocked item goes once its panel moves on\n(busy, ready, exited, or reported). Each Session keeps its newest 1000 items\n(`retention.sessionInbox` in `config.json`).\n\n```text\nrunpane inbox --session <id|name> [--json] # defaults to $PANE_ORCHESTRATION_SESSION_ID\nrunpane inbox ack <item-id>... [--decision <D-n>] [--session <id|name>]\nrunpane inbox ack --all --session <id|name>\n```\n\n`runpane inbox` also lists `answers`: what the Session's workers were told, kept\n7 days. Human output prints each one with no decision as needing a D-n, and\n`runpane inbox ack <item> --decision <D-n>` records it, even on an item already\ncleared.\n\nAn orchestrator runs `runpane inbox` when it starts or resumes, to catch what\nfinished while it was down, its workers' unrecorded answers included. Pane never adds the inbox to the orchestrator's\nturns: worker output reaches it only as the result of a tool call it made.\n\n### What waits on the person: Approvals\n\nWhile Approvals is on (Settings → Approvals, saved as `notify.enabled`, on by\ndefault), a Session has one voice to the person: its orchestrator.\n\n- **Workers don't call `notify`.** Approvals come from the orchestrator, not\n from the agents in the Session's Panes. A worker in a Session's Pane gets\n `PANE_SESSION_DIR` and no `PANE_ORCHESTRATION_SESSION_ID`; Pane's\n instructions (the user-level Notify block and the `pane` home skill) tell\n such a worker to report blocked with\n `runpane report --state blocked --question \"<question>\"` instead. A\n worker's `notify` call isn't shown to the person; it returns `unavailable`\n with a `next` that says to report blocked.\n- **A worker's question is a card at once.** Its blocked report shows in\n Approvals straight away. From a JSON status file or a bare `needs_you`\n block, the card takes its question and `why` as\n context, its question's `options` as answer buttons (a `(recommended)`\n suffix marks the recommended one; several questions get an answer box), and\n its `files` as links (past six, the card names the rest). When the journal\n cut the summary short, Pane reads the first 256 KB of the status file itself\n (a regular file holding JSON), so a long `needs_you` keeps its buttons and\n links; a `needs_you` past 256 KB gets none, and `runpane report` warns the\n worker. A worker on another machine keeps the 2,000 characters the journal\n sent, since its path names a file over there. Other JSON shows one line (`summary`, `step` or\n `title`) or none, never the raw text; the file itself opens as the worker's\n status link. It rings once the orchestrator\n relays it or after 10 minutes, so the orchestrator first settles what the plan\n already answers (D-79). The answer goes straight to the asking tab, whether or\n not the orchestrator is running: `answer: Q-n → <answer> (by you)`, once its\n agent is at its prompt ([docs/PANE_NOTIFY.md](PANE_NOTIFY.md) has the rule).\n An answer Pane can't type shows in `runpane inbox` as `undelivered`; the\n orchestrator passes it on unless its tab closed. A relayed question stays\n open after its worker's tab closes, since its orchestrator can still read a\n reply to it (the reply goes to the orchestrator). The tab can\n also receive `closed: Q-n (by you)` and `correction: Q-n → <answer> (by you)`;\n workers and orchestrators treat those as the person's word.\n- **Typed replies.** Anything the person types on an approval arrives as\n `reply: Q-n → \"<their words>\" (picked: <picks>) (by you)` (or as the open\n call's `{reply, picks?, id, replyId, next}` result, whose `replyId` the\n reader passes to `--took` and `--update`). A worker's question's reply goes\n to the worker's tab; when the worker can't read it, to the orchestrator that\n relayed it; else to Autopilot. The reader decides whether it answers or asks:\n `runpane notify --took <id|Q-n> answer`, or `--took <id|Q-n> question`, then\n `runpane notify --update <id|Q-n> --asked \"<their question>\" --what-changed\n \"<one line per change>\"` with any changed fields. That saves a new version of\n the same approval (\"Updated · ready again\", at most 10 kept) and waits for the\n answer; nobody posts a second approval for it. `correction: Q-n → that was a\n question: \"…\"` and `correction: Q-n → that was your answer: \"…\"` are the\n person's fix of how it was taken. A worker may run `--took` and `--update`:\n they aren't new asks. [docs/PANE_NOTIFY.md](PANE_NOTIFY.md#replies-and-new-versions)\n has the lines, the reader order and what the approval shows.\n- **Orchestrator mode.** The generated orchestrator skill, the Session's\n `AGENTS.md` and the orchestrator guide\n (`paneChatBundle/skills/pane-orchestration/SKILL.md`, \"What waits on the\n person\") tell the orchestrator that only it asks the person; to keep a\n running list and keep the work moving; when the person asks about one\n thing while other work is open, to remind them and offer the next step; at\n the end of a turn, to have an approval waiting or be done. All three carry\n Pane's approvals text, \"Asking the person in Pane\"\n (`main/src/services/approvalsRules.ts`, also in the `pane` home skill): which\n card to use, what a card holds and how to read a reply\n ([PANE_NOTIFY.md](PANE_NOTIFY.md#what-an-agent-can-send)). These are\n instructions; Pane doesn't check turns, only cards.\n- **The orchestrator relays and posts.** The same three carry the posting rule: keep every item that waits on the person (a\n worker's needs_you or blocked question, a plan or design approval, a PR\n ready to merge, a next step only they can take) posted to Approvals exactly\n once, titled with its Q-n and with the worker's files and PR as `--links`.\n Post each one with `runpane notify ... --json` as a background command (in\n Claude Code, Bash with `run_in_background`), not the MCP `notify` tool,\n which returns `waiting` after a while, and never `AskUserQuestion`. A worker's question already has a card, so the orchestrator\n relays into it: `runpane notify --relays <item> ...`, with the id from `runpane\n inbox`, gives that card its choices, context and links and rings it, and the\n call waits on it as on any notify. The answer goes straight to the worker's\n tab, so the orchestrator doesn't forward it, except an answer `runpane inbox`\n lists as `undelivered` because Pane can't see what runs in the tab, which it\n passes on with `runpane panels submit` (one whose tab closed has no one left\n to tell). It\n records the decision with\n `runpane inbox ack <item> --decision <D-n>`, and the card reads \"Recorded as\n D-n\". The older way (post a second card, ack, forward the answer) keeps working\n for one release. The orchestrator stays free to talk about the item in its\n tab while the card waits. Stopping an item's background call drops its own\n stale item. On start, resume or wake it reconciles against the status files,\n its ledger and `runpane inbox`, and records any answer with no decision.\n Approvals survive a restart, and an asker that posts the same question again\n joins the waiting card. When `notify` returns `unavailable` because Approvals\n is off, it asks in its own tab as before.\n- **Filing.** Pane files each item under the Session its Pane belongs to, and\n marks items from the orchestrator's own tabs. Claude permission prompts and\n chat tab prompts still come straight from the asking tab and are filed under\n its Session.\n- **Closing with the Session.** Closing or archiving a Session closes the\n waiting items connected to it, workers' and orchestrators' alike, within 5 s\n (\"closed: Session closed\", \"closed: Session archived\"). A worker's newer report\n closes its older question (\"closed: the worker moved on\").\n\nSee [PANE_NOTIFY.md](PANE_NOTIFY.md) for the Approvals screen itself.\n\n## Skill contract\n\n`main/src/services/skillCacheManager.ts` installs the skills that ship in\n`main/src/services/paneChatBundle/` into\n`<PANE_DIR>/skills/pane-chat/skills/` and into the `.claude/skills/` and\n`.codex/skills/` folders of the data directory. It also generates the\n`pane-orchestrator` entry skill (plus a Cursor rule at\n`.cursor/rules/pane-orchestrator.mdc`), the runtime context, and the helper\nsubagents in `.claude/agents/` and `.codex/agents/`. A manifest\n(`skills/pane-chat/installed.json`) records what it installed and a hash of the\nbundle: startup skips the install when the hash is unchanged, and later installs\nreplace only the recorded entries. The bundled `wrap-up` skill is also copied\ninto each Session folder when it is prepared (see\n[Keeping a Session tidy](#keeping-a-session-tidy)).\n\nTo change Pane Chat behavior, edit the bundle or `buildPaneOrchestratorSkill()`\nin `skillCacheManager.ts`, then run `paneChatBundle.test.ts`.\n\nBundled workflow skills are available to Sessions and can be selected according\nto the user's task. The installed manifest lets Pane refresh its own skill files\nwithout replacing unrelated user skills.\n\n`shared/types/sessionProfile.ts` defines the generic default profile and shared\ncapability context. Generated guides and agent instruction files use this\ncontract. The legacy shared Cursor rule is not always applied; Session-specific\ninstructions belong to the Session's working directory. User-selected profiles\nand workflows determine behavior after the user supplies a task.\n\n## Terminal and Files\n\nEach Session has a collapsible **Terminal** dock and a **Files** button beside\nits agent tabs. The shell and file browser use the Session's workspace folder.\nSelecting a file opens an editor tab alongside the agent conversation. Panels\nare saved with the Session and reused when you reopen the tools; switching\nSessions keeps their shells and files separate.\n\nEvery Pane has the same dock: its first plain shell, titled **Terminal**, where\nthe setup progress notices appear. It is not a tool or agent tab. `runpane panels\nlist` marks it `dock: true`, and `runpane panes list` reports a Pane `running`\nonly while one of its tool or agent terminals is live, not for the dock alone.\n\n## Plans, pages, and split view\n\nAgents show pages and files with `runpane panels open --file <path>` or\n`--url <url>`. Files open in an editor tab with read-only previews for supported\nformats; HTML opens as editable source. Use `--url` with an HTTP, HTTPS or file\nURL for a live browser tab. By default the tab opens in split view:\nthe first one splits the stage to the right of the conversation, and later ones\njoin that side group as tabs. A page opened while you are looking at another\nSession or Pane is in that side group when you come back, without taking focus\nfrom the tab you left showing; tabs you have already arranged stay where you put\nthem.\n`--tab` opens it as a plain tab instead. Reopening the same file or URL reuses\nand reloads its tab; without `--tab`, a reopened tab that sits in the\nconversation's group moves to the side group. This works the same in Sessions\nand in worktree Panes.\n\nGenerated Session instructions ask the orchestrator to write plans, reports, and\nother documents as self-contained HTML files in its Session folder and link them\nfrom one status document. It opens one with `--url` (rendered) or `--file`\n(source) only when the person needs to look at it now; see\n[Keeping a Session tidy](#keeping-a-session-tidy).\nOpening a Session never submits a prompt or starts work just to write\na document.\n\nWhile the stage is split, each group has its own tab strip, including the agent\ntab in its group. For a single Session, the strips align directly below the\nwindow title bar. Closing the last tab in the side group returns to a single\ngroup. Layouts are saved with the Session.\n\nDrag any tab to rearrange the stage, as in a project Pane: drop it in the\nmiddle of a group to join that group, against an edge (the outer quarter) to\nsplit beside it, or between tabs on a strip to place it there. Dragging the\nlast tab out of a group closes that group. In tiled Sessions a tab moves only\nwithin its own Session.\n\n## Tiling Sessions side by side\n\n![Two Sessions tiled side by side, both streaming](screenshots/session-tiling.png)\n\nSessions tile with the same gesture as tabs, one level up. Drag a Session from\nits sidebar row — or by its title row once tiled — onto another Session and drop\nit against an edge to put the two beside each other; drop it in the middle to\nshow it in that slot instead. Edge bands are the outer quarter of the target,\nas they are for tabs, and the layout nests as deeply as you take it: a row of\nSessions with one of them split into a column is an ordinary shape, not a\nspecial case.\n\nBoth halves stay fully live. A tile that is not focused keeps its agent running\nand its output streaming; nothing is throttled or suspended, so a Session you\nare watching out of the corner of your eye is the same Session you were just\ntyping in. Each tile keeps its own tab splits, its own Terminal dock, its own\nFiles and Changes sidebar, and its own navigation.\n\nThe focused tile's Session is the selected one: its title row carries the focus\nring, and clicking a Session in the sidebar focuses its tile when it already has\none, or shows it in the focused tile when it does not. With one tile that is\nexactly the old behaviour — switching Sessions replaces the view.\n\nThe `X` on a tile's title row stops tiling that Session; the Session itself,\nits conversation and its panels are untouched, and the layout collapses back\naround the space. The last tile has no close button, since a window with no\nSession in it has nothing to show. Search carries the same commands\nfor the keyboard: focus the Session left, right, above or below, and stop tiling\nthe focused one.\n\nA layout belongs to the host it was built on, like the remembered location it\nsits beside: Session ids only mean anything on their own host, so switching\nhosts loads that host's layout and every tile is revalidated against the\nSessions that still exist there. Archiving or deleting a tiled Session retires\nits tile and collapses the split.\n\n## Reaching Pane and delegating work\n\nThe generated Session instructions tell the orchestrator how to reach\n`runpane` (PATH, then `$PANE_RUNPANE_BIN`, then the runtime context) and forbid\nsubstituting plain git worktrees or built-in subagents for delegated work; if\n`runpane` is unreachable the agent stops and reports it. Worktrees the\norchestrator creates or adopts with `runpane panes create` or `panes adopt`\nbecome the Session's children in the same call.\n\nEarlier development builds had an experimental progress view that rendered\n`progress.html` in a fixed side panel. It never shipped; Pane deletes its old\n`.pane-progress.json` switch and leaves any HTML files in place.\n\nNew worktrees launched from a Session default to unpinned. First association also\nclears a worktree's previous pin, including an explicit `--pinned` creation pin,\nso it appears as a Session child. Use `panes pin` manually afterward; repeated association does not undo that choice. Independent\nworktree defaults and existing historical pins are unchanged.\n\n### Generated instructions and Git\n\nSession instructions and documents live under `<PANE_DIR>/sessions/<id>/`,\noutside the project. While the Session agent shows its folder-trust prompt, a\nbanner across the top of the chat says the folder is Pane's own, holding the\nSession's notes and no project code. Session terminals and chats set `GIT_CEILING_DIRECTORIES` to\n`<PANE_DIR>/sessions`, so git run in a Session folder never picks up a repository\nabove it, such as a home directory tracked as a dotfiles repo. Do not configure\nPANE_DIR inside a project repository.\n\n### Move an existing chat to a Session\n\nRight-click a worktree and choose **Move chat to Session…**, then choose the chat\nif it has multiple agent tabs. You can also use **Move chat to Session** in the top\nbar of a selected Claude or Codex chat. Then enter a unique Session name, and choose **Move chat**. The agent must be idle\nand have a saved conversation ID. Pane stops the old terminal before transferring\nthe existing panel and resumes the same conversation from a private Session\nfolder. No initial prompt is submitted. The original worktree becomes a child;\nits branch, files, and uncommitted changes remain in place. Other tabs stay there.\n\nCursor and custom launch wrappers are not yet supported for promotion. Missing\nhistory, conflicting ownership, and active work are rejected before transfer.\nA durable Session record allows reopening to complete an interrupted transfer\nwithout copying the conversation. Terminal, Files, and split view\ncapabilities are the same as for a newly created Session.\n\nPromotion defaults to the worktree's current name.\n"},{"path":"docs/SETUP_EXPORT_IMPORT.md","title":"Export and import your Pane setup","text":"# Export and import your Pane setup\n\n**Settings › Import & Export**, after Privacy in the Settings sidebar, saves\nyour Pane setup to a file and loads it on another computer.\n\n## Export\n\nThe page lists nine sections, each with what it would save. Click a row to\nleave that section out, then click **Export…** and pick where to save\n`pane-setup-YYYY-MM-DD.json`. When it is saved, **Show in Finder** (**Show in\nfolder** on Windows and Linux) opens its folder.\n\n| Section | What it saves |\n| --- | --- |\n| Agent presets | Pane Chat agent, agent interface, the default Session command, resume, profile and pin, permission mode and model |\n| Custom commands | Every custom command: name, command and resume templates |\n| Run scripts | Each saved repository's Build Script, Run Commands and Archive Script, keyed by its `origin` remote |\n| Skills & MCP | Whether Pane's skill is installed and its MCP server registered, and the MCP toolsets |\n| Terminal shortcuts | Every terminal shortcut |\n| Custom links | Every custom link: label, pattern, URL template and on/off state |\n| Worktree file sync | Every file sync entry with a relative path |\n| Appearance | Appearance mode, themes, high contrast, UI scale, terminal font and size |\n| Preferences | The current value of each behavior toggle from General, Terminal, Notifications, Shortcuts, Worktrees & Git and Advanced, the keys you changed in Keyboard Shortcuts (importing them replaces your changed keys), new-Pane defaults (without the base branch), and the sidebar and `@terminal` choices |\n\n### What is never in the file\n\nThe file is built from a list of named settings, so anything not listed above\nis never written. That includes every API key and token Pane stores (Anthropic,\nOpenAI, fal, OpenRouter, Deepgram, APNs), shared credentials, Remote Pane and\nWorkspaces settings, analytics settings and identity, leaderboard, the Claude\nexecutable path, extra PATH entries, the preferred shell, start on login,\nPublish Pane instructions to AGENTS.md, developer and verbose modes, the\nDefault Open IDE Command, and each repository's path, worktree folder,\nOpen IDE Command and Project System Prompt. Notes, Loops and Sessions are not\npart of the setup.\n\nFree text can still hold a secret someone typed into it. As a second check,\nPane leaves out any command, resume template, script, Session profile or\nshortcut text or custom link URL template that looks like it holds one:\n\n- a key assignment such as `API_TOKEN=abc` or `password: x` (a variable\n reference such as `API_TOKEN=$API_TOKEN` is kept);\n- a flag with a value such as `--password x` or `--token=x` (`--token-file ./x`\n is kept);\n- an `Authorization` or `Cookie` header;\n- credentials in a URL (`postgres://user:pass@host`) or a secret in its query;\n- a well-known key prefix (`sk-`, `ghp_`, `github_pat_`, `xox`, `AKIA`).\n\nThe smallest unit is left out: one command, one shortcut, one custom link, one script of one\nrepository, or one setting. The card names each one and counts it on its row.\nThis check is best effort, so read the file before you share it.\n\nYour home folder is written as `~` in commands and scripts, so\n`/Users/ana/bin/serve` is saved as `~/bin/serve`.\n\n## Import\n\nClick **Import…** and choose a setup file. Nothing changes yet: the card shows\nwhat importing would change on this computer, section by section. Expand a row\nto see each item it adds or replaces, with the exact text of every command,\nresume template and script, each shortcut's key and on/off state, and, for a\nreplacement, what it was. A section with no changes is dimmed\nand can't be selected. Uncheck any section you don't want, then click\n**Import N sections**.\n\nImport adds and replaces. It never deletes:\n\n| Kind | Rule |\n| --- | --- |\n| Single settings | The file's value replaces this computer's when they differ |\n| Custom commands | Matched by name. A new name is added; the same name with a different command replaces it; commands only on this computer stay |\n| Terminal shortcuts | Matched by id, same rules. A shortcut whose key another shortcut here already uses comes in turned off, marked \"key in use\" |\n| Custom links | Matched by id, same rules. A link whose pattern or URL template has a problem still comes in, and the Links page shows the problem |\n| Worktree file sync | Matched by path, same rules |\n| Run scripts | See below |\n\nBecause nothing is deleted, a default shortcut or file sync entry you removed\non the first computer stays on the second one. Remove it there by hand.\n\nA leading `~/` or `~\\` in a command or script becomes this computer's home\nfolder, and the preview shows the result. Scripts are not translated between\noperating systems: when the file was written on another OS, the Run scripts row\nsays so (\"written on macOS\").\n\nImporting Skills & MCP does what the toggles in **AI & Agents** do: turning MCP\non registers Pane's server in your Claude Code, Codex and Cursor configs, and\nturning the skill on installs it in your home skill folders.\n\n### Run scripts\n\nEach repository in the file applies to every saved repository here whose\n`origin` remote has the same host and full repository path, whether it is\ncloned over SSH or HTTPS. `github.com/acme/web` does not match\n`gitlab.com/acme/web`, and `gitlab.com/team-a/tools/web` does not match\n`gitlab.com/team-b/tools/web`.\nA repository exported without a remote matches by name, and only when exactly\none repository here has that name.\n\n- Only scripts in the file are written; an empty script never clears yours.\n- A script the repository's own `pane.json` (or another\n [config file](CONFIG_FILES.md)) provides is skipped, so the team's file keeps\n working.\n- A repository that isn't saved in Pane on this computer is skipped and named.\n Import never creates repositories or clones them.\n\nBuild and archive scripts run on their own when a worktree is created or\narchived, which is why the preview shows their full text.\n\n### When a file is refused\n\nPane refuses a file that isn't JSON, isn't a Pane setup file, was written by a\nnewer Pane, is larger than 1 MB, or has a section in the wrong shape. The card\nsays why, that nothing changed, and what to do next. Sections and settings Pane\ndoesn't know are ignored, including any of the never-saved settings above added\nby hand.\n\nIf one step of an import fails, the sections before it stay imported and the\nrest are not. Importing the same file again is safe: anything already imported\nshows as no change.\n\n## Remote hosts\n\nWhile the window is connected to another computer through Remote Pane, the\ncard is disabled. Choose this computer in the sidebar's machine menu to\nexport or import this computer's setup.\n\n## For teams\n\nRun scripts a whole team should share belong in a committed\n[`pane.json`](CONFIG_FILES.md), which every clone picks up. A setup file is for\nmoving one person's setup.\n\n## File format\n\n```json\n{\n \"kind\": \"pane-setup\",\n \"version\": 1,\n \"exportedAt\": \"2026-10-26T22:40:00.000Z\",\n \"appVersion\": \"2.4.202\",\n \"platform\": \"darwin\",\n \"sections\": { \"agentPresets\": {}, \"customCommands\": [], \"runScripts\": [] }\n}\n```\n\n`sections` holds only the sections chosen on export. Inside each, fields keep\ntheir names from Pane's `config.json`; run scripts use `build_script`,\n`run_script` and `archive_script`, and Preferences also carries the\n`user_preferences` keys `auto_rename_sessions_to_pr`, `sidebar_pane_row_layout`,\n`sidebar_attention_inbox`, `at_terminal_paste_mode` and `at_terminal_line_count`.\nReaders ignore sections and keys they don't know, so a new section keeps\n`version: 1`; the version changes only for a breaking change. The code is in\n`main/src/services/setupTransfer.ts` and `shared/types/setupTransfer.ts`.\n"},{"path":"docs/SHARED_CREDENTIALS.md","title":"Shared integration keys","text":"# Shared integration keys\n\nSet an integration key once and every Pane host you use gets it. A key set on your Mac reaches your Windows PC, and a key you type in the iPhone app reaches every host the phone has saved.\n\n## Which keys\n\n| Key | Where you set it |\n| --- | --- |\n| Deepgram, fal, OpenRouter (voice dictation) | Settings → Integrations on a desktop, or the phone's voice setup |\n| APNs key for iPhone notifications | Settings → Integrations → iPhone notifications |\n| Anthropic, OpenAI | `anthropicApiKey`, `openaiApiKey` in the host's `config.json` |\n\nA key that exists only in a host's environment (for example `FAL_KEY` or the `PANE_APNS_*` variables) stays on that host and is never shared. On that host the environment value wins over a shared one. To get phone alerts from every computer, load the APNs key once in Settings → Integrations rather than only in one host's environment. The APNs endpoint follows the phone's build, not the key's environment ([Native mobile](NATIVE_MOBILE.md#push-delivery-operator-setup)).\n\n[Pane secrets](PANE_SECRETS.md) travel the same way, with the same rules, but their\nvalues stay in each host's keychain or secret file rather than `config.json`.\n\n## How keys travel\n\nHosts never contact each other on their own. A device that has more than one host saved, whether found over Tailscale, paired with a code, or paired by a [QR code or one-time link](QR_PAIRING.md), carries the keys between them:\n\n- **The iPhone app** syncs whenever it opens or returns to the foreground, after you save a key from the phone, and when a host reports that its settings changed. It relays the keys and keeps no copy.\n- **A desktop with another host saved** syncs when it starts, when a key changes on it, and when a saved host reports a change. Computers on your Tailscale login are saved the first time you switch to them, from the sidebar's machine menu or Settings › Remote Access › Computers. To link another computer, use Settings › Remote Access › Add a device › Computer. To pair with a code instead, create a connection code on the other host (Settings › Remote Access › Tailscale › Set Up Host) and paste it under Settings › Remote Access › Tailscale › Paste a connection code.\n\nSharing chains: if your Mac is paired with your Windows PC and the Windows PC with a Linux server, a key set on the Mac reaches the Linux server once both syncs have run.\n\nWhen two hosts disagree, the copy that was set most recently wins. Removing a key records when you removed it, so an older copy on another host does not bring it back. Settings → Integrations shows which host each key was set on and when.\n\nA host that is offline keeps its own copy and catches up on the next sync. Hosts running a Pane version from before key sharing are skipped.\n\n## The Approvals switch\n\nSettings → Approvals' on/off switch (`notify.enabled`) travels the same way, on the same syncs: read every reachable host, write the newest to those behind. A change here also tells hosts that saved this one, so they sync within seconds. It has its own commands (`notify:switch:get`, `notify:switch:apply`), only desktops carry it (not the iPhone app), and only on/off and Show cards on are shared: position, sound, shortcut and the rest stay on each machine.\n\nThe most recent change wins, by `notifyEnabledChangedAt` in `config.json`. A host applying another host's value keeps that host's time, so two hosts never trade values. A value with no time counts as time 0 and a missing value means on; at equal times off wins, so a machine turned off before sharing existed turns the others off when they first sync. A change made by hand in `config.json` while Pane runs counts as a change; one made while it's quit doesn't get a new time.\n\nHosts running a Pane version from before this are skipped without error; their keys still sync. The same people can reach it as the keys: the owner's login or a paired device.\n\nSettings → Approvals' Show cards on (`notify.cardsOn`: the picked machine's install id and name, or null for whichever computer is in use) rides the same commands with its own time, `notifyCardsOnChangedAt`. Each part merges on its own time, so changing one never overwrites the other; at equal times \"whichever computer is in use\" wins. A host from before Show cards on still syncs on/off: its answers carry no Show cards on, which never clears a pick, and it isn't written for Show cards on alone.\n\n## Who can read the keys\n\nOnly your own devices. Over Tailscale, a host answers a request for its keys only from its owner's Tailscale login, even when its workspace lets other people on the tailnet in, so a teammate's computer neither receives nor replaces your keys. With a connection code, the caller must present a valid pairing token, and the host refuses the request when it does not require pairing. Either device can already open terminals on that host, so sharing keys with it exposes nothing new.\n\nKeys are never written to logs or events. They are stored in each host's `config.json` in the Pane data directory, as before.\n\n## Stop sharing\n\nRemove the host from the device, or unpair it. On a host, revoke it under Settings › Remote Access › Tailscale › Set Up Host (the Set Up This Machine page) › Host status. On a desktop, expand the computer's row in Settings › Remote Access › Computers and choose Unlink from all your computers, or Forget. On the phone, remove the host. The keys already copied to each host stay there until you remove them, and removing a key on one host removes it from the others on the next sync.\n"},{"path":"docs/SSH_HOSTS.md","title":"SSH hosts","text":"# SSH hosts\n\nPane lists the hosts in your SSH config under **SSH hosts** in the sidebar. Click one and Pane opens a terminal tab that runs `ssh <host>` with your own `ssh`, keys and `ssh-agent`. You need no project, and no coding agent starts.\n\n## Add a host\n\nAny `Host` entry in your SSH config shows up:\n\n```\nHost mini\n HostName 192.168.1.20\n User me\n IdentityFile ~/.ssh/id_ed25519\n```\n\n## Open a host\n\nSSH tabs open in the **SSH view**, which takes the place of the main area, like Pane Chat.\n\n- **Click a host** to show its tab. If the host has no tab yet, Pane opens one.\n- **Right-click a host**, or hover it and click **+**, to open another tab on it.\n- A dot beside a host means it has an open tab.\n- With the sidebar collapsed to icons, the **SSH hosts** icon opens the SSH view. With no tab open, the view lists your hosts.\n\nEach tab is an ordinary Pane terminal. Pane starts its default shell (**Settings → Terminal → Default shell**) in your home folder and types `ssh <host>` into it. Password, passphrase and host-key prompts appear in the tab as they would in any terminal. When the connection ends or fails, you are back at a local prompt. After Pane restarts, your SSH tabs return in the SSH view, and each one runs `ssh <host>` again the first time you open it.\n\n## Which file Pane reads\n\n| System | File |\n| --- | --- |\n| macOS, Linux | `~/.ssh/config` |\n| Windows | `C:\\Users\\<you>\\.ssh\\config` |\n\nPane also reads the files that config pulls in with `Include`, the way `ssh` does: globs such as `Include conf.d/*` expand in sorted order, relative paths start from your `.ssh` folder, and `~` means your home folder. An `Include` counts only when it applies to every host: before the first `Host` or `Match` line, or under `Host *`. An `Include` inside a narrower `Host` or `Match` block applies only to that block's hosts, so `ssh` would not use its entries for a plain `ssh <host>`, and Pane does not list them. If a host from an included file is missing, move its `Include` line to the top of the config. Pane takes the home folder from your user account, as `ssh` does: on macOS and Linux changing `$HOME` does not move it, and on Windows it is the profile folder Windows records for your account.\n\nPane reads the files again on start, when its window comes back into focus, and when you expand the section. After editing the config in another app, switch back to Pane to see the change. After editing it in a Pane terminal, collapse and expand **SSH hosts**. A host you delete from the config stays in the list while it has an open tab, so you can return to that tab; it disappears once you close its tabs.\n\nPane opens only the config and its included files. It never opens, copies or uploads your keys; `ssh` reads them.\n\n## Which hosts appear\n\nEvery name on a `Host` line appears, in file order, so `Host web db` lists both `web` and `db`. Hosts from an included file appear where its `Include` line is. A repeated name appears once. Pane skips:\n\n- Patterns with `*`, `?` or `!`, such as `Host *` or `Host *.internal`.\n- Names that do not start with a letter, digit or `_`, or that contain characters other than letters, digits and `. _ @ : -`. Pane types the name into a shell, so it lists only names every shell passes to `ssh` unchanged; a leading `-` would be an `ssh` option and a leading `@` means something else in PowerShell.\n- Hosts that appear only in `Match` blocks, and the system-wide config (`/etc/ssh/ssh_config`, or `%ProgramData%\\ssh\\ssh_config` on Windows).\n\nIf a host is missing from the list, check it against these rules. A missing or unreadable config lists no hosts; an unreadable included file is skipped. With no hosts and no open SSH tabs, the section and its sidebar icon stay hidden.\n\n## Windows\n\nPane's default shell on Windows is Git Bash when it is installed, otherwise PowerShell or `cmd`. Each shell runs the first `ssh` on its PATH: usually Git's `ssh` in Git Bash, and Windows' OpenSSH client in PowerShell and `cmd` (an optional Windows feature that recent versions install by default). Both read `C:\\Users\\<you>\\.ssh\\config`.\n\nWindows' OpenSSH client refuses a private key that other accounts can read. Make the key readable only by you, replacing `id_ed25519` with your key file:\n\n```powershell\nicacls $env:USERPROFILE\\.ssh\\id_ed25519 /inheritance:r /grant:r \"$($env:USERNAME):R\"\n```\n\n## Remote Pane\n\nWhen this window controls Pane on another machine through [Remote Pane](SELF_HOSTED_REMOTE_DAEMON.md), the list shows the hosts in that machine's SSH config, and `ssh` runs there with that machine's keys and network.\n\nIf a host runs Pane itself, connect to it with Remote Pane. That gives you its projects, files, dev servers at `localhost` and running agents.\n\nThe phone app shows no SSH host list.\n"},{"path":"docs/STATE_MANAGEMENT.md","title":"State Management Guidelines","text":"# State Management Guidelines\n\n⚠️ **IMPORTANT**: Pane follows a targeted update pattern for state management to minimize unnecessary re-renders and network requests.\n\n## Overview\n\nPane uses a combination of Zustand stores, IPC events, and targeted updates to manage application state efficiently. The application prioritizes specific, targeted updates over global refreshes to improve performance and user experience.\n\nSession and project lists live in Zustand (`frontend/src/stores/sessionStore.ts` and related stores). Do not keep a parallel `projectsWithSessions` array in a tree component; `DraggableProjectTreeView` was removed.\n\n## Key Principles\n\n1. **Targeted Updates**: Always update only the specific data that changed\n2. **Event-Driven Updates**: Use IPC events to communicate changes between processes\n3. **Avoid Global Refreshes**: Never reload entire lists when only one item changes\n4. **Database as Source of Truth**: Frontend state should reflect backend state, not override it\n\n## State Update Patterns\n\n### Session Updates\n\n```typescript\n// ❌ BAD: Global refresh\nconst handleSessionCreated = () => {\n void loadSessions(); // Reloads everything\n};\n\n// ✅ GOOD: Targeted store update\nconst handleSessionCreated = (newSession: Session) => {\n useSessionStore.getState().addSession(newSession);\n};\n```\n\nIPC handlers in `useIPCEvents` already call `addSession` / `updateSession` / `deleteSession` on the store. Subscribe with selectors (`useSessionStore(s => s.sessions)`) instead of copying the list into local React state.\n\n### Project Updates\n\n```typescript\n// ❌ BAD: Reload all projects\nconst handleProjectDeleted = () => {\n fetchProjects(); // Network request for all projects\n};\n\n// ✅ GOOD: Remove from local state\nconst handleProjectDeleted = () => {\n setProjects(prev => prev.filter(p => p.id !== deletedId));\n};\n```\n\n## IPC Event Handling\n\nThe application uses IPC events to synchronize state between the main process and renderer:\n\n### Session Events\n\n- `session:created` - Add new session to appropriate project\n- `session:updated` - Update specific session properties\n- `session:deleted` - Remove session from project list\n\n### Project Events\n\n- `project:updated` - Update specific project properties\n\n## When Global Refreshes Are Acceptable\n\n- **Initial Load**: When component mounts for the first time\n- **User-Triggered Refresh**: When user explicitly requests a refresh\n- **Error Recovery**: After connection loss or critical errors\n- **Complex State Changes**: When multiple interdependent items change\n\n## Implementation Examples\n\n### ProjectSessionList.tsx\n\n- Reads sessions from Zustand `sessionStore`\n- IPC events patch the store; the tree re-renders from selectors\n- Avoids a local `projectsWithSessions` array that new-references on every status tick\n\n## Best Practices\n\n1. **Use Store Actions**: Call `useSessionStore.getState().addSession(...)` (or the matching action) from IPC handlers so every subscriber sees one update\n2. **Merge Updates**: When updating objects, spread existing properties to preserve data\n3. **Handle Edge Cases**: Always check if the item exists before updating\n4. **Log State Changes**: Add console logs for debugging state updates in development\n5. **Validate IPC Data**: Ensure IPC events contain expected data structure\n"},{"path":"docs/TERMINAL_FILE_LINKS.md","title":"Terminal file links","text":"# Terminal file links\n\nCtrl-click a detected file path (Cmd-click on macOS) to open its actions. Files\ninside the pane's worktree can open in an editor tab. Paths outside the worktree\nare labelled as such and cannot open in the worktree editor; local sessions can\nstill reveal them in the system file manager.\n\n`resolveTerminalPath` is shared by detected links and selected-text actions. It\nkeeps the absolute path for tooltips and native file-manager actions separate\nfrom the relative path required by `file:exists` and `openFileInEditor`. It\nnormalizes `.` and `..` segments and converts Linux paths to the worktree's WSL\nUNC namespace when appropriate.\n\n`terminal:getPathContext` gets the worktree and home directory from the session's\ndaemon host. WSL sessions read `HOME` asynchronously inside their distribution.\n`~/` is never inferred from the worktree. If home cannot be resolved, home-relative\nactions stay disabled. Remote sessions continue to disable native file-manager\nactions.\n\nThe xterm link-provider line number is one-based; the terminal buffer's\n`getLine` index is zero-based.\n\n## Custom links\n\nSettings › Links turns text matching your own regular expressions into links,\nsuch as issue keys opening your tracker. Each entry has a pattern and a URL\ntemplate that must start with `http://` or `https://`; `$0` inserts the whole\nmatch and `$1` to `$9` insert capture groups, URL-encoded. Cmd-click (Ctrl-click\non Windows and Linux) opens the link. File, URL and git links keep working\nalongside. Entries travel with Settings › Import & Export.\n\nPatterns run in a web worker (`frontend/src/utils/customLinkMatcher.ts`), one\nterminal row at a time with trailing padding trimmed. A row that takes longer\nthan `CUSTOM_LINK_MATCH_TIMEOUT_MS` stops the worker and gets no custom links,\nso a pattern that backtracks badly can't freeze the window.\n"},{"path":"docs/TIMESTAMP_HANDLING.md","title":"Timestamp Handling Guidelines","text":"# Timestamp Handling Guidelines\n\n⚠️ **IMPORTANT**: Proper timestamp handling is critical for the application to function correctly, especially for prompt duration calculations.\n\n## Overview\n\nPane uses timestamps throughout the application for tracking session activity, prompt execution times, and displaying time-based information. Due to the mix of SQLite database storage and JavaScript Date objects, special care must be taken to ensure timezone consistency.\n\n## Key Principles\n\n1. **Database Storage**: All timestamps are stored in UTC using SQLite's `CURRENT_TIMESTAMP` or `datetime()` functions\n2. **Frontend Display**: Timestamps are parsed as UTC and converted to local time only for display\n3. **Consistency**: Always use the timestamp utility functions instead of manual date parsing\n4. **Validation**: Always validate timestamps before using them in calculations\n\n## Timestamp Formats\n\n- **SQLite DATETIME**: `YYYY-MM-DD HH:MM:SS` (stored in UTC without timezone indicator)\n- **ISO 8601**: `YYYY-MM-DDTHH:MM:SS.sssZ` (with explicit UTC timezone)\n- **JavaScript Date**: Local timezone by default (be careful!)\n\n## Utility Functions\n\nPane provides timestamp utilities in both frontend and backend:\n\n### Backend (`main/src/utils/timestampUtils.ts`)\n\n```typescript\nimport { formatForDatabase, formatForDisplay, getTimeDifference, formatDuration, isValidTimestamp } from '../utils/timestampUtils';\n\nconst timestamp = formatForDatabase(); // ISO 8601 string, UTC\nconst displayTime = formatForDisplay(timestamp); // local time for display\nconst durationMs = getTimeDifference(start, end); // end defaults to now\nconst formatted = formatDuration(durationMs); // \"2m 34s\"\n```\n\n### Frontend (`frontend/src/utils/timestampUtils.ts`)\n\n```typescript\nimport { formatDistanceToNow, isValidTimestamp } from '../utils/timestampUtils';\n\nconst ago = formatDistanceToNow(timestamp); // \"5 minutes ago\"\n```\n\nThe frontend helpers call `new Date()` on their input, so pass them ISO strings\nwith a `Z` (or `Date` objects), never raw SQLite `YYYY-MM-DD HH:MM:SS` values.\n\n## Database Operations\n\nWhen working with timestamps in SQLite:\n\n```sql\n-- Use datetime() for UTC timestamps\nINSERT INTO prompt_markers (timestamp) VALUES (datetime('now'));\n\n-- When selecting, append 'Z' for proper UTC parsing\nSELECT datetime(timestamp) || 'Z' as timestamp FROM prompt_markers;\n\n-- For completion timestamps with NULL handling\nSELECT\n CASE\n WHEN completion_timestamp IS NOT NULL\n THEN datetime(completion_timestamp) || 'Z'\n ELSE NULL\n END as completion_timestamp\nFROM prompt_markers;\n```\n\n## Common Patterns\n\n### Creating a new timestamp\n\n```typescript\n// Backend - for database storage\nconst timestamp = formatForDatabase();\n\n// Frontend - for immediate use\nconst now = new Date();\n```\n\n### Tracking prompt execution time\n\n```typescript\n// When prompt starts\ndb.addPromptMarker(sessionId, promptText, outputIndex);\n\n// When prompt completes\ndb.updatePromptMarkerCompletion(sessionId);\n```\n\n### Calculating duration\n\n```typescript\n// With completion timestamp\nif (prompt.completion_timestamp) {\n const duration = getTimeDifference(prompt.timestamp, prompt.completion_timestamp);\n return formatDuration(duration);\n}\n\n// For ongoing prompts\nconst duration = getTimeDifference(prompt.timestamp); // Uses current time as end\nreturn formatDuration(duration) + ' (ongoing)';\n```\n\n## Common Pitfalls to Avoid\n\n### 1. Never parse SQLite timestamps directly with `new Date()`\n\n```typescript\n// ❌ WRONG - treats UTC as local time\nconst date = new Date(\"2024-01-01 12:00:00\");\n\n// ✅ CORRECT - select it with `datetime(col) || 'Z'` in SQL, or mark it as UTC first\nconst date = new Date(\"2024-01-01 12:00:00\".replace(' ', 'T') + 'Z');\n```\n\n### 2. Always validate timestamps before calculations\n\n```typescript\nif (!isValidTimestamp(timestamp)) {\n return 'Unknown duration';\n}\n```\n\n### 3. Be careful with timezone conversions\n\n```typescript\n// Database stores UTC, display shows local\nconst dbTime = \"2024-01-01 12:00:00\"; // UTC\nconst parsed = new Date(dbTime.replace(' ', 'T') + 'Z'); // parsed as UTC\nconst display = formatForDisplay(parsed); // Converts to local for display\n```\n\n### 4. Handle negative durations gracefully\n\n```typescript\nconst duration = endTime - startTime;\nif (duration < 0) {\n console.warn('Negative duration detected');\n return 'Invalid duration';\n}\n```\n\n## Testing Timestamp Code\n\nWhen testing timestamp-related features:\n\n1. Test with different timezones (especially negative UTC offsets)\n2. Test with daylight saving time transitions\n3. Test with very old and future timestamps\n4. Test with invalid/malformed timestamps\n5. Verify duration calculations are always positive\n"},{"path":"docs/TOOL_PANEL_SYSTEM.md","title":"Tool Panel System Implementation Guidelines","text":"# Tool Panel System Implementation Guidelines\n\n⚠️ **IMPORTANT**: The tool panel system implements a flexible, extensible architecture for managing multiple tool instances per session.\n\n## Architecture Overview\n\nThe tool panel system consists of several key components:\n\n1. **Panel Manager** (`main/src/services/panelManager.ts`): Central coordinator for panel lifecycle management\n2. **Terminal Panel Manager** (`main/src/services/terminalPanelManager.ts`): Specialized handler for terminal panel processes\n3. **Panel Event Bus** (`main/src/services/panelEventBus.ts`): Event communication system between panels\n4. **Panel Store** (`frontend/src/stores/panelStore.ts`): Frontend state management with Zustand\n5. **Panel Components**: React components for rendering different panel types\n\n## Key Implementation Principles\n\n- Each feature has one Pane, and its reviews, audits, fixes and QA are tabs in it (`runpane doctor` has Pane's working rules). A Pane owns one worktree and branch; panels (tabs) share it. Agents add review, QA and fix agents for existing work as new panels with `runpane panels create --pane <id>`, never as new Panes. See [Sessions](SESSIONS.md#one-pane-per-feature).\n\n1. **Lazy Initialization**: Panels are created in the database immediately but background processes (like terminal PTY) only start when the panel is first viewed\n2. **State Persistence**: All panel state including terminal scrollback, working directories, and configurations persist across application restarts\n3. **Memory Efficiency**: Inactive panels suspend rendering but maintain background processes\n4. **Event-Driven Updates**: Uses IPC events to synchronize state between main and renderer processes\n5. **Extensible Design**: Architecture supports future panel types beyond terminals\n\n## Panel Lifecycle\n\n1. **Creation**: User clicks \"Add Tool\" → Panel entry created in database → Added to UI\n2. **First View**: User clicks panel tab → Background process initializes → XTerm.js mounts\n3. **Switching**: User switches panels → Previous panel unmounts XTerm → New panel mounts\n4. **Background Operation**: Processes continue running even when panel is not visible\n5. **Deletion**: Panel closed → Process terminated → Database entry removed → UI updated\n\n## Terminal Panel Specifics\n\n- Each terminal panel spawns an independent PTY process using node-pty\n- Terminal metadata (cwd, dimensions, agent session) persists in `tool_panels.state` as JSON, ceilinged at 256 KB per panel and merged key by key inside SQLite\n- Terminal bytes (scrollback, serialized snapshot, alternate-screen frame) persist in `panel_buffers`, capped at 4 MB per panel with the oldest scrollback trimmed first\n- XTerm.js instances mount/unmount based on panel visibility to save memory\n- Working directories are maintained independently per panel\n- Command history and environment variables can be preserved across restarts\n- Each shell gets `PANE_PANEL_KIND`, set when it starts so shell startup files can branch on it: `dock` (the first\n plain shell, pinned to the bottom terminal dock), `shell` (another plain shell tab), `agent` (an agent CLI such as\n Claude Code or Codex) or `command` (any other launch command)\n- Cmd-click on macOS or Ctrl-click on Windows/Linux opens `pane://open?pane=<pane-id>&panel=<panel-id>` links in terminal output inside Pane. The panel parameter is optional.\n\n## Database Schema\n\n- `tool_panels` table stores panel configuration and state\n- `sessions.active_panel_id` is the last-used tab per session: the one any client picked most recently. A client with no memory of a Pane opens it there, and `runpane panels list` reports it as active\n- Foreign key constraints ensure panels are cleaned up when sessions are deleted\n\n## Event System\n\n- A client's tab click (`panels:set-active`), `runpane panes focus` and opening a Session view update `active_panel_id` and move no other client. A host- or agent-initiated activation (`runpane panels open`, `panels create`/`panes create` with focus, Pane Chat, new-Pane setup, run scripts) sends `panel:activeChanged` (`PanelActivationRequest`), which only clients already showing that Pane follow\n- The remote web and mobile app remembers its own Pane, Session and tab per host in browser storage. Each desktop remembers its own split and tabs per Pane in its local `ui_state` (`paneLayout.<pane id>[@<host profile id>]`) and its own Session in navigation memory; it opens a Pane on `active_panel_id` and the stored `panel_layout` only when it has no memory of it. Tabs missing from its memory join the primary group, except agent-opened ones (`metadata.openPlacement: 'split'`), which go to the side group, inactive\n- Terminal panels emit `terminal:command_executed`, `terminal:exit`, and `files:changed` events\n- Event bus routes events to subscribed panels (planned for future panel types)\n- Events support future inter-panel communication (e.g., diff panels reacting to file changes)\n\n## Implemented Panel Types\n\nThe tool panel system supports 11 panel types (`ToolPanelType` in `shared/types/panels.ts`):\n\n1. **Terminal** (`terminal`): PTY shells, several per pane. Agent CLIs such as\n Claude Code, Codex and Cursor Agent run in terminal panels\n (`TerminalPanelState.agentType` records which one).\n **Chat** (`chat`): any agent whose config has a `chat` section, over ACP,\n with no terminal; its state is\n `ChatPanelState` (`shared/types/chatTab.ts`) and only the host's chat runtime\n writes it. See [CHAT_TABS.md](CHAT_TABS.md).\n2. **Diff** (`diff`): git diff viewer. Singleton, permanent, worktrees only.\n3. **Explorer** (`explorer`): file tree.\n4. **Editor** (`editor`): Monaco editor, one tab per open file.\n5. **Logs** (`logs`): script execution output. Singleton.\n6. **Dashboard** (`dashboard`): project overview. Singleton, permanent,\n projects only.\n7. **Setup Tasks** (`setup-tasks`): project setup checklist. Singleton,\n permanent, projects only.\n8. **Browser** (`browser`): embedded browser. Worktrees only.\n9. **Notes** (`notes`): the Pane's notes. Singleton. Experimental: hidden\n until Settings → Advanced → Notes is on.\n10. **Device** (`device`): an iOS simulator or Android emulator's live screen,\n opened by `device_open`, not the + menu. See [DEVICES.md](DEVICES.md).\n\n## Panel Capabilities\n\nEach panel type has specific capabilities defined in `PANEL_CAPABILITIES`:\n\n- **requiresProcess**: Whether panel needs background process (terminal, logs)\n- **singleton**: Only one instance per session (diff, logs, dashboard, setup-tasks)\n- **permanent**: Cannot be closed by user (diff, dashboard, setup-tasks)\n- **canAppearInProjects**: Available in project view (all except diff and browser)\n- **canAppearInWorktrees**: Available in worktree sessions (all except dashboard, setup-tasks)\n- **canEmit**: Events this panel can produce\n- **canConsume**: Events this panel listens to\n\nExample: Diff panels are singleton + permanent + worktree-only, consuming `files:changed` and `terminal:command_executed` events to auto-refresh.\n\n### Named custom launch profiles\n\nIn a worktree's **Add Tool (+)** menu, choose **Add custom command…** and enter\nan optional **Name** alongside the command. **Save & launch** saves the profile\nand opens a terminal tab with that name. Leaving the name blank uses the first\nthree words of the command. Saved profiles are shared through app configuration.\nUse the pencil beside a saved profile to rename it; the menu and future tabs use\nthe new name. Existing tabs keep their titles. Hover a profile to see its full\nname and command.\n\nResume commands retain the original shell quoting and environment assignments when removing a launch prompt. Custom Claude launchers may choose a separate configuration directory; Pane trusts their recorded conversation IDs instead of checking the app configuration for their transcripts.\n"},{"path":"docs/UPDATE_RECOVERY.md","title":"Update prerequisites, status and recovery","text":"# Update prerequisites, status and recovery\n\n`runpane update` defaults to the running Pane app and the CLI that received the\ncommand, on the machine where the command runs. A remote host selected in the UI\ndoes not change that target. Use `--pane-only` or `--cli-only` for one component.\nThe Update button in Settings uses the app's built-in updater instead, and does\nnot need the prerequisites below; see [Built-in updater](#built-in-updater). When a prerequisite is missing, `runpane update`\nhands off to that built-in updater: the running Pane downloads the latest release,\nquits and installs it, and the command prints `\"mode\": \"in-app\"`. The handoff\nskips the checkpoint, snapshot and panel restoration described here, and it\nleaves an npm or pip CLI as it was (`cliUpdated: false`). It returns `\"phase\": \"installing\"` once the\ninstall starts; with `--wait` it returns `\"phase\": \"complete\"` only after the relaunched Pane\nreports the new version, and fails with `ERR_UPDATE_IN_APP_TIMEOUT` after 10 minutes. Pinned versions,\n`--pane-path`, `--cli-only` and `--dry-run` still report the refusal.\nRun `runpane update --dry-run --json` first to see the executable, data directory,\nCLI owner and supervisor capability without starting an update.\nWhen Pane is not running on the machine, for example because a failed update\nleft it unable to start, `runpane update` installs the requested release\n(latest by default) instead, like `runpane install`. If even `runpane` fails, see\n[Bundled runpane](RUNPANE_BUNDLED_CLI.md#how-it-works) for its fallback to `node`.\n\n## Built-in updater\n\nPackaged Pane on Windows, Linux and signed macOS installs checks for a new\nrelease at launch and every 4 hours and downloads it in the background. When\nthe download finishes, a **Restart to update** button appears above the sidebar\nfooter (a blue refresh icon when the sidebar is collapsed). After 5 minutes with\nno agent working or waiting for you, no run script running and no worktree being\nremoved, a toast offers **Tonight**, **Later** or **Restart now**:\n\n- **Restart now** quits Pane the normal way, installs the update and relaunches.\n The next launch resumes every interrupted agent in every project on its saved\n conversation, reopens the Pane that was open and skips the Resume dialog. It\n relaunches each agent with its resume command and types nothing into it. A\n Pane whose agent cannot resume stays interrupted and the toast says so; the\n Resume dialog offers it when it belongs to the active project.\n- **Later** hides the toast for 4 hours. The sidebar button stays.\n- **Tonight** restarts between 2:00 and 5:00 local time, once nothing has run for\n an hour and the keyboard and mouse have been idle for 30 minutes. To cancel,\n click the sidebar button (now **Restarts tonight**), then **Don't restart\n tonight**.\n\nClicking the sidebar button while something runs says what is running and offers\n**Restart anyway**. A macOS install whose signature cannot be verified downloads\nnothing in the background; its button reads **Update available** and opens the\nSoftware Update dialog. Turning off **Settings → General → Check for updates\nautomatically** stops the checks and the downloads, hides the button and\ncancels Tonight.\n\nTo test locally, serve a newer build from a generic feed and start a dev build\nwith `TEST_UPDATES=true UPDATE_SERVER_URL=<feed url>`. The dev build downloads\nfrom that feed and **Restart now** relaunches in place instead of installing.\nThese test-only variables shorten the timers: `PANE_TEST_UPDATE_IDLE_SECONDS`,\n`PANE_TEST_UPDATE_TONIGHT_IDLE_SECONDS`,\n`PANE_TEST_UPDATE_TONIGHT_INPUT_IDLE_SECONDS` and\n`PANE_TEST_UPDATE_TONIGHT_HOURS` (for example `0-24`).\n\n## Prerequisites\n\nBoth the running app and the requested app release must support continuity\nprotocol 1. No existing 2.4.182 release has the required `continuity.json`\nmanifest. To bootstrap this feature, install a continuity-capable release with\nits normal installer before using this path; installing the CLI alone does not\nadd support to an older running app. A requested older target without that manifest is refused before shutdown.\n\nUse an account that owns the app and CLI directories, in an interactive login\nwith launchd (macOS), Task Scheduler (Windows), or user systemd (Linux). The app\nmust be a packaged macOS bundle, Windows installation, or owned Linux AppImage.\nSystem package installations on Linux require their package manager. App updates\nrequire platform signature verification on macOS and Windows. The official\nWindows 2.4.182 installer is unsigned and is refused by this verifier.\n\nInstall standalone patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) and make it available on PATH to the process\nstarting the update. The helper copies this runtime before shutdown; Electron\ninside the app being replaced is insufficient. npm must also be available when\nupdating a JavaScript CLI. The supported CLI owners are:\n\n- Pane's managed CLI, normally under `<pane-dir>/bin`; an explicit CLI-only\n update remains selected when an older Pane next starts.\n- A writable global npm `runpane` installation in the prefix reported by its\n own npm. Local project packages and npx cache copies are refused.\n- The invoking Python environment's writable `runpane` package, with its own\n `python -m pip` available. Virtual environments, including pipx environments,\n and user-site installs are identified by their actual package paths. A pip\n dry run must accept the staged wheel. The Python wrapper also requires the\n continuity engine installed by Pane under the same `--pane-dir`; pip alone\n does not install that engine or Node.\n\nThe helper checks directory permissions, data/profile readability and free\nspace on each affected volume. Windows can exclusively lock live browser-profile\nfiles; their sizes are counted before shutdown, and the snapshot must successfully\nread them after clean shutdown before installation is allowed. It stages downloads\nbefore shutting down Pane.\n\nThe snapshot holds Pane's own state, not everything in the data folder: every\ntop-level file (config, databases, journals) and the folders Pane keeps state in\n(`PANE_STATE_FOLDERS` in `packages/runpane/src/updateCapacity.ts`). Folders Pane\nrebuilds or doesn't migrate (`bin`, `shell`, `projects`, the `agent-adapters`\nfolder older versions downloaded chat adapters into, and\nothers in `PANE_UNSNAPSHOTTED_FOLDERS`), git checkouts, and folders Pane does\nnot know are left out. Preflight lists the last two in `snapshotSkipped`, so a\ndry run shows them; back them up yourself if they matter. A test fails when the\ncode writes a top-level folder that is on neither list.\n\nThe CLI that requested an update may be answering a remote\n`runpane workspace <machine> exec` through the Pane it is about to stop. The\nhelper waits up to 60 seconds for that CLI to exit, and 2 seconds more, before\nstopping Pane, so the reply with the operation `id` arrives.\nA successful dry run checks local prerequisites; it does not download or prove\nthat the requested release passes artifact verification.\n\n## Status and exit codes\n\nKeep the operation's `id` and use the same `--pane-dir`:\n\n```sh\nrunpane update --json\nrunpane update --status <id> --pane-dir <path> --wait --json\n```\n\nThe status command reads the local journal even while Pane is stopped, provided\nthe invoking CLI and its runtime can still launch. If the normal command fails\nbecause the app or CLI was damaged, read `<pane-dir>/updates/<id>/status.json`\ndirectly in a text editor. On macOS/Linux, use\n`cat \"<pane-dir>/updates/<id>/status.json\"`; in PowerShell, use\n`Get-Content -Raw '<pane-dir>\\updates\\<id>\\status.json'`. Replace the placeholders\nwith the original data directory and operation ID. This read does not start or\nresume an update. If the ID was lost, inspect the directories under `updates`\nand match the journal's ID and host with `preflight.json`; do not guess ownership\nfrom timestamps alone. A missing or unreadable journal requires maintainer help.\n\nThe command's JSON\nobject has these fields; this result is documented here and is not currently a\nnamed schema in the agent contract's `jsonSchemas` collection.\n\n| Field | Meaning |\n| --- | --- |\n| `id`, `host`, `scope`, `version` | Operation identity, local machine, `both`/`pane`/`cli`, and requested or resolved release |\n| `phase` | Current stage or terminal outcome |\n| `completed` | Stages durably recorded as finished |\n| `appUpdated`, `cliUpdated` | Selected component installation finished; neither implies host or panel readiness |\n| `hostReachable` | Relaunched host passed version, identity and endpoint/auth checks; false for CLI-only updates |\n| `restored` | Per-panel `{panelId, outcome, reason}` records; `resumed`, `preserved`, or `needs-attention` |\n| `error` | Failure explanation, when present |\n| `updatedAt`, `helperPid` | Last recorded time and acknowledged helper PID; PID presence alone does not prove liveness |\n| `statusFile`, `next` | Journal location and command to inspect it again |\n\nStages are `accepted`, `stage`, `checkpoint`, `stop`, `snapshot`, `install`,\n`launch`, `health`, and `restore`. Terminal phases are `complete`, `failed`, and\n`needs-attention`. `complete` means all selected components and applicable health\nand restoration gates finished; preserved idle/blocked panels are intentional.\n`needs-attention` can mean a partially updated installation or individual panels\nrequiring manual action. Inspect the booleans, completed stages, error and every\npanel outcome together.\n\nExit 0 means the returned status is not a terminal failure. Without `--wait`, it\ncan still be in progress. `failed` and `needs-attention` return exit 1. Command or\npreflight errors also return nonzero. `--wait` has no overall timeout. Ctrl+C stops\nthe waiting caller, not the independent operation; inspect status before retrying.\nThere is no supported operation cancellation command. A fresh update runs\npreflight before checking locks. If preflight succeeds and another operation\nholds the lock, it returns that operation's status instead of starting another\ninstall.\nDuring downtime, preflight may fail before reaching the lock. Use `--status`\n(which bypasses preflight), or read the journal directly, to inspect recovery.\n\n## What happens to agent work and drafts\n\nOnly a panel recorded as actively working, with an exact conversation ID and a\nsupported resume command, is eligible to reopen. Built-in launch resolution\ncovers Claude, Codex, Cursor, native OpenCode and Pi. OpenCode requires a recorded\nvalid `ses_…` selector and an eligible direct launch command; incompatible Session\nwrappers or custom-resume settings are refused. Custom commands use their\neffective resume profile: an explicit template containing `{sessionId}`, or the\nderived profile for a recognized Agent Farm launch. Eligibility and command\nconstruction do not prove history exists or guarantee provider restoration:\n`resumed` requires fresh conversation-identity and readiness evidence from the\nrunning harness. An incompatible command or missing evidence yields\n`needs-attention`.\n\nReadiness requires an explicit adapter acknowledgment after the harness has\naccepted the exact conversation and is usable. The relaunched process receives\na fresh `PANE_UPDATE_RESUME_NONCE`. An adapter may emit one complete line\n`PANE_UPDATE_RESUME_READY=<nonce>:<actual-loaded-conversation-id>` only after that\nacceptance. The nonce binds the acknowledgment to this launch; an old marker,\nwrapper ID line, generic output, startup animation or CLI-ready timeout does not\nconfirm readiness. Login/trust blockers and command exit prevent success.\nDo not print this marker merely because a wrapper started or received a resume ID.\n\nThe built-in Claude/Codex/Cursor/OpenCode launch commands do not currently provide\nthis acknowledgment themselves; Pane has no vendor acknowledgment adapter for\nthem. Without an instrumented harness adapter and verification of the fresh\nchallenge plus actual loaded conversation ID, reopening these conversations\nreports `needs-attention`; inspect the live panel manually. Custom\nreported/generated commands, including Agent Farm, can integrate the same\nacknowledgment. A reported conversation ID alone is insufficient. The native QA\nadapter proves this protocol with a harmless process, not a vendor login or\nconversation acceptance.\n\nReopening the conversation does not submit the interrupted task again. The agent\nmay return to its prompt; review it and decide what to send. Idle, completed and\napproval-blocked work stays stopped. The updater sends no `continue`, prompt,\nqueued mutation, or draft input.\n\nA panel the update left stopped starts when you open it, like any stopped panel,\nonce the update has ended: it finished, its helper process exited, or the\ncomputer restarted since the update last made progress. Its agent reopens on its\nsaved conversation and nothing is typed into it. While the update is still\nrunning, opening the panel reports that it is waiting for the update; retry when\nthe update finishes.\n\nBefore shutdown, the checkpoint saves each panel's prior state, activity, launch\nprofile, conversation ID and launch/worktree/Session cwd. Unsubmitted composer\ntext detected in the terminal prevents automatic reopening. Inspect that panel's\n`priorState.screenText`, `initialInput` and `initialInputFile` in `checkpoint.json`\nfor the saved evidence. Screen text can contain other terminal content and is not\na promise of a complete editable draft. Recover and verify the intended text\nmanually before submitting anything. Do not share checkpoint files publicly.\n\n## Recovering an interrupted operation\n\nAll paths below use the same Pane data directory supplied with `--pane-dir`.\nThe operation directory is `<pane-dir>/updates/<id>/`:\n\n| File or directory | Purpose |\n| --- | --- |\n| `status.json`, `preflight.json`, `staged.json` | Progress, original executable/data/profile and CLI paths, staged package/backup paths |\n| `checkpoint.json`, `restoration.json` | Prior panel state and durable per-panel launch claims/outcomes |\n| `quiesced.json` | Original host's clean-shutdown acknowledgment |\n| `snapshot/data`, `snapshot/profile`, `snapshot/complete.json` | Pre-install copy; only the complete marker establishes a finished snapshot |\n\n### Inspecting the supervisor and remaining processes\n\nUse the operation ID from the journal. These commands inspect state; they do\nnot stop jobs or clear locks:\n\n| Platform | Supervisor and logs |\n| --- | --- |\n| macOS | `launchctl print \"gui/$(id -u)/com.pane.update.<id>\"`; read `<operation-directory>/supervisor.log` and `supervisor.plist` for the executable and arguments. |\n| Windows | `schtasks /Query /TN \"com.pane.update.<id>\" /V /FO LIST`; inspect `<operation-directory>/supervisor.xml`. Task Scheduler's History tab or the `Microsoft-Windows-TaskScheduler/Operational` event log may provide execution history if enabled. This adapter does not create a stdout/stderr log file. |\n| Linux | `systemctl --user status \"com.pane.update.<id>.service\"` and `journalctl --user -u \"com.pane.update.<id>.service\"`; transient units may already have been collected. |\n\nWindows relaunch can also create `com.pane.update.<id>-app`; inspect that task\nwhen present. A completed or missing supervisor is not proof that a child\ninstaller has exited. On macOS/Linux use `ps -axo pid,ppid,command`; on Windows\nuse `Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,ExecutablePath,CommandLine`\nin PowerShell. Compare full paths and arguments with this operation's staged\nruntime/helper, `staged.json` installer path and `preflight.json` installation.\nCheck helper children and installer processes separately; a reused PID, generic\nprocess name or stale Task Scheduler result is insufficient. If processes cannot\nbe attributed confidently, access is denied, or logs contradict the journal,\nleave locks and snapshots intact and ask a maintainer to inspect them.\n\n### Recovery steps\n\n1. Read status before starting another installer. If it is progressing, let it\n finish. If it stops progressing, inspect the helper supervisor and logs. A\n missing caller or terminal is expected; a PID alone is insufficient to decide\n the helper is dead. Do not remove locks while any helper/installer is active.\n2. For `failed` before shutdown, Pane remains available and the terminal operation\n releases its locks. Correct the reported preflight/staging problem and retry.\n3. For `needs-attention` with `hostReachable: true`, open the same installed Pane\n and inspect each panel outcome. Do not replay input whose delivery is unknown.\n Use the panel's normal explicit resume/restart control after reviewing its saved\n conversation and draft evidence. Already resumed panels must not be restarted\n merely because another panel needs attention.\n4. If Pane is stopped, use `preflight.json` to identify the exact executable,\n `paneDir` and `userData`. After establishing that no update helper/installer is\n still acting, launch that installation with `PANE_DIR` set to `paneDir` and\n `--user-data-dir=<userData>`. If the executable is missing or damaged, repair\n that same installation with the same or newer compatible official installer.\n Keep the operation directory and snapshot while diagnosing the failure.\n5. Never replace a migrated database with the old snapshot while the newer app is\n running. A rollback needs a compatible application and a complete data/profile\n snapshot restored together while all relevant processes are stopped. This\n updater does not automate or validate such a rollback. Get maintainer help\n when compatibility or installer state is uncertain.\n\nAn operation releases its locks when it ends `complete` or `failed`, or ends\n`needs-attention` after its `install` step completed (for example, a failed\nhealth check or panel restoration). The next `runpane update` also reclaims a\nlock left by such an operation. It runs in a new operation directory, so the\nold journal, checkpoint and snapshot stay in place.\n\nA `needs-attention` operation that stopped before or during `install` keeps\nits locks, because an installer child may still be running. A lock owned by an\noperation that has not ended is not reclaimed either. To recover, verify that no\noperation-owned helper or installer is running, then move aside only locks whose\n`owner.json` contains this exact operation ID. Lock directories are listed in\n`preflight.json` as `lockDirectory` and `additionalLockDirectories`. Do not\ninfer ownership from a reused PID. If recovery of a crashed lock cleanup is\nitself interrupted, its persistent cleanup claim also requires manual\ninspection; another caller will not steal it or report a new update as\ncompleted. Logout/reboot continuation is not guaranteed.\n"},{"path":"docs/UX_PRINCIPLES.md","title":"UX principles: progressive disclosure","text":"# UX principles: progressive disclosure\n\nGuidelines for Pane's UI design, informed by Linear and Claude Code CLI patterns.\n\n## Core Principles\n\n### 1. Prompt-First, Options-Second\n\nEvery interaction should lead with the primary action. For session creation, that's the prompt. For settings, that's the most common toggle. Everything else is secondary and should be layered behind progressive disclosure.\n\n**Do:** Auto-focus the primary input. Show one clear action.\n**Don't:** Present a wall of fields, cards, and sliders on first load.\n\n### 2. Opinionated Defaults Over Choice Overload\n\nProvide one good default rather than forcing a choice. Users interpret defaults as expert recommendations (the \"default effect\"). When 80%+ of users will pick the same option, make it the default and let the rest override.\n\n**Do:** Default to 1 session. Auto-generate names. Remember the last choice where a choice is needed.\n**Don't:** Present every agent as an equal-weight card that must be picked every time.\n\n### 3. The 80/20 Rule\n\nShow the 20% of features that 80% of users need. Hide the rest behind expandable sections, overflow menus, or context menus. Every visible element competes for attention.\n\n**Do:** Show prompt + create button. Put model selection, session count, branch config behind \"Session options.\"\n**Don't:** Show session count slider, tool cards, model dropdowns, and commit mode all at once.\n\n### 4. Minimal Status Indicators\n\nMatch Claude Code CLI's simplicity. Status should be informative without being distracting. Simple text beats animated spinners. A color-coded dot beats a pulsing badge with rotating icons.\n\n**Do:** Show `Thinking...` with subtle animated dots.\n**Don't:** Show spinning rings, bouncing dots, rotating icons cycling through 8 images, and 41 wacky status messages.\n\n### 5. Progressive, Not Hidden\n\nProgressive disclosure is not about hiding features — it's about layering them. Users should always see a clear affordance that more options exist (chevron, \"More options\" link, overflow menu icon).\n\n**Do:** Use `▸ Session options` with a chevron that expands to reveal fields.\n**Don't:** Remove the session count slider entirely. Don't bury settings with no visual indicator.\n\n## Patterns to Follow\n\n### Linear's \"One Good Way\"\n\nLinear deliberately constrains flexibility in favor of purpose-built workflows:\n- Issue creation needs only a **title** — everything else is optional\n- Smart pre-population (highlighted text auto-fills issue title)\n- Opinionated at the atomic level (labels and due dates are issue properties, not configurable)\n- Purpose-built over flexible\n\n**Pane equivalent:** Creating a pane needs nothing typed: the name is auto-generated, and the agent and prompt are optional.\n\n### Claude Code CLI's Minimalism\n\n- Shows simple `thinking...` during processing — no visual noise\n- Thinking content hidden by default, revealed via `Ctrl+O`\n- Status line is optional and customizable\n- Updates debounced at 300ms to prevent visual flicker\n\n**Pane equivalent:** Keep status dots simple. No animations unless state actually changes.\n\n### Collapsible Section Pattern\n\nUse for grouping secondary options:\n- Clear heading that describes what's inside\n- Chevron indicator (▸ collapsed, ▾ expanded)\n- Remember expansion state in user preferences\n- Keep disclosure levels below 3 (avoid nesting collapsibles inside collapsibles)\n\n### Overflow Menu Pattern\n\nUse when 3+ utility actions compete for toolbar space:\n- Keep the most-used action visible (with keyboard shortcut)\n- Group remaining actions behind `⋯` (MoreHorizontal) icon\n- Menu items should have icons + labels\n- Include state indicators where relevant (e.g., \"Sort: Newest first\")\n\n## When NOT to Simplify\n\nProgressive disclosure fails when critical information is hidden:\n- Never hide destructive actions behind progressive disclosure without confirmation\n- Don't hide information users need to make decisions (e.g., hiding that a session will use Codex instead of Claude)\n- Don't over-simplify settings that have security implications (API keys, permission modes)\n- If sales/engagement drops after hiding something, bring it back — trust trumps minimalism\n\n## Visual Design Principles\n\n### Reduce Visual Noise\n- Fewer colors, fewer animations, fewer competing elements\n- Use whitespace to create hierarchy\n- Sequential content flow (top-to-bottom)\n- One primary action per view\n\n### Animations\n- Only animate to communicate state changes (not for decoration)\n- Respect `prefers-reduced-motion` OS setting\n- Debounce status updates (300ms minimum)\n- Subtle > flashy. Text > spinners. Dots > bouncing balls.\n\n### Color\n- Use color sparingly and consistently for status:\n - Green: running/success\n - Yellow: waiting/attention needed\n - Red: error\n - Blue: new/unviewed activity\n - Gray: completed/inactive\n\n## References\n\n- [The Linear Method: Opinionated Software](https://www.figma.com/blog/the-linear-method-opinionated-software/)\n- [How we redesigned the Linear UI](https://linear.app/now/how-we-redesigned-the-linear-ui)\n- [Progressive disclosure in UX: Types and use cases (LogRocket)](https://blog.logrocket.com/ux-design/progressive-disclosure-ux-types-use-cases/)\n- [Designing for Progressive Disclosure (UXmatters)](https://www.uxmatters.com/mt/archives/2020/05/designing-for-progressive-disclosure.php)\n- [The Default Effect in UX](https://www.ux-bulletin.com/default-effect-in-ux/)\n- [Claude Code CLI Status Line Docs](https://code.claude.com/docs/en/statusline)\n"},{"path":"docs/assets/visual-style.md","title":"dcouple README visual language","text":"# dcouple README visual language\n\nUse a shared pixel-art world with a distinct setting for each product. The family\nreference is the [Agent Farm banner](https://github.com/greenfield-inc/agent-farm/blob/19f1fba8ef12050eef39c1b44e725c697b57b87b/docs/assets/agent-farm-banner.png).\n\n## Shared rules\n\n- Crisp coherent pixels, readable silhouettes, and isometric miniature scenes.\n- Charcoal midnight backgrounds, warm cream lettering, and soft lantern light.\n- Cream robots with dark faceplates and green eyes; clothes and props reflect their role.\n- Restrained foliage, wood, stone, and floating islands connect the settings.\n- Wide 3:1 banners: title left, scene right. Supporting images are roughly 2:1.\n- Use each project's own setting, props, and accent colors. Avoid repeating the same farm under a new title.\n- Keep technical labels and arrows accurate. Preserve real screenshots, demos, commands, and detailed diagrams.\n- Do not depict planned features as shipped, implicit sharing as public, or required human approval as automatic.\n- Keep alt text and text equivalents for information-bearing diagrams.\n\n## This repository\n\nA multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\n\nLocal reference: [pane-banner.png](pane-banner.png).\n\nSupply that banner as an image reference for future generation. Match its pixel\ntreatment, characters, lighting, and palette while adapting the scene to the\nsection. Save final assets in `docs/assets/` and add the prompt to the\ngeneration record below; inspect labels and readability at README display width\nbefore embedding. Use new filenames for experiments rather than overwriting\nchosen art.\n\n## Generation record\n\nGenerated with the built-in image-generation tool, using the Agent Farm banner as\nthe style reference.\n\n### pane-banner.png\n\nUse case: stylized-concept\nAsset type: GitHub README hero banner, 3:1 landscape.\nUse the provided Agent Farm banner as STYLE REFERENCE only. Same crisp coherent pixel-art game world, charcoal midnight opaque backdrop, warm cream chunky title type, soft lantern light, cream robots with dark faceplates and green eyes, restrained foliage on isometric floating islands. Keep readable silhouettes and generous negative space. Give this product its own props and accent palette. No blur, smooth 3D, photorealism, watermarks, fake screenshots, tiny illegible text or extra slogans.\nScene: a multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\nComposition: large title on left 45%, detailed but tidy scene on right 55%; safe margins. Exact title: \"PANE\". Use two lines for long titles. Only this title as text. Make a polished sibling identity within the dcouple family.\n\n### pane-workspaces.png\n\nUse case: infographic-diagram\nAsset type: GitHub README section illustration, 2:1 landscape.\nUse the provided Agent Farm banner as STYLE REFERENCE only. Same crisp coherent pixel-art game world, charcoal midnight opaque backdrop, warm cream chunky title type, soft lantern light, cream robots with dark faceplates and green eyes, restrained foliage on isometric floating islands. Keep readable silhouettes and generous negative space. Give this product its own props and accent palette. No blur, smooth 3D, photorealism, watermarks, fake screenshots, tiny illegible text or extra slogans.\nLocal identity: a multilevel terminal workshop with three separate well-lit work booths, each holding a cream robot and terminal; a human coordinator views the booths from a central desk. Tiny branch-shaped paths lead to each booth, suggesting separate workspaces. Teal and copper accents, no musical props or farmer hats.\nDiagram: Three panels left to right with exact headings and body lines: \"Repository\" / \"Saved base repo\"; \"Pane\" / \"Worktree and branch\"; \"Panels\" / \"Terminals share the worktree\". Arrows from Repository to Pane to Panels. Illustrate a project folder, a separate workshop booth, then two small terminals within that same booth. All panels are conceptual, not an app screenshot. No implication that each panel gets its own worktree.\nLarge highly legible cream text on uncluttered dark areas; graphical precision and factual readability take priority over scenery. No large product title. Match the supplied family reference.\nInput images for the section illustration: first is the family style reference; second is this project's generated banner. Match the second image's character, props and accents.\n"},{"path":"docs/lint/anti-slop.md","title":"Anti-slop policy","text":"# Anti-slop policy\n\nPane vendors the 15 Oxlint rules from `dmmulroy/anti-slop` at commit\n`cd064fe602b5915ff35e1e1c20836ca9bcb3729a` in\n`tools/oxlint/anti-slop`. The snapshot is intentionally local so the rules run\ndeterministically and can be reviewed alongside the code they gate.\n\nThe original full-repository scan covered `frontend`, `main`,\n`packages/runpane`, `shared`, `tests`, `scripts`, all non-vendored `tools`, and\nevery Playwright config. It found 2,463 findings in 240 files. The cleanup\ncampaign reduced every rule to a zero baseline, so all 15 rules now block\nregressions in the root lint command.\n\n| Rule | Baseline findings/files | Lane | Reason |\n| --- | ---: | --- | --- |\n| `no-object-parameters` | 0/0 | blocking | Prevent new positional object bags without an explicit contract. |\n| `no-reflect-apply` | 0/0 | blocking | Prefer direct, typed calls over reflective dispatch. |\n| `no-unknown-type-aliases` | 0/0 | blocking | Prevent aliases that rename uncertainty instead of parsing it. |\n| `no-widen-then-assert` | 0/0 | blocking | Prevent discarding known types and recovering them with assertions. |\n| `no-reflect-get` | 4/1 | blocking | Reflective reads were replaced with declared or descriptor-based access. |\n| `no-chained-type-assertions` | 89/22 | blocking | Boundary contracts avoid type laundering through chained assertions. |\n| `no-conditional-empty-object-spread` | 34/16 | blocking | Optional fields are assembled explicitly. |\n| `no-known-value-widening` | 142/65 | blocking | Known values retain inferred or named domain types. |\n| `no-module-mocking` | 31/13 | blocking | Tests use explicit seams or real modules. |\n| `no-runtime-typeof` | 417/94 | blocking | Runtime boundaries use parsers, feature checks, or domain guards. |\n| `no-shape-in-symbol-names` | 18/1 | blocking | Symbols describe domain intent rather than structural shape. |\n| `no-unknown-parameters` | 250/64 | blocking | Uncertain input is parsed at its boundary, including unconstrained parser-only generic parameters. |\n| `no-unknown-returns` | 37/21 | blocking | Adapters return parsed domain values. |\n| `no-unsafe-dictionary-type` | 192/51 | blocking | Dictionary contracts use bounded keys or validated JSON objects. |\n| `require-safety-comment-for-type-assertion` | 1,249/177 | blocking | Remaining necessary assertions document their checked invariant. |\n\nRun `pnpm lint` for the blocking policy. `pnpm lint:ox:extra` and\n`pnpm lint:ox:extra:details` remain available as harness checks, but no rules\nremain in the advisory lane.\n\n## Root cause policy\n\nFor agent-written Pane code, the most important class is uncertainty that leaks\npast an I/O boundary and later becomes a widening or assertion. Ask: **is this\nchange fixing the root cause or a symptom?** The root fix parses IPC, daemon,\nfilesystem, process, or browser input once into a named domain type. A late\n`unknown` alias, representation ladder, dictionary, or assertion usually treats\nthe symptom. Blocking findings should guide that review.\n\nAny future anti-slop rule must reach a zero baseline for the full scope before\njoining the blocking configuration. Do not silence a class globally to make a\npromotion appear clean.\n\nThe root development toolchain requires patched Node 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+ (26.x) for the eMudhra CA\nfix. Oxlint's TypeScript plugin runs under the developer Node process. This does not change\nElectron 43's bundled Node 24 runtime, and the published `runpane` wrapper requires the same patched standalone Node ranges.\n\n`no-unknown-parameters` also reports an unconstrained function type parameter used directly as an input when an explicit return type and every other parameter omit it. Generic identities, callback relationships, relationships expressed by other generic constraints, constrained inputs, and inferred return contracts remain valid. Boundary parsers and output serializers should use `unknown` with a local explanation of the schema or transport contract, rather than a generic that hides an unvalidated input.\n"},{"path":"docs/lint/oxlint-overlap.md","title":"Oxlint and ESLint overlap","text":"# Oxlint and ESLint overlap\n\n`pnpm lint:ox` is the first blocking lane. ESLint remains blocking for rules\nwhose current Pane semantics are not reproduced by Oxlint 1.76.0, and continues\nto report the repository's existing warning-level checks. An ESLint rule is\ndisabled in `tools/eslint/oxlint-overlap.cjs` only when the explicit blocking\nOxlint rule below replaces it.\n\nThe 79 unique ESLint error-level rules were resolved from the frontend, main,\nand RunPane flat configs. Seventy-eight have blocking equivalents. `no-octal`\nhas no Oxlint 1.76.0 equivalent and therefore stays in ESLint.\n\n| ESLint rule | Blocking Oxlint rule | Scope/disposition |\n| --- | --- | --- |\n| `for-direction` | `eslint/for-direction` | common; moved |\n| `no-async-promise-executor` | `eslint/no-async-promise-executor` | common; moved |\n| `no-case-declarations` | `eslint/no-case-declarations` | common; moved |\n| `no-compare-neg-zero` | `eslint/no-compare-neg-zero` | common; moved |\n| `no-cond-assign` | `eslint/no-cond-assign` | common; moved |\n| `no-constant-binary-expression` | `eslint/no-constant-binary-expression` | common; moved |\n| `no-constant-condition` | `eslint/no-constant-condition` | common; moved |\n| `no-control-regex` | `eslint/no-control-regex` | common; moved |\n| `no-debugger` | `eslint/no-debugger` | common; moved |\n| `no-delete-var` | `eslint/no-delete-var` | common; moved |\n| `no-dupe-else-if` | `eslint/no-dupe-else-if` | common; moved |\n| `no-duplicate-case` | `eslint/no-duplicate-case` | common; moved |\n| `no-empty` | `eslint/no-empty` | frontend only; moved (main/RunPane warning retained) |\n| `no-empty-character-class` | `eslint/no-empty-character-class` | common; moved |\n| `no-empty-pattern` | `eslint/no-empty-pattern` | common; moved |\n| `no-empty-static-block` | `eslint/no-empty-static-block` | common; moved |\n| `no-ex-assign` | `eslint/no-ex-assign` | common; moved |\n| `no-extra-boolean-cast` | `eslint/no-extra-boolean-cast` | common; moved |\n| `no-fallthrough` | `eslint/no-fallthrough` | common; moved |\n| `no-global-assign` | `eslint/no-global-assign` | common; moved |\n| `no-invalid-regexp` | `eslint/no-invalid-regexp` | common; moved |\n| `no-irregular-whitespace` | `eslint/no-irregular-whitespace` | common; moved |\n| `no-loss-of-precision` | `eslint/no-loss-of-precision` | common; moved |\n| `no-misleading-character-class` | `eslint/no-misleading-character-class` | common; moved |\n| `no-nonoctal-decimal-escape` | `eslint/no-nonoctal-decimal-escape` | common; moved |\n| `no-octal` | — | common; retained in ESLint |\n| `no-prototype-builtins` | `eslint/no-prototype-builtins` | common; moved |\n| `no-regex-spaces` | `eslint/no-regex-spaces` | common; moved |\n| `no-self-assign` | `eslint/no-self-assign` | common; moved |\n| `no-shadow-restricted-names` | `eslint/no-shadow-restricted-names` | common; moved |\n| `no-sparse-arrays` | `eslint/no-sparse-arrays` | common; moved |\n| `no-unexpected-multiline` | `eslint/no-unexpected-multiline` | common; moved |\n| `no-unsafe-finally` | `eslint/no-unsafe-finally` | common; moved |\n| `no-unsafe-optional-chaining` | `eslint/no-unsafe-optional-chaining` | common; moved |\n| `no-unused-labels` | `eslint/no-unused-labels` | common; moved |\n| `no-unused-private-class-members` | `eslint/no-unused-private-class-members` | common; moved |\n| `no-useless-backreference` | `eslint/no-useless-backreference` | common; moved |\n| `no-useless-catch` | `eslint/no-useless-catch` | common; moved |\n| `no-var` | `eslint/no-var` | common; moved |\n| `prefer-const` | `eslint/prefer-const` | frontend only; moved (main/RunPane warning retained) |\n| `prefer-rest-params` | `eslint/prefer-rest-params` | common; moved |\n| `prefer-spread` | `eslint/prefer-spread` | common; moved |\n| `require-yield` | `eslint/require-yield` | common; moved |\n| `use-isnan` | `eslint/use-isnan` | common; moved |\n| `valid-typeof` | `eslint/valid-typeof` | common; moved |\n| `@typescript-eslint/ban-ts-comment` | `typescript/ban-ts-comment` | common; moved |\n| `@typescript-eslint/no-array-constructor` | `typescript/no-array-constructor` | common; moved |\n| `@typescript-eslint/no-duplicate-enum-values` | `typescript/no-duplicate-enum-values` | common; moved |\n| `@typescript-eslint/no-empty-object-type` | `typescript/no-empty-object-type` | common; moved |\n| `@typescript-eslint/no-explicit-any` | `typescript/no-explicit-any` | common; moved |\n| `@typescript-eslint/no-extra-non-null-assertion` | `typescript/no-extra-non-null-assertion` | common; moved |\n| `@typescript-eslint/no-misused-new` | `typescript/no-misused-new` | common; moved |\n| `@typescript-eslint/no-namespace` | `typescript/no-namespace` | common; moved |\n| `@typescript-eslint/no-non-null-asserted-optional-chain` | `typescript/no-non-null-asserted-optional-chain` | common; moved |\n| `@typescript-eslint/no-require-imports` | `typescript/no-require-imports` | frontend only; moved (main/RunPane warning retained) |\n| `@typescript-eslint/no-this-alias` | `typescript/no-this-alias` | common; moved |\n| `@typescript-eslint/no-unnecessary-type-constraint` | `typescript/no-unnecessary-type-constraint` | common; moved |\n| `@typescript-eslint/no-unsafe-declaration-merging` | `typescript/no-unsafe-declaration-merging` | common; moved |\n| `@typescript-eslint/no-unsafe-function-type` | `typescript/no-unsafe-function-type` | common; moved |\n| `@typescript-eslint/no-unused-expressions` | `typescript/no-unused-expressions` | common; moved |\n| `@typescript-eslint/no-wrapper-object-types` | `typescript/no-wrapper-object-types` | common; moved |\n| `@typescript-eslint/prefer-as-const` | `typescript/prefer-as-const` | common; moved |\n| `@typescript-eslint/prefer-namespace-keyword` | `typescript/prefer-namespace-keyword` | common; moved |\n| `@typescript-eslint/triple-slash-reference` | `typescript/triple-slash-reference` | common; moved |\n| `react-hooks/rules-of-hooks` | `react/rules-of-hooks` | frontend only; moved |\n| `jsx-a11y/alt-text` | `jsx-a11y/alt-text` | frontend only; moved |\n| `jsx-a11y/anchor-has-content` | `jsx-a11y/anchor-has-content` | frontend only; moved |\n| `jsx-a11y/aria-props` | `jsx-a11y/aria-props` | frontend only; moved |\n| `jsx-a11y/aria-proptypes` | `jsx-a11y/aria-proptypes` | frontend only; moved |\n| `jsx-a11y/aria-unsupported-elements` | `jsx-a11y/aria-unsupported-elements` | frontend only; moved |\n| `jsx-a11y/click-events-have-key-events` | `jsx-a11y/click-events-have-key-events` | frontend only; moved |\n| `jsx-a11y/heading-has-content` | `jsx-a11y/heading-has-content` | frontend only; moved |\n| `jsx-a11y/iframe-has-title` | `jsx-a11y/iframe-has-title` | frontend only; moved |\n| `jsx-a11y/no-access-key` | `jsx-a11y/no-access-key` | frontend only; moved |\n| `jsx-a11y/no-distracting-elements` | `jsx-a11y/no-distracting-elements` | frontend only; moved |\n| `jsx-a11y/no-static-element-interactions` | `jsx-a11y/no-static-element-interactions` | frontend only; moved with `onClick`/expression options |\n| `jsx-a11y/role-has-required-aria-props` | `jsx-a11y/role-has-required-aria-props` | frontend only; moved |\n| `jsx-a11y/role-supports-aria-props` | `jsx-a11y/role-supports-aria-props` | frontend only; moved |\n| `jsx-a11y/tabindex-no-positive` | `jsx-a11y/tabindex-no-positive` | frontend only; moved |\n\nBoth Oxlint configs disable the broad `correctness` category. This is\nintentional: the blocking contract is the explicit list above plus the 15\nzero-baseline anti-slop rules, rather than an unstable category preset.\n\nA Profiler-based render counter is deliberately deferred. Add one with the\nfirst named React subscription/render regression and a component test renderer\nthat can mount the affected Pane surface; React Scan supplies exploratory\nruntime evidence but is not a deterministic unit-test assertion.\n"},{"path":"docs/remote-daemon-lifecycle.md","title":"Remote Daemon Lifecycle","text":"# Remote Daemon Lifecycle\n\nThis is the implementation checklist for Remote Pane setup, teardown, and runtime switching. It exists to keep config writes, runtime controller actions, and renderer refreshes in sync.\n\n## Runtime Roles\n\n- Host lifecycle is owned by `PaneRemoteTransportController` and `remoteHostRuntimeStateStore`.\n- Client lifecycle is owned by `RemotePaneClientController`.\n- IPC handlers in `main/src/ipc/remoteDaemon.ts` orchestrate config writes and controller calls.\n- Renderer runtime changes are reconciled through `remote-daemon:resync-required`. Main sends `{ hostChanged: true }` when the active runtime changes; a reconnect to the same host sends it without a payload.\n- A resync refetches config, Panes, the active Pane's panels, repositories, Sessions and pinned Sessions, pending permission prompts, loaded archived Panes, archive progress, the host's terminal shells, and an open Usage view. When the host changed, it also leaves an open repository view, since repository ids are per host, loads that host's expanded repositories, opened Sessions and open Archived groups, and asks again about that host's interrupted Panes.\n- Expanded repositories are saved per host: this computer under `treeView.expandedProjects`, a remote host under `treeView.expandedProjects@<computer id>`.\n- Opened Sessions and open Archived groups are saved per host the same way, under `treeView.expandedSessions[@<computer id>]` and `treeView.expandedArchivedProjects[@<computer id>]`. A Session not in the opened list shows collapsed. Older `treeView.collapsedSessions[@<computer id>]` rows are no longer read and stay in `ui_state` unused.\n- Where the user was is saved per host too, under `navigation.lastLocation` / `navigation.lastLocation@<computer id>`: the active view, the open repository view's project id, and the open Pane. A switch clears the outgoing host's selection as above and then restores the incoming host's, validating every id against that host's freshly loaded repositories and Panes — anything archived or gone degrades to the home view, and the dead memory is overwritten rather than retried. `frontend/src/utils/hostNavigationMemory.ts` owns both halves; the renderer names the host on each read and write, because it can still be showing the outgoing host while main has already switched runtimes. Restoring selects one Pane, as a click would, and never revives every terminal once open on that host. The memory also holds this desktop's selected Session: launch and host switches both restore it, and the host's last-used Session is only the fallback when there is none. Another client's selection never moves it. The tabs and split inside each Pane are a separate per-Pane memory, `paneLayout.<pane id>` / `paneLayout.<pane id>@<computer id>` (`frontend/src/utils/paneLayoutMemory.ts`); the host's stored layout and active tab are the last used by any client and seed a Pane this desktop has not shown. Archiving or deleting a Pane drops its memory. At app startup the location memory reopens only one thing besides the Session: when this computer is the active host and the last Pane shown is live (not archived, folder present) with a chat tab in front (`ui-state:get-launch-chat`, `UIStateManager.getLaunchChat`), launch opens that Pane, as a click would, and focuses the chat's message box. Any other last view starts on Home. A launch with a remote host active, and the launch after a restart to update, keep their own restore.\n- The terminal shell picker reads and writes the active host's shell (`terminal:get-shell-settings`, `terminal:set-preferred-shell`). It appears only when that host runs Windows.\n- `pane:focus-requested` and `pane:open-link` are host events. `runpane panes focus` and `runpane panes create --focus` move only the desktop window attached to that host as its local host; a remote-mode client ignores them. A host- or agent-initiated tab activation (`panel:activeChanged`) moves only clients already showing that Pane, and a new Pane switches only the client whose request created it (`clientRequestId`, echoed on `session:created`). A pane:// link opened on a remote-mode client is resolved by its renderer against the active host.\n- Remote terminals ack output with `terminal:ack`. This window's ptyHost port reaches only local terminals.\n- The Remote Pane PWA keeps the same rules in the browser. When its event stream returns after a drop (network loss, or the native app resuming), it refetches Panes, the selected Pane's panels, Sessions, and loaded archived Panes. Connecting to a host or disconnecting clears all host-scoped state first: Panes, panels, Sessions, the open Session, archived Panes, open dialogs, and notification settings.\n\n## Lifecycle Matrix\n\n| Action | Main-process side effect | Renderer side effect |\n| --- | --- | --- |\n| Import connection and connect succeeds | Save the code as a route of its computer (or a new computer), activate it, set remote mode | Resync config, sessions, panels |\n| Import connection and connect fails | Save the route, keep current active runtime | No runtime resync |\n| Connect saved computer | Activate the computer before persisting remote mode | Resync config, sessions, panels |\n| Change route on the active computer | Reopen the event stream on the new route; no runtime switch | Reconnect resync (no `hostChanged`) |\n| Switch to local runtime | Disconnect active remote client, save local mode | Resync config, sessions, panels, clear stale active session |\n| Remove inactive computer, or its last route | Remove the computer | No runtime resync |\n| Remove active computer | Switch local, remove the computer, save local mode | Resync config, sessions, panels |\n| Enable or update host | Save host config, transport controller syncs to live or error | Host-state event updates UI |\n| Stop host | Save disabled host config, transport controller stops server | Host-state event updates UI |\n| Disconnect host clients | Drop matching SSE clients | Host-state event updates client count |\n| Revoke host client | Remove saved client record, drop matching SSE clients | Host-state event updates client count |\n\n## Guardrails\n\n- Saved computers live in `remoteDaemon.client.computers` (`shared/types/remoteComputers.ts`), one per computer with its routes in order; `client.activeProfileId` names a computer id. `client.profiles` is the pre-computers list, kept untouched for a downgrade and read only by the conversion.\n- Do not persist remote mode until the selected computer has successfully activated.\n- Failed import-connect saves the route but must not switch runtime or emit a renderer resync.\n- Connected remote clients are runtime state, not saved client records.\n- Current Pane Data hosting is live only while that Pane app is running.\n- Isolated daemon data can install a background service; Current Pane Data should not.\n\n## Terminal Input\n\nDesktop and browser clients send at most one terminal input request per panel at a time. Keys typed while a request is pending are combined into the next request, preserving their order without a separate round trip for every buffered key. A bare Escape always ends a combined request, because terminal apps read Escape followed by another key in the same write as an Alt shortcut. Different panels and other remote commands remain independent.\n\nAgainst a host that runs each request ID once (`deduplicatesRequestIds` in its `ready` event), each input request carries an ID. A request whose answer is lost, or that is caught by a reconnect or by the app going to the background, is resent with the same ID once the connection is back, and the queued input behind it follows in order. Callers are rejected once a request has waited five minutes for the connection.\n\nAgainst an older host, input requests are not retried. On failure, disconnect, or a ten-second input timeout, queued input is discarded and outstanding callers are rejected, because an interrupted request may already have reached the host.\n\n## Desktop media previews\n\nThe explorer's previews (images, PDFs, fonts, video, audio and the text formats) work from a remote desktop. The renderer still gets a `pane-media://preview/<token>` URL from its own main process; the grant records which host issued it, and a request after a host switch, or after a switch to local mode, gets 403. Each request goes to the host's `GET /media?sessionId=&filePath=` with the connection's usual authentication on that door, and its `Range` header passes through, so video and audio seek without downloading the whole file. The host checks that the path has a preview kind and resolves it through `file:getPath`, the same worktree and symlink boundary the host uses for its own previews, and answers 404 otherwise. Archive and SQLite listings use the daemon-owned `file:preview-list` command, so they run on the host too. \"Open with system app\" on a remote desktop downloads the whole file through the same route into a new temporary folder on that desktop and opens the copy, so edits in the system app do not reach the host. The copy keeps the host file name when that name is valid on every desktop OS, and is otherwise named `preview` plus the extension. A failed download or open removes the folder. While remote mode has no connected host, previews and Open fail; they never read the desktop's own files. \"Reveal in folder\" is available only on the host.\n\n## Desktop browser file previews\n\nBefore mounting a `file://` webview, the desktop renderer asks the local main process to prepare its session. In remote mode, an isolated in-memory Electron partition handles every file request through `panels:read-browser-file` on the existing authenticated remote connection. The original URL, including its filename, remains intact, so relative CSS, images, scripts and linked HTML pages resolve normally. Local-mode previews, like every other browser tab, use the shared `persist:pane-browser` store; Settings → Privacy → Clear browser data clears it on the computer showing the browser and is never forwarded to the host. This does not add browser panels to the Remote PWA.\n\nThe host reader requires an existing browser panel whose saved entry URL identifies a regular file. It serves regular files within that entry page's directory and descendants, with a 16 MiB limit per file. It checks canonical paths to reject traversal and symlinks/junctions outside that directory at validation time; it never lists directories. The host filesystem is trusted: these checks do not guarantee atomic containment against a host process maliciously replacing files or directories during a read. Thus opening a file shares its containing bundle directory with connected clients, not the entire worktree or disk. This endpoint has no caller-supplied root. File entry URLs are host-owned: HTTP command provenance is carried through async handlers, and the panel manager rejects remote attempts to create or retarget file previews (including through RunPane). Clients can update an unchanged entry but must open a new file on the host. The one exception is previewing a worktree HTML file: a remote desktop names the file and the host creates the browser tab for it, so links within that file's folder load through the reader above. Arbitrary `file://` URLs from a client stay refused.\n\nA host switch removes cached browser panels before asynchronous resync, so outgoing URLs and partitions cannot survive even when both hosts have identical panel IDs. Panel-list requests carry a host generation and refetch if their response belongs to an outgoing host. Incoming panel data recreates the guest and prepares its file session anew. While file preparation is unresolved, navigation does not mount a guest or persist URLs; starting preparation also cancels earlier pending URL writes. Remote file navigation is client-local and does not overwrite the host's saved entry URL. This keeps nested page navigation from changing the bundle boundary. If the host replaces the file entry with an HTTP(S) URL, the client returns to the shared browser store and ordinary navigation persistence, including when it was already viewing that HTTP page. Missing/deleted panels revoke reads; changing the connected profile or its base URL invalidates the previous session's requests, including responses already in flight. A failed fetch renders an error message and never falls back to the client's filesystem. For a file outside the entry page's directory, the message is the host's refusal: it names the file, that directory and the ways to fix the page. While the client is still connected to that host, the tab also shows that refusal under its address bar until its next page, so a refused stylesheet or script that the page never displays is still visible. Both desktop client and host need this version; an older host reports an unavailable preview.\n\nRun `pnpm build:main`, start the frontend with `pnpm --filter frontend dev`, then set `PANE_ELECTRON_E2E=1` and run `pnpm exec playwright test tests/remote-browser-files.spec.ts`. Set `PLAYWRIGHT_PORT` if using a different dev-server port. This opt-in Electron regression uses isolated temporary Pane data and a loopback host with the production HTTP/SSE transport. It verifies the actual BrowserPanel, CSS/image loads, linked-page navigation, the preserved filename, access denial and disconnect behavior, and saves `remote-client-rendered.png`. Linux requires a display (for example Xvfb).\n"},{"path":"docs/remote-terminal-flow-control.md","title":"Remote terminal output flow control","text":"# Remote terminal output flow control\n\nTerminal panels begin hidden until a client registers visibility with\n`terminal:setVisibility`. Hidden panels still stream to daemon subscribers and\nretain scrollback, but do not wait for renderer acknowledgements. A raw SSE\nsubscriber does not register visibility by merely opening `/events`.\n\nVisible panels pause their PTY at 100,000 unacknowledged characters and resume\nat 5,000. The five-second safety timeout abandons the stale acknowledgement\ncount before resuming; fresh output can still cross the high watermark and\npause again. This escape hatch prevents one lost acknowledgement from causing\nevery subsequent flush to wait five seconds. It does not disable backpressure\nfor a visible client that consistently fails to acknowledge output.\n\nAcknowledgements have no sequence or generation. After timeout recovery, a\ndelayed acknowledgement can temporarily reduce the fresh backlog count. Keeping\nforgiven debt would instead discard valid new acknowledgements when the old ones\nwere lost. Strict accounting across recovery would require a protocol change.\n\nDesktop clients connected to a remote host acknowledge processed output through\n`terminal:ack`, including when a PTY ID is known. Only local terminals can use\nthe local PTY host MessagePort. Clients attached to an already-running panel\ncan acknowledge by panel ID without receiving a new `terminal:ptyReady` event.\n\nAcknowledgement accounting is per terminal, not per viewer: one responsive\nviewer can release a pause even if another viewer is silent. Removing the last\nviewer clears pending flow control and resumes the PTY. Registered viewers\nsurvive a PTY host respawn, and attach/detach changes during an asynchronous spawn\nare applied to the replacement terminal.\n\nFocused regression checks:\n\n```sh\npnpm --filter main test run src/ptyHost/flowControl.test.ts src/services/terminalPanelManager.persistence.test.ts src/services/terminalPanelManager.test.ts\npnpm --filter frontend test src/utils/terminalAck.test.ts\n```\n"},{"path":"docs/troubleshooting/SETUP_TROUBLESHOOTING.md","title":"Setup Troubleshooting Guide","text":"# Setup Troubleshooting Guide\n\n## Python distutils Error\n\nIf you encounter this error during `pnpm run setup`:\n```\nModuleNotFoundError: No module named 'distutils'\n```\n\nThis happens because Python 3.12+ removed the `distutils` module that `node-gyp` depends on.\n\n### Quick Fix:\n```bash\nbrew install python-setuptools\n```\n\n### Alternative: Use Python 3.11 with pyenv\n\n```bash\nbrew install pyenv\npyenv install 3.11.9\npyenv global 3.11.9\n```\n\nThen run `pnpm run setup` again.\n\n## Other Common Issues\n\n### Modified terminal keys appear as escape-sequence text on Windows/WSL\n\nIf Alt+Up inserts `[1;3A`, Shift+Left inserts `[1;2D`, or F6 inserts `[17~`,\ncheck whether the application launched from WSL is actually a Windows executable.\nA Windows npm launcher can select `node.exe` even when invoked from a Linux shell.\n\nPane must honor ConPTY's `CSI ? 9001 h` request using xterm's\n`vtExtensions.win32InputMode`. Without it, a Windows console application reached\nthrough WSL can receive a complete VT sequence as individual character key\nrecords. A Linux raw-stdin reader can still receive the exact bytes correctly;\nthis symptom alone does not demonstrate split IPC messages or PTY writes.\nThe negotiated mode must also survive terminal snapshot restoration. The `@`\ninterceptor interprets Win32 key records locally and forwards unconsumed records\nunchanged. This handling applies to all terminal applications.\n\nThe browser regression suite is `tests/terminal-keyboard-input.spec.ts`; it checks\nwhole input messages for Alt+Up, Shift+Left, Shift+Up, and F6 with and without\nnegotiated Windows input mode. For transport diagnosis, compare a Linux raw-stdin\nreader with a Windows `ReadConsoleInputW` reader launched through WSL: compare\nbytes for the former and virtual keys/modifiers for the latter.\n\nSee Microsoft's [Win32 input protocol specification](https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md).\n\n### electron-rebuild failures\n- Ensure Xcode Command Line Tools are installed: `xcode-select --install`\n- Clear node_modules and reinstall: `rm -rf node_modules && pnpm install`\n\n### pnpm permission errors\n- Never use `sudo` with pnpm\n- Fix npm permissions: `npm config set prefix ~/.npm-global`\n\n## Windows Build Requirements\n\n### Spectre-mitigated Libraries Error\n\nIf you encounter this error during `pnpm run setup` on Windows:\n```\nLINK : fatal error LNK1181: cannot open input file 'MSVCRT.lib'\n```\n\nOr similar errors mentioning missing `.lib` files, this means you need to install the Spectre-mitigated libraries in Visual Studio.\n\n### Solution:\n\n1. **Install Visual Studio 2022** (Community Edition is free):\n - Download from [https://visualstudio.microsoft.com/](https://visualstudio.microsoft.com/)\n \n2. **Install Required Components**:\n - Open **Visual Studio Installer**\n - Click **Modify** on your Visual Studio 2022 installation\n - Go to the **Individual components** tab\n - Search for \"Spectre\" in the search box\n - Check the following components:\n - `MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)`\n - `MSVC v143 - VS 2022 C++ ARM64/ARM64EC Spectre-mitigated libs (Latest)` (if building for ARM64)\n - Click **Modify** to install\n\n3. **Restart your terminal** and run `pnpm run setup` again\n\n### Why is this needed?\n\nNode.js native modules on Windows are built with Visual Studio's C++ compiler. Recent security updates require Spectre-mitigated libraries to be installed separately. These libraries provide protection against Spectre vulnerability exploits.\n\n### Alternative: Use Pre-built Binaries\n\nIf you only need to run Pane, [download the Windows installer](https://runpane.com/api/download?version=latest&platform=windows&arch=x64&format=exe&source=gh-docs) instead of building from source. If runpane.com doesn't respond, get `Pane-x.x.x-Windows-x64.exe` (or `-arm64.exe`) from [GitHub Releases](https://github.com/greenfield-inc/Pane/releases/latest?utm_source=github).\n"},{"path":"docs/troubleshooting/WINDOWS_APP_HANG.md","title":"Windows freezes on startup or window focus","text":"# Windows freezes on startup or window focus\n\nA September 3, 2026 report described the latest version as \"lagging\" and \"freezing all the time.\" The reported investigation found a 250 MB `sessions.db`, approximately 200 MB of terminal history across 92 stopped sessions, an accidental Git repository at the Windows user profile root, and the isolated PTY host disabled. Windows recorded `AppHangTransient`.\n\n## Prevention\n\n- Startup loads only logs and browser panels that need restart cleanup. Terminal state is restored on demand when accessed, including history for stopped and archived sessions.\n- Workspace summaries exclude raw and serialized terminal buffers in SQLite before returning rows to JavaScript. Summary reads do not replace complete cached panel state or write reduced state back to disk.\n- Automatic Git status checks and filesystem watching skip the home directory, log a diagnostic, and report unknown Git status. Windows path comparison ignores case and normalizes separators and dot segments. Choose the actual project folder instead of `C:\\Users\\<user>`. Existing repository records and `.git` directories are not deleted.\n- New configurations no longer use the home directory as an implicit Git repository. Legacy home-directory `gitRepoPath` values are rejected by the migration accessor.\n- The isolated PTY host defaults to enabled on Windows, including existing configurations without a `usePtyHost` value. Explicit `false` values are preserved. Enable **Settings > Advanced > Use isolated PTY host** and restart Pane to change an existing opt-out. `PANE_USE_PTY_HOST=1` still forces it on for development.\n\nTerminal history remains on disk. The existing 21-day retention policy for archived sessions is unchanged, and no full `VACUUM` runs during startup. A large database file does not by itself mean all history is resident in the JavaScript heap.\n\n## Manual Windows verification\n\n1. Use an isolated `PANE_DIR` with a copy of a database containing many stopped and archived terminal panels. Launch Pane, inspect responsiveness and heap use, then reopen an old terminal and verify its history.\n2. In an isolated test profile with a home-directory Git repository, select a session whose worktree path is that home directory. Repeatedly blur/focus Pane. Confirm no recursive watcher or Git status scan starts, and check the diagnostic in the main-process log. Verify a normal project beneath the profile still refreshes.\n3. Start with a config missing `usePtyHost`: confirm the settings toggle is enabled and the supervisor forks on Windows. Repeat with explicit `false`, then enable the setting and restart.\n\nThe automated tests cover persistence, summary projections, path normalization, Git scan entry points, and platform defaults. They do not reproduce Windows `AppHangTransient` or validate a packaged Windows PTY host.\n"},{"path":"docs/troubleshooting/WINDOWS_CLAUDE_CODE_SPAWN.md","title":"Windows Claude Code Spawn Issue - RESOLVED","text":"# Windows Claude Code Spawn Issue - RESOLVED\n\n## Status: ✅ FIXED\n\nBoth issues have been resolved. Claude Code now spawns correctly on Windows.\n\n## Note: the original reproduction no longer applies\n\nThe failure described below was reproduced against a copy of Claude Code installed **inside\nPane's own `node_modules`** — Pane declared `@anthropic-ai/claude-code` as a dependency, so\n`Pane/node_modules/.bin/claude` existed and could win PATH resolution during development.\nThat dependency has since been removed (nothing ever imported it; Pane spawns the user's\nown CLI), so the specific `MODULE_NOT_FOUND` path shown below — resolving into Pane's pnpm\nstore — can no longer occur.\n\n**The fixes described here are still live and still required.** Both apply to any\nglobally installed `claude`:\n\n- npm/pnpm bin stubs are shell scripts on Windows, so `node-pty` cannot execute them\n directly (error code 193). The proactive Node.js fallback in `AbstractCliManager.ts`\n handles this.\n- Those stubs resolve their target through `$basedir`-relative paths, which break when the\n process is spawned with a worktree as `cwd`. `findCliNodeScript()` in `nodeFinder.ts`\n parses the stub and invokes the resolved `.js` file directly.\n\nRead the sections below as the rationale for that code. Only the reproduction environment\nis out of date.\n\n## Problem Summary\n\nClaude Code was failing to spawn properly on Windows when Pane runs it in a worktree directory different from where `@anthropic-ai/claude-code` is installed.\n\n## Root Cause Analysis\n\n### Issue 1: Error Code 193 (Fixed)\n\n**Error:** `Failed to spawn Claude Code: Cannot create process, error code: 193`\n\n**Cause:** Error code 193 on Windows means \"not a valid Win32 application\". This occurs when trying to execute a shell script (like npm bin stubs) directly via `node-pty` instead of through a shell or Node.js.\n\n**Fix Applied:** The PTY host classifies the spawn failure as `E193` (`classifySpawnError()` in `main/src/ptyHost/ptyHostMain.ts`). `AbstractCliManager.ts` matches the error message (`error code: 193` or `not a valid Win32 application`) and retries with the Node.js fallback.\n\n**Location:** `main/src/ptyHost/ptyHostMain.ts` and `main/src/services/panels/cli/AbstractCliManager.ts`\n\n### Issue 2: Module Not Found (Fixed)\n\n**Error:**\n```\nError: Cannot find module 'C:\\Users\\<user>\\<repo>\\worktrees\\@anthropic-ai\\claude-code\\cli.js'\n```\n\n**Cause:** The npm bin stub at `node_modules/.bin/claude` uses a relative path:\n```bash\nexec node \"$basedir/../@anthropic-ai/claude-code/cli.js\" \"$@\"\n```\n\nWhen the `cwd` is set to the worktree directory, the relative path resolves incorrectly.\n\n## Solution Applied\n\n### Fix 1: Proactive Windows Node.js Fallback\n\nOn Windows, we now proactively use the Node.js fallback instead of waiting for failures:\n\n```typescript\n// In spawnPtyProcess() at main/src/services/panels/cli/AbstractCliManager.ts\nif (os.platform() === 'win32') {\n this.logger?.verbose(`[${this.getCliToolName()}] Windows detected, using Node.js fallback proactively`);\n nodeFallbackTools.add(needsNodeFallbackKey);\n}\n```\n\nThis bypasses the problematic shell script execution entirely.\n\n### Fix 2: Enhanced pnpm Path Resolution\n\nThe `findCliNodeScript()` function in `main/src/utils/nodeFinder.ts` was enhanced to properly handle pnpm's node_modules structure:\n\n1. **Detects pnpm directory**: Checks for `node_modules/.pnpm` directory\n2. **Known package mappings**: Has specific mappings for Claude Code and Codex packages\n3. **Generic pnpm search**: Falls back to searching for any matching package\n4. **Proper path construction**: Correctly builds paths like:\n ```\n node_modules/.pnpm/@anthropic-ai+claude-code@2.0.0/node_modules/@anthropic-ai/claude-code/cli.js\n ```\n\n## Technical Details\n\n### npm Bin Stub Structure (Windows)\n\nThe file at `Pane/node_modules/.bin/claude` is a shell script that:\n1. Sets `NODE_PATH` with pnpm-specific paths\n2. Executes: `node \"$basedir/../@anthropic-ai/claude-code/cli.js\" \"$@\"`\n\nThe `$basedir` is the directory containing the script, but when node-pty spawns with a different `cwd`, the relative path resolution breaks.\n\n### Why the Proactive Approach?\n\nThe reactive fallback (catching error code 193) wasn't enough because:\n- The spawn could \"succeed\" from node-pty's perspective\n- But the process would exit immediately with code 1 (MODULE_NOT_FOUND)\n- By the time we knew it failed, it was too late to retry\n\nBy proactively using Node.js on Windows, we avoid the shell script entirely and directly invoke the CLI script with the correct absolute path.\n\n## Files Modified\n\n1. `main/src/services/panels/cli/AbstractCliManager.ts` - Added:\n - Proactive Windows Node.js fallback detection\n - Error code 193 message matching (reactive fallback)\n2. `main/src/ptyHost/ptyHostMain.ts` - `classifySpawnError()` reports error 193 as `E193`\n3. `main/src/utils/nodeFinder.ts` - Enhanced `findCliNodeScript()` with:\n - pnpm structure detection\n - Known package mappings for Claude Code and Codex\n - Generic pnpm package search\n - Standard npm path resolution\n\n## Debug Logs to Check\n\n- `backend-debug.log` - Look for:\n - `Windows detected, using Node.js fallback proactively`\n - `Detected pnpm structure`\n - `Found pnpm CLI script at:`\n - `Using Node.js:`\n\n## Test Commands\n\n```bash\n# Rebuild main process after changes\npnpm build:main\n\n# Run in dev mode\npnpm electron-dev\n\n# Check logs (PowerShell)\nSelect-String -Path backend-debug.log -Pattern \"Claude|spawn|pnpm|NodeFinder\"\n```\n"}]