Jump to content

MindAttic.Webcam/SPEC

From MindAttic Docs

MindAttic.Webcam — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

In docs/ECOSYSTEM.md this is a platform repo: it owns webcam face and gaze signals, reused by every app that watches.

MindAttic.Webcam is webcam eye tracking and face monitoring with no special hardware: an ordinary webcam or a phone's front camera tells an app where on the screen a person is looking and whether they are present. One camera and one MediaPipe face model feed every module (eye tracking, presence, head pose, integrity), and one bridge carries gaze to browser pages, Unity and Unreal. Its consumers are MindPuck (the game) and Gadfly's exam room. The finished product is a library that can be redistributed, describes behaviour neutrally, and holds everything its consumers need, so Gadfly keeps no local copies of webcam features.

2. Scope boundary

2.1 In the product

  • Webcam core, eye tracking with calibration, the bridge, tracker page, gaze lab, Unity and Unreal clients.
  • Presence, head pose and the integrity event stream, with the gaze-and-deception guidance.
  • Licence and third-party notices; neutral wording in every summary.
  • Performance controls, face signals and gaze-quality tools that Gadfly needs.

2.2 Never in the product

  • Emotion or deception detection, and any reading of a look away as thinking (ET-LAW-2, docs/GAZE-AND-DECEPTION.md).
  • Sending video frames off the device; a cloud service or recorder (ET-LAW-1).
  • A laboratory-grade tracker that tells which word is read.
  • Open-ended bughunts (ET-T32).

3. Users and roles

  • Player / student: sits in front of a webcam or holds a phone; calibrates once.
  • Host app (MindPuck, Gadfly): reads gaze points, presence and integrity events.
  • Owner: verifies with a real camera and releases the package.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it.

E1. Webcam gaze and face library — ET-T39 — built

F1.1 Gaze tracking and calibration — ET-T40 — built

  • S1.1.1 Webcam gaze library and bridge — ET-T2 — built As a host, I want MediaPipe iris landmarks, calibration, smoothing, a bridge and Unity/Unreal clients, so that one gaze source serves every engine. Evidence: ET-T2.
  • S1.1.2 Calibrate over the play window — ET-T3 — built As a player, I want calibration to cover the window I play in, so that vertical gaze reaches the whole window.
  • S1.1.3 Head-geometry gaze model — ET-T4 — built As a player, I want gaze that does not assume the camera is at the screen centre, so that off-axis setups work.
  • S1.1.4 Steady looks and continuous learning — ET-T5 — built As a player, I want steady looks averaged and calibration refined from clicks and hints. Evidence: 0188123.
  • S1.1.5 Face-to-lens distance and angle — ET-T6 — built As a player, I want the gaze lab to show distance and angle live. Evidence: 196a12e.
  • S1.1.6 Follow-the-dot calibration — ET-T7 — built As a player, I want a smooth-pursuit pass and an accuracy report, so that the gaze lands where I look. Evidence: 10f8279.

F1.2 Face monitoring modules — ET-T41 — built

  • S1.2.1 Webcam core — ET-T13 — built As a host, I want one shared core (device, permission, frame loop, one landmarker), so that modules share a camera. Evidence: 16dc996.
  • S1.2.2 Presence — ET-T14 — built As a host, I want face count, absence, same-person check and lighting warnings, with no stored signature. Evidence: f5bf66d.
  • S1.2.3 Head pose and gaze region — ET-T15 — built As a host, I want calibration-free on-screen versus off-screen regions with dwell timing. Evidence: 9e5d865.
  • S1.2.4 Integrity event stream — ET-T16 — built As Gadfly, I want presence, region and a reading-pattern detector merged into one event stream matching SessionHub.Integrity. Evidence: 89f84a2.
  • S1.2.5 What gaze can and cannot tell — ET-T17 — built As a host developer, I want docs/GAZE-AND-DECEPTION.md and the module API documented. Evidence: ab51c38.

E2. Webcam library compliance — ET-T33 — MS-1

F2.1 Licence and notices — ET-T34 — MS-1

  • S2.1.1 Licence, notices, usage logging — ET-T30 — MS-1 (task) As a site that serves the bundle, I want a LICENSE, THIRD-PARTY-NOTICES with the Apache-2.0 text and the face_landmarker model card, and MediaPipe's usage-logging call confirmed off, so that redistribution is lawful and the browser contacts no third party.

F2.2 Neutral look-away wording — ET-T35 — MS-1

  • S2.2.1 Neutral look-away summary — ET-T29 — MS-1 (task) As a reviewer, I want a look away described as "A brief look away from the screen (N s). Not a concern on its own.", so that no summary reads behaviour as thinking.

E3. Gadfly on the library — ET-T42 — MS-129

F3.1 Performance controls — ET-T43 — MS-129

  • S3.1.1 Worker landmarker and fps cap — ET-T44 — MS-129 (supersedes ET-T18) As a host on a slow device, I want detection in a worker, a targetFps option and per-frame processing time, so that tracking does not starve the page. Acceptance: worker mode matches main-thread landmarks on the synthetic face.

F3.2 Face signals — ET-T45 — MS-129

  • S3.2.1 Blendshapes and iris confidence — ET-T46 — MS-129 (supersedes ET-T19) As a host, I want opt-in eyeLook/eyeBlink blendshapes and per-eye iris confidence on each frame. Acceptance: with the option off, frames are unchanged.

F3.3 Gaze quality tools — ET-T47 — MS-129

  • S3.3.1 gazePoint, 5-dot calibration, face light — ET-T48 — MS-129 (supersedes ET-T20) As Gadfly, I want gazePoint in cm, a quick 5-dot calibration with leave-one-out accuracy and jitter, and a face versus background brightness figure, so that gaze-quality.js is replaced by the library.

F3.4 Polish and release 1.1 — ET-T49 — MS-129

  • S3.4.1 Ship Webcam 1.1.0 — ET-T50 — MS-129 As the owner, I want @mindattic/webcam 1.1.0 with README, PROTOCOL and notices current and Gadfly on it, so that one library serves every consumer. Acceptance: MindPuck still plays; the owner signs off a Gadfly session.

5. Non-functional requirements

  • No frames leave the device (ET-LAW-1); neutral wording only (ET-LAW-2); one wire protocol (ET-LAW-3).
  • Tests need no camera: a synthetic face drives the pipeline (ET-LAW-4).
  • Third-party terms travel with the code (ET-LAW-5). About 30 gaze points a second on an ordinary laptop.

6. Interfaces and dependencies

Platform it relies on (docs/ECOSYSTEM.md): MindAttic.Agency, MindAttic.Tickets. Consumers: Gadfly and MindPuck.Web.

  • Uses: @mediapipe/tasks-vision 1.2.3 and the face_landmarker model (Apache-2.0), Node for the bridge.
  • Used by: MindPuck.Web, MindPuck.Unity, MindPuck.Unreal (through the bridge, docs/PROTOCOL.md), Gadfly (browser modules and toHubEvent).

7. Release sequence

  1. MS-1 MindPuck real-eye verification (active, shared with the three MindPuck repos): E2. Its sign-off is the owner playing MindPuck with a real camera.
  2. MS-129 MindAttic.Webcam 1.1 Gadfly on the library (planned, the finished product): E3. Ends with F3.4 Polish and release 1.1.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from README, BIBLE, RELEASE, code and the ticket history; the Gadfly extensions deferred by the reset (ET-T18..T28) return as MS-129 stories MAT-T382
2026-11-30 MAT-T462 single-source pass: 1 renamed, 0 buckets, 4 requires added, 0 platform re-points MAT-T466
From MindAttic.Webcam/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.