DEV Community

Cover image for Peek: a horror game where your MacBook lid is your eyelids
Kanak Waradkar
Kanak Waradkar Subscriber

Posted on AI-assisted

Peek: a horror game where your MacBook lid is your eyelids

Presage SmartSpectra SDK Challenge Submission

This is a submission for the Presage SmartSpectra SDK Challenge

What I Built

Lowering the lid closes the eyelids on screen. Halfway down, writing appears on the shelves.

Peek is a horror game where your MacBook lid is your eyelids.

You sit in a dark archive. Something tall stands at the end of the aisle. I call it the Archivist. While you look at it, it can't move.

You can't just stare, though. The walls have writing on them, and you can only read it by squinting. Squinting means tilting the lid down. Tilt it further and your eyes are shut: the screen goes black and you hear it coming. It moves when you blink. It gets faster when your pulse goes up. Holding your breath makes it lose you, for a few seconds.

You get out by doing the hard thing: open your eyes, look at it, and calm down until your pulse is back near your resting rate. Then the lights come on.

Most horror games are about looking away. I wanted looking away to be something you do with your hands. M2 and newer MacBooks have an angle sensor in the hinge, and it makes a surprisingly good eyelid.

There are three chapters:

Chapter What changes
1. The Reading Room You learn the rules. 3 messages to find
2. The Stacks The lamp dies on a schedule. The bulb buzzes first, and in the dark you can't watch it. 4 messages
3. The Vault It moves somewhere new every time you shut your eyes. 5 messages

The twelve messages tell the Archivist's story. One full session, with calibration, takes about 8 minutes.

Where the idea came from. Nevermind (2015) got harder as your heart rate went up, so I knew pulse-driven horror could work. Sam Henri Gold's LidAngleSensor showed the hinge angle can be read at all. I haven't seen the two put together: the lid as eyelids, a blink as the monster's cue to move, and holding your breath to hide.

Demo

This is one full live session, cut down to under 3 minutes. Presage reads me through the MacBook's built-in camera. The panel in the top left is Peek's debug overlay: raw Presage values (pulse, breathing, blinks, face status, packet count) next to the hinge angle and the ghost's distance. The strip in the bottom right shows the lid zone, my pulse and the hinge angle as I play.

The lamp dies in chapter 2. In the dark you can't watch it, so it moves:

The bulb buzzes, then the screen goes dark with the caption: Dark. It can move.

Holding my breath while it was close. The overlay shows the hold being detected, and after a few seconds the game tells me to breathe normally:

Squinting in the Vault with the breath hold detected, then the prompt: Breathe normally.

The way out: look straight at it and let your pulse come down.

The Archivist stands in the aisle, then the lights come on.

Code

GitHub logo Labreo / peek

Peek: a horror game where your MacBook lid is your eyelids (Presage SmartSpectra SDK challenge)

Peek

CI macOS License: MIT

A horror game where your MacBook lid is your eyelids.

Close the lid partway to squint at the room, or shut it to hide. A ghost, the Archivist, moves when you blink, rushes in when you shut your eyes, and gets faster as your pulse climbs. The only way out is to look at it and calm down.

Your phone, propped beside the laptop, is the eye that watches you. The Presage SmartSpectra SDK reads your pulse, breathing and blinks from that camera, so closing the lid never breaks sensing.

Built for the Presage SmartSpectra SDK Challenge on DEV.

This is a game, not a health tool. It does not tell you anything about your health.

Three chapters

Chapter New twist Messages
1. The Reading Room Learn the rules: watch, blink, squint, shut, breathe 3
2. The Stacks The lamp fails on a schedule. The bulb buzzes first.
…

git clone https://github.com/Labreo/peek.git && cd peek
npm install
cp .env.example .env   # add your free Presage key: PRESAGE_API_KEY=...
npm start              # the lid needs an M2 or newer MacBook; the arrow keys work otherwise
npm run replay         # no camera, no key, no lid: watch the sample run
Enter fullscreen mode Exit fullscreen mode

