Files
Jake 26c7307607
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — docs, scripts, root config, residuals
Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.

transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
  -> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
  as immutable audit trail). Includes architecture-map references
  to magnotia_core::*, magnotia_storage::*, etc. now pointing at
  lumotia_*; dev-setup.md tracing output examples (lumotia_startup
  target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
  audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
  hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
  crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
  crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
  doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
  ("lumotia_task_sync"); magnotia_locale i18n localStorage key
  renamed + migration shim added; CSS keyframe names
  magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
  system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
  keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
  wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
  to "lumotia era" earlier — restored).

Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
  legacy detection strings in legacy_and_target_paths() so the
  migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
  — migration call sites reference the legacy magnotia keys
  deliberately.
- docs/handovers/ — historical audit trail.

cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:38:03 +01:00

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 mapTauri runtimeCommands → 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 call build_initial_prompt(&request_prompt, &profile.initial_prompt, &profile_terms) to assemble the final Whisper prompt before passing it into TranscriptionOptions.

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:

  1. Caller-supplied request_prompt wins outright when non-empty (the caller has already made the decision).
  2. 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's initial_prompt biases the decoder toward the correct spelling at decode time, before any LLM cleanup pass.
  3. Else: profile prompt alone, or "Vocabulary: term1, term2." alone if only terms are present.
  4. 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 lumotia_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's add_profile_term is 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_prompt is 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

  • Profileslearn_profile_terms_from_edit_cmd is what populates the profile_terms list this helper consumes.
  • Transcription — both whisper paths call this helper.
  • Live transcriptionstart_live_transcription_session calls this helper once at startup and stashes the result on the config struct.
  • Commands index — back to the index.