a local audio daemon
rift is one process, kept running by launchd,
that will turn the sound its devices hear into an append-only log of which words were said when,
and play back what it is given. Today: one instance, its socket, the event log, and the stream,
every connected device's sound on one clock, kept on disk for a window, then archived. A device
plays a file or, on macOS, hears a microphone or plays what it is given; on a Mac one ear and
one mouth stand beside the daemon, each a launchd job of its own, the ear
idle until the ears are on and the mouth until it is given a play, run from one path and signed
by an identity of rift's own, so the microphone is asked for once and the grant holds across
upgrades.
Today
- One instance. An exclusive
flockheld for the process's life; a secondserveis refused and logged. - The socket. A unix socket in a 0700 directory the daemon checks is this user's,
speaking NDJSON: a hello with a protocol number, then
health,quiet,feed,shutdownand the stream's ops; errors are typed codes (the protocol). - The event log.
events.ndjson, the durable state beside the audio: each event appended whole before any client hears of it. A restart re-derives everything from it, a torn last line cut off. - The stream. Below: devices, tracks, one clock, segments, holes, a window, an archive, readers.
- The feed. A connection replays the log from a position and stays live, one gapless sequence; a client that falls 1024 events behind is dropped and resumes from its last position.
- Quiet. One switch, logged as an event, kept across restarts: on, it hushes every play and refuses new ones (the mouth).
- A clean stop. SIGTERM, SIGINT, SIGHUP and the shutdown request drain alike:
stop accepting, hush each play, close the open segments, log
stop, end the feeds, cut open connections after a budget that fits launchd's kill timeout, exit 0.
The stream
Mechanical: it carries sound onto one timeline and keeps it a while, and decides nothing about what the sound is. The wire is the protocol's.
audio/ for the archive, or are deleted when none is set.- Devices. A device is a client of the socket, never inside the daemon: it says it is an ear (what it hears) or a mouth (what it plays, as played) and its name, answers the daemon's clock pings, and streams 20 ms frames stamped on its own clock.
- One clock. The daemon measures each device's offset by ping on connect and again as it streams, and places every frame on its own timeline; events carry that time.
- On disk. Each track's frames append to 10 s segments, each closed one an event; a gap is a hole event and writes nothing. After a kill the next boot cuts a torn segment to whole frames and closes it: a restart loses at most the frames not yet written.
- The ears. One switch opens and closes the stream, kept across restarts; closed, devices stay connected and are told, and their frames are refused.
- Window and archive. A window (default 600 s) and an optional archive directory, both kept; a closed segment older than the window moves to the archive with an index line, or is deleted with none. Nothing deletes from the archive.
- Readers. A range read streams from disk with silence for holes; a live follow gets each frame as it is placed, within a frame plus transit.
The microphone
rift device ear <name> --mic [<microphone>], macOS only
(CoreAudio through cpal, capture alone: no echo cancelling, no voice processing). On Linux it
exits 2 saying so.
- Which input. Alone,
--micfollows the system's default input, listed every$RIFT_POLL_MS; a change closes the microphone and opens the new default. With a name it holds that input, matched exactly, and never follows the default. A Bluetooth default (CoreAudio's transport type, Bluetooth or Bluetooth LE) is not opened: opening a headset's microphone puts it in call mode, degrading all it plays while the ears are on, so the unpinned ear hears the Mac's built-in input instead, its segments naming it, and the rule is applied again at every change of the default, with the usual hole and new name; a Mac with no built-in input hears the Bluetooth default rather than nothing. Each such choice is one stderr line, said when it starts. A pinned name is opened whatever its transport. An input not present (the named one, or no default at all) is one stderr line listing the inputs present, then a wait: it opens when the input appears, and closes when it goes, or falls silent a poll long and opens afresh. Two devices, each pinned, record two microphones on two tracks at once. - Open only while the ears are. The microphone opens when the ears open and closes when they close, so the system's recording indicator shows exactly when rift hears.
- One microphone a segment. Every frame names its microphone; a change closes
the open segment, and the next opens with a hole and carries the new name, as do its
segmentevent and the archive's index line. The recorded audio separates by microphone with no guessing (the protocol). - Conversion. Channel 0 of whatever the input delivers (a sum of channels would cancel or clip), through a Hann-windowed sinc low-pass under 7 kHz, a millisecond each side, then read at 16 kHz between the filtered samples; 16-bit, 20 ms frames from its first sample other than exact zero, stamped by the sample count and rebased only when that strays over 100 ms from the time the frame was captured, which is audio really missing. That time is the buffer's handover less every sample still pending, so a buffer handed over late in one piece, by a busy machine, misses nothing, and a write held up by a busy daemon delays frames, never moves them. Pings are answered as they arrive, on the thread that reads them.
- A withheld grant is said, never fatal. Under launchd an ungranted
microphone either blocks the open while macOS's prompt waits or delivers exact zeros with no
error. An open past
$RIFT_OPEN_MS(10 s) is named and waited on: Allow returns it and recording starts. Exact zeros for$RIFT_ZERO_MS(2 s) after an open, an input silent a poll long and a refused open (rift device: "<microphone>": <cause>) close it; the next open waits$RIFT_POLL_MS(1 s), doubled per failure in a row to 64 s. Zeros are never sent, so an unheard input is a hole, not silence on disk. Each line, naming System Settings › Privacy & Security › Microphone where the grant is the cause, is said once until the input is heard; the ears close and open throughout. - It stands. Nothing ends the device but a stop signal: a connection that
ends (
{"code":"unknown","ok":false}) and a daemon that is down ({"code":"down","ok":false}) or refuses it are each waited out a poll, then it connects again, so it never spins; the microphone is closed meanwhile. A refusal (another protocol, a track held:taken) is also one stderr line, said once per code until it connects, the wait doubled per refusal in a row to 64 polls. SIGTERM, SIGINT and SIGHUP end it at once wherever it waits, exit 0, one stderr line (rift device: stopped by SIGTERM); the daemon closes its open segment as the connection goes. - The standing ear. On a Mac,
rift setupinstallsdev.gigantic.rift.earbeside the daemon:rift device ear <host> --micrun from its fixed copy,<host>the Mac's local host name (scutil --get LocalHostName, set in Sharing and never renamed by a network) lowercased, so its track,ear-<host>, is the Mac's for good; renaming the Mac starts a new track at the next setup. It follows the default input by the rule above, holds no microphone while the ears are off, and shows among the devices ofrift status. To opt out,launchctl disable gui/$(id -u)/dev.gigantic.rift.ear: setup then writes its plist and leaves it unloaded.
Identity
macOS grants the microphone to a program outside an app bundle by its
path, and checks the program's code signature against the grant: a new path is asked again,
and so is a new signature at the same path. The microphone's grant belongs to the standing
ear's program, ~/.local/libexec/rift/rift, one path every release
shares, signed by a certificate of rift's own, so it is asked for once. A
rift device ear --mic run by hand from a terminal is the terminal's
to grant, not rift's.
- The ear's fixed copy. Each release lives at its own path under hotswap
(
~/.local/share/hotswap/rift/<version>/rift), which an upgrade changes and the prune deletes, so the ear never runs from there (observed 2026-11-26: an upgrade, same identity, was asked again for the new path). Once the release is signed, setup copies it to~/.local/libexec/rift/rift, outside hotswap's tree and namedrift, the name System Settings shows, by a temp file renamed over it so a running ear keeps the file it mapped; when the copy is already the release byte for byte it is left as it is. The daemon opens no microphone and runs from the link. - The Info.plist. Linked into the binary on macOS
(
__TEXT,__info_plist):CFBundleIdentifierdev.gigantic.rift,CFBundleNameriftand the sentence the microphone's prompt shows. - What setup makes, once. After hotswap links the release and before the
daemon is loaded or swapped: a password in
<root>/rift.keychain-pass(0600), a keychain<root>/rift.keychain-dbwith no lock timeout and none at sleep, kept off the search list, and in it a self-signed code-signing certificate,CN=rift, RSA 2048, 100 years, its key usable bycodesignwith no prompt. Each run unlocks the keychain (a reboot locks it), the password file read without a trailing newline, and signs the release itself, the file behindcurrent, with identifierdev.gigantic.rift, unless that identity already signed it: a copy beside it is signed, then renamed over it, so a running rift keeps the file it mapped. Each tool call has$RIFT_SIGN_MS; one that would ask at the screen is killed and named, and a failure isrift setup: <line>, exit 1, before the daemon is touched. - A new signature, a fresh load. macOS checks a launch agent's program
against the signature it last recorded for it, and updates that record only after a launch:
a kickstart onto a re-signed release was refused, and the job stayed refused through every
later kickstart, while a bootout then a bootstrap started it at once. So a run that re-signs
the release reloads the agent instead of kickstarting it, and so does an agent loaded at
login: it carries a managed launch constraint (
launchctl printsaysmanaged LWCR) that a swap invalidates and a kickstart keeps, while a bootstrap loads it without one. Any load not ready within$RIFT_RELOAD_MSis reloaded once more before setup gives up. The ear's job is always loaded afresh: booted out before the daemon is touched, loaded once the new daemon answers ready, and ready once that daemon lists its track. A track another device already holds there is said in a line, the ear loaded to take it over once that one leaves, with no wait; a failure is named and exits 1 with the daemon serving. - What
--removedeletes. The keychain and its password file, as files, and the ear's copy; the root is left. The nextsetupmakes a new certificate, so the microphone is asked for again.
The mouth
rift device mouth <name> --speaker, macOS only (CoreAudio through cpal; on Linux it exits 2 saying
so): it plays what rift is given for its track, and its track holds only what its output took,
when it took it. The wire is the protocol's plays.
- Which output. The system's default output, listed as the mouth connects and every
$RIFT_POLL_MSafter, opened by its name when a play's first give arrives and closed$RIFT_LINGER_MS(10 s) after it last took a play's sample, so back-to-back plays share one open and an idle mouth holds no output; what the first play after idle pays for the open is unmeasured. A change of the default closes it and opens the new one, what is queued kept; an output that goes with no default left is one stderr line and a wait, the play queued and its giver paced, until one appears or, past$RIFT_STALL_MS, the stall rule ends the play. An output that fails while it stays listed (cpal pauses its stream on a rate change, a Bluetooth profile's switch or a device lost: anything but a glitch) ends its open; a glitch (CoreAudio's processor overload, an I/O cycle the output missed, heard as a click) plays on, counted on the output's thread and said on stderr by the open's own every 100 ms, as"<output>" glitched (<n>)once an open has one, then whenever its count has at least doubled; the mouth says so, closes it as above and opens it again a poll on, a refused open retried as any. Each output its frames name,speaker, as an ear's name their microphone. - The callback copies, nothing more. The output's callback takes samples the
loop already converted to the output's rate, each with its position among the given samples,
out of a queue bounded at a quarter second, and records each sample it renders, silence
included, with its position and when it sounds, into a buffer whose capacity never grows: no
allocation, no JSON, no socket. The two share one mutex, which each side holds only for that
copy, the loop converting, accounting, cutting and writing outside it: a ring free of locks
would need
unsafe, which is forbidden, or a crate the tree does not have. A hush drops the converted queue and the given samples alike. - Conversion. Audio is given 16-bit mono at a stated rate, 8 to 48 kHz, and
converted once, in the mouth, to the output's rate: each output sample a Kaiser-windowed
(β 9, its stopband about 90 dB down) sinc interpolation of the given samples around its
position, 32 each side; into a faster output cut at 0.475 of the given rate, into a slower
one 0.045 of the given rate short of the output's Nyquist, where the stopband then begins, so
nothing past it folds back (a 48 kHz play into 16 kHz is cut at about 5.8 kHz). Its taps
are precomputed at 256 phases between two samples once a play and output and read between
the two nearest; the nth output sample since the output opened sits at the play's
position then plus n × given rate / output rate, one division, so no rounding adds
up. A tone given at 16 or 24 kHz to a 44.1 or 48 kHz output comes out at 89 dB SINAD or more
as 16 bits, their own floor, flat within 0.01 dB to 10 kHz of 24; at 24 kHz into 16 kHz, a
tone just past 8 kHz 90 dB down where the 0.475 cut let it fold back at −25 dB (measured
2026-11-27 · tones of 300 Hz to 10 kHz, a replica of the interpolator matched to the fake
output's samples;
fidelityin the suite holds 85 dB and the fold-back silent). Then written to every channel; no gain, the system's volume alone. Audio is not narrowed before it is played. The track is then made from what the output took, by the ear's own converter to 16 kHz. - Where audio waits. In the mouth alone: the daemon passes each give on as it
reads it and holds none, and withholds the give's reply while the mouth holds
$RIFT_AHEAD_MS(200) or more of it untaken, so a giver faster than real time is paced by its replies and the mouth holds at most that plus one give (16 KiB). A hush drops that queue in one place; a queue in the daemon would still need the mouth's dropped, and would be memory a restart loses either way. A run begins on a cushion: with nothing converted queued, as a play starts or once its mouth has run dry, the mouth waits until it holds$RIFT_LEAD_MS(100) past the interpolation's reach, or the play has ended, or its output has played that long of silence since it held some, counted in the output's own samples (so the wait is a value, and begins only once the output is open: a slow open adds to it, though a giver paced at$RIFT_AHEAD_MSthrough the open has given the cushion by then), then plays; a giver faster than real time but jittery, a speech engine giving 80 ms frames as it makes them, is heard whole, where a run begun on its first frame ran dry after it (measured 2026-11-27 · the fake output, 80 ms gives 75 to 95 ms apart: three runs before, one after). A mouth run dry plays silence, its position held; a giver slower than real time is heard in runs, each begun on that cushion, so in fewer, longer pauses rather than a stutter every give. A run's start, thesoundevent's, is when it began. The last 32 samples wait for the play'send, which the interpolation needs, so anendheld up past what the mouth holds splits off a run of them; the last sample stands for what is past it, so a play run to its end counts every given sample played. The daemon's queue to the mouth is the mouth's alone; one full, a mouth not reading, is dropped as a slow feed is and its play ends. A play given nothing ends at once at itsendor its hush; a give after either is refused and the mouth ignores one for a play it has ended. A mouth that owes progress (a giver's pause owes none) and reports none, counted from its last report, give orend, for$RIFT_STALL_MS(15 s) has its play endedmouthand its giver answered. - Stamping. From the output's callback: this device's clock in the callback
plus the latency cpal reports for it (the I/O buffer plus CoreAudio's device latency and safety
offset), so a sample's time is when it sounds, never when it was given. A run's start is its
first sample's; its track's frames are cut on one 20 ms grid from the open, stamped by sample
count and rebased past 100 ms as an ear's, and sent once each has sounded. A frame with none of
a play's samples is not sent, so the silence between plays is a hole, logged at the next play's
first frame. The frame holding a play's last sample is filled with silence and queued as the
play ends, and the mouth says
doneonly once it is sent, so the daemon closes the mouth's open segment atdoneand no segment is left open across the silence to outlive the window;done, and with it the hush's reply, waits for that frame to sound, up to 20 ms plus the output's latency, while the ears are open. - One play per mouth. A second giver is refused
busy: a queue would sound it after whatever it answered had moved on, with no bound on the wait, and replacing would let two givers cut each other unseen. Refused, the giver chooses:hushthenplayreplaces, a retry after theplayedevent queues. A mouth not connected isabsent, refused at once rather than held for it. - Hush, quiet and the ears.
rift hush <track>ends one mouth's play at once: the mouth drops its queue, and what the callback already took still sounds and is counted played.rift quiet onis the standing switch over every mouth: it hushes each open play (reasonquiet) and refuses new ones until off; off resumes nothing. The ears switch only the recording: closed, a mouth plays on and sends no frames. - A giver that leaves. Its play is hushed (
left): a play's tail sounds only once its giver vouched for it withend, and what that drops is at most what the mouth held.rift playstopped by a signal ends this way, at once. One that leaves afterendleaves its play to play out. A giver whose reply is withheld is seen to leave once the mouth takes enough to answer it, or a hush or the stall rule ends the play. - It stands. As the ear: a connection that ends or a daemon that is down is
waited out a poll, a refusal said once on stderr, the wait doubled to 64 polls, and SIGTERM,
SIGINT or SIGHUP the only exit. Its connection gone, it drops what it holds at once: nothing
can log it. A daemon whose device reply lacks
"plays":true, an older release, is one stderr line naming it and the fix, then waited out as a refusal. - The standing mouth.
rift setupinstallsdev.gigantic.rift.mouthbeside the ear:rift device mouth <host> --speakerfrom a copy of its own,~/.local/libexec/rift/mouth, a path no setup older than the mouth writes (the ear's stays where its microphone grant is), so a rollback orupgrade --backleaves the mouth on a release that knows it, idling on an older daemon with its backoff and its cappedmouth.err, never an older program respawning.<host>is the ear's, so its track ismouth-<host>;KeepAlive. Booted out with the ear before the daemon is touched, its copy and plist written only once the daemon and the ear are good, then loaded afresh and ready when the daemon lists its track, its held and disabled lines the ear's; a failure from that write on boots it out and removes plist and copy before exit 1, so a failed setup leaves nothing of the mouth.
| latency | bounded by | expected | measured by |
|---|---|---|---|
| given → sounding | the hop to the daemon and on to the mouth (under a millisecond each), the wait for the output's next callback (one I/O period, 10.7 ms at 512 frames and 48 kHz), then the output's latency; on an output not yet open, its open; and, when the first give holds less than $RIFT_LEAD_MS past the interpolator's 32 samples and no end follows, up to that lead (100 ms) of the output's own samples after its open | for a first give holding the lead (2432 samples at 24 kHz, 100 ms and the reach), about 45 ms on the built-in speakers with the output open, about 90 ms when it must reopen (observed 2026-11-26, silent run); the first play after the mouth starts waited 2.1 s, inside the first open, past the listing (unverified 2026-11-26 · cpal's first stream or its first reported latency, the device's to tell); Bluetooth adds its own, 100 to 300 ms (unverified 2026-11-26 · not yet measured) | the play event's t against its first sound's start; on a Mac, the ear's track hearing the speakers |
| hush → silence | the hop to the mouth (the pipe to it holds at most what it queues, read as it arrives), the drop, one I/O period, then what the output already holds, its latency; never $RIFT_AHEAD_MS, since the queue is dropped, not drained | under 25 ms on built-in speakers; on Bluetooth, its latency, which nothing above the output can recall | the hush reply's time against the last sound's end (start + samples / rate); on a Mac, where sound stops in the ear's track |
| failure mid-play | what happens | on disk after |
|---|---|---|
| the mouth dies | its queue goes with it; the play ends mouth at its last report, launchd respawns it, nothing resumes | every run up to the last report, short by at most 20 ms plus the output's latency |
| the daemon drains | each play hushed in turn inside $RIFT_DRAIN_MS, one not answered by then ended at its last report, each logged stop before stop; the mouth drops its queue as the connection goes | all of it |
| the daemon is killed | the mouth drops its queue as the connection goes; each giver's ends with an unknown outcome | the play and its closed runs; the next boot logs played lost, the run under way not derivable but from the mouth's frames, when the ears were open |
| the output vanishes | its queue kept; the next default opened, playing on with a new run, begun on its lead as any, a hole and the new speaker in the track; no output, a wait and a paced giver, ended mouth by the stall rule past $RIFT_STALL_MS | all of it; samples the old output took and had not sounded count as played |
| the output fails, still listed | its open ended, said, opened again a poll on, playing on with a new run; stuck past $RIFT_STALL_MS, the play ended mouth | all of it, as above |
| the giver disconnects | before end, hushed, left; after it, played out | all of it |
- The wire's cost. Gives are JSON lines, the audio as hex like every frame, so a message stays one line every tool can read: at 48 kHz, 96 KB of audio a second is 192 KB of hex in about six gives of 16 KiB, crossing the socket twice (to the daemon, on to the mouth), about 390 KB/s, against an ear's 64 KB/s; the daemon checks the hex and copies the text without decoding it. Base64 would save a third of that and break the one encoding; binary framing would break the one line.
- The fake output.
$RIFT_SPEAKER, as$RIFT_MICfor inputs: a directory whosedefaultnames the default output; each file underoutputs/an output holding<rate> <channels> <latency ms>orfail(an open refused, or an open one failing as its file comes to say so), unlisted when the file goes; it takes in real time, a late tick 40 ms at most and the rest skipped as a device's late callback skips it, and with atakefile never past the output samples it names, in all for this connection, the time held there passing, so a test, not the clock, decides how far a play gets; every sample taken appended toheard/<output>and an open and close line per open tolog. The cpal calls live insrc/speaker.rs, exempt from coverage assrc/mic.rsis; queueing, conversion, stamping, hush and the default's following aresrc/mouth.rs, covered. - The suite's cases.
plays, the suite on the socket as both giver and mouth: the refusals and bad requests, pacing (a give's reply withheld until the mouth reports), runs, a hush, a play to its end and its segment closed atdone, a giver gone before and afterend, a mouth gone, one that never answers a hush, quiet, the drain and a kill (lost, the next boot's).mouth, against the fake output: a play to its end at 16, 24 and 48 kHz into 48 and 44.1 kHz outputs, the same tone at the same level inheard;rift playto its end and stopped by a signal; an empty play ended at itsendand at its hush;rift hushat a settake, itsplayedchecked against the positions the fake's own record says it took, the give after it refused and uncounted, nothing but silence taken after; a giver that stalls (runs split, holes); the default changed mid-play; no output, then a refused one; an output failing mid-play and recovering; the linger; the ears closed; the drain; an older daemon; a split tail cut before itsdone; a stop signal.stuck: an output taking nothing, ended by the stall rule; a giver paused past it owing nothing, open still.setup: the plist, disabled, held, ready, an ear failing (the mouth not touched), a mouth failing (nothing of it left),--remove. - Deterministic on a slow runner. Every step waits on what it can observe (a
feed line, a log line, a count in
heard) under the suite's bounds, never on a sleep; how far a play gets istake's, never the machine's speed; runs are checked contiguous and summing to what played, never counted, since a busy machine may run a mouth dry; a hush's count and a dry spell are read from the levels inheard, never its length; onlystuckruns the stall rule, since a starved mouth may report nothing for seconds; a time is asserted only as a bound read around the act, the 1 s cut as at least 1 s. - Known limits. Samples an output took and had not sounded when it is lost
count as played, up to one output latency. A play starting within 20 ms of the last loses up to
20 ms of the mouth's own track. A killed daemon's
lostcounts only its logged runs. Two outputs of one name are one to the mouth, the first listed opened. - Checked on a Mac, by hand. Each rate through the built-in speakers, with no
click at a give and none at a run; given → sounding and hush → silence, by the ear hearing the
speakers, and whether cpal's reported latency matches, there and on a Bluetooth headset; the
default moved between speakers, wired and Bluetooth mid-play, and a headset unplugged; what the
first play after idle pays for the open; the job under launchd from its own copy, asking
nothing; sleep and wake mid-play; the output's rate changed in Audio MIDI Setup mid-play and a
Bluetooth headset switching profile, each seen as a failed output and reopened; no glitch from
the callback's mutex under load (no
glitchedline inmouth.err); a play by ear against the same file through the fake output thenafplay, which parts conversion from the device; a muted output, whose taken samples still count as played; a rollback (rift upgrade --backonto the release before the mouth) leaving the mouth idle with its log capped.
The path
The audio path, in the order sound crosses it, part built. Every stage writes its results to the same log, so a client reads the sound as events.
| stage | what it does |
|---|---|
| ① devices | clients of the socket, each an ear or a mouth; built: a file player and, on macOS, the microphone (rift device), and, on macOS, the mouth, each standing as a launchd job of its own that every setup installs; one on another machine is a later protocol |
| ② one stream | built: every track on the daemon's clock, so a moment means the same instant on every track (the stream) |
| ③ voices | built: the talkers kind, its join to turns and its reference engine. Who spoke when, voices speaking at once included, each an enrolled voice's label with a score of evidence (null when not identified), the label holding across the stream, or a number for one not enrolled, by a talkers engine |
| ④ words | the track's speech transcribed to words, each word with its start and end on that clock, by engines: echo, then turn and words; a client joins words to voices by time |
| ⑤ playback | built: audio a client gives played on a mouth, hushed at once, a play's runs logged in the giver's own sample count; designed: text a client gives spoken by a speech engine |
Engines
Built through slice 11; the clean track (slice 12) designed. The work that reads sound (the echo stage, voice and turns, words) and the work that makes it (speech) are engines: programs on rift's socket, each of one kind on one track, swapped while the daemon runs. Models come and go; the daemon, its clock, its log and its checks stay. The wire is the protocol's engines.
| kind | reads | reports | first engine |
|---|---|---|---|
| echo | an ear's frames live, every mouth's runs | masks of the ear; later, a clean track | tail, in rift: masks each run as it sounds, plus a tail |
| speech | a mouth's says, text in pieces | a play of the audio, marks of the text sounded | read-aloud: Pocket TTS |
| talkers | an ear's ruled frames, or a clean track's, and the turn engine's turns | who spoke when: settled spans, each voice an enrolled label with a score of evidence (null when not identified), or a number | diarize: LS-EEND, then WeSpeaker against the enrolled voices |
| turn | an ear's ruled frames, or a clean track's | voice starts and stops, turns | endpoint: Silero VAD, then Smart Turn at each close |
| words | the same frames, and the turn engine's turns | partial and final words, each timed | transcribe: Moonshine v2 |
- A process on the socket, never compiled in. Swapping one is a job's restart, not a release; it may be written in any language with a JSON line reader, Python included; its crash, its memory and its model load are its own, so the stream, the ears and the mouths never notice one leave.
- One connection, one kind, one track. A program serving two ears opens two connections and may share one loaded model across them, so the wire stays per track and the memory is the engine's choice.
- One engine per kind per track, a second refused
taken. Two words engines on one track would put two truths in the log with no rule between them, as two devices on one track would; comparing engines is done on a second track or offline, by reading the same audio. - A result is a claim, its form checked, never its truth. Any process of the
socket's user may take a free kind's slot (before its job starts, during a respawn or a swap)
and report what it likes under a
nameof its own choosing, so a label, a transcript, a turn or a mask is the word of whichever process held the slot. The boundary is same-user access to the 0700 socket directory; within it a client can see a change of engine, theengineevents and theirname, and verify nothing more (the protocol). - Engines carry no clock. They read frames already on the daemon's clock and report times off them, so there are no pings, and a report past what the engine was given is refused: no engine can claim audio it never heard.
- The daemon gives the audio on the engine's own connection, from a time it
names. Replay from disk joined to live, gapless as a feed, so an engine that
reconnects resumes at
through, the end of its kind's last logged report on that track, and a swapped one picks up where the last left off; reading byreadthenlistenon two connections would leave the join to every engine. - Voice and turn are one kind. Smart Turn scores only at a voice close
(observed 2026-11-26 · 14 to 16 ms a score, not streaming), and a turn held under its bar waits
on the next voice; the close and the verdict are one engine's state, so one stream of events,
voiceandturn, keeps their order without a second engine reading the first. - A words engine is told each turn by the daemon, in order with its frames. Moonshine finishes only when told the turn ended (observed 2026-11-26 · final words 76 to 141 ms after that), and the turn line arrives after the frame holding the turn's end, so the engine finishes knowing it holds all of it; reading turns off a feed would join two streams with no common order. A words engine may also finish on its own rule; the turn line is the daemon's ordering, not a requirement.
- Partials are live, never logged. A partial is superseded within a second and
no late reader needs one; logged they would multiply the log and fill a feed's queue. Clients
follow them with
partials, and nothing in the design waits on one: the first came about 2 s in at microphone pace (observed 2026-11-26 · unexplained). Finals are events, never revised. - Telling voices apart is a kind of its own,
talkers. It reads the frames a words engine reads and reports who spoke when; neither waits on the other, so words are never held for a voice's id (about 1 s, below) and a swap of either model leaves the other alone. Notvoice, the turn engine's speech event, norspeaker, a mouth's output. - Its own speech finding, the turn engine's turns for its cuts. A diarizer finds speech itself, so the kind needs no voice lines and serves a track with no turn engine; it reads the turn lines a words engine reads only to close a span at each turn's end, so the span a client waits on for a turn closes with the turn, not at the next change of voice.
- Settled spans, never revised. A diarizer revises its recent labels; the log revises nothing, so the engine holds a span until its labels stop changing and reports it once, as words are finals. Revisions inside a horizon would leave every client a merge rule and a feed replay two truths; the cost is the settling delay, which the onset sets anyway.
- Nobody is said, never inferred. A span with no talkers is the only way to say nobody spoke; time no span covers is unknown, so a client tells "nobody" from "unknown" and "not yet" by values, and the daemon need not hold an engine to tiling. The latest end is the engine's settled reach. Speech at once is one span naming each voice: spans never overlap, as finals, none is empty, and a change in who speaks is a new span, so overlap needs no rule of its own.
- An enrolled voice's id is its label; any other is a number for one connection. The label is what the engine was configured with, stable across reconnects and boots while its profile stands; an unknown voice is an integer from 1 per connection, since a diarizer's slots mean nothing to its next process. The JSON type tells the two apart, and a label starts with a letter, so none can pass for an unknown voice. Keeping unknown voices across connections would need the engine to persist profiles of voices never enrolled, which is enrolment by stealth.
- A score per talker per span is evidence, not authentication. The
embedding match of the span's audio against the label's profile, 0 to 1, higher closer,
promised nothing beyond its order within one engine and release; null, under 2 s, means not
identified (on Pocket TTS's eight voices other voices' windows under 2 s outscored the
enrolled one's; measured 2026-11-27, the tables in
engines/README.md). Measured on synthetic voices only, with no false-accept rate measured on people: how far it parts voices depends on the profile, another voice reached the enrolled one's scores under a long profile, and a recording of the enrolled voice scores as the voice. The label alone is LS-EEND's guess, another voice's for 1.8 to 13.6 s of a file in those runs; a client never acts on a label with a null score, and one that needs a decision chooses and validates its own cut on its own voices. - No event is stamped with a speaker; a client joins by time. Routing ids to
the words engine would hold words about 1 s for them and tie two models together; stamping
turnorwordsevents would revise or delay what is logged. Both streams are on the daemon's clock in one log, so the join is a pure function of two kinds of event on a feed (who spoke a turn). A client that acts only on one enrolled voice's speech keeps eachturnuntil atalkersspan reaches its end, then counts as that voice only the spans whose label carries a non-null score it accepts, a label with a null score unknown, as is time no span covers: the span reaching a turn's end is logged 1.11 to 1.23 s after that end, 0.83 to 0.95 s after the turn event (measured 2026-11-27 ·mise run prove-diarize, 4 turns, endpoint and diarize on one daemon). - Enrolment is the engine's, local and private. A profile is the engine's
own file, in a directory its job's command names; the daemon learns a label and nothing else
about whom it names. The enrolment tool is a subcommand of the engine, never of rift:
diarize enrol <label> --model <dir> --profiles <dir>with--track <track> --from <t> --to <t>(it reads the span withread, as any client) or--file <pcm>, refuses audio LS-EEND finds no voice in, and writes the audio (its first 30 s) and its embedding to<dir>/<label>.json0600, the directory made 0700;diarize forget <label> --profiles <dir>removes it, and the running engine reads the directory as it connects, so a new profile takes effect on its job's restart. No profile, recording or label is ever committed. - The echo stage rules before anything downstream reads. With an echo engine
connected, a live ear frame reaches the talkers, turn and words engines only once it has ruled past it,
masked samples as zeros and the frame marked
masked, so no engine author handles echo, and a later echo engine that cancels instead of masking publishes a clean track (clean-<name>, segments and window as any) that downstream names as its track instead. Masks are events, so a replay from disk applies them; a mask goes on and off, each no more than 1 s past what was heard, so a play is two events and no report masks without bound. None connected, or one gone, frames flow unruled at once: the stage fails open, since words must never wait on an optional stage, and theengineevents say where it was missing. One 1024 frames behind is dropped, counted, never timed. - Speech rides the play path. A client opens a
sayon a mouth and gives text in pieces, thenend, as a giver gives audio; the daemon routes each piece to the mouth's speech engine, which gives audio as an ordinary play tagged with the say (Pocket TTS: 24 kHz mono in 80 ms chunks, first audio 25 to 39 ms after text, about 8× real time, observed 2026-11-26; the mouth converts any rate 8 to 48 kHz). Pacing, runs, hush, quiet, drain andlostare the play's, unchanged. The say holds the mouth from its open, so no other giver slips between its pieces. - What sounded is counted in text, from marks. The speech engine marks how much
of the text has sounded by which sample of its play; the daemon ends the say with
spoken, the characters behind the play'splayed. A play run to its end speaks all of it; a hushed one, as far as its last mark underplayed, 0 for an engine that marks nothing: never more than sounded. - A typed answer, never silence. A
sayorpartialswith no engine of its kind isabsentat once; health lists each track's engines; the feed records each one's coming and going. - A crash takes only its own work. Words engine gone: finals logged stand, the
utterance under way is re-read by the next from
throughwhile it is in the window. Turn engine gone: a voice left on is logged off at the end of what it was given, before itsengineevent (after a kill, as the next boot starts). Talkers engine gone: spans logged stand, the open one is never reported, and the next resumes fromthrough, its numbers counted afresh; a client finds a turn's tail unknown, never nobody's. Speech engine gone: its say endsengine, its play hushed. Echo gone: fail open. Devices, segments and other engines go on.
- Local configuration stays local. rift passes an engine nothing but its
track's lines. A words engine's preferred terms, a model's path, a voice: its own flags and
files, named in the command its job runs, which lives in a plist on this machine and nowhere in
this repo. The reference engines take
--terms <file>and the like; no file of that sort is ever committed. - Installed as jobs, swapped by one command.
rift engine add <kind> -- <command…>writesdev.gigantic.rift.<kind>(KeepAlive,RunAtLoad, stderr to<root>/engines/<kind>.err, capped by the daemon as each engine connects), the command recorded verbatim, boots out the job it replaces and waits for its engine to leave health, loads the new one and waits until health lists an engine of that kind on the command's track (its first word of a track's form; a command naming none is refused), reloading once assetupdoes; a kind and track another's engine still holds is loaded unwaited, to take over once it leaves, and a job disabled in launchd is written, not loaded.rift engine remove <kind>unloads it and removes its plist;rift engine listprints each job's command, one{"command":[…],"kind":…}line each.setupleaves engine jobs as they are (an engine stands and reconnects across the daemon's swap, as a device does) andsetup --removeremoves them. No fixed copy: an engine opens no microphone or output, so no grant is keyed to its path; it runs from wherever its command says, a checkout or an installed copy alike. - One job per kind, so one engine per kind per machine by job. A second track's engine of a kind (a second ear's words) runs as any client does: by hand, or as a launchd job of one's own under another label; the job names its track in its command, and the slot it takes is that track's.
rift engine add words -- uv run --project ~/src/transcribe transcribe ear-mac --terms ~/.config/transcribe/terms.txt
rift engine add echo -- ~/.local/bin/rift engine run tail ear-mac
rift engine add words -- ./my-words ear-mac # the swap: the old job booted out, the new one loaded
rift status # "engines":{"ear-mac":{"echo":"tail","words":"my-words"}}
| reference engine | kind | what it does | where |
|---|---|---|---|
| diarize | talkers | LS-EEND (DIHARD III, 100 ms steps) through FluidAudio, macOS only, fed each 20 ms frame as it comes through a 2:1 decimator of its own whose filter state carries across frames (enrolment through the same), so its steps are the same however the stream is cut, each step's slots over 0.5 smoothed by a median of five steps; a step settles once two more have come, so a span is reported 1.1 to 1.2 s after the audio it ends on (LS-EEND gives each step once, 0.9 s after it, never revising it), cut at each change of who speaks, each hole, each turn line's end and at 20 s. The profiles in --profiles, read at each connect, enrol LS-EEND afresh with each label's audio; each span naming a label is scored by WeSpeaker's embedding of its audio (at most 10 s) against the profile's, the cosine mapped linearly from 0.06 (0) to 1 (1); null, not identified, under 2 s, where other voices' windows outscored the enrolled one's (measured 2026-11-27 · Pocket TTS voices, the tables in engines/README.md). A label is LS-EEND's guess and a score evidence, not authentication: it labels the fixture's first marius phrase as the enrolled alba, and a client never acts on a label with a null score. Masked frames are nobody's. After 30 s of settled nobody, or once 60 s old at its next 3.5 settled s of nobody (past the 3 s a turn may be held across), the stream starts afresh, LS-EEND reset and the profiles enrolled again (about 0.3 s each), the audio not yet settled fed again: a stream left on a quiet room drifts, its running mean and state the room's: on the fixture after 40 s to 30 min of it a phrase took the enrolled label and part of another went unheard, and restarted the spans are a fresh stream's (measured 2026-11-28 · engines/README.md; validated privately on real speech); a voice not enrolled heard again after it takes a new integer. LS-EEND names speech from its first steps, not after a second of nobody: over twelve phrases of three Pocket TTS voices, none enrolled, it named 10 from their first step and the other two 0.28 and 0.86 s in. It did not always tell the voices apart: javert's phrases took alba's id every time, and marius's first phrase did too. Over alba's and marius's later phrases summed at 0.7 each, with alba enrolled, it named both together for 1.7 of the 2.56 s (measured 2026-11-27 · a probe over the sentences in AGENTS.md; the overlap in the model test). diarize enrol and forget keep the profiles (engines/README.md). Ready 0.35 s after start once Core ML's cache is warm (observed 2026-11-27 · mise run prove-diarize); 0.7 ms a step, 16 ms an embedding (unverified 2026-11-27 · measured 2026-11-26 before the decimator, which adds 129 multiply-adds an 8 kHz sample) | engines/diarize/, Swift |
| endpoint | turn | Silero VAD on 32 ms windows, a voice reported once it spans 96 ms of speech and closed after 256 ms under its offset, Smart Turn v3.2 scoring the turn so far at each close, over --bar (0.5) a turn, else held for the next voice up to --ceiling-ms (3000) of silence; a turn over the bar spanning under --short-ms (1500) of voice is held --grace-ms (512) of silence first, a voice reported inside it joining the turn (one that starts inside it but spans its 96 ms only after it is due does not), either flag at 0 turning that off, as Smart Turn scores a short opening word and its pause a finished turn (0.81 to 0.99; on recordings of one speaker, 75 sentences, turns cut mid-sentence 23 to 6 at the same 310 ms median close, observed 2026-11-26). Voice off is logged 279 ms after speech ends, and the turn with it over 1.5 s of voice, 770 ms after under it (observed 2026-11-26 · engines/prove.py, the fixture's 1.66 s, then with --short-ms 2000). A hole under 256 ms is heard as silence of its length; a longer one closes the voice at the hole's start and resets Silero, so no hole makes a voice or a turn of its own. Connecting, it hears again the audio from the oldest the window holds, any boot, so a turn held as an engine left is rebuilt whole and closed as usual, by the ceiling, or by the grace when it was waiting one out; the voices its reply's through covers stay unreported, a logged turn heard again is refused unsaid, and a turn whose voice was under way at that oldest audio is dropped, said once, rather than reported short (its edge swept meanwhile, it resumes from through and says the held turn is not rebuilt) | engines/endpoint/, Rust |
| read-aloud | speech | Pocket TTS, voice --voice (alba), each say spoken as its text comes in spans of whole sentences of up to 390 bytes (a longer sentence alone), one model piece of at most 120 tokens each, so commas and the joins between sentences keep the voice's own prosody, its 24 kHz chunks given as made, a mark once each span that sounded is given, so marks rise strictly, a hush stopping it at the next chunk (play open 63 ms after the say, measured 2026-11-26 · engines/prove.py) | engines/read-aloud/, Rust |
| scribe | words | Parakeet Ultra through FluidAudio, macOS only, decoding each turn once, whole, at its turn line: its frames in a 30 s buffer, a span opened at a voice's start less 250 ms and held across the voices of a turn held unfinished, decoded over its audio to the turn's end alone, at 20 s by its own rule (300 ms behind the newest frame, past a voice's close and its line, the rest carried on as the next span while the voice is on, and closed by an off or a turn line ending at or before it); no partials; none for a turn with no words. With no voice lines it decodes nothing; a turn line ending before a span a voice opened (a replay's) leaves it open. It writes no transcript anywhere but its reports: FluidAudio's own lines go to the unified log alone, from warning up. It connects from 30 s back, and loads and warms its model before it connects, saying so once. Parakeet times each word by its tokens, each mapped back to when its audio was heard, holes included; --model required, --terms rescoring the words toward the file's terms by FluidAudio's CTC spotter, each kept word keeping its times and a replaced run sharing the span it took (any newline, CRLF included); without it, no rescoring: a second fixture's invented "Phlogix", heard "Flogix" without it, is "Phlogix" with it, its final 79 to 82 ms after its turn line (2 runs). The fixture's final lands 39 to 51 ms after its turn line, the decode itself, so decoding speculatively at voice off could save at most that; ready 9.3 s after start on first use (Core ML compiling for the Neural Engine), 151 to 158 ms after; a 38 MB footprint, the weights on the Neural Engine not counted (measured 2026-11-26 · mise run prove-scribe, 5 runs; /usr/bin/time -l) | engines/scribe/, Swift: an engine in any language |
| tail | echo | a mask on at a play's first run's start, off once the ear is heard past the last run's end plus --tail-ms (default 200), 200 ms more while its play is open: two events a play sounding without a longer gap; ruling up to the last frame heard while no play is open, up to the mask's planned off while one is on, and 200 ms behind what was heard while a play is open unmasked (a run is reported within 20 ms of its output taking it, before it sounds, its start an output latency on, so 200 ms covers a report held up that long). It starts from the ruling its reply gives, a play already open masked from there, and reads the reply to each report: a mask on refused was never on, and the ruling waits at an on until it is answered. Limit: a run reported later than the guard plus its output's latency lets the start of its echo through unmasked, a busier machine's leak, not one the stage can see | rift engine run tail <ear>: no model, so in rift and its suite |
| transcribe | words | Moonshine v2 Medium Streaming on speech alone: its frames in a 30 s buffer, a stream opened at each voice's start less 250 ms and fed 300 ms behind the newest frame so it stops at the voice's end, one stream across the voices of a turn held unfinished, finished at the turn line over audio to the turn's end alone (afresh from the buffer if fed past it), at 20 s by its own rule; a partial per 320 ms whose text changed; none for a turn with no words. With no voice lines (no turn engine on the track) it transcribes nothing. It connects from 30 s back, so a resume never chews through more than its buffer. Moonshine times lines, not words: a line's words share its span by length, each mapped back to when its audio was heard, holes included; --model required, --terms rewrites after decoding | engines/transcribe/, Python under uv: an engine in any language |
Each model engine keeps its runtime pinned (a Cargo lock, a uv lock, a Swift
package's resolved pin) and its model in its own cache, never in the repo: engines/README.md names each
download and licence. mise run check-engines is their gate: each
engine's protocol logic at 100 % of lines against a stub model, and one test per model over the
synthetic fixture (engines/fixtures/phrase.pcm, Pocket TTS saying
"Please turn on the kitchen lights.", no recording of a person) where its weights are, scribe's
skipped off macOS; mise run prove-engines runs three against a
throwaway daemon and a fake output (PROVE_FAST=1 on a loaded
machine), prove-scribe the same with scribe for words, prove-diarize endpoint and diarize over fixtures/voices.pcm. rift's release
carries none of them. Smart Turn completes a falling sentence (0.988) and holds an unfinished
one ("So I was thinking that we...", 0.008, the retired reference's front end agreeing at
0.008); the ceiling path is the stub suite's. A file-fed ear paced in real time on a busy
machine wakes from its sleep about 200 ms late and plays on from there as a hole, keeping every
sample (measured 2026-11-26 · 8 busy loops on 16 cores, 52 holes in 200 frames, replies under
50 ms), so the track it places is the fixture stretched with silence; sent fast it places
none.
| slice | ships | its tests decide, by values and order |
|---|---|---|
| 1 · the connection | engine, taken, the engine events, health's engines | the suite as an engine: the reply's fields; a second refused taken; engine on and off bracketing its reports in the feed; health listing it while connected only; an engine killed mid-stream leaving a file-fed ear's every frame answered and its segments' samples summing to what it sent |
| 2 · words | frames from from, words, partials, through, absent | a file-fed ear (--fast) read by a suite engine from a from inside the window: every t 20 ms after the last, none twice, across the replay's join to live; its finals logged with the values sent; one overlapping, out of order or past the last frame refused and unlogged; a partial reaching a partials reader and not the log; a reconnect's through the last final's end; gone before the window |
| 3 · turn | voice, turn, the turn line to words | alternation and order refused when broken; each turn line reaching the words engine after the frame holding its end, by comparing ts in the order read; a turn engine leaving with voice on, its engine event after the open voice |
| 4 · echo | mask, ruled, held frames, tail and rift engine run tail | a suite echo engine that rules to a time the test sets: the words engine holding no frame past it, then each after it once ruled; masked samples zeros and their frames marked; a replay carrying the logged masks; the echo engine gone and frames flowing unmarked; 1024 behind, dropped; tail against a play into the fake output: its masks, merged, equal each logged run's span plus the tail, merged |
| 5 · say | say, text, mark, done, spoken | a suite speech engine giving a tone per piece and marking each: a say to its end, spoken its whole text; hushed once the suite's mouth reported a run, spoken the largest mark under the played it reported; busy, absent, quiet, left, engine, a kill's lost; the play event's say |
| 6 · jobs | rift engine add, remove, list | against the launchctl stub: the plist's fields, the old job booted out before the new loads, ready only once health lists the kind, setup --remove removing them |
| 7 · model engines | endpoint, read-aloud, transcribe | each in its own gate on a recorded fixture through a file-fed ear: the phrase's words among the finals; voice on before off and one turn over a phrase with a pause; a say's play ending end with sound in heard and spoken its text's length |
| 8 · the loop | the jobs on a Mac | speak, a final words event, a say, its spoken whole and the ear's track masked across its runs; the same with fixture and fake output as the suite's last case |
| 9 · talkers | the kind, talkers reports and events, its through, its frames and turn lines, rift engine add talkers | a suite talkers engine over a file-fed ear: its spans logged with the values sent, talkers as given; refused and unlogged: one overlapping, out of order, empty, past the last frame, a string id not of the form or not starting with a letter, an integer under 1 or with a score, a score outside 0 to 1, an id twice or out of order; a reconnect's through the last span's end; each turn line after the frame holding its end, as slice 3's; health and the engine events listing it; the plist's kind against the launchctl stub |
| 10 · the join | nothing in the daemon: the client's rule, held by the suite | a suite turn engine and talkers engine on one ear, a feed reading both: for each turn, each id's, nobody's and the unknown time over its whole length summed from the values, a gap unknown, known once a span reaches its end; a talkers engine's engine off after a turn's last span and before its event, so the tail reads unknown, not "not yet"; a reconnect mid-turn, each connection's integer ids kept apart; with none connected, health and the feed saying so |
11 · diarize | the reference talkers engine, engines/diarize/, Swift, macOS only, and its enrol and forget | its protocol logic at 100 % of lines against a stub diarizer and embedder in check-engines on macOS (said skipped elsewhere): settling, cuts at turn lines, gaps and nobody, the restart after 30 settled s of nobody (a lone step over the bar smoothed away, masked steps skipped) or at 60 s of age, steps re-fed in line, masks, ids and order, resuming from through, the 16-talker cap, enrolment's files and the profiles directory's owner and mode; model tests over fixtures/voices.pcm (Pocket TTS, alba then marius, twice each): alba enrolled from 14.5 s of other sentences (fixtures/alba.pcm), both her phrases labelled hers and scored, every score of hers above every score of marius's as her, labelled so or not; the fixture fed in 20 ms, 100 ms and 333-sample pieces giving the same steps; an overlap of her and marius, their later phrases summed at 0.7, naming both together for at least 1.5 s; the fixture after 2 min of a quiet room giving a fresh stream's spans. prove-diarize runs the fixture through a throwaway daemon, the profile enrolled from the daemon's read of her first turn, her turns mostly hers and scored above any score of his. |
| 12 · on the clean track | a talkers engine naming clean-<name> once the echo engine streams one | the clean track accepted as a talkers engine's track and its turn lines routed from that track's turn engine; a profile enrolled from the clean track scoring its own voice there as from the ruled ear; the machine's own speech, masked on the ear, nobody's on the clean track |
- The reference talkers engine.
diarize(its row above): FluidAudio's LS-EEND (MIT, up to 10 voices) for who speaks when and its WeSpeaker embedder (CC-BY-4.0) for each span's score; with alba enrolled LS-EEND labelled files of four of seven other Pocket TTS voices as her, 1.8 to 13.6 s of each (measured 2026-11-27 ·engines/README.md), so its label is a guess the score weighs. A new voice's first span waits on LS-EEND's 0.9 s output lag, not on a relabel: the settling delay is that lag and the median's 0.2 s. A profile keeps the enrolment audio as well as its embedding, since LS-EEND enrols from audio. Swift because FluidAudio is a Swift package on Apple's Neural Engine; a SwiftPM package of its own with its resolved lock. - Its install.
mise run install-enginesbuilds it and fetches its models at their pins; a profile withdiarize enrol, then therift engine add talkers -- … --profiles ~/.config/diarizeline it prints, the directory 0700 and the job's alone. - What the clean track adds. Nothing on the wire: a talkers engine names
clean-<name>as the turn and words engines do, all three on the same track so the turn lines it reads are that track's. A profile is enrolled from the track the engine will read, since cancelled audio embeds unlike masked audio; on the ruled ear a masked frame is zeros and so nobody's, while on the clean track the machine's residual echo must read as nobody, which slice 12 tests.
Priority
Every launchd job rift writes (the daemon, the ear, the mouth and each engine)
carries ProcessType Interactive. Unset, launchd
applies "light resource limits to the job, throttling its CPU usage and I/O bandwidth"; Interactive
jobs "run with the same resource limitations as apps, that is to say, none"
(man launchd.plist). Adaptive moves with XPC transactions, which rift
does not use. Under a load average of 43, unset, speech came out in 280 ms runs with gaps, the
output glitched, and the turn and words engines answered seconds late (observed 2026-11-28).
job's ProcessType | its threads' priority | a thread asking user-interactive QoS |
|---|---|---|
| unset, Standard | 20 | 20: clamped |
| Interactive | 31, an app's | 37 |
| Adaptive, Background | 4 |
Measured 2026-11-28 with ps -M on throwaway agents, a
child of the job inheriting its class. The output's I/O thread is CoreAudio's own, real time
(priority 97) whatever the job's class; cpal sets no priority of its own. The daemon's, the
devices' and the engines' threads run at the job's class: no QoS or time-constraint call is
made, so none is clamped.
rift setup reloads the daemon, the ear and the mouth on
their new plists, and gives each engine job without the key the key, then a bootout and a
bootstrap (none for a disabled one). An engine it cannot migrate is one line and its plist as it
was, for the next setup to try again; setup still succeeds, so one engine never rolls back an
upgrade.
Paths
| path | what |
|---|---|
| ~/.local/state/rift | the state root, mode 0700; $RIFT_ROOT overrides |
| <root>/audio/<boot>/<track>/<n>.pcm | a segment's raw frames: the closed ones still in the window and each track's open one |
| <root>/ear.err | launchd's stderr for the standing ear: its waits, refusals, Bluetooth and grant lines and stop line, capped at each attempt as serve.err is |
| <root>/events.ndjson | the event log, the durable state beside the audio |
| <root>/mouth.err | launchd's stderr for the standing mouth: its output, refusal and stop lines, capped as ear.err is |
| <root>/rift.keychain-db, <root>/rift.keychain-pass | rift's own keychain, holding its code-signing identity, and its password (0600); setup makes both, setup --remove deletes both (identity); identity.new/ beside them lives only while a certificate is made |
| <root>/run/rift.sock | the socket, in run/ (0700) beside serve.lock (the flock that admits one instance), serve.pid (a hint) and serve.log (start, refused, accept, degraded, exit and panic lines) |
| <root>/serve.err | launchd's stderr, for a failure before the daemon's log |
| <archive>/audio/…, <archive>/index.ndjson | the archive, when one is set: every segment that left the window at its path, and its segment event, one line each (a repeated line after a kill); nothing deletes there |
| ~/.local/libexec/rift/rift | the standing ear's program: the signed release copied to one path every release shares, the one the microphone's grant belongs to (identity) |
| ~/.local/libexec/rift/mouth | the standing mouth's program: the signed release, copied as the mouth is loaded, at a path no release older than the mouth writes; setup --remove removes it with the ear's copy and the directory |
| ~/.local/bin/rift | the binary: hotswap's link through ~/.local/share/hotswap/rift/current, the release installed; hotswap's record is under ~/.local/state/hotswap/ |
| ~/Library/LaunchAgents/dev.gigantic.rift.upgrade.plist | hotswap's upgrade agent: rift upgrade every 900 s |
| ~/Library/LaunchAgents/dev.gigantic.rift.plist | the launchd agent: KeepAlive on an unclean exit only, RunAtLoad |
| ~/Library/LaunchAgents/dev.gigantic.rift.ear.plist | the standing ear's agent: ~/.local/libexec/rift/rift device ear <host> --mic, KeepAlive always, RunAtLoad |
| ~/Library/LaunchAgents/dev.gigantic.rift.<kind>.plist, <root>/engines/<kind>.err | an engine's job, its command as rift engine add was given it, KeepAlive always, RunAtLoad, and its stderr |
| ~/Library/LaunchAgents/dev.gigantic.rift.mouth.plist | the standing mouth's agent, ~/.local/libexec/rift/mouth device mouth <host> --speaker, as the ear's, written only as it is loaded |
Environment
| var | effect |
|---|---|
| RIFT_AHEAD_MS | how much of a play its mouth may hold untaken before the daemon withholds the giver's next reply, default 200 |
| RIFT_BOOTOUT_MS | setup's wait for launchd to let go of a job after a bootout, default 30000 |
| RIFT_DRAIN_MS | the drain's budget for open connections before they are cut, default 1000 (launchd's ExitTimeOut is 3 s); before them, the wait for each mouth to answer its play's hush, within the same amount |
| RIFT_LEAD_MS | the cushion --speaker holds before a run of a play begins, and the longest it waits for it, in the output's own samples from its open, default 100; past RIFT_AHEAD_MS the giver is paced before it fills, so the wait decides |
| RIFT_LINGER_MS | how long after the output last took a play's sample --speaker keeps it open, default 10000 |
| RIFT_LOG_CAP | the size at which serve.log, serve.err, ear.err, mouth.err and each engines/<kind>.err are each copied to .1 and emptied (emptied, not renamed, since launchd's writer appends on), default 1 MiB |
| RIFT_MIC | the suite's fake microphones in place of the system's: a directory, its format in src/ear.rs |
| RIFT_OPEN_MS | how long a microphone's open may wait before --mic names the grant, waiting on, default 10000 |
| RIFT_PING_MS | how long after a device's last ping a frame's reply carries the next, default 10000 |
| RIFT_POLL_MS | how often --mic lists the inputs, how long one may fall silent before it closes, the wait after a failed open, doubled per failure in a row to 64 times, and the wait before it connects again; for --speaker the same, for outputs, default 1000 |
| RIFT_READY_MS | setup's wait, after a reload, for the daemon to answer health ready, or the ear or the mouth to be among its devices, default 30000 |
| RIFT_RELOAD_MS | setup's wait for health ready, or the ear or the mouth among its devices, before it loads that agent afresh, once, default 15000 (past launchd's 10 s respawn hold) |
| RIFT_ROOT | the state root, default ~/.local/state/rift; the socket path under it must fit 103 bytes |
| RIFT_SEGMENT_MS | a segment's length, in whole 20 ms frames, at least one, default 10000 |
| RIFT_SIGN_MS | how long setup lets each launchctl, scutil, security, openssl and codesign call run before killing it and failing, naming the call, default 30000 |
| RIFT_SPEAKER | the suite's fake outputs in place of the system's: a directory, its format in src/mouth.rs (the mouth) |
| RIFT_STALL_MS | how long a play's mouth may report nothing while it owes progress before the daemon ends the play mouth (owed: the play's end after end, or given past what was taken by more than the interpolator's 64 samples), checked every second, default 15000 |
| RIFT_ZERO_MS | how long a microphone may give only exact zeros after its open before --mic closes it as a failed open, naming the grant, default 2000 |
Command line
Releases come from .github/workflows/release.yaml, one per
merge to main, YYYY.M.N, signed by packslip.
mise use -g packslip:jgeschwendt/rift # the latest release, verified by packslip rift setup # into hotswap's layout, the ~/.local/bin/rift link, the agents rift upgrade --check # what the next swap would run mise run install # a checkout: a dev build as ~/.local/bin/rift-next mise run dist # a checkout: this host's release archive, to dist/
| command | does |
|---|---|
| rift serve | the daemon, in the foreground; launchd runs it |
| rift status | prints the daemon's health, or {"code":"down","ok":false} |
| rift quiet on|off | sets the quiet switch |
| rift ears on|off | opens or closes the ears |
| rift keep <window s> [<archive>] | sets the window and the archive, resolved against the working directory; none given, segments leaving the window are deleted |
| rift feed [--after <boot>:<seq>] | prints the events, from this boot or after a position, then live |
| rift listen <track> | prints each frame placed on the track, live |
| rift read <track> <from us> <to us> | prints the range's frames, silence where nothing is held |
| rift play <track> <rate> [<file.pcm>] | gives a raw PCM file (16-bit mono little-endian at <rate> Hz, 8000 to 48000; an odd last byte dropped), or stdin as it comes with none, to the mouth <track>, 16384 bytes a give, paced by the daemon's replies, then end; prints its reply, then the play's last line; exit 0 for "reason":"end", 1 for every other reason (hush, quiet, mouth, stop), for a refused play and for {"code":"unknown","ok":false} when the connection ends first; an unreadable file is rift play: <cause>, exit 1; a stop signal ends the connection, which hushes the play (left), rift play: stopped by SIG<name>, exit 1 |
| rift hush <track> | ends the mouth's open play at once and prints how much of it played and how much was dropped, or "play":null when none was open |
| rift device ear|mouth <name> <file.pcm> [--fast] | a device, its own process: plays a raw PCM file (16 kHz, mono, 16-bit little-endian) as the track's frames, a short tail dropped, answering every ping, paced in real time and stamped from now, a pause or clock step of over 100 ms playing on from the clock as a hole, or with --fast sent as fast as each is answered and stamped as if captured ending now; prints its reply, then each notice and refusal; exit 0 once every frame is answered, {"code":"unknown","ok":false} and exit 1 if the connection ends first; an unreadable file is rift device: <cause>, exit 1 |
| rift device ear <name> --mic [<microphone>] | a device, its own process, macOS only: hears the default input (the built-in in place of a Bluetooth one, when there is one), or the one named, whatever its transport, while the ears are open (the microphone); prints its reply, then each notice and refusal; when the connection ends ({"code":"unknown","ok":false}) or the daemon is down, it waits a poll and connects again; SIGTERM, SIGINT or SIGHUP, its only exit: rift device: stopped by SIG<name>, exit 0; a withheld grant or a failed open is one stderr line, and it keeps trying; on Linux exit 2 |
| rift device mouth <name> --speaker | a device, its own process, macOS only: plays what it is given for mouth-<name> on the default output, following it (the mouth), and streams what the output took as the track while the ears are open; stands, reconnects and stops as --mic does; a daemon that plays nothing is one stderr line, rift device: the daemon <version> plays nothing; fix: rift setup, waited out as a refusal; on Linux exit 2 |
| rift engine add <kind> -- <command…> | remove <kind> | list | an engine's launchd job, echo, speech, turn or words (engines): each call that changes something printed, as setup prints them; a failure is rift engine: <line>, exit 1 |
| rift engine run tail <ear> [--tail-ms <ms>] | the reference echo engine on the ear track <ear> (engines); prints its reply, then works until the connection ends, {"code":"unknown","ok":false}, exit 1 |
| rift setup [--print | --remove] | brings the release into hotswap's layout and links ~/.local/bin/rift (with none installed, the latest, through packslip), signs the release with rift's identity and copies it to the ear's fixed path unless already there, then writes the daemon's plist on the link and the ear's on that copy, boots the ear's and the mouth's out, loads the daemon's, or swaps it with one kickstart -k (a bootout then a bootstrap when it re-signed the release), and waits for the new daemon to answer health ready, then loads the ear's, waited on until that daemon lists ear-<host>; with the ear good, copies the release to the mouth's own path, writes its plist and loads it, waited on until mouth-<host> is listed, a failure there booting it out and removing both; each loaded afresh once when not ready past $RIFT_RELOAD_MS; a failure is rift setup: <line naming its label>, exit 1, the daemon left serving; one whose track another device already holds is loaded unwaited, a disabled one left unloaded, each said in a line, exit 0; --print prints the three plists (the daemon's alone off macOS), --remove has hotswap forget the layout and the upgrade agent, unloads the three agents and removes their plists, the link, both copies, the keychain and its password |
| rift upgrade [--check | --back | --retry] | hotswap's swap onto a newer release: installed beside the running one, current moved, rift setup, then the smoke (rift version, rift status until the daemon answers with it); a failure rolls back. Exit 0 green or settled, 1 red, 2 unable to try |
| rift version | the build, as the hello reports it |
Gate spans
Every run of mise run check is one OpenTelemetry trace through
floodgate span: a check span with each step nested under it
(fmt, clippy, cover,
stele.check and stele.emit), so floodgate's page shows which
steps cost the time and CPU.
check only wraps check:steps in its root span; the
steps live there. A step is wrapped in mise run span -- <name> [--attr k=v]… -- <cmd…>
(.mise/tasks/span): it execs floodgate span when
floodgate is on PATH, else the command after the second --, so
a machine without floodgate, CI included, gates as before. To add a step, put it in the
check:steps task's run list wrapped the same way; a step left
bare is time no span explains. check-engines, a separate gate, is not spanned.