The README covers the requirements, the camera setup and troubleshooting. npm run replay plays a saved run through the same signal code and game rules at a fixed 30 Hz step. The bundled sample is a scripted bot session, and the game labels it synthetic. It lets you see the game without the hardware, and it doubles as a test: the same file always gives the same ending.

How It Responds to Human Signals

Debug overlay mid-game: lid 53 degrees SQUINT, pulse 76.3 bpm from Presage, breath hold 4.8 s, 968 metric packets

Peek uses three live Presage signals, plus a fourth for looks, and the hinge sensor:

Signal Source What it does Handling
Lid angle MacBook hinge sensor, read 30 times a second Open: you are watching and it can't move. Squint: the writing shows but it creeps. Shut: black screen and it rushes in Median of 5 samples and 3 degrees of hysteresis, so the zone doesn't flicker at the boundary
Blink Presage BLINKING Each blink while you watch lets it step 25 cm closer Counted on the rising edge with a 250 ms gap, so one blink is one step
Pulse Presage PULSE_RATE The further you are above your own resting pulse, the faster it moves. To win, stay within 3 bpm of resting for 8 s (12 s in chapter 3) Only readings Presage marks stable are used, smoothed with a moving average. Pulse is slow, so it sets the pressure, not the reflexes
Breathing Presage breathing trace (upperTrace) Hold your breath when it is within 3 m and it loses you and drifts back The trace's swing over 3 s has to drop below 20% of your calm swing for 1 s. Hiding then lasts 4 s at most, so a hold never needs to go much past 8 s
Expression Presage EXPRESSIONS A scared or surprised face makes the desk lamp stutter Looks only. It never changes the rules

The ghost's rules. It starts 10 m away and catches you at 0.8 m. While the lid is open and you don't blink, it stays put, and if you hold a calm, unbroken gaze it backs off. While you squint it creeps at 5 cm/s, plus up to 15 cm/s more if your pulse is up. With your eyes shut it comes at 40 to 80 cm/s, depending on your pulse.

So you need to squint to find the messages, but squinting lets it creep. Shutting your eyes feels safe and is the worst thing you can do. And the more scared you get, the faster it comes.

Everything is relative to you. Before play, a 60 s calm scene records your resting pulse and normal breathing. A 15 s lid calibration records your open angle and how far down you squint. In the run in the video, my resting pulse came out at 86.7 bpm. I was nervous about recording. By the final steady-up in chapter 3 the stable readings were down around 60 to 61 bpm.

The integration. Presage runs natively in Electron's main process (src/main/presage.ts). The window only receives metrics packets:

const sdk = new ss.SmartSpectraSDK({
  apiKey: this.apiKey,
  requestedMetrics: [...ss.breathingMetrics, ss.MetricType.PULSE_RATE, ss.MetricType.BLINKING, ss.MetricType.EXPRESSIONS],
  enableTelemetry: false, // Peek opts out of Presage's optional SDK telemetry
});
sdk.on('metrics', (buf, ts) => this.send({ type: 'metrics', buf: new Uint8Array(buf), ts })); // -> signal bus
sdk.useCamera(ss.CameraSelection.byId(cameraId), { width: 1280, height: 720, fps: 30 });
sdk.start();
Enter fullscreen mode Exit fullscreen mode

The renderer decodes each packet with decodeMetrics from @smartspectra/node-sdk/messages, turns it into timestamped events, and the signal bus filters them before the game rules see them.

