4.8 KiB
4.8 KiB
AGENTS.md — Vorleser
Vorleser is a macOS 14+ (Apple Silicon) menu-bar app. It reads the user's current text selection in any app aloud through a local Ollama speech model (Gradium Phonon) and gives sentence- and paragraph-level playback control. Swift 6, SwiftUI + AppKit, SwiftPM package + XcodeGen app target.
Source of truth — read on demand, not all at once
| When you work on… | Read first |
|---|---|
| Anything (overview, modules, state machine, budgets) | docs/ARCHITECTURE.md |
| What to build next / task scope / acceptance criteria | docs/IMPLEMENTATION_PLAN.md, docs/PROGRESS.md |
| Ollama HTTP, voices, errors, fixtures | docs/OLLAMA_SPEECH_API.md |
| Selection capture, Accessibility, Services, clipboard | docs/SELECTION_CAPTURE.md |
| AVAudioEngine, PCM, speed, events | docs/AUDIO_PIPELINE.md |
| Logging, network, permissions, caching | docs/SECURITY_PRIVACY.md (hard requirements) |
| Tests | docs/TESTING.md |
| Why something is the way it is | docs/DECISIONS.md |
| Product intent and user stories | docs/PRD.md |
docs/CODING_STANDARDS.md is always loaded through opencode.json. Follow it.
When you load a referenced file, treat its content as mandatory instructions. If two documents conflict, ARCHITECTURE.md wins. Raise the conflict to the user and fix the documents.
Commands
make bootstrap # install xcodegen/swiftformat/swiftlint via Homebrew if missing
make generate # xcodegen generate → Vorleser.xcodeproj (git-ignored)
make build # swift build (package) + xcodebuild app (Debug)
make test # swift test (unit, contract, component)
make verify # format check + lint + build + test + privacy grep checks ← must be green before "done"
make app # build and launch Vorleser.app (Debug)
make live-test # tests against a real local Ollama (VORLESER_LIVE=1)
make fixtures # scripts/capture-fixtures.sh → Packages/VorleserKit/Tests/VorleserOllamaTests/Fixtures
swift run --package-path Packages/VorleserKit vorleser-cli --help # headless harness: models, voices, speak, segment, read
The package (Packages/VorleserKit/ — Sources/, Tests/) builds and tests without Xcode UI. Prefer swift build / swift test for fast feedback. Use xcodebuild only for the App/ target.
Workflow for every task
- Read
docs/PROGRESS.md, then pick the task (T<m>.<n>) the user named or the next open one in order. Do not skip milestones; M4 (headless CLI reading) must work before UI milestones. - Read the task row in
docs/IMPLEMENTATION_PLAN.mdand the relevant section of the referenced docs. - Plan briefly: files to add or change, protocols touched, tests to write.
- Write tests first for logic: Swift Testing, using fakes from
VorleserTestSupport. - Implement the smallest change that meets the acceptance criteria.
- Run
make verify. Fix until green. Never weaken or delete a test to make it pass. - Update
docs/PROGRESS.md(checkbox, date, one-line note). If you changed a contract or made a design choice, update the relevant doc and/or add an ADR todocs/DECISIONS.md. - Summarise: what changed, how it was verified, open follow-ups.
Non-negotiables
- Privacy: never log selected text, except with
privacy: .private; prefer counts. No telemetry. Networking only inVorleserOllama. Loopback endpoint by default. See SP-1…SP-10. - Faithful reading: never summarise, rewrite, or "improve" the user's text. Only the mechanical normalisation N1–N5.
- Ollama request body = exactly
model,input,voice,response_format. Never sendspeedorinstructions(the server returns 400). - Never hard-code voice lists. Discover them via
/api/show. - Capture only on explicit trigger. No AX observers on other apps.
- Module boundaries per ARCHITECTURE §3.
App/holds no business logic. - Swift 6 strict concurrency, zero warnings.
- Dependencies: only
KeyboardShortcuts(app) andswift-argument-parser(CLI only). Anything else needs an ADR and user approval. - Do not edit
Vorleser.xcodeproj(generated). Editproject.yml. - Do not run
git push, change signing identities, or touch notarisation credentials without the user's explicit request.
Environment facts
- Ollama ≥ 0.40.9 at
http://127.0.0.1:11434. Speech models:phonon(EN, Apache-2.0),phonon:40m-{en,de,fr,es,pt,multilingual}(CC BY-NC 4.0). - Audio from Ollama: PCM16LE, mono, 24 kHz, streamed. 48,000 bytes/s.
- Max 4,096 chars per request; Vorleser caps segments at 1,500.
- Things you cannot test headlessly: Accessibility capture, global hotkeys, the Services menu, the panel's focus behaviour, and audio route changes. For these, write the code behind protocols, unit-test the logic, and give the user a precise manual test script.