Five-slice navigable map of the entire codebase under
docs/architecture-map/. Each slice is a self-contained
breadcrumbed sub-tree:
01-frontend (16) Svelte/SvelteKit UI
02-tauri-runtime (26) src-tauri commands + lifecycle
03-audio-transcription (16) audio + transcription crates
04-llm-formatting-mcp (19) llm, ai-formatting, mcp, cloud
05-core-storage-hotkey-build core, storage, hotkey, workspace,
(26) CI, dev glue
Plus master README.md and data-flow-end-to-end.md tracing
audio bytes from microphone to FTS5 search to MCP read.
Generated by 5 parallel subagents on 2026/05/09 against
HEAD 3c47000. Each page has YAML frontmatter, file:line code
refs, sibling cross-links, plain-English summaries.
Aggregated debt surfaced (full lists in master README):
RB-08 macOS power assertion, schema head drift v14 vs v15,
VAD blocked on ort version conflict, streaming primitives
not wired into live.rs, no prompt versioning, MCP has no
auth, cloud-providers in-memory keystore, SettingsPage
2 484 LOC, commands/live.rs 1 737 LOC, dual theme system,
brand rename to Lumenote pending across the codebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9.2 KiB
9.2 KiB
name, type, slice, last_verified
| name | type | slice | last_verified |
|---|---|---|---|
| Slice 02 — Tauri runtime | architecture-map-page | 02-tauri-runtime | 2026/05/09 |
Slice 02 — Tauri runtime
Where you are: Architecture map → Tauri runtime
Plain English summary. The Tauri runtime is the bridge between Magnotia's Svelte frontend and the Rust workspace crates. It owns app startup (database init, panic hook, plugin wiring, preferences injection), the system tray, the secondary windows (task float, transcript viewer, transcription preview), and the entire #[tauri::command] surface that the frontend invokes for audio capture, transcription, LLM cleanup, task and transcript CRUD, paste, TTS, hotkeys, diagnostics, and more. Everything that runs on the host process but is not pure crate logic lives here.
At a glance
- Path:
src-tauri/ - Total LOC (Rust + Cargo + JSON, excluding
gen/): ~8,690. - Tauri version:
2(seesrc-tauri/Cargo.toml:44). - Bundle identifier:
uk.co.corbel.magnotia(src-tauri/tauri.conf.json:5). - Plugins (always-on):
tauri-plugin-opener,tauri-plugin-dialog,tauri-plugin-notification. - Plugins (desktop-only, gated
cfg(not(target_os = "android"))):tauri-plugin-global-shortcut,tauri-plugin-autostart(LaunchAgent),tauri-plugin-window-state. Thetray-iconTauri feature is also desktop-only. - Workspace crates pulled in:
magnotia-core,magnotia-audio,magnotia-transcription(default-features off,whisperre-enabled here),magnotia-ai-formatting,magnotia-storage,magnotia-cloud-providers,magnotia-hotkey,magnotia-llm. - Tauri commands exposed via
invoke_handlerinsrc-tauri/src/lib.rs:321: 71 commands. - Capability files:
src-tauri/capabilities/main.json(main window) andsrc-tauri/capabilities/secondary-windows.json(task float, transcript viewer, transcription preview). - Command modules: 22
#[tauri::command]modules plus 3 utility modules (mod.rs,power.rs,security.rs). - Integration tests:
src-tauri/tests/config_hardening.rs(3 tests guarding CSP, updater signing, secondary-window permissions).
Map of this slice
App boot, config, tests:
- App lifecycle.
src-tauri/src/main.rsandsrc-tauri/src/lib.rs. Run entry, AppState construction, plugin wiring, preferences injection, X11-on-Wayland workaround, panic hook, error-log pruning, command registration. - System tray. Desktop-only tray icon and menu (
src-tauri/src/tray.rs). - Tauri config.
tauri.conf.jsonplus the Linux native-decorations overlay; CSP, window defaults, bundle settings. - Capabilities and ACL. The two ACL files in
capabilities/, what each scopes, and the Phase 9 high-risk-permission firewall. - Cargo and features.
Cargo.toml, thewhispercargo feature, the per-target dependency blocks,build.rs,.cargo/config.toml. - Tests. Config-hardening regression tests.
Command modules (entry index):
- Commands index. Every command file with a one-liner.
Individual command pages (linked from the commands index):
- Audio capture, Live transcription, Paste at cursor, Models registry and runtime, Transcription, Local LLM, Text to speech, Tasks and decomposition, Transcripts CRUD, Diagnostics and reports, Implementation intentions, Profiles, Window management, Hotkey bridge, Feedback capture, Power assertions and security, Small commands, mod.rs registration.
How this slice connects to others
- Frontend (slice 01). Every
#[tauri::command]is invoked from Svelte via@tauri-apps/api/coreinvoke(). Events emitted viaapp.emit(...)are consumed vialisten()in the frontend. Live transcription uses typedtauri::ipc::Channelinstead of plain events; the channel pair is created on the JS side and passed in as command args. - Audio + transcription (slice 03).
commands::audiocallsmagnotia_audio::{MicrophoneCapture, WavWriter, decode_audio_file_limited, resample_to_16khz, probe_audio_duration_secs}.commands::transcriptionandcommands::livecallmagnotia_transcription::LocalEngineplusmagnotia_audio::StreamingResampler.commands::modelscallsmagnotia_transcription::{model_manager, load_whisper, load_parakeet}. - LLM + formatting + MCP (slice 04).
commands::llmcallsmagnotia_llm::{LlmEngine, model_manager, ContentTags, LlmModelId}andmagnotia_ai_formatting::{llm_cleanup_text, LlmPromptPreset}.commands::taskscallsmagnotia_llm::prompts::FeedbackExampleand the engine'sdecompose_task_with_feedback/extract_tasks_with_feedback/extract_content_tags.commands::transcriptionandcommands::livecallmagnotia_ai_formatting::{post_process_segments, FormatMode, PostProcessOptions}.commands::profilescallsmagnotia_ai_formatting::extract_correctionsfor auto-learned vocabulary. - Core + storage + hotkey + build (slice 05). Everything DB-touching goes through
magnotia_storage(init,database_path,get_setting,set_setting,prune_error_log, the full set of CRUD helpers,app_data_dir,crashes_dir,logs_dir,list_recent_errors,log_error).commands::hardwareandcommands::modelscallmagnotia_core::{hardware, model_registry, recommendation, types, constants}.commands::meetingcallsmagnotia_core::process_watch.commands::hotkeyis a thin Tauri wrapper aroundmagnotia_hotkey::{EvdevHotkeyListener, HotkeyCombo, HotkeyEvent}.build.rsis the build-system half of the slice (CSP regression guard plus ggml multi-definition link arg).
Open questions / debt
commands/live.rsis 1,737 LOC. The runtime, loop state, speech gate, dedup, and chunking logic share the file. Splitting per concern would track against the broader refactor pass already mooted in the in-repo code review (docs/code-review-2026-04-22.md). Seecommands/live.mdfor the breakdown.commands::update::install_updatereturns a hard-coded "Updates are disabled until release signing is configured." (src-tauri/src/commands/update.rs:15). The integration testupdater_is_signed_or_absent(src-tauri/tests/config_hardening.rs:35) only asserts that if an updater config ships, it carries a non-empty pubkey. There is currently no updater config intauri.conf.json, so the test is an empty no-op.commands::power::PowerAssertionis a no-op on Linux and Windows (src-tauri/src/commands/power.rs:90). Only macOS has a real implementation viaobjc2. The doc comment promisesSetThreadExecutionState(Windows) and logind inhibitors (Linux), but neither is wired up. Symptom: long live-dictation sessions on Linux can be idled by the compositor.src-tauri/.cargo/config.tomlhard-codesLIBCLANG_PATH = "C:\\Program Files\\LLVM\\bin"(Windows). It is harmless on non-Windows hosts (env var is just unused) but it is a foot-gun if someone moves Clang elsewhere on Windows. See Cargo and features.- The Linux Wayland workaround in
lib.rs(ensure_x11_on_wayland) sets env vars before any threads spawn. This is the right pattern, but it ships even when the user is on a working DMA-BUF stack. The override knob isWEBKIT_DISABLE_DMABUF_RENDERER=0set by the user; documented in the function header but not surfaced anywhere user-visible. commands::diagnostics::install_panic_hookwrites a "minimal text dump" without backtraces unless the user hasRUST_BACKTRACE=1set (src-tauri/src/commands/diagnostics.rs:42). The packaged binary does not set it, so production crash dumps will lack stack traces. Document or default-enable.commands::audio::list_audio_devicesis gatedensure_main_windowbut thesecondary-windowscapability does not invoke it, which is correct. Theclipboard::copy_to_clipboardcommand, by contrast, has no main-window guard and any window with thecore:defaultpermission can call it; intentional, but worth flagging.
Existing in-repo docs
docs/code-review-2026-04-22.md. The MAJOR / MINOR review that motivated several of the safety helpers seen here (the parallel-mode loopback CSP guard inbuild.rs, secondary-window high-risk-permission test, RB-06 worker-join incommands::audio, RB-07compose_acceleratorsincommands::models, RB-08 macOS App Nap power assertion incommands::power).docs/issues/. Open issue threads, several of which the diagnostic-report bundler exists to feed.docs/whisper-ecosystem/brief.md. Source of the numbered "brief items" cited in code comments (item #2 = loopback LLM CSP, item #9 = App Nap, items #10/#17 = paste / replace flows, item #19 = progressive WAV writer, item #28 = sequential-GPU mode).docs/handovers/. Daily handover docs that cite specific command surfaces; useful when the in-source comments cite a "RB-NN review point".docs/dev-setup.md. Linux + Windows + macOS toolchain setup, including the Vulkan loader install required for GPU-backed whisper.cpp.