What went wrong along the way.

  • The camera problem is the whole game. With the built-in camera, lowering the lid points the camera at the keyboard. So Peek lets you pick any camera. A phone in USB webcam mode (I used a Pixel 8a) or an external webcam sits beside the laptop and doesn't care where the lid is. The video uses the MacBook camera because it was the simplest way to film. So when the lid goes down, Peek keeps your last pulse and doesn't pause until you open it again. With a separate camera, sensing doesn't depend on the lid at all.
  • Frame rate. My first version used Presage's renderer helper, which sends every camera frame from the window to the main process. With the 3D scene running on a MacBook Air, Presage stopped with "frame rate too low" (error 14). Capturing the camera natively in the main process fixed it.
  • One camera, one reader. Opening the sensing camera anywhere else at the same time, even for a small preview, broke Presage's frame timing (error 11). Now nothing else opens it.
  • Blinks were too strong. At 50 cm per blink, normal blinking ended every run in about two minutes. I dropped it to 25 cm and made a calm gaze push the ghost back.
  • Still rough: with the built-in camera Presage often asks you to adjust your position, and in this run it reported "ok" for a little over half of the play time. Every time it lost my face for 3 s with the lid open, the game paused. I cut those pauses out of the video.

Prize Categories

Most Creative or Delightful Use. The laptop hinge becomes an eyelid, and each Presage signal causes a different scare: blinks move the monster, your pulse sets its speed, and holding your breath hides you. The only way to win is the opposite of what fear makes you do: keep your eyes open and calm down.

Consent and Data Handling

  • Consent: a plain-language consent card appears before the camera is touched. The camera starts only after "I agree, start camera". A camera-on indicator stays in the corner the whole time.
  • Processing: the SmartSpectra SDK processes the video on the player's own computer. Peek never records or saves video, and never asks the SDK for image output.
  • Storage: readings stay in memory for the session.
  • Sharing: none. Peek uploads nothing.
  • Retention: readings are cleared when you quit. A run file is written only if you press "Save run file" on the debrief screen, and only to ~/Documents/Peek/runs/ on your computer.
  • Deletion: quitting clears memory. "Delete my data" on the debrief screen clears the session and deletes every run file Peek has written.
  • SDK telemetry: off, with enableTelemetry: false. Presage's Telemetry and Privacy doc says that when it is disabled, "the SDK starts no telemetry session and transmits nothing." The SDK still contacts Presage's servers to check the API key.
  • AI services: none.
  • Who is measured: only the person at the computer. The debrief is a game recap. It is not health information.
  • Safety: a content note before play. Flashing can be turned off. One jump scare per run, under 1.5 s with the volume capped. A breath hold stops working after about 8 s and the game says "Breathe normally". No mechanic rewards a higher heart rate. Space or Esc stops the game at any time.

Agent Session

I built Peek with Claude Code. The idea and the playtesting were mine. Claude wrote most of the code with me, and I reviewed and tested it on my own MacBook.

Building Peek: a horror game where your MacBook lid is your eyelids
You

@"~/Downloads/PEEK_PLAN.md"
Use and excute this plan for me.Ask me whenever you need access to things which you cant access like api keys that you want me to give or specifal permissions that uou dont have access to.Some keys and stuff are already prsent in my learning folder in the .env file you can take rom there make sure to gitingore whenever approprite and also toinitizle this into a private rpeo on my github and push whenever appriprtie.

Agent

(81 tool calls in this turn, 5 shown)

I built Peek through the Day 3 scope and pushed it to your private repo github.com/Labreo/peek. Replay mode plays start to finish and all 19 unit tests pass. Live play with the camera and Presage hasn't been tested yet: macOS won't let my shell use the camera, so you need to run it yourself.

