The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(desktop): reopen recently closed Swarms
dee10ae8f445568
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 7c588788c..633d86068 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -118,6 +118,7 @@ class _SwarmScreenState extends State<SwarmScreen> {final payload = {'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,'activeId': app.activeSwarmId,+ 'canReopen': app.canReopenClosedSwarm,'attention': _attention,'tabs': [for (final swarm in app.swarms)@@ -151,6 +152,8 @@ class _SwarmScreenState extends State<SwarmScreen> {switch (call.method) {case 'new':app.newSwarm();+ case 'reopen':+ app.reopenClosedSwarm();case 'select':if (args['id'] is String) app.selectSwarm(args['id']);case 'close':@@ -456,6 +459,7 @@ class _SwarmScreenState extends State<SwarmScreen> {...buildShortcutBindings(handlers: {ShortcutAction.newSwarm: app.newSwarm,+ ShortcutAction.reopenClosedSwarm: app.reopenClosedSwarm,ShortcutAction.closeSwarm: () =>app.closeSwarm(app.activeSwarmId),ShortcutAction.renameSwarm: () => _rename(app.activeSwarmId),diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dartindex 2041133e3..53db8e8ae 100644--- a/desktop/lib/shortcuts/app_shortcuts.dart+++ b/desktop/lib/shortcuts/app_shortcuts.dart@@ -47,6 +47,7 @@ import '../logging/debug_surface.dart';enum ShortcutAction {newSwarm,closeSwarm,+ reopenClosedSwarm,renameSwarm,nextSwarm,previousSwarm,@@ -449,6 +450,16 @@ const kSwarmShortcuts = [label: 'New swarm',group: ShortcutGroup.navigate,),+ AppShortcut(+ action: ShortcutAction.reopenClosedSwarm,+ activator: SingleActivator(+ LogicalKeyboardKey.keyT,+ meta: true,+ shift: true,+ ),+ label: 'Reopen closed swarm',+ group: ShortcutGroup.navigate,+ ),AppShortcut(action: ShortcutAction.closeSwarm,activator: SingleActivator(LogicalKeyboardKey.keyW, meta: true),diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex af01ccf7d..c8300a9e7 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -342,6 +342,10 @@ class AppNotifier extends ChangeNotifier {int _nextSwarmId = 2;int _nextWallpaper = 1;static const maxSwarms = 24;+ static const maxClosedSwarms = 24;+ final List<ClosedSwarm> _closedSwarms = [];+ bool get canReopenClosedSwarm =>+ _closedSwarms.isNotEmpty && swarms.length < maxSwarms;Swarm get activeSwarm => swarms.firstWhere((s) => s.id == _activeSwarmId,orElse: () => swarms.first,@@ -412,15 +416,27 @@ class AppNotifier extends ChangeNotifier {Future<void> closeSwarm(String id) async {final index = swarms.indexWhere((s) => s.id == id);if (index < 0) return;+ // Held ⌘W must not manufacture and close an endless sequence of blank+ // welcome tabs, evicting the real work from recently closed history.+ if (swarms.length == 1 &&+ swarms.single.panes.isEmpty &&+ swarms.single.name == 'New swarm' &&+ swarms.single.presets.isEmpty) {+ return;+ }final removed = swarms.removeAt(index);+ Swarm? replacement;if (swarms.isEmpty) {- swarms.add(- Swarm(- id: 'swarm-${_nextSwarmId++}',- wallpaper: _nextWallpaper++ % swarmWallpapers.length,- ),+ replacement = Swarm(+ id: 'swarm-${_nextSwarmId++}',+ wallpaper: _nextWallpaper++ % swarmWallpapers.length,);+ swarms.add(replacement);}+ _closedSwarms.add(+ ClosedSwarm(removed, index: index, replacement: replacement),+ );+ if (_closedSwarms.length > maxClosedSwarms) _closedSwarms.removeAt(0);if (_activeSwarmId == id) {_activeSwarmId = swarms[index.clamp(0, swarms.length - 1)].id;}@@ -436,6 +452,47 @@ class AppNotifier extends ChangeNotifier {}}+ void reopenClosedSwarm() {+ if (_disposed || !canReopenClosedSwarm) return;+ final saved = _closedSwarms.removeLast();+ if (swarms.length == 1 && saved.replacesUntouchedWelcome(swarms.single)) {+ swarms.clear();+ }+ final pool = {+ for (final pane in allPanes) (pane.machineId, pane.agentId): pane,+ };+ var id = saved.id;+ while (swarms.any((swarm) => swarm.id == id)) {+ id = 'swarm-${_nextSwarmId++}';+ }+ final restored = Swarm(id: id, name: saved.name, wallpaper: saved.wallpaper)+ ..gridColumns = saved.gridColumns+ ..presets.addAll(saved.presets);+ for (final entry in saved.panes) {+ final pane = pool.putIfAbsent(+ (entry.machineId, entry.agentId),+ () => TerminalPane(+ id: _nextPaneId++,+ machineId: entry.machineId,+ agentId: entry.agentId,+ )..composerVisible = entry.composerVisible,+ );+ restored.panes.add(pane);+ if (entry.pinnedSlot != null) {+ restored.pinnedSlots[pane.id] = entry.pinnedSlot!;+ }+ }+ int? paneAt(int index) => index >= 0 && index < restored.panes.length+ ? restored.panes[index].id+ : null;+ restored.focusedPaneId =+ paneAt(saved.focus) ?? restored.panes.firstOrNull?.id;+ restored.previousPaneId = paneAt(saved.previousFocus);+ restored.zoomedPaneId = paneAt(saved.zoom);+ swarms.insert(saved.index.clamp(0, swarms.length), restored);+ selectSwarm(restored.id);+ }+/// Capture the destination before any network wait or tab change.Future<void> addAgentToSwarm(String machineId,@@ -1663,6 +1720,7 @@ class AppNotifier extends ChangeNotifier {}Future<void> login() async {+ _closedSwarms.clear();_lastError = null;status = AppStatus.bootstrapping;signingIn = true;@@ -1712,6 +1770,7 @@ class AppNotifier extends ChangeNotifier {void cancelLogin() => cliLogin.cancel();Future<void> logout() async {+ _closedSwarms.clear();// Best-effort and fire-and-forget: local state is cleared below regardless of whether the CLI// process could be reached, but a real `harness logout` clears its saved session so the NEXT// launch doesn't silently sign back in without ever showing the login screen.@@ -1722,6 +1781,7 @@ class AppNotifier extends ChangeNotifier {// Tiles go, the saved layout stays: signing out and back in is the same// person at the same desk, and the file is only read once machines exist.await _closeAllPanes(persist: false);+ _closedSwarms.clear();await _pool?.closeAll();_pool = null;_cliEndpoint = null;@@ -4490,6 +4550,7 @@ class AppNotifier extends ChangeNotifier {@overridevoid dispose() {_disposed = true;+ _closedSwarms.clear();_daemonSupervisionTimer?.cancel();_updateCheckTimer?.cancel();_environmentRecheckTimer?.cancel();diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dartindex 584958597..b7a371d0a 100644--- a/desktop/lib/state/swarm.dart+++ b/desktop/lib/state/swarm.dart@@ -57,6 +57,56 @@ class Swarm {}}+/// Session-free history for an accidental tab close. Terminal buffers and+/// controllers are released normally; a reopened view reuses any live peer.+class ClosedSwarm {+ ClosedSwarm(Swarm swarm, {required this.index, Swarm? replacement})+ : id = swarm.id,+ name = swarm.name,+ wallpaper = swarm.wallpaper,+ gridColumns = swarm.gridColumns,+ focus = swarm.panes.indexWhere((p) => p.id == swarm.focusedPaneId),+ previousFocus = swarm.panes.indexWhere(+ (p) => p.id == swarm.previousPaneId,+ ),+ zoom = swarm.panes.indexWhere((p) => p.id == swarm.zoomedPaneId),+ presets = Map.unmodifiable(swarm.presets),+ panes = List.unmodifiable([+ for (final pane in swarm.panes)+ (+ machineId: pane.machineId,+ agentId: pane.agentId,+ composerVisible: pane.composerVisible,+ pinnedSlot: swarm.pinnedSlots[pane.id],+ ),+ ]),+ replacementId = replacement?.id,+ replacementWallpaper = replacement?.wallpaper;++ final String id;+ final String name;+ final int index;+ final int wallpaper;+ final int? gridColumns;+ final int focus;+ final int previousFocus;+ final int zoom;+ final Map<int, PanePreset> presets;+ final List<+ ({String machineId, String? agentId, bool composerVisible, int? pinnedSlot})+ >+ panes;+ final String? replacementId;+ final int? replacementWallpaper;++ bool replacesUntouchedWelcome(Swarm swarm) =>+ swarm.id == replacementId &&+ swarm.name == 'New swarm' &&+ swarm.wallpaper == replacementWallpaper &&+ swarm.panes.isEmpty &&+ swarm.presets.isEmpty;+}+const swarmWallpapers = ['dusk','abstract',diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex 8d88b44e4..74977b23e 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -11,6 +11,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {private var observers: [NSObjectProtocol] = []private var configured = falseprivate var actionsEnabled = false+ private var canReopen = falseinit(window: NSWindow, messenger: FlutterBinaryMessenger) {self.window = window@@ -26,6 +27,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {case "update":let state = call.arguments as? [String: Any] ?? [:]self.actionsEnabled = state["enabled"] as? Bool == true+ self.canReopen = state["canReopen"] as? Bool == trueself.strip.update(state)result(nil)default: result(FlutterMethodNotImplemented)@@ -88,6 +90,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {menu.addItem(item)}add("New Swarm", "t", "new")+ add("Reopen Closed Swarm", "t", "reopen", [.command, .shift])add("Close Swarm", "w", "closeActive")add("Rename Swarm…", "r", "renameActive", [.command, .shift])menu.addItem(.separator())@@ -102,10 +105,12 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {main.insertItem(item, at: min(2, main.numberOfItems))}- func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { actionsEnabled }+ func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {+ actionsEnabled && (menuItem.representedObject as? String != "reopen" || canReopen)+ }@objc private func menuAction(_ sender: NSMenuItem) {- guard actionsEnabled, let action = sender.representedObject as? String else { return }+ guard validateMenuItem(sender), let action = sender.representedObject as? String else { return }channel.invokeMethod(action, arguments: nil)}}diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dartindex 334fbd75d..38f3d16d1 100644--- a/desktop/test/swarm_interactions_test.dart+++ b/desktop/test/swarm_interactions_test.dart@@ -226,6 +226,11 @@ void main() {await tester.pump(const Duration(milliseconds: 300));await opening;expect(updates.last['enabled'], isTrue);+ app.renameSwarm(app.activeSwarmId, 'Recover me');+ await app.closeSwarm(app.activeSwarmId);+ await tester.pump();+ final beforeExternal = app.activeSwarmId;+ expect(updates.last['canReopen'], isTrue);// Root app-menu dialogs enter outside SwarmScreen's own dialog helper.final external = showDialog<void>(context: tester.element(find.byType(SwarmScreen)),@@ -234,11 +239,16 @@ void main() {await tester.pump(const Duration(milliseconds: 300));expect(updates.last['enabled'], isFalse);await native('new');- expect(app.swarms.single.id, 'swarm-1');+ await native('reopen');+ expect(app.swarms.single.id, beforeExternal);Navigator.of(tester.element(find.byType(AlertDialog))).pop();await tester.pump(const Duration(milliseconds: 300));await external;expect(updates.last['enabled'], isTrue);+ await native('reopen');+ await tester.pump();+ expect(app.swarms.single.name, 'Recover me');+ expect(updates.last['canReopen'], isFalse);await tester.pumpWidget(const SizedBox());projects.dispose();app.dispose();diff --git a/desktop/test/swarm_reopen_test.dart b/desktop/test/swarm_reopen_test.dartnew file mode 100644index 000000000..b59da75e9--- /dev/null+++ b/desktop/test/swarm_reopen_test.dart@@ -0,0 +1,200 @@+import 'dart:async';++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/auth/auth_session.dart';+import 'package:harness/auth/cli_login.dart';+import 'package:harness/core/config.dart';+import 'package:harness/state/app_state.dart';+import 'package:harness/state/pane_preset.dart';+import 'package:harness/terminal/terminal_session.dart';++import 'swarm_interactions_test.dart' show chord;+import 'swarm_screen_test.dart' show mount;+import 'swarm_state_test.dart' show createApp, MemoryStore;++class _NoopLogin extends CliLogin {+ int logoutCalls = 0;+ @override+ Future<void> logout() async {+ logoutCalls++;+ }+}++void main() {+ test('recently closed swarms do not survive sign-out', () async {+ final login = _NoopLogin();+ final app = AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ cliLogin: login,+ );+ addTearDown(app.dispose);+ app.renameSwarm(app.activeSwarmId, 'Private work');+ await app.closeSwarm(app.activeSwarmId);+ expect(app.canReopenClosedSwarm, isTrue);+ await app.logout();+ expect(login.logoutCalls, 1);+ expect(app.canReopenClosedSwarm, isFalse);+ app.reopenClosedSwarm();+ expect(app.swarms.every((s) => s.name != 'Private work'), isTrue);+ });++ test('only the latest 24 closed arrangements are retained', () async {+ final app = createApp();+ addTearDown(app.dispose);+ for (var i = 0; i < 27; i++) {+ app.renameSwarm(app.activeSwarmId, 'Closed $i');+ await app.closeSwarm(app.activeSwarmId);+ }+ for (var i = 26; i >= 3; i--) {+ app.reopenClosedSwarm();+ expect(app.activeSwarm.name, 'Closed $i');+ }+ expect(app.swarms, hasLength(24));+ // Make room without recording another close, to distinguish an empty+ // history from the independent open-tab limit.+ app.swarms.removeLast();+ app.selectSwarm(app.swarms.first.id);+ expect(app.canReopenClosedSwarm, isFalse);+ });+ test(+ 'reopen restores an arrangement and preserves changes to shared views',+ () async {+ final store = MemoryStore();+ final app = createApp(store: store);+ addTearDown(app.dispose);+ app.renameSwarm(app.activeSwarmId, 'Work');+ await app.addAgentToSwarm('m', 'a0');+ await app.addAgentToSwarm('m', 'a1');+ final original = app.activeSwarm;+ final shared = original.panes.first;+ app.focusPane(shared.id);+ app.togglePinPane(shared.id);+ app.setPreset(2, PanePreset.rows);+ app.toggleZoomPane();+ final wallpaper = original.wallpaper;+ app.newSwarm(name: 'Keep working');+ final other = app.activeSwarm;+ await app.addAgentToSwarm('m', 'a0');+ await app.closeSwarm(original.id);+ app.toggleComposer(shared.id);+ await app.addAgentToSwarm('m', 'a2');+ app.reopenClosedSwarm();+ expect(app.swarms.map((s) => s.name), ['Work', 'Keep working']);+ expect(app.activeSwarmId, original.id);+ expect(app.panes.map((p) => p.agentId), ['a0', 'a1']);+ expect(app.panes.first, same(shared));+ expect(shared.composerVisible, isTrue);+ expect(app.activeSwarm.wallpaper, wallpaper);+ expect(app.presetFor(2), PanePreset.rows);+ expect(app.focusedPaneId, shared.id);+ expect(app.zoomedPaneId, shared.id);+ expect(app.activeSwarm.previousPaneId, app.panes.last.id);+ expect(app.isPanePinned(shared), isTrue);+ expect(other.panes.map((p) => p.agentId), ['a0', 'a2']);+ expect(other.pinnedSlots, isEmpty);+ await app.flushPaneLayout();+ final restored = createApp(store: store);+ addTearDown(restored.dispose);+ await restored.restorePaneLayoutForTest();+ expect(restored.swarms.map((s) => s.name), ['Work', 'Keep working']);+ expect(restored.activeSwarmId, original.id);+ expect(restored.canReopenClosedSwarm, isFalse);+ },+ );++ test('reopen replaces only an untouched automatic welcome', () async {+ final app = createApp();+ addTearDown(app.dispose);+ await app.addAgentToSwarm('m', 'a0');+ final original = app.activeSwarmId;+ await app.closeSwarm(original);+ for (var i = 0; i < 30; i++) {+ await app.closeSwarm(app.activeSwarmId);+ }+ app.reopenClosedSwarm();+ expect(app.swarms.single.id, original);+ expect(app.panes.single.agentId, 'a0');+ await app.closeSwarm(original);+ app.renameSwarm(app.activeSwarmId, 'New plans');+ final plans = app.activeSwarm;+ app.reopenClosedSwarm();+ expect(app.swarms, hasLength(2));+ expect(app.swarms, contains(same(plans)));+ expect(plans.name, 'New plans');+ });++ test('reopen does not wait for a closing terminal and cannot resurrect its controller', () async {+ final closeReply = Completer<bool>();+ final app = createApp();+ addTearDown(app.dispose);+ final session =+ TerminalSession(+ machineId: 'm',+ agentId: 'a0',+ agentName: 'Work',+ engineId: 'codex',+ send: (type, _) => type == 'terminal_close'+ ? closeReply.future+ : Future.value(true),+ sendBinary: (_) async => true,+ )+ ..streamId = 'closing-stream'+ ..status = TerminalSessionStatus.controlling;+ final oldPane = app.adoptSessionForTest(session);+ final closing = app.closeSwarm(app.activeSwarmId);+ app.reopenClosedSwarm();+ final reopened = app.panes.single;+ expect(reopened, isNot(same(oldPane)));+ expect(reopened.session, isNull);+ closeReply.complete(true);+ await closing;+ expect(app.panes.single, same(reopened));+ });++ test(+ 'history is bounded, newest-first and retained while capacity is full',+ () async {+ final app = createApp();+ addTearDown(app.dispose);+ for (var i = 0; i < AppNotifier.maxClosedSwarms + 3; i++) {+ app.renameSwarm(app.activeSwarmId, 'Closed $i');+ await app.closeSwarm(app.activeSwarmId);+ }+ for (var i = 0; i < AppNotifier.maxSwarms - 1; i++) {+ app.newSwarm();+ }+ expect(app.canReopenClosedSwarm, isFalse);+ app.reopenClosedSwarm();+ expect(app.swarms, hasLength(AppNotifier.maxSwarms));+ await app.closeSwarm(app.activeSwarmId);+ app.reopenClosedSwarm();+ expect(app.activeSwarm.name, 'New swarm');+ // Free slots directly without adding newer close records to this check.+ app.swarms.removeRange(1, app.swarms.length);+ app.selectSwarm(app.swarms.single.id);+ app.reopenClosedSwarm();+ expect(app.activeSwarm.name, 'Closed 26');+ },+ );++ testWidgets('Cmd-Shift-T restores the last closed swarm from the welcome', (+ tester,+ ) async {+ final app = createApp();+ await app.addAgentToSwarm('m', 'a0');+ app.renameSwarm(app.activeSwarmId, 'My work');+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyW);+ expect(app.panes, isEmpty);+ await chord(tester, LogicalKeyboardKey.keyT, shift: true);+ expect(app.activeSwarm.name, 'My work');+ expect(app.panes.single.agentId, 'a0');+ expect(app.canReopenClosedSwarm, isFalse);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+}diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.mdindex 7f9fbcd01..c2f07936d 100644--- a/docs/harness-v2-progress.md+++ b/docs/harness-v2-progress.md@@ -49,6 +49,7 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83- New `desktop/lib/state/swarm.dart`: tab ID/name/wallpaper, memberships, focus/zoom, presets, measured grid columns, pins.- `AppNotifier`: swarm list/active swarm; `panes` is active membership, `allPanes` is the deduplicated session pool. Transport event fan-out uses all unique sessions.- New/select/rename/reorder/close tabs, wallpaper cycling, add-to-swarm, and machine/project seeding.+- Cmd+Shift+T and the native Reopen Closed Swarm command restore the most recently closed arrangement at its original position, including focus, zoom, wallpaper, presets and pins. Recovery reuses agents still open in other swarms and preserves newer shared-view edits. History holds only lightweight intent for the last 24 closes, clears on account changes or app exit, and retains no terminal controllers or buffers. Reopening replaces the automatic empty welcome only while it is untouched; holding Cmd+W there cannot evict useful history.- Replacing membership creates/reuses a different pane identity instead of mutating a pane shared with another swarm.- Session detachment waits until the final membership closes. Sends terminal-close, never agent-delete.- Seeding records membership synchronously before awaiting attachments. Agent creation captures its destination before the RPC completes, so tab switching cannot redirect results.@@ -87,11 +88,11 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83- `desktop/macos/Runner/SwarmTitlebar.swift`, registered in Xcode and owned by `MainFlutterWindow`.- `NSTitlebarAccessoryViewController` with native scrollable tabs, new button, notification bell, settings. Automatic native window tabbing disabled; Flutter content begins below title bar.-- Method channel `harness/swarm_tabs`: Dart sends tab ID/name/selection/attention; Swift sends new/select/close/rename/reorder/navigation/settings/notifications.+- Method channel `harness/swarm_tabs`: Dart sends tab ID/name/selection/attention and recovery availability; Swift sends new/reopen/select/close/rename/reorder/navigation/settings/notifications.- Native tab click, double-click rename, context menu, close, drag/drop reorder. Tab button instances are retained across refreshes.- Accessibility names/selection update with state, including overflowed tabs that have never painted. Tab context menus obey modal-disabled state. Layout reveals the selected tab after window resize.- Accessibility child order follows the displayed order after a reorder; AppKit receives a layout-change notification when tabs are added, moved or closed. A windowless check compiles the production Swift source and exercises these native controls directly, without booting Flutter or reading saved account/layout data.-- Native Swarm menu includes new/close/rename, previous/next, Add agent and close agent view. Settings activates the former disabled Preferences placeholder in the application menu, giving Cmd+, one native owner. It follows the same modal-disabled state as the titlebar controls.+- Native Swarm menu includes new/reopen/close/rename, previous/next, Add agent and close agent view. Reopen disables when history is empty or the open-tab limit is reached. Settings activates the former disabled Preferences placeholder in the application menu, giving Cmd+, one native owner. It follows the same modal-disabled state as the titlebar controls.- Real tabs alongside traffic lights were visually verified. Native selection, new tabs, modal-disabled controls, and independently accessible select/close buttons were checked. Drag/reorder, overflow, and a wider keyboard/accessibility audit remain.### CLI project metadata@@ -118,6 +119,7 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83| Action | Binding || --- | --- || New / close swarm | Cmd+T / Cmd+W |+| Reopen closed swarm | Cmd+Shift+T || Rename swarm | Cmd+Shift+R || Previous / next swarm | Cmd+Shift+[ / ], Ctrl+Shift+Tab / Ctrl+Tab || Add agent picker / New agent | Cmd+Shift+F or Cmd+P / Cmd+N |@@ -133,14 +135,17 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83Swarm shortcuts, help, and tooltips now read the same catalog in `shortcuts/app_shortcuts.dart`. The retained legacy HomeScreen explicitly opts into its old bindings. Native Swarm actions and controls are blocked whenever another route is above the shell, including root app-menu dialogs. Held Layout/Shortcuts/Firmware menu commands cannot stack dialogs; repeated Cmd+S still cycles the visible Layout palette. Clipboard/select-all and shell/TUI keys remain owned by the terminal. Do not add AppKit menu equivalents that intercept Cmd+H/J before Flutter.+The reopen binding follows the documented Mac tab-recovery shortcut in [Safari](https://support.apple.com/guide/safari/keyboard-shortcuts-and-gestures-cpsh003/mac) and [Chrome](https://support.google.com/a/users/answer/13293027?hl=en). Those references inform familiar navigation; the approved Swarm product contract remains the design scope.+## Verification and limits| Check | Result || --- | --- || macOS debug build | Passed and launched from the monorepo with real saved Swarms and terminals. || macOS optimized local build | Passed and running with the real entry point and saved V2 state. Local ad hoc signing requires the command-line `ENABLE_HARDENED_RUNTIME=NO` override for Flutter's framework; distribution signing settings remain unchanged. The distribution Developer ID certificate is unavailable; nothing was uploaded. Normal asynchronous quit and relaunch were verified. The screen remains locked, so final native visual review is pending. |-| Full Flutter suite | **980 passed, 1 skipped** after persistence, modal menus, retained-terminal performance and stream-dispatch changes. |+| Full Flutter suite | **987 passed, 1 skipped** after persistence, modal menus, retained-terminal performance, stream dispatch and closed-Swarm recovery. || Focused interaction checks | 8 passed: picker navigation/scroll/refresh, welcome keys, shared-view close, composer, native modal guard, profile and folder races. |+| Closed-Swarm recovery | 7 passed: arrangement and shared-view restoration, untouched welcome replacement, rapid close/reopen with delayed cleanup, capacity, bounded history, sign-out isolation and the keyboard command. Native command availability and modal behavior also pass in the interaction suite. || Local CLI discovery | 25 passed, including older-daemon folder parsing and continuous snapshots without spawning/reconnecting. || CLI typecheck | `npm run typecheck` passed. || CLI targeted tests | 135 passed across project/frame, registry/restore, and terminal recovery files. Project/frame tests rerun after port normalization: 9 passed. |@@ -155,7 +160,7 @@ Tests now exercise the actual V2 welcome/settings/linking flow. Usage pricing agEvidence on this Mac under `/private/tmp`:-- `harness-v2-final-tests.log`: full 980-test pass.+- `harness-v2-final-tests.log`: full 987-test pass.- `harness-v2-final-analyze.log`: latest diagnostics.- `harness-v2-final-build.log`: real-entry debug build.- `harness-v2-release-build.log`: optimized local build.@@ -167,6 +172,7 @@ Evidence on this Mac under `/private/tmp`:- `harness-v2-benchmark-final.log`: latest catalog and retained-terminal CPU measurements.- `harness-v2-native-titlebar-tests.log`: windowless checks against the actual AppKit tab source.- `harness-v2-routing-tests.log`: 68 stream-routing, binary protocol and terminal session checks.+- `harness-v2-reopen-tests.log`: 23 Swarm recovery, state and interaction checks.Earlier logs contain superseded failures. Temporary logs and toolchains are local conveniences, not committed artifacts.@@ -232,7 +238,7 @@ npx vitest run src/lib/agentFrame.spec.ts src/lib/agentProject.spec.tsSome tests require permission to bind disposable loopback sockets. Inject memory/temp stores, skip real credential/usage pollers using `kUnderTest`, and never treat a real Harness home as a fixture. Keep patched `desktop/third_party/xterm`, not pub.dev xterm.-The real review app is now built in `/Users/ab/code/autonomous-harness/desktop/build/macos/Build/Products/Debug/Harness V2.app`, with the separate V2 bundle identity and saved V2 state. An optimized ad hoc signed local build is ready in the sibling `Release/` directory. It has not been launched yet: the Mac is locked and the running debug app declined a normal quit request. No process was force-terminated. Production Harness remains a separate running app. Never automatically take over its terminals or use a real Harness home as a test fixture.+The real review app uses `/Users/ab/code/autonomous-harness/desktop/build/macos/Build/Products/Release/Harness V2.app`, with the separate V2 bundle identity and saved V2 state. Its optimized local build has been launched and verified running. The earlier debug build remains in the sibling `Debug/` directory. Production Harness remains separate. Never automatically take over its terminals or use a real Harness home as a test fixture.## Publishing boundaries