Why Local-First Open Source Demands Strict Phase 0 Governance#
Building a voice AI language tutor (STT -> LLM -> TTS) and Mandarin Studio completely free and open-source introduces an engineering paradox: the final product must run effortlessly on a developer's single desktop GPU, while its public repositories (speakon-services and speakon-mobile) must maintain strict zero-leak hygiene, OSI license compliance, and deterministic CI from commit one.
In Phase 0, before writing a single speech inference model or UI screen, we established the Shared Aldeon Foundation (CHILD_BOOTSTRAP_STANDARD.md and SERVICE_BLUEPRINT.md) and bootstrapped both public Apache-2.0 repositories alongside automated governance.
Architecture: Loopback Web, Paired LAN Mobile, Zero Web Backend#
SpeakOn splits responsibilities cleanly across three surfaces without ever duplicating state or violating Aldeon's zero-backend rule inside aldeon/app:
- Consolidated Web Portal (
aldeon/app/src/routes/speakon/): Served over HTTPS on Vercel, it keeps zero database connections or backend routes. Browser clients communicate strictly withhttp://127.0.0.1:8000(exempt from mixed-content blocking) rather than arbitrary LAN IPv4 addresses. - Local Desktop FastAPI Orchestrator (
Celio1878/speakon-services): Binds127.0.0.1:8000by default, isolating heavy AI dependencies (faster-whisper,kokoro,silero-vad, PyTorch cu128) in an optional[project.optional-dependencies].aiextra. That keeps base installations lightweight and lets GitHub Actions run full lint,mypy --strict,pytest, and OpenAPI drift checks in ~20 seconds on CPU runners. - Expo Prebuild Native Mobile Client (
Celio1878/speakon-mobile): Configured with strict TypeScript ("strict": true), 64-bit Android ABIs (arm64-v8a,x86_64), and throttled Gradle workers (workers.max=4) to prevent Linux OOM daemon crashes during local native builds, while validating both Android and iOSexpo prebuildtrees in CI.
Security: Private Network Access, Zero-Leak Gates, and License Hygiene#
Shipping public repositories from an active multi-product workstation surfaces subtle security and licensing pitfalls that we caught and automated immediately in Phase 0:
- Chrome Private Network Access (PNA) + Starlette 1.10+: When an HTTPS page calls
http://127.0.0.1:8000, Chromium issues a CORS preflight withAccess-Control-Request-Private-Network: true. Starlette1.10.0rejects this by default with400 Disallowed CORS private-networkunlessallow_private_network=Trueis enabled—and still emits the PNA header on failed origin checks if left unwrapped. We combinedCORSMiddleware(allow_private_network=True)with an outerPrivateNetworkAccessMiddlewarethat enforces our explicit origin allowlist before returningAccess-Control-Allow-Private-Network: true. - Pre-Publish Secret Scanning & Privacy Checks: Before running
gh repo create --public, both repositories passedgitleaks detect(backed by a SHA-256-verified binary in CI instead of licensed third-party actions) and filesystem privacy scans ensuring no personal paths, emails,.envfiles, or keystores appear in source defaults. - License Guardrails: Because
piper-tts >= 1.3(piper1-gpl) is GPL-3.0, SpeakOn explicitly rejects it in favor of the archived MIT standalonepiper2023.11.14-2binary verified by SHA-256 (scripts/check_models.py) alongsideKokoro-82M(Apache-2.0) andrhasspy/piper-voices(MIT). - Terraform Repository Governance:
infra/terraform/imports both GitHub repositories and enforces branch protection onmainanddevelop(requiringciandgitleaksstatus checks), vulnerability alerts, and secret push protection.
Reliability: Diagnostics, Dependency Pinning, and OpenAPI Contracts#
Reliable local AI tooling starts with fast environment verification and repeatable builds:
speakon doctorDiagnostics & Proxy Bypass:uv run speakon doctorvalidatesuv,bun,docker,terraform,gh,eas,gddy,gitleaks,espeak-ng, CUDA GPU availability,HF_HOMEwritability, and host Ollama model tags via/api/tagswithout triggering unwanted pulls. Crucially, testing uncovered that hostHTTP_PROXYenvironment variables hijack loopbackhttpxcalls to127.0.0.1:11434(400 Direct IP access is not allowed), so all local Ollama clients explicitly settrust_env=False.- FastAPI + OpenTelemetry Pinning: Unbounded
fastapi>=0.115.0pulled0.165.1alongsideopentelemetry-api 1.46.0, breakingTestClientwith aTypeErrorin native telemetry logger initialization. Pinningfastapi>=0.115.0,<0.135.0inpyproject.tomlanduv.lockeliminated the failure cleanly. - Deterministic OpenAPI Drift Checks:
scripts/export_openapi.py --checkruns in CI to guaranteeopenapi.jsonnever drifts out of sync before TypeScript clients are generated for web and mobile.
Next Up#
With Phase 0's public repositories, CI pipelines, and Terraform governance live and green, Phase 1 will implement the modular app/stt, app/llm, app/tts, and app/vad local AI pipeline and benchmark RTX 3070 memory and turn latency.
