Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d2c9ca9
Add settings sidebar shell
lawrencecchen Apr 28, 2026
95d4ca1
Add settings shell prototype app
lawrencecchen Apr 28, 2026
f28dc75
Migrate settings to native shell layout
lawrencecchen Apr 28, 2026
30e443a
Align settings shell with prototype
lawrencecchen Apr 28, 2026
d440142
Remove settings titlebar debug hooks
lawrencecchen Apr 28, 2026
187987d
Use SwiftUI scene for settings window
lawrencecchen Apr 29, 2026
4349366
Improve settings search results
lawrencecchen Apr 29, 2026
a918a4c
Remove settings detail title
lawrencecchen Apr 29, 2026
10a792d
Tune settings window default size
lawrencecchen Apr 29, 2026
63e86f0
Highlight settings search results
lawrencecchen Apr 29, 2026
d30f8c4
Make settings search highlight persistent
lawrencecchen Apr 29, 2026
59d27a3
Fade settings search highlight
lawrencecchen Apr 29, 2026
b84f6d7
Expose settings json in settings
lawrencecchen Apr 29, 2026
aaac7df
Split settings navigation helpers
lawrencecchen Apr 29, 2026
d4bd7a9
Limit settings highlight to search clicks
lawrencecchen Apr 29, 2026
ce772ae
Make settings sidebar scroll latest-wins
lawrencecchen Apr 29, 2026
963e40a
Use wand icon for automation settings
lawrencecchen Apr 29, 2026
ec7ca8f
Move workspace colors below shortcuts
lawrencecchen Apr 29, 2026
da0f416
merge: resolve conflicts with main
lawrencecchen Apr 29, 2026
440d5cc
Address settings window review feedback
lawrencecchen Apr 29, 2026
1d697b3
Fix settings shortcut routing test cleanup
lawrencecchen Apr 29, 2026
0e607d2
Fix settings window activation warning
lawrencecchen Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Prototypes/SettingsShellLab/.codex/environments/environment.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY
version = 1
name = "SettingsShellLab"

[setup]
script = ""

[[actions]]
name = "Run"
icon = "run"
command = "./script/build_and_run.sh"
2 changes: 2 additions & 0 deletions Prototypes/SettingsShellLab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.build/
dist/
19 changes: 19 additions & 0 deletions Prototypes/SettingsShellLab/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// swift-tools-version: 5.9

import PackageDescription

