SplashGUI

Serve local GGUF/MLX models and keep a saved model list

- One SavedModel entry (id/label/path/mmproj) covers both saved Hub IDs and
  local files; the id IS the model ID, so per-model profiles, served name,
  grantedAuto and client configs keep working untouched
- Local launch appends --model-dir/--mmproj; the GUI mirrors the engine's
  parser refusals before starting (no --revision with local, --mmproj refused
  with --language-only, missing path/projector), and the auto local/<name> ID
  is sanitized to the repo-ID shape
- Model picker is now Splash suggested / Saved / Custom…; a saved entry renames
  inline and removes without dropping its profile; Add local model… opens a
  form (NSOpenPanel, name, editable API ID, optional projector, live status)
- Harness 115 -> 134 checks (tolerant savedModels decode, argv rules, ID
  validator mirroring parse_model_id, GGUF/dir validators, local start blocker),
  mutation-proven on the two engine-refusal mirrors

d02a3c1056026f6bc7360e9faee4511b2c03ff71
cjosie <administrator@josie-c.com> · 2026-11-03T13:41 · browse files at this commit

parents: 4bb8bae

diff --git a/Sources/SplashGUI/Core/AppConfig.swift b/Sources/SplashGUI/Core/AppConfig.swift
index c5e45bb..1a62195 100644
--- a/Sources/SplashGUI/Core/AppConfig.swift
+++ b/Sources/SplashGUI/Core/AppConfig.swift
@@ -247,6 +247,124 @@ struct GrantedSettings: Codable, Equatable {
     var memoryBytes: Int
 }
 
