# M1: Home & Posts list (#17) > **Date:** 2026-10-01 > **Type:** issue > **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/17 ## Goal Ship #17 (S1.1): the workspace shell from the design contract — nav rail (Posts, Sessions, Learnings, Settings), Posts pane mirroring the Home's `posts/` on disk with empty state, Home editable in Settings with repoint-only semantics, placeholder panes for Sessions/Learnings. ## What Was Done - `DesignTokens.swift` — palette + geometry extracted from `museion-workspace.html` (`:root` vars, grid columns 56/232/min-420/356, radii 10/14, serif/mono designs). - `WorkspaceView.swift` — post-gate root surface: nav rail + pane switch; `RailButton` with the export's selected-card + edge-bar treatment; honest placeholders for Sessions (#28) / Learnings (#26, #27). - `PostsPaneView.swift` — Posts destination with Pass State group labels, post rows (title + mono meta), empty state, editor placeholder (#19–#21), mentor column (`MentorPaneView` at 356). - `PostLibrary.swift` — `PostLibrary.scan(home:)`: mirrors `posts/` (dirs with `post.md` only — lazy folders and noise skipped), lenient frontmatter (`pass_state`/`origin`, First Draft/writer defaults), Title = first non-empty line after frontmatter with `#` stripped, `untitled` fallback. - `SettingsPaneView.swift` — Home row + NSOpenPanel repoint; repoint-only copy in-UI. - `AppGateState.museionHome` — UserDefaults-backed, default `~/Documents/Museion` (main's b3daac9 default, not the old `~/Museion` from the issue text). - `MentorPaneView` root min-frame dropped (it's a column now). - Tests (+7): PostLibraryTests — bare post defaults, lenient frontmatter, empty/missing home, lazy-folder + noise exclusion, title sort, untitled edges, default Home. ## Decisions & Rationale | Decision | Rationale | |----------|-----------| | Column collapse instead of a fat minWidth | First build forced rail+library+editor+mentor minWidth (1064); the restored 900pt window clipped the rail and mentor off-screen (user hit it live). The export collapses at media-query thresholds (≤1100 library, ≤920 mentor); PRD says map that to macOS pane collapse. `GeometryReader` budget drives `showsLibrary`/`showsMentor`. | | Lenient frontmatter read (`pass_state`/`origin` keys, defaults) | Corpus posts ship bare; the write-side key format is #18's to pin. CONTEXT.md: Pass State explicit, never inferred — First Draft default is the honest read of a bare post. | | UserDefaults for the Home | A Home is a plain folder the user points at — nothing app-owned worth a database. Same floor as state.json reasoning. | | NSOpenPanel over fileImporter | fileImporter's folder mode still shows files on macOS; one proven AppKit call beats bridging workarounds. | | Explicit `AppGateState.init()` | `Self` in a stored-property initializer trips `@ObservationTracked` (covariant-Self compile error). | | Scan on `.task(id: home)` only | #17 is read-only; no FS events yet — #18 adds lifecycle (create/rename/delete round-trips) and re-scan triggers. | ## Gotchas & Fixes | Problem | Root Cause | Fix | |---------|------------|-----| | Empty posts list despite defaults write | `defaults write` from the agent's shell lives in a different cfprefsd context than the `open`-launched app; plist on disk never got the key | Verified scan logic standalone (swift REPL finds both posts); user-path verification (Settings → Choose…) is the honest route — CLI defaults injection is unreliable for GUI apps | | Rail icons "invisible" in early screenshots | 900pt restored window < 1064 minWidth → HStack laid out at min size, clipping both edges | Column collapse (above) | | `localizedStandardCompare` order surprise | It's Finder-like (case-insensitive, numeric-aware): "Beta 2" < "beta 10" | Test expectation corrected — the code is right | | SwiftFormat reformatting drive-by (944-line prototype diff) | Ran `swiftformat .` repo-wide | Reverted untouched files; formatted only changed files after | | AppleScript `by` reserved word | `set {bx, by} to position` — `by` is an AppleScript term | Renamed to `btnPos`/`btnSize` | ## Verification - Build: `xcodebuild … build` → **BUILD SUCCEEDED** - Tests: full suite → **TEST SUCCEEDED**, 52/52 passed (45 pre-existing + 7 new) - Lint: `swiftlint Museion/ MuseionTests/` → 0 violations; SwiftFormat clean on changed files - Live: app launched, gate sheet passed and dismissed via AX, workspace rendered (rail/Posts/editor/mentor verified by screenshot); window-resize collapse fix built but final visual pass blocked by a fullscreen break timer — needs one manual look ## Finish Audit (same day) Three fresh-context reviewers (ponytail / security / general) over `804b588`. Accepted and fixed: | Fix | Source | |-----|--------| | Scan off-main: `Task.detached { Post.scan(home:) }` in `.task(id:)` — MainActor-inherited synchronous scan froze the UI on big Homes | security MEDIUM-1 + review | | `PostLibrary` struct → `Post.scan(home:) -> [Post]` (wrapper with one field, unused Equatable) | ponytail | | Hidden-dir skip now real (dot-prefix guard) — the AGENTS.md claim was code-less and the test vacuous; test now writes a `post.md` into `.trash/` | review MEDIUM + security INFO-5 | | Unterminated frontmatter returns `untitled` (was leaking `pass_state: …` as Title) | review MEDIUM | | Quoted YAML values unquoted (`origin: "ai"` → `.ai`) | review MEDIUM | | Leading blank line before `---` no longer defeats frontmatter detection (both parser funcs) | review LOW | | `#`-only body → `untitled` (was empty string) | review LOW | | Symlinked post dirs skipped (one resourceValues guard, single fetch) | security LOW-3 | | Persisted home validated `isFileURL` (fails closed to default; hygiene) | security LOW-2 | | Dead code out: `radiusLarge`, `editorMinWidth`, `homeKey`; `PaneHeader` trailing slot; Settings ScrollView; PostRow optional-fill dance; `availableWidth` default | ponytail | Discarded as speculative: read-cap on file heads (detached hop fixes the hang; #18 owns growth), UserDefaults round-trip test (shared test host). Tests 56/56 (4 new: quoted values, symlink, unterminated frontmatter, leading blank). Lint 0. ## Files Changed | File | Change Summary | |------|---------------| | `Museion/DesignTokens.swift` | New — design-contract tokens | | `Museion/WorkspaceView.swift` | New — nav rail + pane shell, collapse logic | | `Museion/PostsPaneView.swift` | New — library column, groups, empty state, editor placeholder | | `Museion/PostLibrary.swift` | New — disk scan + lenient frontmatter | | `Museion/SettingsPaneView.swift` | New — Home repoint via NSOpenPanel | | `Museion/MuseionApp.swift` | `AppGateState.museionHome` + default | | `Museion/ContentView.swift` | Post-gate root → `WorkspaceView` | | `Museion/MentorPaneView.swift` | Root min-frame dropped | | `MuseionTests/PostLibraryTests.swift` | New — 7 tests | | `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | Contracts updated | ## Open Items & Next Steps - [ ] Manual look at the collapse behavior at narrow widths (break timer blocked the final screenshot pass) - [ ] #18 Post lifecycle — New Post button, lazy folder creation, slug naming, rename/delete round-trips; pins the frontmatter key format written on save - [ ] Mentor engine crash on workspace entry — pre-existing #14 behavior (drift note also visible); not #17 scope but worth a #28 look when Sessions land --- *Log written by write-log skill*