updated 2026-11-26·11 min read
Native Runtime & Platform Bridge
Complete breakdown of Noether's Tauri v2 desktop runtime, 64 native Rust IPC commands, three-tier atomic saves, Win32 memory trimming, and lossless Markdown round-tripping.
Bundling Chromium via Electron drags installer sizes past 120 MB and leaves idle RAM sitting around 600 MB to 1.5 GB. Noether uses Tauri v2 and a compiled Rust backend over the OS webview (WebView2 on Windows, WebKit on macOS/Linux), exposing 64 IPC commands for atomic saves, rusqlite queries, local Git snapshots, and Windows working-set trimming.
1. Native Desktop Architecture with Tauri v2
┌─────────────────────────────────────────────────────────────────┐
│ Webview Frontend (React 19) │
│ TipTap Editor • Force Graph • Zustand Stores • Tailwind UI │
└────────────────────────────────┬────────────────────────────────┘
│ Tauri IPC Commands
▼
┌─────────────────────────────────────────────────────────────────┐
│ Compiled Rust Backend (Tauri v2) │
│ • rusqlite WAL Engine • Crash-Safe Atomic Saves │
│ • Asynchronous File Watcher • Win32 Memory Trimmer │
│ • Native Git Version Control • Dynamic Icon Tinting │
└────────────────────────────────┬────────────────────────────────┘
│ Direct OS Calls
▼
┌─────────────────────────────────────────────────────────────────┐
│ Local File System │
│ • Plain Text *.md Notes • .noether/noether.sqlite │
└─────────────────────────────────────────────────────────────────┘
The frontend interfaces with the operating system through Tauri IPC commands declared in src-tauri/src/ (vault.rs, db.rs, vcs.rs, icon_tint.rs, and lib.rs).
2. Native Rust Tauri IPC Commands Catalog (64 Commands)
Below is the complete catalog of native Rust commands registered via tauri::generate_handler! in src-tauri/src/lib.rs:
A. Vault & Filesystem Operations (vault.rs)
| Command Name | Arguments | Description |
|---|---|---|
get_current_vault | None | Returns the active vault path, name, and recent vault list. |
set_current_vault | vault_path: String | Switches the active workspace vault, DB, and file watcher. |
create_new_vault | name: String, parent_path: Option<String> | Initializes a new vault directory structure. |
rename_vault | target_path: String, new_name: String | Renames a vault root folder safely. |
remove_recent_vault | vault_path: String | Removes a vault from recent history. |
open_vault_in_explorer | vault_path: Option<String> | Opens the active or recent vault root in the OS file manager. |
reveal_in_explorer | path: String | Highlights a specific file in the OS file manager. |
open_in_default_app | path: String | Launches the operating system default app for a file. |
scan_vault_files | custom_vault_path: Option<String>, allowed_extensions: Option<Vec<String>> | Fast recursive filesystem walk indexing notes and assets. |
create_vault_folder | relative_path: String | Creates directory structure safely within the active vault. |
save_markdown_file | filename: String, content: String, relative_path: Option<String> | Atomic save pipeline with internal write fingerprint registration. |
read_markdown_file | filename_or_path: String | Reads UTF-8 CommonMark note text from the active vault. |
read_binary_file | filename_or_path: String | Reads binary media assets as Base64 strings. |
set_file_attributes | filename_or_path: String, readonly: Option<bool>, _modified_time: Option<u64> | Updates OS file read-only attributes. |
delete_markdown_file | filename_or_path: String | Boundary-safe note deletion in the active vault. |
rename_markdown_file | old_filename?: String, new_filename?: String, old_relative_path?: String, new_relative_path?: String | Atomically renames or moves a note on disk. |
open_plugins_folder | None | Opens <vault>/.noether/extensions/ in the OS file manager. |
open_trash_folder | None | Opens <vault>/.trash/ in the OS file manager. |
save_trash_file | filename: String, content: String, relative_path: Option<String> | Archives a note into <vault>/.trash/. |
delete_trash_file | filename_or_path: String | Permanently deletes a note from <vault>/.trash/. |
empty_trash_folder | None | Purges all files inside <vault>/.trash/. |
B. Extension Bundle Management (vault.rs)
| Command Name | Arguments | Description |
|---|---|---|
list_installed_plugins | None | Scans .noether/extensions/ (and legacy .noether/plugins/) and returns manifests. |
read_plugin_bundle | plugin_folder: String | Reads compiled extension main.js bundle and CSS stylesheets. |
install_plugin_bundle | plugin_folder: String, manifest_json: String, main_js: String, styles_css?: String | Writes extension bundle files into .noether/extensions/<id>/. |
uninstall_plugin_bundle | plugin_folder: String | Removes extension directory from disk. |
C. Native SQLite Caching & FTS5 (db.rs)
| Command Name | Arguments | Description |
|---|---|---|
noether_db_init | vault_path: Option<String> | Initializes .noether/noether.sqlite in WAL mode with 256MB mmap. |
noether_db_query | sql: String, params: Option<Vec<Value>> | Executes parameter-bound SQL queries returning JSON row arrays. |
noether_db_execute | sql: String, params: Option<Vec<Value>> | Executes SQL statements returning affected row counts. |
noether_db_transaction | queries: Vec<DbQueryItem> | Executes batch statements inside an atomic SQLite transaction. |
noether_db_supports_fts5 | None | Validates native compiled FTS5 module support. |
D. Version Control & Snapshot Engine (vcs.rs)
| Command Name | Arguments | Description |
|---|---|---|
vcs_check_status | None | Checks local Git repository availability and dirty file status. |
vcs_init_vault | None | Initializes a local Git tracking repository in the active vault. |
vcs_create_snapshot | relative_path: Option<String>, message: Option<String> | Creates an atomic Git commit snapshot of modified files. |
vcs_get_file_history | relative_path: String, limit: Option<usize> | Returns commit history log for a note. |
vcs_get_file_diff | relative_path: String, commit_a: String, commit_b: Option<String> | Generates a unified diff against target commits. |
vcs_get_historical_content | relative_path: String, commit: String | Retrieves raw note text from a historical Git commit tree. |
vcs_restore_file | relative_path: String, commit: String | Reverts a note file to a historical commit state. |
E. Window Management, Memory Trimming & System Services
| Command Name | Arguments | Description |
|---|---|---|
window_minimize / window_maximize / window_close | Window handle | Standard native window state controls. |
window_is_maximized / window_is_minimized / window_is_fullscreen | Window handle | Queries window display geometry flags. |
window_set_fullscreen | fullscreen: bool | Toggles window fullscreen mode. |
window_start_dragging | Window handle | Initiates native window dragging on custom title bars. |
window_set_title | title: String | Updates OS native window title. |
window_trim_memory | None | Calls Win32 SetProcessWorkingSetSize to flush RAM below 150MB when idle. |
notify_user_activity | None | Resets idle activity signal from the frontend. |
focus_main_window | None | Unminimizes and brings the primary application window to foreground. |
open_vault_window / close_vault_window | None | Controls secondary vault window state. |
open_settings_window / close_settings_window | tab?: String / None | Controls dedicated settings window instances. |
open_help_window / close_help_window | None | Controls dedicated help documentation window instances. |
save_app_settings / load_app_settings | settings_json: String / None | Persists global application preferences in the OS config directory. |
register_global_shortcut / unregister_global_shortcut | id: String, shortcut: String / id: String | Binds system-wide OS hotkeys. |
download_remote_text | url: String | Fetches remote extension bundles and marketplace manifests natively. |
read_clipboard_files / has_clipboard_files / copy_files_to_vault | None / source_paths, target_relative_dir? | Handles OS-level clipboard file pastes into the active vault. |
set_accent_icon | accent_color: String (icon_tint.rs) | Dynamically renders window taskbar icons tinted to theme accent. |
3. Save Pipeline and Atomic File Writes
Writing straight over note.md with standard file truncation risks leaving a 0-byte file if power drops or Windows Search / antivirus holds a temporary handle. Noether splits document writes across three tiers:
- Tier 1 (Instant In-Memory Keystroke): Keystrokes mutate the local ProseMirror document state synchronously. Word count and character count update in the status bar without re-rendering unrelated panels.
- Tier 2 (Debounced Disk Flush & Content Cache, 400ms): When typing pauses for 400ms (extended to 800ms during active typing), the active buffer flushes to disk.
- Atomic Write to Temp: Rust writes serialized CommonMark content to a process-scoped temporary file in the same directory (
file_path.with_extension(format!("tmp.{}", std::process::id())), i.e.,<filename>.tmp.<pid>). - Atomic Rename (
fs::rename): Once written, the OS atomically replaces the destination file with the temp file so notes are never left half-written. - In-Place Store Patching: During pure content edits,
saveDocumentByIdmutatesexistingDoc.content_jsonin place without creating a newdocumentsarray reference. That avoids cascading re-renders across the file tree, sidebars, and breadcrumbs.
- Atomic Write to Temp: Rust writes serialized CommonMark content to a process-scoped temporary file in the same directory (
- Tier 3 (Idle Secondary Indexing, 1200ms): Heavy secondary work (unlinked mention scanning across all notes and broken embed validation) waits on a 1200ms idle queue (
scheduleIdleSecondaryIndexing) so the main thread stays clear while typing.
4. File Watcher Echo Filtering
When Noether saves a note to disk, the OS filesystem watcher fires a change event. Without filtering, that creates a reload loop: save note → watcher detects change → reload note → reset caret.
Noether prevents self-write loops using per-path content fingerprints in src-tauri/src/vault.rs:
- Fingerprint Registration: Before
fs::renamereplaces the target file,save_markdown_filecallsregister_internal_write(&file_path, content.as_bytes()), storing the canonicalized path, byte size,xxh3_64hash, and timestamp inWRITE_FINGERPRINTS. - Echo Verification: When the watcher thread receives an event,
is_internal_echo()checks the file on disk against the stored size andxxh3_64hash (within a 30-second cache window and a 3–5s fallback for transient Windows file locks). Matching writes are ignored. - External Change Detection: If an external modification occurs (from Git or another editor), the fingerprint does not match, so Rust emits
vault-files-changedand Noether reloads the note without losing external changes. - Conflict Protection: While the editor holds focus and uncommitted edits, ProseMirror keeps authority over the active buffer so background sync does not jump the cursor.
5. Windows Memory Management
Electron Markdown apps routinely idle at 600 MB to 1.5 GB because Chromium clings to cached heaps, and even WebView2 holds working-set pages after heavy scans unless nudged.
Minimizing the window triggers window_trim_memory() immediately, while losing focus or hiding the window starts a 5-second (5000 ms) timer (scheduleTrimMemory in platformAdapter.ts). On Windows, window_trim_memory() calls SetProcessWorkingSetSize(GetCurrentProcess(), usize::MAX, usize::MAX), flushing unreferenced working-set pages back to the OS standby pool to hold idle RAM under 150 MB. Switching back within 5 seconds fires cancelTrimMemory() so Alt-Tabbing doesn’t cause paging churn.
6. Lossless Markdown Round-Trip & Source Mode Fidelity
ProseMirror wants a strict hierarchical node tree, whereas .md files on disk carry arbitrary indentation, mixed -/*/+ bullets, YAML comments, raw HTML tags, and multiline pipe tables. Noether keeps those intact across round-trips:
Verbatim Raw Frontmatter Preservation
When you open a note containing YAML frontmatter, parseFrontmatter captures the exact raw frontmatter string (_raw_frontmatter) alongside parsed key-value metadata:
- Zero Syntax Alteration: YAML comments (
# Author notes), custom multi-line indentation, folded scalars, and explicit YAML quote styles remain untouched. - Verbatim Serialization: When writing back to disk, if properties were not structurally altered via the UI metadata inspector,
formatFrontmatterre-emits the exact raw frontmatter block byte-for-byte instead of reconstructing synthetic YAML.
AST List Marker Retention
Standard CommonMark serializers discard list bullet characters upon AST ingestion, defaulting to - for every item upon disk export. Noether preserves authored list markers through explicit node attributes:
- Marker Extraction: During parsing,
matchTaskListItemLineand list parsers extract the exact list marker (-,*, or+) and persist it into the list item’s AST attributes (attrs.marker). - Targeted Serialization:
jsonToMarkdowninspectsli.attrs?.markerwhen serializing bullet lists and task lists. Nested mixed-marker lists (*for top-level,-for sub-items) keep their original markers on disk.
Multiline Table Structure & Delimiter Escaping
Markdown pipe tables often break during AST conversions. Noether protects table cell integrity with delimiter normalization:
- Multiline Cell Encoding: Line breaks within table cells are converted to
<br>tags during serialization (replace(/\r?\n/g, '<br>')) rather than collapsing into single-line spaces. Upon ingestion,<br>tags convert back intohardBreaknodes. - Pipe Delimiter Escaping: Literal pipe characters within cell text are escaped (
\|) during serialization and parsed via lookbehind splitters (split(/(?<!\\)\|/)), keeping column counts intact.
Direct Plaintext Source Mode Disk Bypass
When editing in Source Mode, you interact directly with the raw Markdown buffer:
- AST Serialization Bypass: Keystrokes in Source Mode maintain a direct raw text ref (
pendingRawMarkdownRef). When auto-save flushes, Noether pipes this raw string directly to disk viarawMarkdownOverride. - Zero Round-Trip Degradation: Because disk writes bypass
jsonToMarkdown, custom indented code fences inside task lists, Setext headings, and raw HTML blocks stay untouched. - Asynchronous Search Indexing: While disk writes remain byte-for-byte identical to the raw buffer, SQLite blocks and full-text search (
blocks_fts) still update asynchronously from the derived AST.