How DejaVu decides what to keep
A screen memory lives or dies by what it doesn’t keep. This is how DejaVu looks at your screen up to every two seconds and keeps only what is worth remembering — with Apple’s own frameworks, on your Mac.
In short
- One ScreenCaptureKit stream, never repeated screenshots — repeated one-shot captures are a known way to make macOS stutter.
- Four cheap filters decide whether a frame is kept — macOS’s change regions, a 64×36 brightness fingerprint, an animation detector, and window switches.
- Kept frames go to Apple’s hardware HEVC encoder, sealed frame by frame; text is read with Vision only where the screen changed, in an isolated helper process.
Rewind kept a frame about every two seconds, and its former users told us that was the right rhythm: often enough to catch the tracking number that flashed by, rare enough to stay light. The hard part is everything that happens between two frames. A blinking cursor, a ticking clock, a video in a corner — a naive memory would keep all of it, read all of it, and fill your disk with nothing.
Here is how DejaVu decides, step by step.
One stream, not a thousand screenshots
DejaVu opens a single ScreenCaptureKit stream and lets macOS deliver frames at most every two seconds. It never takes repeated one-shot screenshots: open-source projects have documented that repeated captures, especially across several displays, can freeze the macOS interface for seconds. One long-lived stream is also what lets the system tell us what changed.
When your Mac sleeps, locks or the screen turns off, the stream stops cleanly and starts again a few seconds after you are back — waiting a moment avoids a burst of requests just as the system wakes up.
Four filters, cheapest first
Every frame that arrives goes through four checks. Each one is cheaper than what it saves, and most frames never get past the first two.
1. Did macOS say anything changed?
ScreenCaptureKit attaches dirty rectangles to each frame: the regions the window server redrew since the last one. DejaVu adds them up since the last frame it kept. If they cover only a sliver of the screen — a cursor blink, the clock in the menu bar — and you haven’t switched windows, the frame is dropped right there.
2. Does it actually look different?
Redrawn doesn’t mean changed. A spinner that comes back to where it was, sub-pixel noise, a highlight that appears and disappears: macOS reports them, but the picture is the same. So DejaVu reads a 64 × 36 brightness thumbnail straight from the frame’s luma plane — about 37,000 byte reads, no colour conversion — and compares it cell by cell with the last kept frame. Too few cells moved? Dropped.
3. Is it a video or an animation?
When the same box changes frame after frame — a video, an animated banner — keeping every frame would be costly and useless. DejaVu notices when the changing region overlaps the previous one almost entirely, several times in a row, and then keeps that area only now and then, and reads its text even more rarely.
4. Did you switch app or window?
A new window always counts. Switching from Mail to Safari is exactly the kind of moment you will want to come back to, so it bypasses the filters above.
Encoding: hardware HEVC, sealed frame by frame
A kept frame goes to VideoToolbox, Apple’s video framework, and is encoded in HEVC by the Mac’s dedicated media engine rather than the CPU. Settings are tuned for screens: a constant quality, a keyframe every 30 frames, no frame reordering, and 10-minute segments.
Each encoded frame is then encrypted on its own, with AES-GCM and a key specific to its segment, before anything touches the disk. Nothing is ever written in the clear, even temporarily — and because each frame stands alone, the last few minutes can be viewed right away.
Text: read only where the screen changed
Reading text is the most expensive thing a screen memory does; in our prototype measurements it was by far the largest share of DejaVu’s cost. So DejaVu reads as little as it can:
- Only the regions that changed. The dirty rectangles from step 1 are grouped into tiles, and only those tiles go to Vision, Apple’s text-recognition framework. A full-screen read happens on window switches, when most of the screen changed, and from time to time as a safety net.
- In tiles a few thousand pixels wide. We found that Vision reads almost nothing on a full 4K frame at once; tiling makes it read everything.
- In an isolated helper. Text recognition runs in a separate, sandboxed XPC service with no state of its own. If it misbehaves or uses too much memory, it is restarted without touching the rest of DejaVu.
- Gently on battery. On battery, when the Mac warms up, or in Low Power Mode, text requests are spaced out and changes are read together on the latest picture. Pictures are still kept on time; their text arrives a few seconds later.
In the direct edition, DejaVu can also read text straight from windows through Accessibility, which is exact and cheap. Nothing is kept while you type a password: DejaVu pauses whenever macOS reports secure keyboard entry.
Search: one small database per day
Text, window titles and timestamps go into SQLite with FTS5, a full-text index — one encrypted database per day. In our prototype, a keyword search answered in under a millisecond per day. Keeping days separate also makes deleting real: when a day is gone, its key is destroyed with it.
What we don’t do
- No audio, ever. The stream is created without audio.
- No keystrokes. DejaVu never listens to the keyboard.
- No cloud. Every step above runs on your Mac.
What’s next
We will publish measured battery and disk figures from a MacBook Air before launch — not before. In the meantime, if you want a rough idea of what any screen memory costs in disk space, try our disk space estimator; it is transparent about its assumptions.
Questions
How often does DejaVu look at the screen?
At most one frame every two seconds — the rhythm former Rewind users asked for — and only when something on screen actually changed.
Does DejaVu use Apple’s Live Text?
It uses Vision, the framework behind Live Text, to read text on your Mac. In the direct edition it can also read text straight from windows through Accessibility, which is faster and more exact.
Will you publish battery and disk figures?
Yes, measured on a MacBook Air before launch. We won’t quote numbers until then.