← All case studies Case study · iOS · Signal processing

SIGNAL: a pulse reading that refuses to guess

A personal iPhone app that measures pulse through the rear camera and LED torch. It delivers a reading only when the signal proves itself, and otherwise says plainly that the signal was lost. Built from one intent file, graded by an evidence review, and corrected on a real iPhone the same morning.

Platform Native SwiftUI, iOS 17+ Data On device only, no network Method RepoGenics
evidence/validation.md
Good sessions     40–180 BPM
  ✓ 160 accepted, 0 rejected
  ✓ mean error 0.21 BPM
  ✓ max error  0.85 BPM
Bad sessions      must be refused
  ✓ phone motion        0 / 100
  ✓ finger wobble       0 / 100
  ✓ no pulse            0 / 100
  ✓ very weak pulse     0 / 100
  ✓ finger lifted       0 / 100

0 of 500 bad sessions shown as a number
The repository’s own validation summary. Synthetic sessions only; real-device accuracy is covered further down, with what is and is not yet proven.
1
Morning from first build to a correct reading on a real iPhone, 31 Oct 2026
0/500
Disturbed synthetic sessions that slipped through as a number
25
Unit tests on the signal pipeline, plus a persistence test that compiles the real store, green in CI
0
Network calls, SDKs or accounts. Frames become one color in memory and are discarded

The problem

“Acquire the signal, verify its integrity, deliver the message. Or say it was lost.”

A wrong number delivered confidently is worse than no number at all.

Camera-based pulse apps are easy to make and hard to trust. A fingertip over a phone camera gives a faint, noisy color signal. Move the hand, press too hard or lift a finger and the math will still happily produce a number. Most apps show it.

SIGNAL started from the opposite rule, borrowed from Army Signal Corps practice: a message is either received with integrity or reported as lost. The intent set the bar:

  • Measure pulse with the rear camera and LED torch, no extra hardware.
  • Never show a reading below GOOD quality, and never clamp a real value to look plausible.
  • Name the reason for every rejection, so the user knows what to fix.
  • Turn the torch off on every exit: stop, fail, cancel, background or crash path.
  • Keep everything on the phone. A wellness tool, not a medical device.

How it was delivered

The Repogenic Loop, on a personal app

SIGNAL started from the intent-drive-starter repository and one intent file, INTENT 001. Claude Code did the building. The human decided what counted as proof.

1

Intent

A detailed current-feature.md: outcome, integrity rules, acceptance tests and stop conditions, before any Swift existed.

2

Variation

Claude Code produced the pipeline, the app, 25 tests, a Python reference model, synthetic validation and CI in one pass.

3

Selection

RepoIntent graded the build from repository evidence only. A real iPhone then graded it again, and found what static review could not.

4

Inheritance

Each correction was appended to the same intent file as a delta: observation, keep, change, evidence. The next session starts from all of it.

5

Guardrails

Integrity rules enforced in code, a pre-implement gate on the intent, and CI that fails when the build does.

What we built

The math is a library. The app only feeds it frames.

All signal processing lives in SignalCore, a Swift package that depends only on Foundation. It has no camera, no UI and no phone, so every stage is unit-tested on Linux and macOS. The iOS app owns the camera, torch, motion sensor, history and screens, and never does math of its own.

Seven pipeline stages (acquire, contact, filter, peaks, intervals, quality, decide), each named with its SignalCore type, followed by six hard gates and the two outcomes: SIGNAL ACQUIRED with a BPM number, or SIGNAL LOST with no number and a reason
What this shows: the pipeline and gates as built, with constants from SignalConfig.swift. Why it matters: the integrity rule from the intent is code, not a promise: any one gate withholds the number.
PACKAGE

SignalCore

Filter, peak detection, robust BPM, quality scoring and the completion policy. Every constant in one config file.

Depends on Foundation onlyTested 25 unit tests, Linux and macOS
Never clamps a value into a “normal” range
SERVICE

CameraService

Rear wide camera plus torch. Reduces each frame to one mean color and fingertip coverage.

Feeds optical samplesStops synchronously on every exit
Never stores or sends a frame
SESSION

MeasurementSession

Coordinates the flow: prepare, acquire, result or signal lost, with haptics and hardware lifecycle.

Owns workflow stateAsks SignalCore for every decision
Owns no math and no pixels
STORE

MeasurementStore

SwiftData on the device, keeps the latest 500 readings for history and a Swift Charts trend.

Shows SAVED or NOT SAVED, honestlyTested compiled and run in CI
No cloud, no account
DEBUG

Session analysis

Hidden view behind a long press: raw and filtered signal, detected peaks, intervals, every quality input, CSV export.

For evidence on a real deviceExports one CSV per session
Not part of the normal flow
SIMULATOR

Synthetic source

In the Simulator, a deterministic fingertip session replaces the camera, so the full flow and screenshots run without a phone.

Scenarios good and signal-lostUsed by tests and CI screenshots
Never active on a real device run

Inside one session

What “accepted” and “lost” actually look like

The same pipeline run on two sessions. On the left, a resting fingertip: clean peaks, even intervals, STRONG quality. On the right, a finger that wobbles on the lens: the math still finds “peaks” and would compute 186 BPM, but the artifact gate trips and the number is withheld.