What I confirmed (the plan's Day 0 checks, now recorded at the top of PEEK_PLAN.md)
- Your Mac: it's an M3. The lid sensor reads live angles with no sudo and no rebuild step.
- Presage SDK (now 3.5.0): you can pick a camera by name, so we're on Plan A.
- Blink: the Node SDK provides it (BLINKING), so the MediaPipe fallback isn't needed.
- Telemetry: it turns off with one option, and Presage's own docs say it then sends nothing. Peek turns it off.
- Your API key: it works. I tested it without a camera and got no login or usage-limit errors.

What's built
- The …

You

I cant do it now with the pixel as i am busy i will test later but if there are other things in the plan that is reaminng that you can do please do so.

Agent

(25 tool calls in this turn, 4 shown)

I've done everything left in the plan that doesn't need your phone or your accounts, and pushed it to Labreo/peek. All 20 tests pass, and I checked each change by running the app and looking at screenshots of it.

Fixed
- Pauses: a pause no longer shifts the timing in saved run files, so a run with a pause replays correctly.
- Camera unplugged mid-run: the game now pauses. Plug the camera back in and press Enter to continue.
- Replay sound: replay mode now plays audio without needing a click first.
- Clue placement: the first two wall messages were partly hidden behind shelves. I moved them.
- Debug panel title: it now says "RECORDED RUN" during replay instead of "PRESAGE LIVE".

Added
- Expressions (the P2 item): your key is allowed to use Presage's facial expression reading. A frightened or surprised face now makes the desk lamp flicker. This is visual …

You

Has the game got enough content to support a 10 min demo if not then please add so.

Agent

(38 tool calls in this turn, 5 shown)

No, it didn't before. It was one room with 3 messages, so a run lasted about 1.5 to 3 minutes. It does now: it's three chapters, and a full session runs about 10 minutes.

What a session is now

Chapter New twist Messages
1. The Reading Room Teaches the rules 3
2. The Stacks The lamp fails on a schedule. The bulb buzzes first, then 3 s of darkness where you can't watch it and it creeps closer 4
3. The Vault It jumps to a new spot every time you shut your eyes. A projector beam and rattle at the far end 5
  • Look: each chapter is its own room, with different layout, colors, fog and props (warm amber, then cold blue, then green film vault).
  • Story: the 12 messages tell the Archivist's story. A card between chapters shows the story so far and the next chapter's rule.
  • Retry: if it catches you, you can retry that chapter …
You

What is remaining for me to complete before i submit this project?

Agent

Deadline is Nov 23, 1:29 PM IST. Target submit is Sun Nov 22, 10 PM IST. Today is Nov 20. Everything left needs your hardware or your accounts.

1. Real-hardware test (must do, ~1 hour, ideally today)
- Run cd ~/Peek && npm start from Terminal.app, not from inside Claude, so macOS shows the camera prompt.
- Try the FaceTime camera first. Then plug in the Pixel with a USB 2.0 cable, choose USB > Webcam on the phone, and pick it in the camera list.
- Check these:
- The pulse stabilizes.
- Blinks tick up on the debug overlay (press D).
- A breath hold turns on within about 4 s.
- The frame rate holds.
- Shutting the lid keeps the camera sensing, which only works with the Pixel.
- If it breaks, send me the debug overlay values or the error text.
- Plan B (Android app) is only needed if the Pixel route fails. The Mac camera won't work for the lid …

You

Also since the app is focused on real life footage i want to show video of us actually being recorded and physically closed the lid or squinting or whatever it does.Also being included in the video.Also make this repo suitable for public deploymenet keep it private for now but just prep and ekpe it ready.

Agent

(33 tool calls in this turn, 5 shown)

Both are done: the app can now put you on screen in your demo recording, and the repo is ready to go public but still private.

Getting yourself into the video

I can't film you, so the app now does part of it:

  • Presenter view: start with npm run demo, or press V during play. It shows your live face from the Pixel in a corner of the game. On top of it you see your pulse, a hinge icon that moves with the real lid, the current state (WATCHING, SQUINTING, EYES SHUT, LAMP DIED) and a BLINK flash. It stays visible when you lower the lid and the game goes black, so a plain screen recording shows you, the lid and the game together.
  • Filming guide in docs/demo-video.md:
    • Rig layout: the Pixel as the sensing camera, plus a second phone filming you from the side.
    • Recommended: record with OBS (already on your Mac). It captures the screen, the game sound and the side …
You

I connected a usb cable via protnoics as usb 3.0 port and now my mac is connected to my phone try now.Let me know if yuo run into issues.

Agent

(10 tool calls in this turn, 4 shown)

The phone works as a webcam now, but I haven't seen a live frame from it yet. macOS blocks camera access from my shell, so the live test has to run from your own Terminal.

What happened
- First check: the Mac saw the Pixel through the Portronics hub, but in file-transfer mode. You switched it to Webcam.
- Now: macOS and the Presage SDK both list it as "Android Webcam". Peek's camera picker matches that name and puts it first.
- Speed: the link runs at USB 2.0 through the hub. That's what we want, because the macOS webcam problem only affects USB 3 links.
- Modes: it offers 640x360 up to 1920x1080, each at 15, 24, 30 or 60 fps. Peek asks for 1280x720 at 30 fps, which is supported and above Presage's roughly 25 fps minimum.
- Not tested yet: I tried a 3-second test recording to count frames, but it hung, waiting on camera permission for the Claude app. I …

You

Grant Claude camera

Agent

(52 tool calls in this turn, 5 shown)

I fixed the frame-rate error ("code 14") you hit. A full Peek session with you on the Pixel hasn't been tested yet, so that's the next step when you're back.

What caused it
- Peek was copying every camera frame from its window to the background process where Presage runs. With the 3D room also drawing on the MacBook Air, too few frames got through, so Presage stopped.
- Before you left, I ran Presage on the Pixel on its own, with no Peek window. It ran 60 s with no error, detected your blinks, and gave a steady pulse of 80 to 87 bpm. The pulse took about 57 s to appear, so be patient on the camera check.
- Peek now lets Presage open the Pixel directly, which Presage's own docs recommend for performance.

A second problem I found and fixed while you were away
- If anything else opens the Pixel at the same moment, Presage fails with a different error ("code 11"). That includes …

You

Yes, when back

Agent

The live test is set up for when you're back. When you have the Pixel, plug it in, choose Webcam on the phone, turn on a lamp, and send me a message. I'll then:

  1. Check the Mac sees "Android Webcam".
  2. Open Peek in Terminal.app with logging, the same way as before.
  3. Ask you to click "I agree" and sit still facing the Pixel for up to a minute.
  4. Read the debug overlay and logs for pulse, blinks, breath hold, frame rate, and how the face status behaves when you lower the lid.
  5. Fix anything that breaks, then move on to tuning and your first saved real run.

Nothing else is waiting on you before then.

You

Ok i am done how do i record and what do i record can you see the competiton rules to see if they would like to see me being recorded and stuff in the rweal video and it being demonstrated.For the demo video also tell me the beats for the demo video and what i should record.It shouldnt be that long of a video if we doing max 3 minutes or something you can just show in gifs and stuff for the cover gif or something else."https://dev.to/challenges/presage-2026-11-04"

Agent

(6 tool calls in this turn, 4 shown)

I checked the official challenge page and the contest rules. They don't require or forbid showing yourself, but filming yourself is the strongest choice. The full plan is in docs/demo-video.md.

What the rules say about the video
- A demo video is required. No length or format is set, so an unlisted YouTube video is fine.
- Judges check that you really use the Presage SDK by looking at the repo and the video. If the video doesn't show the SDK working with at least one live signal, the entry "may be disqualified". So keep the debug overlay (D) and the presenter view visible during gameplay.
- Showing yourself: neither required nor forbidden. Since the game is a physical action, seeing you lower the lid while the pulse number moves is the clearest proof that the signals are live.
- Only you on camera. The rules ban "covert or non-consensual monitoring".
- **No health …

You

Can i use the macbook camera with the smart sdk and show.

Agent

(6 tool calls in this turn, 4 shown)

Yes to both: record the screen while you play, put the files in a folder, and I'll edit the video and make the GIFs. The MacBook-camera version works live in Peek (you confirmed it on screen; I didn't get to read the values myself).

