Introduction
Canon is a CLI tool for organizing large collections of files (photos, music, documents) scattered across old hard drives, backup directories, cloud downloads, and phone exports. It indexes files across any number of locations, identifies content by hash regardless of name or path, and lets you query and filter everything with metadata. When you’re ready, it archives what matters and excludes what is not worth keeping, both on the record. Storage that holds nothing unresolved can be retired: its complete story stays readable, in plain text, after the storage is gone.
The Problem
Files accumulate over years and across devices, and the scale makes it hard to even start. Manual approaches are risky: one wrong move and something irreplaceable could be gone.
The Approach
Canon works incrementally:
- Scan directories to index files and compute content hashes
- Enrich with metadata extracted by external tools (EXIF, file types, etc.)
- Orient: explore with filters and queries, survey a location (what’s archived, where it connects, what’s unique), or sweep all roots for the places where one action resolves the most
- Archive selected files to a canonical location, at your own pace
- Resolve the rest: exclude what is not worth keeping, and retire storage once everything on it is archived or excluded
Each step is revisitable, and Canon tracks what’s already archived.
Scanning and querying never modify or move your files.
To get started, see Setup and Getting Started.
Setup
Installation
Install Canon from crates.io:
cargo install canon-archive
This installs the canon binary.
From Source
Alternatively, build from source:
git clone https://github.com/robklg/canon.git
cd canon
cargo install --path .
Canon Home Directory
Canon stores all state in a single directory called the canon home. The default location is ~/.canon/.
It contains:
| File | Purpose |
|---|---|
canon.db | SQLite database (roots, sources, objects, facts) |
aliases.toml | Filter aliases (optional — see Aliases) |
config.toml | Ledger settings (see Recording Modes) |
The directory is created automatically on first use.
Overriding the Location
You can relocate canon home with the CANON_HOME environment variable or the --canon-home flag:
# Via environment variable
export CANON_HOME=/mnt/archive/.canon
canon scan --add --role source /photos
# Via flag
canon --canon-home /tmp/test-canon scan --add --role source /photos
Precedence: --canon-home flag > CANON_HOME env var > ~/.canon/
Verify Installation
canon --version
canon --help
Continue with Getting Started.
Getting Started
A typical Canon workflow, from scanning to resolving what remains.
Scanning
First, index your source files and existing archive:
# Add source roots (files you want to organize)
canon scan --add --role source /path/to/photos
canon scan --add --role source /path/to/backup-drive/photos
canon scan --add --role source --comment "Old backup, possibly duplicates" /Volumes/OldDrive
# Add an archive root (your organized destination)
canon scan --add --role archive /Volumes/Archive
By default, Canon computes content hashes during scanning.
Enriching
Use external tools to extract metadata. The example below uses exiftool to extract EXIF data including GPS-based geolocation:
canon worklist --where 'source.ext|lowercase IN (jpg, jpeg, heic, mov, mp4)' \
| ./scripts/exif-worklist.sh \
| canon import-facts
See Enriching for details on the worklist/import pipeline.
Querying
Discover what facts are available and explore your files:
# See all available facts
canon facts
# Check value distribution for a specific fact
canon facts --key content.geo.region # Where were photos taken?
canon facts --key "content.DateTimeOriginal|year" # Which years?
# List files matching filters
canon ls --where 'content.geo.city=Bletchley'
# Preview files (macOS)
canon ls -0 --where 'content.geo.city=Bletchley' | xargs -0 open -a Preview
Orienting
Survey a location to see how it relates to everything else you’ve indexed:
canon survey /Volumes/OldDrive/photos
Sweep ranks the places where one action resolves the most:
canon sweep
See survey and sweep for reading the output.
Archiving
When you find a collection worth archiving, create a manifest:
canon cluster generate \
--where 'content.DateTimeOriginal|year=2023' \
--where 'content.geo.region="North Holland"' \
--dest /Volumes/Archive/Trips/2023-Amsterdam
This creates manifest.toml with the query parameters and a manifest.lock with matching sources.
Edit manifest.toml to customize the output pattern:
[output]
pattern = "{content.DateTimeOriginal|date}/{filename}"
base_dir = "Trips/2023-Amsterdam"
Preview and apply:
canon apply manifest.toml --dry-run # Preview what will happen
canon apply manifest.toml # Execute the copy
Files are copied to the archive with paths like:
/Volumes/Archive/Trips/2023-Amsterdam/2023-06-16/IMG_001.jpg
Resolving
Content that isn’t worth keeping is excluded rather than deleted: nothing is destroyed, and the action is recorded.
# This directory's content is verified in the archive; dismiss the redundant copies
canon exclude set /Volumes/OldDrive/photos --reason "verified archived, originals redundant"
Read a place’s history back at any time:
canon trail /Volumes/OldDrive/photos
When everything on a root is archived or excluded, retire it: its complete story is bound into a plain-text book at the archive, and the storage is free to go.
Next Steps
- Learn about Concepts to understand how Canon models your files
- Explore the full Commands reference
- See Filters for advanced query syntax
Concepts
The core concepts the rest of the book builds on:
- Roots: Storage locations that Canon tracks
- Sources and Objects: Files on disk and the content they hold
- Facts: Metadata attached to sources or objects
- Exclusion: Dismissing content from consideration, reversibly
- Resolution: The goal of the work, and the standings on the way there
- Decision Provenance: How Canon records what you did, to what, and why
- Retirement, the Book, and the Shelf: How a resolved root leaves the index
Roots
A root is a directory on a storage device that Canon tracks. Each root is identified by its absolute path and assigned a role.
Roles
Source roots: assets you want to explore, reconcile, or archive, possibly unstructured, incomplete, or holding duplicates. Examples: old backup drives, phone exports, download directories.
Archive roots: an intentional structure that you maintain, where archived files go. Examples: your organized photo library, music collection, document archive.
Rules
- Roots may not overlap (one root cannot be inside another), suspended roots included
- You can have multiple roots of each type
Typical Setup
Source roots:
/Volumes/OldBackup (unorganized photos from 2015)
/Volumes/PhoneExport (recent phone backup)
~/Downloads/Photos (miscellaneous downloads)
Archive roots:
/Volumes/Archive/Photos (canonical photo library)
/Volumes/Archive/Music (canonical music library)
Offline Access
Commands that read the index work with the storage detached. scan and apply need it online.
Suspended roots
Suspending a root takes it out of view, and Canon does nothing on it until you unsuspend it. It says nothing about whether the storage is attached.
- Standing: unchanged. Its sources stay indexed.
- Reports: a report on a suspended place lists nothing and says it is suspended. A report across all roots leaves the root out.
- Actions: an action that names a suspended place is rejected by name and writes nothing.
- Records: the trail, the story, notes and books can still be read.
- Evidence: its copies still count. Content that also sits in a suspended archive root counts as archived.
- Content: facts and exclusions belong to the content, so acting on content from a live root reaches its copies on suspended roots.
canon roots shows what each command does.
Sources and Objects
A source is a file on disk, at one root and relative path. An object is content, identified by its SHA-256 hash. Two files with identical bytes have the same hash and share one object, wherever they are found.
Source A: /backup1/photos/IMG_001.jpg ─┐
Source B: /backup2/old/IMG_001.jpg ─┼─► Object (hash: abc123...)
Source C: /downloads/photo.jpg ─┘
For each source Canon tracks:
- Location: Root path + relative path within the root
- Identity: Device ID and inode for move detection
- Metadata: Size and modification time
- Integrity: Partial hash (first + last 8KB) for validation during transfers
- State: A
basis_revcounter that increments when size or mtime changes
Hashing, by default part of scanning, links a source to its object. Objects enable:
- Deduplication: Multiple sources can point to the same object
- Archive tracking: When content exists in an archive, all sources with that hash count as archived
- Fact sharing: A content fact stored on the object is available on all sources with that content
Unhashed sources cannot be linked to objects, so they cannot be deduplicated or tracked for archive coverage.
Empty files are contentless
A zero-byte file has no content, so Canon treats its source as contentless. Every empty file shares the one empty-content object, so its hash identifies nothing.
- In counts: never covered, archived or unresolved, and never a block on retirement.
- As a file: ordinary.
lsfinds it, it can be excluded, and archive operations take it along with its directory, so a verbatim directory copy keeps its empty files.
Facts
Facts are key-value metadata attached to sources or objects.
Types of Facts
Source facts (source.*) are about a source itself, recorded by the scanner. Every source has the same fixed set, and they are never imported or deleted:
source.ext- File extensionsource.size- File size in bytessource.mtime- The file’s save timesource.path,source.rel_path- Where the file is
Content facts (content.*) are about a source’s content. External tools import them via the enrichment pipeline, and Canon records the content hash when it hashes a file:
- Content hash:
content.hash.sha256 - EXIF metadata:
content.Make,content.Model,content.DateTimeOriginal - Geolocation:
content.geo.city,content.geo.country - Media info:
content.mime,content.duration - Any custom key-value pairs you choose to import
Built-in keys (filename, size, hash, …) are short names for values used often, neither source facts nor content facts. Some have the same value as a source fact: size has the same value as source.size. See Source Facts and Built-in Keys for the full lists.
Reading a Key’s Name
A plain name means a content fact, in a filter, a report key and a pattern alike:
- A plain name: the content fact.
--where 'Make=Apple'selects the same sources as--where 'content.Make=Apple', and{Make}givesApple. - The name of a built-in key: that key, such as
filenameorid.{size}gives the file’s size,3. - A full name: that fact.
{content.size}givesbig, for a content fact imported under the namesize.
A source has one value for each key. A content fact can be stored on the source as well as on its content; filters, canon facts, patterns and canon worklist all use the fact stored on the content, and the one stored on the source only where the content has none.
Value Types
A fact has one of four types:
- Text: Strings like
Appleorimage/jpeg - Numbers: Integers or decimals like
1024or3.14 - Times: Points or spans of time on one timeline, like a capture date or a save time. See Times below
- Paths:
source.pathandsource.rel_path. Path accessors select parts of a path
A key’s type is determined from all of its facts, on every root, so it is the same whatever the scope. See Values and Types for how a value you type is interpreted as the key’s type, and for keys of mixed type.
Import can include type hints. See Enriching.
Times
How Canon shows a time
Canon shows times in your local time: the zone TZ names, or else the zone the machine is set to. A manifest uses the time zone it records instead. Times show with no offset, at their precision:
| Precision | Shows |
|---|---|
| year | 2024 |
| month | 2024-06 |
| day | 2024-06-15 |
| minute | 2024-06-15 14:30 |
| second | 2024-06-15 14:30:05 |
How Canon interprets a time
| Written as | Example | Stored as |
|---|---|---|
| A date and time with an offset | 2024-06-15T14:30:00+02:00, 2024-06-15T12:30:00Z | an instant, with its offset kept; Z and +00:00 both mean UTC |
| A date and time with no offset | 2024-06-15 14:30:00, 2024-06-15T14:30:00, 2024:06:15 14:30:00 | a time with no offset |
| A date, month or year alone | 2024-06-15, 2024:06:15, 2024-06, 2024 | a time with no offset |
See Times for the spellings in full.
A recorded offset is kept, and is not used when the value is shown or compared. For someone whose time zone is Europe/Amsterdam:
| Written as | Shows |
|---|---|
2023-12-31T21:00:00-05:00 | 2024-01-01 03:00:00 |
2023-12-31T23:30:00Z | 2024-01-01 00:30:00 |
2023:12:31 21:00:00 | 2023-12-31 21:00:00 |
2024 | 2024 |
2024-06-15T14:30:05.45+02:00 | 2024-06-15 14:30:05 |
Precision
A time keeps the precision it was written at, and is never padded: 2024 is the year 2024, not its first second.
Save times
source.mtime is a file’s save time as the file system reports it: an instant, to the second, with no recorded offset.
Exclusion
Excluding dismisses content from consideration: it does not need archiving. Nothing
is deleted. The files stay on disk and in the index. Excluded sources are skipped by
default in queries and archiving operations, and --include excluded shows them again.
An exclusion can be cleared at any time, returning the content to consideration.
Clearing is itself recorded, as the restored transition. Nothing else lifts a
dismissal: the exclusion holds through edits, moves, replacement, and a file
reappearing after an absence.
Two levels
- Source-level: dismisses a file at its path. Other copies of the same content are unaffected.
- Object-level: dismisses content by hash, for every source sharing that content, in source roots and archive roots alike, and any copy scanned later.
A source counts as excluded when either level applies: it is excluded itself, or its content is.
The record
Every exclusion is recorded as a decision with your optional
--reason, one of the three recorded fates beside archived and deleted.
See canon exclude for the command.
Resolution
Everything Canon indexes, across all your roots, is your universe. Resolving it is the goal of the work: deciding, for all of it, that content worth keeping is archived and content not worth keeping is excluded. The universe shrinks from both directions, and what remains is the work still to do.
Coverage is evidence
Covered content is verified present in the archive by content identity: the same hash exists at an archive root. Coverage is a precise claim about content and nothing more. It does not say the archive copy is arranged the way you want, and it does not say you chose it; content can be covered by a copy nobody put there on purpose.
The judgment that content is resolved stays yours: Canon states what it can verify.
Standings
A present source is in exactly one standing:
- excluded: consciously dismissed (see Exclusion)
- contentless: empty, nothing for content identity to verify (see empty files are contentless)
- archived from here: the original, still here, of content copied to the archive
- covered: content verified present in the archive, though not archived from here
- unresolved: none of the above; no resolution evidence
When several could apply, the earlier in this list wins. A source that was never hashed counts as unresolved.
The verdict is asymmetric
Canon can prove content unresolved: present, no coverage evidence, not excluded. It never certifies the opposite. The retirement review says NOT READY while unresolved sources remain; when nothing blocks, it reports that no blockers were found and leaves the verdict to you.
Decision Provenance
A decision is Canon’s record of an effectful action, kept in two artifacts:
- Record: a queryable row in Canon’s database: what happened, when, optionally why
- Receipt: a durable TOML file on disk with the per-item detail: every file the action touched, with its content hash, size, and modification time
A file archived, excluded or deleted can be traced back to the action that put it in that state, from the files alone.
What Gets Recorded
These commands write a decision record:
| Command | What it records |
|---|---|
scan | Directory indexing; files gone missing (deletion) |
apply | File archiving |
exclude set/clear/duplicates | Source triage |
exclude set-object/clear-object | Object-level triage |
cluster generate/refresh | Manifest creation |
roots rm/suspend/unsuspend | Structural changes |
roots retire | Retirement |
import-facts | Enrichment |
prune | Data cleanup |
facts delete | Fact removal |
facts convert | A key’s change of type |
note clear | Note deletion |
What a Record Contains
- Command: stable identifier (e.g.,
exclude_set,apply) - Scope: paths the command operated on
- Command line: the full command as typed
- Reason: optional user annotation (via
--reason) - Status:
started,completed,partial,interrupted, orrefused - Counts: attempted, completed, failed, skipped
- Summary: the completion message you saw
- Canon version: which version produced the record
- Timestamp: when the command started
- Time zone: the time zone the command used for times
The time zone a decision uses
A decision records the time zone its command used for times: your time zone when it ran, or, for cluster generate, cluster refresh and apply, the zone the manifest records (the manifest’s time zone). trail show shows it as time zone:, and a receipt has it as zone in [meta].
Transitions
A transition is the change in a source’s standing that an action made or observed: archived, excluded, restored (an exclusion undone) or deleted. Receipts and canon trail use the same words.
Two-Phase Recording
- Start: A “started” record is written after you confirm (or just before execution for commands without confirmation)
- Complete: The record is updated with the outcome after execution finishes
A run that a pre-flight check stops before anything is touched records refused. One cut short after work began records interrupted or partial.
A row left started means its outcome was never written: the run was killed or crashed, or the write failed.
Receipts
Receipts live in a .canon-ledger/ directory under a root, each named for its decision’s id:
.canon-ledger/000042-exclude_set.toml
.canon-ledger/Media/2016/000041-apply.toml
.canon-ledger/000043-scan.toml
A receipt sits where the action took effect:
- Apply: mirrors the destination path under the archive root’s
.canon-ledger/ - Exclusion: in the archive ledger root’s
.canon-ledger/ - Deletion: in the
.canon-ledger/of the source root where the files were lost.
Anatomy of a receipt
Every receipt’s [meta] block states what happened, to what, and where:
[meta]
receipt_version = 1
decision_id = 142
command = "scan"
transition = "deleted"
posture = "observed"
status = "completed"
# ...summary, canon_version, command_line...
zone = "Europe/Amsterdam"
[meta.locus]
path = "/mnt/old-drive/photos"
id = 3
transition: see Transitionsposture:observedfor a scan-detected deletion,performedfor every other receipt[meta.locus]: the root holding the receipt: itspathwhen the receipt was written, and its databaseidzone: the time zone the decision recordsorigin_disposition: apply receipts only:retained(a copy) orrelocated(a move)
The provenance chain
Every source carries a decision_id, naming the action that last changed its state. When an action changes a file an earlier one touched, the receipt records the earlier decision as previous_decision_id. Because that id is also its receipt’s filename, you can walk the chain backwards from the files on disk alone.
Recording Modes
What Canon writes is controlled by ledger.recording in $CANON_HOME/config.toml:
| Mode | Database record | Receipt file |
|---|---|---|
Full (default) | ✓ | ✓ |
Records | ✓ | — |
Off | — | — |
ledger.layout controls where apply receipts sit: Central (default) collects them under the archive root’s .canon-ledger/; Alongside places them in a .canon-ledger/ beside each destination directory.
[ledger]
recording = "Full" # Full | Records | Off
layout = "Central" # Central | Alongside
With no archive root, an exclusion is recorded without a receipt.
Annotating Decisions with --reason
A short reason for an action:
canon exclude set --where 'source.ext=dll' --reason "OS system files, no personal value"
canon apply manifest.toml --reason "Italy 2016 — assembled from three drives"
canon scan /mnt/old-laptop --reason "Deleted duplicate movies, originals confirmed in archive"
--reason is available on: exclude set, exclude clear, exclude duplicates, exclude set-object, apply, scan, roots rm, roots retire, roots suspend, roots unsuspend, facts convert.
The reason is written into the decision record and into the receipt’s [meta] when there is one.
For apply, manifest notes (from the # === Notes === section) become the reason when --reason is not given.
Suppressing Receipts with --no-receipt
To record a decision in the database but skip the receipt file for a single invocation:
canon exclude set --where 'source.ext=dll' --no-receipt
To turn recording off entirely, set recording = "Off" in config.toml.
When Recording Does Not Happen
Nothing is recorded on a --dry-run, on a declined confirmation, or under recording = "Off".
Reading the Trail
canon trail shows the record.
The Extraction Ledger — the Trail’s Outbound Direction
The extraction ledger is the index of what each apply transferred out of each source root: files, bytes, and whether the originals remain. Per-item detail stays in the apply receipt. A row stays readable after its source root is removed. canon trail reads it to show what went out.
Disk is truth, the database is a rebuildable index
The database is an index over the receipts. canon ledger reindex rebuilds the extraction ledger from the apply receipts on disk. A decision with no receipt cannot be recovered.
The Composition Card — State, Not Events
The composition card appears at the bottom of a canon trail of one place (see Reading the Trail). It says what the place is made of now, based on the surviving sources. Origin, on the card, means the source root an apply took the content from.
Crossing In, Crossing Out, Staying Put
An action has two ends: where content came from, and where it ended up. A place may put a boundary between them:
| Origin | Destination | Seen from this place |
|---|---|---|
| inside | outside | left — content was archived out of here |
| outside | inside | arrived — content came in |
| inside | inside | rearranged — content was transferred, but crossed nothing |
Standing at an archive root, a curation pass shows as a rearrangement; standing in the destination directory, the same pass shows as an arrival. In any one place, no file is counted twice.
A transfer across the boundary of a place is a crossing. canon trail crossings shows them.
A crossing relates two places by what was transferred between them. The sweep’s counterpart relates them by where matching content stands.
Retirement, the Book, and the Shelf
Canon’s goal for old storage is getting it out of your life. Working through a root resolves what’s on it; retirement closes it out so the storage can go.
Retiring binds the root’s story into a book kept on the shelf: plain text, readable without Canon, without the database, and without the storage it came from. An old drive is usually hard to discard because you can’t say what’s on it any more. The book answers that after it’s gone.
Retirement
Retiring a root means this root is resolved and its index may be removed.
What counts as resolved is your judgment (the verdict is
asymmetric). --allow unresolved retires
despite a NOT READY verdict, on the record.
canon roots story shows the map of a root’s places
at any point in the triage, and records nothing.
Discarding the storage is yours to do.
canon roots retire runs four steps: the readiness
review, the bind, an inspection window, and the release of the index.
If you don’t want a book, canon roots rm deletes the
root’s index outright. Retiring needs a registered archive root because the book
needs a shelf.
The book
The book is the bound story of a retired root: what was on it, and the fate of
every file. It is a directory of plain text. Open its README.md and start reading.
The book’s contents and format are a public, Canon-independent contract. See the book format.
The shelf
The shelf is the retired/ directory at your archive’s ledger root, where the
books are kept.
canon roots retired lists what’s on it. Keep the shelf with your archive. Deleting
a book deletes the only readable story of a root that is already gone.
What survives what
- Retirement: removes the index only. The root’s sources, facts, and notes are deleted from the database. The complete per-file story is bound in the book.
roots rm: binds nothing. The decisions stay in the trail, and the archive’s own ledger keeps its per-file apply and exclusion receipts, but the notes are deleted, content no action touched leaves no record, and the storage’s deletion receipts stay on the storage, discarded with it.- Receipts: the root’s own receipts are gathered into the book. Receipts at the archive (apply, exclusion) stay in the archive’s ledger.
Canon Commands
Common Options
Most commands that operate on sources share these options:
Path scope: Limit a command to a specific directory by passing a path:
canon ls /path/to/photos
canon facts /path/to/photos
canon coverage /path/to/photos
When no paths are given, a command scopes to the current directory if it is inside a known root, and otherwise operates across all roots. Use --global to operate across all roots while inside one.
Filters: Select sources using --where with boolean expressions:
canon ls --where 'source.ext=jpg'
canon facts --where 'source.size > 1000000'
canon cluster generate --where 'geo.country=Netherlands' --dest /archive
Multiple --where flags are combined with AND. See Filters for the full syntax.
--include: By default, query commands (ls, facts, coverage, worklist) show sources from active source roots, hiding excluded and archived sources. Use --include to expand what you see:
canon ls --include excluded # Also show excluded sources
canon ls --include archived # Also show sources from archive roots
canon facts --include all # Show everything
compare always compares both directories, on source roots and archive roots alike. It hides excluded sources only, and its --include accepts excluded.
--allow: Commands that change state (cluster generate, apply, import-facts) skip certain sources by default (e.g., sources already in an archive). Use --allow to acknowledge you want to include them:
canon cluster generate --allow archived --dest /archive # Include sources from archive roots
canon cluster generate --allow duplicates --dest /archive # Include content already archived elsewhere
canon import-facts --allow archived # Import facts for archive sources
The available --allow values are specific to each command.
Managing Roots
Adding, listing and retiring roots:
scan: add a new root, or re-scan an existing oneroots: list, suspend, comment on or remove rootsroots story: a root’s resolution storyroots retire: bind that story into a book and release the root from the index
Scan
Index directories or single files into a root: a directory is walked, and a named file is scanned on its own. By default new and changed files are hashed.
A root’s role is set when it is added. To change it, remove the root and add it again with the new role; Removing Roots says what happens to the earlier root’s records.
When to run scan
Re-scan a root after its contents change.
--verify recomputes hashes for all files, even unchanged ones, and exits non-zero if a file’s hash changed without its mtime changing, so it suits cron jobs that alert on failure.
Examples
# Add a new root and scan it (--add and --role required for new roots)
canon scan --add --role source /path/to/photos
# Scan multiple new roots
canon scan --add --role source /path/to/photos /path/to/more/photos
# Add with a descriptive comment
canon scan --add --role source --comment "Photos from 2020 trip" /path/to/photos
# Add as an archive root (for tracking already-organized files)
canon scan --add --role archive /path/to/archive
# Re-scan an existing root (--role optional, validated against existing)
canon scan /path/to/photos
# Re-scan all roots, or all roots of one role
canon scan --all
canon scan --all --role archive
# Scan just a subtree within an existing root
canon scan /path/to/photos/2024
# Scan a single file within an existing root
canon scan /path/to/photos/2024/img_0042.jpg
# Scan without computing hashes (just index files)
canon scan --no-hash /path/to/photos
# Verify archive integrity by recomputing all hashes (good for cron jobs)
canon scan --verify /Volumes/Archive
# Disable mount protection, when device IDs change between scans (e.g., NAS remounts)
canon scan --ignore-device-id /Volumes/NAS
# Mark sources under a deleted directory as not present
canon scan --missing /path/to/deleted/directory
Hash computation: --no-hash indexes files without hashing, for speed or to hash only certain kinds of files.
Discovering untracked directories: --candidates finds directories with files that aren’t yet under any root:
# Find candidate roots to add under a path
canon scan --candidates /Volumes/Backup
Candidate roots to add:
/Volumes/Backup/photos (3 directories with files)
/Volumes/Backup/imports (1 directory with files)
Single files: Nothing else under the root is looked at. A named file that is gone is skipped with a warning, never recorded as deleted.
Reading the summary
Scanned 1234 files: 100 new, 5 updated, 2 moved, 1127 unchanged, 0 missing
Hashed 105 files
| Clause | Meaning |
|---|---|
new | Paths not in the index before |
updated | Files whose content changed at a path already indexed |
moved | Files found at a new path, with matching content and the old path confirmed gone. Otherwise the file counts as new and the old path as missing |
missing | Indexed paths gone from disk |
27753 new (27751 hardlink companions of already-indexed files) | Each hardlink path is its own source |
2 possible moves could not be verified | The old path could not be checked. The files count as new |
3 skipped (read errors) | Files that could not be read, see Deletions |
skipped 214 symlinks, skipped 3 special files | Only regular files become sources. Symlinks are never followed |
Hash debt
Coverage, duplicate detection, and cluster selection skip sources with no content hash.
Scanned 4820 files: 4820 new, 0 updated, 0 moved, 0 unchanged, 0 missing
4820 sources remain unhashed
The next scan that hashes reads them, and counts them as backlog:
Scanned 4820 files: 0 new, 0 updated, 0 moved, 4820 unchanged, 0 missing
Hashed 4820 files (4820 from backlog)
Hashing can be interrupted: the next scan continues from there.
Moves
Canon follows files that move within or between roots, provided it sees the destination:
# Index where the files are now
canon scan /Volumes/Photos
# Reorganize on disk
mv /Volumes/Photos/inbox/trip /Volumes/Photos/2024/trip
# Scan again: the sources keep their history at the new paths
canon scan /Volumes/Photos
Scanning the destination is enough, also for a move between roots.
A file edited and moved in the same step is reported as new plus missing.
Deletions
Use --missing to record that a path is gone without re-scanning its parent:
# Deleted a backup directory: mark its 140 sources as not present
canon scan --missing /Volumes/Backup/old-phone
# Works with any path under a known root, including the root itself
canon scan --missing /Volumes/Backup
The sources are marked as not present but remain in the database with their hashes and metadata intact. If the path reappears later, a scan marks them present again.
A scan never concludes a file was deleted just because it could not read it. The source keeps its record, and the summary counts it as skipped (read errors).
A deletion, inferred by a scan or marked with --missing, is recorded as a decision with a source-local receipt, even when no archive root exists:
canon scan --missing /Volumes/Backup/old-phone \
--reason "Phone backed up to archive, originals confirmed"
canon roots
List and manage registered roots.
Roots are added via scan.
# List all roots with file counts and last scan time
canon roots
# List roots at or beneath a specific path
canon roots /path/to/photos
# List only suspended roots
canon roots --suspended
# Set a comment on a root (omit text to clear)
canon roots comment id:1 "Old backup, possibly duplicates"
canon roots comment id:1
# Suspend a root (out of view and not acted on, until you unsuspend)
canon roots suspend id:1
canon roots suspend path:/path/to/photos
# Unsuspend a root
canon roots unsuspend id:1
# Remove a root by ID (files on disk are NOT deleted)
canon roots rm id:1
# Remove a root by path
canon roots rm path:/path/to/photos
# Skip confirmation prompt
canon roots rm id:1 --yes
Example output:
ID ROLE FILES LAST SCAN PATH
1 source 16635 2h ago /path/to/photos
2 archive 169941 5d ago /path/to/archive
3 source 1234 never /path/to/backup (Old backup, possibly duplicates)
Suspending Roots
See Suspended roots for what suspension is. A suspended root is hidden from canon roots (use --suspended to list only suspended roots) and skipped by scan --all. When canon roots finds only suspended roots, it lists each one as suspended:
/path/to/photos suspended · canon roots unsuspend path:/path/to/photos
A report on a suspended place says so:
/path/to/photos suspended — set aside: here · canon roots unsuspend path:/path/to/photos or --global
With nothing else to list, the exit code is 1. An action shows the same sentence with rejected in place of set aside. A command that reads what Canon recorded says so once in its header:
Decision trail: /path/to/photos — /path/to/photos suspended · canon roots unsuspend path:/path/to/photos
| Commands | At a suspended place |
|---|---|
ls, worklist, facts, coverage, survey | Set aside. A live path named beside it still runs |
sweep | Leaves its places out of the ranking and says so in a footer |
exclude, cluster generate and refresh, apply at either end, facts delete, note -m and --clear, scan, roots rm, roots retire, compare, survey --other | Rejected by name before any plan or confirmation, so --yes and --dry-run state it too. Nothing is written |
trail, roots story, note, roots retire --dry-run | Work as usual, and say the root is suspended |
import-facts | Sets aside the records naming a suspended source and counts them in its summary |
exclude set-object, facts delete --on object | Reach every copy of the content, and state how many are on suspended roots |
prune | Skips suspended roots |
Removing Roots
Removing a root removes its sources, facts, and notes from the database, and deletes no files on disk. Adding the path again makes a new root: its story starts empty, and its sources need enriching again. The earlier root’s decisions stay in the trail, shown by canon trail --global --all or a date view, but not by naming the path. See what survives removal.
Removal is recorded as a decision; add --reason to say why the root is going.
Root Specs
Several commands accept root specifications in two formats:
| Format | Example | Description |
|---|---|---|
id:N | id:1 | By database ID (shown in canon roots output) |
path:/... | path:/path/to/photos | By exact path |
canon roots story
A root’s resolution story as a map of places: where you acted and why, and what no action ever touched.
canon roots story <id:N|path:/path> [--limit N | --all]
The map of places
Story: /mnt/old-disk
role source
comment old laptop backup, 2014–2016
first indexed 2026-03-14
last scan 2026-07-28 (5d ago)
The places
(root)
archived 5 files, 130.0 KB → /archive/exports/old-disk #66 · "final export before the disk goes"
→ canon trail /mnt/old-disk
pictures
archived 4,102 files, 61.0 GB → /archive/media/rest #51 · "rest of the pictures, mechanical"
→ canon trail /mnt/old-disk/pictures
pictures/italy
archived 640 files, 18.4 GB → /archive/media/2016-italy #42 · "the Italy trip"
archived 3 files, 2.1 MB → /archive/exports/old-disk/pictures/italy #66
→ canon trail /mnt/old-disk/pictures/italy
minecraft-worlds
no decision here
3,412 covered — copies stand in /archive/staging-2019 (3,401), /archive/games (11)
→ canon trail /mnt/old-disk/minecraft-worlds
system-cache · across 214 folders
excluded 12,006 files, 1.2 GB #58
→ canon trail /mnt/old-disk/system-cache
downloads · across 61 folders
excluded 4,890 files across 3 decisions
· "installer junk" #57, #61
· #63 — no reason given
deleted 1,204 files (scan-observed) #64
35 unresolved (19 never hashed — cannot be content-verified)
→ canon trail /mnt/old-disk/downloads
Standing: 20,911 sources — 3,980 covered · 16,896 excluded · 35 unresolved (19 never hashed)
Whether this story is complete is yours to judge.
For the readiness gate: canon roots retire path:/mnt/old-disk --dry-run
Reading a place
Lines starting with a transition: the
actions at this place. A deletion a scan observed is marked scan-observed.
One action at several places: partial counts at each, none of them the action’s
total. #66 above is two such lines.
Other lines: what is there now, whether or not an action touched it:
| Line | Meaning |
|---|---|
covered | content verified present in the archive; copies stand in says where |
archived from here | the original, still here, of content copied to the archive |
excluded | shown when the lines above don’t already say it |
unresolved | neither archived nor excluded; any never-hashed count is called out |
empty files (no content to cover) | contentless, outside coverage, never blocking retirement |
→ always means sent there by your action. copies stand in always means observed there
today.
Why some directories aren’t listed
Only some directories get a line. The rest merge into the nearest listed place, and
· across 214 folders shows how many that covers. A directory gets a line when:
- It differs from its surroundings: in standings, actions or covered-copy locations
- It has a note
- It has an action you gave a reason
A place with no files, action or note of its own, whose content all lies in one directory below it, is shown at that directory instead.
The gate
The story gives no verdict. For that, run
canon roots retire --dry-run.
Flags
--limit N: cap the number of place lines (default 50). Omissions are counted.--all: every place line.
Requirements
- The target is a source root. An archive root’s places are served by
canon trailand its composition card. - For a suspended or unreachable root, the story shows what Canon last observed there, and the header says so.
canon roots retire
Retirement compiles a root’s whole story into a book on the shelf, then removes the root from the index. Four steps: the readiness review, the bind (compile, verify, move to the shelf), the inspection window, and the release. A confirmation comes before anything is written, and another before anything is removed.
canon roots retire <id:N|path:/path> [--dry-run] [--allow unresolved] [--reason <text>] [--yes]
At every failure point, either the root is fully intact or the book is fully on the shelf. Never both partial. The root cannot be removed until the book has passed verification and is on the shelf.
The readiness review
The root’s whole story in counts:
Retirement review: /mnt/photos-backup
role source
comment old laptop backup, 2014–2016
suspended no
first indexed 2026-03-14
last scan 2026-07-28 (5d ago)
Resolution account
ever indexed here 14,215 sources
the story so far
archived from here 9,847 files, 214.6 GB (6,102 moved, 3,745 copied)
deleted 3,891 sources (scan-observed)
missing, unexplained 12 sources
standing here now 4,210 sources
archived from here 3,745 (this copy still stands; the archive holds it)
covered 235 (content verified present in the archive)
excluded 195
unresolved 35 (19 unhashed — listed by name only)
Facts to weigh
12 sources are missing without a recorded deletion.
19 present sources were never hashed — they cannot be content-verified.
2 cluster-generate decisions on this root have no subsequent apply — possible open intentions.
NOT READY for retirement — 35 sources are neither archived nor excluded.
To retire anyway: canon roots retire path:/mnt/photos-backup --allow unresolved
To read the story behind these counts: canon roots story path:/mnt/photos-backup
the story so far: whole-history eventsstanding here now: the sources presently there, in their standings
The two do not reconcile: a file copied to the archive appears in both.
Facts to weigh never block retirement.
The verdict is asymmetric
See the verdict. When nothing blocks, Canon reports “No blockers found. Whether this story is complete is yours to judge.”
Binding the book
After the review, Canon names where the book will go, retired/<name>-<date>/ on the
shelf at the archive ledger root, and asks the first confirmation. On yes:
- The story is composed for the book (see the book format) and offered once to your editor.
- The book is compiled into a temporary directory, with the story as
story.md. - The compile is verified.
- The verified book is moved to the shelf.
The book is at /archive/retired/photos-backup-2026-08-02
14,215 entries bound; 41 receipts gathered
story.md — the story as told
The story and your foreword
Before the compile, Canon asks once:
Edit the story before it is written into the book? [y/N]
Yes opens $VISUAL/$EDITOR on the composed page, with a Foreword section for your
words. The book shows your foreword above Canon’s narration. If you leave that section
as it is, it drops out of the book. If you do not edit the page, the story is bound as
Canon composed it.
The release
Between the two confirmations is an inspection window: the verified book is on the shelf, and the root is untouched. Then:
Remove the root from the index? Aborting keeps both the root and the book.
- Aborting: the root stays indexed and the book stays on the shelf. A re-run the same day replaces that book, and any edits you made to it are lost. A re-run on a later day binds a new book beside it; the date in each book’s name tells them apart, and the earlier one is yours to remove.
- Confirming: the root’s sources, facts and notes are removed in one transaction.
If anything changed on the root since the review, the release stops with root and book intact, and asks to be re-run.
Retired /mnt/photos-backup: 14,215 sources released; the story is bound at /archive/retired/photos-backup-2026-08-02
The storage is yours to discard.
canon trail keeps
showing the retired root’s history.
The shelf listing
canon roots retired lists the books on the shelf:
The retired fleet: 2 books on the shelf (/Volumes/Archive/retired)
2026-08-02 /Volumes/Backup/icloud-export — 3,980 entries → icloud-export-2026-08-02
2026-09-14 /Volumes/old-laptop — 12,404 entries → old-laptop-2026-09-14 · "sold it"
Identification is not verification: the listing reads each book’s meta.toml
identity and counts, nothing more.
The books of two roots retired from the same path show the same path. To tell them apart,
give each root a comment, or each retirement a --reason.
Flags
--dry-run: the review only; always exits 0.--allow unresolved: retire despite unresolved sources. Without it, a NOT READY verdict ends the run with a non-zero exit. Never implied by--yes.--reason <text>: recorded with the decision and on the book’s identity page.--yes: skips both confirmations.
Requirements
- The target must be a source root.
- An archive root must be registered. Removing a root without binding its story
remains available as
canon roots rm. - An unreachable root can be retired: the story is bound from what Canon last observed there.
- A suspended root is not retired until you unsuspend it.
--dry-runstill shows the review.
Enriching
External processors add metadata to indexed files.
worklist outputs sources as JSONL, a processor extracts metadata, and import-facts stores it.
canon worklist → processor → canon import-facts
A processor can be any CLI tool or script that extracts information from files: exiftool for EXIF data, file for MIME types, ffprobe for media info, or custom scripts. Writing Processors shows how to build your own.
Basic Usage
Extract EXIF metadata from images:
canon worklist --where 'source.ext|lowercase IN (jpg, jpeg, heic)' \
| ./scripts/exif-worklist.sh \
| canon import-facts
Detect MIME types for all files:
canon worklist | canonargs --fact mime -- file -b --mime-type {} | canon import-facts
Provided Processors
| Processor | Purpose | Requires |
|---|---|---|
scripts/exif-worklist.sh | EXIF, GPS, and media metadata | exiftool, jq |
scripts/hash-worklist.sh | SHA-256 content hashes | jq |
scripts/tag-worklist.sh | macOS Finder tags | jq, python3 |
canonargs --fact mime -- file -b --mime-type {} | MIME type detection | canonargs |
Install canonargs with: cargo install canonargs
Tip: Selective Hashing
To hash only specific file types, scan with --no-hash and hash through the pipeline:
canon scan --no-hash --add --role source /path/to/mixed-files
canon worklist /path/to/mixed-files --where 'source.ext|lowercase IN (jpg, jpeg, heic, mov, mp4)' \
| ./scripts/hash-worklist.sh \
| canon import-facts
canon worklist
Sources as JSONL, for external tools.
# Sources in current directory (when inside a root)
canon worklist
# All sources across all roots
canon worklist --global
# Only sources missing a content hash
canon worklist --where 'NOT content.hash.sha256?'
# Only JPG files
canon worklist --where 'source.ext=jpg'
# Scope to a specific directory
canon worklist /path/to/photos
# Include sources from archive roots (for backfilling facts); also takes excluded, or all for both
canon worklist --include archived
# Include keys' values in output (for chained enrichment)
canon worklist --emit content.geo.lat --emit content.geo.lon
A --where filter for repeated passes: Resuming a Pass.
Output Format
{"source_id":123,"path":"/full/path/to/file.jpg","root_id":1,"size":1024,"mtime":1703980800,"basis_rev":0}
| Field | Description |
|---|---|
source_id | Database ID (pass through to import-facts) |
path | Full absolute path to the file |
root_id | ID of the root containing this source |
size | File size in bytes |
mtime | The file’s save time, in seconds since 1970 (UTC) |
basis_rev | Revision counter for staleness detection (pass through to import-facts) |
Emitting Existing Facts
--emit adds each source’s value for a key (null if it has none):
canon worklist --emit content.geo.lat --emit content.geo.lon
{"source_id":123,"path":"/...","basis_rev":0,"facts":{"content.geo.lat":52.37,"content.geo.lon":4.89}}
{"source_id":124,"path":"/...","basis_rev":0,"facts":{"content.geo.lat":null,"content.geo.lon":null}}
A time is written as ISO 8601 text, in the form and at the precision it is stored:
canon worklist --emit content.DateTimeOriginal
{"source_id":125,"path":"/photos/IMG_0125.jpg","root_id":1,"size":2048,"mtime":1718454605,"basis_rev":0,"facts":{"content.DateTimeOriginal":"2023-12-31T21:00:00-05:00"}}
{"source_id":126,"path":"/photos/IMG_0126.mov","root_id":1,"size":2048,"mtime":1718454605,"basis_rev":0,"facts":{"content.DateTimeOriginal":"2023-12-31T20:00:00-00:00"}}
{"source_id":127,"path":"/photos/IMG_0127.jpg","root_id":1,"size":2048,"mtime":1718454605,"basis_rev":0,"facts":{"content.DateTimeOriginal":"2023-12-31T21:00:00"}}
{"source_id":128,"path":"/photos/IMG_0128.jpg","root_id":1,"size":2048,"mtime":1718454605,"basis_rev":0,"facts":{"content.DateTimeOriginal":"2024-06-15T14:30:05.45+02:00"}}
{"source_id":129,"path":"/photos/IMG_0129.jpg","root_id":1,"size":2048,"mtime":1718454605,"basis_rev":0,"facts":{"content.DateTimeOriginal":"2024"}}
Key names in --emit follow the same rules as in --where, except that a name with a space needs no quotes. --emit geo.lat emits content.geo.lat.
canon worklist --emit Make --emit source.mtime --emit source.ext
{"source_id":1,"path":"/photos/README","root_id":1,"size":5,"mtime":1792271246,"basis_rev":0,"facts":{"Make":null,"source.mtime":"2026-10-17T21:07:26-00:00","source.ext":null}}
{"source_id":2,"path":"/photos/trip/IMG_0125.jpg","root_id":1,"size":3,"mtime":1792271246,"basis_rev":0,"facts":{"Make":"Canon","source.mtime":"2026-10-17T21:07:26-00:00","source.ext":"jpg"}}
Reverse geocoding files that have coordinates but no city name:
canon worklist --emit content.geo.lat --emit content.geo.lon --where 'geo.lat? AND NOT geo.city?' \
| ./scripts/reverse-geocode.sh \
| canon import-facts
canon import-facts
Facts from a processor, as JSONL on stdin.
canon worklist | some-processor | canon import-facts
# Allow importing facts for sources in archive roots
canon worklist --include archived | some-processor | canon import-facts --allow archived
Input Format
Each line is a JSON object:
{"source_id":123,"basis_rev":0,"facts":{"hash.sha256":"abc123...","mime":"image/jpeg"}}
| Field | Description |
|---|---|
source_id | Source ID from the worklist (required) |
basis_rev | Revision from the worklist for staleness check (required) |
facts | Object mapping fact keys to values |
Fact Namespacing
A name is stored under content.: mime becomes content.mime (Reading a Key’s Name).
hash.sha256 creates or links an object.
Types
Facts are text, numbers, or times (Value Types).
A key has one type. Its first import sets it, and a later value that does not fit is skipped and counted. Only canon facts convert changes a key’s type.
The Key Decides
| A value written as | Key holds text | Key holds numbers | Key holds times | New key |
|---|---|---|---|---|
| A string | Text, as written | A number, when the text is a valid number and loses nothing; otherwise skipped | A time, when the text is a valid time; otherwise skipped | Text |
| A JSON number | Text, in the spelling written: 1.10 stays 1.10 | A number | Skipped | A number |
true or false | Text: true, false | 1 or 0, so a filter asks Flag=1 | Skipped | 1 or 0 |
| A list or an object | Text, as compact JSON | Skipped | Skipped | Text, as compact JSON |
null | Nothing stored | Nothing stored | Nothing stored | Nothing stored |
Text that would lose a leading or trailing zero as a number, such as 01234 or 2.50, is skipped.
Dates as strings: a new key whose first value is a date string with no hint holds text. A time modifier still treats it as a time (--where 'DateTimeOriginal|year=2024').
Type Hints
A value wrapped in an object with value and type:
{"source_id":123,"basis_rev":0,"facts":{
"DateTimeOriginal": {"value": "2024:07:23 11:06:32", "type": "datetime"},
"duration": {"value": "1:23:45", "type": "duration"},
"width": {"value": "1920", "type": "number"},
"rating": 5
}}
| Type | Reads | Stored As |
|---|---|---|
datetime | A string in a form Canon accepts as a time; a whole year from 1900 to 2100 as a JSON number | A time, in the form and at the precision it was written |
duration | "1:23:45", "5:30", or seconds as a number | Seconds (a number) |
number | A JSON number, or a string written as one ("1920") | A number for a number key or a new key; text in the spelling written for a text key |
A hinted value that does not fit its key is skipped.
What Is Skipped
Every skipped value is counted:
content.DateTimeOriginal: 2 values, such as "0000:00:00 00:00:00", do not read as a time (--verbose lists each); have the tool write a time Canon reads (see "How Canon interprets a time" in the facts documentation) or omit values that are no time (an empty EXIF date such as 0000:00:00 00:00:00 is best omitted), or `canon facts convert content.DateTimeOriginal` to see the other ways
content.DateTimeOriginal: 1 value, 1721811600, is a number, and the key holds times; have the tool write the time as text (a year as "2019"), or, for a year, write the number with the datetime hint
Read 4 records: imported 4 facts; skipped 3 values: 2 that do not read as their key's type, 1 that is a number for a time key; 4 null values (nothing stored).
--verbose lists each value:
[/photos] IMG_0042.jpg
content.DateTimeOriginal: "0000:00:00 00:00:00" skipped (does not read as a time)
content.ImageWidth: 4032 (on object)
A skipped value leaves its file selected by a NOT <key>? filter; see Resuming a Pass.
Replacing a Key’s Values
Import replaces a key’s existing value, so no delete is needed first. To re-read every file with a key, except on suspended roots:
canon worklist --global --include all --where 'content.Make?' \
| some-processor | canon import-facts --allow archived
--include all brings archived and excluded sources into the worklist, and --allow archived lets the import write facts for the archived ones.
Batches
Records are written in batches, and facts already written stay if the import stops.
Archive Sources
Facts for sources in archive roots are skipped without --allow archived.
Suspended Roots
A record naming a source on a suspended root is set aside and counted:
Read 7 records: imported 5 facts; skipped 2 records: 2 on suspended roots.
Writing Processors
A processor: a script or program that reads worklist entries, extracts metadata from files, and outputs facts for import.
Input and Output
Input (from worklist):
{"source_id":123,"path":"/photos/IMG_001.jpg","basis_rev":0,"size":1024,"mtime":1703980800}
Output (for import-facts):
{"source_id":123,"basis_rev":0,"facts":{"Make":"Apple","Model":"iPhone 12"}}
The processor must pass through source_id and basis_rev unchanged.
Custom Processors
#!/bin/bash
while IFS= read -r line; do
source_id=$(echo "$line" | jq -r '.source_id')
basis_rev=$(echo "$line" | jq -r '.basis_rev')
path=$(echo "$line" | jq -r '.path')
# Extract facts (example: EXIF data)
facts=$(exiftool -json -Make -Model "$path" 2>/dev/null | jq '.[0]')
jq -nc \
--argjson source_id "$source_id" \
--argjson basis_rev "$basis_rev" \
--argjson facts "$facts" \
'{source_id: $source_id, basis_rev: $basis_rev, facts: $facts}'
done
The canonargs Helper
canonargs (installed separately) handles the JSONL parsing and output formatting; you provide a command that extracts data from a single file.
Single Fact Mode
When your command outputs a single value:
canon worklist | canonargs --fact mime -- file -b --mime-type {} | canon import-facts
The {} is replaced with the file path. The command’s stdout becomes the fact value.
Each value is passed on as a string, and the import interprets it as the key’s type; for a new key, it is stored as text. --type specifies a type:
# Store as datetime (enables |year, |month modifiers)
canon worklist | canonargs --fact DateTimeOriginal --type datetime -- exiftool -DateTimeOriginal -s3 {} | canon import-facts
# Store image width as number (using ImageMagick's identify)
canon worklist | canonargs --fact width --type number -- identify -format '%w' {} | canon import-facts
Valid types: datetime, duration, number
Send zip codes and other zero-padded codes without --type number.
Key-Value Mode
When your command outputs key=value pairs (one per line):
canon worklist | canonargs --kv -- my-extractor {} | canon import-facts
Values are passed on as strings; key:type=value specifies a type:
width:number=1920
height:number=1080
DateTimeOriginal:datetime=2024:07:23 14:30:00
codec=h264
JSON Mode
When your command outputs a JSON object:
canon worklist | canonargs --json -- exiftool -json {} | canon import-facts
Example extractor output:
{"Make": "Apple", "Model": "iPhone 12", "DateTimeOriginal": "2024:07:23 14:30:00"}
Each value is passed on exactly as the command wrote it, and the key decides how it is stored.
Chaining
Processors can be chained since canonargs passes through the worklist entry and merges facts:
canon worklist \
| canonargs --fact mime -- file -b --mime-type {} \
| canonargs --json -- exiftool -json {} \
| canon import-facts
Using Existing Facts
worklist --emit gives a processor a key’s value: Emitting Existing Facts.
Resuming a Pass
A --where filter decides which sources a pass still needs. Filter on a fact the processor emits for every file it handles, not on the fact you are after.
A fact emitted only for some files leaves the others selected on every pass:
# Reprocesses files that have no capture time, every run
canon worklist --where 'NOT content.media.capture_datetime?'
# Converges: this processor emits media.width for every file it reads
canon worklist --where 'NOT content.media.width?'
A processor covering several kinds of file needs one branch per kind:
canon worklist --global --include archived --where '
((mime ~ image/* OR mime ~ video/*) AND NOT content.media.width?)
OR (mime ~ audio/* AND NOT content.audio.duration?)
'
When no output is unconditional, emit a marker for every file handled, including files nothing was found in:
{"source_id":123,"basis_rev":0,"facts":{"exif.scanned":"13.55"}}
NOT content.exif.scanned? then selects the unprocessed sources, and storing the tool version lets a later pass reselect on it.
The enriched? predicate does not serve here: it is true as soon as a source has any fact beyond the content hash, including facts from a different processor.
Type Hints
Hints matter for a key’s first values: with no hint, a date string or a quoted number makes a new key a text key. See import-facts for the hint format and full details.
Writing Times
Write each time in the form that says what it is.
{"source_id":123,"basis_rev":0,"facts":{
"media.capture_datetime": {"value": "2024-06-15T14:30:05+02:00", "type": "datetime"},
"media.create_datetime": {"value": "2024-06-15T12:30:05-00:00", "type": "datetime"},
"media.modify_datetime": {"value": "2024:06:15 14:30:05", "type": "datetime"},
"event.date": {"value": "2024-06-15", "type": "datetime"}
}}
| Written as | When |
|---|---|
2024-06-15T14:30:05+02:00 | The offset of the clock that took the time is known. Where that offset is UTC, write Z or +00:00 |
2024-06-15T12:30:05-00:00 | Only the UTC instant is known, as in much video metadata |
2024:06:15 14:30:05 | A time with no offset, as most EXIF dates are |
2024-06-15 | Only the date is known; 2024-06 and 2024 likewise for a month or a year |
A time with no offset is assumed to be in your time zone, so a processor that knows the location, from GPS or otherwise, writes the offset.
Tagging Files with Finder Tags (macOS)
Finder tags can be imported as facts, to classify files for queries and clusters.
The Workflow
-
Tag in Finder: tags such as “vacation”, “kids”, or “junk”.
-
Import tags into Canon:
canon worklist Photos/2011 | ./scripts/tag-worklist.sh | canon import-facts -
Query by tags:
canon ls --where 'tag.vacation?' # files tagged "vacation" canon ls --where 'tag.vacation? AND tag.kids?' # both tags canon ls --where 'tag.vacation? AND NOT tag.kids?' # vacation without kids canon facts # see all tag.* keys with counts -
Cluster and archive by tag:
canon cluster generate --where 'tag.vacation?' --dest /Archive/Media/2011/Vacation ...
How It Works
Each Finder tag becomes a fact key like tag.vacation. Query tags with the ? (exists) operator.
Querying
ls: sources matching filter expressionsfacts: available facts and their coveragecompare: overlap between two directoriessurvey: a selection’s archive status, related locations and unique contentsweep: reduction opportunities across all roots, rankedtrail: the decision trailtrail crossings: what was transferred between two places
ls, facts, compare and survey take --where filters. Every command here but sweep takes a path. Common options covers scope defaulting.
canon ls
List sources matching filters.
# List sources in current directory (default when inside a root)
canon ls
# List sources matching a filter
canon ls --where 'source.ext|lowercase=jpg'
# Filter by status
canon ls --where 'NOT archived? AND hashed?'
# Show duplicate files (same content hash), grouped by hash
canon ls --duplicates
# View excluded sources (requires --include for visibility)
canon ls --include excluded --where 'excluded?'
# Include sources from archive roots (automatic when scope is in an archive)
canon ls --include archived
# Query all roots, ignoring current directory scope
canon ls --global --where 'source.ext|lowercase=jpg'
# Long format with size and date
canon ls -l
# Sort by path, size, mtime or name; -r reverses
canon ls --sort size -r
# Null-delimited output for xargs (handles spaces in paths, macOS)
canon ls -0 --where 'source.ext|lowercase=jpg' | xargs -0 open -a Preview
- Status column: with
--include,ls -lmarksE(source-level exclusion),X(object-level exclusion) orA(source in an archive root)
Paths go to stdout, the scope line and the count to stderr:
scope: /Volumes/old-drive/photos
vacation/img001.jpg
vacation/img002.jpg
work/doc.pdf
3 sources
canon facts
The facts you have, and their coverage.
# Overview of all facts (scoped to current directory when inside a root)
canon facts
# Scoped to a specific directory
canon facts /path/to/photos
# Global overview across all roots
canon facts --global
# With filters
canon facts --where 'source.ext|lowercase=jpg'
# Value distribution for a specific fact
canon facts --key content.Make
# With modifiers: group mtime by year-month
canon facts --key 'source.mtime|yearmonth'
# With accessors: distribution by top-level directory
canon facts --key source.rel_path[0]
# Show hidden source facts
canon facts --all
# Unlimited results (default is 50)
canon facts --key content.hash.sha256 --limit 0
# Show source count per root (which roots have matching content?)
canon facts --by-root
# Group fact values by root (which roots contribute to each value?)
canon facts --key source.ext --by-root
# Group by any fact key (with modifiers)
canon facts --key source.ext --group-by 'source.mtime|year'
# Compound grouping (root + another fact)
canon facts --key source.ext --by-root --group-by 'content.Make'
# Group by several keys, as a list
canon facts --key content.Make --group-by 'content.Model, source.size|bucket(1e6,1e7)'
# A key alias, in either place
canon facts --key @taken --group-by @year
Facts: all roots
Sources matching filters: 34692
Key Type Count Coverage
────────────────────────────────────────────────────────────
source.ext text 34692 100.0% (source fact)
source.size number 34692 100.0% (source fact)
source.mtime time 34692 100.0% (source fact)
source.path path 34692 100.0% (source fact)
source.rel_path path 34692 100.0% (source fact)
filename text 34692 100.0% (built-in key)
"content.File Size" number 7935 22.9%
content.Make text 7935 22.9%
content.Model text 7935 22.9%
content.hash.sha256 text 34692 100.0%
content.mime text 34692 100.0%
(4 source facts hidden, use --all to show)
...
A key is shown the way you write it in --where. Count is the number of sources in scope that <key>? selects. A key with values of more than one type is listed as mixed:
2 keys are of mixed type; filters and patterns support one type only:
"content.File Size" (text and number)
content.Model (text and number)
To see their values and convert each to one type:
`canon facts convert 'content.File Size'`
`canon facts convert content.Model`
A key’s values
--key counts the sources in scope by their value for the key:
$ canon facts --key content.Model
Facts: all roots
Sources matching filters: 12480
content.Model Count Coverage (text)
───────────────────────────────────────────────────────────────────────
"Canon EOS 5D Mark II" 6102 48.9%
"iPhone 6s" 3977 31.9%
DMC-FZ38 820 6.6%
"" 14 0.1%
(no value) 1567 12.6%
(no value): NOT content.Model?
A value is shown the way you write it in --where, so <header>=<row> selects exactly the sources the row counted (quoting).
Each line under a table is <what is on the row>: <filter>, with --where text after the : . A row marked + is a coarse time beside finer values in its period. <header>=<row> would select those too, so use the row’s line.
A time shows in your local time, at the precision it was written, and times that show the same are one row:
content.DateTimeOriginal Count Coverage (time)
───────────────────────────────────────────────────────────────────────
"2023-12-31 21:00:00" 2 50.0%
2024 1 25.0% +
"2024-01-01 03:00:00" 1 25.0%
Each year row marked +: content.DateTimeOriginal=<row> AND NOT content.DateTimeOriginal|month?
--limit never hides (no value); when it hides rows, stderr says how many.
--key source.mtime counts by year and --key source.size by range (1K is 1,000 bytes). Write a modifier to count otherwise: --key 'source.mtime|datetime', --key 'source.size|number'.
source.size|bucket Count Coverage (range, source fact)
─────────────────────────────────────────────────────────────────────────────────────
100K-to-1M 21004 60.5%
1M-to-10M 12950 37.3%
1K-to-10K 738 2.1%
Grouped output
--by-root and --group-by break each value down:
source.ext (grouped by root)
jpg (total: 12,500, 36.0%)
id:1 /Volumes/OldBackup/Pictures 8,000 64.0%
id:2 /Users/me/laptop/photos-backup 4,500 36.0%
png (total: 8,200, 23.6%)
id:1 /Volumes/OldBackup/Pictures 5,000 61.0%
id:3 /Volumes/laptop-import/media 3,200 39.0%
Each indented row: source.ext=<value> AND root_id=<N>
id:<N> (not id=, which names a source): root_id=<N>
With several grouping keys, <1st>, <2nd> … stand for the parts printed on the row, and the root counts as a part:
source.ext (grouped by source.mtime|year, content.Make)
jpg (total: 12,500, 36.0%)
2011 / Canon 8,000 64.0%
2012 / Canon 3,000 24.0%
2012 / (no value) 1,500 12.0%
Each indented row: source.ext=<value> AND source.mtime|year=<1st> AND content.Make=<2nd>
Each indented (no value) row: source.ext=<value> AND source.mtime|year=<1st> AND NOT content.Make?
--group-by takes one key or a comma-separated list, and can be given more than once. --key and --group-by take a key alias.
A key name with a space needs no quotes here: --key "content.File Size" reports that key.
See also: facts convert for changing a key’s type, facts delete for removing incorrect metadata, prune for cleaning up stale or orphaned data.
canon compare
Two directories compared by content hash.
# Compare current directory against another location
canon compare /path/to/folder_b
# Compare two explicit directories
canon compare /path/to/folder_a /path/to/folder_b
# With filters
canon compare /path/to/folder_a /path/to/folder_b --where 'source.ext=jpg'
# Include excluded sources in comparison
canon compare /path/to/folder_a /path/to/folder_b --include excluded
# Show file paths for differences
canon compare /path/to/folder_a /path/to/folder_b --verbose
With one path argument, the current directory is side A and the argument is side B.
Comparing:
A: /mnt/old-drive/photos/italy
B: /mnt/old-drive/photos/misc
Files in both (by content): 21
Only in A: 26
Only in B: 0
Exit code is 0 if identical, 1 if differences found.
canon survey
An orientation map of a location: what’s archived, which other locations share content, and what exists only here.
Survey works on source-side selections: a scope inside archive roots is refused.
# Survey current directory
canon survey
# Survey a specific path
canon survey /mnt/old-drive/photos
# Survey with filters
canon survey /mnt/old-drive/photos --where "@image AND source.mtime|year=2016"
# See which of your files overlap with related locations
canon survey /mnt/old-drive/photos --detail overlap
# See content that exists nowhere else
canon survey /mnt/old-drive/photos --detail unique
# Pipe unique paths for further processing
canon survey /mnt/old-drive/photos --detail unique -0 | xargs -0 open
# See what's NOT at a reference location
canon survey /mnt/old-drive/photos --detail residual --other /mnt/backup/vacation/
# Add affinity columns to understand related locations deeper (requires --where)
canon survey /mnt/old-drive/photos --where "@image" --affinity
# See complementary content at related locations (requires --where)
canon survey /mnt/old-drive/photos --where "@image" --detail complement
# Compare against specific locations instead of discovering them
canon survey /mnt/old-drive/photos --other /mnt/backup/vacation/
Options
| Flag | Description |
|---|---|
--where <EXPR> | Filter expression (repeatable). Narrows the selection. |
--affinity | Enable affinity columns (+N more, unique count, classification). Requires --where. |
--detail <MODE> | archived, complement, unique, overlap, or residual. Replaces the summary view. |
--archive <SPEC> | Filter archive section to a specific archive root (id:N or path:/...). |
--include <VALUE> | Include additional sources: excluded. |
--global | Survey all roots, ignoring current directory scope. |
--other <PATH> | Compare against specific locations (repeatable). Bypasses scope discovery. |
--brief | Skip per-location affinity computation when --affinity is active. |
--verbose | Show all locations (summary) or all paths per location (detail views). |
-0 | Null-delimited output for --detail archived, unique, overlap, or residual. |
Reading the output
Summary view (default)
Survey: /mnt/old-drive/exports
517 sources here (0 unhashed, 517 hashed)
264 unique here
Archived: 201 of 517 (38.9%)
/archive/media/2019/holiday 41
/archive/media/2019/kids 35
/archive/media/2019/home 43
/archive/media/2020/kids 22
...
Related locations:
/mnt/backup/pictures/phone/ 161 of 517 overlap (18,057 total)
/mnt/sandisk-export/camera-roll/2019/dec 82 of 517 overlap (370 total)
/mnt/sandisk-export/camera-roll/2020/jan 40 of 517 overlap (211 total)
/mnt/backup/phone/2019-W48 37 of 517 overlap (115 total)
... and 6 more locations (use --verbose to show all)
Survey header: unhashed files can’t be matched. “Unique here” is content that exists nowhere else in Canon’s universe.
Archived: your files with a copy in an archive. --detail overlap --other <archive-path> shows which files are at a given location.
Related locations: other places that share content with your selection:
- N of M overlap: your files that also exist at this location
- (T total): all files at this location
Notes
Survey shows the 5 most recent notes on the scope and the directories below it, or all of them with --verbose:
Survey: /mnt/old-drive/exports
12 sources here (0 unhashed, 12 hashed)
12 unique here
Notes:
2026-03-20 . confirmed: 95% archived, 12 unique remain
2026-03-19 . looks clean
2026-03-18 vacation/ interesting sunset photos, check originals
2026-03-16 . check dates
2026-03-15 . phone backup from 2019, mostly photos
(2 earlier notes across 2 locations)
Affinity mode (--affinity)
With a --where filter, --affinity shows what related locations have beyond the overlap:
Related locations:
/mnt/backup-2022/photos/italy/ ≥ 380 of 388 overlap (420 total) +95 more (31 unique)
/mnt/partner-laptop/DCIM/vacation > 45 of 388 overlap (225 total) +180 more (42 unique)
/mnt/backup-2022/photos/misc/ ⊆ 30 of 388 overlap (30 total)
- +N more: files here that match your filters but have different content from your selection
- (K unique): of those, how many exist nowhere else
- Classification symbol: how this location relates to your selection (see below)
The four dispositions
- Superset (≥): nearly everything you have, plus more matching content
- Lead (>): complementary content with partial overlap
- Subset (⊆): high overlap, no complementary content, and most of the location’s own content overlaps with yours
- Mirror (=): overlap, no complementary content, and significant other content outside your filter
Detail views
A detail view shows file listings in place of the summary’s sections:
| Summary signal | Question | Detail view |
|---|---|---|
| “201 of 517 archived (38.9%)” | Which files are archived, and where? | --detail archived |
| “264 unique here” | What content exists only here? | --detail unique |
| “161 of 517 overlap” | Which of my files are at that location? | --detail overlap |
| “+95 more” (affinity) | What matching content is over there? | --detail complement |
| — | What’s here that’s NOT at a specific location? | --detail residual |
-0 gives flat, deduplicated, absolute paths from your selection.
Archived (--detail archived)
Archived files (201 sources across 6 locations):
Archived at /archive/media/2019/home (43 files):
exports/photos/IMG_0001.jpg
→ media/2019/home/IMG_0001.jpg
exports/photos/IMG_0002.jpg
→ media/2019/home/IMG_0002.jpg
... and 38 more
Archived at /archive/media/2019/holiday (41 files):
exports/vacation/DSC_0100.jpg
→ media/2019/holiday/DSC_0100.jpg
...
Unique (--detail unique)
Paths of files whose content exists nowhere else:
photos/2016-07-14/IMG_4201.jpg
photos/2016-07-14/IMG_4202.jpg
photos/2016-07-18/DSC_0891.jpg
Overlap (--detail overlap)
Overlapping with related locations (overlap):
/mnt/backup/phone-export/ (4 of 135 overlap):
recordings/morning-walk.m4a
→ audio/2020/morning-walk.m4a
recordings/evening-notes.m4a
→ audio/misc/recording-001.mp3
photos/IMG_0042.JPG
→ DCIM/2020-W48/IMG_0042.JPG
→ DCIM/2020-W48/IMG_0042 2.JPG
Complement (--detail complement)
Requires --where. Files at related locations that match your filters but have different content from your selection:
Complementary content at related locations:
/mnt/backup-2022/photos/italy/ (+95, 31 unique):
week3/IMG_4501.jpg
week3/IMG_4502.jpg
week3/IMG_4503.jpg
week4/IMG_4601.jpg
week4/IMG_4602.jpg
... and 90 more
Residual (--detail residual)
Requires --other. Your files not shared with the reference location:
Not at /mnt/backup/vacation/ (residual):
photos/IMG_4201.jpg
photos/IMG_4202.jpg
photos/IMG_4203.raw
Directed comparison (--other)
--other names locations instead of discovering them:
canon survey /mnt/old-drive/photos \
--other /mnt/backup/vacation_italy/ \
--other /mnt/partner-laptop/DCIM/
canon sweep
Reduction opportunities across the whole universe: the ranked places where one dismissal resolves the most.
# The leaderboard: the ten best reduction opportunities, ranked
canon sweep
# Everything: all entries, all members, findings below the emit floors
canon sweep --all
The sweep takes no paths and no filters, and is computed fresh on every run.
Options
| Flag | Description |
|---|---|
--limit <N> | Show up to N leaderboard entries (default: 10). |
--all | No cap: every entry, every place of a multi-place entry, and findings below the emit floors. |
Reading a finding
#1 /Volumes/OldBackup/ARCHIVED/Super8
96% inside /Volumes/Archive/Media/Super8 (by size · 89% by count)
counterpart: archived, scanned 5d ago · subject scanned 2d ago
gain: 1,204 files · 33.7 GB residual: 1 file · 3.9 GB nowhere else
→ canon survey /Volumes/OldBackup/ARCHIVED/Super8 --other /Volumes/Archive/Media/Super8
- Subject (the first line): the place the finding is about, the side you might dismiss
- Counterpart: where the copies live, with its standing and each side’s scan age
- Relation:
insidea larger counterpart, ormirrorsone in both directions; a large gap between “by size” and “by count” means many small files - Gain: what acting on the finding resolves
- Residual: content existing nowhere else in the universe;
residual: nonemeans a clean dismissal →line: the command to judge the finding; an entry with none has no single place on a source root to compare
Excluded content creates no findings and blocks no dismissal.
Scattered findings
When no single counterpart holds the copies, the finding says scattered:
#4 /Volumes/Backup/laptop-import/mixed
94% exists elsewhere, across 7 locations (2 archived · 3 suspended)
scattered; consolidation candidate · subject scanned 12d ago
Hubs
Many places with copies in one counterpart show as a single entry, with the counterpart on its first line:
#2 /Volumes/Archive/Media/iphone-backup
shared counterpart — 36 places hold copies inside it · archived, scanned 5d ago
total gain: 7,820 files · 41.2 GB
/Volumes/OldBackup/iphone-2019 98% inside · 402 files · 2.1 GB
/Volumes/old-disk/dumps/phone 97% inside · 371 files · 1.9 GB
… 34 more (--all)
→ canon survey /Volumes/OldBackup/iphone-2019 --other /Volumes/Archive/Media/iphone-backup
Roots close to done
A source root with few unresolved sources left shows as one entry, with the root on its first line:
#1 /Volumes/oldmac (whole root)
3 unresolved sources remain
6 places, up to 1,204 files · 41.3 GB
/Volumes/oldmac/Pictures/2019 mirrors · 100% · archived · 612 files · 22.1 GB
/Volumes/oldmac/Pictures/2020 98% inside · archived · 431 files · 14.8 GB
… 4 more (--all)
→ canon roots retire path:/Volumes/oldmac --dry-run
The count is what the retirement review measures.
The up to figure is an upper bound: two places can each have copies of the other, and only one of them can be let go.
Sibling directories under one parent
Several places under one parent, each with its own counterpart, show as one entry, with the parent on its first line:
#1 /Volumes/Backup/photos
10 places under here · 88% of this folder
up to 4,102 files · 61.4 GB
/Volumes/Backup/photos/set-01 mirrors · 100% · archived · 402 files · 6.1 GB
/Volumes/Backup/photos/set-02 98% inside · archived · 388 files · 5.9 GB
… 8 more (--all)
→ canon survey /Volumes/Backup/photos
The percentage is the share of the parent’s own sources that lie under those places; the → line surveys the whole parent.
Ranking
Findings rank by these factors, in order, each visible on the finding:
- Cleanliness: ready-to-assess findings above consolidation candidates.
- Archive standing: a place on a source root above an equivalent place in the archive.
- Root nearness: a place on a source root with little left unresolved above a place on a root barely started. Archive roots tie here.
- Weight: gain, by size.
- Counterpart standing: archived above present; scattered content with nothing archived last.
- Residual: less content existing nowhere else ranks higher.
A small place on a root close to done outranks a large one elsewhere, and says so on its own line:
#1 /Volumes/oldmac/Pictures/2019
mirrors /Volumes/Archive/Media/2019 (100% by size · 100% by count)
counterpart: archived, scanned today · subject scanned today
20 unresolved sources remain on /Volumes/oldmac
gain: 30 files · 61.4 KB residual: none
→ canon survey /Volumes/oldmac/Pictures/2019 --other /Volumes/Archive/Media/2019
Suspended roots
Places on a suspended root are not ranked, and neither are places whose counterpart is on one. Each such root gets a footer line:
/Volumes/OldBackup suspended — not ranked: 8 places on it (up to 185.3 GB), 4 with copies on it (up to 12.1 GB) · canon roots unsuspend path:/Volumes/OldBackup
--all does not reveal these places.
canon trail
The decision trail: every effectful command in a timeline, interleaved with notes.
- By place: which actions touched this place.
- By time (
--today,--since,--on): an overview of a time window. - Between places (
trail crossings): what was transferred between two places.
# What happened here?
canon trail
# What happened in a specific directory?
canon trail /mnt/old-drive/photos
# Today, across all roots
canon trail --today --global
# Everything since Saturday
canon trail --since saturday
# One month
canon trail --on 2026-05
# One action in full
canon trail show 61
# Full paths, for copying
canon trail -l
By place
With no time flags, the actions that touched the scope:
$ canon trail --limit 3
Decision trail: /mnt/old-drive/photos
#14 2026-11-01 15:15 archived italy → 47 files (3.9 MB) to /archive/2016/italy (copied) · "italy assembly"
#15 2026-11-01 15:15 scan . Scanned 68 files: 0 new, 0 updated, 0 moved, 68 unchanged, 12 missing · "verified duplicates"
#16 2026-11-01 15:15 excluded misc Excluded 21 sources · "redundant backup"
2026-11-01 15:15 italy ~ unsure about the RAW files — revisit
Archived from here: 47 files (3.9 MB) → 1 destination.
`canon trail crossings` to list the places behind these totals
12 earlier decisions not shown (--limit N or --all; showing 3).
Standing here: 68 files (5.6 MB)
excluded: 21 files (1.7 MB)
first indexed here: 47 files (3.9 MB)
An action touches a scope in either direction: one on a parent directory counts here, and so does one on a subdirectory.
Incomplete actions are marked [partial], [interrupted], [refused] or [started].
The third column is the transition that occurred (archived, excluded, restored), otherwise the command name.
The fourth column is the place: the scope the action applied to, relative to this directory.
- This directory:
. - Below it: the path from here.
italy - Elsewhere in the same root: the path from the root, with a leading
/./alone is the root. - Several scopes: the deepest one, with
+Nfor the others.b/IMG_0.jpg +1 - No scope:
global.canon trail --globallists these actions. - A trail crossing roots: full paths, capped from the left.
Where a place has a leading /, a line under the header names the root:
Decision trail: /archive/2016
Places are relative to this folder; a leading / is relative to /archive.
#2 2026-11-01 15:14 scan / Scanned 0 files: 0 new, 0 updated, 0 moved, 0 unchanged, 0 missing
#4 2026-11-01 15:14 archived italy ← 47 files (3.9 MB) from /mnt/old-drive/photos/italy (copied in) · "italy assembly"
The last column is the action’s summary and your --reason in quotes. ~ marks a note there, and --no-notes hides notes.
See also canon roots story: a whole root as a map of places.
What went in and what went out
An apply shows which way its content went:
- Out of here:
→. From/mnt/old-drive/photos:→ 6 files (30.0 KB) to /archive/2016 (copied) - Into here:
←. From/archive:← 6 files (30.0 KB) from /mnt/old-drive/photos/italy (copied in) - Within here:
→, on one line. From/archive:→ 3 files (15.0 KB) to 2020 (moved)
The fourth column is the end in this place, and the counts are what went out of or into it.
A trail of one place ends with whole-history totals, whatever the --limit. Archived from here and Arrived here count what crossed the boundary of this place, and Rearranged here counts what moved within it:
Archived from here: 1,251 files (22.1 GB) → 2 destinations.
Arrived here: 340 files (8.2 GB) from 3 origins.
`canon trail crossings` to list the places behind these totals
Rearranged here: 47 files (3.9 GB).
Size is omitted if unknown.
The composition card: what’s standing here
What exists at the location (the composition card):
Standing here: 500 files (12.9 GB)
arrived from /Volumes/old-laptop
300 files (7.1 GB) · 2 decisions · 2026-03-02 – 2026-05-01
arrived from elsewhere in /archive
47 files (3.9 GB) · decision #57 · 2026-05-12
`canon trail crossings --origin <path>` to list the folders behind an origin
rearranged: 12 files (800.0 MB)
first indexed here: 141 files (1.1 GB)
| Line | Meaning |
|---|---|
arrived from <root> | Came from that root, merged across actions, busiest first |
arrived from elsewhere in <root> | The origin is outside this place but inside the root that contains it |
via apply #N from M origins | One apply that took content from several roots |
excluded: and other standings | What present content was last touched by, merged across actions |
rearranged | All of it came from inside this place |
first indexed here | Content this location first saw through a scan |
arrival unrecorded | Content with no record of how it arrived |
archived (origin unknown) here (#88) | A gap: an apply the record cannot attribute |
transition unrecorded here (#404) | A gap: an action whose decision record is gone |
Origins are named at the root; trail show <id> lists the directories.
By time
--today, --since <when> or --on <when> group the actions by day:
Decision trail: all roots — today
Sunday 2026-11-01 — deleted 12 files (3.6 MB), archived 47 files (3.9 MB), excluded 21 files (1.7 MB) — and 3 other actions
#1 15:16 scan /mnt/old-drive/photos Scanned 80 files: 80 new, 0 updated, 0 moved, 0 unchanged, 0 missing
#2 15:16 scan /archive Scanned 0 files: 0 new, 0 updated, 0 moved, 0 unchanged, 0 missing
#3 15:16 cluster_generate /mnt/old-drive/photos/italy Generated manifest: italy-2016.toml (47 sources in italy-2016.lock)
#4 15:16 archived /mnt/old-drive/photos/italy Applied italy-2016.toml: 47 copied, 0 renamed, 0 moved, 0 skipped (missing), 0 skipped (stale), 0 skipped (filtered), 0 errors · "italy assembly"
#5 15:16 scan /mnt/old-drive/photos Scanned 68 files: 0 new, 0 updated, 0 moved, 68 unchanged, 12 missing · "verified duplicates"
#6 15:16 excluded /mnt/old-drive/photos/misc Excluded 21 sources · "redundant backup"
15:16 /mnt/old-drive/photos/italy ~ unsure about the RAW files — revisit
<when> is today, yesterday, a weekday name (the most recent one, today included), or a time such as 2026-07, 2026-07-12 or "2026-07-12 14:30". Each covers the whole span it gives, in your local time.
Full paths: -l
-l shows each entry over several lines, with full absolute paths:
$ canon trail -l --limit 1
Decision trail: /mnt/old-drive/photos
#16 2026-11-01 15:15 excluded
/mnt/old-drive/photos/misc
Excluded 21 sources · "redundant backup"
2026-11-01 15:15
/mnt/old-drive/photos/italy
~ unsure about the RAW files — revisit
...
Inspecting a decision: trail show
$ canon trail show 16
Decision #16 — exclude_duplicates
when: 2026-11-01 15:15
status: completed
counts: attempted 21, completed 21, failed 0, skipped 0
reason: "redundant backup"
command: canon exclude duplicates /mnt/old-drive/photos/misc --prefer /archive --yes --reason redundant backup
time zone: Europe/Amsterdam
scope: /mnt/old-drive/photos/misc (within here)
version: 0.6.0
summary: Excluded 21 sources
receipts:
/archive/.canon-ledger/000016-exclude_duplicates.toml
For an apply, drew from: is what was transferred from each source root, recorded at apply time:
drew from:
/Volumes/old-laptop/photos/2016/italy — 47 files (3.9 GB)
/Volumes/nikon-sd/dcim — 12 files (401 MB) (root removed)
(here) marks a scope that is the current directory or contains it; (within here) marks one the current directory contains.
Machine output
--jsonl emits one JSON object per timeline event, with a type of "decision" or "note". A summary can span several lines. The scope header goes to stderr:
canon trail --today --global --jsonl | jq -r 'select(.type=="decision") | .summary'
# the timeline's line alone
canon trail --today --global --jsonl | jq -r 'select(.type=="decision") | .summary | split("\n")[0]'
Flags
| Flag | Meaning |
|---|---|
--global | All roots, ignoring current-directory scope |
--today | Today (same as --since today) |
--since <when> | From the start of <when> onward |
--on <when> | Within <when>, the whole span it names |
--limit N | Show at most N actions (default 20) |
--all | No cap |
--no-notes | Actions only |
-l, --long | Multi-line entries with each place’s full absolute path |
--jsonl | Machine output (JSONL on stdout) |
canon trail crossings
What was transferred between two places, according to the recorded crossings.
# The places behind canon trail's totals
canon trail crossings
# Everything one root ever delivered here
canon trail crossings --origin /Volumes/old-backup
# Everything it delivered, wherever it went
canon trail crossings --global --origin /Volumes/old-backup
With no flags
$ canon trail crossings
Crossings: /archive
Archived from here: 1,251 files (22.1 GB) → 2 destinations.
/archive/Media/2016
904 files (18.2 GB) · 3 decisions · 2026-07-11 · 44 folders
/archive/Documents/scans
347 files (3.9 GB) · decision #57 · 2026-08-09
Arrived here: 36,412 files (498.2 GB) from 10 origins.
/Volumes/old-backup/archived
(root retired — the book: /archive/books/2026-08-11-backup-archived)
8,398 files (201.4 GB) · 15 decisions · 2026-08-02 – 2026-08-09
… and 9 more origins.
`canon trail crossings --origin <path>` or `--destination <path>` to list the folders behind an entry
44 folders counts the recorded destination directories behind an entry.
Naming a counterpart
--origin <path> narrows to content that came from at or under that place, and --destination <path> narrows to content that ended up at or under it. The two compose. Naming one lists its section per action:
$ canon trail crossings --origin /Volumes/old-backup/archived
Crossings: /archive
Arrived here: 8,398 files (201.4 GB) from /Volumes/old-backup/archived
(root retired — the book: /archive/books/2026-08-11-backup-archived).
#48 2026-08-02 1,204 files (31.2 GB) moved in
Photos/2016 → Media/2016
Photos/2017 → Media/2017
"italy trip + the 2017 backlog"
#50 2026-08-02 847 files (12.8 GB) copied in
Photos/2018 → Media/2018
… and 13 more decisions.
Standing here: 8,151 of the 8,398 files delivered — 15 decisions stand behind them; 17 delivered.
Standing here compares what came from this origin with what is here now, when the origin is a whole root.
Caps and machine output
--jsonl emits the timeline’s events for the actions with a crossing here.
| Flag | Meaning |
|---|---|
--origin <path> | Narrow to content that came from at or under this path |
--destination <path> | Narrow to content that ended up at or under this path |
--global | All roots; requires --origin or --destination |
--limit N | At most N entries per section (default 20) |
--all | No cap |
--jsonl | Machine output (JSONL on stdout) |
Managing Sources
exclude: sources to skip duringcluster generateandapply. Excluding deletes nothing, and an exclusion can be cleared at any time.note: timestamped observations on locations.
canon exclude
Source exclusions: sources most commands skip.
# Mark sources as excluded (e.g., small files, temp files)
canon exclude set --where 'source.size<1000'
canon exclude set /path/to/photos --where 'source.ext=tmp'
# Exclude a specific file by path
canon exclude set /path/to/photos/unwanted.jpg
# Exclude by source ID (shown in ls --duplicates output)
canon exclude set --id 12345
# Preview what would be excluded
canon exclude set --where 'source.ext=bak' --dry-run
# Skip confirmation prompt (for scripting)
canon exclude set --where 'source.ext=bak' --yes
# View excluded sources
canon ls --include excluded --where 'excluded?'
# Remove exclusions
canon exclude clear
canon exclude clear --where 'source.ext=tmp'
# Skip confirmation prompt
canon exclude clear --yes
A filter with !=, !~, NOT IN or NOT also selects sources with no value; the preview says how many.
canon exclude duplicates
Exclude duplicates, keeping the copies in a preferred location.
# Exclude duplicates, keeping files under /preferred/path
canon exclude duplicates /scope/path --prefer /preferred/path
# Preview what would be excluded
canon exclude duplicates /scope/path --prefer /preferred/path --dry-run
# Skip confirmation prompt
canon exclude duplicates /scope/path --prefer /preferred/path --yes
# With filters
canon exclude duplicates /scope/path --prefer /preferred/path --where 'source.ext=jpg'
canon exclude set-object / clear-object
Exclude content by hash rather than by path, affecting every source sharing that content (two levels).
# Exclude by a file's content (looks up its hash)
canon exclude set-object /path/to/junk.bin --yes
# Exclude by content across a scope, with filters
canon exclude set-object /scope --where 'content.mime=application/octet-stream' --yes
# Exclude by hash directly (excluding empty content requires this explicit form)
canon exclude set-object --hash <content-hash> --yes
# Restore a content-level exclusion (the full hash, as list-objects prints it)
canon exclude clear-object <content-hash>
# List content-level exclusions
canon exclude list-objects
exclude set-object defaults to a dry-run; pass --yes to execute.
How exclusions affect other commands
| Command | Default behavior | Override |
|---|---|---|
ls | Skips excluded | --include excluded |
worklist | Skips excluded | --include excluded |
facts | Skips excluded, shows count | --include excluded |
coverage | Counts non-excluded sources | None |
cluster generate | Always skips excluded | None |
apply | Blocks if manifest has excluded | None |
Provenance
Every exclusion is recorded as a decision, with a receipt where an archive root is available. exclude set, clear, duplicates, and set-object accept --reason.
canon note
Timestamped notes on locations: quick observations about a directory scope. Notes also show in survey.
# Add a note to the current directory
canon note -m "lots of unsorted vacation photos here"
# Add a note to a specific path
canon note /mnt/old-drive/exports -m "overlaps with 2019 backup, check survey"
# View notes at the current scope
canon note
# View notes at a specific path
canon note /mnt/old-drive/exports
# List recent notes across all roots (temporal, capped at 10)
canon note --global
# List recent notes recursively under a scope
canon note -r
canon note -r /mnt/old-drive
# Show the spatial map — one line per noted location
canon note --global --by-scope
canon note -r --by-scope
# Clear notes at the current scope
canon note --clear
# Clear all notes under a scope (with confirmation)
canon note --clear -r /mnt/old-drive
# Skip confirmation prompt for recursive clear
canon note --clear -r --yes
Options
| Flag | Description |
|---|---|
-m <TEXT> | Add a note with the given text. |
-r, --recursive | List or clear notes for scope and all descendants. |
--global | List all notes across all roots. |
--by-scope | Group by location, show most recent note per location. |
--limit <N> | Maximum entries to display (default: 10, 0 = unlimited). |
--clear | Clear notes at the scope (or subtree with -r). |
--yes | Skip confirmation prompt (recursive clear only). |
Notes are a journal: each -m adds a timestamped entry, and notes are never edited in place.
Modes
Add (-m)
$ canon note phone-export -m "phone backup from 2019, mostly photos"
Note added: phone-export
View (default)
canon note shows the notes at the exact scope, with counts of the notes above and below it:
$ canon note
phone-export:
2026-03-15 phone backup from 2019, mostly photos
2026-03-20 confirmed: 95% archived, 12 unique files remain
1 noted location below (-r to show)
Temporal listing (--global, -r)
The most recent notes, by date:
$ canon note --global --limit 5
/mnt/photos/2011 2026-03-15 tagged vacation photos, school stuff still needs triage
/mnt/old-drive/phone-export 2026-03-20 confirmed: 95% archived, 12 unique files remain
/mnt/photos/2011/vacation 2026-03-20 subset tagged and clustered
/mnt/old-drive/phone-export/vacation 2026-03-22 unique sunset photos here
/mnt/old-drive/other 2026-03-23 not sure what this is
(4 more notes, 2 more locations)
-r lists a subtree the same way:
$ cd /mnt/old-drive
$ canon note -r
phone-export 2026-03-15 phone backup from 2019, mostly photos
phone-export 2026-03-20 confirmed: 95% archived, 12 unique files remain
phone-export/vacation 2026-03-22 unique sunset photos here
other 2026-03-23 not sure what this is
Spatial listing (--by-scope)
One line per location: its most recent note and its note count, capped at 10.
$ canon note --global --by-scope --limit 4
/mnt/old-drive/phone-export (2) 2026-03-20 confirmed: 95% archived, 12 unique files remain
/mnt/photos/2011/vacation (1) 2026-03-20 subset tagged and clustered
/mnt/old-drive/phone-export/vacation (1) 2026-03-22 unique sunset photos here
/mnt/old-drive/other (1) 2026-03-23 not sure what this is
(3 more locations with notes)
Clear (--clear)
Without -r, --clear clears the notes at the exact scope, with no confirmation.
$ canon note --clear
Cleared 2 notes at phone-export
With -r, it clears all notes in the subtree, after confirmation:
$ canon note --clear -r /mnt/old-drive
Clear 3 notes across 3 locations under /mnt/old-drive?
Proceed? [y/N] y
Cleared 3 notes
Notes and the decision trail
Notes hold thoughts; the decision trail holds actions. Effectful commands record themselves, and --reason attaches your reason.
Archiving
Archiving a collection of files takes two steps:
coverage: how much has been archived.
canon coverage
Archive coverage statistics: how many sources are hashed and how many are archived.
# Coverage for current directory (when inside a root)
canon coverage
# Scoped to a specific directory
canon coverage /path/to/photos
# Global overview of all source roots
canon coverage --global
# One line per root
canon coverage --global --compact
# With filters
canon coverage --where 'source.ext=jpg'
# Coverage relative to a specific archive root
canon coverage --archive id:1
# Include archive roots in analysis
canon coverage --include archived
Global output:
Coverage: all roots
Root 1: /path/to/backup1 (source)
Total sources: 1,234
Hashed: 1,100 (89.1%)
Empty files: 40 (no content to cover)
Archived: 850 (80.2% of 1,060 with content)
Unarchived: 210
Root 2: /path/to/backup2 (source)
Total sources: 567
Hashed: 500 (88.2%)
Archived: 400 (80.0% of 500 with content)
Unarchived: 100
────────────────────────────────────────
Overall:
Total sources: 1,801
Hashed: 1,600 (88.8%)
Empty files: 40 (no content to cover)
Archived: 1,250 (80.1% of 1,560 with content)
Unarchived: 310
- Hashed: sources with a content hash
- Empty files: empty files, counted in neither
ArchivednorUnarchived - Archived: sources whose content exists in an archive root
canon cluster
cluster generate
A manifest of the sources matching filters. --dest must be inside a registered archive root.
# All photos to an archive (unhashed sources are skipped)
canon cluster generate --where 'source.ext|lowercase IN (jpg, png, heic)' --dest /Volumes/Archive/Photos
# Scope to a specific path
canon cluster generate /path/to/photos --dest /Volumes/Archive
# Custom output file
canon cluster generate --where 'source.ext|lowercase=jpg' --dest /Volumes/Archive -o my-manifest.toml
# Also keep sources in archive roots, and sources whose content is already archived
canon cluster generate --where 'source.ext|lowercase=jpg' --dest /Volumes/Archive --allow archived
# Allow sources with identical content in the selection
canon cluster generate --where 'source.ext|lowercase=jpg' --dest /Volumes/Archive --allow duplicates
# List the sources left out as already archived
canon cluster generate --where 'source.ext|lowercase=jpg' --dest /Volumes/Archive --show-archived
Two files: the manifest (.toml), which you edit, and the lock file (.lock), which apply uses as written. The manifest opens in $VISUAL, $EDITOR or vi unless --no-edit is given. -O writes it at the destination.
Typical workflow:
canon cluster generate --where 'source.ext|lowercase IN (jpg, png, heic)' --dest /Volumes/Archive
# Edit the pattern in the editor that opens
canon apply manifest.toml --dry-run # Preview
canon apply manifest.toml # Execute
Output:
Generated manifest: manifest.toml (6 sources in manifest.lock)
From 2 roots:
/Volumes/Drive1 (4)
/Volumes/Drive2 (2)
6 have no archived copy
Time zone: Europe/Amsterdam, recorded in the manifest's zone line.
To apply: canon apply manifest.toml
Empty files are never skipped as already archived: the manifest takes them with their directory.
The manifest
# Canon manifest — edit pattern and Notes freely.
# To change the query, edit it here then run: canon cluster refresh <manifest>
# zone: the time zone for times in the query and in directory names.
# Edit it, or delete it to take this machine's, then run: canon cluster refresh <manifest>
# Other fields are managed by Canon — do not edit.
#
# === Cluster Summary ===
# 4 sources
# From 1 root:
# /Volumes/Drive1 (4)
# 4 have no archived copy
# === Notes ===
#
[meta]
version = 2
query = ["source.ext|lowercase IN (jpg, png, heic)"]
scope = ["/Volumes/Drive1/photos"]
zone = "Europe/Amsterdam"
generated_at = "2026-11-01T14:15:19Z"
lock_hash = "f1577a6513197dd510a0d7f113692d9a3f82c1d82196384ca7051ee2606e1405"
[options]
allow = []
[output]
pattern = "{scope.rel_path}"
archive_root_id = 3
base_dir = ""
# Keys the 4 selected sources share, for use in the pattern:
# ...
| Field | What it holds | An edit takes effect |
|---|---|---|
meta.version | The manifest format version | Managed by Canon |
meta.query | The filters | At the next refresh |
meta.scope | The paths the selection was scoped to; no such line when unscoped | At the next refresh; apply takes the scope from the lock |
meta.zone | The time zone for dates, in the query and in directory names | At the next refresh; apply uses the lock’s |
meta.generated_at | When the manifest was generated | Managed by Canon |
meta.lock_hash | The lock file’s hash; empty when a refresh selected nothing | Managed by Canon |
options.allow | The --allow values given. A refresh reads them all; apply reads only duplicates | At the next command that reads it |
output.pattern | Where files go below base_dir. Starts at {scope.rel_path} for a scoped generation and {source.rel_path} otherwise: files keep the directory structure they were found in | At the next apply |
output.base_dir | The destination’s directory inside the archive root | At the next apply |
output.archive_root_id | The destination archive root | Managed by Canon |
The Cluster Summary is rewritten on each refresh; Notes are kept.
To copy a filter into query, paste it between ''' and ''': query = ['''filename="a%b.jpg"'''].
Pattern syntax: Pattern Expressions. Examples: Common Patterns.
Year directories: a second manifest can take the sources whose time is known only to the year:
query = ["content.DateTimeOriginal|year? AND NOT content.DateTimeOriginal|month?"]
pattern = "{content.DateTimeOriginal|year}/{filename}"
cluster refresh
# Re-query and update the lock file
canon cluster refresh manifest.toml
# Edit the manifest first, then re-query from what was saved
canon cluster refresh --edit manifest.toml
Re-runs the manifest’s query and rewrites the lock file. [options] and [output] stay as they are.
A refresh leaves out sources on suspended roots.
The manifest’s time zone
A time with an offset, or a file’s save time, can fall on a different date in another zone. The manifest records the time zone in its zone line and the lock file records it too, so a manifest puts files in the same directories on any machine.
cluster generate: records this machine’s zonecluster refresh: selects in the zone line’s time zone and writes it into the lockapplyandcluster status: use the lock’s time zone, never this machine’s
A changed zone can change which sources a time query selects, and the refresh says so.
cluster status
The state of a manifest, and its next step.
Manifest: manifest.toml
Destination: /Volumes/Archive
Pattern: {content.Make}/{content.Taken|month}/{filename}
Lock: 6 entries
Time zone: Europe/Amsterdam (the lock's)
3 of 6 entries have no destination:
2 sources: {content.Make} has no value
1 source: {content.Taken|month} has no value: the time is known only to the year
/Volumes/Photos/2016/IMG_0001.jpg
/Volumes/Photos/2016/IMG_0003.jpg
/Volumes/Photos/2016/IMG_0002.jpg
Summary: 0 at destination, 3 pending, 3 with no destination computable, 0 source files missing.
Adjust the pattern in your manifest, or import the missing facts; or add "content.Make?" to the manifest's query to leave such sources out, then run `canon cluster refresh manifest.toml`.
`canon facts` shows which sources have these facts
Use a coarser modifier in the pattern, which takes effect at the next apply; or add "content.Taken|month?" to the manifest's query to leave such sources out, then run `canon cluster refresh manifest.toml`.
NOT CONFIRMED is a file of the right size that the index does not record at its destination. canon apply --resume compares it with the lock.
canon apply
Copies or moves files into the archive as a manifest specifies, and registers them, so no scan is needed.
# Preview what would happen
canon apply manifest.toml --dry-run
# Copy files (default mode, preserves mtime/permissions on Unix)
canon apply manifest.toml
# Show per-file progress during transfer
canon apply manifest.toml --verbose
# Rename files instead of copying
canon apply manifest.toml --rename
# Move files
canon apply manifest.toml --move
# Only apply sources from specific roots
canon apply manifest.toml --root id:1 --root id:2
canon apply manifest.toml --root path:/path/to/source
# Allow duplicates within the destination archive
canon apply manifest.toml --allow duplicates
# Allow duplicates across archives (but not within destination)
canon apply manifest.toml --allow cross-archive-duplicates
Transfer modes:
| Flag | Behavior |
|---|---|
| (default) | Copy + preserve mtime/permissions (Unix) |
--rename | Atomic rename; fails if cross-device (Unix only) |
--move | Try rename; fallback to copy+delete on cross-device (Unix only) |
No mode overwrites: if a destination file exists, apply aborts with an error.
A --move to another volume confirms each copy before it removes the origin, so it takes longer per file on a network volume.
For --rename and --move, the confirmation summary shows which source roots will lose files:
Mode: rename (sources will be relocated)
Files: 150
Sources from:
/Volumes/Drive1 (100 files)
/Volumes/Drive2 (50 files)
The manifest’s field table says which edits apply reads.
Resume mode (--resume):
Continues an interrupted apply, checking what is at each destination:
- Recorded: left alone
- Right size, not recorded: compared with the lock’s hash. A match is recorded; a difference stops the run
- Wrong size: stops the run
- Absent: transferred
# Resume an interrupted apply
canon apply manifest.toml --resume
# Preview what --resume would do
canon apply manifest.toml --resume --dry-run
Stopping a run (Ctrl-C):
The first Ctrl-C stops the run after the current file, and --resume finishes the work. The second ends the process at once, and that run writes no receipt.
Root filtering:
--root applies only the manifest’s sources on the roots you name (root specs).
apply checks every source and destination before it transfers anything, and stops with nothing moved if a check fails. --dry-run does not see a file changed since the last scan; a real run does.
Provenance
Every apply is recorded as a decision, with a receipt under the archive root’s .canon-ledger/. Without --reason, the manifest’s # === Notes === section is the reason.
Maintenance
Commands for cleaning up and maintaining Canon’s database.
facts delete, facts convert and prune change data in the database (never on disk)
and are dry-run by default; use --yes to execute. ledger reindex writes by default;
use --dry-run to preview instead.
facts delete: remove incorrect or unwanted metadatafacts convert: change a key’s typeprune: clean up stale, orphaned, or excluded dataledger reindex: rebuild the extraction ledger from receipts on disk
canon facts delete
Delete the facts of a key you do not want. To change a key’s type instead, use facts convert.
# Preview deletion (dry-run by default)
canon facts delete content.mime --on object
canon facts delete content.Make --on source /path/to/photos --where 'source.ext=jpg'
# Execute deletion
canon facts delete content.mime --on object --yes
$ canon facts delete Make --on object
Would delete 2 content.Make facts across 2 objects, held by 5 sources (3 in source roots, 2 in archives; 1 of them on suspended roots)
$ canon facts delete Make --on source
No content.Make facts on matching sources; 2 on objects (--on object)
--on(required):sourcefor facts stored on the matching sources,objectfor facts stored on their content. A fact stored on the content is deleted for every copy of it, archive copies and copies on suspended roots included- The key: a name with no prefix is a
content.key, socanon facts delete sizedeletescontent.size --value-type: delete only the facts of that type (text,numberortime)- Matching sources: the ones
canon lslists at the same scope. Excluded sources are not among them. Archive copies are among them only when the scope is inside an archive root
canon facts convert
Shows what a stored key holds, and converts it to text, a number or a time.
canon facts convert content.DateTimeOriginal # what it holds, what it can become (read-only)
canon facts convert content.DateTimeOriginal --to time # preview (dry run by default)
canon facts convert content.DateTimeOriginal --to time --list # one line per lost or removed fact and source
canon facts convert content.DateTimeOriginal --to time --allow removal=2 --yes \
--reason "the tool wrote dates as text"
| Flag | Effect |
|---|---|
--to <type> | The type to convert to: text, number or time. Without it, the command shows what the key holds |
--list | One line per lost or removed fact and source, tab-separated |
-0, --null | With --list: fields separated by a NUL, each record ended by one |
--allow loss=N, --allow removal=N | Accept the cost the preview states |
--yes | Convert (default is a dry run) |
--reason <why> | Attach a reason to the decision record |
A conversion takes no paths and no --where: it converts every fact of the key, on every root, suspended roots included.
What a Key Holds
$ canon facts convert DateTimeOriginal
content.DateTimeOriginal (whole index, read-only)
Type: text
Holds:
text 5 facts, the value of 5 sources: 4 counted by `canon facts --global`, 1 on a suspended root
most frequent: "0000:00:00 00:00:00" ×2 facts, "2021:03:02 18:44:10" ×1 fact, "2021:03:02 18:50:00" ×1 fact
`canon facts --key content.DateTimeOriginal --global --limit 0` to see the values `canon facts` counts
Can convert to:
time the 5 text facts: 3 unchanged, 2 removed
`|datetime` asks for these values as times without changing anything stored
number the 5 text facts: 5 removed
most of these are not numbers — text on purpose? `|number` asks for these values as numbers without changing anything stored
`canon facts convert content.DateTimeOriginal --to time` to preview
`canon facts convert content.DateTimeOriginal --to number` to preview
The Preview
$ canon facts convert DateTimeOriginal --to time
content.DateTimeOriginal → time (whole index, dry run): 5 text facts, the value of 5 sources — 1 of them not counted by `canon facts --global`: 1 on a suspended root
unchanged 3 spelling only, e.g. 2021:03:02 18:44:10 → 2021-03-02T18:44:10
removed 2
"0000:00:00 00:00:00" is not a time: ×2 facts, the value of 2 sources: 1 counted by `canon facts --global`, 1 on suspended root /path/to/backup (id:2)
After changing the type, the lost and removed values cannot be reimported as your tool wrote them until this key's type is converted back.
After: untyped dates imported for this key are stored as times.
Aliases naming this key: @taken.
Manifests whose naming pattern uses this key place files by the new values at their next apply.
`canon facts convert content.DateTimeOriginal --to time --list` to see each fact with its source (not kept after)
`canon facts convert content.DateTimeOriginal --to time --allow removal=2 --yes` to convert
add --reason '<why>' to record why
Dry run: nothing changed.
Every fact falls in one class:
| Class | Meaning | Needs |
|---|---|---|
| unchanged | The same value; a change of spelling only | nothing |
| lossy | Converts, but loses something the value carried | --allow loss=N |
| removed | Cannot be converted to the target type | --allow removal=N |
Text to time (How Canon interprets a time):
| Stored text | Class |
|---|---|
2024:07:23 11:06:32, 2024-07-23T11:06:32+02:00, 2024-07-23T09:06:32Z, 2024:07:23 11:06:32.45 | unchanged |
2024-07-23, 2024-07, 2024, 2024-07-23 11:06 | unchanged, at its own precision |
0000:00:00 00:00:00, 2024-02-30, misc, 1690000000 | removed |
Text to number:
| Stored text | Class | Becomes |
|---|---|---|
12, 2.5, 1e5 | unchanged | 12, 2.5, 100000 |
2.50 | lossy (a trailing decimal zero) | 2.5 |
01234 | lossy (a leading zero) | 1234 |
14.2.1, misc | removed |
Any type to text is always unchanged: a number in its shortest spelling, a time in the spelling worklist --emit writes.
$ canon facts convert DateTimeOriginal --to time --list
removed 0000:00:00 00:00:00 /path/to/photos/c.jpg
removed 0000:00:00 00:00:00 /path/to/backup/d.jpg suspended
Converting
--yes converts, all or nothing. Give each lossy and removed count as the preview shows it:
$ canon facts convert DateTimeOriginal --to time --allow removal=2 --yes --reason "the tool wrote dates as text"
content.DateTimeOriginal → time: 3 unchanged, 2 removed
whole index: 5 text facts, the value of 5 sources — 1 of them not counted by `canon facts --global`: 1 on a suspended root
removed: "0000:00:00 00:00:00" ×2 facts
content.DateTimeOriginal is of type time.
`canon trail show 5` to read this conversion later
After the Conversion
Converting back restores every unchanged value, though not always its original spelling. Lost and removed values come back by importing them again.
canon prune
Clean up orphaned or stale data from the database.
# Preview stale facts (stored on a source whose file changed since the fact was recorded)
canon prune --stale-facts
# Preview orphaned objects (no present sources reference them)
canon prune --orphaned-objects
# Preview facts stored on excluded sources and on excluded content
canon prune --excluded-facts
canon prune --excluded-facts=source # Only facts stored on excluded sources
canon prune --excluded-facts=object # Only facts stored on excluded content
# Execute deletion
canon prune --stale-facts --yes
canon prune --orphaned-objects --yes
canon prune --excluded-facts --yes
Orphaned objects are content entries with no remaining present sources, which can happen when files are deleted. They can serve as a historical record; pruning deletes them along with their facts and their non-present sources.
canon ledger reindex
Rebuild the extraction ledger from apply receipts already on disk. The ledger is the index behind the canon trail lines showing what went out.
# Preview what would be indexed
canon ledger reindex --dry-run
# Rebuild
canon ledger reindex
When to run it
Run it after restoring a database from an older backup, because recent apply decisions may be missing their extraction rows.
It changes only the extraction ledger, and the report is the only record of the run.
What it does
reindex reads the receipt of every apply decision and aggregates its items into extraction rows the way a live apply does. It rebuilds a decision’s rows only for the roots the decision archived from that are still indexed, so a root added later is never recorded as the origin of an earlier decision’s files, even at the same path. The exception is a decision recorded before the extraction ledger existed: it has no record of its roots, so its receipt is matched by path against the roots indexed now.
A decision it does not index is reported under one of these labels:
- skipped (roots removed or retired): every root the decision archived from has been removed or retired; its rows stay as they were
- no receipt: the decision records no receipt location (
--no-receipt, receipts off for that run, or a receipt whose write never completed) - unreachable: a receipt was recorded, but its root is gone or offline or the file is missing; retried on the next run
- malformed: the receipt fails an integrity check (bad TOML, a decision id that doesn’t match); skipped
$ canon ledger reindex
Ledger reindex: extraction index
Scanned 3 apply decisions.
indexed: 1 decisions (1 rows)
already current: 0
no receipt: 1
#7 --no-receipt
unreachable: 1
#8 receipt file missing: /Volumes/Archive/.canon-ledger/2016/000008-apply.toml
malformed: 0
Unreachable receipts are retried on the next run.
Exit status
Exits nonzero only when no decision was indexed, already current or skipped.
Facts Reference
Facts are key-value metadata. See the overview and key names.
Namespaces
| Namespace | Description |
|---|---|
source.* | Source facts: taken from what the scanner records (path, size, mtime) |
content.* | Content facts: imported (EXIF, mime type), and the content hash |
Values
The value types. Only the path source facts have the type path:
| Type | Examples |
|---|---|
| Text | Apple, image/jpeg, "2019" |
| Number | 1024, 3.14, -5, 1e6 |
| Time | 2024-07-23 14:30:45, 2024-07, 2024 |
| Path | source.rel_path |
Modifiers
Transform values using | syntax:
Time Modifiers
Time modifiers work on time values (like source.mtime or EXIF dates) and on text written as a time. Each works in your local time. The examples use the time 2024-07-23 14:30:45:
| Modifier | Gives | Prints | In a filter | Needs a time known to the |
|---|---|---|---|---|
year | A number | 2024 | |year=2024 | year |
month | A number, 1–12 | 07 | |month=7 or 07 | month |
day | A number, 1–31 | 23 | |day=23 | day |
hour | A number, 0–23 | 14 | |hour>=14 | minute |
minute | A number, 0–59 | 30 | |minute=30 | minute |
second | A number, 0–59 | 45 | |second=45 | second |
date | A day | 2024-07-23 | |date=2024-07-23 | day |
time | A time of day, at the time’s own precision | 14:30:45 | |time>=18:00 | minute |
datetime | The time, at its own precision | 2024-07-23 14:30:45 | |datetime="2024-07-23 14:30" | year |
yearmonth | A month | 2024-07 | |yearmonth=2024-07 | month |
week | A number, the ISO week 1–53 | 30 | |week=30 | day |
weekday | A number, 1–7 from Monday | Tuesday | |weekday=2 or Tuesday | day |
quarter | A number, 1–4 | Q3 | |quarter=3 or Q3 | month |
A time coarser than the last column has no value for that modifier (Precision).
String Modifiers
These work on text and paths, and on the printed form of another modifier’s result (Chaining).
| Modifier | Description | Example |
|---|---|---|
lowercase | Convert to lowercase | JPG → jpg |
uppercase | Convert to uppercase | jpg → JPG |
capitalize | Capitalize the first letter, the rest lower case; on a path, each name | apple → Apple, my photos/IMG.JPG → My photos/Img.jpg |
stem | Filename without extension | photo.jpg → photo |
ext | File extension; a name with none (README, .bashrc, trail.) has no value | photo.jpg → jpg |
short | First 8 characters | abc123def456 → abc123de |
Numeric Modifiers
| Modifier | Takes | Gives |
|---|---|---|
number | Text, as a number; a number, as itself | A number. Text that is not a number has no value |
bucket | A number from 0 up | A range label: 0, then powers of ten, 1-to-10, 10-to-100, 1K-to-10K, 0.00001-to-0.0001. A number below zero has no value |
bucket(a,b,c) | Any number, negative ones included | A range label: under-a, a-to-b, b-to-c, c-and-up, a number below zero written with minus- (|bucket(-90,0,90) gives under-minus-90, minus-90-to-0, 0-to-90, 90-and-up) |
A range includes its lower edge and not its upper: 1K-to-10K holds 1,000 up to 9,999, since K is 1,000, M 1,000,000 and G 1,000,000,000. A label is compared with =, != and IN, and typed the way Canon shows it (source.size|bucket(1e6)=1000000-and-up).
Path Accessors
Python-style indexing for path values, and for text, which an accessor splits into path segments (content.SourceFile[-1]):
| Syntax | Meaning |
|---|---|
key[-1] | Last segment (filename) |
key[0] | First segment |
key[1:3] | Slice segments 1 and 2 |
key[:-1] | All but last segment |
An index past the end has no value; a slice past the end is a path with no segments.
source.rel_path[-1] → IMG_001.jpg
source.rel_path[-1]|stem → IMG_001
source.rel_path[0] → photos
Source Facts and Built-in Keys
These keys need no enrichment. hash, hash_short and the content hash have a value once Canon has hashed the source.
Source Facts
Source facts come from what the scanner records. The set is fixed.
| Key | Type | Description |
|---|---|---|
source.ext | text | File extension (no dot); no value for a file with none (README, .bashrc, trail.) |
source.size | number | File size in bytes |
source.mtime | time | File modification time |
source.path | path | Full absolute path |
source.rel_path | path | Path relative to the root |
source.root | path | Root path (hidden) |
source.id | number | Source database ID (hidden) |
source.device | number | Device ID (hidden) |
source.inode | number | Inode number (hidden) |
canon facts shows the hidden ones with --all.
Built-in Keys
Short names for values used often.
| Key | Type | Value |
|---|---|---|
filename | text | The last path component |
stem | text | The file name without its extension |
ext | text | The same as source.ext |
size | number | The same as source.size |
mtime | time | The same as source.mtime |
id | number | The same as source.id |
root_id | number | The ID of the source’s root |
hash | text | The content hash, content.hash.sha256 |
hash_short | text | The first 8 characters of the content hash |
A name that is a built-in key refers to that key in --where, --key, --group-by, worklist --emit and a pattern. A content fact imported under such a name (size, filename, id) is stored as content.size and so on, and a filter reaches it only by that full name.
The Content Hash
| Key | Type | Description |
|---|---|---|
content.hash.sha256 | text | SHA-256 content hash, recorded when Canon hashes a source |
In a Pattern
{hash}, {hash_short} and {content.hash.sha256} use the content hash the lock file recorded for the source. Patterns also have {scope.rel_path}, which no filter has.
Filter Syntax
The language of --where: boolean expressions over facts that select sources. Several --where flags combine with AND.
Operators
Basic
| Syntax | Meaning |
|---|---|
key? | Fact has a value; for a key with modifiers, the modified value (content.DateTimeOriginal|month? is false for a time known only to a year) |
key=value | Fact equals value (case-sensitive); for a time, the value falls within the time you typed (2024-06 is all of June 2024) |
key!=value | Everything key=value does not select (no value included) |
key~glob | Glob match on text and paths (case-sensitive); see Globs |
key!~glob | Everything key~glob does not select (no value included) |
key>value | Greater than; for a time, starts at or after the end of the time you typed |
key>=value | Greater or equal; for a time, starts at or after the start of the time you typed |
key<value | Less than; for a time, ends by the start of the time you typed |
key<=value | Less or equal; for a time, ends by the end of the time you typed |
key IN (v1, v2, ...) | Fact matches any value in list |
key NOT IN (v1, v2, ...) | Everything key IN (...) does not select (no value included) |
Times compare as spans of time in your local time (see Times), and text in character order, so B sorts before a and 10 before 9.
Globs
After ~ and !~ the value is a glob:
| Glob | Meaning |
|---|---|
* | Any run of characters, / included, or none |
? | One visible character |
[abc] | One character from the set |
[a-z] | One character in the range |
[!abc] or [^abc] | One character not in the set |
"…" or '…' | The quoted text itself, joined to the text beside it |
A space outside quotes ends a glob, and a set cannot hold one. A glob with no wildcard or set matches the whole value.
# Files starting with IMG_
--where 'filename~IMG_*'
# Files in a year subdirectory
--where 'source.rel_path~*/2024/*'
# Names holding [2024]
--where 'filename~*"[2024]"*'
# A directory name with a space
--where 'source.rel_path~*/"My Pictures"/*'
Without quotes a glob holds what a plain value holds (see Quoting) and * ? [ ]. Any other character needs quotes around its part, with * ? [ ] left outside them:
A quote mark inside a glob starts quoted text. To match an apostrophe, quote it with the other mark: filename~*"'"*.
Boolean Operators
| Syntax | Meaning |
|---|---|
expr AND expr | Both conditions must match |
expr OR expr | Either condition matches |
NOT expr | Negates the condition |
(expr) | Grouping for precedence |
Operator precedence (highest to lowest): NOT, AND, OR.
AND, OR, NOT, IN and NOT IN are written in capitals.
Quoting
A value can be written without quotes when it holds only letters and digits, of any language, and _ . - / : +: filename=照片1.jpg, source.size>-5, source.mtime>=2024-06-15. Any other character needs quotes, a space included: content.Model="EOS 5D".
A key name needs quotes for different characters, depending on where it is written:
- In a filter: anything but letters, digits and
_ . : / -.content.XMP-dc:Subjectneeds none;"content.File Size"needs them. - In
--keyand--group-by:|and[, and a,in--group-by.content.File Sizeneeds none;"content.a|b"needs them. - In a pattern’s
{…}:|,[and}.{content.Camera Model}needs none;{'content.a|b'}needs them.
Outside a filter, a name that does not start with a letter or _ needs quotes too: "5 Stars".
A value or a key that needs quotes is written in double or single quotes, and that mark inside is doubled.
In a shell, wrap the whole filter in single quotes and use double quotes inside it:
--where 'content.Title="say ""hi"""' # the title: say "hi"
--where 'content.Title="it'\''s"' # the title: it's
--where '"content.File Size">1000000' # a key with a space
--where '"content.File Size"|bucket(1e6)=1000000-and-up'
Values and Types
Every key has a type. A value you type is interpreted as the key’s type before anything runs.
| Key type | A value you type is interpreted as |
|---|---|
| Number | A number: 1024, -5, 3.14, 1e6. Quoted or bare, the same number |
| Time | A year, a month, a day, a minute, a second or a point within a second, in your local time. See Times |
| Text | Text, exactly as typed |
| Path | Text, compared with the path |
Text and path keys: a bare value that looks like a number, a time or a time of day (2019, 2024-06-15, 18:00) gives an error. Quoted, it is text. To ask a number or a date question of text, say so with a modifier: content.numtext|number>=10, content.textdate|year=2024. Anything else is text without quotes: IMG_0001.jpg, 2024-06-15_beach.jpg.
Numbers are compared exactly: content.Rating=0.3 selects a stored 0.3 and not a value that only rounds to it.
Text is compared exactly as stored: an accented letter stored as one character and the same letter stored as a letter plus an accent mark are two different texts. A path typed as an argument is found in either form.
A key of mixed type, whose facts hold more than one type, cannot be compared or modified.
Times
A time covers a span in your local time, as wide as its precision: 2024 is the whole of that year, 2024-06 that month, "2024-06-15 14:30" that minute.
A comparison selects a stored time when its whole span satisfies the operator. With 2024-06 as the time you type, a stored time is:
- Inside that span:
=selects it.2024-06-15is=2024-06. - Before or after it:
<or>selects it.2024-05-31is<2024-06, and2024-07-01is>2024-06. - Coarser than it:
!=andNOTselect it, like a source with no value.2024is in none of=2024-06,<2024-06and>2024-06.
| You type | Selects the same as |
|---|---|
source.mtime=2024 | source.mtime|year=2024 |
source.mtime=2024-06 | source.mtime|yearmonth=2024-06 |
source.mtime=2024-06-15 | source.mtime|date=2024-06-15 |
A time with an offset is translated to your local time.
A time, typed or imported, is written like this:
- A date is
YYYY-MM-DD, orYYYY:MM:DDas EXIF writes it; a month isYYYY-MM; a year isYYYY. - A time of day follows the date after
Tor one space, asHH:MMorHH:MM:SS, with up to nine digits of a fraction of a second (14:30:05.45). - An offset follows the time directly or after one space, as
Zor±HH:MM.
Anything else is not a time.
No Value
!=, !~, NOT IN and NOT all select sources with no value. To leave them out, ask for a value as well:
--where 'content.DateTimeOriginal!=2024 AND content.DateTimeOriginal?'
What an Acting Command States
A command that acts on a --where selection (exclude set, exclude clear, exclude duplicates, exclude set-object, cluster generate, cluster refresh, facts delete) states this under the number of sources it acts on:
Would exclude 2,140 sources:
of which 312 have no Make
12 sources have a time that spans 2024-06 (coarser than a month): 9 not selected, 3 selected
The lines show under --yes too, and stay in the decision’s summary, which canon trail show shows.
Status Predicates
Status predicates check computed state.
| Predicate | True when |
|---|---|
archived? | Content exists in at least one archive root |
hashed? | Content hash has been computed |
excluded? | Source or object is excluded |
enriched? | Has any stored metadata beyond the content hash |
Status predicates are written in lower case and take only ?.
# What still needs archiving?
canon facts --key mime --where 'NOT archived?'
# Survey unresolved content
canon survey --where 'NOT archived?'
# Unidentified files
canon worklist --where 'NOT hashed?'
# Combine status predicates with fact filters
canon ls --where 'NOT archived? AND hashed? AND mime~image/*'
# View excluded sources (requires --include)
canon ls --include excluded --where 'excluded?'
NOT archived? includes unhashed sources; NOT archived? AND hashed? leaves them out.
Aliases
An alias is a named expression in $CANON_HOME/aliases.toml (by default ~/.canon/aliases.toml), which you use as @name. An alias replaces a whole condition or a key: in --where, and in facts --key and --group-by.
Filter Aliases
The value is one whole filter:
image = "source.ext IN (jpg, png, heic)"
recent = "source.mtime|year >= 2020"
large = "source.size > 10000000"
A filter alias combines with AND, OR, NOT and parentheses, and nothing else may follow it.
Key Aliases
The value is one key, followed by nothing else:
filename = "source.rel_path[-1]"
parent = "source.rel_path[-2]"
year = "source.mtime|year"
taken = "content.DateTimeOriginal"
A key alias takes the same operators and modifiers as a key, and an accessor only where its value is a key name alone.
Using Aliases
# A filter alias on its own
canon ls --where '@image'
# Combine filter aliases
canon ls --where '@image AND @recent'
# A key alias with a glob, a modifier
canon ls --where '@filename~IMG_*'
canon ls --where '@taken|year=2024'
# Negate a filter alias
canon ls --where 'NOT @large'
The Aliases File
A name starts with a letter, then letters, digits, _ and -, in any language.
A manifest’s query takes no alias: cluster generate writes what each alias stands for into the query.
Using Modifiers
See Facts for the complete list and what each gives, and Expressions for chaining. In a manifest’s query a time modifier works in the manifest’s time zone.
# Files from 2024
--where 'source.mtime|year=2024'
# Case-insensitive extension matching
--where 'source.ext|lowercase=jpg'
# Case-insensitive glob
--where 'filename|lowercase~img_*'
# Common image formats
--where 'source.ext|lowercase IN (jpg, png, gif, webp)'
# iPhone photos
--where 'Make=Apple'
# Large images (combining with parentheses)
--where '(source.ext|lowercase=jpg OR source.ext|lowercase=png) AND source.size>1000000'
Pattern Expressions
The pattern field of a cluster manifest: where a file ends up in the archive, built from facts with {expr}.
Basic Syntax
Patterns consist of literal path segments and expressions in curly braces:
{content.DateTimeOriginal|year}/{content.DateTimeOriginal|month}/{filename}
This produces paths like: 2024/07/IMG_001.jpg
Fact Keys
Any fact key can be used in a pattern. Key names follow the same rules as in --where, except that a name with a space needs no quotes: {content.Camera Model}. An alias cannot be used in a pattern.
{scope.rel_path}
The source’s path relative to its scope.
The path starts at a base directory, which depends on the scopes the manifest records in the source’s root:
- One directory: that directory. Scope
photos, sourcephotos/2024/a.jpg:2024/a.jpg. - Several scopes: the deepest directory they share, so each scope’s name stays in the path. Scopes
photosandvideos, same source:photos/2024/a.jpg. - One file: the directory the file is in, so only the filename remains. Scope
photos/2024/a.jpg:a.jpg.
Each root has its own base.
cluster generate and cluster refresh work out the value and record it in the lock file, and apply uses what was recorded. With no scope recorded it has no value, and there is no fallback destination.
Modifiers
Transform values using the | syntax. See Facts for the complete list.
{source.mtime|year} → 2024
{source.mtime|yearmonth} → 2024-07
{content.hash.sha256|short} → a1b2c3d4
{source.ext|uppercase} → JPG
A time with no modifier:
{content.DateTimeOriginal} → 2024-06-15 14:30:05
{content.DateTimeOriginal} → 2024 (a time known only to the year)
A pattern uses the time zone recorded in the lock.
A time with a time of day, bare or through |datetime or |time, writes : into the directory or file name. exFAT, FAT32 and NTFS volumes and SMB shares do not allow : in a name; for an archive on such storage, use |date, |yearmonth or |year.
Chaining
{filename|stem|lowercase} → img_001
{source.mtime|weekday|lowercase} → monday
A text modifier after another modifier works on the value as Canon shows it: |weekday shows Monday, so |weekday|lowercase gives monday.
Path Accessors
Path accessors work the same way in a pattern and in a filter. With source.rel_path = "photos/2024/vacation/IMG_001.jpg":
{source.rel_path[-1]} → IMG_001.jpg
{source.rel_path[1:-1]} → 2024/vacation
{source.rel_path[-1]|stem} → IMG_001
Built-in Keys
Built-in keys work the same way in a pattern and in a filter:
{hash_short}_{filename} → a1b2c3d4_IMG_001.jpg
{hash|short} → a1b2c3d4
{ext|lowercase} → jpg
Where a Value Ends Up
What a {…} makes is decided by the type of its value:
- A path (
{source.rel_path},{scope.rel_path}, an accessor[a:b]) makes one directory per segment. - A path with no segments makes no directory, and the
/joining it to the rest goes with it:{source.rel_path[:-1]}/{filename}puts a file at the top of its root directly in the destination. - Any other value makes exactly one directory or file name, in its printed form.
Common Patterns
# Preserve structure below the scopes declared in the manifest
pattern = "{scope.rel_path}"
# Preserve structure below each source's root
pattern = "{source.rel_path}"
# Flat (all files in one directory)
pattern = "{filename}"
# By EXIF capture date
pattern = "{content.DateTimeOriginal|year}/{content.DateTimeOriginal|month}/{filename}"
# By date with hash prefix (collision-safe)
pattern = "{content.DateTimeOriginal|date}/{hash_short}_{filename}"
# By camera
pattern = "{content.Make}/{content.Model}/{filename}"
# By file type and year
pattern = "{source.ext|lowercase}/{source.mtime|year}/{filename}"
The Book Format
When a root is retired, its complete story is compiled
into the book: a directory of plain text in stable formats, readable with ls
and a text editor. This page is the format contract.
A book directory contains:
photos-backup-2026-08-02/
├── README.md the human entry point — start here
├── story.md the story as told, written at the retirement
├── inventory.jsonl every source the root ever had, with fates
├── timeline.md every decision that touched the root, with reasons
├── notes.md the notes, bound beside the timeline
├── ledger/ the receipts that lived on the drive (absent when it kept none)
└── meta.toml identity, account, counts, gaps — machine-readable
README.md
The summary for a person: the root’s identity (path, role, comment, scan history, the retirement reason), the resolution account, the verification posture, a guide to the other files, and the gaps, meaning anything this book should hold but doesn’t.
It names story.md as the place to start, and gives the mapping from the story’s plain
words to Canon’s own:
| In the story | In Canon |
|---|---|
| chosen for the archive | archived |
| let go | excluded |
| preserved by copies in the archive | covered |
| no known copy in the archive | unresolved |
| empty file | contentless |
| returned to consideration | restored |
It also states the time zone the book’s dates are in:
Dates in this book's text — this file, story.md, timeline.md, notes.md — and
in this folder's name are in this time zone: Europe/Amsterdam. The times in
inventory.jsonl and meta.toml are in UTC.
story.md
The story that canon roots story tells, written for someone with no Canon
and no memory of the place.
The page runs in a fixed order:
- An opening that orients the reader: what this document is, its date, and the time
zone its dates are in (
Its dates are in this time zone: Europe/Amsterdam.). - A short explanation of how to read the entries.
- The places, in full.
- A tally of where everything went.
- The gaps, stated in prose: what was left open on purpose.
- A last page.
Retirement asks for a foreword: your own words about the whole root, written
verbatim above Canon’s text. It also offers the entire page to your editor before
the book is written. A page edited by hand is marked in meta.toml (hand_edited).
inventory.jsonl
One JSON object per line, one line per source, sorted by path. Fields:
| Field | Presence | Meaning |
|---|---|---|
path | always | Path relative to the root |
size | always | Bytes |
mtime | usually | The file’s save time, ISO 8601 in UTC with Z (2015-06-12T09:30:00Z; a year before 0000 in ISO 8601’s expanded form), or the stored number of seconds since 1970, as text, for a save time beyond the instants Canon can hold; absent only on entries recovered from receipts that record no mtime |
hash | where known | Content hash with algorithm prefix (sha256:…) |
fate | always | What happened to this source; see the vocabulary below |
decision | where recorded | The decision record behind the fate: for archived, the apply; for excluded/deleted, the action that set it; otherwise the source’s most recent recorded transition. Cross-references the timeline’s #N and the NNNNNN-command.toml receipt filenames, in the gathered ledger/ for drive-local receipts and in the archive’s live ledger for apply and exclusion receipts |
verification | always | content_verified (hashed) or name_only (listed by name, never content-verified) |
disposition | archived only | moved or copied; absent when the record does not state which: omitted, never guessed |
destination | archived only | The recorded destination of the apply, readable without Canon |
locations | where known | Archive paths holding this content at compile time (destination is what the apply recorded). Zero-byte sources have no locations |
reason | where recorded | The user’s reason for the exclusion or deletion |
Fate vocabulary
archived— archived from here: an apply receipt names this path as an origin. Has the recordeddestinationand, where known, currentlocations. Entries for sources moved into the archive are recovered from the apply receipts.covered— content verified present in the archive (by hash), archived from elsewhere, or archived from here when no receipt survives to say so (recorded as a gap).excluded— consciously dismissed, with the recorded reason. When the content is also archived, the archive locations appear too.deleted— a scan observed the loss; the recorded reason where present.present— present at retirement, with none of the above recorded.contentless— empty at retirement (zero bytes).missing_unexplained— absent without a recorded deletion.
timeline.md
Every action that touched the root, with its summary as Canon printed it at the time and the user’s reason. Global actions are counted at the end, not listed. The retirement itself is absent; a prior attempt that wrote a book but did not remove the root is listed.
notes.md
Every note on the root, oldest first, with its location.
ledger/
The receipts that lived on the drive itself: the root’s own .canon-ledger/, copied
verbatim with filenames and timestamps preserved. A source root’s ledger only ever
holds deletion receipts. The receipts of archiving and exclusion
live in the archive’s own ledger (.canon-ledger/ at the archive root), and the book
points there.
If the drive kept no receipts or was unreachable at compile time, there is no
ledger/ directory, and the README says so.
meta.toml
The machine-readable half, version = 1:
gaps— every gap: unreadable receipts, a ledger that could not be copied, and so on. An empty list asserts that nothing this book should hold is missing from it.zone— the time zone the book’s prose dates and directory name are in, the same text the retirement decision records (the time zone a decision uses).[identity]— path,root_id(the root’s number in the index that bound the book; that index never gives one number to two roots), role, comment, suspension,first_indexed(when the earliest remaining source was first indexed), last scan,compiled_at, the user’s reason,decision_id(the id the trail and the index use for the retirement that wrote this book; absent when the retirement ran with recording off: omitted, never guessed), and the Canon version that wrote the book.[account]— the resolution account in counts: the story so far (archived files and bytes with the moved/copied split, deleted, unexplained missing) and the standing at binding (archived_standing, the files still here that anapplychose: named in its receipt or, where it left no receipt, under a directory it archived from;covered,excluded,contentless,unresolved). Bytes and derived totals are omitted, never guessed, when the record cannot support them.[posture]—scan_verifiedoron_faith(with the reason: suspended, unreachable, or never scanned) and the last scan time.[counts]— entry totals per fate. Before any removal, Canon recounts the inventory and compares it with them.[ledger]— whether the drive-local ledger was copied (gathered), and how many files.[story]— its file (story.md), whether it was edited by hand (hand_edited), and the settings that shaped it. Verification requires the file to exist and hold text.
Versioning
version in meta.toml identifies the format. This page describes version 1. Fields
may be added within a version; existing fields keep their meaning. A book bound before
a field was added lacks it and verifies unchanged: zone, root_id, [story] with
story.md, and the contentless fate, whose count is taken as zero and whose empty files such a book
lists as covered. Verifying a book of a newer version than Canon knows fails with an
error. The book itself stays readable either way.