Skip to content

Latest commit

 

History

History
192 lines (131 loc) · 57.5 KB

CLAUDE.md

File metadata and controls

192 lines (131 loc) · 57.5 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Seahelm (sea + helm) is a native macOS terminal multiplexer built with Swift + AppKit. It integrates the Ghostty terminal engine (via C bindings through GhosttyKit.xcframework) to render terminals, keeps each pane alive in a session daemon of its own (seahelmd, Rust, in seahelmd/), and provides a dashboard UI for browsing git worktrees with agent status detection.

Build Commands

# First-time setup: init the Ghostty submodule + build/reuse GhosttyKit.xcframework
scripts/setup.sh

# Build into .build/, kill any running Seahelm, and launch the debug app
./run.sh                 # add --clean-restart to wipe .build first

# Run UI tests (regenerates the project, optionally filtered to one class)
./run_ui_tests.sh [TestClass]

Note: run.sh builds with -derivedDataPath .build, so the live app runs out of .build/, NOT the default ~/Library/Developer/Xcode/DerivedData bundle a bare xcodebuild or Xcode.app run would produce — when inspecting a running instance, use the bundle the live pid actually came from.

# Generate Xcode project from project.yml (requires xcodegen)
xcodegen generate

# Build
# NOTE: CodeEditSourceEditor pulls in the SwiftLint build-tool plugin, which
# requires trust validation. Headless/CLI builds must pass -skipPackagePluginValidation
# (in Xcode.app, click "Trust & Enable" once instead).
xcodebuild -project seahelm.xcodeproj -scheme seahelm -configuration Debug -skipPackagePluginValidation -skipMacroValidation build

# Run tests
xcodebuild -project seahelm.xcodeproj -scheme seahelmTests -configuration Debug test

# Run a single test class
xcodebuild -project seahelm.xcodeproj -scheme seahelmTests -configuration Debug test -only-testing:seahelmTests/ConfigTests

# Run a single test method
xcodebuild -project seahelm.xcodeproj -scheme seahelmTests -configuration Debug test -only-testing:seahelmTests/ConfigTests/testDefaultConfig

# Run UI tests — prefer ./run_ui_tests.sh, and targeted unit classes during
# active development. Each test runs the app in a /tmp/shui-* scratch home with
# its own core and seahelmd daemons; run_ui_tests.sh ends them after the run.
# A bare xcodebuild (or Xcode's ⌘U) does not: they keep running until the next
# test launch sweeps scratch dirs older than 30 min (UITestScratch.sweepStale).
xcodebuild -project seahelm.xcodeproj -scheme seahelmUITests -configuration Debug test

# Clean build
xcodebuild -project seahelm.xcodeproj -scheme seahelm clean

The project uses XcodeGen (project.yml) to generate the Xcode project file. After modifying project.yml, regenerate with xcodegen generate.

Helper scripts: scripts/build-seahelmd.sh <dest> builds the session daemon (seahelmd/, Rust) for the arch being built and installs it — the app's "Embed and sign seahelmd" phase runs it, so a build needs cargo, and on first build network: libghostty-vt is the release seahelmd/vendor/build-vt.sh pins (1.0.0, stable C ABI), on macOS the official XCFramework, fetched once per version and arch into ~/.cache/seahelm/libghostty-vt and checked against pinned SHA-256s (Linux and Windows build it from the release tarballs with zig 0.17). keep-vt's bindings are hand-written; seahelmd/crates/keep-vt/src/abi.rs pins every value and layout they use, checked by Rust at compile time and by build.rs as C _Static_asserts against the linked headers, so a library bump that moved one fails the build. scripts/disk-drop-recover.sh recovers from the workspace volume dropping out, which can wedge the session daemons (seahelmd list answers status=unreachable and remounting does not heal them): it captures each pane's claude --resume id, kills the app and every seahelmd process, clears the stale sockets, and relaunches the bundle — --check diagnoses only (exit 10 = wedged), --kill-strays also reaps other processes spinning on a dead cwd.

Architecture

