Skip to content

About

Multimodal Mac controller using Hand gestures and voice

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

JEV REFLEX

Your Mac reacts before you finish asking.

A macOS interaction engine combining local hand tracking, local partial speech, window geometry, and Jev's typed decisions. A Next.js dashboard makes the pipeline visible.

Start

Python 3.11–3.12, macOS, a webcam, and Node.js 20.9+ are required. Dependencies, the English speech model, and the production dashboard are installed/built in this workspace.

uv run jev-reflex

Open the local session link printed in the terminal. It contains a temporary dashboard token, never your OpenRouter key. Keep the engine running; Ctrl-C stops it. The dashboard starts in preview mode.

For a fresh checkout:

uv sync --extra dev
uv run python -m backend.voice.setup
cd frontend
npm ci
npm run build
cd ..
uv run jev-reflex

Create .env in the project root with OPENROUTER_API_KEY=.... It is ignored by Git. Keep .env.example empty of secrets. Environment variables override .env. Restart after edits.

First interaction

  1. Enable Camera, Microphone, and Accessibility for the terminal launching Python in System Settings → Privacy & Security. Fully quit and reopen the terminal after changing permissions. Media control can also require Automation access to Music/Spotify.
  2. Place the dashboard on the display you want to control; select that display in its menu.
  3. Choose Calibrate pointing. Point at top-left, top-right, bottom-left, then bottom-right. At each corner press Space and hold POINT through the 2.5-second capture timer. Calibration is per session and approximate: keep your camera angle and sitting position fixed.
  4. Arrange target windows beside the dashboard. Hold your index finger extended with the other fingers curled. A stable target appears in the window map after a 250 ms dwell.
  5. Click Arm controls. Point again, then flick right/left to snap the target to that half of its display. A recent pointed target is retained for 1.2 seconds for the flick.
  6. Enable the microphone and say “maximize this” while targeting a window. You can also type a command and press Send. Speech supplies partial transcripts; typing submits a final one.
  7. Demo mode enlarges readouts. Escape pauses controls while the dashboard has focus. Saying “stop” with the microphone on also disarms. Disconnecting the dashboard disarms.

No window can move until Accessibility is granted to the launch process. Codex and iTerm permissions are separate. uv run jev-reflex --doctor checks configuration without displaying keys.

Interactions

Input Result Path
Steady POINT Highlight nearest window; frontmost wins overlaps Local
POINT, then flick left/right Snap window to that side Local
Recent POINT, then swipe up/down Scroll at target window Local
Open palm / fist Pause / play Spotify or Music Local
POINT + “this one” Select window Jev
POINT + “maximize this” / “restore this” Resize / restore saved bounds Jev
POINT + “move this right” Snap right Jev
“move this…” then point/flick Use up to four seconds of recent state Hybrid
“not this, the other one” with a new target Resolve current/previous target Jev
POINT + “close this” Confirm by pinch, “yes,” or button Jev + gate
Minimize, focus, next display, volume, mute Allowlisted native action Jev

open_app can activate a running candidate app or launch installed Chrome, Cursor, Terminal, Music, and Spotify from a fixed bundle-ID allowlist. Multi-window “close these” and browser-specific pause/resume are not implemented. State-specific media gestures support Music and Spotify; no blind media-key toggle is sent.

Architecture

Webcam → MediaPipe → pose/motion → calibration → target window
                         │                         │
Microphone → offline Vosk partial transcripts ─────┤
                         │                         ▼
                 clear gesture              four-second context
                         │                         │
                    local rule              Jev typed decisions
                         │                         │
                         └────────────┬────────────┘
                                      ▼
                      local confidence / risk / freshness gate
                                      ▼
                          exact-window Accessibility action
                                      │
               loopback authenticated WebSocket → Next.js dashboard

Traditional screenshot agents upload images, wait for reasoning and tools, then act. Reflex handles vision locally and sends compact state only when semantic input changes. Camera capture is independent of network requests. Jev calls are debounced, limited to one in flight and at most two per second. Changed input invalidates old replies; replies older than 2.5 seconds are discarded. Local gestures supersede in-flight semantic requests.

