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>
4.0 KiB
name, type, slice, last_verified
| name | type | slice | last_verified |
|---|---|---|---|
| commands/mod.rs — module roots and prompt builder | architecture-map-page | 02-tauri-runtime | 2026/05/09 |
commands::mod
Where you are: Architecture map → Tauri runtime → Commands → mod.rs
Plain English summary. mod.rs declares all 25 child modules (22 command modules, 3 utility modules) and exports one shared helper: build_initial_prompt. The helper is the precedence rule that decides what the Whisper initial_prompt actually is when a command receives caller-supplied prompt text plus a profile prompt plus a list of profile vocabulary terms.
At a glance
- Path:
src-tauri/src/commands/mod.rs. - LOC: 114 (60 of those are tests).
- Tauri commands exposed: none.
- Events emitted: none.
- Depends on: nothing crate-external.
- Called from:
commands::transcription(whisper PCM path and file path),commands::live::start_live_transcription_session. Both callbuild_initial_prompt(&request_prompt, &profile.initial_prompt, &profile_terms)to assemble the final Whisper prompt before passing it intoTranscriptionOptions.
What's in here
Module declarations (src-tauri/src/commands/mod.rs:1)
audio, clipboard, diagnostics, feedback, fs, hardware,
hotkey, intentions, live, llm, meeting, models,
mod (this file), nudges, paste, power, profiles,
rituals, security, tasks, transcription, transcripts,
tts, update, windows
All declared pub mod, so any sibling module can use crate::commands::name.
build_initial_prompt(request_prompt, profile_prompt, profile_terms) -> Option<String> (src-tauri/src/commands/mod.rs:39)
Precedence:
- Caller-supplied
request_promptwins outright when non-empty (the caller has already made the decision). - Else: profile's stored prompt + profile terms (joined as
"<profile prompt> Vocabulary: term1, term2."). The vocabulary line is the OpenWhispr pattern: feeding domain terms into Whisper'sinitial_promptbiases the decoder toward the correct spelling at decode time, before any LLM cleanup pass. - Else: profile prompt alone, or
"Vocabulary: term1, term2."alone if only terms are present. - Else:
None.
Whitespace-only terms are skipped. Whitespace-only prompts are treated as empty. The returned Option<String> is what every Whisper-side command stuffs into TranscriptionOptions::initial_prompt.
Tests (src-tauri/src/commands/mod.rs:65)
Six test cases cover each branch of the precedence rule plus whitespace handling. These are pure-function tests, no DB.
Data flow
The helper is called after the calling command has read the relevant ProfileRow and ProfileTermRows from magnotia_storage. The DB I/O lives in the calling command (so the tests in this file stay pure).
Watch-outs
- The helper does not de-duplicate terms. If the same term appears twice in
profile_terms, it lands twice in the vocabulary sentence. The storage layer'sadd_profile_termis what enforces uniqueness, but if the terms list ever comes from somewhere else, dedup at the call site. - Vocabulary length is not capped here. A profile with hundreds of terms will produce a very long
initial_prompt, and Whisper has a context-window limit that depends on the model. If you ever ship a UI that lets users add unlimited terms, add a cap in the calling commands or here. - The whisper.cpp
initial_promptis best-effort only. It biases decoding but does not guarantee a particular word will be produced. Profile-edit-derived corrections (commands::profiles::learn_profile_terms_from_edit_cmd) feed back into this path on the next session.
See also
- Profiles —
learn_profile_terms_from_edit_cmdis what populates theprofile_termslist this helper consumes. - Transcription — both whisper paths call this helper.
- Live transcription —
start_live_transcription_sessioncalls this helper once at startup and stashes the result on the config struct. - Commands index — back to the index.