Skip to content
tanjiro184Public

About

Native open-source macOS maintenance: 100 transparent modules, 30 system settings, exact dry-run plans, write-ahead Recovery, and zero telemetry.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Serein — Mac care, with clarity

Serein

Mac care, with clarity.
Native, open-source macOS maintenance with exact dry-run plans, explicit risk labels, and local Recovery.

Lire en français

CI macOS 13+ Swift 5.9+ Universal 2 Technical preview MIT License

Serein is a distinct Swift/SwiftUI application built around the idea that macOS maintenance should be native, local, and auditable. It contains 100 modules: 88 standard, 10 sensitive, and 2 critical. The interface never folds those risk levels into a vague “one-click fix”.

Note

0.1.0 is a technical preview. The source and a locally installable Universal 2 ad hoc package are complete and verified. The first public binary release remains deliberately blocked until the owner supplies a real Apple Developer ID identity and the exact artifact is accepted by Apple’s notarization service.

Important

The Universal 2 build, metadata-clean DMG/ZIP tooling, Developer ID signing path, and notarization gate are implemented. Public release binaries must not be described as Apple-notarized until they are signed with the owner’s real Developer ID Application certificate, receive notary status Accepted, and pass stapling/Gatekeeper/quarantine checks. See Release status and docs/RELEASING.md.

Why Serein

  • Native Swift + SwiftUI — no Electron runtime, web view, account, subscription, or background analytics.
  • An exact review plan — final confirmation shows every frozen top-level path, selected executable, fixed command, risk, and staged-byte total.
  • Simulation first — dry-run is enabled by default; it never moves target files or runs maintenance commands. A private local summary is written to History.
  • Write-ahead Recovery — every intended move is journaled before mutation, and a later command failure cannot erase the rollback record.
  • Honest storage semantics — staging clears an application location but does not free disk space; only the separate critical Recovery purge reclaims those bytes.
  • No generic shell — fixed executable URLs and argument arrays replace sh -c, remote rules, and arbitrary scripts.
  • Frozen and revalidated targets — per-action path rules plus whole-tree file/volume identity, timestamps, size, count, and a SHA-256 metadata digest are checked immediately before a move.
  • Graduated critical protection — a critical action runs alone after a unique phrase, ten-second delay, and Touch ID or device-owner password.
  • No fake “health” score — storage and system signals are reported as measurements, not marketing drama.
  • No telemetry — core scans and maintenance are local and require no network connection.

Interface

Serein overview

Action Library Safety Center
Serein Action Library Serein Safety Center

The native NavigationSplitView interface includes:

  • overview and privacy-permission status;
  • Smart Care scan restricted to standard modules;
  • searchable/filterable library of all 100 modules;
  • exact, expiring target plans and graduated confirmation sheets;
  • local recovery manifests and one-click restore;
  • an explicit safety center documenting enforced invariants;
  • light/dark/system appearance through native macOS materials.

The 88 / 10 / 2 model

Level Count Automatic selection Confirmation Recovery
Standard 88 Smart Scan may inspect; nine conservative defaults are initially selected Exact plan review Read-only, moved to Serein Recovery, or a reviewed setting write
Use with care 10 Never Exact plan + acknowledgement + 3-second delay Five Recovery moves; five fixed commands without rollback
Extreme caution 2 Never; disabled until Expert mode Standalone plan + unique phrase + acknowledgement + 10 seconds + device-owner authentication Irreversible

System settings and administrator tools

Two engines were added alongside the original four.

Settings write macOS defaults through /usr/bin/defaults with a structured argument vector — never a shell string. The value currently in force is read back from the machine before a switch is drawn, so it shows reality rather than an assumption, and the value you reviewed is frozen into the plan before anything is written. Thirty settings cover Finder, the Dock, screenshots and Safari. All are reversible: applying the other value restores the previous behaviour.

Administrator tools exist because some maintenance genuinely needs root. macOS presents its own authentication window; Serein never sees, stores or transmits the password, and leaves no privileged helper installed between runs. The argument vector stays structured until the last moment, then every element is single-quoted, so no catalogue value can escape its own argument — a self-check asserts this against a deliberately hostile argument. Administrator privilege is treated as a permission, not a risk tier: a module that merely needs a password keeps the risk level its consequences warrant, and carries a separate label. The full reasoning is in docs/SAFETY.md.

The catalogue includes storage and hardware insights, user/system caches, ten browsers, communication apps, Xcode and package-manager artifacts, privacy data, Docker/Homebrew maintenance, Spotlight and LaunchServices repair, and the Recovery/Trash critical boundary. The authoritative inventory, exact targets, limitations, and two-phase storage model are in docs/FEATURES.md and enforced by tests:

#expect(ActionCatalog.standard.count == 88)
#expect(ActionCatalog.sensitive.count == 10)
#expect(ActionCatalog.critical.count == 2)
#expect(Set(ActionCatalog.all.map(\.id)).count == 100)

Install

Developer ID-notarized release (recommended, not published yet)

When the release gate has been completed with the owner’s Apple credentials:

  1. Download Serein-<version>.dmg from GitHub Releases.
  2. Verify its SHA-256 against SHA256SUMS.txt.
  3. Open the DMG and drag Serein into Applications.
  4. Launch Serein from Applications.

The release workflow verifies the identity, timestamp, hardened runtime, entitlements, and both architectures; requires notary status Accepted; staples the app and DMG; validates Gatekeeper; recreates the ZIP; generates checksums last; and creates a draft/prerelease by default.

Build locally

Requirements:

  • macOS 13 or later;
  • Swift 5.9 or later (swift --version);
  • Apple Command Line Tools for a local ad hoc build;
  • full Xcode plus Apple Developer credentials only for official signing/notarization.
