A digital prayer wheel.
A prayer wheel is a drum that holds written prayers. Turning the drum carries every prayer in it round once, and the tradition counts that turn as the prayers said. prayer-wheel draws on the prayer wheel of Tibetan Buddhism, which carries the mantra Om Mani Padme Hum, and this repository's starter wheel holds that mantra. You can turn the starter wheel, or begin with a wheel of your own; either is a good first step.
prayer-wheel does the same for prayers held as files. You keep a wheel: a directory of prayers, with a manifest that puts them in sequence. The program turns that wheel around the clock, one prayer after another, reading each file whole, and counts the revolutions. It is light enough to run in the background of any workstation or server all day; What it costs gives the measured figures.
starter/
is a wheel that holds one prayer, Om Mani Padme Hum, in Tibetan script,
as the Degé Kangyur gives it. The install's first answer sets it
turning; Install says how. From a clone, it turns
with:
cargo run --release -- turn --wheel starter --state ~/.local/state/prayer-wheel/starterThe starter wheel keeps a count of its own, so that it never adds to the count of your own wheel or contends for its lock.
starter/docs/sources.md
says where its text comes from, how it was checked, and why the starter
wheel holds this prayer alone. The prayers of other traditions are left
to their keepers: add the prayers of your own practice to a wheel of
your own.
Make a directory for the wheel and add your prayers to it, one file each, with the name you give each prayer:
mkdir ~/wheel
prayer-wheel add --wheel ~/wheel ~/drawing.png "Still Water & Stone"
prayer-wheel add --wheel ~/wheel ~/morning.txt "Morning Light"
prayer-wheel turn --wheel ~/wheeladd copies the file into the wheel, names the copy by
its hash, and puts the prayer at the end of the sequence.
turn runs until it is stopped. A prayer can be any file.
Small files such as text and images suit a wheel best; a larger file
works too, and costs more to turn.
Every command but install and uninstall
takes the wheel from --wheel <dir>, else from the
variable PRAYER_WHEEL, else the current directory;
install takes it only from its question or its options.
prayer-wheel --help lists the commands and options.
prayer-wheel install sets prayer-wheel up and stays
until the wheel has turned. It asks two questions, which wheel turns and
how, and each has a default: the starter wheel, turning always, from
boot, as a systemd user service. For a wheel inside a Git clone it also
offers to pull the clone every 15 minutes. It never needs root, and it
refuses to run as root.
prayer-wheel installEvery question has an option that answers it, so a run given all of
them asks nothing; prayer-wheel install --help lists them.
The install checks everything before it changes anything, so a run that
stops at a check leaves the machine as it found it, and running it again
never writes over a wheel or a count. It ends by naming where things
live:
~/.local/bin/prayer-wheel;~/.config/systemd/user/, each opening
with a line that marks it as the install's;~/.local/share/prayer-wheel/starter;~/.local/state/prayer-wheel/starter, any other wheel's at
~/.local/state/prayer-wheel/state.The XDG variables move these, as they do for other programs.
prayer-wheel uninstall asks once, then stops and removes
the units the install wrote and the program. It keeps every wheel and
every count, and names where they are; it leaves lingering as it is.
prayer-wheel is one static binary for x86-64 Linux, built from source
with Rust 1.89 or later. With rustup, the repository's
rust-toolchain.toml brings the pinned toolchain and the
musl target the build names; a Rust installed another way needs that
target installed for it first:
rad clone rad:z3V6mdzcLjXgLXF8PJ9e7HXZFkLJw && cd prayer-wheel
cargo build --release --locked --target x86_64-unknown-linux-musl
target/x86_64-unknown-linux-musl/release/prayer-wheel installThe binary needs nothing installed beneath it, so the one file can be
copied to any x86-64 Linux machine and run there. On an aarch64 machine,
such as a small board, build for aarch64-unknown-linux-musl
in the same way, after
rustup target add aarch64-unknown-linux-musl. Only Linux is
built and tested; other Unix systems are untested, and Windows is not
supported.
A wheel is a plain directory, which you can read, edit, copy and keep in a repository of your own:
wheel/
manifest
9f2c…a1.png
47be…0d.txt
docs/
manifest is the manifest.docs/.A prayer's hash is its identity. A renamed prayer is the same prayer; a prayer with one byte changed is a different prayer.
The manifest is a UTF-8 text file with one prayer on each line, its hash, two spaces and its written name:
9f2c…a1 Morning Light
47be…0d Still Water & Stone
A prayer's number is the position of its line, counted from 0. Every line is a prayer: there are no comments and no blank lines. No hash and no name appears twice. A name is not empty, neither begins nor ends with a space, and holds no control character. Lines end with a line feed alone; a file saved with Windows line endings is at fault on every line.
The manifest is the wheel. Its order is the order the prayers turn
in, and nothing about the filesystem can change it. To remove, rename or
reorder a prayer, edit the manifest by hand.
prayer-wheel check then tells you whether the manifest and
the directory are in step: it reports a line it cannot read, a listed
prayer whose file is missing or does not match its hash, and a file that
no line lists. It changes nothing.
prayer-wheel turn passes one prayer per beat. It reads
the prayer's file from its first byte to its last, in pieces, and checks
the bytes against the prayer's hash. A prayer has turned when its file
was read whole and matched. After each prayer the wheel rests one beat,
one second unless --beat says otherwise, as
--beat 500ms, --beat 2s,
--beat 5m or --beat 1h.
A circuit is one pass through the manifest, from prayer 0 to the last. When every prayer in a circuit turned, the circuit is a revolution and the count rises by one. A prayer that is missing or does not match breaks its circuit, which is not counted; the wheel still takes that prayer's beat and goes on. A manifest at fault turns nothing until it is mended. The wheel reads the manifest afresh at the start of each circuit, so a prayer you add joins the next one.
The count is kept outside the wheel, in a file of two lines:
revolutions 20417
last 2026-11-21T19:59:00Z
last is when the latest revolution completed, in UTC.
The file is --state <file>, else the variable
PRAYER_WHEEL_STATE, else
$XDG_STATE_HOME/prayer-wheel/state, else
~/.local/state/prayer-wheel/state, and it must lie outside
the wheel. Each machine keeps its own count. The wheel saves the first
revolution at once and then at most once a minute, so a crash can lose
about a minute of revolutions and never records one that did not happen.
Only one turn runs on a state file at a time.
The interrupt or terminate signal stops turn promptly;
it saves the count and exits with status 0. Its log, on standard error,
has a line when it starts, when a fault appears or clears, and when it
stops, and names prayers by number, never by name.
check exits with 1 when it finds a fault, and
add with 1 when it refuses. Every command exits with 2 when
it cannot run, as with a usage error, a wheel directory it cannot read,
a state file it cannot understand, or a lock already held: a state file
another turn holds, or a wheel another add is
at work on.
Your prayers and their names are yours. Keep your wheel somewhere private, not in a public repository.
If you keep your wheel in Git, store its files exactly as they are.
Git can rewrite the line endings of a file it takes for text, which
changes the file's bytes and so its hash. Put a
.gitattributes file holding this line at the top of the
wheel:
* -text
prayer-wheel is published on Radicle, and a private Radicle repository might seem a natural home for a wheel. It is not one yet: by Radicle's disclosure of 23 September 2026, no version of Radicle released by 21 November 2026 keeps a private repository confidential on the network. A private Git repository on a host of your own, reached over SSH, is.
prayer-wheel install sets the service up, and the pull
for a wheel kept in Git. To set them up by hand instead, contrib/systemd/
holds the same units as examples, for a wheel at ~/wheel,
its count at ~/.local/state/prayer-wheel/state and the
binary at ~/.local/bin/prayer-wheel; change those paths to
yours.
prayer-wheel.service runs
prayer-wheel turn at the lowest processor and disk priority
(the disk setting takes effect only where the disk's scheduler honors
it). It restarts after a failure, but not after exit status 2: a wheel
that cannot start, as when its state file cannot be understood, stays
stopped and shows as failed, instead of restarting forever on a machine
nobody is watching. To turn from boot without a login, enable lingering
with loginctl enable-linger "$USER".prayer-wheel-pull.service and
prayer-wheel-pull.timer are for a wheel kept in a Git
repository. Every 15 minutes the service pulls the clone, fast-forward
only, at the lowest priority, in the clone's top directory, its
WorkingDirectory=. The wheel may be a subdirectory of the
clone: the last word of ExecStart= names it. When the pull
has brought a change, it runs prayer-wheel check and fails
when the wheel is out of step, so that a bad change shows among the
machine's failed units. It discards everything Git and
check print, which can name prayers, files and hosts, and
leaves one line in the journal when it fails; run git pull
and prayer-wheel check in the wheel at a terminal to see
why.mkdir -p ~/.config/systemd/user
cp contrib/systemd/prayer-wheel* ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now prayer-wheel.service prayer-wheel-pull.timerprayer-wheel does not sync. One way to keep a wheel turning on
several machines is a private Git repository that they all reach over
SSH, a clone on each machine, and the units above on each. Adding a
prayer is then a pull, prayer-wheel add, a commit and a
push, and the prayer turns on the other machines within about a quarter
of an hour. Two adds made on two machines that are not yet in step
conflict in the manifest, as they would in any Git repository; resolve
that by hand, since it is a choice of sequence.
A wheel that stops counting raises no alarm: a manifest at fault or a missing prayer leaves the process running, and its log says so once. To look:
last line is recent while the wheel
turns. The count is saved at most once a minute, so last
can be a minute behind, and more by the time a revolution takes (the
number of prayers times the beat, and a little more). A
last older than both together means that circuits are
broken or nothing is turning.prayer-wheel check says why.On each beat the wheel passes one prayer. A pass costs in proportion to the file's size, so a wheel of text and small images costs little processor time, however many prayers it holds: the wheel measured below averaged about 0.13 milliseconds of it each second. The wheel holds one 64 KiB piece of a file at a time, so its memory does not grow with the size of a prayer; it grows with the number of prayers, by a few hundred bytes and the length of the name for each. It writes one small file at most once a minute. It reads each prayer once per revolution, usually from the operating system's cache on a machine with memory to spare; on a busy machine, passing large files can push other programs' data out of that cache.
Measured on 2026-11-22, on an AMD Ryzen 5 3600 6-Core Processor: a static binary of version 0.1.0 built before its release, turning a made-up wheel of 300 prayers (250 files of 2 KiB and 50 of 200 KiB, 10500 KiB of prayers and 11024 KiB on disk with the manifest) at the default beat for one hour, peaked at 816 KiB of resident memory and used 0.47 seconds of processor time in the hour. The machine was a virtual machine of 10 processors on that processor, shared with other builds throughout the hour.
MIT; see LICENSE.