Contributing to SplashGUI
This is the working reference for anyone modifying SplashGUI by hand or with an AI assistant. It's a distillation of my personal project-memory md files.
SplashGUI is MIT-licensed and ships no engine code, it is a SwiftUI front-end that downloads and manages the separate, Apache-2.0 Splash engine.
The big picture
- The app wraps
splash serve: it builds the launch arguments, supervises the child process, polls/status, and derives run settings from the machine's Metal ceiling. The engine pulls and verifies models from Hugging Face itself, the app only pins and pre-flights hashes. Core/is logic,Views/is presentation,Core/AppModelis the singleObservableObject. Views bind to it directly; rules live in Core, not in views.- Some rules are deliberately single-sourced. Do not duplicate them:
SplashServer.buildArguments: the one argv builder (the exact launch command, including the LAN--allowed-hostlist).ClientConfigs: the one client-config writer (OpenCode / Zed / Claude Code / Codex / Pi).AppModel.enginePlan: the pure (nonisolated static) engine-source mode table:pinnedignores custom fields,homebrewtakes the brew payload at any version,customrequires all three,latestkeeps the installed engine when the update check fails (never a silent downgrade).AppModel.portValid,AppModel.providerContextTokens,AppPaths.dataDir,CatalogModel.weightsBytes,EngineInstaller.isInstalled.
Repo map
Sources/SplashGUI/
├── Core/
│ ├── AppConfig.swift # Codable config (schema 7), model catalog, AppPaths, ConfigStore
│ ├── AppModel.swift # live state: enginePlan, server lifecycle, 1s status poll + performance sampler, bindings
│ ├── ClientConfigs.swift # client config text generators (never edits a tool's config in place)
│ ├── EngineInstaller.swift # pinned engine download/install + Homebrew adoption + headless CLI
│ ├── EngineResolver.swift # latest-release resolver (GitHub API) → EnginePin, nil on any failure
│ ├── MachineInfo.swift # RAM/GPU/disk probes, AutoProfile (27B-arch gated), HF cache paths
│ ├── PerformanceLog.swift # JSONL /status samples (day files, tick gating, stats, CSV export)
│ ├── SessionLog.swift # JSONL session store (day files, retention purge, tail, stats)
│ ├── SessionProxy.swift # logging front: byte pipe on the public port + HTTP/SSE parse layer
│ ├── SplashClient.swift # /status decoder (StatusSnapshot) + HTTP client
│ └── SplashServer.swift # serve process launch, argv builder, LogRing
└── Views/
├── RootView.swift # @main, sidebar, custom title bar, footer, headless probes
├── SettingsLayout.swift # full-width SettingsPage / SettingsSection cards
├── RunTab.swift # Model & Server + Engine + log pane
├── LoggingTab.swift # session + performance logging, storage stats, live tail
├── ProviderTab.swift # client picker, LAN-host toggle, sampling, config preview/copy/save
├── StatusTab.swift # memory bar, headline cards, chart, metric grid
└── StatusWidgets.swift # title-bar controls, chips, fields, MemoryBar/TimeSeriesChart
scripts/
├── bundle-app.sh # dev bundle; --release = Developer ID + notarized DMG
├── release.sh # tag + push + gh release create (maintainers)
└── profile-test/ # headless regression harness (see Tests)
Runtime state lives in ~/Library/Application Support/SplashGUI (config.json, engine installs, logs/sessions, logs/performance). The app and the /Applications copy share that directory and the server port, don't run both at once.
Build
Requires macOS 26.4+, Apple silicon, and the Swift 6.2 toolchain (Xcode 26 or the standalone toolchain).
swift build # zero warnings expected — treat a new warning as breakage
scripts/bundle-app.sh --open # ad-hoc signed build/SplashGUI.app
Tests
scripts/profile-test/run.sh # the headless harness (185 assertions against the real AppModel)
- Quit SplashGUI first. The harness refuses to run while the app is up: it trades your live
config.jsonfor a fixture and restores it via a trap on exit. Note thatHOME=<tmp>does not redirectapplicationSupportDirectoryon macOS. Tests always touch the real data dir, which is why the backup/restore exists. - The harness exports
SPLASHGUI_TEST=1soAppModelinit doesn't spawn a real engine whenstartOnLaunchis on. Keep that guard when hand-rolling headless runs (compileCore/*.swiftplus a throwawaymain.swift- the file must be named exactlymain.swiftfor top-level code). - Every new behavior gets a harness check. Extend an existing check or table before adding one. The maintainer mutation-proves load-bearing checks (break the code, watch the specific check fail).
- The harness's
swiftclist is explicit. Add any newCore/*.swiftfile toscripts/profile-test/run.shor the harness won't compile it.
The app binary also doubles as a CLI, useful for verification and CI:
SplashGUI.app/Contents/MacOS/SplashGUI --install-engine # install the pinned engine
SplashGUI.app/Contents/MacOS/SplashGUI --auto-profile # print the derived launch args
SplashGUI.app/Contents/MacOS/SplashGUI --check-model # verify installed weights' hash (exit 1 on mismatch)
The conventions that matter
Codable: the trap that silently wipes user settings
The synthesized Decodable throws on a missing non-optional key even when the property has a default value. Any new field on a Codable config type without a tolerant path sends every existing config.json into ConfigStore.load()'s catch-all → factory defaults, per-model profiles and all. So:
AppConfig,RunConfig,SamplingDefaults, andModelProfilehave explicitinit(from:)implementations. Every new field needs adecodeIfPresent+ default (or make it Optional). Nested types are otherwise still strict and the same trap applies if they gain fields.- A struct with any custom initializer loses its memberwise init, so those types also need an explicit
init(). - Config shape changes bump
schemaVersionand migrate tolerantly (e.g. schema 5 rewrote a stored"0"cache quota to"10G"; unknown keys like the retiredtaskPresetare ignored and dropped on next save). - Add a harness fixture check for any new field: old-config decode + migration.
SwiftUI gotchas (each one was a shipped bug)
Text("...\(8095)")interpolates throughLocalizedStringKeyand renders "8,095". Machine values go throughString(int)TextField(value:format:.number)needs.grouping(.never).- Grouped
Formcenters rows in a fixed ~704 pt column and wastes wide windows, useSettingsPage/SettingsSection. - macOS sizes
.toolbaritems to content, so a stretching item collapses. The server controls live in the custom 54 ptRootView.titleBarinstead, not a.toolbar. - Long inline view trees hit the type-checker limit ("conform to TableRowContent" cascades). Extract columns/sections into computed properties.
- Labels hug their text; alignment comes from
Gridcolumns, not fixed-width label frames (fixed frames caused the dead gaps). The two documented exceptions are deliberate local alignments (Provider sampling rows,LabeledFieldvalue columns). - No animation anywhere. All state movement comes from the 1s status poll.
- System colors only. No hex/RGB literals; dark mode comes free from that rule.
UI copy
- English, sentence case, no em dashes in user-facing copy unless you're quoting Dragon's Dogma dialogue.
- Prefer
.help(...)tooltips over inline prose; inline.captiononly for facts a user needs without hovering. A tooltip that quotes a number names its source (model card, Metal ceiling, engine's own limit). Never present a value as arbitrary. - Applying card values is an explicit click ("Reset to model card", the thinking-off link), never a side effect of switching models or effort.
- The footer is the single error surface; there is no error banner.
Working with the Splash engine
Engine behavior here was verified empirically against installed releases, not from docs. Two standing rules:
- Verify against the installed engine payload
(
~/Library/Application Support/SplashGUI/engine/current/), not a stale clone or release notes. The--max-cache-disksemantics changed between 1.3.0 and 1.3.2; a reference tree that is two versions behind will mislead you. - Engine bumps are code changes. The compiled
EngineInstaller.defaultPinis the tested default;latestmode resolves live from the GitHub releases API (and keeps the installed engine on any failure). When bumping the pin, re-verify every flagbuildArgumentspasses against the new payload (1.5.0 rejects CLI abbreviations, for example) and re-check any code comment that claims engine behavior.
Facts worth knowing before touching server integration:
- The engine always pairs a speed draft (DFlash2): there is no
--no-draftflag, sentinel, or env var (verified on 1.5.0). Don't add an app-side "skip draft" toggle until upstream adds the flag. - Sampling: there are no serve-level defaults; omitted fields fall back to the engine's per-request defaults (temperature 1.0 / top_p 0.95 / top_k 20). On 1.3.2+ every sampling field is accepted except
logit_bias(400). Model-card values are the app's defaults source; card asks the engine refuses are stated in the UI, not silently dropped. --max-cache-disk:"auto"omits the flag (engine follows volume free space),"0"disables the SSD tier;--persistent-cacheis refused without a non-zero quota, so the app must not pass it alongside"0".--idle-release(default 10 m) unwires weights when idle; the next request pays a ~4–6 s restore plus a slower first prefill. The app defaults to60m.- LAN serving needs
--allowed-host <LAN IP>. Engine 1.6.x accepts only the bind address, loopback, and names given with--allowed-host;0.0.0.0is excluded. The app passes the leased LAN address whenever "Serve on LAN" is on. With logging fronted, the engine binds loopback and the proxy is the only LAN-facing listener, but the allowed host still has to ride through. - Homebrew is a first-class engine source. A
brew install splashpayload at/opt/homebrew/opt/splash/libexecmirrors the tarball root, so adoption just pointscurrentat it.homebrewmode takes it at any version (brew can lag the pin);pinnedandlatestadopt it only at or above the wanted build. Schema 7 flips the untouchedpinneddefault tohomebrewwhen one is detected. - Model targets are Hub IDs only (
owner/repo[:VARIANT], the variant is part of the store-link name). The catalog follows the engine's owninstall/suggested-models.tsvand carries revision+sha256 pins only on rows verified on hardware. The pre-flight hash check exists because the engine's own startup verify only re-checks paths and byte counts. - Stopping a serve by hand: kill the Python launcher first (or in the same batch as the native child), or the launcher auto-restarts the engine.
lsof -i :PORTalso matches TIME_WAIT sockets, don't gate on it. - Auto-sizing (
MachineInfo.autoProfile) keys onrecommendedMaxWorkingSetSize(the Metal wired ceiling), not free RAM. macOS keeps RAM resident, soavailableRAMis misleading. It is gated to the 27B-arch catalog rows (one measured KV constant); other archs and custom IDs return nil so the engine self-sizes. That is a documented semantic ("Splash auto-sizes"), not a bug.
Pull requests
- Write or at least edit the body yourself. If you have an LLM draft it, that's fine, but please don't let a model dump a 700 word short novel on me when it could have been a paragraph (they really love doing this). The diff will show the code changes so the body just needs to be a "TLDR" of what changed and why.
- Small, reversible steps; match the existing style; don't reflow or reword lines you don't need to change. Keep comments concise, and don't re-state what the code itself already says it does.
- Reuse before you add: grep for an existing helper or check and extend it. No new options or exports without a caller.
- Don't rename the bundle id (
com.splashgui.app) or the data directory. Both are migration anchors. - Before opening a PR:
swift buildwith zero warnings,scripts/profile-test/run.shgreen (app quit), and a new harness check for any new behavior. If you changed visuals, rebuild the dev bundle (scripts/bundle-app.sh --open) and actually look at it. If you can't for the life of you get it working but you think it's something that really should be added, go ahead and cut the PR with that as a note, and I'll see if I can wrassle it. - Don't commit:
build/,.build/,scratch/, DMGs, or anything under~/Library/Application Support.
Releases (maintainers only)
SIGN_IDENTITY="Developer ID Application: …" NOTARY_PROFILE=… scripts/bundle-app.sh --release
scripts/release.sh # tags splashgui/v<version>, pushes main + tag, gh release create
- Bump
Resources/Info.plistversion + build first; the build counter stays monotonic. - Never move a published tag. Re-tag forward instead.
release.shdoes a plain push: if history was rewritten (squash), force-pushmainas its own step before running it.- If
ghcan't infer the repo from your remotes (for example, a mirror plus a GitHub push URL), pass--repo owner/nametogh release create. - Only the app binary is signed/notarized. The engine is downloaded via URLSession (no quarantine xattr) and runs as a child process under its own signature, it does not need ours.
Notes for AI agents
If you are an LLM or agent working on this repo, whether dispatched by a harness or driven interactively:
- Read before you write. Never edit a file you haven't just read; never reference a symbol without confirming it exists. Start with
README.md, this file, then the specific Core/Views files you'll touch. - Verify, don't assert. "It should work" is not verification. The definition of done is:
swift buildclean with zero warnings,scripts/profile-test/run.shgreen, and - for behavior the harness can reach - a new check that would fail if you reverted the fix. Run the headless CLI modes (--auto-profile,--check-model) to confirm engine-facing changes instead of reasoning about argv. - Check the running engine, not your memory of it. Claims about Splash flags, defaults, or
/statusfields must be confirmed against the installed engine payload or a live endpoint. Comments in this repo that state engine facts name the version they were verified on, re-verify on a pin bump. - The Codable trap and the number-localization trap are the two easiest ways to ship a silent data-loss or display bug. Re-read those sections before touching config types or any
Text/TextFieldthat renders a machine value. - Respect the live environment. The harness mutates the real
config.json(with backup/restore). Quit the app before running it, and never editconfig.jsonwhile the app runs: it saves on picker changes and at quit, silently clobbering external edits. Drive the app or the CLI instead. - Keep scope. No unrequested features, abstractions, or "while I'm here" refactors; flag unrelated problems in your summary instead of fixing them in passing.
- Be honest about uncertainty. Say what you ran, what passed, and what you could not verify. If you reviewed or relayed another agent's output, grep-verify every load-bearing claim before presenting it as fact. Sub-agent reports have shipped real findings alongside hallucinated symbols and fixes that broke adjacent paths.
- Never invent content in docs or comments. Record only what you observed or what the user decided.