How to record (about 15 minutes)
1. Open OBS. It's already on your Mac and it captures the game sound, which the built-in Cmd+Shift+5 recorder can't.
- Sources: add macOS Screen Capture (pick the Peek window or the whole display) and macOS Audio Capture (Peek's sound).
- Settings → Output: MP4, 1920x1080, 30 fps. Save to ~/Peek/recordings/. Git ignores that folder, so videos are never uploaded.
2. Start Peek: cd ~/Peek && npm run demo. Pick FaceTime HD Camera, and keep a lamp on your face.
3. Record one full session. Go from consent into chapter 2 until the lamp dies, and make each moment happen at least once:
- …

You

Yes but if i use my pixel as my second camera recording becomes weird also where would i placcec my pixel phone accordingly.

Agent

The recording only gets awkward if the Pixel is also plugged into the Mac. In this setup the MacBook camera does the sensing, so the Pixel isn't connected at all. It's just a phone filming in its normal camera app, and nothing conflicts. …

You

Nah i will do it without jsut give me the details of how the reocrding and all is going to work,

Agent

Here's how the screen-only recording works from start to finish. In that setup the bottom-right box only showed an empty "no second camera" panel, so it's now a compact strip: WATCHING / SQUINTING / EYES SHUT, your pulse, a hinge icon and the lid angle, with BLINK flashing.

1. Set up OBS (once, about 5 min)

  1. Sources → +: macOS Screen Capture (Window → Peek) and macOS Audio Capture (Peek).
  2. Output: mp4 into ~/Peek/recordings, 1920x1080, 30 fps.

2. Record

  1. In Terminal: cd ~/Peek && npm run demo. The debug overlay and signal strip are on automatically.
  2. Lamp on your face, lid open, sitting where you …
You

@"~/Downloads/2026-11-22 18-06-51.mp4"
I got the video but it didnt capture my face do you think it is necessary to improve my chances does the dev.to post mention anything or the top post of this tag have anything as such.Also for the articles use mostly gifs wherever you can even for the cover image.And also detch the winners of previous dev.to challange and see how they made winning articles.Also follow the sctrict submission template.

Agent

(50 tool calls in this turn, 4 shown)

Your face isn't required, so the recording you have is fine to submit. The challenge rules don't ask to see the player. They only say judges check the repo and the demo video for "the live Presage signal(s) in action". Your recording shows that clearly: the overlay in the top left has the live Presage values and the strip in the bottom right shows your pulse and lid angle.

What I made from your recording: a 2:50 captioned demo cut, four GIFs, a GIF cover and an overlay screenshot. The DEV post follows the template's 7 headings in order …

You
  1. https://youtu.be/S88PnXiHM8c
  2. Ok make it public make sure to hide anything senstive or unnecssary that is present.
  3. Do it for me and do the remove any keys for me you have done it before and hide anything senstive.
  4. My dev username is kakeroth

Upload the draft as a draft on dev.to and tell me and give the link.Make sure you dont upload it directly as a post and also that you are following the rules of competitons and it's submission template.

Agent

Repo made public after removing working notes from its history. Transcript scrubbed of keys, email, names and local paths, then saved here. Post saved to DEV as a draft for review.

Built solo by @kakeroth.

Top comments (3)

Collapse
 
jpuidev profile image
JPUI •

Using the lid as eyelids is such a clever mapping, since squinting already feels like a half closed hinge. I make small iPhone games driven by the fold angle, so I'm curious how you handled calibration: is the angle range consistent across M2 and newer MacBooks, or does each machine need its own open and closed points? Also love that a blink is the monster's cue to move, it turns a reflex into the tension.

Collapse
 
kakeroth profile image
Kanak Waradkar •

Thanks! Fold-angle games on iPhone sound awesome—there’s something really tactile about tying physical hinge movement directly to game mechanics.

We actually calibrate per-player rather than relying on hardcoded angles, because "comfortable open" and "squint" vary quite a bit depending on desk height, posture, and screen size (like a 13" Air vs. a 16" Pro). Before a run starts, there’s a quick 15-second lid calibration that captures your personal open angle and your natural squint angle, then derives the zone thresholds from those two points.

To keep things from flickering right on the border between watching and squinting, the game takes a 5-sample median at 30 Hz and applies 3 degrees of hysteresis. So even if different MacBook models have slightly different sensor noise or hinge tension, the boundaries feel solid once calibrated!

And yeah, turning blinking into a threat completely changes how you play—you end up fighting your own reflexes the whole time. Would love to check out your fold-angle games if you have links!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.