Four-layer design:

  1. App Coordinators (Sources/App/)

    • MainWindowController — Window owner, embeds content VCs, positions traffic lights, handles keyboard shortcuts via SeahelmWindow subclass
    • TabCoordinator — Orchestrates tab switching, repo VC lifecycle (cached in repoVCs[repoPath]), status update forwarding, and session state save/restore
    • TerminalCoordinator — Split pane operations (split, close, move focus, resize), worktree deletion, surface manager ownership
    • PanelCoordinator — Manages side panels (AI panel, notification panel)
  2. UI Layer (Sources/UI/)

    • Dashboard/ — One layout, left/right (setupLeftRightLayout, accessibility id dashboard.layout.left-right): the fleet overview on one side as navigator, a FocusPanelView hosting the selected terminal on the other. DashboardOverviewView is that overview — every worktree a row, grouped by WorktreeGroupingMode (repository, status, activity time, or pane, which expands to a third level of pane rows). Edit mode swaps in EditLayoutContainerView: a terminal column and a file-preview column, each with an EditTabStripView, split by a draggable divider. The former Grid / TopSmall / TopLarge modes and the mini-card sidebar are gone; the "grid-aware" wording left in DashboardFocusController is a remnant, not a feature.
    • Repo/ — RepoViewController with SidebarViewController for worktree switching; SplitContainerView hosts split panes
    • Split/ — SplitContainerView renders SplitTree as frame-based leaf views with DividerView drag handles and dim overlays on unfocused panes
    • Chrome/ — Two-column WindowChromeController (sidebar/terminal headers, divider, collapse)
    • Dialog/ — Quick switcher (Cmd+P) and new branch dialog (Cmd+N)
    • SidePanel/ — Per-worktree side panel with Files / Changes tabs (WorktreeSidePanelViewController). Changes answers "what here still has to go in a PR": uncommitted work, then committed work the base lacks. A squash merge leaves git no ancestry to go on, so committed work is counted from the last merged PR's head when GitHub has one (MergedPRLookup), otherwise as what git merge-tree says merging into the base would change (GitDiff.branchChangedFiles). The GPUI client has the same two tabs in the same place: the sidebar header's folder and diff buttons swap the fleet in the left column for Files or Changes (clients/gpui/src/side_panel.rs over worktree_git.rs; the active button again, or ×, brings the fleet back), and a file or change opens as a tab in the main area above the terminals (preview_tabs.rs; the first tab is the terminals). It measures committed work by git merge-tree only: the core's pr.list carries no PR heads, and it has no recorded base, so it tries origin/main, origin/master, main, master. The old First Mate orders tab (BridgePanelViewController) and the inline command composer (InlineWorktreeCreateView) are gone: pending orders and the command line both live in Island/.
    • Diff/ — Code-review diff viewer (DiffReviewView + DiffSyntaxHighlighter)
    • Helm/ — GrowingTextView (extracted from the former CommandInputView), the keyboard-help overlay and the shortcut hint bar. The command line itself is the Island's (Island/OpenedSurfaceView, / @ # autocomplete); the sidebar has no composer.
    • Island/ — Floating "dynamic island" panel (morphs closed pill ↔ open surface), and First Mate's home in the app (docs/superpowers/specs/2026-11-04-first-mate-surfaces-design.md). Closed: usage and the fleet's status tiles, with the count of cards waiting — or, outranking both, an IslandWarning badge (CORE when seahelm-core is not answering, CTRL when another instance holds the control socket), shown in full as a banner when opened. Opened: one content-sized timeline under the usage bar. Its cap is 60% of the screen's visible height, with a 520 pt minimum; measured header, warning, and composer chrome can raise that cap to preserve at least 380 pt for the timeline. It combines First Mate's conversation (FirstMateLink.timeline, folded by ConversationItem) with durable card rows from the core timeline, merged by card_id; pending buttons always come from the live CardDeck and answers go through CardDeck.answer. Answered, dismissed, expired, and gone cards stay in place as one-line history. UI strings follow the language seahelm-core reports in autopilot.state (first_mate_language, zh or en; unset, the language most of the user's last 20 prompts are in), and config.json's raw key while the core does not answer. 待办 N filters to waiting cards and suggestions, while hidden conversation runs expand in place; suggestions are lighter, with the newest three shown before 更多建议. The same First Mate composer stays below the timeline; Esc clears the filter, then closes. A card that opens the island targets and briefly highlights its row; user opens start unfiltered at the bottom. ⌘J / ⌃⌃ / View ▸ First Mate and Settings ▸ Open First Mate open the timeline; ⌘J on an open island focuses the composer and scrolls to the bottom. The fleet column's First Mate dock and the main area's First Mate terminal are gone.
    • Settings/ — Tabbed settings window (the GPUI client's counterpart is one Settings page, the sidebar header's gear: autopilot_enabled, agent_yolo and install-hooks, written key by key into the same config.json by clients/gpui/src/user_config.rs, every other key kept) (WizardKit holds the controls the Telegram setup wizard is built from). There is no first-run wizard: a fresh config opens on the main window with the default agent picked from PATH (AgentDetector), and an empty fleet shows a single "Add project" row with nothing on the terminal side.
  3. Core Services (Sources/Core/, Sources/Status/)

    • Fleet — the app's copy of every pane (docs/app-reads-core.md). Layout is the app's (register / unregister / rehome / reorder); state is seahelm-core's (apply, from CoreClient). It decides nothing. Observers get a PaneChange (old/new status, completion). CoreClient is the app's one connection to the core: typed CoreEvents (pane, notice, unseen, cards, card answered, location, session, worktree discovered, raw), replaying panes, cards and session references on every (re)connect. CoreMessages serves timelines from the core; CardDeck mirrors the core's cards; FirstMateLink follows First Mate in the core; ChannelHub holds the chat channels; PaneInput types into panes.
    • WorktreeStatusAggregator — Aggregates per-pane statuses into per-worktree status, fires WorktreeStatusDelegate
    • Config — JSON config at ~/.config/seahelm/config.json (migrated from legacy ~/.config/amux on first launch). Every key decodes on its own (lenient): a value of the wrong type falls back to that key's default and the rest loads; a file that is not JSON at all is copied to config.unreadable-<time>.json and not written that run. Other programs write the same file (seahelm-core's autopilot.configure, the GPUI client, hand edits), so a save writes a key only if the app changed it since its last load or write and keeps the file's value otherwise (Config.merged)
    • StationRegistry — Global registry mapping surface IDs to Station instances
    • GatewayLink — the app's link to seahelm-gateway (seahelmd/crates/gateway, design: docs/seahelm-gateway-plan.md), the standalone service that now owns web access (the HTTP/WS server seahelm-web talks to, pairing codes, per-device tokens, share links, the VT relay) and the Telegram bot. The app only starts it (seahelm-gateway ensure at launch, binary in Contents/Resources/bin beside seahelm-core, else $SEAHELM_GATEWAY_BIN) and edits its settings over gateway.sock (GatewayClient: gateway.config.*, gateway.status, pairing.*, devices.*, share.*, telegram.validate_token / telegram.pair.*; GatewayEventStream follows events.subscribe). Settings ▸ Telegram / ▸ Pairing (GatewaySettingsPages), the pairing window and the header's share button all go through it, and say "seahelm-gateway is not running" when it does not answer. The GPUI client (Windows, Linux) has the same settings under its Settings ▸ Telegram and ▸ Pairing pages (the sidebar header's gear opens Settings as a page column beside the page, like the macOS Settings window; the main header's share button makes a link to the focused pane like the macOS one — share.create, on the clipboard, a popover with the link, its lifetime and revoke, and a way on to Pairing (share_popover.rs); clients/gpui/src/settings_page.rs holds the pages and SettingsSection, gateway_page.rs the gateway's two over gateway_client.rs, with its own one-line text_input.rs). The GPUI client's terminal has the macOS pane's right-click menu (pane_menu.rs: split, Preview of a worktree file named under the pointer, the link under the pointer, copy, paste, rename, sleep — the terminal detached, its session running on until Wake — and close); its fleet rows show the macOS app's colour labels, read from and written to the same worktree-labels.json and draws a pane's suggestion card on its ::seahelm-suggest:: line as the macOS one does (terminal_text::locate_suggestion; suggestions stay out of the card strip above the terminals and are counted on the First Mate dock). seahelm-web lays a worktree's panes out as the desktop window does: CoreLink hands seahelm-core every split tree with each sync (layouts.set, kept as sent, by client), and the page asks layout.get through the gateway, stacking the panes when no desktop shows the worktree. The gateway keeps its own files under ~/.config/seahelm/gateway/ and imported the legacy mqtt / host_gateway / telegram keys from config.json once; the app no longer reads or writes them. The Gmail mail channel is gone. Telegram facts measured when the bridge lived in the app, which describe the gateway's behaviour now: a conversation is a chat id (no forum-topic support, on purpose); from an allowed user (allowed_users, a hard gate — empty obeys nobody) a message is an order (in a group only a /command, a line starting @thebot, or a reply to the bot), from anyone else it is rule input; URLSession requests to Telegram hung in-process, and a fresh TCP+TLS handshake per call cost ≈1.7s, hence a pooled client; progress in a group is one edited message per pane, deleted at turn end, and in a private chat a sendMessageDraft board — drafts are private-chat only (TEXTDRAFT_PEER_INVALID in groups), one per chat, fade ~12s after the last call (docs say 30), so the board is re-sent every 8s; the Stop update is dropped unless allowed_updates asks for it and its draft_id arrives as a string. The Mini App host (tg.seahelm.dev) is deliberately not behind Cloudflare Access (its login page sends X-Frame-Options: DENY); on it the gateway refuses the pairing code and signs in only with verified Telegram launch data or an issued token.
  4. Terminal & System (Sources/Terminal/, Sources/Git/)

    • GhosttyBridge — Singleton wrapping the Ghostty C API (ghostty.h via bridging header)
    • Station — Wraps GhosttyNSView (NSView + Metal renderer + PTY); manages surface lifecycle, reparenting, and backend session attachment
    • SplitTree / SplitNode — Tree data structure for split pane layout; serializable for persistence in config
    • WorktreeDiscovery — Runs git worktree list --porcelain to discover worktrees

Key Patterns

Surface lifecycle: Station instances are long-lived — created once per split leaf, reparented between views (dashboard focus panel, repo tab split containers). reparent(to:) uses CATransaction to suppress animations, then defers size sync and focus restoration via two DispatchQueue.main.async passes. Surfaces are destroyed only on explicit deletion or app quit.

Tab switching: detachActiveTerminal() removes the active SplitContainerView from its superview before embedding the new tab's content. This prevents Z-order conflicts when surfaces are shared across views.

Split pane system: SplitTree is a binary tree of SplitNode (leaf or split with axis + ratio). SplitContainerView.layoutTree() computes frame-based positions for each leaf, places GhosttyNSView instances, adds DividerView drag handles, and updates dim overlays. Focus is tracked via tree.focusedId; GhosttyNSView.onFocusAcquired callback keeps the tree in sync when user clicks a pane.

File drop: dragging files (or an image out of a browser, Photos, Mail) onto a pane types their paths into that pane. SplitContainerView is the drag destination, not each GhosttyNSView: a DividerView's 16pt hit strip overlaps the pane edges, and the container already knows every leaf frame. draggingUpdated resolves the pane under the cursor (dropTargetStationId(at:paneFrames:); the seam goes to the nearest pane) and lights it with GhosttyNSView.setDropHighlight, an in-view sublayer like the inactive wash. Asleep panes, and panes covered by the preview overlay, refuse. TerminalDrop.resolveText takes the first of: file URLs → backslash-escaped paths (ShellEscape.backslash, native Ghostty's escaping) plus a trailing space; file promises → received into $TMPDIR/seahelm-drops/<uuid>/; bare image data → a PNG there; otherwise the dropped text verbatim. The text goes in through Station.sendText — ghostty_surface_text, the paste path, so bracketed paste applies and agent TUIs read a pasted image path as an image — and the drop focuses that pane and activates the app. In a pane whose agent is Claude Code (Fleet.pane(for:)), dropped images attach instead of being typed (AgentImagePaste): each goes onto the general clipboard as PNG and the pane gets a real ctrl+v key event — Claude Code's chat:imagePaste, which reads the clipboard through osascript … «class PNGf» — then the user's clipboard is restored unless they copied in the meantime. It must be a key event, not sendText: inside a bracketed paste ctrl+v is just a pasted byte. Other files in the same drop follow as paths.