+// A model the user keeps in the picker: a saved Hub ID or a local GGUF/MLX file. The id IS the
+// model ID the app already flows everywhere — profile key, picker selection, client configs —
+// so per-model settings keep working without special cases. Local entries carry the paths as
+// plain strings: the app is not sandboxed, so no bookmarks.
+struct SavedModel: Codable, Identifiable, Equatable {
+    var id: String = ""         // "owner/repo[:variant]" or "local/<name>[:variant]"
+    var label: String = ""      // picker display name
+    var path: String = ""     // "" = Hub entry; else local GGUF file or model directory
+    var mmproj: String = ""   // local only, optional vision projector file
+    var isLocal: Bool { !path.isEmpty }
+
+    init() {}
+
+    init(id: String, label: String, path: String = "", mmproj: String = "") {
+        self.id = id
+        self.label = label
+        self.path = path
+        self.mmproj = mmproj
+    }
+
+    enum CodingKeys: String, CodingKey {
+        case id, label, path, mmproj
+    }
+
+    // Tolerant decoder (the Codable trap): it applies per element, so one entry written by a
+    // future build must not throw the whole saved list — and with it the config — to factory.
+    init(from decoder: Decoder) throws {
+        let c = try decoder.container(keyedBy: CodingKeys.self)
+        id = try c.decodeIfPresent(String.self, forKey: .id) ?? ""
+        label = try c.decodeIfPresent(String.self, forKey: .label) ?? ""
+        path = try c.decodeIfPresent(String.self, forKey: .path) ?? ""
+        mmproj = try c.decodeIfPresent(String.self, forKey: .mmproj) ?? ""
+    }
+
+    // Mirrors the engine's parse_model_id (server/serve_options.py): owner/repo[:variant],
+    // segments of [A-Za-z0-9._-] starting and ending alphanumeric-or-underscore (repo ≤ 96,
+    // variant ≤ 64), no "--" or ".." and no ".git" ending in the repo part, ".." refused in
+    // the variant too. The engine never contacts a local/ owner, but the shape still applies.
+    static func validID(_ id: String) -> Bool {
+        var repo = id
+        var variant: String?
+        if let colon = id.firstIndex(of: ":") {
+            repo = String(id[id.startIndex..<colon])
+            variant = String(id[id.index(after: colon)...])
+        }
+        let segs = repo.split(separator: "/", omittingEmptySubsequences: false)
+        guard segs.count == 2,
+              isRepoSegment(String(segs[0]), maxCount: nil),
+              isRepoSegment(String(segs[1]), maxCount: 96),
+              !repo.contains("--"), !repo.contains(".."), !repo.hasSuffix(".git")
+        else { return false }
+        if let v = variant {
+            guard v.count >= 1, v.count <= 64, !v.contains(".."), isVariantSegment(v) else { return false }
+        }
+        return true
+    }
+
+    private static func isRepoSegment(_ s: String, maxCount: Int?) -> Bool {
+        guard !s.isEmpty, s.count <= (maxCount ?? Int.max) else { return false }
+        guard isSegmentEdge(s.first!), isSegmentEdge(s.last!) else { return false }
+        return s.allSatisfy { isSegmentMiddle($0) }
+    }
+
+    // Variants start alphanumeric (no leading underscore) and may end on any middle char.
+    private static func isVariantSegment(_ s: String) -> Bool {
+        guard let first = s.first, first.isASCII, first.isLetter || first.isNumber else { return false }
+        return s.allSatisfy { isSegmentMiddle($0) }
+    }
+
+    private static func isSegmentEdge(_ c: Character) -> Bool {
+        c.isASCII && (c.isLetter || c.isNumber || c == "_")
+    }
+
+    private static func isSegmentMiddle(_ c: Character) -> Bool {
+        c.isASCII && (c.isLetter || c.isNumber || c == "." || c == "_" || c == "-")
+    }
+
+    // The auto API ID for a local file or directory: local/<name>[:variant], sanitized to the
+    // repo-ID shape. The variant is the part after the file name's last "-" when it reads like
+    // a quant name (no lowercase, with a digit or underscore), e.g. UD-IQ3_XXS's IQ3_XXS.
+    static func localID(forPath path: String) -> String {
+        var name = (path as NSString).lastPathComponent
+        if name.lowercased().hasSuffix(".gguf") { name = String(name.dropLast(".gguf".count)) }
+        var variant = ""
+        if let dash = name.lastIndex(of: "-") {
+            let tail = String(name[name.index(after: dash)...])
+            if tail.count >= 2, !tail.contains(where: \.isLowercase),
+               tail.contains(where: \.isNumber) || tail.contains("_"),
+               isVariantSegment(tail) {
+                variant = tail
+                name = String(name[..<dash])
+            }
+        }
+        let clean = sanitizeSegment(name)
+        let base = clean.isEmpty ? "model" : clean
+        return "local/\(base)" + (variant.isEmpty ? "" : ":\(variant)")
+    }
+
+    // Keeps [A-Za-z0-9._-], maps everything else to "-", collapses runs of "-" and ".", then
+    // trims to an alphanumeric-or-underscore on both ends and drops a ".git" ending — the
+    // exact refusals validID checks, so a sanitized segment is always a valid repo segment.
+    static func sanitizeSegment(_ s: String) -> String {
+        var out = ""
+        for c in s {
+            let mapped = isSegmentMiddle(c) ? c : "-"
+            if (mapped == "-" || mapped == ".") && out.last == mapped { continue }
+            out.append(mapped)
+        }
+        while let f = out.first, !isSegmentEdge(f) { out.removeFirst() }
+        while let l = out.last, !isSegmentEdge(l) { out.removeLast() }
+        if out.hasSuffix(".git") {
+            out = String(out.dropLast(4))
+            while let l = out.last, !isSegmentEdge(l) { out.removeLast() }
+        }
+        return out
+    }
+}
+
 struct AppConfig: Codable, Equatable {
     var run = RunConfig()
     var sampling = SamplingDefaults()
@@ -257,6 +375,9 @@ struct AppConfig: Codable, Equatable {
     var modelProfiles: [String: ModelProfile] = [:]
     // Last Splash-granted context/memory for custom IDs, keyed by model ID (see GrantedSettings).
     var grantedAuto: [String: GrantedSettings] = [:]
+    // The user's kept models shown under "Saved" in the picker: saved Hub IDs and local
+    // files, in the order added (see SavedModel). Removing an entry keeps its profile.
+    var savedModels: [SavedModel] = []
     var engineVersionOverride: String = ""
     var engineURLOverride: String = ""
     var engineSHA256Override: String = ""
@@ -276,7 +397,7 @@ struct AppConfig: Codable, Equatable {
     // that field at its default. The synthesized one throws on a missing key, which would drop
     // the whole config back to factory defaults and lose the user's settings.
     enum CodingKeys: String, CodingKey {
-        case run, sampling, modelProfiles, grantedAuto
+        case run, sampling, modelProfiles, grantedAuto, savedModels
         case engineVersionOverride, engineURLOverride, engineSHA256Override, checkEngineUpdate
         case engineMode
         case startOnLaunch
@@ -288,6 +409,7 @@ struct AppConfig: Codable, Equatable {
         sampling = try c.decodeIfPresent(SamplingDefaults.self, forKey: .sampling) ?? SamplingDefaults()
         modelProfiles = try c.decodeIfPresent([String: ModelProfile].self, forKey: .modelProfiles) ?? [:]
         grantedAuto = try c.decodeIfPresent([String: GrantedSettings].self, forKey: .grantedAuto) ?? [:]
+        savedModels = try c.decodeIfPresent([SavedModel].self, forKey: .savedModels) ?? []
         engineVersionOverride = try c.decodeIfPresent(String.self, forKey: .engineVersionOverride) ?? ""
         engineURLOverride = try c.decodeIfPresent(String.self, forKey: .engineURLOverride) ?? ""
         engineSHA256Override = try c.decodeIfPresent(String.self, forKey: .engineSHA256Override) ?? ""
diff --git a/Sources/SplashGUI/Core/AppModel.swift b/Sources/SplashGUI/Core/AppModel.swift
index f9550ca..982ca46 100644
--- a/Sources/SplashGUI/Core/AppModel.swift
+++ b/Sources/SplashGUI/Core/AppModel.swift
@@ -294,6 +294,9 @@ final class AppModel: ObservableObject {
             if line.contains("model download or verification failed") {
                 return "The model download failed partway. Check the connection and try again. Partially downloaded files resume."
             }
+            if line.contains("cannot prepare") || line.contains("local model preparation failed") {
+                return "The engine refused the local model files. Check the entry's path and projector; the reason is in the log below."
+            }
             if line.lowercased().contains("out of memory") || line.lowercased().contains("not enough memory") {
                 return "Not enough free memory to load this model. Close other apps, or lower Max memory in Advanced."
             }
@@ -334,6 +337,64 @@ final class AppModel: ObservableObject {
         CatalogModel.catalog.first { $0.id == config.run.modelID }
     }
 
+    // The user's saved entry for the selected model (Hub or local), nil for a catalog row or
+    // unsaved custom text.
+    var savedEntry: SavedModel? {
+        config.savedModels.first { $0.id == config.run.modelID }
+    }
+
+    // The local entry being served, if the selection is one.
+    var localEntry: SavedModel? {
+        guard let e = savedEntry, e.isLocal else { return nil }
+        return e
+    }
+
+    // Add or update the saved entry for an ID — a duplicate ID updates in place and keeps its
+    // position. False when the engine would refuse the ID as no model ID at all.
+    @discardableResult
+    func saveModel(id: String, label: String, path: String = "", mmproj: String = "") -> Bool {
+        let trimmed = id.trimmingCharacters(in: .whitespaces)
+        guard SavedModel.validID(trimmed) else { return false }
+        let name = label.trimmingCharacters(in: .whitespaces)
+        let entry = SavedModel(id: trimmed, label: name.isEmpty ? trimmed : name,
+                               path: path, mmproj: mmproj)
+        if let i = config.savedModels.firstIndex(where: { $0.id == trimmed }) {
+            config.savedModels[i] = entry
+        } else {
+            config.savedModels.append(entry)
+        }
+        return true
+    }
+
+    // Removing a saved entry leaves its ModelProfile (and grantedAuto) in place, exactly like
+    // a catalog row you stop showing: re-adding by the same ID restores the tuned settings.
+    func removeSavedModel(id: String) {
+        config.savedModels.removeAll { $0.id == id }
+    }
+
+    // Renames a saved entry in place, as typed (the Run tab's field writes every keystroke).
+    func renameSavedModel(id: String, to label: String) {
+        guard let i = config.savedModels.firstIndex(where: { $0.id == id }) else { return }
+        config.savedModels[i].label = label
+    }
+
+    // The engine's local-mode refusals, applied before the launch so the message lands in the
+    // footer instead of a process that dies in the log: a missing file, and the projector +
+    // language-only pair the engine's parser rejects.
+    nonisolated static func localStartBlocker(path: String, mmproj: String,
+                                              languageOnly: Bool) -> String? {
+        if !FileManager.default.fileExists(atPath: path) {
+            return "The local model path no longer exists: \(path). Re-point it with Add local model."
+        }
+        if !mmproj.isEmpty, !FileManager.default.fileExists(atPath: mmproj) {
+            return "The vision projector no longer exists: \(mmproj). Re-attach it or clear it."
+        }
+        if !mmproj.isEmpty, languageOnly {
+            return "Language only refuses a vision projector — the engine rejects the pair. Turn Language only off or detach the projector."
+        }
+        return nil
+    }
+
     // Switching models swaps profiles: the model being left keeps its current settings, the model
     // being entered restores its saved ones, or starts on its card if it has none. Also re-reads
     // the on-disk weights size the auto-profile needs.
@@ -407,7 +468,7 @@ final class AppModel: ObservableObject {
         // with announce, reports it. The full Hub ID stays the profile key and the /status name.
         let apiName = config.run.servedModelName.isEmpty ? config.run.modelID : config.run.servedModelName
         let ctx = ClientConfigContext(client: client, modelID: apiName,
-                                      label: catalogEntry?.label ?? config.run.modelID,
+                                      label: catalogEntry?.label ?? savedEntry?.label ?? config.run.modelID,
                                       port: config.run.port, contextTokens: tokens,
                                       inputModalities: modalities,
                                       sampling: config.sampling,
@@ -415,13 +476,14 @@ final class AppModel: ObservableObject {
         return ClientConfigs.text(for: ctx)
     }
 
-    // Any ID outside the catalog reads as Custom… so the popup never goes blank on a hand-typed ID.
+    // Any ID outside the catalog and the saved list reads as Custom… so the popup never goes
+    // blank on a hand-typed ID.
     var modelPickerSelection: Binding<String> {
         Binding(
-            get: { self.catalogEntry?.id ?? "custom" },
+            get: { self.catalogEntry?.id ?? self.savedEntry?.id ?? "custom" },
             set: { newValue in
                 if newValue != "custom" { self.selectModelID(newValue) }
-                else if self.catalogEntry != nil { self.selectModelID("") }
+                else if self.catalogEntry != nil || self.savedEntry != nil { self.selectModelID("") }
             }
         )
     }
@@ -445,9 +507,12 @@ final class AppModel: ObservableObject {
 
     // Resolved run profile for the current model, using the catalog weight estimate when the
     // model hasn't downloaded yet. Cheap: weights size is cached, Metal ceiling read once.
+    // Local entries size from their files (and get no Auto profile — the arch gate returns
+    // nil for a non-catalog ID and the engine sizes itself).
     var currentAutoProfile: AutoProfile? {
         let id = config.run.modelID
-        let weights = catalogEntry?.weightsBytes ?? MachineInfo.cachedModelSize(id)
+        let weights = localEntry.map { MachineInfo.localWeightsSize(path: $0.path) }
+            ?? catalogEntry?.weightsBytes ?? MachineInfo.cachedModelSize(id)
         return MachineInfo.autoProfile(modelID: id, languageOnly: config.run.languageOnly, weightsBytes: weights)
     }
 
@@ -534,6 +599,13 @@ final class AppModel: ObservableObject {
             startBlocked(mismatch)
             return
         }
+        let local = localEntry
+        if let entry = local,
+           let blocked = Self.localStartBlocker(path: entry.path, mmproj: entry.mmproj,
+                                                languageOnly: config.run.languageOnly) {
+            startBlocked(blocked)
+            return
+        }
         Task {
             let probe = await client.probePort()
             if probe.open {
@@ -571,7 +643,10 @@ final class AppModel: ObservableObject {
                 var run = self.config.run.effective(using: profile)
                 run.clearingUnsupportedMemoryKnobs(forModelID: self.config.run.modelID)
                 try self.server.launch(config: run,
-                                       revision: self.catalogEntry?.revision)
+                                       revision: self.catalogEntry?.revision,
+                                       local: local.map {
+                                           SplashServer.LocalLaunch(modelDir: $0.path, mmproj: $0.mmproj)
+                                       })
                 self.launchedRunConfig = self.config.run
                 if let pid = self.server.childPID {
                     AppModel.serverKillPID = pid
diff --git a/Sources/SplashGUI/Core/MachineInfo.swift b/Sources/SplashGUI/Core/MachineInfo.swift
index ba87ebd..26cacaf 100644
--- a/Sources/SplashGUI/Core/MachineInfo.swift
+++ b/Sources/SplashGUI/Core/MachineInfo.swift
@@ -186,6 +186,67 @@ enum MachineInfo {
             + "~/.cache/huggingface/hub/models--\(entry.owner)--\(entry.hfRepo) and start again to re-pull it."
     }
 
+    // The "GGUF" magic at the head of a file.
+    static func hasGGUFMagic(_ url: URL) -> Bool {
+        guard let h = try? FileHandle(forReadingFrom: url),
+              let head = try? h.read(upToCount: 4) else { return false }
+        return head == Data("GGUF".utf8)
+    }
+
+    // Whether a saved local entry's path is something the engine can serve: a GGUF file
+    // (magic, per install/local.py) or a directory whose root holds a GGUF or an MLX model
+    // (config.json + safetensors). A hint for the UI only — the engine has the last word.
+    static func localLooksLikeModel(path: String) -> Bool {
+        let fm = FileManager.default
+        var isDir: ObjCBool = false
+        guard fm.fileExists(atPath: path, isDirectory: &isDir) else { return false }
+        if !isDir.boolValue { return hasGGUFMagic(URL(fileURLWithPath: path)) }
+        guard let names = try? fm.contentsOfDirectory(atPath: path) else { return false }
+        if names.contains(where: { $0.lowercased().hasSuffix(".gguf") }) { return true }
+        return names.contains("config.json")
+            && names.contains(where: { $0.lowercased().hasSuffix(".safetensors") })
+    }
+
+    // Bytes a local entry loads: the GGUF file (every part of a split GGUF lies beside it) or
+    // the model files at a directory's root. Stat sizes only, so no cache is needed.
+    static func localWeightsSize(path: String) -> Int? {
+        let fm = FileManager.default
+        var isDir: ObjCBool = false
+        guard fm.fileExists(atPath: path, isDirectory: &isDir) else { return nil }
+        // HF snapshot files are symlinks into the blob store; stat the resolved file, and
+        // count only regular files so a directory entry never adds a bogus link size.
+        func size(_ p: String) -> Int {
+            let url = URL(fileURLWithPath: p).resolvingSymlinksInPath()
+            guard let vals = try? url.resourceValues(forKeys: [.fileSizeKey, .isRegularFileKey]),
+                  vals.isRegularFile == true else { return 0 }
+            return vals.fileSize ?? 0
+        }
+        var total = 0
+        if isDir.boolValue {
+            for name in (try? fm.contentsOfDirectory(atPath: path)) ?? []
+            where name.lowercased().hasSuffix(".gguf") || name.lowercased().hasSuffix(".safetensors") {
+                total += size((path as NSString).appendingPathComponent(name))
+            }
+        } else if let stem = splitGGUFStem(of: (path as NSString).lastPathComponent),
+                  let dir = try? fm.contentsOfDirectory(atPath: (path as NSString).deletingLastPathComponent) {
+            let parent = (path as NSString).deletingLastPathComponent
+            for name in dir where splitGGUFStem(of: name) == stem {
+                total += size((parent as NSString).appendingPathComponent(name))
+            }
+        } else {
+            total = size(path)
+        }
+        return total > 0 ? total : nil
+    }
+
+    // The model a split GGUF part belongs to: NAME from NAME-00001-of-00003.gguf; nil for a
+    // whole file (install/local.py's SPLIT_NAME rule, same shape as its part naming).
+    private static func splitGGUFStem(of name: String) -> String? {
+        guard let r = name.range(of: #"-\d+-of-\d+\.gguf$"#, options: .regularExpression)
+        else { return nil }
+        return String(name[..<r.lowerBound])
+    }
+
     // Sums the real bytes under a directory, following symlinks. The Splash model path is a
     // symlink into the HF snapshot and its files are symlinks into the content-addressed blob
     // store, so the default enumerator (which treats symlinks as non-regular) sees nothing.
diff --git a/Sources/SplashGUI/Core/SplashServer.swift b/Sources/SplashGUI/Core/SplashServer.swift
index 223f017..f9a8b59 100644
--- a/Sources/SplashGUI/Core/SplashServer.swift
+++ b/Sources/SplashGUI/Core/SplashServer.swift
@@ -91,6 +91,13 @@ final class SplashServer {
         let prefixArgs: [String]
     }
 
+    // The local files a saved local entry serves. SplashServer stays entry-free: it builds
+    // argv from these two strings and knows nothing about SavedModel.
+    struct LocalLaunch {
+        let modelDir: String
+        let mmproj: String    // "" = none
+    }
+
     static func resolveLaunch() -> LaunchTarget? {
         let py = EngineInstaller.pythonPath
         if EngineInstaller.isInstalled {
@@ -105,7 +112,7 @@ final class SplashServer {
         return nil
     }
 
-    func launch(config: RunConfig, revision: String?) throws {
+    func launch(config: RunConfig, revision: String?, local: LocalLaunch? = nil) throws {
         guard process == nil else { return }
         guard let target = Self.resolveLaunch() else {
             throw ServerError.missingExecutable
@@ -113,7 +120,7 @@ final class SplashServer {
 
         let p = Process()
         p.executableURL = URL(fileURLWithPath: target.executable)
-        p.arguments = target.prefixArgs + Self.buildArguments(for: config, revision: revision)
+        p.arguments = target.prefixArgs + Self.buildArguments(for: config, revision: revision, local: local)
         var env = ProcessInfo.processInfo.environment
         env["PYTHONUNBUFFERED"] = "1"
         env["TERM"] = "dumb"
@@ -187,14 +194,23 @@ final class SplashServer {
         }
     }
 
-    static func buildArguments(for config: RunConfig, revision: String? = nil) -> [String] {
+    static func buildArguments(for config: RunConfig, revision: String? = nil,
+                               local: LocalLaunch? = nil) -> [String] {
         var args = ["serve", "--model", config.modelID, "--port", String(config.port)]
+        if let local {
+            // Local serving: --model stays the ID the API reports, --model-dir names the files.
+            // The engine's parser refuses --mmproj with --language-only, so the projector rides
+            // only when vision is on (start() blocks that pair before it gets here anyway).
+            args += ["--model-dir", local.modelDir]
+            if !local.mmproj.isEmpty && !config.languageOnly { args += ["--mmproj", local.mmproj] }
+        }
         // LAN serving: bind every IPv4 interface. The engine accepts IP-address Host headers
         // by default, so no --allowed-host is needed for clients connecting by address.
         if config.lanAccess { args += ["--host", "0.0.0.0"] }
         // A catalog entry pins an exact HF commit, so the pull is reproducible and a later
-        // re-upload under the same name cannot change what this Mac loads.
-        if let revision, !revision.isEmpty { args += ["--revision", revision] }
+        // re-upload under the same name cannot change what this Mac loads. The engine refuses
+        // --revision with --model-dir, so a local launch never carries one.
+        if let revision, !revision.isEmpty, local == nil { args += ["--revision", revision] }
         if config.maxContext.lowercased() != "auto", !config.maxContext.isEmpty {
             args += ["--max-context", config.maxContext]
         }
diff --git a/Sources/SplashGUI/Views/RunTab.swift b/Sources/SplashGUI/Views/RunTab.swift
index f7d41e0..2c5ecc1 100644
--- a/Sources/SplashGUI/Views/RunTab.swift
+++ b/Sources/SplashGUI/Views/RunTab.swift
@@ -1,7 +1,9 @@
 import SwiftUI
+import UniformTypeIdentifiers
 
 struct RunTab: View {
     @EnvironmentObject var model: AppModel
+    @State private var showAddLocal = false
 
     var body: some View {
         // The server controls (Start/Stop, port, chips, context slot) live in the custom
@@ -64,6 +66,9 @@ struct RunTab: View {
         .safeAreaInset(edge: .bottom) {
             logPane
         }
+        .sheet(isPresented: $showAddLocal) {
+            AddLocalModelSheet().environmentObject(model)
+        }
     }
 
     // The two columns are separate computed properties: inline they push the GridRow's
@@ -75,52 +80,35 @@ struct RunTab: View {
                 Text("Model")
                     .fixedSize(horizontal: true, vertical: false)
                 Picker("Model", selection: model.modelPickerSelection) {
-                    ForEach(CatalogModel.catalog) { m in
-                        HStack {
-                            Text(m.label)
-                            Spacer()
-                            Text(m.id == "custom" ? "" : m.id)
-                                .font(.caption)
-                                .foregroundStyle(.secondary)
-                        }.tag(m.id)
+                    Section("Splash suggested") {
+                        ForEach(CatalogModel.catalog.filter { $0.id != "custom" }) { m in
+                            modelRow(label: m.label, id: m.id)
+                        }
+                    }
+                    if !model.config.savedModels.isEmpty {
+                        Section("Saved") {
+                            ForEach(model.config.savedModels) { s in
+                                modelRow(label: s.label, id: s.id)
+                            }
+                        }
                     }
+                    Text("Custom…").tag("custom")
                 }
                 .labelsHidden()
             }
             .help("Hub ID, owner/repo[:variant], shown so you know exactly whose upload you're pulling. The DFlash2 draft model pairs automatically. First start downloads weights and prepares them; later starts map from disk. Each model keeps its own sampling and context settings, saved under its full ID including the :variant; switching models swaps them in, and a model you have not tuned starts on its card's sampling.")
-            if model.catalogEntry == nil {
-                HStack(spacing: 6) {
-                    Text(model.config.run.modelID.isEmpty
-                        ? "no model ID set; pick Custom… and type owner/repo[:variant]"
-                        : model.config.run.modelID)
-                        .font(.system(.caption, design: .monospaced))
-                        .foregroundStyle(.secondary)
-                    Spacer()
-                }
-                TextField("owner/repo[:variant]", text: model.customIDBinding)
-                    .textFieldStyle(.roundedBorder)
-                    .font(.system(.body, design: .monospaced))
+            if model.catalogEntry == nil, model.savedEntry == nil {
+                customRows
+            }
+            if let saved = model.savedEntry {
+                savedRows(saved)
             }
             if let entry = model.catalogEntry {
-                HStack(spacing: 6) {
-                    Image(systemName: entry.onDisk ? "checkmark.circle.fill" : "arrow.down.circle")
-                        .foregroundStyle(entry.onDisk ? Color.green : Color.orange)
-                    Text(entry.onDisk
-                         ? "installed, maps from disk"
-                         : "not installed, first start pulls it from Hugging Face")
-                        .font(.caption)
-                        .foregroundStyle(.secondary)
-                    Text("· \(entry.note)").font(.caption).foregroundStyle(.secondary)
-                    Spacer()
-                }
-                .help((entry.downloadURL.map { "pulls, pinned to commit \($0). " } ?? "")
-                      + "serve --revision pins the download to this exact commit, so a later re-upload under the same file name cannot change what loads. The catalog also carries its sha256; the app checks it against the digest Splash records before starting.")
-                if !entry.fitsThisMac {
-                    Label("too large for this Mac's memory, expected to fail",
-                          systemImage: "exclamationmark.triangle")
-                        .font(.caption)
-                        .foregroundStyle(.red)
-                }
+                catalogStatusRow(entry)
+            } else if let local = model.localEntry {
+                localStatusRow(local)
+            } else if let saved = model.savedEntry, !saved.isLocal {
+                hubSavedStatusRow(saved)
             }
             Toggle(isOn: $model.config.run.auto) {
                 HStack(spacing: 6) {
@@ -178,6 +166,138 @@ struct RunTab: View {
         }
     }
 
+    private func modelRow(label: String, id: String) -> some View {
+        HStack {
+            Text(label)
+            Spacer()
+            Text(id)
+                .font(.caption)
+                .foregroundStyle(.secondary)
+        }
+        .tag(id)
+    }
+
+    // The Custom… slot: the typed ID, the field, and the two ways to keep a model.
+    private var customRows: some View {
+        VStack(alignment: .leading, spacing: 6) {
+            HStack(spacing: 6) {
+                Text(model.config.run.modelID.isEmpty
+                     ? "no model ID set; pick Custom… and type owner/repo[:variant]"
+                     : model.config.run.modelID)
+                    .font(.system(.caption, design: .monospaced))
+                    .foregroundStyle(.secondary)
+                Spacer()
+            }
+            TextField("owner/repo[:variant]", text: model.customIDBinding)
+                .textFieldStyle(.roundedBorder)
+                .font(.system(.body, design: .monospaced))
+            HStack(spacing: 6) {
+                if SavedModel.validID(model.config.run.modelID) {
+                    Button("Save to list") { saveCustomToList() }
+                        .help("Keeps this ID in the picker's Saved section, so switching away and back restores it with its own settings — no retyping.")
+                }
+                Button("Add local model…") { showAddLocal = true }
+                    .help("Serve a GGUF file or model directory already on this Mac — no Hugging Face download.")
+                Spacer()
+            }
+        }
+    }
+
+    private func saveCustomToList() {
+        let id = model.config.run.modelID
+        let repo = id.split(separator: ":").first.map(String.init) ?? id
+        let label = repo.split(separator: "/").last.map(String.init) ?? repo
+        model.saveModel(id: id, label: label)
+    }
+
+    // A selected saved entry: rename inline, or remove from the list (its settings stay
+    // saved under the model ID, exactly like a catalog row you stop showing).
+    private func savedRows(_ saved: SavedModel) -> some View {
+        HStack(spacing: 6) {
+            TextField("Name", text: savedLabelBinding(saved.id))
+                .textFieldStyle(.roundedBorder)
+                .frame(maxWidth: 220)
+            Button("Remove") { model.removeSavedModel(id: saved.id) }
+                .help("Removes it from the Saved list. Its sampling and serve settings stay saved under the model ID; re-adding it restores them.")
+            Spacer()
+        }
+    }
+
+    private func savedLabelBinding(_ id: String) -> Binding<String> {
+        Binding(
+            get: { model.config.savedModels.first { $0.id == id }?.label ?? "" },
+            set: { model.renameSavedModel(id: id, to: $0) }
+        )
+    }
+
+    private func catalogStatusRow(_ entry: CatalogModel) -> some View {
+        VStack(alignment: .leading, spacing: 4) {
+            HStack(spacing: 6) {
+                Image(systemName: entry.onDisk ? "checkmark.circle.fill" : "arrow.down.circle")
+                    .foregroundStyle(entry.onDisk ? Color.green : Color.orange)
+                Text(entry.onDisk
+                     ? "installed, maps from disk"
+                     : "not installed, first start pulls it from Hugging Face")
+                    .font(.caption)
+                    .foregroundStyle(.secondary)
+                Text("· \(entry.note)").font(.caption).foregroundStyle(.secondary)
+                Spacer()
+            }
+            .help((entry.downloadURL.map { "pulls, pinned to commit \($0). " } ?? "")
+                  + "serve --revision pins the download to this exact commit, so a later re-upload under the same file name cannot change what loads. The catalog also carries its sha256; the app checks it against the digest Splash records before starting.")
+            if !entry.fitsThisMac {
+                Label("too large for this Mac's memory, expected to fail",
+                      systemImage: "exclamationmark.triangle")
+                    .font(.caption)
+                    .foregroundStyle(.red)
+            }
+        }
+    }
+
+    // A saved Hub entry reads its installed state off the same disk layout as a catalog row;
+    // it tracks the repository's default branch (no revision pin in v1).
+    private func hubSavedStatusRow(_ saved: SavedModel) -> some View {
+        let onDisk = MachineInfo.weightsDir(for: saved.id) != nil
+        return HStack(spacing: 6) {
+            Image(systemName: onDisk ? "checkmark.circle.fill" : "arrow.down.circle")
+                .foregroundStyle(onDisk ? Color.green : Color.orange)
+            Text(onDisk
+                 ? "installed, maps from disk"
+                 : "not installed, first start pulls it from Hugging Face")
+                .font(.caption)
+                .foregroundStyle(.secondary)
+            Spacer()
+        }
+        .help("Saved Hub ID, pulled from the repository's default branch. Its full ID and settings stay under \(saved.id).")
+    }
+
+    private func localStatusRow(_ local: SavedModel) -> some View {
+        let status = Self.localStatus(local)
+        return HStack(spacing: 6) {
+            Image(systemName: status.ok ? "checkmark.circle.fill" : "exclamationmark.triangle")
+                .foregroundStyle(status.ok ? Color.green : Color.red)
+            Text(status.text)
+                .font(.system(.caption, design: .monospaced))
+                .foregroundStyle(.secondary)
+                .lineLimit(1)
+            Spacer()
+        }
+        .help("Served from disk with serve --model-dir; the API reports \(local.id). No Hugging Face download. A GGUF serves text only unless a vision projector is attached; the DFlash2 draft pairs from the Hugging Face cache when one is recorded for the family.")
+    }
+
+    // One line about a local entry's files: "local · <path> · <size>", or what is wrong.
+    static func localStatus(_ local: SavedModel) -> (ok: Bool, text: String) {
+        guard FileManager.default.fileExists(atPath: local.path) else {
+            return (false, "local file not found: \(local.path)")
+        }
+        guard MachineInfo.localLooksLikeModel(path: local.path) else {
+            return (false, "not a GGUF file or model directory: \(local.path)")
+        }
+        var text = "local · \(local.path) · \(MachineInfo.gb(MachineInfo.localWeightsSize(path: local.path)))"
+        if !local.mmproj.isEmpty { text += " · + projector" }
+        return (true, text)
+    }
+
     private var serverColumn: some View {
         VStack(alignment: .leading, spacing: 10) {
             LabeledField("Idle release", $model.config.run.idleRelease, width: 120)
@@ -325,3 +445,155 @@ struct LabeledField: View {
         }
     }
 }
+
+// The Add-local-model form: pick the GGUF file or model directory already on disk, name it,
+// and keep it in the Saved list. Paths are stored as plain strings — the app is not sandboxed.
+struct AddLocalModelSheet: View {
+    @EnvironmentObject var model: AppModel
+    @Environment(\.dismiss) private var dismiss
+    @State private var path = ""
+    @State private var label = ""
+    @State private var apiID = ""
+    @State private var mmproj = ""
+    // Typing in Name or API ID stops the auto-fill from the file name; re-picking a file
+    // resets both.
+    @State private var labelEdited = false
+    @State private var apiEdited = false
+
+    var body: some View {
+        VStack(alignment: .leading, spacing: 12) {
+            Text("Add local model").font(.headline)
+            HStack(spacing: 6) {
+                Text("Model")
+                    .fixedSize(horizontal: true, vertical: false)
+                Text(path.isEmpty ? "no file or directory picked" : path)
+                    .font(.system(.caption, design: .monospaced))
+                    .foregroundStyle(path.isEmpty ? .secondary : .primary)
+                    .lineLimit(1)
+                    .truncationMode(.middle)
+                Button("Choose…") { chooseModel() }
+                Spacer()
+            }
+            HStack(spacing: 6) {
+                Text("Projector")
+                    .fixedSize(horizontal: true, vertical: false)
+                Text(mmproj.isEmpty ? "none (a GGUF serves text only)" : mmproj)
+                    .font(.system(.caption, design: .monospaced))
+                    .foregroundStyle(mmproj.isEmpty ? .secondary : .primary)
+                    .lineLimit(1)
+                    .truncationMode(.middle)
+                if mmproj.isEmpty {
+                    Button("Attach…") { chooseProjector() }
+                } else {
+                    Button("Detach") { mmproj = "" }
+                }
+                Spacer()
+            }
+            .help("A GGUF vision projector file (mmproj-*.gguf) that lets a GGUF target serve images. MLX directories carry their vision tower in the checkpoint and need none.")
+            LabeledField("Name", labelBinding, width: 300)
+            LabeledField("API ID", apiBinding, width: 300)
+                .help("The model name the API reports, like a Hub ID. It defaults to local/<file name>; clients address the model by it.")
+            statusLine
+            HStack(spacing: 6) {
+                Spacer()
+                Button("Cancel") { dismiss() }
+                    .keyboardShortcut(.cancelAction)
+                Button("Add") { add() }
+                    .keyboardShortcut(.defaultAction)
+                    .disabled(!canAdd)
+            }
+        }
+        .padding(20)
+        .frame(width: 560)
+    }
+
+    private var statusLine: some View {
+        VStack(alignment: .leading, spacing: 4) {
+            if !path.isEmpty {
+                let status = RunTab.localStatus(SavedModel(id: apiID, label: label, path: path, mmproj: mmproj))
+                Text(status.text)
+                    .font(.system(.caption, design: .monospaced))
+                    .foregroundStyle(status.ok ? Color.secondary : Color.red)
+            }
+            if !SavedModel.validID(apiID) {
+                Text("API ID must be owner/repo[:variant], e.g. local/my-model:Q4_K_M")
+                    .font(.caption)
+                    .foregroundStyle(.red)
+            }
+            if !mmproj.isEmpty, model.config.run.languageOnly {
+                Text("Language only is on, which refuses a projector — turn it off on the Run tab or detach it.")
+                    .font(.caption)
+                    .foregroundStyle(.red)
+            }
+            if canAdd, model.config.savedModels.contains(where: { $0.id == apiID }) {
+                Text("An entry with this ID already exists; Add updates its path and name.")
+                    .font(.caption)
+                    .foregroundStyle(.orange)
+            }
+        }
+    }
+
+    private var canAdd: Bool {
+        !path.isEmpty && !label.trimmingCharacters(in: .whitespaces).isEmpty
+            && SavedModel.validID(apiID)
+            && MachineInfo.localLooksLikeModel(path: path)
+    }
+
+    private var labelBinding: Binding<String> {
+        Binding(
+            get: { label },
+            set: { labelEdited = true; label = $0 }
+        )
+    }
+
+    private var apiBinding: Binding<String> {
+        Binding(
+            get: { apiID },
+            set: { apiEdited = true; apiID = $0 }
+        )
+    }
+
+    private func chooseModel() {
+        let panel = NSOpenPanel()
+        panel.canChooseFiles = true
+        panel.canChooseDirectories = true
+        panel.allowsMultipleSelection = false
+        if let gguf = UTType(filenameExtension: "gguf") {
+            panel.allowedContentTypes = [.directory, gguf]
+        }
+        guard panel.runModal() == .OK, let url = panel.url else { return }
+        path = url.path
+        if !labelEdited {
+            label = Self.defaultLabel(forPath: path)
+        }
+        if !apiEdited {
+            apiID = SavedModel.localID(forPath: path)
+        }
+    }
+
+    private func chooseProjector() {
+        let panel = NSOpenPanel()
+        panel.canChooseFiles = true
+        panel.canChooseDirectories = false
+        panel.allowsMultipleSelection = false
+        if let gguf = UTType(filenameExtension: "gguf") {
+            panel.allowedContentTypes = [gguf]
+        }
+        if panel.runModal() == .OK, let url = panel.url {
+            mmproj = url.path
+        }
+    }
+
+    // The file or directory name without its .gguf ending — what the user calls this model.
+    static func defaultLabel(forPath path: String) -> String {
+        var name = (path as NSString).lastPathComponent
+        if name.lowercased().hasSuffix(".gguf") { name = String(name.dropLast(".gguf".count)) }
+        return name
+    }
+
+    private func add() {
+        guard model.saveModel(id: apiID, label: label, path: path, mmproj: mmproj) else { return }
+        model.selectModelID(apiID)
+        dismiss()
+    }
+}
diff --git a/scripts/profile-test/main.swift b/scripts/profile-test/main.swift
index 3fe9124..c5b6976 100644
--- a/scripts/profile-test/main.swift
+++ b/scripts/profile-test/main.swift
@@ -591,6 +591,147 @@ func runTests() {
             && mlxK.expert && q2K.expert
             && !denseK.ple && !denseK.expert && !denseK.sparseKv)
 
+    // O: local models + the saved custom list (spec scratch/spec-local-and-saved-models.md).
+    // The Codable trap on the new list, the engine's argv rules for --model-dir/--mmproj/
+    // --revision, the ID validator mirroring parse_model_id, the local file validators, and
+    // the saved entry behaving like a catalog row for profiles.
+    let noSaved = #"{"run":{"port":8123,"modelID":"someone/Model:x"},"sampling":{"temperature":0.4}}"#
+    if let nsd = noSaved.data(using: .utf8),
+       let nscfg = try? JSONDecoder().decode(AppConfig.self, from: nsd) {
+         check("savedModels absent decodes [] without losing the config",
+               nscfg.savedModels.isEmpty && nscfg.run.port == 8123 && nscfg.sampling.temperature == 0.4)
+    } else {
+        check("savedModels absent decodes [] without losing the config", false, "decoder threw")
+    }
+    let minEntry = #"{"id":"a/b","label":"B"}"#
+    if let med = minEntry.data(using: .utf8),
+       let ment = try? JSONDecoder().decode(SavedModel.self, from: med) {
+        check("SavedModel without path/mmproj decodes defaulted",
+              ment.path.isEmpty && ment.mmproj.isEmpty && ment.isLocal == false)
+    } else {
+        check("SavedModel without path/mmproj decodes defaulted", false, "decoder threw")
+    }
+    var scfg = AppConfig()
+    scfg.savedModels = [SavedModel(id: "someone/Model:x", label: "X"),
+                        SavedModel(id: "local/test", label: "test",
+                                   path: "/m/test.gguf", mmproj: "/m/mmproj.gguf")]
+    if let sd = try? JSONEncoder().encode(scfg),
+       let sback = try? JSONDecoder().decode(AppConfig.self, from: sd) {
+        check("the saved list round-trips through a save, order kept",
+              sback.savedModels.count == 2
+                && sback.savedModels[0].id == "someone/Model:x" && !sback.savedModels[0].isLocal
+                && sback.savedModels[1].path == "/m/test.gguf" && sback.savedModels[1].isLocal
+                && sback.savedModels[1].mmproj == "/m/mmproj.gguf")
+    } else {
+        check("the saved list round-trips through a save, order kept", false, "encode/decode threw")
+    }
+    var lrun = RunConfig()
+    lrun.modelID = "local/test"
+    let localLaunch = SplashServer.LocalLaunch(modelDir: "/m/test.gguf", mmproj: "")
+    let largs = SplashServer.buildArguments(for: lrun, local: localLaunch)
+    check("--model-dir reaches the engine for a local entry",
+          flagValue(largs, "--model-dir") == "/m/test.gguf", largs.joined(separator: " "))
+    check("no --model-dir for a Hub entry",
+          !SplashServer.buildArguments(for: RunConfig()).contains("--model-dir"))
+    let visArgs = SplashServer.buildArguments(
+        for: lrun, local: SplashServer.LocalLaunch(modelDir: "/m/t.gguf", mmproj: "/m/mm.gguf"))
+    check("the projector passes with vision", flagValue(visArgs, "--mmproj") == "/m/mm.gguf")
+    var loRun = lrun
+    loRun.languageOnly = true
+    let loArgs = SplashServer.buildArguments(
+        for: loRun, local: SplashServer.LocalLaunch(modelDir: "/m/t.gguf", mmproj: "/m/mm.gguf"))
+    check("the projector never rides with language-only (engine parser rule)",
+          !loArgs.contains("--mmproj"), loArgs.joined(separator: " "))
+    let revArgs = SplashServer.buildArguments(for: lrun, revision: "deadbeef", local: localLaunch)
+    check("revision never accompanies a local entry, and still rides for a Hub one",
+          !revArgs.contains("--revision")
+            && flagValue(SplashServer.buildArguments(for: RunConfig(), revision: "abc"), "--revision") == "abc",
+          revArgs.joined(separator: " "))
+    check("the ID validator mirrors parse_model_id",
+          SavedModel.validID("local/Quant:Q4") && SavedModel.validID("a/b:C")
+            && SavedModel.validID("local/test")
+            && !SavedModel.validID("nope") && !SavedModel.validID("a//b")
+            && !SavedModel.validID("a b/c") && !SavedModel.validID("local/a..b")
+            && !SavedModel.validID("a/b:Q4..X") && !SavedModel.validID("a/b:")
+            && !SavedModel.validID("a/b:c:d"))
+
+    // Local file validators and sizes against temp fixtures.
+    let tmp = FileManager.default.temporaryDirectory
+        .appendingPathComponent("splashgui-localtest-\(ProcessInfo.processInfo.processIdentifier)")
+    try? FileManager.default.removeItem(at: tmp)
+    try? FileManager.default.createDirectory(at: tmp, withIntermediateDirectories: true)
+    let ggufFile = tmp.appendingPathComponent("m.gguf")
+    let junkFile = tmp.appendingPathComponent("junk.gguf")
+    let projFile = tmp.appendingPathComponent("mmproj.gguf")
+    try? Data([UInt8]("GGUF".utf8) + [UInt8](repeating: 0, count: 100)).write(to: ggufFile)
+    try? Data([UInt8](repeating: 7, count: 64)).write(to: junkFile)
+    try? Data([UInt8]("GGUF".utf8) + [UInt8](repeating: 0, count: 16)).write(to: projFile)
+    let mlxDir = tmp.appendingPathComponent("mlx")
+    let emptyDir = tmp.appendingPathComponent("empty")
+    try? FileManager.default.createDirectory(at: mlxDir, withIntermediateDirectories: true)
+    try? FileManager.default.createDirectory(at: emptyDir, withIntermediateDirectories: true)
+    try? Data("{}".utf8).write(to: mlxDir.appendingPathComponent("config.json"))
+    try? Data([UInt8](repeating: 3, count: 120)).write(to: mlxDir.appendingPathComponent("model.safetensors"))
+    let linkFile = tmp.appendingPathComponent("link.gguf")
+    try? FileManager.default.createSymbolicLink(at: linkFile, withDestinationURL: ggufFile)
+    check("the GGUF magic and directory validators read the files like the engine",
+          MachineInfo.localLooksLikeModel(path: ggufFile.path)
+            && !MachineInfo.localLooksLikeModel(path: junkFile.path)
+            && MachineInfo.localLooksLikeModel(path: mlxDir.path)
+            && !MachineInfo.localLooksLikeModel(path: emptyDir.path)
+            && !MachineInfo.localLooksLikeModel(path: tmp.appendingPathComponent("gone.gguf").path))
+    check("local weights size sums the file or the directory's model files",
+          MachineInfo.localWeightsSize(path: ggufFile.path) == 104
+            && MachineInfo.localWeightsSize(path: mlxDir.path) == 120
+            && MachineInfo.localWeightsSize(path: junkFile.path) == 64
+            && MachineInfo.localWeightsSize(path: linkFile.path) == 104
+            && MachineInfo.localWeightsSize(path: tmp.appendingPathComponent("gone.gguf").path) == nil)
+    check("the local start blocker mirrors the engine's refusals",
+          AppModel.localStartBlocker(path: tmp.appendingPathComponent("gone.gguf").path,
+                                     mmproj: "", languageOnly: false) != nil
+            && AppModel.localStartBlocker(path: ggufFile.path, mmproj: projFile.path,
+                                          languageOnly: true) != nil
+            && AppModel.localStartBlocker(path: ggufFile.path, mmproj: tmp.appendingPathComponent("gone.gguf").path,
+                                          languageOnly: false) != nil
+            && AppModel.localStartBlocker(path: ggufFile.path, mmproj: projFile.path,
+                                          languageOnly: false) == nil
+            && AppModel.localStartBlocker(path: ggufFile.path, mmproj: "",
+                                          languageOnly: true) == nil)
+    try? FileManager.default.removeItem(at: tmp)
+    check("the auto local ID follows the sanitized repo shape",
+          SavedModel.localID(forPath: "/x/Qwen3.8-27B-UD-IQ3_XXS.gguf") == "local/Qwen3.8-27B-UD:IQ3_XXS"
+            && SavedModel.localID(forPath: "/x/model-v2.gguf") == "local/model-v2"
+            && SavedModel.localID(forPath: "/x/weird name (v3)!!") == "local/weird-name-v3"
+            && SavedModel.validID(SavedModel.localID(forPath: "/x/a..b__c!!.gguf"))
+            && SavedModel.validID(SavedModel.localID(forPath: "/x/!!!.gguf")))
+
+    // The saved entry flows through the picker and profiles like a catalog row.
+    let S = "someone/My-Qwen3.8-27B-Quant:Q4"
+    m.config.savedModels.removeAll()
+    m.selectModelID(A)
+    check("saveModel refuses an ID the engine would not accept",
+          m.saveModel(id: "nope", label: "N") == false && m.config.savedModels.isEmpty)
+    m.saveModel(id: S, label: "My Quant")
+    m.selectModelID(S)
+    check("the picker selection names a saved entry",
+          m.modelPickerSelection.wrappedValue == S && m.savedEntry?.label == "My Quant")
+    m.config.sampling.temperature = 0.11
+    m.selectModelID(A)
+    check("a saved entry's profile archives on switch away",
+          m.config.modelProfiles[S]?.sampling.temperature == 0.11)
+    m.selectModelID(S)
+    check("a saved entry restores its profile like a catalog row",
+          m.config.sampling.temperature == 0.11, "\(m.config.sampling.temperature)")
+    m.saveModel(id: S, label: "Renamed")
+    check("saving a duplicate ID updates the entry instead of appending",
+          m.config.savedModels.count == 1 && m.config.savedModels.first?.label == "Renamed",
+          "\(m.config.savedModels)")
+    m.removeSavedModel(id: S)
+    check("remove drops the entry but keeps the profile and grantedAuto",
+          m.config.savedModels.isEmpty && m.config.modelProfiles[S]?.sampling.temperature == 0.11
+            && m.modelPickerSelection.wrappedValue == "custom")
+    m.selectModelID(A)
+
     exit(failures == 0 ? 0 : 1)
 }