--- name: Workspace Cargo.toml type: architecture-map-page slice: 05-core-storage-hotkey-build last_verified: 2026/05/09 --- # Workspace Cargo.toml > **Where you are:** [Architecture map](../README.md) → [Core, Storage, Hotkey, Build](README.md) → Workspace Cargo.toml **Plain English summary.** The repo-root `Cargo.toml`. Tiny — 161 bytes. Defines the Cargo workspace (one binary at `src-tauri/`, every crate under `crates/*`) and the release profile that produces the Tauri bundle artefacts. ## At a glance - File: `/Cargo.toml` (repo root, 161 bytes). - External: none. The workspace root has no dependencies of its own; member crates pin their own versions. - Consumers: every Cargo invocation. `cargo check --workspace` from the repo root walks the members. ## Contents ```toml [workspace] members = ["src-tauri", "crates/*"] resolver = "2" [profile.release] codegen-units = 1 lto = "thin" opt-level = 3 panic = "abort" strip = "symbols" ``` ## Members The `crates/*` glob picks up every directory under `crates/` that contains a `Cargo.toml`. Members at the time of writing: - `crates/core/` → `magnotia-core` - `crates/storage/` → `magnotia-storage` - `crates/hotkey/` → `magnotia-hotkey` - `crates/audio/` → audio capture (slice 3) - `crates/transcription/` → transcription engines (slice 3) - `crates/llm/` → `magnotia-llm` (slice 4) - `crates/ai-formatting/` → `magnotia-ai-formatting` (slice 4) - `crates/mcp/` → `magnotia-mcp` (slice 4) - `crates/cloud-providers/` → `magnotia-cloud-providers` (slice 4) - `src-tauri/` → the Tauri binary `magnotia` (slice 2) ## Resolver `resolver = "2"` is mandatory for any workspace that mixes feature flags across `[dependencies]` and `[build-dependencies]` or `[dev-dependencies]`. Without it, features unify in surprising ways (a build-script-only feature can silently affect the runtime crate). Tauri 2's docs require resolver 2. ## Release profile ```toml codegen-units = 1 # one codegen unit; longer compile, better optimisation lto = "thin" # cross-crate inlining without full LTO's compile blow-up opt-level = 3 # standard optimised panic = "abort" # smaller binaries; no unwind tables; mandatory for embedded panics strip = "symbols" # debug symbols stripped from release artefacts ``` The `panic = "abort"` setting is a deliberate trade-off: - **Plus:** smaller binary, no `__rust_panic_unwind` machinery, faster cold start. - **Minus:** any panic is fatal. The crash hook (slice 2) writes a `.crash` file before the process dies; the diagnostic-report bundler in Settings → About surfaces it on next launch. `lto = "thin"` not `"fat"` because thin LTO gives most of the optimisation benefit at a fraction of the compile time. Whisper-rs-sys + llama-cpp-sys-2 are already huge C++ builds; saving build time matters more than the last 5% of optimisation. ## Watch-outs - **No `[workspace.dependencies]` block.** Each member crate pins its own dep versions independently. Side effect: `sqlx 0.8` in `magnotia-storage` and `sysinfo 0.35` in `magnotia-core` could drift between members. A future tidy would centralise common pins. - **No `[patch]` overrides.** Useful to know — every crate is consumed at its registered version. - **`codegen-units = 1` makes release builds slow.** ~10 minutes on Jake's Monolith for a clean `cargo tauri build`. Acceptable for release; use `cargo tauri dev` (debug, default) for iteration. - **No `[profile.dev]` overrides.** Default debug build. `cargo build` produces a binary in `target/debug/`. The workspace target dir is `./target` at the repo root, **not `src-tauri/target`** — this caught the CI cache step (see [`ci-pipeline.md`](ci-pipeline.md)). ## See also - [CI pipeline](ci-pipeline.md) — uses this profile for release builds. - [Dev launcher and scripts](dev-launcher-and-scripts.md) — `npm run dev:tauri` uses the default debug profile via the canonical `run.sh` launcher. - [Storage Cargo configuration](storage-overview.md) — the per-crate sqlx feature stripping.