let package = Package(
name: "SettingsShellLab",
platforms: [
.macOS(.v14),
],
products: [
.executable(name: "SettingsShellLab", targets: ["SettingsShellLab"]),
],
targets: [
.executableTarget(
name: "SettingsShellLab",
path: "Sources/SettingsShellLab"
),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import AppKit
import SwiftUI

@main
struct SettingsShellLabApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate

var body: some Scene {
WindowGroup(String(localized: "app.window.title", defaultValue: "Settings Shell Lab")) {
SettingsShellView()
}
.defaultSize(width: 900, height: 620)
.commands {
SidebarCommands()
}
}
}

final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
NSApp.setActivationPolicy(.regular)
NSApp.activate(ignoringOtherApps: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import SwiftUI

enum SettingsSection: String, CaseIterable, Identifiable {
case general
case terminal
case sidebar
case browser
case keyboard
case automation
case advanced

var id: Self { self }

var title: String {
switch self {
case .general:
return String(localized: "section.general.title", defaultValue: "General")
case .terminal:
return String(localized: "section.terminal.title", defaultValue: "Terminal")
case .sidebar:
return String(localized: "section.sidebar.title", defaultValue: "Sidebar")
case .browser:
return String(localized: "section.browser.title", defaultValue: "Browser")
case .keyboard:
return String(localized: "section.keyboard.title", defaultValue: "Keyboard")
case .automation:
return String(localized: "section.automation.title", defaultValue: "Automation")
case .advanced:
return String(localized: "section.advanced.title", defaultValue: "Advanced")
}
}

var symbolName: String {
switch self {
case .general:
return "gearshape"
case .terminal:
return "terminal"
case .sidebar:
return "sidebar.left"
case .browser:
return "globe"
case .keyboard:
return "keyboard"
case .automation:
return "bolt.horizontal"
case .advanced:
return "wrench.and.screwdriver"
}
}

var detail: String {
switch self {
case .general:
return String(localized: "section.general.detail", defaultValue: "Language, appearance, updates")
case .terminal:
return String(localized: "section.terminal.detail", defaultValue: "Font, scrollback, bell")
case .sidebar:
return String(localized: "section.sidebar.detail", defaultValue: "Layout, badges, metadata")
case .browser:
return String(localized: "section.browser.detail", defaultValue: "Search, links, history")
case .keyboard:
return String(localized: "section.keyboard.detail", defaultValue: "Shortcuts and chords")
case .automation:
return String(localized: "section.automation.detail", defaultValue: "Socket, hooks, ports")
case .advanced:
return String(localized: "section.advanced.detail", defaultValue: "Diagnostics and reset")
}
}

var searchText: String {
"\(title) \(detail)"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import SwiftUI

struct SettingsDetailView: View {
let section: SettingsSection

@State private var isEnabled = true
@State private var selectedMode = Mode.system
@State private var numericValue = 12.0

var body: some View {
Form {
Section {
LabeledContent(
String(localized: "detail.section", defaultValue: "Section"),
value: section.title
)

Toggle(
String(localized: "detail.toggle", defaultValue: "Enable"),
isOn: $isEnabled
)

Picker(String(localized: "detail.mode", defaultValue: "Mode"), selection: $selectedMode) {
ForEach(Mode.allCases) { mode in
Text(mode.title).tag(mode)
}
}
.pickerStyle(.segmented)

Slider(
value: $numericValue,
in: 0...24
) {
Text(String(localized: "detail.slider", defaultValue: "Amount"))
}
} header: {
Text(section.title)
}

Section {
Button(String(localized: "detail.primaryAction", defaultValue: "Open Related File")) {
}

Button(String(localized: "detail.secondaryAction", defaultValue: "Restore Defaults")) {
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
}
.formStyle(.grouped)
.padding()
}
}

private enum Mode: String, CaseIterable, Identifiable {
case system
case compact
case expanded

var id: Self { self }

var title: String {
switch self {
case .system:
return String(localized: "mode.system", defaultValue: "System")
case .compact:
return String(localized: "mode.compact", defaultValue: "Compact")
case .expanded:
return String(localized: "mode.expanded", defaultValue: "Expanded")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import SwiftUI

struct SettingsShellView: View {
@SceneStorage("selectedSettingsSection") private var selectedSectionRaw = SettingsSection.general.rawValue
@State private var searchText = ""

private var selectedSection: SettingsSection {
SettingsSection(rawValue: selectedSectionRaw) ?? .general
}

private var filteredSections: [SettingsSection] {
let query = searchText.trimmingCharacters(in: .whitespacesAndNewlines)
guard !query.isEmpty else { return SettingsSection.allCases }
return SettingsSection.allCases.filter { section in
section.searchText.localizedStandardContains(query)
}
}

var body: some View {
NavigationSplitView {
List(selection: $selectedSectionRaw) {
ForEach(filteredSections) { section in
Label(section.title, systemImage: section.symbolName)
.tag(section.rawValue)
}
}
.listStyle(.sidebar)
.navigationTitle(String(localized: "settings.sidebar.title", defaultValue: "Settings"))
.searchable(
text: $searchText,
placement: .sidebar,
prompt: Text(String(localized: "settings.search.prompt", defaultValue: "Search Settings"))
)
} detail: {
SettingsDetailView(section: selectedSection)
.navigationTitle(selectedSection.title)
.toolbar {
ToolbarItem {
Button {
} label: {
Label(
String(localized: "toolbar.reset", defaultValue: "Reset"),
systemImage: "arrow.counterclockwise"
)
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
}
}
.navigationSplitViewStyle(.balanced)
}
}
78 changes: 78 additions & 0 deletions Prototypes/SettingsShellLab/script/build_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -euo pipefail

MODE="${1:-run}"
APP_NAME="SettingsShellLab"
BUNDLE_ID="com.cmux.prototype.SettingsShellLab"
MIN_SYSTEM_VERSION="14.0"

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DIST_DIR="$ROOT_DIR/dist"
APP_BUNDLE="$DIST_DIR/$APP_NAME.app"
APP_CONTENTS="$APP_BUNDLE/Contents"
APP_MACOS="$APP_CONTENTS/MacOS"
APP_BINARY="$APP_MACOS/$APP_NAME"
INFO_PLIST="$APP_CONTENTS/Info.plist"

cd "$ROOT_DIR"

pkill -x "$APP_NAME" >/dev/null 2>&1 || true

swift build
BUILD_BINARY="$(swift build --show-bin-path)/$APP_NAME"

rm -rf "$APP_BUNDLE"
mkdir -p "$APP_MACOS"
cp "$BUILD_BINARY" "$APP_BINARY"
chmod +x "$APP_BINARY"

cat >"$INFO_PLIST" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>$APP_NAME</string>
<key>CFBundleIdentifier</key>
<string>$BUNDLE_ID</string>
<key>CFBundleName</key>
<string>$APP_NAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>$MIN_SYSTEM_VERSION</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
PLIST

open_app() {
/usr/bin/open -n "$APP_BUNDLE"
}

case "$MODE" in
run)
open_app
;;
--debug|debug)
lldb -- "$APP_BINARY"
;;
--logs|logs)
open_app
/usr/bin/log stream --info --style compact --predicate "process == \"$APP_NAME\""
;;
--telemetry|telemetry)
open_app
/usr/bin/log stream --info --style compact --predicate "subsystem == \"$BUNDLE_ID\""
;;
--verify|verify)
open_app
sleep 1
pgrep -x "$APP_NAME" >/dev/null
;;
*)
echo "usage: $0 [run|--debug|--logs|--telemetry|--verify]" >&2
exit 2
;;
esac
17 changes: 17 additions & 0 deletions Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -68490,6 +68490,23 @@
}
}
},
"settings.search.prompt": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Search Settings"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "設定を検索"
}
}
}
},
"settings.workspaceColors.base": {
"extractionState": "manual",
"localizations": {
Expand Down
12 changes: 6 additions & 6 deletions Sources/TerminalController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7302,13 +7302,13 @@ class TerminalController {
let shouldActivate = v2FocusAllowed(requested: v2Bool(params, "activate") ?? true)

let navigationTarget: SettingsNavigationTarget?
switch targetRaw {
case nil:
if let targetRaw {
guard let target = SettingsNavigationTarget(rawValue: targetRaw) else {
return .err(code: "invalid_params", message: "Unknown settings target", data: ["target": targetRaw])
}
navigationTarget = target
} else {
navigationTarget = nil
case SettingsNavigationTarget.keyboardShortcuts.rawValue:
navigationTarget = .keyboardShortcuts
default:
return .err(code: "invalid_params", message: "Unknown settings target", data: ["target": targetRaw ?? ""])
}

DispatchQueue.main.async {
Expand Down
4 changes: 1 addition & 3 deletions Sources/WindowDecorationsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ final class WindowDecorationsController {
}

private func trafficLightOffset(for window: NSWindow) -> NSPoint {
guard window.identifier?.rawValue == "cmux.settings" else { return .zero }
// Nudge controls slightly right/down to align with the custom Settings title row.
return NSPoint(x: 7, y: -4)
return .zero
}
Comment on lines 71 to 73

@coderabbitai coderabbitai Bot Apr 28, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep the zero offset scoped to the settings window.

trafficLightOffset(for:) now returns .zero for every window, so applyTrafficLightOffset(on:hidden:) stops applying any offset anywhere this controller is used. If the intent is only to neutralize cmux.settings, keep the identifier check here and preserve the existing offset for other windows.

🔧 Proposed fix
 private func trafficLightOffset(for window: NSWindow) -> NSPoint {
-    return .zero
+    if window.identifier?.rawValue == "cmux.settings" {
+        return .zero
+    }
+    return /* existing non-settings offset logic */
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/WindowDecorationsController.swift` around lines 71 - 73, The
trafficLightOffset(for:) implementation was changed to always return .zero,
disabling offsets globally; revert this to only return .zero for the settings
window by checking the window identifier (e.g., compare
window.identifier?.rawValue to "cmux.settings") and otherwise compute/return the
original offset value used previously so applyTrafficLightOffset(on:hidden:)
still applies offsets for non-settings windows; update the logic inside
trafficLightOffset(for:) (and ensure any helper used there is preserved) rather
than changing applyTrafficLightOffset(on:hidden:).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified as not applicable. On main, non-settings windows already returned zero offset; this PR intentionally removes the Settings-only traffic-light offset, so no non-settings offset behavior was lost.

— Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified as not applicable. On main, non-settings windows already returned zero offset; this PR intentionally removes the Settings-only traffic-light offset, so no non-settings offset behavior was lost.

— Claude Code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawrencecchen, understood — the previous implementation had .zero as the default for all non-settings windows, so collapsing the method to always return .zero correctly preserves that behavior while intentionally dropping the Settings-specific nudge (now unnecessary with the native system titlebar via the SwiftUI WindowGroup). My comment was a false positive. Thanks for the clarification!

(ᓀ‸ᓂ)


✏️ Learnings added
Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3244
File: Sources/WindowDecorationsController.swift:71-73
Timestamp: 2026-04-29T06:24:51.350Z
Learning: Repo: manaflow-ai/cmux — Sources/WindowDecorationsController.swift — `trafficLightOffset(for:)` returned `.zero` for all non-settings windows on `main`; the only non-zero offset was for `cmux.settings` (nudge right/down to align with the custom Settings title row). PR `#3244` intentionally removes that offset because Settings now uses a SwiftUI WindowGroup with a native macOS system titlebar, making the nudge unnecessary. Do not flag `trafficLightOffset(for:)` always returning `.zero` as a regression.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:3586-3604
Timestamp: 2026-04-14T20:00:21.500Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26+, the app intentionally keeps NSWindow.StyleMask.fullSizeContentView enabled even with the native (non-transparent) system titlebar. The titlebar handles dragging natively; isMovable=true and isMovableByWindowBackground=false are used. Any comment suggesting “without fullSizeContentView” is outdated.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2124
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-25T08:05:26.034Z
Learning: Repo: manaflow-ai/cmux — File: Sources/AppDelegate.swift — Pattern for “New Window” geometry seed:
In AppDelegate.createMainWindow(initialWorkingDirectory:sessionWindowSnapshot:), compute the existingFrame using preferredMainWindowContextForWorkspaceCreation(debugSource: "createMainWindow.initialGeometry") and then resolvedWindow(for:) rather than relying on NSApp.keyWindow or the first registered mainWindowContext. Rationale: ensures the new window inherits size from the intended main-terminal window even when an auxiliary window is key, and keeps behavior consistent with showOpenFolderPanel().

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3179
File: Sources/ContentView.swift:4005-4021
Timestamp: 2026-04-27T11:59:15.622Z
Learning: Repo: manaflow-ai/cmux — PR `#3179` — Sources/ContentView.swift
Learning: For separate-surface transparent windows, installNativeTitlebarBackdrop intentionally inserts NativeTitlebarBackdropView below contentView (NSHostingView) — positioned .below relativeTo: contentView — so the backdrop fills through transparent hosting without tinting SwiftUI titlebar text/buttons. The titlebar‑chrome ancestor fallback is only for edge cases where contentView isn’t directly under the NSThemeFrame. This layering was pixel‑verified in PR `#3179`; do not “fix” it to sit below the titlebar chrome on this path.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3179
File: Sources/ContentView.swift:3991-4002
Timestamp: 2026-04-27T09:15:53.326Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — Native titlebar backdrop layering: installNativeTitlebarBackdrop must place the backdrop between the NSThemeFrame’s background material and the standard titlebar chrome (insert .below the close button’s ancestor in the theme frame). When the titlebar-chrome ancestor lookup fails, fall back to inserting .below relativeTo: nil so the backdrop is behind existing siblings and does not overpaint the SwiftUI titlebar/sidebar strip. Visual matching has been verified via pixel samples.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/ContentView.swift:3194-3196
Timestamp: 2026-03-04T14:05:48.668Z
Learning: In manaflow-ai/cmux (PR `#819`), Sources/ContentView.swift: The command palette’s external window labels intentionally use the global window index from the full orderedSummaries (index + 1), matching the Window menu in AppDelegate. Do not reindex after filtering out the current window to avoid mismatches (“Window 2” for an external window is expected).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-27T06:58:21.434Z
Learning: In the Swift UI code (e.g., Sources/ContentView.swift), when `preferLiquidGlass`/`materialPolicy.preferLiquidGlass` is enabled for sidebar Liquid Glass, only omit the `Color` tint overlay if `NSGlassEffectView` (native Liquid Glass) is actually available. Compute `usingNativeLiquidGlass = materialPolicy.preferLiquidGlass && SidebarVisualEffectBackground.liquidGlassAvailable`, and when `usingNativeLiquidGlass` is false keep the overlay so the non-native `NSVisualEffectView` fallback still receives the configured tint.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3218
File: Sources/AppDelegate.swift:3456-3469
Timestamp: 2026-04-28T11:35:31.575Z
Learning: Repo: manaflow-ai/cmux — Sources/AppDelegate.swift (Swift)
Learning: The DEBUG-only helper unregisterMainWindowContextForTesting(windowId:) should mirror production teardown: after removing matching mainWindowContexts entries, call activateMainWindowContext(mainWindowContexts.values.first) when the active context was removed so tabManager, sidebarState, sidebarSelectionState, and fileExplorerState are repointed (or cleared when none remain). This prevents stale active pointers in tests.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/Windowing/WindowAppearanceSnapshot.swift:185-210
Timestamp: 2026-04-27T06:58:26.079Z
Learning: Repo: manaflow-ai/cmux — Sources/GhosttyTerminalView.swift & Sources/Windowing/WindowAppearanceSnapshot.swift — Snapshot refresh contract for usesHostLayerBackground:
`notifyDefaultBackgroundDidChange()` (and therefore the titlebar/window snapshot refresh in ContentView) must fire whenever `usesHostLayerBackground` changes, even if terminal background color and opacity are unchanged. The prior `hasChanged` check in `updateDefaultBackground()` only compared colors; it was extended so that a toggle of `usesHostLayerBackground` alone also triggers the notification. ContentView listens at the window level to rebuild `WindowAppearanceSnapshot` (including `terminalRenderingMode`) on any such notification. Fixed in commits 4913d17–979a683 (PR `#3166`).

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:15597-15615
Timestamp: 2026-04-14T20:05:53.504Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26 in this app, the only NSSplitView in the window’s view tree is the one owned by NavigationSplitView. Therefore SplitViewDividerHiderView.hideDividers()/patchSplitViews(in:) effectively scope to that single split. Do not flag “global divider clearing” for this path unless additional split views are introduced later.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/AppDelegate.swift:10168-10189
Timestamp: 2026-04-14T20:02:41.558Z
Learning: Repo manaflow-ai/cmux — On macOS 26, the notifications popover is owned by ContentView (State isNotificationsPopoverPresented). AppDelegate APIs (toggle/show/dismiss/isShown) must route via NotificationCenter with a window-scoped userInfo["windowId"] and track visibility per-window, not call UpdateTitlebarAccessoryController. ContentView should observe show/dismiss/toggle and post a visibilityDidChange notification {windowId, visible}.

Learnt from: tranquillum
Repo: manaflow-ai/cmux PR: 2827
File: Sources/Sidebar/ProviderAccountsFooterPanel.swift:174-198
Timestamp: 2026-04-17T15:46:53.298Z
Learning: Repo: manaflow-ai/cmux — Sources/Sidebar/ProviderAccountsFooterPanel.swift + Sources/Sidebar/ProviderAccountsPopover.swift (PR `#2827`):
- `ProviderStatusRanking.impactSeverity(_:)` intentionally returns `-1` for any unrecognized/`"none"` impact string.
- When `worstImpactSeverity == -1` (every incident in the list has an unknown/none impact), `ProviderStatusLabel.statusText` and `.dotColor` fall through to the `default` branch, which shows "Operational" / green.
- This is a deliberate design choice: `StatuspageIOFetcher.fetch` already defaults missing impact fields to `"none"`, so the only way to reach `worstImpactSeverity == -1` is a genuinely benign incident array; showing "Operational" here avoids false-positive yellow.
- The popover always surfaces the full raw incident rows independently, so no incident is invisible to the user.
- Do NOT flag the `-1 → Operational` fallback as a bug or suggest raising unknown impacts to `minor` severity.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/Workspace.swift (PR `#3237`, commit 9dcb9c2), the `newTerminalSurface(...)` method gained an `allowInitialInputWithRemoteStartupCommand: Bool` parameter (default `false`). The session-restore call site in `createPanel(from:inPane:)` passes `true` only when `!panelWasRemoteBacked && combinedInitialInput != nil`, making the per-panel snapshot flag the sole authority for restore-time `initialInput` injection. All 12 other call sites keep `false`, preserving the existing remote-drop defense.

Learnt from: MaTriXy
Repo: manaflow-ai/cmux PR: 1460
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-16T08:02:06.824Z
Learning: In Swift sources, for any panel_id-only route handling in v2PanelMarkBackground(params:) and v2PanelMarkForeground(params:), first attempt v2ResolveTabManager(params:). Use the manager only if it actually owns the panelId; otherwise fall back to AppDelegate.shared?.locateSurface(surfaceId:) to locate the correct TabManager across windows. Apply this pattern to all panel_id-only routes to avoid active-window bias.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3164
File: Sources/cmuxApp.swift:189-197
Timestamp: 2026-04-26T06:03:08.863Z
Learning: Repo: manaflow-ai/cmux — PR `#3164` — Bootstrap contract: In cmuxApp.bootstrapMainWindowScene(), AppDelegate.bootstrapInitialMainWindowIfNeeded(...) calls ensureInitialMainWindowIfNeeded() to create (if needed) the real AppKit main window via AppDelegate.createMainWindow, which wires CmuxConfigStore and FileExplorerState and calls registerMainWindow(... fileExplorerState:). Only after registration does updateSocketController() start TerminalController using AppDelegate.synchronizeActiveMainWindowContext(...). Conclusion: per‑window config/file‑explorer/directory initialization is handled in AppDelegate and occurs before TerminalController starts; do not flag missing setup in WindowGroup.onAppear.

Learnt from: arieltobiana
Repo: manaflow-ai/cmux PR: 1873
File: Sources/TerminalController.swift:4071-4087
Timestamp: 2026-03-20T17:18:30.333Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2WorkspaceAction(params:) -> case "set_color": palette names are resolved via WorkspaceTabColorSettings.defaultPaletteWithOverrides(), whose entries are always valid hex (validated by the UI). Therefore, additional normalization of entry.hex is unnecessary.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/GhosttyTerminalView.swift (PR `#3237`, commit 9dcb9c2), the explicit-vs-baseConfig.initialInput resolution logic was extracted from `TerminalSurface.createSurface(for:)` into a standalone `TerminalSurface.resolveInitialInput(...)` static/instance method for unit-testability. Behavior is unchanged. A companion `TerminalSurfaceResolveInitialInputTests` suite asserts the contract, including byte-for-byte preservation of Ghostty raw-bytes startup-input via `baseConfig.initialInput`.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2528
File: Sources/AppDelegate.swift:2196-2200
Timestamp: 2026-04-03T03:36:45.112Z
Learning: Repo: manaflow-ai/cmux — In Sources/AppDelegate.swift, when KeyboardShortcutSettings.didChangeNotification fires, AppDelegate must clear configured-chord caches (pendingConfiguredShortcutChord and activeConfiguredShortcutChordPrefixForCurrentEvent) via clearConfiguredShortcutChordState() before refreshing tooltips/UI. Also clear chord state on applicationWillResignActive to avoid cross-activity leakage. Verified by cmuxTests/AppDelegateShortcutRoutingTests.swift::testShortcutChangeClearsPendingConfiguredChord.

Learnt from: Horacehxw
Repo: manaflow-ai/cmux PR: 1980
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-04-06T09:33:43.688Z
Learning: Repo: manaflow-ai/cmux — File: Sources/AppDelegate.swift — UI test launch stabilization: in stabilizeUITestLaunchWindowAndForeground(attempt:), call moveUITestWindowToTargetDisplayIfNeeded() only on the first pass (attempt == 0) so the helper’s own 20-step retry handles display moves; subsequent attempts only activate the app and write diagnostics. This avoids nested overlapping retries and stage-log churn.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:15597-15614
Timestamp: 2026-04-14T20:29:58.471Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift (PR `#2647`, macOS 26): SplitViewDividerHiderView hides split dividers by calling the private selector setDividerColor: only when responds(to:) is true (no KVC). Scope is effectively the single NSSplitView owned by NavigationSplitView. Do not flag KVC misuse or “global divider clearing” for this path unless additional NSSplitViews are added.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:2889-2911
Timestamp: 2026-04-14T19:59:54.878Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26, the NavigationSplitView sidebar width is synchronized back to model state via a GeometryReader that updates sidebarWidth and SidebarState.persistedWidth on width changes. Do not flag “write-only sidebar width” drift for this path going forward.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/GhosttyTerminalView.swift (PR `#3237`, commit 9dcb9c2), `private var initialInput` on `TerminalSurface` was changed to `private(set) var initialInput` to allow `testable` consumers to assert the post-normalization value. The setter remains class-private.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/Windowing/WindowAppearanceSnapshot.swift:185-210
Timestamp: 2026-04-27T06:58:26.717Z
Learning: Repo: manaflow-ai/cmux — Sources/GhosttyTerminalView.swift & Sources/ContentView.swift — Snapshot refresh contract for usesHostLayerBackground (post PR `#3166`):
- `updateDefaultBackground()` must fire `notifyDefaultBackgroundDidChange()` (or equivalent generation bump) whenever `usesHostLayerBackground` changes, even if terminal background color and opacity are unchanged, because `WindowAppearanceSnapshot.terminalRenderingMode(usesHostLayerBackground:)` depends on it.
- ContentView must subscribe to the Ghostty default-background notification at the window level (not just color/opacity changes) so the titlebar/window snapshot (`windowAppearanceSnapshot`) is recomputed whenever the rendering mode toggles.
- Do NOT gate the notification solely on color hasChanged; rendering-mode-only transitions must also propagate through the same notification channel.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2575
File: Sources/cmuxApp.swift:0-0
Timestamp: 2026-04-06T08:59:21.923Z
Learning: Repo: manaflow-ai/cmux — File: Sources/cmuxApp.swift — In SettingsView, when handling SettingsNavigationRequest, clear the sidebar search first (settingsSearchText = "") before calling scrollTo; sections are conditionally rendered based on the active query, so clearing ensures the target anchors (e.g., SettingsSection.browser, SettingsSection.keyboardShortcuts, SettingsNavigationTarget.browserImport) exist.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:2918-2932
Timestamp: 2026-04-14T20:05:27.511Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift (PR `#2647`): On macOS 26, NavigationSplitView provides a native collapse chevron in the sidebar column header when the sidebar is visible. The code intentionally: (1) shows a custom toolbar toggle only when the sidebar is hidden to reopen it, and (2) uses SystemSidebarToggleStripper to remove the system-injected toolbar toggle to prevent duplication. Do not flag “no collapse affordance” while the sidebar is open.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2575
File: Sources/cmuxApp.swift:0-0
Timestamp: 2026-04-06T09:01:51.979Z
Learning: Repo: manaflow-ai/cmux — File: Sources/cmuxApp.swift — SettingsView now uses SwiftUI `.searchable(text:placement:prompt:)` for the sidebar search, which provides a native (accessible) clear button. Do not flag missing accessibility on a custom clear button in this view going forward.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-04T14:05:42.574Z
Learning: Guideline: In Swift files (cmux project), when handling pluralized strings, prefer using localization keys with the ICU-style plural forms .one and .other. For example, use keys like statusMenu.unreadCount.one for the singular case (1) and statusMenu.unreadCount.other for all other counts, and similarly for statusMenu.tooltip.unread.one/other. Rationale: ensures correct pluralization across locales and makes localization keys explicit. Review code to ensure any unread count strings and related tooltips follow this .one/.other key pattern and verify the correct value is chosen based on the count.

Learnt from: austinywang
Repo: manaflow-ai/cmux PR: 954
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-05T22:04:34.712Z
Learning: Adopt the convention: for health/telemetry tri-state values in Swift, prefer Optionals (Bool?) over sentinel booleans. In TerminalController.swift, socketConnectable is Bool? and only set when socketProbePerformed is true; downstream logic must treat nil as 'not probed'. Ensure downstream code checks for nil before using a value and uses explicit non-nil checks to determine state, improving clarity and avoiding misinterpretation of default false.

Learnt from: moyashin63
Repo: manaflow-ai/cmux PR: 1074
File: Sources/AppDelegate.swift:7523-7545
Timestamp: 2026-03-09T01:38:24.337Z
Learning: When the command palette is visible (as in manaflow-ai/cmux Sources/AppDelegate.swift), ensure the shortcut handling consumes most Command shortcuts to protect the palette's text input. Specifically, do not allow UI zoom shortcuts (Cmd+Shift+= / Cmd+Shift+− / Cmd+Shift+0) to trigger while the palette is open. Do not reorder shortcut handlers (e.g., uiZoomShortcutAction(...)) to bypass this guard; users must close the palette before performing zoom actions. This guideline should apply to Swift source files handling global shortcuts within the app.

Learnt from: zlatkoc
Repo: manaflow-ai/cmux PR: 1368
File: Sources/Panels/BrowserPanel.swift:69-69
Timestamp: 2026-03-13T13:46:01.733Z
Learning: Do not wrap engine/brand name literals (e.g., displayName values such as Google, DuckDuckGo, Bing, Kagi, Startpage) in String(localized: ...). These are brand/product names that are not translatable UI text. Localization should apply to generic UI strings (labels, buttons, error messages, etc.). Apply this guideline across Swift source files under Sources/ (notably in BrowserPanel.swift and similar UI/engine-related strings) and flag only brand-name strings that are part of user-facing UI text appropriately for translation scope.

Learnt from: kjb0787
Repo: manaflow-ai/cmux PR: 1461
File: Sources/GhosttyTerminalView.swift:5904-5905
Timestamp: 2026-03-15T19:22:32.330Z
Learning: In Swift files under the Sources directory that manage terminal/scroll behavior, ensure the following: when preserving scroll across workspace switches, save savedScrollRow only if the scrollbar offset is greater than 0 (indicating the user has scrolled up). On restore, call scroll_to_row only if savedScrollRow is non-nil; if it is nil, rely on synchronizeScrollView() to keep bottom-pinned sessions following new output. This pattern should be applied wherever GhosttyTerminalView-like views implement setVisibleInUI(_:) to maintain consistent user scroll state across workspace switches.

Learnt from: pratikpakhale
Repo: manaflow-ai/cmux PR: 2011
File: Resources/Localizable.xcstrings:15256-15368
Timestamp: 2026-03-23T21:39:50.795Z
Learning: When reviewing this repo’s Swift localization usage, do not flag missing `String.localizedStringWithFormat` for calls that use the modern overload `String(localized: "key", defaultValue: "...\(variable)")` (where `defaultValue` is a `String.LocalizationValue` built with `\(…)`). That overload natively supports interpolation and the xcstrings/runtime substitution handles the resulting placeholders automatically. Only require `String.localizedStringWithFormat` when using the older `String(localized:)` overload that takes a plain `String` (i.e., where format arguments must be passed separately), such as for keys like `clipboard.sshError.single`.

Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: Sources/TerminalController.swift:3620-3622
Timestamp: 2026-03-25T00:32:54.735Z
Learning: When validating or reporting workspace/tab colors in this repo, only accept and use 6-digit hex colors in the form `#RRGGBB` (no alpha, i.e., do not allow `#RRGGBBAA`). Ensure validation logic matches the existing behavior (e.g., WorkspaceTabColorSettings.normalizedHex(...) and TabManager.setTabColor(tabId:color:) as well as CLI/cmux.swift). Update any error/help text for workspace color to reference only `#RRGGBB` (not `#RRGGBBAA`).

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 2545
File: Sources/GhosttyTerminalView.swift:3891-3903
Timestamp: 2026-04-02T21:37:21.463Z
Learning: In Swift source files like Sources/GhosttyTerminalView.swift, avoid logging raw startup commands or initialInput even in DEBUG (to prevent leaking sensitive paths/tokens and multiline content). If you need to diagnose startup/input, log only non-sensitive metadata such as (1) presence flags (e.g., hasStartupCommand/hasInitialInput), (2) byte counts, and (3) the relevant surface id (so issues can be correlated without exposing the underlying strings).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2528
File: Sources/cmuxApp.swift:6439-6444
Timestamp: 2026-04-03T03:35:54.082Z
Learning: In this repo’s keyboard shortcut implementation, ensure `KeyboardShortcutSettings.setShortcut(...)` does nothing (no-op) when `KeyboardShortcutSettings.isManagedBySettingsFile(action)` returns `true` (i.e., the shortcut is managed via `settings.json`). This prevents writing back overrides into `UserDefaults` and keeps `settings.json` as the source of truth.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2964
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-17T21:35:25.493Z
Learning: In this repo’s shell session resume flow, always build resume commands using the cwd guard helper exposed by SessionEntry (e.g., resumeCommandWithCwd). The helper should produce a command of the form `cd <shell-quoted cwd> && <resumeCommand>`. Update all call sites that generate “resume” commands (e.g., clipboard actions, drag-drop terminal, and in-app resume) to use this helper so that rc files and newly spawned shells cannot start outside the intended directory. Avoid constructing resume commands directly without the guarded `cd` + shell-quoting + `&&` composition.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2978
File: Sources/Workspace.swift:0-0
Timestamp: 2026-04-22T08:13:36.833Z
Learning: In manaflow-ai/cmux, note that Sources/RestorableAgentSession.swift’s `SessionRestorableAgentSnapshot.resumeCommand` already includes a cwd guard when `workingDirectory` is present (it returns a string like `cd <shell-quoted cwd> && <resumeCommand>`). At call sites (e.g., `Workspace.createPanel(...)`), pass `.resumeCommand` through directly and do not prepend another `cd`/cwd guard or wrap it with an additional `cd <...> &&`—otherwise the working directory may be applied twice or incorrectly.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2978
File: Sources/Workspace.swift:0-0
Timestamp: 2026-04-22T08:14:04.901Z
Learning: In the cmux Swift sources, when restoring a restorable agent session, call sites should pass `resumeCommand` directly (ensuring it has the expected trailing newline if required) to `sendInputWhenReady`. Do not wrap `resumeCommand` with an additional `cd '<cwd>' && ...` guard, because `SessionRestorableAgentSnapshot.resumeCommand` already returns a `cwd`-guarded command; adding another guard can result in `double-cd`. Apply this especially along restore paths (e.g., `Sources/Workspace.swift` restore logic) whenever using `resumeCommand`.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3084
File: Sources/AppDelegate.swift:4958-4975
Timestamp: 2026-04-22T11:37:36.238Z
Learning: In Swift code, when re-registering or updating an existing window/session context (e.g., in AppDelegate.registerMainWindow or similar flows), only update an existing *cmuxConfigStore* (or equivalent per-window configuration store) if the incoming configuration/store value is non-nil. Do not overwrite an existing per-window store with nil, so the previous per-window configuration is preserved across re-registration paths.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3128
File: Sources/Panels/BrowserPanelView.swift:4271-4290
Timestamp: 2026-04-23T11:23:49.934Z
Learning: In OmnibarSuggestionsView (and other omnibar-related debug/telemetry logging), never log raw omnibar suggestion content (e.g., URLs, titles, queries). Instead, log only non-sensitive metadata such as suggestion kind/category and the byte length of the text (e.g., "browser.suggestionClick kind=<kind> textBytes=<len>"). Apply this rule consistently to all omnibar-related debug logs to avoid leaking user/search data.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3046
File: Sources/TerminalController.swift:2096-2136
Timestamp: 2026-04-24T22:17:52.550Z
Learning: In Swift request/JSON handlers (e.g., v2 JSON-socket handlers) in Sources, prefer using the v2 helpers for numeric parsing—use `v2Int(params, "<key>")` for normal integer inputs and `v2StrictInt(...)` when strictness is required—rather than casting with `as? Int`. JSONSerialization may yield NSNumber/Double for numeric fields, so v2Int/v2StrictInt ensures correct extraction and type handling. If parsing is used for safety (e.g., timeouts), clamp/validate the parsed value as appropriate (as in `vm.exec` parsing `timeout_ms` and enforcing `>= 1`).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3182
File: Sources/ContentView.swift:10850-10875
Timestamp: 2026-04-27T10:11:36.830Z
Learning: When computing NSTextView content height for NSTextView-based editors (e.g., a method like naturalDocumentHeight(...)), account for trailing newline layout. Specifically, include `layoutManager.extraLineFragmentRect.height` in the measured height only when `extraLineFragmentTextContainer == textContainer`. If you don’t, the caret on the final blank line can be clipped. Apply this rule to future NSTextView-based editors in this repo.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3139
File: Sources/Panels/FilePreviewPanel.swift:534-537
Timestamp: 2026-04-28T05:45:32.192Z
Learning: When implementing workspace/panel teardown or close-confirmation logic in Sources (e.g., close/collapse/workspace-close flows), rely on the shared dirty-state gate driven by the panel’s `isDirty` property rather than adding panel-specific teardown special-casing. Ensure each panel (including `FilePreviewPanel`) exposes and keeps its `isDirty` state up to date (e.g., via `Published private(set) var isDirty` and any subscriptions/synchronization logic), so the generic `panel.isDirty` check correctly covers all panel types during teardown.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3218
File: Sources/AppDelegate.swift:4800-4802
Timestamp: 2026-04-28T11:43:53.356Z
Learning: In Swift code that selects or activates the next main-window context (e.g., iterating window-context collections), avoid iterating `mainWindowContexts.values` directly while calling `resolvedWindow(for:)`. Since `resolvedWindow(for:)` may reindex/mutate `mainWindowContexts`, this can cause mutation-during-enumeration issues. Instead, snapshot first with `Array(mainWindowContexts.values)`, then resolve/reindex against that snapshot, and only then call `activateMainWindowContext(_:)` using the resolved result.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3247
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-29T01:08:39.652Z
Learning: Maintain the behavior contract for “Copy Workspace ID(s)”: when triggered from the sidebar context menu (e.g., in Sources/ContentView.swift TabItemView), the command must copy plain UUIDs (IDs-only), not references/refs. For command palette identifier-copy commands where refs are required, ensure the implementation explicitly passes includeRefs: true. This preserves backward compatibility for scripts expecting UUID-only output while allowing the palette to return richer payloads when needed.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3256
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-04-29T01:20:59.683Z
Learning: In this repo’s Swift implementation, keep browser-creation/open behavior consistent when `BrowserAvailabilitySettings` is disabled. For both V1 and V2, any command that includes a URL when creating/opening a browser (e.g., `open_browser` with a URL, `v2 surface.create` with `type=browser` and `url`, `browser.tab.new` with `url`, `v2 browser.open_split` with `url`) must open the URL externally using `NSWorkspace.shared.open(...)` and return appropriate success metadata. Only URL-less/blank browser creations should fail with the `browser_disabled` error.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lawrencecchen, thanks for clarifying. You're right — looking at the original implementation, trafficLightOffset(for:) returned .zero for all non-settings windows already, so the only offset ever applied was the NSPoint(x: 7, y: -4) nudge specific to cmux.settings. Since PR #3244 migrates Settings to a native SwiftUI WindowGroup titlebar (eliminating the need for that manual alignment), collapsing the whole function to return .zero is correct and loses nothing. I'll record this for future reviews.


✏️ Learnings added
Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3244
File: Sources/WindowDecorationsController.swift:71-73
Timestamp: 2026-04-29T06:25:03.715Z
Learning: Repo: manaflow-ai/cmux — Sources/WindowDecorationsController.swift — `trafficLightOffset(for:)` previously returned a non-zero offset (`NSPoint(x: 7, y: -4)`) only for the `cmux.settings` window identifier (to align traffic-light buttons with a custom Settings title row), and `.zero` for all other windows. PR `#3244` intentionally removed this Settings-specific offset by collapsing the function to `return .zero`, because Settings was migrated to a SwiftUI `WindowGroup` with a native system titlebar that no longer needs manual traffic-light nudging. Do not flag the unconditional `return .zero` in this method as a regression.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:3586-3604
Timestamp: 2026-04-14T20:00:21.500Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26+, the app intentionally keeps NSWindow.StyleMask.fullSizeContentView enabled even with the native (non-transparent) system titlebar. The titlebar handles dragging natively; isMovable=true and isMovableByWindowBackground=false are used. Any comment suggesting “without fullSizeContentView” is outdated.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2124
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-25T08:05:26.034Z
Learning: Repo: manaflow-ai/cmux — File: Sources/AppDelegate.swift — Pattern for “New Window” geometry seed:
In AppDelegate.createMainWindow(initialWorkingDirectory:sessionWindowSnapshot:), compute the existingFrame using preferredMainWindowContextForWorkspaceCreation(debugSource: "createMainWindow.initialGeometry") and then resolvedWindow(for:) rather than relying on NSApp.keyWindow or the first registered mainWindowContext. Rationale: ensures the new window inherits size from the intended main-terminal window even when an auxiliary window is key, and keeps behavior consistent with showOpenFolderPanel().

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3179
File: Sources/ContentView.swift:4005-4021
Timestamp: 2026-04-27T11:59:15.622Z
Learning: Repo: manaflow-ai/cmux — PR `#3179` — Sources/ContentView.swift
Learning: For separate-surface transparent windows, installNativeTitlebarBackdrop intentionally inserts NativeTitlebarBackdropView below contentView (NSHostingView) — positioned .below relativeTo: contentView — so the backdrop fills through transparent hosting without tinting SwiftUI titlebar text/buttons. The titlebar‑chrome ancestor fallback is only for edge cases where contentView isn’t directly under the NSThemeFrame. This layering was pixel‑verified in PR `#3179`; do not “fix” it to sit below the titlebar chrome on this path.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3179
File: Sources/ContentView.swift:3991-4002
Timestamp: 2026-04-27T09:15:53.326Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — Native titlebar backdrop layering: installNativeTitlebarBackdrop must place the backdrop between the NSThemeFrame’s background material and the standard titlebar chrome (insert .below the close button’s ancestor in the theme frame). When the titlebar-chrome ancestor lookup fails, fall back to inserting .below relativeTo: nil so the backdrop is behind existing siblings and does not overpaint the SwiftUI titlebar/sidebar strip. Visual matching has been verified via pixel samples.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/ContentView.swift:3194-3196
Timestamp: 2026-03-04T14:05:48.668Z
Learning: In manaflow-ai/cmux (PR `#819`), Sources/ContentView.swift: The command palette’s external window labels intentionally use the global window index from the full orderedSummaries (index + 1), matching the Window menu in AppDelegate. Do not reindex after filtering out the current window to avoid mismatches (“Window 2” for an external window is expected).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-27T06:58:21.434Z
Learning: In the Swift UI code (e.g., Sources/ContentView.swift), when `preferLiquidGlass`/`materialPolicy.preferLiquidGlass` is enabled for sidebar Liquid Glass, only omit the `Color` tint overlay if `NSGlassEffectView` (native Liquid Glass) is actually available. Compute `usingNativeLiquidGlass = materialPolicy.preferLiquidGlass && SidebarVisualEffectBackground.liquidGlassAvailable`, and when `usingNativeLiquidGlass` is false keep the overlay so the non-native `NSVisualEffectView` fallback still receives the configured tint.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3218
File: Sources/AppDelegate.swift:3456-3469
Timestamp: 2026-04-28T11:35:31.575Z
Learning: Repo: manaflow-ai/cmux — Sources/AppDelegate.swift (Swift)
Learning: The DEBUG-only helper unregisterMainWindowContextForTesting(windowId:) should mirror production teardown: after removing matching mainWindowContexts entries, call activateMainWindowContext(mainWindowContexts.values.first) when the active context was removed so tabManager, sidebarState, sidebarSelectionState, and fileExplorerState are repointed (or cleared when none remain). This prevents stale active pointers in tests.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/Windowing/WindowAppearanceSnapshot.swift:185-210
Timestamp: 2026-04-27T06:58:26.079Z
Learning: Repo: manaflow-ai/cmux — Sources/GhosttyTerminalView.swift & Sources/Windowing/WindowAppearanceSnapshot.swift — Snapshot refresh contract for usesHostLayerBackground:
`notifyDefaultBackgroundDidChange()` (and therefore the titlebar/window snapshot refresh in ContentView) must fire whenever `usesHostLayerBackground` changes, even if terminal background color and opacity are unchanged. The prior `hasChanged` check in `updateDefaultBackground()` only compared colors; it was extended so that a toggle of `usesHostLayerBackground` alone also triggers the notification. ContentView listens at the window level to rebuild `WindowAppearanceSnapshot` (including `terminalRenderingMode`) on any such notification. Fixed in commits 4913d17–979a683 (PR `#3166`).

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:15597-15615
Timestamp: 2026-04-14T20:05:53.504Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26 in this app, the only NSSplitView in the window’s view tree is the one owned by NavigationSplitView. Therefore SplitViewDividerHiderView.hideDividers()/patchSplitViews(in:) effectively scope to that single split. Do not flag “global divider clearing” for this path unless additional split views are introduced later.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/AppDelegate.swift:10168-10189
Timestamp: 2026-04-14T20:02:41.558Z
Learning: Repo manaflow-ai/cmux — On macOS 26, the notifications popover is owned by ContentView (State isNotificationsPopoverPresented). AppDelegate APIs (toggle/show/dismiss/isShown) must route via NotificationCenter with a window-scoped userInfo["windowId"] and track visibility per-window, not call UpdateTitlebarAccessoryController. ContentView should observe show/dismiss/toggle and post a visibilityDidChange notification {windowId, visible}.

Learnt from: tranquillum
Repo: manaflow-ai/cmux PR: 2827
File: Sources/Sidebar/ProviderAccountsFooterPanel.swift:174-198
Timestamp: 2026-04-17T15:46:53.298Z
Learning: Repo: manaflow-ai/cmux — Sources/Sidebar/ProviderAccountsFooterPanel.swift + Sources/Sidebar/ProviderAccountsPopover.swift (PR `#2827`):
- `ProviderStatusRanking.impactSeverity(_:)` intentionally returns `-1` for any unrecognized/`"none"` impact string.
- When `worstImpactSeverity == -1` (every incident in the list has an unknown/none impact), `ProviderStatusLabel.statusText` and `.dotColor` fall through to the `default` branch, which shows "Operational" / green.
- This is a deliberate design choice: `StatuspageIOFetcher.fetch` already defaults missing impact fields to `"none"`, so the only way to reach `worstImpactSeverity == -1` is a genuinely benign incident array; showing "Operational" here avoids false-positive yellow.
- The popover always surfaces the full raw incident rows independently, so no incident is invisible to the user.
- Do NOT flag the `-1 → Operational` fallback as a bug or suggest raising unknown impacts to `minor` severity.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/Workspace.swift (PR `#3237`, commit 9dcb9c2), the `newTerminalSurface(...)` method gained an `allowInitialInputWithRemoteStartupCommand: Bool` parameter (default `false`). The session-restore call site in `createPanel(from:inPane:)` passes `true` only when `!panelWasRemoteBacked && combinedInitialInput != nil`, making the per-panel snapshot flag the sole authority for restore-time `initialInput` injection. All 12 other call sites keep `false`, preserving the existing remote-drop defense.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3164
File: Sources/cmuxApp.swift:189-197
Timestamp: 2026-04-26T06:03:08.863Z
Learning: Repo: manaflow-ai/cmux — PR `#3164` — Bootstrap contract: In cmuxApp.bootstrapMainWindowScene(), AppDelegate.bootstrapInitialMainWindowIfNeeded(...) calls ensureInitialMainWindowIfNeeded() to create (if needed) the real AppKit main window via AppDelegate.createMainWindow, which wires CmuxConfigStore and FileExplorerState and calls registerMainWindow(... fileExplorerState:). Only after registration does updateSocketController() start TerminalController using AppDelegate.synchronizeActiveMainWindowContext(...). Conclusion: per‑window config/file‑explorer/directory initialization is handled in AppDelegate and occurs before TerminalController starts; do not flag missing setup in WindowGroup.onAppear.

Learnt from: pstanton237
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-06T12:03:16.921Z
Learning: Repo: manaflow-ai/cmux — In CLI/cmux.swift, `claudeTeamsLaunchArguments` must use two independent branches: (1) prepend `--teammate-mode auto` only when the caller has NOT already supplied `--teammate-mode`; (2) append `--settings <claudeHooksJSON>` unconditionally (modulo `CMUX_CLAUDE_HOOKS_DISABLED=1` opt-out). These two branches must never be coupled in a single early-return or conditional block — coupling them was the original `#2229` regression (hook JSON silently bypassed when `--teammate-mode auto|manual` was explicit). Mirrors `Resources/bin/claude:208`: `exec "$REAL_CLAUDE" --settings "$HOOKS_JSON" "$@"` where `$@` content never gates hook injection.

Learnt from: MaTriXy
Repo: manaflow-ai/cmux PR: 1460
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-16T08:02:06.824Z
Learning: In Swift sources, for any panel_id-only route handling in v2PanelMarkBackground(params:) and v2PanelMarkForeground(params:), first attempt v2ResolveTabManager(params:). Use the manager only if it actually owns the panelId; otherwise fall back to AppDelegate.shared?.locateSurface(surfaceId:) to locate the correct TabManager across windows. Apply this pattern to all panel_id-only routes to avoid active-window bias.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2528
File: Sources/AppDelegate.swift:2196-2200
Timestamp: 2026-04-03T03:36:45.112Z
Learning: Repo: manaflow-ai/cmux — In Sources/AppDelegate.swift, when KeyboardShortcutSettings.didChangeNotification fires, AppDelegate must clear configured-chord caches (pendingConfiguredShortcutChord and activeConfiguredShortcutChordPrefixForCurrentEvent) via clearConfiguredShortcutChordState() before refreshing tooltips/UI. Also clear chord state on applicationWillResignActive to avoid cross-activity leakage. Verified by cmuxTests/AppDelegateShortcutRoutingTests.swift::testShortcutChangeClearsPendingConfiguredChord.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/GhosttyTerminalView.swift (PR `#3237`, commit 9dcb9c2), the explicit-vs-baseConfig.initialInput resolution logic was extracted from `TerminalSurface.createSurface(for:)` into a standalone `TerminalSurface.resolveInitialInput(...)` static/instance method for unit-testability. Behavior is unchanged. A companion `TerminalSurfaceResolveInitialInputTests` suite asserts the contract, including byte-for-byte preservation of Ghostty raw-bytes startup-input via `baseConfig.initialInput`.

Learnt from: arieltobiana
Repo: manaflow-ai/cmux PR: 1873
File: Sources/TerminalController.swift:4071-4087
Timestamp: 2026-03-20T17:18:30.333Z
Learning: Repo: manaflow-ai/cmux — In Sources/TerminalController.swift, v2WorkspaceAction(params:) -> case "set_color": palette names are resolved via WorkspaceTabColorSettings.defaultPaletteWithOverrides(), whose entries are always valid hex (validated by the UI). Therefore, additional normalization of entry.hex is unnecessary.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:15597-15614
Timestamp: 2026-04-14T20:29:58.471Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift (PR `#2647`, macOS 26): SplitViewDividerHiderView hides split dividers by calling the private selector setDividerColor: only when responds(to:) is true (no KVC). Scope is effectively the single NSSplitView owned by NavigationSplitView. Do not flag KVC misuse or “global divider clearing” for this path unless additional NSSplitViews are added.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:2889-2911
Timestamp: 2026-04-14T19:59:54.878Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift — On macOS 26, the NavigationSplitView sidebar width is synchronized back to model state via a GeometryReader that updates sidebarWidth and SidebarState.persistedWidth on width changes. Do not flag “write-only sidebar width” drift for this path going forward.

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 0
File: :0-0
Timestamp: 2026-04-28T22:24:17.987Z
Learning: Repo: manaflow-ai/cmux — In Sources/GhosttyTerminalView.swift (PR `#3237`, commit 9dcb9c2), `private var initialInput` on `TerminalSurface` was changed to `private(set) var initialInput` to allow `testable` consumers to assert the post-normalization value. The setter remains class-private.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3166
File: Sources/Windowing/WindowAppearanceSnapshot.swift:185-210
Timestamp: 2026-04-27T06:58:26.717Z
Learning: Repo: manaflow-ai/cmux — Sources/GhosttyTerminalView.swift & Sources/ContentView.swift — Snapshot refresh contract for usesHostLayerBackground (post PR `#3166`):
- `updateDefaultBackground()` must fire `notifyDefaultBackgroundDidChange()` (or equivalent generation bump) whenever `usesHostLayerBackground` changes, even if terminal background color and opacity are unchanged, because `WindowAppearanceSnapshot.terminalRenderingMode(usesHostLayerBackground:)` depends on it.
- ContentView must subscribe to the Ghostty default-background notification at the window level (not just color/opacity changes) so the titlebar/window snapshot (`windowAppearanceSnapshot`) is recomputed whenever the rendering mode toggles.
- Do NOT gate the notification solely on color hasChanged; rendering-mode-only transitions must also propagate through the same notification channel.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2575
File: Sources/cmuxApp.swift:0-0
Timestamp: 2026-04-06T08:59:21.923Z
Learning: Repo: manaflow-ai/cmux — File: Sources/cmuxApp.swift — In SettingsView, when handling SettingsNavigationRequest, clear the sidebar search first (settingsSearchText = "") before calling scrollTo; sections are conditionally rendered based on the active query, so clearing ensures the target anchors (e.g., SettingsSection.browser, SettingsSection.keyboardShortcuts, SettingsNavigationTarget.browserImport) exist.

Learnt from: rodchristiansen
Repo: manaflow-ai/cmux PR: 2647
File: Sources/ContentView.swift:2918-2932
Timestamp: 2026-04-14T20:05:27.511Z
Learning: Repo: manaflow-ai/cmux — Sources/ContentView.swift (PR `#2647`): On macOS 26, NavigationSplitView provides a native collapse chevron in the sidebar column header when the sidebar is visible. The code intentionally: (1) shows a custom toolbar toggle only when the sidebar is hidden to reopen it, and (2) uses SystemSidebarToggleStripper to remove the system-injected toolbar toggle to prevent duplication. Do not flag “no collapse affordance” while the sidebar is open.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2575
File: Sources/cmuxApp.swift:0-0
Timestamp: 2026-04-06T09:01:51.979Z
Learning: Repo: manaflow-ai/cmux — File: Sources/cmuxApp.swift — SettingsView now uses SwiftUI `.searchable(text:placement:prompt:)` for the sidebar search, which provides a native (accessible) clear button. Do not flag missing accessibility on a custom clear button in this view going forward.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-04T14:05:42.574Z
Learning: Guideline: In Swift files (cmux project), when handling pluralized strings, prefer using localization keys with the ICU-style plural forms .one and .other. For example, use keys like statusMenu.unreadCount.one for the singular case (1) and statusMenu.unreadCount.other for all other counts, and similarly for statusMenu.tooltip.unread.one/other. Rationale: ensures correct pluralization across locales and makes localization keys explicit. Review code to ensure any unread count strings and related tooltips follow this .one/.other key pattern and verify the correct value is chosen based on the count.

Learnt from: austinywang
Repo: manaflow-ai/cmux PR: 954
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-05T22:04:34.712Z
Learning: Adopt the convention: for health/telemetry tri-state values in Swift, prefer Optionals (Bool?) over sentinel booleans. In TerminalController.swift, socketConnectable is Bool? and only set when socketProbePerformed is true; downstream logic must treat nil as 'not probed'. Ensure downstream code checks for nil before using a value and uses explicit non-nil checks to determine state, improving clarity and avoiding misinterpretation of default false.

Learnt from: moyashin63
Repo: manaflow-ai/cmux PR: 1074
File: Sources/AppDelegate.swift:7523-7545
Timestamp: 2026-03-09T01:38:24.337Z
Learning: When the command palette is visible (as in manaflow-ai/cmux Sources/AppDelegate.swift), ensure the shortcut handling consumes most Command shortcuts to protect the palette's text input. Specifically, do not allow UI zoom shortcuts (Cmd+Shift+= / Cmd+Shift+− / Cmd+Shift+0) to trigger while the palette is open. Do not reorder shortcut handlers (e.g., uiZoomShortcutAction(...)) to bypass this guard; users must close the palette before performing zoom actions. This guideline should apply to Swift source files handling global shortcuts within the app.

Learnt from: zlatkoc
Repo: manaflow-ai/cmux PR: 1368
File: Sources/Panels/BrowserPanel.swift:69-69
Timestamp: 2026-03-13T13:46:01.733Z
Learning: Do not wrap engine/brand name literals (e.g., displayName values such as Google, DuckDuckGo, Bing, Kagi, Startpage) in String(localized: ...). These are brand/product names that are not translatable UI text. Localization should apply to generic UI strings (labels, buttons, error messages, etc.). Apply this guideline across Swift source files under Sources/ (notably in BrowserPanel.swift and similar UI/engine-related strings) and flag only brand-name strings that are part of user-facing UI text appropriately for translation scope.

Learnt from: kjb0787
Repo: manaflow-ai/cmux PR: 1461
File: Sources/GhosttyTerminalView.swift:5904-5905
Timestamp: 2026-03-15T19:22:32.330Z
Learning: In Swift files under the Sources directory that manage terminal/scroll behavior, ensure the following: when preserving scroll across workspace switches, save savedScrollRow only if the scrollbar offset is greater than 0 (indicating the user has scrolled up). On restore, call scroll_to_row only if savedScrollRow is non-nil; if it is nil, rely on synchronizeScrollView() to keep bottom-pinned sessions following new output. This pattern should be applied wherever GhosttyTerminalView-like views implement setVisibleInUI(_:) to maintain consistent user scroll state across workspace switches.

Learnt from: pratikpakhale
Repo: manaflow-ai/cmux PR: 2011
File: Resources/Localizable.xcstrings:15256-15368
Timestamp: 2026-03-23T21:39:50.795Z
Learning: When reviewing this repo’s Swift localization usage, do not flag missing `String.localizedStringWithFormat` for calls that use the modern overload `String(localized: "key", defaultValue: "...\(variable)")` (where `defaultValue` is a `String.LocalizationValue` built with `\(…)`). That overload natively supports interpolation and the xcstrings/runtime substitution handles the resulting placeholders automatically. Only require `String.localizedStringWithFormat` when using the older `String(localized:)` overload that takes a plain `String` (i.e., where format arguments must be passed separately), such as for keys like `clipboard.sshError.single`.

Learnt from: thunter009
Repo: manaflow-ai/cmux PR: 1825
File: Sources/TerminalController.swift:3620-3622
Timestamp: 2026-03-25T00:32:54.735Z
Learning: When validating or reporting workspace/tab colors in this repo, only accept and use 6-digit hex colors in the form `#RRGGBB` (no alpha, i.e., do not allow `#RRGGBBAA`). Ensure validation logic matches the existing behavior (e.g., WorkspaceTabColorSettings.normalizedHex(...) and TabManager.setTabColor(tabId:color:) as well as CLI/cmux.swift). Update any error/help text for workspace color to reference only `#RRGGBB` (not `#RRGGBBAA`).

Learnt from: mrosnerr
Repo: manaflow-ai/cmux PR: 2545
File: Sources/GhosttyTerminalView.swift:3891-3903
Timestamp: 2026-04-02T21:37:21.463Z
Learning: In Swift source files like Sources/GhosttyTerminalView.swift, avoid logging raw startup commands or initialInput even in DEBUG (to prevent leaking sensitive paths/tokens and multiline content). If you need to diagnose startup/input, log only non-sensitive metadata such as (1) presence flags (e.g., hasStartupCommand/hasInitialInput), (2) byte counts, and (3) the relevant surface id (so issues can be correlated without exposing the underlying strings).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2528
File: Sources/cmuxApp.swift:6439-6444
Timestamp: 2026-04-03T03:35:54.082Z
Learning: In this repo’s keyboard shortcut implementation, ensure `KeyboardShortcutSettings.setShortcut(...)` does nothing (no-op) when `KeyboardShortcutSettings.isManagedBySettingsFile(action)` returns `true` (i.e., the shortcut is managed via `settings.json`). This prevents writing back overrides into `UserDefaults` and keeps `settings.json` as the source of truth.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2964
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-17T21:35:25.493Z
Learning: In this repo’s shell session resume flow, always build resume commands using the cwd guard helper exposed by SessionEntry (e.g., resumeCommandWithCwd). The helper should produce a command of the form `cd <shell-quoted cwd> && <resumeCommand>`. Update all call sites that generate “resume” commands (e.g., clipboard actions, drag-drop terminal, and in-app resume) to use this helper so that rc files and newly spawned shells cannot start outside the intended directory. Avoid constructing resume commands directly without the guarded `cd` + shell-quoting + `&&` composition.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2978
File: Sources/Workspace.swift:0-0
Timestamp: 2026-04-22T08:13:36.833Z
Learning: In manaflow-ai/cmux, note that Sources/RestorableAgentSession.swift’s `SessionRestorableAgentSnapshot.resumeCommand` already includes a cwd guard when `workingDirectory` is present (it returns a string like `cd <shell-quoted cwd> && <resumeCommand>`). At call sites (e.g., `Workspace.createPanel(...)`), pass `.resumeCommand` through directly and do not prepend another `cd`/cwd guard or wrap it with an additional `cd <...> &&`—otherwise the working directory may be applied twice or incorrectly.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 2978
File: Sources/Workspace.swift:0-0
Timestamp: 2026-04-22T08:14:04.901Z
Learning: In the cmux Swift sources, when restoring a restorable agent session, call sites should pass `resumeCommand` directly (ensuring it has the expected trailing newline if required) to `sendInputWhenReady`. Do not wrap `resumeCommand` with an additional `cd '<cwd>' && ...` guard, because `SessionRestorableAgentSnapshot.resumeCommand` already returns a `cwd`-guarded command; adding another guard can result in `double-cd`. Apply this especially along restore paths (e.g., `Sources/Workspace.swift` restore logic) whenever using `resumeCommand`.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3084
File: Sources/AppDelegate.swift:4958-4975
Timestamp: 2026-04-22T11:37:36.238Z
Learning: In Swift code, when re-registering or updating an existing window/session context (e.g., in AppDelegate.registerMainWindow or similar flows), only update an existing *cmuxConfigStore* (or equivalent per-window configuration store) if the incoming configuration/store value is non-nil. Do not overwrite an existing per-window store with nil, so the previous per-window configuration is preserved across re-registration paths.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3128
File: Sources/Panels/BrowserPanelView.swift:4271-4290
Timestamp: 2026-04-23T11:23:49.934Z
Learning: In OmnibarSuggestionsView (and other omnibar-related debug/telemetry logging), never log raw omnibar suggestion content (e.g., URLs, titles, queries). Instead, log only non-sensitive metadata such as suggestion kind/category and the byte length of the text (e.g., "browser.suggestionClick kind=<kind> textBytes=<len>"). Apply this rule consistently to all omnibar-related debug logs to avoid leaking user/search data.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3046
File: Sources/TerminalController.swift:2096-2136
Timestamp: 2026-04-24T22:17:52.550Z
Learning: In Swift request/JSON handlers (e.g., v2 JSON-socket handlers) in Sources, prefer using the v2 helpers for numeric parsing—use `v2Int(params, "<key>")` for normal integer inputs and `v2StrictInt(...)` when strictness is required—rather than casting with `as? Int`. JSONSerialization may yield NSNumber/Double for numeric fields, so v2Int/v2StrictInt ensures correct extraction and type handling. If parsing is used for safety (e.g., timeouts), clamp/validate the parsed value as appropriate (as in `vm.exec` parsing `timeout_ms` and enforcing `>= 1`).

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3182
File: Sources/ContentView.swift:10850-10875
Timestamp: 2026-04-27T10:11:36.830Z
Learning: When computing NSTextView content height for NSTextView-based editors (e.g., a method like naturalDocumentHeight(...)), account for trailing newline layout. Specifically, include `layoutManager.extraLineFragmentRect.height` in the measured height only when `extraLineFragmentTextContainer == textContainer`. If you don’t, the caret on the final blank line can be clipped. Apply this rule to future NSTextView-based editors in this repo.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3139
File: Sources/Panels/FilePreviewPanel.swift:534-537
Timestamp: 2026-04-28T05:45:32.192Z
Learning: When implementing workspace/panel teardown or close-confirmation logic in Sources (e.g., close/collapse/workspace-close flows), rely on the shared dirty-state gate driven by the panel’s `isDirty` property rather than adding panel-specific teardown special-casing. Ensure each panel (including `FilePreviewPanel`) exposes and keeps its `isDirty` state up to date (e.g., via `Published private(set) var isDirty` and any subscriptions/synchronization logic), so the generic `panel.isDirty` check correctly covers all panel types during teardown.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3218
File: Sources/AppDelegate.swift:4800-4802
Timestamp: 2026-04-28T11:43:53.356Z
Learning: In Swift code that selects or activates the next main-window context (e.g., iterating window-context collections), avoid iterating `mainWindowContexts.values` directly while calling `resolvedWindow(for:)`. Since `resolvedWindow(for:)` may reindex/mutate `mainWindowContexts`, this can cause mutation-during-enumeration issues. Instead, snapshot first with `Array(mainWindowContexts.values)`, then resolve/reindex against that snapshot, and only then call `activateMainWindowContext(_:)` using the resolved result.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3247
File: Sources/ContentView.swift:0-0
Timestamp: 2026-04-29T01:08:39.652Z
Learning: Maintain the behavior contract for “Copy Workspace ID(s)”: when triggered from the sidebar context menu (e.g., in Sources/ContentView.swift TabItemView), the command must copy plain UUIDs (IDs-only), not references/refs. For command palette identifier-copy commands where refs are required, ensure the implementation explicitly passes includeRefs: true. This preserves backward compatibility for scripts expecting UUID-only output while allowing the palette to return richer payloads when needed.

Learnt from: lawrencecchen
Repo: manaflow-ai/cmux PR: 3256
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-04-29T01:20:59.683Z
Learning: In this repo’s Swift implementation, keep browser-creation/open behavior consistent when `BrowserAvailabilitySettings` is disabled. For both V1 and V2, any command that includes a URL when creating/opening a browser (e.g., `open_browser` with a URL, `v2 surface.create` with `type=browser` and `url`, `browser.tab.new` with `url`, `v2 browser.open_split` with `url`) must open the URL externally using `NSWorkspace.shared.open(...)` and return appropriate success metadata. Only URL-less/blank browser creations should fail with the `browser_disabled` error.


private func shouldHideTrafficLights(for window: NSWindow) -> Bool {
Expand Down
Loading
Loading