3.5 KiB
Architecture decision records
Format: one section per ADR. Status: Proposed · Accepted · Superseded by ADR-n. Add new ADRs at the end with /adr <title>.
ADR-001 — Ollama as the speech backend via /v1/audio/speech
Status: Accepted
Context: The product's core value is local, private narration. Ollama ships Gradium Phonon with an OpenAI-compatible streaming speech endpoint on Apple Silicon. Decision: Use Ollama over HTTP. Do not embed MLX or the model in-process. Consequences: The user must install Ollama and pull a model, so onboarding must handle this. The app stays small and avoids redistributing CC BY-NC models. Swapping in another OpenAI-compatible TTS server later remains possible, but the speech client must not assume OpenAI-only parameters.
ADR-002 — Raw PCM response format
Status: Accepted
Context: The streaming WAV header from Ollama has max-value size fields, and AVFoundation file APIs expect complete files.
Decision: Request response_format: "pcm" (16-bit LE, mono, 24 kHz) and schedule AVAudioPCMBuffers ourselves.
Consequences: Simple streaming with no header parsing. The format assumptions live in one place (OllamaSpeechClient + PCMConverter) and are covered by fixtures.
ADR-003 — Non-sandboxed, Developer ID distribution
Status: Accepted
Context: Reading another app's selection through kAXSelectedTextAttribute requires Accessibility trust, which App Sandbox does not allow for this use.
Decision: Ship without App Sandbox, with Hardened Runtime, signed with Developer ID and notarised. No Mac App Store in v1.
Consequences: Wider capability, and with it more responsibility. SECURITY_PRIVACY.md invariants are mandatory and checked in make verify. A future sandboxed "Services-only" edition remains possible.
ADR-004 — Sentence as the synthesis and navigation unit
Status: Accepted
Context: Users need precise replay/skip. Ollama provides no timestamps, so sub-request positions cannot be mapped. Decision: Synthesise one sentence (merged if < 25 chars, split if > 1,500 chars) per request. Consequences: Exact sentence navigation and low TTFA. Prosody may break slightly at sentence boundaries. Revisit in M9 with a paragraph-mode option (ADR candidate).
ADR-005 — Playback speed in the audio layer
Status: Accepted
Context: Ollama returns 400 for unsupported options such as speed.
Decision: Apply speed via AVAudioUnitTimePitch.rate (pitch-preserving). Never send speed to the server.
Consequences: Live speed changes, and cached audio stays valid across speeds.
ADR-006 — XcodeGen + SwiftPM package for agent-friendly development
Status: Accepted
Context: Coding agents edit .pbxproj files unreliably.
Decision: All logic lives in a SwiftPM package (swift build / swift test from the CLI). The app target is defined in project.yml and generated with XcodeGen. .xcodeproj is git-ignored.
Consequences: Agents can build and test without Xcode UI. Adding files needs no project edits.
ADR-007 — Accessibility capture first, clipboard fallback opt-in
Status: Accepted
Context: Simulating ⌘C works more broadly but mutates the user's clipboard and can trigger app-specific copy behaviour. Decision: The hotkey uses AX first. Clipboard fallback is off by default and, when enabled, always restores the pasteboard. The Services menu is a separate entry point. Consequences: Some apps (certain Electron/canvas views) will not work with the hotkey by default. The error message points to Services or to enabling the fallback.