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.
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
Swift app (SwiftUI) Finder Sync, Quick Look, Spotlight, PeelFS
│ │
PeelKit client libpeel_ffi (C library)
│ │
peel command · peel mcp · peel-ffi · Rust API
│
peel-coreThe 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 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 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.
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:
- Name check. The requested member name goes through
sanitize_entry_name.../xfails here, with theinvalid_namekind, before the archive is opened. - Detect.
detect_formatdecides what the file is, by its content. See below. - Dispatch. The format picks an adapter:
zip_entryfor ZIP,tar_entryfor the tar family,extract_entry_7zfor 7z, and so on. - 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. - 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 ZIP keeps its file open and its central directory in memory.
- A multi-frame
.tar.zstor multi-block.tar.xzbuilds a table of its members on the first read, then reads each plain file from only the units that hold it. The source after 1.4.0 adds multi-block.tar.bz2and single-member.tar.gz. - Other formats keep the handle, the format, the password and change detection, but open the file again for each read.
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: 1peel 1.4.0, recorded 2026-11-26.The extension is a hint only where content cannot say enough:
- Some formats have no leading signature: disk images such as
.mdfand.nrg, cue sheets and Compact Pro. Each is recognised by its extension plus a check of its own layout. - ZIP is one container for many document types. The extension picks
the kind (
.epub,.docx,.cbzand the like), not whether the file is a ZIP. - A bare zstd, xz or bzip2 stream is decided by its signature, but
whether a tar is inside is decided by the name (
.tar.zst). The renamed file above is read as one zstd stream, not a tar. Gzip is the exception: Rind decodes the start and looks for a tar header.
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.