git clone https://github.com/tanjiro184/SereinMac.git
cd SereinMac

# Compile and run the safety/recovery contract checks
scripts/verify.sh

# Create a Universal 2 .app with an ad hoc local signature
VERSION=0.1.0 BUILD_NUMBER=1 SIGN_IDENTITY=- scripts/build-app.sh

# Create an installable DMG, ZIP, and SHA256SUMS.txt
VERSION=0.1.0 SIGN_IDENTITY=- scripts/package-dmg.sh

The artifacts appear in dist/. Packaging verifies the exact metadata-clean app inside the mounted DMG. An ad hoc signature proves local bundle integrity; it is not a Developer ID signature or Apple notarization and is not the project’s public release channel.

Full Disk Access

Serein works in limited mode without Full Disk Access. Protected Mail, Messages, Safari, and container locations may be incomplete until the user grants access in macOS System Settings. The sidebar uses a best-effort protected-location readability probe, not a formal proof that every protected path is accessible; individual plan blockers are authoritative.

Serein does not edit the TCC privacy database, bypass permissions, disable SIP, or weaken Gatekeeper. It only opens Apple's official System Settings panel when asked.

Safety architecture

The important data flow is deliberately one-way until the user confirms a plan:

flowchart LR
    A["Action catalogue"] --> B["Exact FileTargetPlanner"]
    B --> C["Visible paths, command, sizes, fingerprints"]
    C --> D["Risk-specific user consent"]
    D --> E["Plan, path and authorization validation"]
    E --> F["Whole-tree fingerprint revalidation"]
    F --> G["Write-ahead Recovery journal"]
    G --> H["Exact move or fixed command"]
    H --> I["Commit, History, restore or standalone critical purge"]
Loading

Key invariants:

  • /, the home root, the ~/Library root, the temporary root, and Recovery are forbidden cleanup targets;
  • every cleanup candidate must stay inside its exact catalogue PathRule;
  • /System, /usr, /bin, /sbin, and /private are never cleanup targets;
  • symbolic-link roots are refused and nested links are never traversed;
  • file/volume identity, timestamps, entry count, size, and metadata digest are rechecked before moving;
  • sensitive/critical modules never enter Smart Care, and Serein has no unattended scheduler;
  • critical actions run one at a time and require Expert mode, a unique phrase, acknowledgement, timer, and device-owner authentication;
  • moving into Recovery does not reclaim space;
  • no remote rule engine or arbitrary shell command exists.

Read the threat model and limitations in docs/SAFETY.md.

Architecture

Sources/SereinApp/
├── App/             SwiftUI entry point and macOS lifecycle
├── Catalog/         authoritative 100-module catalogue
├── Models/          risk, action, scan, recovery, and audit models
├── Services/        scan, exact planning, fingerprints, safety, execution, recovery, auth, history
├── Verification/    framework-independent self-test harness
├── ViewModels/      @MainActor application state
└── Views/           native navigation, pages, cards, and confirmations

ScanEngine and ActionExecutor are actors. AppState is isolated to the main actor. Filesystem paths, commands, frozen plans, fingerprints, and journal states are data, making catalogue counts and safety invariants testable without launching the UI.

More detail: docs/ARCHITECTURE.md.

Verify

scripts/verify.sh

The verification flow:

  1. compiles the application;
  2. runs the embedded safety-contract self-test;
  3. validates exact risk counts and unique IDs;
  4. rejects configured generic shells and mixed critical batches;
  5. tests global and per-rule path boundaries;
  6. performs a real simulation → write-ahead move → committed manifest → restore round trip;
  7. rejects an old directory containing a newer descendant;
  8. rejects a target changed after plan creation;
  9. preserves Recovery when a later fixed command fails;
  10. runs the framework test suite when Xcode’s test modules are available.

Release status

Component Status
Native SwiftUI technical preview Ready
100-module catalogue Ready and count-locked
Exact plan, revalidation, write-ahead Recovery and restore Ready and self-tested
Local Universal 2 artifact Verified (arm64 + x86_64)
Metadata-clean DMG/ZIP/relative SHA-256 packaging Verified locally with ad hoc signature
MIT licensing, privacy, safety, architecture and community docs Ready
Pull-request CI workflow Ready
Developer ID signing Gate ready; blocked on the owner’s certificate/private key
Apple notarization and stapling Gate ready; blocked on owner credentials and an Accepted submission
Public binary release Not published; keep draft until all Apple and quarantine checks pass

Apple signing cannot be delegated to a fake or shared identity. The owner must have an active Apple Developer Program membership and configure the protected release secrets described in docs/RELEASING.md. Notarization is an automated Apple security/signing check, not App Review or endorsement.

Privacy

Serein collects no telemetry, analytics, advertising identifiers, crash uploads, or account information. Core features are offline. Paths and up to 32 KiB of confirmed command output can appear in local History/Recovery records; they are not uploaded or systematically redacted.

See PRIVACY.md.

Contributing

Contributions are welcome — especially additional scan fixtures, localization, accessibility review, and conservative adapters for developer tools.

Please read CONTRIBUTING.md, SECURITY.md, and the Code of Conduct before opening a pull request.

Acknowledgements

Serein was created after studying the product category represented by PureMac, a native MIT-licensed SwiftUI cleaner. Serein uses its own name, icon, copy, catalogue, interface, architecture, and implementation. No PureMac source file is included in this repository. See ACKNOWLEDGEMENTS.md.

License

Serein is released under the MIT License.

Mac and macOS are trademarks of Apple Inc. Serein is an independent project and is not affiliated with or endorsed by Apple Inc.

About

Native open-source macOS maintenance: 100 transparent modules, 30 system settings, exact dry-run plans, write-ahead Recovery, and zero telemetry.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages