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:

  1. Thumbnails and Scan Pipeline follows a selected catalog from directory discovery to visible images.
  2. Viewer Architecture and Keyboard Ownership follows screen sessions, task identity, overlays and keyboard routing.
  3. Concurrency explains @MainActor, actor ownership, cancellation, and bounded parallelism across that pipeline.
  4. Cache System explains why grid, preview, disk, full-size, and analysis caches are separate.
  5. Focus Mask and Sharpness follows scoring and focus evidence into persisted culling data.
  6. Burst Groups combines sharpness, similarity artifacts, grouping, ranking, and the burst-review UI.
  7. 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

AreaPrimary sourceResponsibility
App compositionRawCull/Main/RawCullApp.swiftUses RawCullApplicationState.live() to assemble stable models/features, inject environment state, and define windows and commands
Main presentationRawCull/Main/RawCullMainView.swiftSwitches between loupe, grid, similarity, rated, comparison, and Review modes and owns top-level sheets and overlays
App orchestrationRawCull/Model/ViewModels/RawCullViewModel.swiftAssembles catalog, culling, burst, presentation and AI owners for environment injection
Background ownershipRawCull/Actors/Serializes scans, thumbnail requests, caches, persistence, extraction, and contention gates
App services and adaptersRawCull/Model/Connects the UI model to RAW parsing, sharpness analysis, AI providers, persistence, diagnostics, and rsync
Reusable domain logicRawCullCore packageValue models and pure algorithms such as burst grouping and ranking
RAW decodingRawParserKit packageDedicated ARW/NEF/DNG and generic macOS-backed RAW dispatch, metadata normalization, MakerNote parsing, thumbnail extraction, and preview creation
Image analysisPhotoAnalysisKit packageSharpness, saliency, focus evidence, masks, and analysis descriptors
AI contracts and workflowsPhotoAIKit package productsTyped similarity artifacts, Vision/CLIP backends, semantic search, segmentation, and storage contracts
TestsRawCullTests/ and package test targetsExecutable 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.
  • RawCullViewModel and feature view models are @MainActor because their state drives presentation.
  • Actors own shared mutable background state and serialize work such as cache access, thumbnail coalescing, and writes.
  • RawCullCore contains reusable value models and pure decisions that do not need UI isolation.
  • RawParserKit, PhotoAnalysisKit, and PhotoAIKit hide 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.

OwnerState or actions
CatalogWorkspaceOpen source, scanned and filtered files, scan progress, focus-point lookup
CatalogControllerCatalog loading, sorting and filtering, grid and zoom projections, sharpness and AI input
CatalogLifecycleCoordinatorCatalog transitions, load tasks and security grant
SelectionModel and RatingsModelFocus, selection and comparison IDs, plus culling store and rating revision
CullingControllerRating changes, selection advance and culling-store recovery
BurstWorkflowControllerAnalysis coordination, review queue, keep-best, undo and review state
WorkspaceNavigationModel, ZoomOverlayModel and LoupeViewportModelView mode, overlay lifecycle and result metadata, and persistent loupe pan/zoom
WorkspacePresentationModel and FileOperationsModelWindow 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:

  1. Find the SwiftUI control or lifecycle trigger.
  2. Find the environment model or controller that handles the action.
  3. Identify which actor, adapter, or package owns the expensive or mutable work.
  4. Follow the value returned to main-actor state.
  5. 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

PageUse it when changing
Memory PressureCache limits, pressure events, or diagnostics
Detailed Sharpness ScoringFormula-level sharpness behavior and score-impacting factors
Detailed Focus Mask ComputationFocus-mask rendering, region selection, and visual thresholds
Synchronous CodeBlocking ImageIO, RAW parsing, or explicit executor bridges
Sony/Nikon MakerNote ParserFocus-point metadata and vendor-specific parsing
AI Model DownloadsModel installation, validation, signing, and activation
Repository Git WorkflowThe 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.


Thumbnails and Scan Pipeline

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 Cache

Synchronizing Cache Storage and Accounting

Memory Pressure

How RawCull measures memory and reacts to macOS pressure events

Concurrency

Focus Mask and Sharpness

Detailed Sharpness Scoring

Close Up

Compare detail across frames using manual regions, pinned references, recorded autofocus points and detected crops.

Detailed Focus Mask Computation

Burst Groups

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.

Synchronous Code

Documentation Review Record

Build 466 source review, per-page dispositions, and the incremental documentation baseline.

Sony, Nikon, and DNG Metadata Parsers

Repository Git Workflow

Security-Scoped URLs


Last modified November 23, 2026: update (58d91c1)