This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Prerequisites:
Core Development:
# Install dependencies
bun install
# Run in development mode
bun run tauri dev
# If cmake error on macOS:
CMAKE_POLICY_VERSION_MINIMUM=3.5 bun run tauri dev
# Build for production
bun run tauri build
# Frontend only development
bun run dev # Start Vite dev server
bun run build # Build frontend (TypeScript + Vite)
bun run preview # Preview built frontend
# Code quality
bun run lint # Lint frontend code
bun run lint:fix # Auto-fix linting issues
bun run format # Format all code (frontend + backend)
bun run format:check # Check formatting without modifyingModel Setup (Required for Development):
# Create models directory
mkdir -p src-tauri/resources/models
# Download required VAD model
curl -o src-tauri/resources/models/silero_vad_v4.onnx https://blob.handy.computer/silero_vad_v4.onnxmacOS Only - Qwen3 ASR Setup:
# Install MLX framework for Qwen3 ASR support
pip install mlx mlx-audio
# Or use HuggingFace mirror for faster download in China
HF_ENDPOINT=https://hf-mirror.com pip install mlx mlx-audioHandy is a cross-platform desktop speech-to-text application built with Tauri (Rust backend + React/TypeScript frontend).
Backend (Rust - src-tauri/src/):
lib.rs- Main application entry point with Tauri setup, tray menu, and managersmanagers/- Core business logic managers:audio.rs- Audio recording and device managementmodel.rs- Whisper model downloading and managementtranscription.rs- Speech-to-text processing pipelineqwen3_engine.rs- Qwen3 ASR engine for macOS (MLX-based)history.rs- Transcription history with SQLite database
audio_toolkit/- Low-level audio processing:audio/- Device enumeration, recording, resamplingvad/- Voice Activity Detection using Silero VAD
commands/- Tauri command handlers for frontend communicationshortcut.rs- Global keyboard shortcut handlingsettings.rs- Application settings managementllm_client.rs- LLM client for post-processing transcriptionclipboard.rs- Clipboard management and text pastingaudio_feedback.rs- Audio feedback system for recording statesoverlay.rs- Recording overlay window management
Frontend (React/TypeScript - src/):
App.tsx- Main application component with onboarding flowcomponents/settings/- Settings UI componentscomponents/model-selector/- Model management interfacecomponents/onboarding/- User onboarding and setup flowcomponents/AccessibilityPermissions.tsx- macOS accessibility permissions UIcomponents/Sidebar.tsx- Main navigation sidebarstores/- Zustand state management storeshooks/- React hooks for settings and model managementlib/types.ts- Shared TypeScript type definitionsi18n/- Internationalization support (i18next)
Manager Pattern: Core functionality is organized into managers (Audio, Model, Transcription, History, Qwen3Engine) that are initialized at startup and managed by Tauri's state system.
Command-Event Architecture: Frontend communicates with backend via Tauri commands, backend sends updates via events.
Pipeline Processing: Audio → VAD → Transcription Engine (Whisper/Parakeet/Qwen3) → Text output with configurable components at each stage.
Multi-Engine Support: The transcription system supports multiple ASR engines:
- Whisper: GPU-accelerated models (Small/Medium/Turbo/Large)
- Parakeet V3: CPU-optimized model with automatic language detection
- Qwen3 ASR: MLX-accelerated model for Apple Silicon (macOS only)
Core Libraries:
transcribe-rs- Multi-engine speech recognition (Whisper, Parakeet, Moonshine)whisper-rs- Local Whisper inference with GPU accelerationcpal- Cross-platform audio I/Ovad-rs- Voice Activity Detectionrdev- Global keyboard shortcutsrubato- Audio resamplingrodio- Audio playback for feedback soundsrusqlite- SQLite database for transcription historytokio- Async runtimeenigo- Keyboard/mouse simulation for text inputhandy-keys- Advanced keyboard input handling
Frontend Libraries:
- React 18 with TypeScript
- Tailwind CSS 4.1
- Zustand for state management
- Tauri 2.9 for desktop integration
- i18next for internationalization
- Sonner for toast notifications
- Lucide React for icons
Platform-Specific Features:
- macOS: Metal acceleration for Whisper, MLX for Qwen3 ASR, accessibility permissions, Apple Intelligence integration
- Windows: Vulkan acceleration, code signing
- Linux: OpenBLAS + Vulkan acceleration, Wayland support via wtype/dotool
- Initialization: App starts minimized to tray, loads settings, initializes managers
- Model Setup: First-run downloads preferred ASR model (Whisper/Parakeet/Qwen3)
- Recording: Global shortcut triggers audio recording with VAD filtering
- Processing: Audio sent to selected ASR model for transcription
- Post-Processing (Optional): Text can be processed by LLM for corrections
- Output: Text pasted to active application via system clipboard
- History: Transcription saved to SQLite database with audio file
Settings are stored using Tauri's store plugin with reactive updates:
- Keyboard shortcuts (configurable, supports push-to-talk)
- Audio devices (microphone/output selection)
- Model preferences (Whisper/Parakeet/Qwen3 variants)
- Audio feedback and translation options
- Post-processing settings (LLM provider, API key, prompts)
- History management (retention period, save preferences)
- Overlay positioning and debug mode
The application supports optional LLM-based post-processing for transcription refinement:
- Multiple Providers: OpenAI, Anthropic, Custom endpoints
- Custom Prompts: User-defined prompts for different use cases
- Prompt Management: Create, update, and delete custom prompts
- Model Selection: Choose appropriate LLM model per provider
Transcription history is managed through SQLite database:
- Database:
history.dbin app data directory - Audio Files: Stored in
recordings/directory as WAV files - Retention Policies: Time-based (3 days, 2 weeks, 3 months) or count-based
- Saved Entries: Mark entries as saved to prevent automatic deletion
- Migration Support: Handles migration from tauri-plugin-sql to rusqlite_migration
The app enforces single instance behavior - launching when already running brings the settings window to front rather than creating a new process.
Debug Mode: Access via Cmd+Shift+D (macOS) or Ctrl+Shift+D (Windows/Linux)
- View application logs
- Access app data directory
- Open recordings folder
- Check model status
Signal Handling (Unix/Linux):
SIGUSR2signal toggles recording on/off- Allows Wayland window managers to control Handy via external tools
- Small: 487 MB - Good balance of speed and accuracy
- Medium: 492 MB - Higher accuracy than Small
- Turbo: 1600 MB - Fast transcription with large model
- Large: 1100 MB - Highest accuracy for complex speech
- V2: 473 MB - CPU-optimized with good performance
- V3: 478 MB - Latest version with automatic language detection
- Qwen3-ASR-0.6B-8bit: MLX-accelerated for Apple Silicon
- Requires
mlxandmlx-audioPython packages - Automatic language detection
- Fast inference on Apple Silicon