Terminal palette follows the app theme, live: dark everywhere or light everywhere. terminal_theme_mode (app default / dark / light, TerminalThemeMode) resolves into GhosttyBridge.terminalIsDark; app tracks NSApp.effectiveAppearance — the theme toggle calls refreshColorScheme, and a KVO observer catches macOS switching on its own under theme_mode = system. When the resolved palette moves, refreshColorScheme rewrites the single theme = override (writeTerminalThemeOverride; one theme rather than light:…,dark:… so the pins work), hard-reloads the config (Ghostty's updateConfig fans change_config to every surface), sets every surface's color scheme (DEC 2031 reports) and posts .ghosttyColorSchemeDidChange so terminal chrome and the empty-state helm (HelmWatermarkView) restyle. Known cost: Codex asks over OSC 10;?/OSC 11;? once at startup, caches the answer for the life of the process and does not enable DEC 2031, so a flip under a running Codex leaves it painting from the stale reading — it only sets a background and leaves text at SGR 39, so a stale Latte reading gives a #e5e7eb user-message pill under Mocha's #cdd6f4 text (#e5e7eb pill + #393947 composer in one frame is the fingerprint). Restart the agent, or pin terminal_theme_mode. From b28f441 the palette was latched per run to avoid this; it was reverted because a window whose panes disagree with it was the worse trade. Separately, a session with no pane attached is answered by the daemon itself: seahelmd's grid stands in for the terminal with the palette current when the session was created (SEAHELMD_FACTS, SeahelmdLocator.sessionEnvironment), so an agent asking OSC 10/11 before its pane arrives still reads real colours.

Terminal persistence: every pane's terminal lives in a seahelmd daemon — one process per session, built from seahelmd/ and bundled as Contents/Resources/bin/seahelmd (SeahelmdLocator; verbs: attach, run, new, send, history, kill, list). The daemon owns the PTY and keeps the screen in libghostty-vt (keep-vt, from ttwwnn/keep), so a pane that attaches — the app relaunched, a web viewer — is repainted with both screens, history, modes and colours (Terminal::handover), and a slow client is repainted rather than queued without end. Sockets live in /tmp/seahelmd-<uid>/<name> (short: socket paths cap near 104 bytes). A pane runs seahelmd attach <name> (Station.seahelmdAttachCommand), which creates the session on the user's shell if it does not exist. An agent is launched as the session's own program, not typed into a shell: seahelmd new --hold 10 <name> -- zsh -lic '<exports> && cd && clear && <agent>; exec zsh -l' (SessionManager.detachedLaunchCommands) — the daemon holds it until the pane attaches, so it starts at the pane's size with the pane there to answer its startup queries, and nothing echoes. runtimeBackend is "seahelmd" or "local"; MainWindowController starts optimistically at "seahelmd" and falls back to "local" if the daemon is missing (local panes are plain processes with no persistence). Sessions are named seahelm-<parent>-<name> (. and : replaced with _, truncated past maxSessionNameLength) and created per split leaf; a health check runs 3s after creation (Station.recoveryDelay) and stale sessions trigger recoverSeahelmdSession (destroy + recreate). A session whose daemon is gone (a reboot) is recreated running the agent's resume command (AgentSessionRef). Split layouts are serialized to config for restore on relaunch.

Worktree discovery in the core: seahelm-core does not rely on the app to know the fleet (seahelmd/crates/core/src/discovery.rs). It keeps every repo it has seen in ~/.config/seahelm/core-repos.json (seeded from listed worktrees, panes, workspace_paths and gpui-projects.json) and every 2 minutes runs git worktree list --porcelain in each, skipping prunable entries, integration checkouts and throwaway/tool-state paths (the app's isEphemeralRepoPath / isToolStateRepoPath). Core::live_worktrees is the app's list ∪ panes ∪ that scan, so the observation log, PRs and facts see worktrees made while the app is closed; the app's list stays authoritative for layout.

Where an agent works: seahelm-core works it out from every hook (the cwd, and the directory of the latest tool call that names one: a leading cd, an Edit/Write path) and pushes pane.location {pane, worktree, location, created_by_agent}; an agent in a worktree nobody tracks yet comes as worktree.discovered. The app acts on them: the chrome title shows a pane whose agent is away (Station.hookLocation, PaneAwayIndicator), a discovered worktree is picked up by handleNewWorktreeFromHook (with its isEphemeralRepoPath / isToolStateRepoPath guards: auto-add is silent and never pruned), and auto-fork below. Panes are not moved automatically; seahelm pane move <pane> <worktree> is the manual path.

Pane fork: auto-follow is gone: a pane whose agent goes into another worktree stays filed where it was and its chrome title shows where the agent is (PaneAwayIndicator, from Station.hookLocation). The user can then fork it there: the header's branch button (shown only while the focused pane's agent is away in a tracked worktree), or seahelm pane fork <pane> [worktree] (pane.fork). TabCoordinator.forkPane sends the original pane Esc (Station.interruptTurn): its turn stops, but its process, seahelmd session and transcript all stay. It then starts claude --resume <id> --fork-session (AgentSessionRef.forkCommandLine; id from config.agentSessions, plus the yolo flag when agent_yolo, and --name <destination branch> — a fork copies the transcript, title included, so without its own name it read exactly like the pane it came from; claude writes the name as a custom-title, which SessionTitleLookup prefers) in a detached seahelmd session on a free name in the destination, and files a new pane on it there, retiring the destination's placeholder if it is one. The fork waits at its prompt. Claude finds a session by id from any directory, so no transcript copying is needed. Claude only: other agents have no forkArgv row. The Esc reads to the original agent as the user cutting it off, so once the fork is running the original pane is told (PaneFork.originNotice, sent once the fork is up — seahelm-core sees Claude in its pane and has numbered it, PaneFork.forkIsReady, since a notice written before the fork reads the original transcript ends up in the fork's own history — and the original turn has ended, PaneFork.noticeIsDue, at most 20s for the turn and 5 minutes for the fork): the work went to pane #n, the user did not stop it, do not carry on here. Its header then shows a ⑂ #n badge (TabCoordinator.forkRecord, in memory, dropped once the fork's pane is gone) that opens the fork. The #n is seahelm-core's and read when the notice goes in; a fork still unnumbered after the wait is named by its worktree.

