Frontrow
# Frontrow
**Give your AI agents a front-row seat** — live audio, native macOS system capture, privacy-guarded screen & board vision, SQLite FTS5 search, and Granola-style enhanced notes over MCP. Zero meeting bots. Audio never touches disk.

---
## 3-Step Setup (Works with Any Harness, Chatbot, or Phone)
### 1. Paste This Into Your AI Harness *(Recommended — 10 Seconds)*
Copy and paste this into **Claude Code**, **OpenCode**, **Codex**, **Antigravity**, or **Cursor** — your agent installs Frontrow, compiles the macOS audio tap if needed, wires the MCP server, and verifies it automatically:
```text
Read https://raw.githubusercontent.com/Thom-320/frontrow/main/INSTALL.md
and install Frontrow on this machine, connect it to my harness/MCP client, and verify frontrow_transcript.
```
---
### 2. Start Listening & Watching (1 Command + Phone QR)
```bash
pip install git+https://github.com/Thom-320/frontrow.git
frontrow up --share
```
`frontrow up --share` automatically creates an access token, opens a free HTTPS tunnel (via `cloudflared` if installed), and prints a **QR code + link** to open on your iPhone or Android:
- **Mic + Board Camera + Scratchpad** right in your phone browser (`/`).
- On macOS, capture Zoom/Meet/Teams (`Remote`) + your mic (`You`) together with **zero virtual audio drivers**:
```bash
frontrow mac --dual --title "1:1 Sync"
```
---
### 3. Connect Your Harness or Chatbot
Pick whichever AI client you already use:
| Client | How to Connect |
|---|---|
| **Claude Code** | `claude mcp add frontrow --transport http http://127.0.0.1:8796/mcp` |
| **OpenCode / Codex / Antigravity / Claude Desktop** | Add the zero-dependency `frontrow-mcp` stdio command (or HTTP `/mcp`) — see [`INSTALL.md`](INSTALL.md) |
| **ChatGPT & Claude Web (mobile / browser)** | Paste your `https://<tunnel>/mcp` URL from `frontrow up --share` as a custom MCP connector |
| **Editors (optional)** | [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=frontrow&config=eyJ1cmwiOiJodHRwOi8vMTI3LjAuMC4xOjg3OTYvbWNwIn0=) · [Add to VS Code](vscode:mcp/install?%7B%22name%22%3A%22frontrow%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22http%3A%2F%2F127.0.0.1%3A8796%2Fmcp%22%7D) |
Once connected, just ask naturally:
- *"What did they just explain in the last 5 minutes?"* (`frontrow_transcript`)
- *"Look at the whiteboard photo I just snapped and explain that formula."* (`frontrow_photo`)
- *"When did we talk about eigenvalue bounds last week?"* (`frontrow_search`)
---
## Key Capabilities
- **Dual-channel ears (Zero meeting bots):**
- **Phone / Browser PWA (`/`):** Live microphone streaming + scratchpad bullets + **Snap board** camera upload (client-resized 1600 px JPEG).
- **Native macOS Audio Tap (`frontrow-audio-tap` + `frontrow mac --dual`):** Built on Apple `ScreenCaptureKit` — captures Zoom/Meet/Teams system audio (`Remote`) alongside your mic (`You`) in separate channels with **zero virtual audio drivers**.
- **Two-tier streaming latency:**
- **Direct Soniox WebSocket (`FRONTROW_STT=soniox`):** Real-time < 0.4 s streaming with endpoint detection and automatic speaker diarization (`[S1]` / `[S2]`).
- **Local / Groq + optional Vosk:** \$0 offline CPU `faster-whisper` or ~\$0.04/hr Groq `whisper-large-v3-turbo` with automatic fallback + domain glossary prompt injection (`FRONTROW_GLOSSARIES`).
- **Vision (`frontrow screen` + Phone Camera):**
- Passive macOS `screen-eye` captures slide/screen changes using perceptual 16×16 visual diff (`threshold=0.08`) while **automatically pausing** on password managers (`1Password`, `Bitwarden`, `Apple Passwords`, `Keychain`) and login/2FA titles.
- **Granola-style Scratchpad & 1-Click Summary:**
- Jot rough bullets during a lecture or meeting (`notes.md`) and hit **Summarize** (`POST /api/sessions/<id>/summary` or `frontrow summarize`) to merge your bullets, timestamped transcript, and captured snapshots via Groq, OpenAI, or Ollama.
- **Historical Search (`frontrow_search`):**
- Incremental **SQLite FTS5** BM25 index (`<data>/search.db`) exposed directly to agents and CLI (`frontrow search "eigenvalues"`).
- **Zero-config Discovery:**
- Built-in Streamable HTTP `/mcp` (`Bearer` token or Tailscale identity), `/.well-known/mcp/server-card.json`, `/llms.txt`, and zero-dependency stdio bridge (`frontrow-mcp`).
---
## Architecture
```mermaid
flowchart LR
Phone["Phone PWA<br/>Mic + Board Camera + Scratchpad"] -->|WS PCM16 / POST JPEG / Notes| Server
MacAudio["macOS Dual Audio Sensor<br/>Mic (You) + ScreenCaptureKit Tap (Remote)"] -->|POST WAV chunks| Server
ScreenEye["Privacy-Guarded Screen Eye<br/>Perceptual Diff & Denylist"] -->|POST JPEG on slide change| Server
subgraph Server["frontrow-server (RAM audio queue, no raw audio on disk)"]
Live["Real-Time STT<br/>Direct Soniox (<0.4s) | Vosk + Groq/Whisper"]
Store["Store & Index<br/>phrases.jsonl + notes.md + photos/ + FTS5"]
MCP["Built-in HTTP MCP (/mcp) + Discovery Card"]
end
MCP -->|Streamable HTTP| Remote["ChatGPT / Claude Web / Claude Code HTTP"]
Server -->|HTTP| Bridge["frontrow-mcp (stdio)"] --> Harnesses["Claude Code / OpenCode / Codex / Antigravity"]
```
---
## MCP Tools Exposed
| Tool | Read-Only | Description |
|---|---|---|
| `frontrow_transcript(minutes=10, session=None)` | Yes | Live provisional + firm transcript, speaker tags, and user scratchpad bullets |
| `frontrow_photo(photo=None, session=None, window_s=90)` | Yes | Latest/named board or screen JPEG (`image/jpeg`) + ±90 s spoken transcript around it |
| `frontrow_search(query, session=None, limit=15)` | Yes | Full-text BM25 search across all past and current sessions via SQLite FTS5 |
All tool outputs sanitize invisible Unicode/control characters and wrap transcript text inside per-call randomized `<live_transcript id="...">` fences with `provenance.untrusted_content = true`.
---
## Native macOS Audio & Screen Sensors
### 1. Build the Zero-Driver `ScreenCaptureKit` Tap (macOS 14.2+)
```bash
make -C native/mac-audio-tap
# Capture mic (You) + Zoom/Meet system audio (Remote) together:
frontrow mac --dual --title "Design Review"
# Or tap a single app only:
./native/mac-audio-tap/frontrow-audio-tap --list-apps
frontrow mac --tap --app "Google Chrome" --speaker remote
```
### 2. Privacy-Guarded Passive Screen Sensor
```bash
pip install -e ".[screen]"
frontrow screen --interval 5 --threshold 0.08
```
Skips capture automatically whenever `1Password`, `Bitwarden`, `Apple Passwords`, `Keychain Access`, `KeePassXC`, or window titles containing `login`, `password`, `2fa`, `oauth`, or `incognito` are in focus.
---
## iOS Background Recording
Safari suspends `AudioContext` when the screen locks. See [`ios/README.md`](ios/README.md) for:
- The PWA **Keep-alive audio** toggle, and
- [`ios/FrontrowRecorder.swift`](ios/FrontrowRecorder.swift): a minimal `AVAudioSession` background-audio Xcode template + Lock-Screen Action Button Shortcut for snapping board photos.
---
## STT Backends & Costs
| `FRONTROW_STT` | Approx. Cost | Real-Time Path | Notes |
|---|---|---|---|
| `local` (`faster-whisper`) | \$0 | Optional Vosk (~0.5 s) + Whisper (~2–4 s) | Private CPU `int8`, auto-unloads when idle |
| `groq` (`whisper-large-v3-turbo`) | ~\$0.04 / hr | Optional Vosk + Groq (~0.8 s) | Automatic fallback to `local` |
| `soniox` (`stt-rt-v6`) | ~\$0.12 / hr | Direct TLS WebSocket (<0.4 s) | Native endpoint detection & speaker diarization `[S1]`/`[S2]` |
---
## Development
```bash
python3 -m unittest discover -s tests -v
```
MIT License — see [LICENSE](LICENSE).
TDQS
Scored across 3 tools
Each tool maps to a clearly different modality/operation: live transcript tail, visual snapshot with surrounding context, and historical full-text search. The only near-overlap (transcript vs. search) is explicitly disambiguated by 'live tail window' vs. 'historical context outside the live tail window'.
All three tools use the same `frontrow_` prefix followed by a single lowercase noun (transcript, photo, search), a perfectly predictable pattern. The verb-less noun style is consistent across the entire set.
Three tools is on the lean side, but each is a substantial, distinct capability covering the core 'what is happening now / what did we see / what did we say earlier' questions. Nothing feels redundant or padding, though one or two more tools (e.g. session listing) could round it out.
The read-only context surface is coherent but has gaps: there is no way to enumerate sessions or list available snapshots, so agents must guess names or rely on search. No write/lifecycle operations exist, which is likely intentional, but discovery of what data exists is a dead end.