Concepts

Architecture

One Rust crate reads and writes every format, and everything else is a thin client of it, so the safety checks live in one place.

Peel 1.4.0 · Snack Studio · Updated

The rule: one format authority

Rind is the archive engine of Peel with the app’s interface removed. It is not a separate codebase. It is the peel-core library, and the other surfaces are built on top of it. Each client of the engine is a thin one: it does not parse archives itself, and it does not carry its own idea of what is safe.

The reason is plain. A second parser in an extension would drift from the engine, miss its formats, and skip its safety policy. The design documents state it as a rule: peel-core is the only format authority.

The layers

Text
Swift app (SwiftUI)    Finder Sync, Quick Look, Spotlight, PeelFS
        │                          │
   PeelKit client          libpeel_ffi (C library)
        │                          │
  peel command  ·  peel mcp  ·  peel-ffi  ·  Rust API
                   │
               peel-core

The Cargo workspace has three crates, and Cargo.toml lists them as its members:

Crate What it is
crates/peel-core The engine: detection, listing, extraction, creation, checking and recovery, as a Rust library.
crates/peel-cli The peel command, and peel mcp, the MCP server over standard input and output.
crates/peel-ffi The C library, built as a static and a dynamic library. Its header is include/peel.h.

The four ways in are covered in their own pages: the Rust library, the CLI, MCP and the C library. Choose by host language and process model. A Rust program depends on peel-core directly. A native program links peel-ffi. Anything else runs peel and reads its JSON, or speaks MCP to peel mcp.

peel-core is not published to crates.io, and a Rust host takes it as a git dependency pinned to a commit. That is a packaging detail, not an architectural one, and the library page has the recipe.

The Mac app

The app is SwiftUI, with a Swift package, PeelKit, between it and the engine. PeelKit’s PeelClient runs the bundled peel command as a process and passes passwords on a pipe, never on the command line or in the environment. Most of the app’s work, extracting, listing and assessing, goes through that process.

Peel’s main window: drop archives here, or open one, with a list of recent archives.
Peel’s main window. The app runs the same engine, through the bundled peel command and the C library.

The extensions each reach the engine in their own way, because macOS gives each its own sandbox and bundle:

Client How it reaches peel-core
App The bundled peel command, as a process, with the password on a pipe.
Recovery window peel assess through the same command for the assessment. It reads a decrypted file through the C library, by way of the app’s private XPC service, which hands back an unlinked file descriptor.
Quick Look libpeel_ffi inside the extension, for listings capped in entries and time. Small native ZIP and tar readers go first for speed.
Spotlight importer libpeel_ffi.a linked in. It reads names only.
PeelFS libpeel_ffi, listing and reading one entry at a time.
Finder Sync Nothing. It hands off to the app.
Peel’s Recovery window for an AES-256 ZIP: recovery is uncertain, the encryption, a readable file list, four items, intact.
Peel’s Recovery window. The top card is the assessment from the bundled command, peel a -j.

An XPC service inside Peel.app is private to that bundle, so the extensions cannot share it. They link the engine in-process instead, which means several copies of one parser stack and no shared daemon.

What PeelFS does today. PeelFS is the FSKit file system that would present an archive as a read-only folder. It mounts only once macOS lets its extension switch stay on. Until then, opening an archive as a folder extracts it with the engine into a cache folder that Finder is pointed at. That path extracts everything, not one member at a time.

How a read flows

Take peel cat demo.zip project/README.md, which prints one file from inside an archive. The path through the engine is the same for any surface that reads one member:

  1. Name check. The requested member name goes through sanitize_entry_name. ../x fails here, with the invalid_name kind, before the archive is opened.
  2. Detect. detect_format decides what the file is, by its content. See below.
  3. Dispatch. The format picks an adapter: zip_entry for ZIP, tar_entry for the tar family, extract_entry_7z for 7z, and so on.
  4. Copy through the budget. The adapter streams the member through the ResourceBudget, which stops an entry that runs past its declared size, an expansion over 1000 times the archive, or a read over the cap. See safety.
  5. Return. The bytes go to memory, to a file, or, for the C library’s peel_read_member_fd, to an unlinked file returned as a descriptor.

Extraction is the same flow for many entries, with a staging folder around it and the destination checks added: safe_destination for each path, links created last, permissions cleaned, quarantine copied. The checks are in the engine, so the CLI, MCP and the app get them without asking.

Sessions

Opening an archive costs something, and reading many members one at a time would repeat it. A session opens the archive once and keeps what it learned. In Rust it is OpenArchive, over the C library it is the peel_session_* functions, and over MCP it is open_archive and close_archive.

A session notices when the file changes. It records the archive’s size and modification time, to the second, and a read after a change fails and the session must be opened again. A same-length rewrite within one second is missed. See the C library and MCP pages for the calls.

A read can also take a window, peel cat --offset N --length N. Its cost depends on the format: a compressed or solid member is decoded from its start, so a deep offset costs the read up to it. See performance.

Formats are detected by content

detect_format in crates/peel-core/src/detect.rs reads the first bytes of the file, not its name. A ZIP is PK, RAR is Rar!, 7z is its six-byte signature, and so on through squashfs, cpio, RPM, ar, PDF, CAB, xar and more. A file called report.dat that holds a ZIP is a ZIP:

peel probe report.dat | grep -E '^(path|format|entries)'; peel probe renamed.bin | grep -E '^(path|format|entries)'
path:       report.dat
format:     zip
entries:    11
path:       renamed.bin
format:     ZstdSingle
entries:    1
Real output from peel 1.4.0, recorded 2026-11-26.

The extension is a hint only where content cannot say enough:

Detection result and capabilities are separate. peel probe -j returns the format along with what each operation supports for it, so a host can check before it asks. The formats page lists them.

Where the safety checks sit

The checks are in the engine, below every surface, and each surface adds its own boundary on top:

Layer What it adds
peel-core Name sanitising, destination containment, links last, the resource budget, staging and cleanup, quarantine. Every adapter calls them.
peel command The 64 MiB single-member cap, exit codes per failure kind, passwords from a pipe.
peel mcp A root allow-list for writes and a protected-folder list, 16 open sessions, no overwriting by create.
C library The same error object as the CLI, and cancel tokens for the long calls.
App and extensions Sandboxes, and their own caps on listings and previews.

The last row is where the guarantee is weakest, and the safety page says so. Previews and mounts parse untrusted data with their own limits and are not covered by the extraction tests.

What this costs and buys

One engine means one set of formats and one set of checks, and a fix lands everywhere at once. The price is several in-process copies of the engine in the app’s extensions, and a Swift layer that talks to a process for most work, so a call from the app pays process start-up. The C library avoids that where a client links it, and sessions avoid the repeated open.