Auto-fork into a new worktree: where the agent is comes from its tool calls as well as its hook cwd (seahelm-core's pane.location, ported from the app's former AgentWorkLocation). Claude Code resets the shell to the project directory after any command that leaves it, so an agent working in a sibling worktree (git worktree add ../repo-x) reports the main checkout on every event and writes cd ../repo-x && … into each command instead. seahelm-core keeps, per pane, the directory of the latest tool start that names one (a leading cd, or an Edit/Write path); a shell command with no cd clears it; events that name no place (Stop, prompts, reads) leave it alone. Status attribution still follows the cwd. The provider also records, per pane, the worktrees its agent created (AgentWorkLocation.createdWorktree: git worktree add [opts] <path> anywhere in a Bash command, resolved past a cd/git -C, or EnterWorktree's <cwd>/.claude/worktrees/<name>). When the agent's location is a tracked worktree it created and the pane is filed elsewhere, TabCoordinator.autoForkIntoCreated forks it there without being asked (PaneFork.shouldAutoFork: once per pane and destination, auto_fork_panes, default true). The original pane stays, its turn stopped. A cd into a worktree someone else made is a visit and forks nothing — that includes an agent told to go work in an existing worktree. The automatic fork gets a first message telling it to carry on in its new directory (PaneFork.continuePrompt, passed as claude's positional prompt), and it does not take focus. The record is in memory, so a worktree created before a relaunch no longer counts.

Pane names: the user can name a pane, and every client shows the name in place of the pane's own title. seahelm-core keeps the names by seahelmd session in ~/.config/seahelm/core-pane-titles.json (pane.rename {pane_id, title}; an empty title clears the name; seahelm pane rename <pane> [title…]). It reports a name as custom_title, and as display_title, in pane.list, and pushes pane.renamed. agent.forget drops the name together with the resume reference, so a session name that gets reused does not inherit it. In the macOS app the name is CoreClient.customTitles, it outranks everything in PaneTitleResolver, and it is set from the terminal's right-click "Rename Pane…". In the GPUI client the name shows beside the pane's #n in its corner, and clicking that badge opens a rename sheet (pane_extras.rs). On seahelm-web it is set from the pane menu's "Rename pane…", and seahelm-gateway forwards pane.renamed as pane.status.

Pane exec: pane.exec / seahelm pane exec <pane> [--timeout MS] <command…> runs a shell command and waits, returning its exit code and the output the pane shows for it; pane.run stays the "type + Enter" verb for anything (agent TUIs included). It only runs at an empty zsh primary prompt, and the shell itself decides (ShellRunIntegration). GhosttyBridge.configureShellIntegrationEnvironment points zsh's ZDOTDIR at ~/.config/seahelm/shell/zsh, whose .zshenv sources Ghostty's own (which restores the user's ZDOTDIR) and then seahelm-run.zsh. That script keeps ~/.config/seahelm/run/<session>.prompt ("<seq> <last status>") present exactly while the shell sits at its prompt (precmd writes it, first in line so $? is intact; preexec removes it), and binds _seahelm_run to the private key ESC[9013~. The app spools the command to <session>.cmd and presses that key through seahelmd; the widget takes it only if BUFFER/PREBUFFER are empty and CONTEXT == start (writing .claimed with the prompt's seq and line count) and otherwise hands it back (.refused, the draft untouched). Completion is .prompt returning with a higher seq. Nothing needs a Ghostty surface, so off-screen and asleep panes work. Output is cut from seahelmd history between the command's echo (matched across soft-wrapped rows, whitespace ignored) and the returning prompt (PaneExecOutput). Shells started before this, and non-zsh shells, never write .ready and are refused. Exit codes: the command's own, 124 when it outlives --timeout (it keeps running), 2 for a refusal.

Status: seahelm-core decides every pane's status (screen, hooks, OSC 7501, from seahelmd's snapshot) and pushes it; the app keeps none of the detection. CoreClient writes each pane.status_changed / pane.updated (info = the whole pane) into Fleet; pane explain is the core's. The core is the only receiver of hooks: seahelm-hook, seahelm-suggest v5 and the OpenCode plugin send to core.sock only. While the core is down the app shows what it last heard, says so on the island (IslandWarning.core, after a few seconds' grace), reconnects by itself, and runs seahelm-core ensure again every 15 s until one answers (CoreLink).

Suggestions: an agent offers next steps by ending its reply with a ::seahelm-suggest:: a | b line, which the core turns into a suggestion card. Only the reply's last line with text counts (past closing code fences), and only with the marker at its start (suggest::marker_line): a reply that quotes the marker in its prose neither makes buttons of that sentence nor loses it from the card's summary. It is told to by the core, not by any repository file: at every SessionStart of an agent running in a seahelm pane (SEAHELM_PANE_ID set), the core answers the hook with the guidance (seahelm_core_hooks::suggest::GUIDANCE) in the agent's own shape for added context — Claude Code and Codex hookSpecificOutput.additionalContext, Cursor additional_context — and the bridge prints it. OpenCode has no such hook; its seahelm_suggest tool's description tells it. In the macOS app the line itself is clickable (InlineSuggestions, GhosttyNSView+Suggestions.swift): while the pane's suggestion card is up, each option on screen gets an accent underline (a faint fill on hover) and the marker is dimmed; a click answers the card through CardDeck.answer, as the island does. The agent's text only says where: buttons are drawn only when the lowest marker line says exactly what the card says (same options, same order, one | between, following an agent's hard wrap up to 3 rows), re-placed every 0.5 s while a card is up; the grid is assumed to start at Ghostty's default 2 pt padding. Codex's hook command keeps stdout for this (2>/dev/null only). Older worktrees may still carry a <!-- seahelm:suggest:start --> block in their CLAUDE.md/AGENTS.md from when the app wrote one; nothing writes it any more.

PR and CI on the fleet: seahelm-core asks GitHub once per repo per minute for the 30 most recently updated PRs (head branch, state, draft, review decision, the head commit's check rollup), looks up by head branch any live worktree's branch they miss (batched per repo, cached: merged/closed never re-asked, "none" daily), and serves them as pr.list; WorktreePRStore asks the core every 15 s. buildWorktreeRowInfos reads it for every worktree but main and the integration checkout: the row's second line shows #12 ✓ approved (✓ passing / ✕ failing / ● running; merged, closed, draft spelled out), the context menu offers Open Pull Request, and fleet.groups items carry it as pr for the web list.

Unseen completion and notices: both are the core's decisions. The app reports what it shows (client.visible {client: "macos", worktrees, app_active}, kept per client in the core and unioned with the GPUI client's) and forwards a remote client's pane.seen; the core marks and clears unseen (pane.unseen_changed) and sends pane.notice, which the app only presents (NotificationManager.show: history and banner; seahelm-gateway sends it to Telegram). The fleet draws unseen as a blue ● dot and a "Finished" group.

Worktree setup hook: a repo's .seahelm/setup.sh (the new worktree's own copy, else the main checkout's, so an untracked script still applies) runs in a new worktree's first pane before its agent: WorktreeSetupHook.launchLine makes the detached session's command <setup> && <agent>, so a failed setup leaves the pane at the shell with the script's error on screen and no agent. The script runs in the new worktree with SEAHELM_WORKTREE and SEAHELM_REPO_ROOT set; an executable script runs by its shebang, anything else through sh. The opening brief waits up to 15 minutes for the agent when a setup ran. Worktrees made from the Cmd+N dialog (no agent) run the setup alone.

First Mate: lives in seahelm-core and nowhere else (seahelmd/crates/core/src/first_mate/, docs/first-mate-core.md): its session seahelm-first-mate under ~/.config/seahelm/first-mate/, the repo rules in .seahelm/automations.yml, the ledger, the audit log, its gates and its cards. The core runs it whenever config.json has autopilot_enabled (and it holds first-mate/owner.lock); there is no autopilot_owner. The app keeps a FirstMateLink: state from autopilot.state, the user's words by autopilot.say, Stop as Esc into its session, its conversation from CoreMessages, and its conversation; its answers to chats and its audit lines reach Telegram through seahelm-gateway. Settings ▸ First Mate still writes the switch, the defaults and a repo's rules file; the core reads them. The app never sweeps First Mate's session as an orphan. Habits (docs/first-mate-autonomy.md, phase 3b; first_mate/habits.rs, sweep.rs, learning.rs): ~/.config/seahelm/first-mate/habits/<repo-key>.yml and _global.yml (seeded with delete-merged-clean at ask), each change kept under habits/.history/; levels observe < suggest < ask < auto, read as at most what the core granted (habits/.granted.json), raised only by the user's yes on a habit.promote: card (observe → suggest is the core's own count) or, for a level written into the file by hand, a habit.confirm: card (no writes the granted level back), lowered automatically. A when that admits uncommitted, untracked, ignored or unpushed work, or busy panes, is never auto. The daily sweep (and on turning First Mate on) deletes auto matches through the core's worktree.delete (how: habit:<id>), puts ask matches on one batched card, lists suggest ones in a line — those lines are note rows the core writes into First Mate's timeline (Kind::Note, no model turn; the island and the web draw a line of note). habits.list / seahelm habit list are read-only. Inventory (phase 4, D6; first_mate/inventory.rs): the first time First Mate is turned on (flag inventory_at in habits/.sweep.json), and on habits.inventory / seahelm habit inventory (--preview raises nothing), the core measures every live linked worktree and raises one card per non-empty group — PR merged / PR closed / no PR (a repo with no GitHub remote counts as no PR) and idle 30+ days, each with nothing to lose, and an at-risk group (the derived fact at_risk: true) that offers no delete. Delete deletes the group now (each re-measured and re-matched, how: inventory, the card id) and grants ask in _global.yml by the answer — the merged group to the general delete-merged-clean, the others to inventory-<group>; keep writes a keep habit; ask-me-each-time an observe one; each answer is one decisions in evidence, a delete also an approval. Open/draft PRs, busy panes, a PR still unknown and repos whose rules deny deletion are left out; the sweep waits while an inventory is due or measuring. Interruption budget (phase 5, D15–D18; first_mate/presence.rs, budget.rs, brief.rs, lang.rs): the core learns when the user is there from moments — keys or the mouse in a seahelm window (client.activity, at most once a minute: the app's local NSEvent monitor in TabCoordinator, the GPUI workspace's capture listeners; only that it happened), a desktop client coming to the front or changing selection, the user's prompts in panes unless something typed into the pane just before, card answers and words to First Mate with their _meta.via channel — into first-mate/activity.json (per-weekday quarter-hour profile, last seen per channel, last arrival; presence.state), kept whether First Mate is on or not. The daily brief is composed by the core (no model turn: done since the last brief, cards waiting, suggest worktrees, habit changes and expiries; nothing to say, no brief), written into First Mate's timeline as a brief row (the island and the web draw it as a block), and — when Telegram is the channel and gateway.status says Telegram is reachable — published as first_mate.brief, which seahelm-gateway sends to the default chat. It goes out on arrival (first signal after 4 h, brief day starting 04:00), or to Telegram once if the user has not shown up by their learned usual start + 1 h (not sent, and not counted, while Telegram is unreachable); once a brief day, never in quiet hours (config.json first_mate_quiet_hours, e.g. "23:00-08:00", together with every repo's). Cards: answering ones (approvals while the user spoke, "Let me pick", D12 confirmations, the inventory) and time-sensitive ones (a ci.failed rule's approval, which also reaches Telegram as every First Mate card does) go up at once, uncounted; proactive ones (sweep batch, promotion offers, other rules' approvals such as cleanup-merged, an unprompted proposal) only while the user is active and under 3 a day, else held; the brief puts at most 3 held cards up and lists the rest. A card unanswered for 3 days is withdrawn with a card.expired observation; only action cards (sweep batch, delete approvals) count it as ignored (two in a row demote), promotion and confirmation cards just wait for fresh evidence. config.json first_mate_language (en or zh) sets the language of the brief, the core's note rows and First Mate's own replies (the audit stays English); unset, it follows the user — Chinese when most of their last 20 prompts in activity.json hold a Chinese character (Lang::detect, at least 5 to go by), else English — and autopilot.state says so (language, language_auto). Phase 6 adds generalisation.rs: a capped learn.review delivered after a full day enabled and 30 min idle, new global/project habits proposed on cards (existing ids refused) via habits.propose / seahelm habit propose --json, explicitly flagged judgement conditions (ordinary scalar YAML conditions refused, never sweep-matched, named calls capped at ask), and tuning.rs bounded state in first-mate/budget.json driving N/M, expiry and daily cap. Every tuning move is audited and noted in the brief. Built-in card labels follow first_mate_language; clients answer by index or shown label, resolved to canonical keys in First Mate (old English cards retain their shown English labels). A habit's own deletions no longer ping Telegram one by one (the gateway skips rule: habit: audit lines).

First Mate phase 7 (first_mate/memory.rs, routing.rs, autonomy D23–D26): project memory stays in ~/.config/seahelm/first-mate/memory/<repo-key>.md, is written through memory.note, versioned and undoable, and only a trusted core-sealed revision is injected (2,000 characters). External edits need the user's exact-revision confirmation; rejection restores the core-remembered version. The core retains its last revision in process memory, so rewriting both on-disk files cannot change an active core's trusted memory. SessionStart hooks and project events include it; new-agent briefs carry only a pointer. Injection keeps whole goal/milestone/don'ts entries first, then newest notes, with a real total/capacity warning. /notes [undo] @repo works from the island and chats (not /memory: that is Claude Code's own). A project with 3+ worktrees made in 7 days and an empty memory gets one proactive card asking for its final goal (first_mate/goal_offer.rs, first-mate/goal-offers.json): "tell" starts a First Mate turn that asks in one line and stores the user's own words as goal:; later (or dismissing) asks again after 14 days; don't is for good. First Mate may write notes; only the user may undo memory or confirm external edits. Routing uses the original user message and known project names, approved aliases or matching GitHub remotes; a mandate starts once per successful turn (another start asks on a card), otherwise ranked project cards teach the normal sealed habits. Short aliases require a separate user yes.