Two columns of charts. Left: raw optical signal, band-passed signal with 22 peaks, and even beat intervals, labelled SIGNAL ACQUIRED 61.0 BPM quality 100 STRONG. Right: a disturbed signal with bursts, 16 peaks, and four very long intervals in red, labelled SIGNAL LOST quality 35 POOR motionArtifacts, 186 BPM withheld
What this shows: raw signal to filtered signal to peaks to intervals to verdict, from the repository’s evidence folder. Why it matters: the rejected session would have produced a confident, wrong 186 BPM. SIGNAL shows the reason instead. Rendered from the reference model on synthetic input; the same view exists in the app’s debug mode for real sessions.

The proof

Accurate when it should be. Silent when it should be.

Before the app touched a phone, the pipeline was swept across 160 good sessions and 500 deliberately bad ones. Both halves matter, but a false acceptance is the failure the intent was written to prevent.

Left: 160 of 160 good synthetic sessions accepted across 40 to 180 BPM, mean error 0.21 BPM, max 0.85. Right: five bad-session scenarios of 100 each (phone motion, finger wobble, no pulse, very weak pulse, finger lifted), zero falsely accepted, 0 of 500 in total
What this shows: the synthetic validation results in evidence/validation.md. Why it matters: integrity was tested as hard as accuracy. Caveat: these are synthetic sessions from the repository’s own generator, so they prove the logic, not real-world accuracy.
Pipeline unit testsVERIFIED25 XCTest cases across filter, peaks, interval rejection, quality gates and full sessions. swift test runs in GitHub Actions on Ubuntu and macOS.
CI on every commitVERIFIEDAll three commits on main (INTENT 001, Delta 001, Delta 002) passed CI: intent gate, package tests on Ubuntu and macOS, app build and Simulator screenshots. Delta 002 added the store persistence test.
Integrity on synthetic dataVERIFIED160 of 160 good sessions accepted, mean error 0.21 BPM. 0 of 500 disturbed sessions shown as a number.
Runs on a real iPhoneVERIFIEDInstalled from Xcode on the owner’s iPhone. The first run completed measurements end to end and produced readings.
Matches a reference deviceOBSERVEDTwo first-run readings of 62 BPM matched a separate pulse device. Two readings show it works; they do not yet measure accuracy.
History survives restartVERIFIEDAfter Delta 002, new readings appear in history on the device and persist after the app is closed and reopened. A CI test fails on the old code.
Accuracy across many readingsNOT YETThe intent asks for several resting readings against a reference device, plus an exported real-session CSV. The table in evidence/README.md is still empty.
Thresholds tuned on real capturesNOT YETEvery constant was tuned on synthetic data. Real fingertip signals may differ in coverage, perfusion and noise, and the gates may need re-tuning against captured sessions.

What changed along the way

Static review found the gaps. The phone found the bug.

The first build looked complete and passed CI. Two different kinds of selection then found two different kinds of problem, and each fix went back into the intent as a delta.

Timeline of 31 October 2026: INTENT 001 at 09:05, a RepoIntent report grading it Radius 2 of 5 with 8 open claims, Delta 001 at 09:16 closing them, a first iPhone run with two 62 BPM readings but empty history, and Delta 002 at 10:04 fixing the save order
What this shows: the morning’s commits and what triggered each. Why it matters: neither review alone was enough. RepoIntent caught structure and honesty gaps from the code; only a real device showed that no reading had ever been saved.

Graded, not trusted

RepoIntent, run against the first commit, placed it at Radius 2 of 5 and flagged starter files that silently bypassed the intent gate, a save failure that still showed SAVED, and a CI step that could pass on a broken build. Delta 001 closed all of them.

The bug only a phone could find

Old readings were pruned before the new one was saved. SwiftData ignored the offset for the unsaved record, deleted it, then reported a successful save of nothing. The screen said SAVED; history stayed empty. Save first, then prune.

The fix became a test

tests/store-persistence.test.sh compiles the real store on macOS in CI and fails on the old order, so this bug cannot come back quietly.

Why these technologies

Native, local, and testable without a phone

A Foundation-only Swift package

Keeping the math away from UIKit and AVFoundation means it runs and tests on Linux CI and on a Mac in seconds. The phone is needed only to prove the camera, not the algorithm.

AVFoundation, Core Motion, SwiftData

The camera, torch and accelerometer are only reachable natively. SwiftData and Swift Charts gave local history and a trend line with no server, which the intent ruled out anyway.

A Python reference model

The authoring environment had no Swift toolchain, so a constant-for-constant Python mirror produced the validation sweep and charts. CI then ran the real Swift tests on macOS and Linux.

SwiftSwiftUIAVFoundationCore MotionSwiftDataSwift ChartsXCTestPython reference modelGitHub ActionsClaude CodeRepoIntentProgressive IntentIntent-driven engineering

Why it matters

Small app, enterprise lesson

Integrity as a requirement

“Refuse rather than guess” was in the intent, became gates in code, and was tested with 500 sessions designed to fool it. The same pattern applies to any AI or analytics output that someone will act on.

Two kinds of selection

Evidence review from the repository and observation in the real environment caught different defects. Teams that rely on only one will ship the other kind.

Corrections that compound

Each delta records what was observed, what to keep and what to change. The next session, human or AI, starts from that record instead of from a new prompt.

Ship software that knows when to say no.

Repogenic helps teams write the intent, build the evidence, and run the review loop that turns a fast first build into something they can trust.

Talk to Repogenic

SIGNAL is a personal wellness prototype, not a medical device, and is not on the App Store. Synthetic validation and CI are verified; real-device accuracy is so far two matching readings, and a full reference-device comparison is the next step.