Monolex Daemons
Monolex uses standalone Rust daemons for performance-critical background operations. These daemons run as separate processes, providing crash resilience and optimal performance.Architecture
Available Daemons
PTY Daemon
Manages terminal sessions via Unix sockets. Survives app crashes for session recovery.
NIIA Watcher
File system monitoring with intelligent filtering and event batching.
NIIA MCP
Model Context Protocol server for AI integrations.
Why Separate Daemons?
Crash Resilience
Performance Isolation
Each daemon runs in its own process:- No GIL contention
- Independent memory spaces
- Parallel execution
- Dedicated CPU scheduling
Native Performance
Pure Rust implementations:- Zero JavaScript overhead
- No Node.js runtime required
- Minimal memory footprint
- Fast operations
Communication
Unix Sockets
All daemons communicate via Unix sockets:Protocol
Length-prefixed binary protocol:Binary Management
Build & Deploy
Binary Locations
| Environment | Path |
|---|---|
| Development | src-tauri/binaries/{name}-{triple} |
| Production | MacOS/{name} |
Target Triple Suffix
| Platform | Suffix |
|---|---|
| macOS ARM | aarch64-apple-darwin |
| macOS Intel | x86_64-apple-darwin |
| Linux | x86_64-unknown-linux-gnu |
| Windows | x86_64-pc-windows-msvc.exe |
Tauri Configuration
Logging
All daemons log to/tmp/:
Troubleshooting
Check Running Daemons
Kill All Daemons
Clean Socket Files
Verify Code Signing (macOS)
Characteristics
| Daemon | Binary Size | Memory | Startup |
|---|---|---|---|
| pty-daemon-rust | 953KB | Low per session | Fast |
| niia-watcher | 2.75MB | Low | Fast |
| niia-mcp | 2.36MB | Low | Fast |