Research schedules (autonomy phase 9, D31–D34): global first-mate/schedules.yml, peer-checked schedule.* RPCs and seahelm schedule add|list|remove|run-now. The core starts budgeted report agents in ordinary worktrees of ~/seahelm-research, initialized and registered on first use, detects committed reports and sends research.done to First Mate. First Mate stores a short change summary through research.summary; the next daily brief includes it and the report path. Three unread reports trigger a user-answered stop card. The core waits for idle or deadline, verifies the run is a linked research worktree, closes its session, fast-forwards research main and removes the worktree. Integration failures abort any merge, notify once and stop cleanup. Leftovers commit only reports/ and tracked changes; other untracked/ignored data keeps the worktree intact. Launch slots expire after 120 seconds; failed launches write a note. Stop-job edits preserve unrelated YAML bytes. Research concurrency is one by default; vanished sessions or runtime plus 30 seconds end a run. Only core-repos.json and discovery events register the repo; the app owns workspace_paths. schedule.list is readable by panes; mutations are user-only. research.summary requires the real First Mate seahelmd ancestry and metadata. Three summary attempts fall back to a “no summary” brief entry.

Auto-update: Sparkle 2 (Sources/Update/UpdateDriver.swift, Sources/App/UpdateCoordinator.swift). UpdateDriver implements SPUUserDriver so updates render in the inline UpdateBanner instead of Sparkle's modals; it stashes each pending Sparkle reply block until the matching banner button is clicked. There is one appcast per CPU arch (we ship arch-specific zips and Sparkle has no arch filtering), so the feed URL is supplied at runtime by UpdateCoordinator.feedURLString rather than baked into Info.plist. SUPublicEDKey comes from the SPARKLE_PUBLIC_ED_KEY build setting; empty means Sparkle refuses to start. scripts/package_release.sh signs Sparkle's nested helpers (Autoupdate, Updater.app, Downloader.xpc, Installer.xpc) inside-out, then generates and signs dist/appcast-<arch>.xml from the final notarized zip using SPARKLE_PRIVATE_KEY.

