Context
ROADMAP.md lists Local AI & Voice hardening as v2.0 Foundation work, including Whisper/Kokoro behavior on lower-end systems, integrity handling and Eco-Mode. PWA-specific local-AI work is already covered by #483/#478, and Ollama connectivity has its own issue history, but there is no cross-surface owner for the bundled/offline Voice/Local-AI runtime lifecycle itself.
The current Core Migration Ledger deliberately keeps AI services out of the initial Wave-2 Rust extraction. This issue must therefore harden the existing product capability without opportunistically turning it into an AI-in-Rust migration.
Goal
Make local speech/AI execution predictable, cancellable, privacy-truthful and resource-bounded across supported current surfaces, with a contract future Qt adapters can consume later.
Capability inventory
Inventory every relevant local execution path, model and artifact at current main, including where applicable:
- Whisper/STT models and worker/runtime path;
- Kokoro/TTS models and worker/runtime path;
- ONNX/WASM/WebGPU/native acceleration paths;
- model download URLs, versions, hashes and cache/storage locations;
- Ollama/local-network routing where it interacts with the same UI but remains a separate runtime;
- fallback/heuristic paths;
- model-manager UI/status and storage cleanup.
For each record:
execution environment
artifact size
minimum/recommended memory
startup/init cost
cancellation support
offline-after-download behavior
integrity verification
cache lifecycle
failure behavior
privacy/routing truth
Model integrity and lifecycle
- Treat model files as versioned artifacts with verifiable integrity where technically feasible.
- Detect incomplete/corrupt downloads rather than repeatedly trying to initialize them.
- Use atomic/fail-safe cache admission so a partial download is not promoted as a valid model.
- Provide explicit retry/remove/redownload behavior.
- Avoid concurrent initialization/download storms via single-flight/admission control.
- Define upgrade/replacement and stale-model cleanup semantics.
Do not silently delete large user-downloaded models merely because initialization fails once.
Low-end / Eco-Mode contract
Define evidence-based Eco-Mode behavior rather than an ambiguous label. Candidate controls may include, where supported:
- smaller model preference;
- reduced concurrency;
- deferred/prevented background preloading;
- lower memory/cache pressure;
- CPU/GPU backend preference based on measured capability;
- reduced speculative/background AI work.
Eco-Mode must not alter manuscript/project correctness. It may reduce AI quality/performance features explicitly, but autosave/editor interaction must remain responsive.
Responsiveness and resource safety
Measure representative low/mid/high classes for:
- first model initialization;
- warm initialization;
- peak/resident memory;
- STT/TTS latency/throughput;
- cancellation latency;
- long-session memory slope;
- editor input/autosave latency while inference runs;
- simultaneous model request behavior;
- background-tab/window suspend/resume where applicable.
Prevent local inference from starving save/recovery operations or making the editor unusable.
Failure / cancellation semantics
Every long-running local model operation must have a deterministic outcome for:
USER_CANCELLED
TIMEOUT
MODEL_MISSING
MODEL_CORRUPT
MODEL_LOAD_FAILED
RESOURCE_LIMIT
BACKEND_UNAVAILABLE
UNSUPPORTED_CAPABILITY
Do not expose raw worker/ONNX/native exception strings as user guidance. Coordinate portable structured diagnostic semantics with #551 while keeping manuscript/prompt/audio content out of logs by default.
Privacy/routing truth
The UI must clearly distinguish:
- browser/device-local model execution;
- local-network Ollama execution;
- cloud-provider execution;
- any WorldScript-hosted proxy route.
Coordinate user-facing security/privacy wording with #549 and PWA-specific routing/capability acceptance with #483/#478.
Cross-surface strategy
Regression matrix
At minimum cover:
- first download/init;
- warm offline init after valid download;
- interrupted/corrupt download;
- hash/integrity mismatch where supported;
- two simultaneous init requests;
- cancel during download/load/inference;
- timeout;
- low-memory/resource rejection;
- Eco-Mode on/off;
- backend unavailable/fallback;
- model removal/redownload;
- long-session repeated inference;
- editor/autosave coexistence;
- truthful local/cloud routing labels.
Acceptance criteria
Non-goals
- porting all AI services into Rust;
- changing cloud-provider product policy;
- implementing collaboration/local-first architecture;
- inventing telemetry that uploads manuscript/audio content;
- coupling this work to the current S2 bootstrap convergence.
Context
ROADMAP.mdlists Local AI & Voice hardening as v2.0 Foundation work, including Whisper/Kokoro behavior on lower-end systems, integrity handling and Eco-Mode. PWA-specific local-AI work is already covered by #483/#478, and Ollama connectivity has its own issue history, but there is no cross-surface owner for the bundled/offline Voice/Local-AI runtime lifecycle itself.The current Core Migration Ledger deliberately keeps AI services out of the initial Wave-2 Rust extraction. This issue must therefore harden the existing product capability without opportunistically turning it into an AI-in-Rust migration.
Goal
Make local speech/AI execution predictable, cancellable, privacy-truthful and resource-bounded across supported current surfaces, with a contract future Qt adapters can consume later.
Capability inventory
Inventory every relevant local execution path, model and artifact at current
main, including where applicable:For each record:
Model integrity and lifecycle
Do not silently delete large user-downloaded models merely because initialization fails once.
Low-end / Eco-Mode contract
Define evidence-based Eco-Mode behavior rather than an ambiguous label. Candidate controls may include, where supported:
Eco-Mode must not alter manuscript/project correctness. It may reduce AI quality/performance features explicitly, but autosave/editor interaction must remain responsive.
Responsiveness and resource safety
Measure representative low/mid/high classes for:
Prevent local inference from starving save/recovery operations or making the editor unusable.
Failure / cancellation semantics
Every long-running local model operation must have a deterministic outcome for:
Do not expose raw worker/ONNX/native exception strings as user guidance. Coordinate portable structured diagnostic semantics with #551 while keeping manuscript/prompt/audio content out of logs by default.
Privacy/routing truth
The UI must clearly distinguish:
Coordinate user-facing security/privacy wording with #549 and PWA-specific routing/capability acceptance with #483/#478.
Cross-surface strategy
Regression matrix
At minimum cover:
Acceptance criteria
Non-goals