RawCull Tech Documentation
RawCull Developer Notes
These pages explain RawCull from a developer’s point of view. They are intended for readers who already understand Swift and SwiftUI and now need to learn where behavior lives, how data moves through the app, and which invariants must survive a change.
Source paths in these pages are relative to the named repository. App paths such
as RawCull/Model/ViewModels/RawCullViewModel.swift belong to the RawCull
repository. Package paths belong to the separately versioned Swift packages
referenced by RawCull.xcodeproj; this documentation repository does not
contain or compile source snapshots.
Start Here
Read these pages in this order when learning the project:
- Thumbnails and Scan Pipeline follows a selected catalog from directory discovery to visible images.
- Viewer Architecture and Keyboard Ownership follows screen sessions, task identity, overlays and keyboard routing.
- Concurrency explains
@MainActor, actor ownership, cancellation, and bounded parallelism across that pipeline. - Cache System explains why grid, preview, disk, full-size, and analysis caches are separate.
- Focus Mask and Sharpness follows scoring and focus evidence into persisted culling data.
- Burst Groups combines sharpness, similarity artifacts, grouping, ranking, and the burst-review UI.
- Artificial Intelligence covers Review presets, model requirements and saved evidence. RawCull Packages explains the reusable package boundaries behind the app.
Use File Read and Write and Security-Scoped URLs whenever a change touches persistence, caches, user-selected folders, export, or copying.
Repository And Target Map
| Area | Primary source | Responsibility |
|---|---|---|
| App composition | RawCull/Main/RawCullApp.swift | Uses RawCullApplicationState.live() to assemble stable models/features, inject environment state, and define windows and commands |
| Main presentation | RawCull/Main/RawCullMainView.swift | Switches between loupe, grid, similarity, rated, comparison, and Review modes and owns top-level sheets and overlays |
| App orchestration | RawCull/Model/ViewModels/RawCullViewModel.swift | Assembles catalog, culling, burst, presentation and AI owners for environment injection |
| Background ownership | RawCull/Actors/ | Serializes scans, thumbnail requests, caches, persistence, extraction, and contention gates |
| App services and adapters | RawCull/Model/ | Connects the UI model to RAW parsing, sharpness analysis, AI providers, persistence, diagnostics, and rsync |
| Reusable domain logic | RawCullCore package | Value models and pure algorithms such as burst grouping and ranking |
| RAW decoding | RawParserKit package | Dedicated ARW/NEF/DNG and generic macOS-backed RAW dispatch, metadata normalization, MakerNote parsing, thumbnail extraction, and preview creation |
| Image analysis | PhotoAnalysisKit package | Sharpness, saliency, focus evidence, masks, and analysis descriptors |
| AI contracts and workflows | PhotoAIKit package products | Typed similarity artifacts, Vision/CLIP backends, semantic search, segmentation, and storage contracts |
| Tests | RawCullTests/ and package test targets | Executable behavior contracts, concurrency checks, cache identity checks, and integration coverage |
Architectural Shape
flowchart TD
App["RawCullApp: composition root"] --> Main["RawCullMainView: presentation router"]
App --> VM["RawCullViewModel: workspace composition"]
VM --> Owners["Observable state and workflow controllers"]
Main --> Owners
Owners --> Feature["Feature models: culling, sharpness, similarity, Review, settings"]
Owners --> Actors["Actors: scan, thumbnail, cache, persistence, export"]
Feature --> Analysis["PhotoAnalysisKit"]
Feature --> AI["PhotoAIKit services and typed artifacts"]
Actors --> Parser["RawParserKit"]
Owners --> Core["RawCullCore pure models and algorithms"]
Actors --> Storage["Application Support, Caches, selected folders"]The boundaries are based on ownership:
- SwiftUI views render observable state and translate gestures, commands, and bindings into model actions.
RawCullViewModeland feature view models are@MainActorbecause their state drives presentation.- Actors own shared mutable background state and serialize work such as cache access, thumbnail coalescing, and writes.
RawCullCorecontains reusable value models and pure decisions that do not need UI isolation.RawParserKit,PhotoAnalysisKit, andPhotoAIKithide specialized parsing and analysis implementations behind typed boundaries.- Security-scoped access remains alive at the app or operation boundary for as long as user-selected files are used.
Workspace owners in 3.4.9
RawCullViewModel.swift wires the long-lived workspace objects together.
workspaceEnvironment(_:) supplies those objects to SwiftUI. Views read the
state and operations they use through the environment or explicit inputs.
| Owner | State or actions |
|---|---|
CatalogWorkspace | Open source, scanned and filtered files, scan progress, focus-point lookup |
CatalogController | Catalog loading, sorting and filtering, grid and zoom projections, sharpness and AI input |
CatalogLifecycleCoordinator | Catalog transitions, load tasks and security grant |
SelectionModel and RatingsModel | Focus, selection and comparison IDs, plus culling store and rating revision |
CullingController | Rating changes, selection advance and culling-store recovery |
BurstWorkflowController | Analysis coordination, review queue, keep-best, undo and review state |
WorkspaceNavigationModel, ZoomOverlayModel and LoupeViewportModel | View mode, overlay lifecycle and result metadata, and persistent loupe pan/zoom |
WorkspacePresentationModel and FileOperationsModel | Window chrome, sheets and banners, plus JPG work and progress |
See Internal Swift API for call sites and Viewer Architecture for presentation lifetimes.
Follow One Feature Through The Code
When investigating a behavior, read it in this direction:
- Find the SwiftUI control or lifecycle trigger.
- Find the environment model or controller that handles the action.
- Identify which actor, adapter, or package owns the expensive or mutable work.
- Follow the value returned to main-actor state.
- Read the tests named after the actor, model, or feature before changing the invariant.
This approach is more reliable than starting with an individual utility type because it shows both ownership and the complete lifetime of the operation.
Focused References
| Page | Use it when changing |
|---|---|
| Memory Pressure | Cache limits, pressure events, or diagnostics |
| Detailed Sharpness Scoring | Formula-level sharpness behavior and score-impacting factors |
| Detailed Focus Mask Computation | Focus-mask rendering, region selection, and visual thresholds |
| Synchronous Code | Blocking ImageIO, RAW parsing, or explicit executor bridges |
| Sony/Nikon MakerNote Parser | Focus-point metadata and vendor-specific parsing |
| AI Model Downloads | Model installation, validation, signing, and activation |
| Repository Git Workflow | The documentation repository’s linear-history workflow |
Reviewed source baseline
Reviewed on 23 November 2026 against RawCull 3.4.9 build 466,
commit 0513a30e. The commit
is present on both version-3.4.9 and main. The Xcode workspace resolves
24 remote pins. See the package snapshot and
review record. Historical audits and measurements retain
their original source revisions.
Read Viewer Architecture and Keyboard Ownership for the October viewer refactor and RAW Formats and Exposure Inspection for generic RAW admission, temporary EV rendering, histogram and clipping. The review record lists every page’s disposition and validation limits. The developer guide provides the application tour; its detailed method reference is now separate.
State ownership and historical catalog performance
BurstWorkflowController retains BurstReviewSessionModel.swift
for review decisions, independently of viewport/image sessions.
SimilarityScoringModel retains RawCullSemanticSearchModel.swift
for semantic evidence, provider configuration and queries, while keeping its
existing forwarding API. Combined Review still has one mutable feature/run
owner, with orchestration, work support and comparison in separate extensions.
Preload workers await disk saves before releasing worker slots, but release each file’s grid gate before the save. See Performance Measurement for the historical October 25 catalog reference, coalesced progress, cache-state limits and deferred validation. The phase 3–6 encoder, grid and source-load candidates were deferred; reduced sampled main-thread work does not establish faster loading or smoother frames. The build 466 smoke manifest expects 384 unique test identifiers. Test targets
ZoomView preview update in build 428
Fit-to-window RAW viewing can now render bounded, eagerly completed pixels while retaining native geometry. Native zoom preserves the developed-JPEG path; temporary inspection stays native. Read RAW viewing policy and performance results for the selected policy and its measured camera/file scope. The next documentation update starts from the full commit recorded in the review record.
RAW preview status in build 429
ZoomView identifies reduced previews and full-detail RAW results, displays preparation progress, and reports the latest RAW request duration including cache retrieval. The current image stays visible while a replacement loads. See RAW status semantics and the internal API.
Close Up in the 3.4.5 development branch
The burst workspace now embeds PhotoEvidenceKit’s manual Close-ups panel, including comparison membership, retained references, source-labeled crops, saved regions and orientation-corrected AF assistance. The same workspace also serves Single Images; the current source has no separate group restriction on the panel. Read Burst Groups and Viewer Architecture for host ownership.
Build 436 adds a detected crop strip above the manual cards. It shows human faces and a Vision animal head and eye pilot from the current embedded preview. Human face geometry and detail can be reused from the on-disk cache. The detected crops are inspection evidence. Build 466 also offers People Ranking as a temporary comparison order. See Close Up.
Viewer Architecture and Keyboard Ownership
Trace loupe, zoom, burst, comparison and AI presentation through sessions, task owners, shared geometry and keyboard routing.
RAW Formats and Exposure Inspection
Distinguish extension admission, macOS decoding, embedded export, RAW development and display-referred exposure inspection.
Memory Pressure
How RawCull measures memory and reacts to macOS pressure events
Close Up
Compare detail across frames using manual regions, pinned references, recorded autofocus points and detected crops.
Model Context Protocol (MCP)
The RawCull MCP architecture, Swift source map, and a walkthrough from a Codex prompt to ranked burst results.
New Features
RawCull 3.4.9 features, competition and the prioritized 3.5.0 plan.
Artificial Intelligence
Review, burst assessments, semantic search and the boundaries between RawCull and its model providers.
RawCull Packages
Pinned package revisions, imported products, dependency direction, and the recommended architecture reading order.
File Read and Write Reference
Files, folders, and persistent data touched by RawCull
Developer and API Documentation
Developer guides and internal Swift API references for RawCull.
Performance Measurement
RAW ZoomView preview measurements, historical catalog findings, benchmark semantics, and validation limits.
Documentation Review Record
Build 466 source review, per-page dispositions, and the incremental documentation baseline.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.