Focus management: GhosttyNSView overrides becomeFirstResponder/resignFirstResponder to call ghostty_surface_set_focus() and apply visual shadow state. mouseDown calls makeFirstResponder(self). Split pane operations defer makeFirstResponder via DispatchQueue.main.async to run after Ghostty's own deferred focus handling.

Thread safety: ghosttyLock (NSLock) serializes all Ghostty C API calls between the background status poll and main-thread input. Key input deliberately does NOT hold the lock (Ghostty is internally thread-safe for keys, and holding it would deadlock on synchronous callbacks).

Window key handling: SeahelmWindow.performKeyEquivalent handles split pane shortcuts (Cmd+D / Cmd+Shift+D split, Cmd+Option+Arrow move split focus, Cmd+Ctrl+Arrow resize) before menu key equivalents. sendEvent intercepts Escape.

Agent Orchestration ("the fleet")

The structure is plain: one app ⊃ many projects (repos) ⊃ many worktrees ⊃ many panes, each pane running an agent. Fleet.shared is the app's copy of every pane; seahelm-core decides what each is doing. (Note: Station is taken for the surface wrapper, so it names none of these tiers.)

This used to be a nautical metaphor — Ship / Deck / Cabin / Sailor for app / repo / worktree / pane — and older commits, branch names and issues still speak it. The rename dropped it because Sailor in particular had come to mean two things at once, the pane and the agent inside it, which is why the types below split along that line rather than mapping one-to-one onto the old names.

  • Pane / agent model (Sources/Core/): AgentType = agent kind, AgentStatus = state enum (owns the status-dot color and the rollup priority), PaneInfo = per-pane snapshot as the core reports it, PaneChange = one change to it. AgentChannel talks to a pane's terminal (SeahelmdChannel, through PaneInput). PaneStatus is a different type: the per-pane snapshot the worktree rollup (WorktreeStatusAggregator, a view over Fleet) consumes.

  • Manifests (Sources/Status/Manifests/, AgentManifest, ManifestStore): agent identities and message settings the app still reads; status rules are evaluated by the core (crates/core-scan).

  • Control socket & CLI (Sources/Core/): ControlSocketServer listens on a 0600 Unix socket at ~/.config/seahelm/seahelm.sock speaking newline-delimited JSON-RPC (ControlProtocol = transport-free router + ControlDataSource seam; SeahelmControlDataSource bridges it to live app state). SeahelmCliInstaller installs ~/.local/bin/seahelm (a Rust program, seahelmd/crates/cli, bundled as Contents/Resources/bin/seahelm) so agents run e.g. seahelm pane run <id> npm test — this backs the seahelm skill. The CLI talks to two sockets, split as the target architecture splits control: listing, reading, typing into and waiting on panes (pane list|read|run|send-text|send-keys|explain, wait output|agent-status, events, ping) go to seahelm-core first, so they work with every client closed and on Windows; the app answers them only when the core cannot be reached or does not know the pane yet (one split a moment ago). Worktree create/delete and pane close go to the app first (it asks before losing work) and to the core without one; split, focus, zoom, move, fork, sleep/wake, options, exec and layouts are the app's alone. A call that reached either side is never re-sent. The core speaks the app's dialect for these: pane.read source: visible is the viewport, keys are KeyChord's (crates/core/src/keys.rs), an unknown pane is -32004 pane not found, and it announces each call as pane.presence, which the app turns into the same pill. The chat/Helm command language is seahelm-core's (command.run, crates/core-command; design: docs/command-redesign.md); the app parses and executes nothing. Sources/Core/Command/ keeps what the app still needs around it: CommandSpecs (the verb table, for the Helm menu), CommandReply / CommandButton (a reply as the app shows it), FleetIndex (the fleet by #n and @name, for the Helm menu's autocomplete) — the desktop talks to the dashboard selection; each chat's binding is kept by seahelm-gateway. Panes are addressed by a stable #n that seahelm-core mints (crates/core-command/src/handles.rs, served in pane.list); the app keeps no numbering of its own and shows the core's (CoreLink.handles, refreshed with every sync), so a pane the core has not listed yet shows no #n. Worktrees and repos are addressed by @name. EventHub is the fan-out broker (bounded ring buffer, events_after replay) for control-socket subscribers. pane.send_keys presses real keys (KeyChord: letters, digits, punctuation, F-keys, nav keys, ctrl/alt/shift) — never text, since text is the paste path and a TUI ignores a pasted digit; alt is ESC-then-key for characters (Ghostty treats Option as a composing key unless macos-option-as-alt) and the xterm ESC[1;3x form, written into the seahelmd session, for keys like alt+left. Presence: the CLI sends params._meta = {caller: $SEAHELM_PANE_ID, note} on every call; for pane-acting methods (ControlRouter.presenceMethods, and the pane a pane.split creates) PanePresence shows a pill on the target pane naming the calling pane's agent and #n handle plus the seahelm --note … text, with an accent frame, for 6s after the last call. Clicking it focuses the caller. Display only — it never changes routing.

  • Hooks installers (Sources/Core/*HooksSetup.swift, *Installer.swift): non-destructively install per-agent shims so third-party agent CLIs report lifecycle events back to seahelm. SeahelmHookInstaller copies ~/.local/bin/seahelm-hook from the bundle (a Rust program, seahelm-core-hooks' seahelm-hook binary — the same bridge as seahelm-core hook, wire::run): it sends the payload to the core and prints only what the core hands back, which is only ever a SessionStart's added context; ClaudeHooksSetup/CodexHooksSetup/CursorHooksSetup/OpenCodePluginInstaller wire that bridge into each tool's config. AgentHookInstaller installs them at launch, limited to enabled_hook_agents when set (all of them otherwise).

  • Cards (Sources/Core/Card.swift): everything waiting on the user is a core card (cards.list / cards.changed): agent questions, screen choices, suggestions, First Mate's approvals and proposals. The app raises none of its own: the integration reports it used to raise went with the integration feature, and CardDeck dismisses any report card still in the core's queue. CardDeck mirrors them; the island and the web (and Telegram, through seahelm-gateway) render Card; every answer goes through cards.answer and the core presses the keys. Only the user answers: the core reads the socket peer's pid from the kernel and refuses a process inside a pane under an AI agent (the user's own shell in a pane passes, unless something typed into that pane within 90 s) (seahelmd/crates/core/src/peer.rs, docs/first-mate-autonomy.md D14); the app's own socket answers no cards.

  • Usage (Sources/Usage/): seahelm-core reads Claude's and Codex's rate limits and today's tokens (usage.summary, crates/core/src/usage.rs); UsageSummaryStore asks it every 30 s and hands the snapshots to IslandModel — UsageSummaryFormatter.readouts turns them into UsageReadouts, which the closed pill rotates one window at a time (left wing, yielding to pending orders) and the opened header shows in full on the title row. Claude only reports rate limits inside its statusline payload, so ClaudeStatuslineBridgeInstaller (run at window setup) wraps the user's statusLine command to tee that payload into ~/Library/Caches/seahelm/claude-statusline.json, which the core reads. Task sources (phase 8, D27–D30; first_mate/task_sources.rs): user-only seahelm task-source add|list|remove|test; per-repo local sources, separate 0600 first-mate/secrets.json for Jira Cloud basic auth and Server/DC bearer PAT. Bounded background reads default to 30 minutes; internal task.new candidates only enter the daily brief’s “Could do” section, with at most one proactive card offering up to three tasks. Only its user answer may create a worktree; task starts and passes become ranking observations. No GitHub/Jira writes. Sources need not be added by hand: when a worktree is made for an issue (an issue link to the repo, issue 12 / #12 in its task, or a branch whose last part starts with the number) in a repo with a GitHub remote and no source, First Mate offers once per repo, on an answering card, to watch its issues — assigned to the user, all, or not (first_mate/source_offer.rs, state in first-mate/source-offers.json); only the user's yes adds the source. Project-memory integration has an explicit phase 7 hook.

  • seahelm-core (seahelmd/crates/core*, design: docs/status-core-port.md, crate contract: docs/core-crates.md): the status detection above, ported to Rust as a headless per-user service so non-macOS clients have it. seahelm-core serve listens on ~/.config/seahelm/core.sock (same JSON-RPC shape as the app's socket) and reads each registered pane's screen with seahelmd snapshot (viewport, title, OSC 9;4 progress, the OSC 7501 root record — seahelmd now keeps 7501 itself and answers its support query while detached). Panes are keyed by seahelmd session name; a client's own id is an alias. Hooks reach it without the app: the app's bridge seahelm-hook sends every payload to the core's socket only (the app receives no hooks), and on a machine without the app seahelm-core install-hooks wires Claude Code and Codex to seahelm-core hook <source>, the cross-platform bridge (named pipe on Windows; it leaves events already running seahelm-hook alone, so nothing arrives twice). The GPUI client (clients/gpui) registers its panes with it. It also holds the cards — every "waits on you" item (agent questions, screen choices, suggestions; client-raised reports and First Mate approvals/proposals) — in one queue (core-registry/src/cards.rs), served as cards.list / cards.answer / cards.dismiss / cards.raise / cards.clear and pushed as cards.changed. The core performs every answer itself through seahelmd (typed option, arrow keys from the dialog's cursor, multi-select ticks, follow-up questions, the review page's Return), so renderers never press keys; a raised card's answer goes back to its owner as card.answered. The GPUI client draws the selected worktree's cards above its terminals. The core runs First Mate (seahelmd/crates/core/src/first_mate/, same session, directory, rules, ledger and audit the app used to have), whenever autopilot_enabled is set and it holds first-mate/owner.lock. First Mate's seahelm command is then a shim onto seahelm-core cli, and the core gates and performs its actions itself (actions.rs). It also keeps every pane's message timeline (crates/core-messages: user prompts, tools, decisions, turn edges, final messages, and the prose between tool calls read from the agent's transcript), served as message.snapshot / message.history / message.subscribe and compared against the app's with seahelm-core compare-messages. It also runs the command language (crates/core-command, command.run {text, context}): cut on 2026-11-04 to /go #n|@worktree|mate, /new, /status, /show, /help plus prose for whoever the conversation talks to, with no confirmations; the caller keeps the binding (see docs/command-redesign.md §0). The app ships seahelm-core beside seahelmd (Contents/Resources/bin), starts it, mirrors its panes and worktrees into it every 2 s, and runs the desktop's Helm line through command.run (chats reach it through seahelm-gateway) (CoreLink, MainWindowController.routeCommand), taking the core's #n handles and adopting sessions the core starts for /new; when the core does not answer, the line is refused, not run. Plan and status: docs/first-mate-core.md. To test it, isolate everything: scratch HOME, SEAHELM_CORE_SOCKET, and SEAHELMD_DIR — seahelmd session names are machine-wide, and a scratch core taking First Mate would replace the live app's seahelm-first-mate session. The seahelm CLI follows SEAHELM_CORE_SOCKET as well as SEAHELM_SOCKET_PATH, so a scratch test of it needs both. When testing with a real agent in a scratch seahelmd session, point SEAHELM_SOCKET_PATH somewhere dead: seahelmd sets SEAHELMD_SESSION, so the agent's hooks otherwise reach the live app and land on the worktree's first pane.

Keyboard System (modal)

The modal Vim/which-key system described in docs/keyboard-redesign.md (NORMAL/INSERT KeyboardMode, KeyboardModeController, Keymap, LeaderMenu) is gone, and so is the last transient KeyboardSubstate — it only ever marked the inline create form, which went with the sidebar composer. Sources/App/KeyboardMode.swift now holds just FocusDirection. Whether bare keys navigate is decided by who owns focus (RegionFocusController); GlobalKeymap centralizes window-level Cmd shortcuts, and SeahelmWindow.performKeyEquivalent (below) still handles the split-pane Cmd shortcuts.

Key Technical Details

  • Swift 5.10, macOS 14.0+ (Sonoma), AppKit (not SwiftUI)
  • Ghostty C interop via seahelm-Bridging-Header.h → ghostty.h; GhosttyKit.xcframework provides libghostty
  • Links against: Metal, QuartzCore, IOSurface, Carbon, UniformTypeIdentifiers, libghostty, libc++
  • SPM dependencies: CodeEditSourceEditor (+ CodeEditLanguages) for the embedded code editor; otherwise system frameworks + Ghostty
  • Delegate pattern used throughout (not Combine/async-await for UI updates)
  • GhosttyBridge.shared is the singleton entry point for all terminal operations
  • StationRegistry.shared is the global surface lookup table (surface ID → Station)
  • Fleet.shared is the app's copy of every pane (layout from the app, state from seahelm-core)
  • Tests use XCTest with @testable import seahelm; test files in Tests/ directory; no external test dependencies
  • Config decodes every key leniently (KeyedDecodingContainer.lenient) for backward compatibility with older config files
  • ghostty/ directory contains the vendored Ghostty source (read-only reference, not built from here)