You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AI/DECISIONS.md
+95Lines changed: 95 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -285,6 +285,101 @@ This file records key decisions made during planning. Before changing anything l
285
285
286
286
---
287
287
288
+
---
289
+
290
+
## DEC-017 — Three deployment modes as a first-class runtime concept
291
+
292
+
**Decision:** RTSPanda has exactly three deployment modes (`pi`, `standard`, `viewer`), resolved at startup via `RTSPANDA_MODE` or auto-detected from `runtime.GOARCH`. Each mode gates specific subsystems.
293
+
294
+
**Rationale:**
295
+
- Prior architecture had implicit behavior changes via individual env vars (`AI_MODE`, `AI_WORKER_URL`), which left room for misconfiguration and unclear capability expectations.
296
+
- A single mode enum makes the deployment surface explicit and testable.
297
+
- ARM auto-detection removes the most common Pi misconfiguration (running standard mode on Pi).
298
+
299
+
**Mode capabilities:**
300
+
301
+
| Mode | YOLO detection | Snapshot AI | Notes |
302
+
|------|---------------|-------------|-------|
303
+
|`pi`| ✗ disabled | ✔ optional | Default on ARM |
304
+
|`standard`| ✔ enabled | ✗ | Default on x86 |
305
+
|`viewer`| ✗ disabled | ✗ | No AI of any kind |
306
+
307
+
**Implications:**
308
+
-`internal/mode/mode.go` is the authority on mode resolution.
309
+
-`main.go` consults `deployMode.AIInferenceAllowed()` and `deployMode.SnapshotAIAllowed()` before starting each subsystem.
310
+
- Forcing `RTSPANDA_MODE=standard` on ARM emits a warning but does not block startup (users may have capable ARM servers).
311
+
312
+
**Status:** Decided. Do not add new per-feature env vars that circumvent mode gating.
313
+
314
+
---
315
+
316
+
## DEC-018 — Raspberry Pi is a viewer and snapshot AI node, not a YOLO inference host
317
+
318
+
**Decision:** Raspberry Pi is explicitly unsupported as a real-time YOLO inference host. This constraint is enforced in code, documentation, scripts, and error messages. There is no "experimental AI on Pi" path.
319
+
320
+
**Rationale:**
321
+
- YOLOv8n ONNX inference requires ~400–600 MB RAM at runtime. A Pi 4 (4 GB) running the full stack (Go backend, mediamtx, 4 RTSP streams, SQLite) is already at its practical memory ceiling.
322
+
- ONNX Runtime on arm64 runs at 3–8 FPS on a Pi 4 CPU — not viable for real-time alerting.
323
+
- Thermal throttling degrades performance further under sustained load.
324
+
- Messaging "experimental AI on Pi" sets false expectations and produces user frustration at root causes that are fundamental, not fixable.
325
+
326
+
**Enforcement points:**
327
+
-`internal/mode/mode.go` — `AIInferenceAllowed()` returns false for `ModePi`
328
+
-`scripts/pi-up.sh` — `full` mode is blocked with an explicit error message
329
+
-`docker-compose.yml` — `rtspanda-pi` service sets `RTSPANDA_MODE=pi`
330
+
-`README.md` — contains a clear statement in the deployment section header
331
+
332
+
**Status:** Non-negotiable. Do not add YOLO inference paths for Pi hardware.
333
+
334
+
---
335
+
336
+
## DEC-019 — Snapshot Intelligence Engine as the Pi AI replacement
337
+
338
+
**Decision:** Pi mode's AI capability is the Snapshot Intelligence Engine: interval-based JPEG capture → external vision API (Claude or OpenAI) → structured events → Discord alerts.
339
+
340
+
**Rationale:**
341
+
- Cloud vision APIs (GPT-4o-mini, claude-haiku) handle complex scene understanding that YOLO cannot (e.g., "Amazon driver detected" vs "person detected").
342
+
- API latency (1–5 seconds) is acceptable for interval-based alerting — this is not a continuous tracking use case.
343
+
- Cost per alert is negligible for homelab usage (< $0.001 per call for haiku/mini).
344
+
- No GPU, no model downloads, no Python process — Pi handles only frame capture (FFmpeg) and HTTP dispatch.
345
+
346
+
**Output contract:**
347
+
- Emits `detection_events` rows with identical schema to YOLO events.
348
+
- Discord alerts use the same `NotifyExternalDetectionEvents` path with a `sourceLabel` of "Snapshot AI (Claude)" or "Snapshot AI (OpenAI)".
349
+
- The UI cannot and does not need to distinguish snapshot AI events from YOLO events.
350
+
351
+
**Constraints:**
352
+
- Not real-time. One API call per camera per interval tick.
353
+
- Not suitable for sub-second response or continuous tracking.
354
+
- Requires `SNAPSHOT_AI_ENABLED=true` and a valid `SNAPSHOT_AI_API_KEY`.
355
+
- Positioning: "smart alerting via AI interpretation, not real-time detection."
356
+
357
+
**Status:** Decided. Configuration via env vars; Settings UI integration is a follow-up task.
358
+
359
+
---
360
+
361
+
## DEC-020 — Snapshot AI uses external vision APIs, not a local model
362
+
363
+
**Decision:** The Snapshot Intelligence Engine sends frames to hosted APIs (Anthropic Claude or OpenAI). There is no local vision model for Pi.
364
+
365
+
**Rationale:**
366
+
- Local vision models capable of scene description (LLaVA, InternVL, etc.) require 4–8 GB RAM — not viable on Pi.
367
+
- External APIs are available on-demand, require no local resources, and produce higher-quality structured descriptions than YOLO labels.
368
+
- The cloud dependency is explicit and opt-in (requires API key). Core viewing and recording work without it.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,19 @@
1
1
# Changelog
2
2
3
+
## v0.0.9 - 2026-03-20
4
+
5
+
### Added
6
+
- First-class runtime deployment modes (`pi`, `standard`, `viewer`) with startup auto-detection and mode-gated subsystem startup.
7
+
- Snapshot Intelligence Engine for Pi mode (`backend/internal/snapshotai`) with Claude/OpenAI vision providers and structured event persistence.
8
+
- Shared frame capture helper (`CaptureFrameToPath`) for external snapshot pipelines.
9
+
- New architecture and decision documentation for deployment mode guarantees and Pi AI constraints.
10
+
11
+
### Changed
12
+
- Backend boot flow now initializes YOLO detection only when mode allows it, and runs degraded detection handles in non-YOLO modes for API compatibility.
13
+
-`docker-compose.yml` now sets explicit `RTSPANDA_MODE` defaults and includes Snapshot AI environment controls for Pi profile runs.
14
+
-`scripts/pi-up.sh` now hard-blocks unsupported local AI-worker paths on ARM, clarifies supported Pi paths, and improves post-deploy guidance.
15
+
- README was fully rewritten around the three deployment modes and explicit Pi constraints.
0 commit comments