Jev and safety

Verified September 20, 2026: typesafe/jev-1.13 at POST https://openrouter.ai/api/alpha/decisions. Override the model with JEV_MODEL in .env. One request asks action/target choice questions, an execution noul probability, and a score risk question. No prose is requested. API risk levels are zero-based and converted to 1–4.

Sources: OpenRouter model, OpenRouter Decisions integration, TypeSafe API.

The minimum of action/target confidence and execution probability must reach 0.90 to execute. 0.70–0.90 requests confirmation; below 0.70 does nothing. Configure EXECUTE_THRESHOLD and SUGGEST_THRESHOLD (minimum suggestion threshold 0.70). Closing has a code-enforced risk floor of 3 and always requires confirmation. Risk 4 is rejected. Confirmation is single-use, expires in six seconds, and is cancelled on changed input or target.

Window ID/process ID are rechecked; AX geometry must match exactly one window. Arbitrary scripts, shell commands, password entry, deletion, messages, purchases, and security-prompt approval have no execution path. App minimum sizes or unsupported AX actions can prevent resizing. Restore uses the original bounds saved during this session.

Privacy and measured timing

Frames/audio stay on your Mac. Frames go only to the local dashboard; Vosk processes speech offline. Jev receives app names, window IDs, pointing, gestures, recent context, and the spoken/ typed command. Window titles, screenshots, password fields, and app text are not read for the payload. Do not dictate secrets as commands. The 60-entry timeline is memory-only.

The server binds only to 127.0.0.1, validates Host/Origin, and requires a random session token before streaming frames or accepting controls. Python alone loads the OpenRouter key.

The HUD measures camera read, tracking, gestures, speech processing, Jev network, actions, and total latency. Local rules show LOCAL rather than invented AI confidence. Local total starts at camera acquisition; semantic total starts at the latest transcript update and includes debounce/network/action. Speech timing is processing of the latest audio block, not time from the start of a sentence. Browser paint and human confirmation delay are excluded. FPS measures the full camera loop. A live synthetic Jev check took ~1.75 seconds; sub-150 ms semantic latency has not been established. Live camera testing measured approximately 23–25 FPS.

Verification and on-device acceptance

uv run pytest -q
uv run ruff check backend tests
cd frontend
npm run typecheck
npm run build

Tests cover calibration, overlap/nearest targeting, gesture stability, local rules, partial utterances, invalid model values, risk/confidence gates, confirmation reuse/expiry, stale responses, vanished windows, snap/restore geometry, and native failures. The production UI, webcam stream, native window inventory, local microphone startup, and a live synthetic Jev request were checked. Physical calibration, actual window movement, spoken intent quality, and close confirmation still need an on-device acceptance pass with Accessibility enabled. Synthetic/native-call tests do not substitute for that check.

Troubleshooting

  • Camera diagnostic: uv run jev-reflex --camera-only.
  • Different camera: uv run jev-reflex --camera 1.
  • Different port: uv run jev-reflex --port 8766.
  • Missing OpenCV APIs: uv sync --extra dev --reinstall-package opencv-contrib-python. Do not install opencv-python alongside contrib; their shared files collide.
  • Camera opens without frames: close other camera apps and check the connection.
  • Permissions denied: enable the launching terminal and fully restart it.
  • Dashboard offline after restart: use the new session link printed in the terminal.
  • Speech model missing: uv run python -m backend.voice.setup.
  • HTTP 401/402/429: check key/credits/model/rate limits. Errors appear without exposing the key.
  • No target: recalibrate; keep the target beside the dashboard. Calibration uses fingertip position, not a reconstructed 3D pointing ray.

The frontend is a static Next.js/TypeScript/Tailwind export served by Python on the same port. Rebuild after editing the dashboard. npm run dev is for UI development; the authenticated engine connection is tested on the production export. The build uses webpack because Turbopack's worker port binding failed in the restricted development environment.

About

Multimodal Mac controller using Hand gestures and voice

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages