System Architecture
Maestro is built on Electron with a strict security model separating the Node.js backend from the React frontend. This page provides a high-level overview of the architecture—for detailed technical documentation, see the ARCHITECTURE.md file in the source repository.Dual-Process Architecture
Maestro uses Electron’s main/renderer split with strict context isolation:Main Process
Node.js backend with full system access:
- Process spawning (PTY for terminals, child_process for AI agents)
- File system operations
- Git integration
- IPC handlers
- Secure command execution
Renderer Process
React frontend with no direct Node.js access:
- UI components
- Custom React hooks (15 hooks)
- IPC wrappers
- Theme system
- State management
Security Model
Maestro enforces security through Electron best practices:- Context isolation: Enabled (renderer has no Node.js access)
- Node integration: Disabled (no
require()in renderer) - Preload script: Exposes minimal API via
contextBridge.exposeInMainWorld('maestro', ...) - Command execution: Uses
execFileNoThrowwithspawn()andshell: falsefor security
The window.maestro API
All renderer-to-main communication flows through the preload-exposed API:
Agent Model
Each agent (what users see in the Left Bar) runs two processes simultaneously:Cmd+J) without process restarts.
Key Systems
Layer Stack System
Centralized modal/overlay management with predictable Escape key handling. Each modal registers with a priority value:- STANDING_OVATION: 1100 (highest—achievement celebrations)
- CONFIRM: 1000 (confirmation dialogs)
- QUICK_ACTION: 700 (Command palette
Cmd+K) - SETTINGS: 450
- GIT_DIFF: 200
- FILE_PREVIEW: 100 (lowest)
Process Manager
Handles two process types:- PTY Processes (via
node-pty) - Terminal sessions with full shell emulation - Child Processes (via
child_process.spawn) - AI agents with direct stdin/stdout capture
--print --output-format json for non-interactive execution.
Stream-JSON Mode: When images are attached, agents use --input-format stream-json for multimodal input.
AI Tab System
Multiple conversation tabs within each agent:- Each tab maintains its own provider session ID
- Per-tab read-only mode and save-to-history toggles
- Unread filtering and starring
- Tab switcher modal (
Alt+Cmd+T)
File Preview Tab System
File viewing integrated into the tab bar alongside AI tabs:- Unified tab order with AI and file tabs
- State persistence (scroll position, search query, edit mode)
- SSH remote file support
- Extension-based color badges
- Deduplication within sessions
Execution Queue
Sequential message processing to prevent race conditions:- Write operations queue sequentially
- Read-only operations can run in parallel
- Auto Run tasks queue with regular messages
- Visible via indicator in tab bar
Auto Run System
File-based document runner for automating multi-step tasks:- Markdown documents with checkbox tasks
- Playbooks for repeatable workflows
- Git worktree integration for parallel execution
- Loop mode with reset-on-completion
- Per-document progress tracking
Group Chat System
Multi-agent coordination with moderator AI:- Moderator orchestrates conversations via @mentions
- Agents work in parallel
- Synthesis rounds after all agents respond
- Conversation loops until complete
Custom Hooks
Maestro uses 15 custom React hooks for state management:| Hook | Purpose |
|---|---|
useSettings | Application settings with auto-persistence |
useSessionManager | Agent CRUD operations and groups |
useFileTreeManagement | File tree refresh and git metadata |
useBatchProcessor | Auto Run batch execution |
useLayerStack | Modal/overlay management |
useNavigationHistory | Back/forward navigation |
useAchievements | Achievement/badge system |
useActivityTracker | User activity tracking |
Settings Persistence
Settings stored viaelectron-store:
Locations:
- macOS:
~/Library/Application Support/maestro/ - Windows:
%APPDATA%/maestro/ - Linux:
~/.config/maestro/
maestro-settings.json- User preferencesmaestro-sessions.json- Agent persistencemaestro-groups.json- Agent groupsmaestro-agent-configs.json- Per-agent configuration
Theme System
Themes defined with mode-specific color palettes:For Developers
For detailed architecture documentation including code patterns, IPC handlers, and implementation guides, see:- ARCHITECTURE.md - Complete architecture guide
- CONTRIBUTING.md - Development setup and patterns
- CLAUDE.md - AI-focused development guide