Undo
Every file operation in fialr is logged to an append-only audit ledger. The undo system reads this ledger to reverse operations — moving files back to their original locations, clearing provenance metadata, and logging the reversal. Dry-run is default. No file moves without explicit confirmation.
How it works
Section titled “How it works”fialr tracks three pieces of provenance for every file operation:
- Operations table — the SQLite audit ledger records source path, destination path, operation type, and job UUID for every move, rename, and archive
- XATTRs —
original_nameandoriginal_pathare stamped on every file before it is moved or renamed - Paths table — the
is_currentflag tracks which path is the file’s current location
The undo system uses all three to reconstruct and execute the reverse operation.
Reversible operations
Section titled “Reversible operations”| Operation | Reversal |
|---|---|
| Move | File moved back to original path |
| Rename | File renamed to original name |
| Archive (vault) | File rehydrated from vault to original path |
Enrichment metadata changes, classification assignments, and deduplication groupings are not reversible via undo.
Conflict detection
Section titled “Conflict detection”Before executing any reversal, fialr checks for three conflict types:
| Conflict | Cause | Resolution |
|---|---|---|
file_exists | Another file occupies the original path | Skip (default) or overwrite with --force |
dir_missing | Original parent directory was deleted | Skip (default) or force creates directory with --force |
file_modified | File content changed since the operation | Skip (default) or force moves current version with --force |
Conflicts are always surfaced in the dry-run preview. With --force, all conflicts are overridden. Without --force, conflicting operations are skipped and reported.
Preview before undoing
Section titled “Preview before undoing”Always preview first. The default mode is dry-run:
# Show the last 10 reversible operationsfialr undo --last 10
# Preview undo for a specific jobfialr undo --job 2026-03-11_organize_a1b2c3d4Execute the undo
Section titled “Execute the undo”Add --execute to apply the reversal:
# Undo the last 5 operationsfialr undo --last 5 --execute
# Undo a specific jobfialr undo --job 2026-03-11_organize_a1b2c3d4 --execute
# Force through conflictsfialr undo --last 5 --execute --forceUndo specific operations
Section titled “Undo specific operations”Target individual operations by UUID:
fialr undo --op abc123 def456 --executeWhat happens during undo
Section titled “What happens during undo”For each operation being reversed:
- Source file verified at current location (BLAKE3 hash check)
- Conflict check at original location
- File moved back to original path
original_nameandoriginal_pathXATTRs clearedpathstable updated (is_currentflags flipped)- Reverse operation logged to
operationstable
Every reversal is itself logged. The audit ledger remains append-only — undo does not delete the original operation record.
See also
Section titled “See also”- undo CLI reference — full command documentation
- Job Execution Model — how operations are tracked
- organize — the primary source of reversible operations