Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

Sync voice server configuration with authoritative system

Daniel Miessler20993c68cd34
diff --git a/README.md b/README.md
index 28fb3b9f..af147948 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,16 @@
> **✨ v0.5.0 NEW:** Skills-based PAI architecture with 92.5% token reduction! Core identity now in skill description, zero hook overhead. [See details below →](#-recent-updates)
+<details>
+<summary><strong>📅 2025-10-19 - Automated Documentation Update</strong></summary>
+
+- **Voice:** 2 updated
+
+*Updated by pre-commit hook: 3 modified*
+
+</details>
+
+
<details>
<summary><strong>📅 2025-10-19 - Automated Documentation Update</strong></summary>
diff --git a/documentation/voice-system.md b/documentation/voice-system.md
index 6ea8ec93..b9bc22ec 100644
--- a/documentation/voice-system.md
+++ b/documentation/voice-system.md
@@ -1,7 +1,7 @@
# PAI Voice System Documentation
## Overview
-The PAI Voice System provides text-to-speech capabilities for Kai and all agents using macOS native Premium and Enhanced voices. The system uses a unified stop-hook approach where completion messages are read aloud with distinct voices for Kai and each specialized agent, providing voice differentiation through character-matched, high-quality neural TTS voices.
+The PAI Voice System provides text-to-speech capabilities for Kai and all agents using ElevenLabs TTS API. The system uses a unified stop-hook approach where completion messages are read aloud with distinct voices for Kai and each specialized agent, providing voice differentiation through character-matched, high-quality ElevenLabs voices.
## Architecture Overview
@@ -9,10 +9,10 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
1. **Voice Server** (`${PAI_DIR}/voice-server/server.ts`)
- Bun-based HTTP server running on port 8888
- - Uses macOS native `say` command with Premium/Enhanced voices
- - Supports both voice name and speech rate control
+ - Uses ElevenLabs API for high-quality TTS generation
+ - Plays audio using macOS afplay command
- Provides notification display alongside voice output
- - Zero API costs (no cloud services required)
+ - Requires ELEVENLABS_API_KEY in ~/.env
2. **Stop Hook** (`${PAI_DIR}/hooks/stop-hook.ts`)
- Triggers after every Claude Code response
@@ -23,8 +23,8 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
3. **Agent Configurations** (`${PAI_DIR}/agents/*.md`)
- Each agent has a unique voice matching their personality
- - Voice names defined in agent frontmatter (`voiceId:`)
- - Voice mappings centralized in stop-hook.ts
+ - Voice IDs defined in hooks (ElevenLabs voice IDs)
+ - Voice mappings centralized in stop-hook.ts and subagent-stop-hook.ts
## How It Works
@@ -46,46 +46,45 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
- Determines if it was Kai or an agent who completed the task
4. **Voice Selection**
- - For Kai's completions: Uses Jamie (Premium) - UK Male
- - For agent completions: Uses the agent's specific voice
+ - For Kai's completions: Uses ElevenLabs voice ID s3TPKV1kjDlVtZbl4Ksh
+ - For agent completions: Uses the agent's specific ElevenLabs voice ID
5. **Voice Generation**
- Stop hook sends POST request to voice server at localhost:8888
- - Request includes the completion message and voice name
- - Server uses macOS `say` command with specified Premium/Enhanced voice
- - Audio plays through system speakers
-
-## Voice Mappings
-
-All entities use high-quality macOS Premium or Enhanced neural voices for natural, realistic speech. Voices are selected to match each entity's personality and role.
-
-| Entity | Voice | Type | Accent | Gender | Personality Match |
-|--------|-------|------|--------|--------|-------------------|
-| Kai | Jamie (Premium) | Premium | UK | Male | Professional, conversational |
-| Researcher | Ava (Premium) | Premium | US | Female | Analytical, highest quality |
-| Engineer | Tom (Enhanced) | Enhanced | US | Male | Steady, professional |
-| Architect | Serena (Premium) | Premium | UK | Female | Strategic, sophisticated |
-| Designer | Isha (Premium) | Premium | Indian | Female | Creative, distinct |
-| Pentester | Oliver (Enhanced) | Enhanced | UK | Male | Technical, sharp |
-| Writer | Samantha (Enhanced) | Enhanced | US | Female | Articulate, warm |
-
-### Voice Quality Levels
-
-- **Premium voices**: Highest quality neural TTS (marked with "Premium")
- - Ava, Jamie, Serena, Isha
- - Larger model files (94MB - 457MB)
- - Best audio quality available in macOS
-
-- **Enhanced voices**: High-quality neural TTS (marked with "Enhanced")
- - Tom, Oliver, Samantha
- - Excellent quality, slightly smaller models
- - Still far superior to legacy voices
+ - Request includes the completion message and ElevenLabs voice_id
+ - Server calls ElevenLabs API to generate audio
+ - Audio is saved to /tmp and played using afplay
+ - Temp files are cleaned up after playback
+
+## Voice Mappings (ElevenLabs)
+
+All entities use ElevenLabs TTS voices for high-quality, natural speech. Voices are selected to match each entity's personality and role.
+
+| Entity | ElevenLabs Voice ID | Personality Match |
+|--------|---------------------|-------------------|
+| Kai | s3TPKV1kjDlVtZbl4Ksh | Professional, conversational |
+| Perplexity-Researcher | AXdMgz6evoL7OPd7eU12 | Analytical, clear |
+| Claude-Researcher | AXdMgz6evoL7OPd7eU12 | Strategic, sophisticated |
+| Gemini-Researcher | iLVmqjzCGGvqtMCk6vVQ | Multi-perspective, thorough |
+| Engineer | fATgBRI8wg5KkDFg8vBd | Steady, professional |
+| Principal-Engineer | iLVmqjzCGGvqtMCk6vVQ | Strategic, senior leadership |
+| Architect | muZKMsIDGYtIkjjiUS82 | Strategic, sophisticated |
+| Designer | ZF6FPAbjXT4488VcRRnw | Creative, distinct |
+| Artist | ZF6FPAbjXT4488VcRRnw | Creative, artistic |
+| Pentester | xvHLFjaUEpx4BOf7EiDd | Technical, sharp |
+| Writer | gfRt6Z3Z8aTbpLfexQ7N | Articulate, warm |
+
+### Voice Configuration
+
+ElevenLabs voices provide consistent, high-quality neural TTS with natural-sounding speech across all agents. Voice IDs are stored in:
+- Server default: `${PAI_DIR}/voice-server/server.ts`
+- Stop hooks: `${PAI_DIR}/hooks/stop-hook.ts` and `${PAI_DIR}/hooks/subagent-stop-hook.ts`
## Server Configuration
### Voice Configuration (voices.json)
-The voice system uses a centralized JSON configuration file for all voice and speed settings:
+The voice system uses a centralized JSON configuration file for voice naming and metadata (primarily for reference):
**Location:** `${PAI_DIR}/voice-server/voices.json`
@@ -112,28 +111,22 @@ The voice system uses a centralized JSON configuration file for all voice and sp
}
```
-**Configuration Fields:**
-- `voice_name`: macOS voice name (e.g., "Jamie (Premium)", "Ava (Premium)")
-- `rate_multiplier`: Speed multiplier (1.0 = normal, 1.3 = 30% faster)
-- `rate_wpm`: Words per minute (calculated as default_rate × rate_multiplier)
-- `description`: Human-readable description of the voice
-- `type`: Voice quality level (Premium or Enhanced)
+**Note:** The `voices.json` file is primarily for reference and naming conventions. The actual voice IDs used by ElevenLabs are hardcoded in the hook files (stop-hook.ts and subagent-stop-hook.ts).
-**Customizing Voice Speeds:**
-To change speech rates, edit the `rate_multiplier` or `rate_wpm` values in voices.json:
-- Kai (default): 1.3x = 228 wpm
-- Agents (default): 1.35x = 236 wpm
-- Normal speed: 1.0x = 175 wpm
-- Fast speed: 1.5x = 263 wpm
+### Environment Variables (in ~/.env)
-Changes take effect immediately (no server restart required for hook-initiated voices).
+**Required:**
+```bash
+ELEVENLABS_API_KEY=your_api_key_here
+```
-### Environment Variables (in ${PAI_DIR}/.env)
+**Optional:**
```bash
PORT="8888" # Optional, defaults to 8888
+ELEVENLABS_VOICE_ID="s3TPKV1kjDlVtZbl4Ksh" # Optional, Kai's default voice
```
-No API keys required - uses native macOS voices.
+Get your free API key at [elevenlabs.io](https://elevenlabs.io) (10,000 characters/month free tier available).
### Server API
@@ -144,7 +137,7 @@ Main endpoint for voice notifications.
```json
{
"message": "Text to speak",
- "voice_name": "Ava (Premium)",
+ "voice_id": "s3TPKV1kjDlVtZbl4Ksh",
"title": "Optional notification title",
"voice_enabled": true
}
@@ -152,8 +145,7 @@ Main endpoint for voice notifications.
**Field Requirements:**
- `message` (required): The text to be spoken
-- `voice_name` (optional): macOS voice name (e.g., "Ava (Premium)", "Tom (Enhanced)")
-- `rate` (optional, alternative): Speech rate in words per minute (100-500) if not using voice_name
+- `voice_id` (optional): ElevenLabs voice ID (defaults to Kai's voice if not specified)
- `title` (optional): Visual notification title
- `voice_enabled` (optional): Set to false to skip voice output
@@ -176,7 +168,7 @@ Simplified endpoint for PAI system messages.
}
```
-Uses Kai's default voice (Jamie Premium).
+Uses Kai's default voice (s3TPKV1kjDlVtZbl4Ksh).
#### GET /health
Health check endpoint.
@@ -186,78 +178,45 @@ Health check endpoint.
{
"status": "healthy",
"port": 8888,
- "voice_system": "macOS Native",
- "default_voice": "Jamie (Premium)"
+ "voice_system": "ElevenLabs",
+ "default_voice_id": "s3TPKV1kjDlVtZbl4Ksh",
+ "api_key_configured": true
}
```
## Agent Voice Configuration
-### Agent Frontmatter
-Each agent file (`${PAI_DIR}/agents/*.md`) includes voice configuration:
+### Hook Configuration
+Voice mappings are defined in the stop hook files:
-```yaml
----
-name: researcher
-description: Research specialist
-model: sonnet
-color: cyan
-voiceId: Ava (Premium)
----
+**Main Agent (Kai):** `${PAI_DIR}/hooks/stop-hook.ts`
+```typescript
+voice_id: 's3TPKV1kjDlVtZbl4Ksh' // Kai's ElevenLabs voice ID
```
-The `voiceId` field specifies which macOS voice the agent uses.
+**Subagents:** `${PAI_DIR}/hooks/subagent-stop-hook.ts`
+```typescript
+const ELEVENLABS_VOICE_IDS: Record<string, string> = {
+ 'kai': 's3TPKV1kjDlVtZbl4Ksh',
+ 'writer': 'gfRt6Z3Z8aTbpLfexQ7N',
+ 'engineer': 'fATgBRI8wg5KkDFg8vBd',
+ 'principal-engineer': 'iLVmqjzCGGvqtMCk6vVQ',
+ 'designer': 'ZF6FPAbjXT4488VcRRnw',
+ 'artist': 'ZF6FPAbjXT4488VcRRnw',
+ 'perplexity-researcher': 'AXdMgz6evoL7OPd7eU12',
+ 'claude-researcher': 'AXdMgz6evoL7OPd7eU12',
+ 'researcher': 'AXdMgz6evoL7OPd7eU12',
+ 'pentester': 'xvHLFjaUEpx4BOf7EiDd',
+ 'architect': 'muZKMsIDGYtIkjjiUS82',
+};
+```
### Voice Selection Criteria
Voices are selected based on:
1. **Personality Match**: Voice characteristics match agent role
-2. **Accent Variety**: Mix of US, UK, and Indian accents for distinction
-3. **Gender Balance**: Mix of male and female voices
-4. **Quality Level**: Premium voices for frequently-used agents
-
-## Downloading Additional Voices
-
-### How to Add More Premium/Enhanced Voices
-
-1. Open **System Settings**
-2. Navigate to **Voice (Live Speech)**
-3. Click **System Voice** dropdown
-4. Select **Manage Voices...**
-5. Download desired Premium or Enhanced voices
-
-### Available Premium Voices (as of macOS 15.x)
-
-**English (US):**
-- Ava (Premium) - Female, 457MB ⭐
-- Allison (Enhanced) - Female, 94MB
-- Tom (Enhanced) - Male, 392MB
-- Nathan (Enhanced) - Male
-- Samantha (Enhanced) - Female
-- Joelle (Enhanced) - Female
-- Nicky (Enhanced) - Female
-- Noelle (Enhanced) - Female
-
-**English (UK):**
-- Jamie (Premium) - Male ⭐
-- Serena (Premium) - Female, 195MB ⭐
-- Daniel (Enhanced) - Male
-- Kate (Enhanced) - Female
-- Oliver (Enhanced) - Male
-
-**English (India):**
-- Isha (Premium) - Female ⭐
-- Rishi (Enhanced) - Male
-- Sangeeta (Enhanced) - Female
-- Veena (Enhanced) - Female
-
-**English (Ireland):**
-- Moira (Enhanced) - Female
-
-**English (South Africa):**
-- Tessa (Enhanced) - Female
-
-⭐ = Currently in use by the PAI system
+2. **Voice Variety**: Different ElevenLabs voices for distinction
+3. **Consistency**: Same voice ID for similar agent types
## COMPLETED Line Formatting
@@ -297,14 +256,16 @@ The CUSTOM COMPLETED line is used if:
curl http://localhost:8888/health
```
-2. Verify voice is downloaded:
+2. Verify ElevenLabs API key is configured:
```bash
- say -v '?' | grep "Premium\|Enhanced"
+ grep ELEVENLABS_API_KEY ~/.env
```
3. Test voice directly:
```bash
- say -v "Ava (Premium)" "Testing voice quality"
+ curl -X POST http://localhost:8888/notify \
+ -H "Content-Type: application/json" \
+ -d '{"message":"Testing voice","voice_id":"s3TPKV1kjDlVtZbl4Ksh"}'
```
### Voice Server Not Running
@@ -324,12 +285,12 @@ bun server.ts &
### Wrong Voice Playing
1. Check stop-hook voice mappings:
```bash
- grep "const VOICES" ${PAI_DIR}/hooks/stop-hook.ts
+ grep "ELEVENLABS_VOICE_IDS" ${PAI_DIR}/hooks/subagent-stop-hook.ts
```
-2. Verify agent voiceId in frontmatter:
+2. Verify voice_id in hook file:
```bash
- grep "voiceId:" ${PAI_DIR}/agents/*.md
+ grep "voice_id.*s3TPKV1kjDlVtZbl4Ksh" ${PAI_DIR}/hooks/stop-hook.ts
```
### No COMPLETED Line in Output
@@ -338,6 +299,11 @@ The voice system requires the `🎯 COMPLETED:` line. Ensure:
- Exact format: `🎯 COMPLETED: [description]`
- No typos in emoji or text
+### ElevenLabs API Errors
+1. **401 Unauthorized**: Invalid API key - check ~/.env
+2. **429 Too Many Requests**: Rate limit exceeded - wait or upgrade plan
+3. **Quota Exceeded**: Monthly character limit reached - upgrade plan or wait for reset
+
## Development
### Testing Individual Voices
@@ -345,28 +311,36 @@ The voice system requires the `🎯 COMPLETED:` line. Ensure:
# Test Kai's voice
curl -X POST http://localhost:8888/notify \
-H "Content-Type: application/json" \
- -d '{"message":"Testing Kai voice","voice_name":"Jamie (Premium)"}'
+ -d '{"message":"Testing Kai voice","voice_id":"s3TPKV1kjDlVtZbl4Ksh"}'
-# Test Researcher voice
+# Test Perplexity-Researcher voice
curl -X POST http://localhost:8888/notify \
-H "Content-Type: application/json" \
- -d '{"message":"Testing Researcher voice","voice_name":"Ava (Premium)"}'
+ -d '{"message":"Testing Perplexity-Researcher voice","voice_id":"AXdMgz6evoL7OPd7eU12"}'
# Test Engineer voice
curl -X POST http://localhost:8888/notify \
-H "Content-Type: application/json" \
- -d '{"message":"Testing Engineer voice","voice_name":"Tom (Enhanced)"}'
+ -d '{"message":"Testing Engineer voice","voice_id":"fATgBRI8wg5KkDFg8vBd"}'
```
### Adding New Voices
-1. Download voice via System Settings → Voice (Live Speech) → Manage Voices
-2. Update voices.json configuration:
+1. Get an ElevenLabs voice ID from [elevenlabs.io](https://elevenlabs.io)
+2. Update subagent-stop-hook.ts:
+ ```typescript
+ const ELEVENLABS_VOICE_IDS: Record<string, string> = {
+ // ... existing voices ...
+ 'newagent': 'your_elevenlabs_voice_id_here',
+ };
+ ```
+
+3. Optionally update voices.json for reference:
```json
{
"voices": {
"newagent": {
- "voice_name": "NewVoice (Premium)",
+ "voice_name": "NewVoice Name",
"rate_multiplier": 1.35,
"rate_wpm": 236,
"description": "Description of voice",
@@ -376,86 +350,53 @@ curl -X POST http://localhost:8888/notify \
}
```
-3. Update agent frontmatter:
- ```yaml
- voiceId: NewVoice (Premium)
- ```
-
4. Test the new voice configuration
-## Voice Quality Comparison
-
-### Premium vs Enhanced vs Legacy
-
-- **Premium**: Best quality, largest files, most natural
-- **Enhanced**: Excellent quality, good balance of size/quality
-- **Legacy/Compact**: Old robotic voices (DO NOT USE)
-
-### How to Identify Voice Quality
-
-```bash
-say -v '?' | grep "Premium" # Premium voices only
-say -v '?' | grep "Enhanced" # Enhanced voices only
-say -v '?' | head -50 # All voices (Premium/Enhanced at top)
-```
-
-Premium and Enhanced voices are clearly labeled in the output.
-
-## Migration from Speech Rate System
-
-### Previous System (Deprecated)
-- Used single system default voice
-- Differentiated by speech rate (220-310 wpm)
-- All voices sounded the same, just faster/slower
-
-### Current System (Active)
-- Uses multiple Premium/Enhanced voices
-- Each entity has distinct voice character
-- Natural variety through accent, gender, personality
-- Much more engaging and differentiated
-
-### Upgrading from Old System
-If you're upgrading from the rate-based system:
-
-1. Download Premium/Enhanced voices via System Settings
-2. Update all agent *.md files (change `speechRate:` to `voiceId:`)
-3. Update stop-hook.ts (change `VOICE_RATES` to `VOICES`)
-4. Update curl commands (change `rate` parameter to `voice_name`)
-5. Restart voice server
-
## Security & Privacy
-- All voice processing happens locally on your Mac
-- No data sent to external services
-- No API keys or authentication required
-- Zero cost, complete privacy
+- Voice processing happens via ElevenLabs API (cloud service)
+- Audio data sent to ElevenLabs servers for TTS generation
+- API key required (stored in ~/.env)
- CORS restricted to localhost only
- Rate limiting enabled (10 requests/minute)
+- Temporary audio files stored in /tmp and cleaned up after playback
+- Keep your ELEVENLABS_API_KEY secure and never commit to public repos
## System Requirements
-- macOS 13.0 or later (for Premium/Enhanced voices)
+- macOS (for afplay audio playback)
- Claude Code CLI
- Bun runtime (for voice server)
-- ~2-4GB disk space for premium voices
+- ElevenLabs API key
+- Internet connection (for API calls)
## Performance
-- Voice generation: Near-instant (<100ms)
-- Network latency: Local only (~1-5ms)
-- No external API delays
-- Unlimited usage
-- No rate limits (beyond local rate limiter)
+- Voice generation: ~500ms-2s (API call + network latency)
+- Audio playback: Immediate after generation
+- Monthly quota: 10,000 characters (free tier) or more (paid plans)
+- Rate limits: Per ElevenLabs plan
## Summary
The PAI Voice System provides:
-- ✅ High-quality neural TTS using macOS Premium/Enhanced voices
+- ✅ High-quality neural TTS using ElevenLabs API
- ✅ Distinct voices for Kai and each agent
-- ✅ Zero cost (no cloud APIs)
-- ✅ Complete privacy (local processing)
-- ✅ Natural voice variety (accents, genders, personalities)
+- ✅ Professional voice quality
+- ✅ Natural voice variety (via different ElevenLabs voices)
- ✅ Simple integration via stop-hook
- ✅ Automatic voice notifications for all completions
+- ⚠️ Requires API key and internet connection
+- ⚠️ Subject to ElevenLabs usage limits and pricing
+
+Voice makes Kai and agents feel more alive and engaging!
+
+## Recent Changes (2025-10-19)
-Voice makes Kai and agents feel more alive and engaging!
\ No newline at end of file
+- ✏️ `voice-server/README.md` (modified)
+ - +249 / -245 lines
+- ✏️ `voice-server/voices.json` (modified)
+ - +13 / -6 lines
+
+---
+<!-- Last Updated: 2025-10-19 -->
diff --git a/voice-server/README.md b/voice-server/README.md
index 996dc1e6..4095e066 100644
--- a/voice-server/README.md
+++ b/voice-server/README.md
@@ -1,69 +1,169 @@
# PAI Voice Server
-A zero-cost voice notification server for the Personal AI Infrastructure (PAI) system that provides text-to-speech notifications using macOS Premium and Enhanced neural voices.
+A voice notification server for the Personal AI Infrastructure (PAI) system that provides text-to-speech notifications using ElevenLabs API.
-> **Quick Start**: See [documentation/VOICE-SETUP-GUIDE.md](../documentation/VOICE-SETUP-GUIDE.md) for detailed setup guide.
+> **Quick Start**: See [QUICKSTART.md](QUICKSTART.md) for a 5-minute setup guide (if available).
## 🎯 Features
-- **Native macOS Voices**: Uses Premium and Enhanced neural TTS voices (no API costs)
-- **Distinct Voice Personalities**: Different Premium voices for Kai and each agent
-- **100% Offline**: No cloud APIs, complete privacy
-- **Customizable Speed**: Configurable speech rates for each entity
-- **Simple HTTP API**: Easy integration via REST endpoints
-- **JSON Configuration**: Centralized voice and speed settings in voices.json
+- **ElevenLabs Integration**: High-quality AI voices for notifications
+- **Multiple Voice Support**: Different voices for different AI agents
+- **macOS Service**: Runs automatically in the background
+- **Menu Bar Indicator**: Visual status indicator in macOS menu bar
+- **Simple HTTP API**: Easy integration with any tool or script
## 📋 Prerequisites
-- macOS 13.0 (Ventura) or later (for Premium/Enhanced voices)
+- macOS (tested on macOS 11+)
- [Bun](https://bun.sh) runtime installed
-- Premium/Enhanced voices downloaded from System Settings
+- ElevenLabs API key (required for voice functionality)
## 🚀 Quick Start
-### 1. Download Premium Voices
+### 1. Install Bun (if not already installed)
+```bash
+curl -fsSL https://bun.sh/install | bash
+```
+
+### 2. Configure API Key (Required)
+Add your ElevenLabs API key to `~/.env`:
+```bash
+echo "ELEVENLABS_API_KEY=your_api_key_here" >> ~/.env
+echo "ELEVENLABS_VOICE_ID=s3TPKV1kjDlVtZbl4Ksh" >> ~/.env
+```
+
+> Get your free API key at [elevenlabs.io](https://elevenlabs.io) (10,000 characters/month free)
+
+### 3. Install Voice Server
+```bash
+cd ~/.claude/voice-server
+./install.sh
+```
-1. Open **System Settings**
-2. Navigate to **Voice (Live Speech)**
-3. Click **System Voice** dropdown → **Manage Voices...**
-4. Download these voices:
- - **Jamie (Premium)** - English (UK) - For Kai
- - **Ava (Premium)** - English (US) - For Researcher (highest quality)
- - **Serena (Premium)** - English (UK) - For Architect
- - **Isha (Premium)** - English (India) - For Designer
- - **Tom (Enhanced)** - English (US) - For Engineer
- - **Oliver (Enhanced)** - English (UK) - For Pentester
+This will:
+- Install dependencies
+- Create a macOS LaunchAgent for auto-start
+- Start the voice server on port 8888
+- Verify the installation
+- Optionally install menu bar indicator (requires SwiftBar/BitBar)
-See [VOICE-SETUP-GUIDE.md](../documentation/VOICE-SETUP-GUIDE.md) for detailed download instructions.
+## 🛠️ Service Management
-### 2. Start the Voice Server
+### Start Server
+```bash
+./start.sh
+# or
+launchctl load ~/Library/LaunchAgents/com.pai.voice-server.plist
+```
+### Stop Server
```bash
-cd ${PAI_DIR}/voice-server
-bun server.ts &
+./stop.sh
+# or
+launchctl unload ~/Library/LaunchAgents/com.pai.voice-server.plist
```
-**Expected output:**
+### Restart Server
+```bash
+./restart.sh
```
-🚀 PAIVoice Server running on port 8888
-🎙️ Using macOS native voices (default: Jamie (Premium))
-📡 POST to http://localhost:8888/notify
-🔒 Security: CORS restricted to localhost, rate limiting enabled
+
+### Check Status
+```bash
+./status.sh
```
-### 3. Test Voice Output
+### Uninstall
+```bash
+./uninstall.sh
+```
+This will stop the service and remove the LaunchAgent.
+## 📡 API Usage
+
+### Send a Voice Notification
```bash
curl -X POST http://localhost:8888/notify \
-H "Content-Type: application/json" \
- -d '{"message":"Voice system working perfectly","voice_name":"Jamie (Premium)","rate":228}'
+ -d '{
+ "message": "Task completed successfully",
+ "voice_id": "s3TPKV1kjDlVtZbl4Ksh",
+ "voice_enabled": true
+ }'
```
+### Parameters
+- `message` (required): The text to speak
+- `voice_id` (optional): ElevenLabs voice ID to use
+- `voice_enabled` (optional): Whether to speak the notification (default: true)
+- `title` (optional): Notification title (default: "PAI Notification")
+
+### Available Voice IDs
+```javascript
+// PAI System Agents
+Kai: s3TPKV1kjDlVtZbl4Ksh // Main assistant
+Perplexity-Researcher: AXdMgz6evoL7OPd7eU12 // Perplexity research agent
+Claude-Researcher: AXdMgz6evoL7OPd7eU12 // Claude research agent
+Gemini-Researcher: iLVmqjzCGGvqtMCk6vVQ // Gemini research agent
+Engineer: fATgBRI8wg5KkDFg8vBd // Engineering agent
+Principal-Engineer: iLVmqjzCGGvqtMCk6vVQ // Principal engineering agent
+Designer: ZF6FPAbjXT4488VcRRnw // Design agent
+Architect: muZKMsIDGYtIkjjiUS82 // Architecture agent
+Pentester: xvHLFjaUEpx4BOf7EiDd // Security agent
+Artist: ZF6FPAbjXT4488VcRRnw // Artist agent
+Writer: gfRt6Z3Z8aTbpLfexQ7N // Content agent
+```
+
+## 🖥️ Menu Bar Indicator
+
+The voice server includes an optional menu bar indicator that shows the server status.
+
+### Installing the Menu Bar
+
+1. **Install SwiftBar** (recommended) or BitBar:
+```bash
+brew install --cask swiftbar
+# OR
+brew install --cask bitbar
+```
+
+2. **Run the menu bar installer**:
+```bash
+cd ~/.claude/voice-server/menubar
+./install-menubar.sh
+```
+
+### Menu Bar Features
+- **Visual Status**: 🎙️ (running) or 🎙️⚫ (stopped)
+- **Quick Controls**: Start/Stop/Restart server from menu
+- **Status Info**: Shows voice type (ElevenLabs)
+- **Quick Test**: Test voice with one click
+- **View Logs**: Access server logs directly
+
+### Manual Installation
+If you prefer manual installation:
+1. Copy `menubar/pai-voice.5s.sh` to your SwiftBar/BitBar plugins folder
+2. Make it executable: `chmod +x pai-voice.5s.sh`
+3. Refresh SwiftBar/BitBar
+
## 🔧 Configuration
+### Environment Variables (in ~/.env)
+
+**Required:**
+```bash
+ELEVENLABS_API_KEY=your_api_key_here
+```
+
+**Optional:**
+```bash
+PORT=8888 # Server port (default: 8888)
+ELEVENLABS_VOICE_ID=s3TPKV1kjDlVtZbl4Ksh # Default voice ID (Kai's voice)
+```
+
### Voice Configuration (voices.json)
-All voice and speed settings are centralized in `voices.json`:
+The `voices.json` file provides reference metadata for agent voices:
```json
{
@@ -82,245 +182,149 @@ All voice and speed settings are centralized in `voices.json`:
"rate_wpm": 236,
"description": "US Female - Analytical, highest quality",
"type": "Premium"
+ },
+ "engineer": {
+ "voice_name": "Zoe (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "US Female - Steady, professional",
+ "type": "Premium"
+ },
+ "architect": {
+ "voice_name": "Serena (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "UK Female - Strategic, sophisticated",
+ "type": "Premium"
+ },
+ "designer": {
+ "voice_name": "Isha (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "Indian Female - Creative, distinct",
+ "type": "Premium"
+ },
+ "artist": {
+ "voice_name": "Isha (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "Indian Female - Creative, artistic",
+ "type": "Premium"
+ },
+ "pentester": {
+ "voice_name": "Oliver (Enhanced)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "UK Male - Technical, sharp",
+ "type": "Enhanced"
+ },
+ "writer": {
+ "voice_name": "Serena (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "UK Female - Articulate, warm",
+ "type": "Premium"
}
}
}
```
-**Customizing Voices and Speeds:**
-Edit `voices.json` to change:
-- `voice_name`: Any Premium or Enhanced macOS voice
-- `rate_multiplier`: Speed (1.0 = normal, 1.3 = 30% faster, 1.5 = 50% faster)
-- `rate_wpm`: Words per minute (auto-calculated or set manually)
-
-Changes take effect immediately (hooks reload config on each use).
-
-### Environment Variables
+**Note:** The actual ElevenLabs voice IDs are configured in the hook files (`hooks/stop-hook.ts` and `hooks/subagent-stop-hook.ts`), not in `voices.json`.
-Optional configuration in `${PAI_DIR}/.env`:
+## 🏥 Health Check
+Check server status:
```bash
-# Server port (optional, defaults to 8888)
-PORT=8888
+curl http://localhost:8888/health
```
-**No API keys required** - voice system is 100% free and offline.
-
-## 📡 API Reference
-
-### POST /notify
-
-Main endpoint for voice notifications.
-
-**Request:**
-```json
-{
- "message": "Text to speak",
- "voice_name": "Jamie (Premium)",
- "rate": 228,
- "title": "Optional notification title",
- "voice_enabled": true
-}
-```
-
-**Parameters:**
-- `message` (required): Text to be spoken
-- `voice_name` (optional): macOS voice name (e.g., "Jamie (Premium)")
-- `rate` (optional): Speech rate in words per minute (default: 175)
-- `title` (optional): Visual notification title
-- `voice_enabled` (optional): Set to false to skip voice output
-
-**Response:**
-```json
-{
- "status": "success",
- "message": "Notification sent"
-}
-```
-
-### POST /pai
-
-Simplified endpoint using Kai's default voice.
-
-**Request:**
-```json
-{
- "title": "PAI System",
- "message": "System message"
-}
-```
-
-### GET /health
-
-Health check endpoint.
-
-**Response:**
+Response:
```json
{
"status": "healthy",
"port": 8888,
- "voice_system": "macOS Native",
- "default_voice": "Jamie (Premium)"
+ "voice_system": "ElevenLabs",
+ "default_voice_id": "s3TPKV1kjDlVtZbl4Ksh",
+ "api_key_configured": true
}
```
-## 🎙️ Voice Mappings
-
-| Entity | Voice | Type | Speed | Accent | Description |
-|--------|-------|------|-------|--------|-------------|
-| Kai | Jamie (Premium) | Premium | 1.3x | UK Male | Professional, conversational |
-| Researcher | Ava (Premium) | Premium | 1.35x | US Female | Analytical, highest quality |
-| Engineer | Tom (Enhanced) | Enhanced | 1.35x | US Male | Steady, professional |
-| Architect | Serena (Premium) | Premium | 1.35x | UK Female | Strategic, sophisticated |
-| Designer | Isha (Premium) | Premium | 1.35x | Indian Female | Creative, distinct |
-| Pentester | Oliver (Enhanced) | Enhanced | 1.35x | UK Male | Technical, sharp |
-| Writer | Samantha (Enhanced) | Enhanced | 1.35x | US Female | Articulate, warm |
-
## 🐛 Troubleshooting
-### Server Won't Start
+### Server won't start
+1. Check if another service is using port 8888:
+ ```bash
+ lsof -ti:8888
+ ```
+2. Kill the process if needed:
+ ```bash
+ lsof -ti:8888 | xargs kill -9
+ ```
+
+### No voice output
+1. Verify ElevenLabs API key is configured:
+ ```bash
+ grep ELEVENLABS_API_KEY ~/.env
+ ```
+2. Check server logs:
+ ```bash
+ tail -f ~/.claude/voice-server/logs/voice-server.log
+ ```
+3. Test the API directly:
+ ```bash
+ curl -X POST http://localhost:8888/notify \
+ -H "Content-Type: application/json" \
+ -d '{"message":"Test message","voice_id":"s3TPKV1kjDlVtZbl4Ksh"}'
+ ```
+
+### API Errors
+- **401 Unauthorized**: Invalid API key - check ~/.env
+- **429 Too Many Requests**: Rate limit exceeded - wait or upgrade plan
+- **Quota Exceeded**: Monthly character limit reached - upgrade plan or wait for reset
+
+## 📁 Project Structure
-```bash
-# Check if port 8888 is in use
-lsof -i :8888
-
-# Kill any existing process
-lsof -ti :8888 | xargs kill -9
-
-# Restart server
-cd ${PAI_DIR}/voice-server && bun server.ts &
```
-
-### Voice Sounds Robotic
-
-**Problem:** Downloaded wrong voice type (Compact/Legacy instead of Premium/Enhanced)
-
-**Solution:**
-1. Go to System Settings → Voice (Live Speech) → Manage Voices
-2. Ensure you're downloading voices labeled **(Premium)** or **(Enhanced)**
-3. Voices without these labels are old robotic voices - don't use them!
-
-### Voice Not Found
-
-```bash
-# Verify voice is downloaded
-say -v '?' | grep "Jamie (Premium)"
-
-# If not found, download from System Settings
-# System Settings → Voice (Live Speech) → Manage Voices
-```
-
-### No Sound Output
-
-**Checklist:**
-1. System volume not muted
-2. Voice server running: `curl http://localhost:8888/health`
-3. Voice downloaded: `say -v "Jamie (Premium)" "test"`
-4. Correct output device selected (System Settings → Sound)
-
-### Wrong Voice Playing
-
-```bash
-# Check voices.json configuration
-cat ${PAI_DIR}/voice-server/voices.json
-
-# Check stop-hook is loading config
-grep "VOICE_CONFIG" ~/.claude/hooks/stop-hook.ts
+voice-server/
+├── server.ts # Main server implementation
+├── voices.json # Voice metadata and configuration
+├── install.sh # Installation script
+├── start.sh # Start service
+├── stop.sh # Stop service
+├── restart.sh # Restart service
+├── status.sh # Check service status
+├── uninstall.sh # Uninstall service
+├── run-server.sh # Direct server runner
+├── logs/ # Server logs
+│ ├── voice-server.log
+│ └── voice-server-error.log
+├── macos-service/ # LaunchAgent configuration
+│ └── com.paivoice.server.plist
+└── menubar/ # Menu bar indicator scripts
+ └── pai-voice.5s.sh
```
-## 🔐 Security & Privacy
-
-- **100% Local Processing**: All voice generation happens on your Mac
-- **Zero Cost**: No cloud APIs, no subscriptions
-- **Complete Privacy**: No data sent to external services
-- **CORS Protected**: Server only accepts requests from localhost
-- **Rate Limited**: 10 requests per minute to prevent abuse
-
-## 📁 File Structure
-
-```
-${PAI_DIR}/voice-server/
-├── server.ts # Main voice server
-├── voices.json # Voice configuration (edit this for customization)
-└── README.md # This file
-
-~/.claude/hooks/
-├── stop-hook.ts # Triggers voice notifications on completion
-└── context-compression-hook.ts # Notification for context compression
-
-~/Library/Mobile Documents/com~apple~CloudDocs/Claude/voice-server/
-└── Same structure (if using cloud sync)
-```
-
-## 🎬 Usage Examples
-
-### Test Individual Voices
-
-```bash
-# Test Kai's voice
-curl -X POST http://localhost:8888/notify \
- -H "Content-Type: application/json" \
- -d '{"message":"Testing Kai voice","voice_name":"Jamie (Premium)","rate":228}'
-
-# Test Researcher voice
-curl -X POST http://localhost:8888/notify \
- -H "Content-Type: application/json" \
- -d '{"message":"Testing Researcher voice","voice_name":"Ava (Premium)","rate":236}'
-
-# Test Engineer voice
-curl -X POST http://localhost:8888/notify \
- -H "Content-Type: application/json" \
- -d '{"message":"Testing Engineer voice","voice_name":"Tom (Enhanced)","rate":236}'
-```
-
-### Custom Voice Speeds
-
-```bash
-# Slow speed (0.8x = 140 wpm)
-curl -X POST http://localhost:8888/notify \
- -H "Content-Type: application/json" \
- -d '{"message":"Slow speed test","voice_name":"Jamie (Premium)","rate":140}'
-
-# Fast speed (1.5x = 263 wpm)
-curl -X POST http://localhost:8888/notify \
- -H "Content-Type: application/json" \
- -d '{"message":"Fast speed test","voice_name":"Jamie (Premium)","rate":263}'
-```
-
-## 🤝 Integration with PAI System
-
-The voice server automatically integrates with PAI hooks:
-
-- **stop-hook.ts**: Sends voice notification when Kai or agents complete tasks
-- **context-compression-hook.ts**: Announces when conversation context is compacted
-- Both hooks load voice configuration from `voices.json`
-
-No manual integration needed - just start the server and hooks will use it automatically.
-
-## 📖 Documentation
+## 🔒 Security
-- **[VOICE-SETUP-GUIDE.md](../documentation/VOICE-SETUP-GUIDE.md)** - Complete setup guide
-- **[voice-system.md](../documentation/voice-system.md)** - Technical documentation
-- **[voices.json](./voices.json)** - Voice configuration file
+- **API Key Protection**: Keep your `ELEVENLABS_API_KEY` secure
+- **Never commit** API keys to version control
+- **CORS**: Server is restricted to localhost only
+- **Rate Limiting**: 10 requests per minute per IP
-## 💡 Tips
+## 📊 Performance
-1. **Choose Premium voices first** - They have the highest quality
-2. **Use Enhanced when Premium unavailable** - Still excellent quality
-3. **Avoid voices without labels** - These are legacy robotic voices
-4. **Customize speech rates** - Edit `voices.json` to adjust speeds
-5. **Test voices before committing** - Use the curl commands above
-6. **Different accents for clarity** - Mix of US, UK, and Indian helps distinguish speakers
+- **Voice Generation**: ~500ms-2s (API call + network)
+- **Audio Playback**: Immediate after generation
+- **Monthly Quota**: 10,000 characters (free tier)
+- **Rate Limits**: Per ElevenLabs plan
-## 🆘 Support
+## 📝 License
-For issues:
-1. Check [Troubleshooting](#-troubleshooting) section
-2. Verify voices are downloaded (System Settings → Voice (Live Speech))
-3. Test voice directly: `say -v "Jamie (Premium)" "test"`
-4. Check server is running: `curl http://localhost:8888/health`
-5. See [voice-system.md](../documentation/voice-system.md) for detailed documentation
+Part of the Personal AI Infrastructure (PAI) system.
----
+## 🙋 Support
-**Zero cost. Complete privacy. Natural voices. That's the PAI way.** 🎙️
+For issues or questions:
+1. Check the logs: `~/.claude/voice-server/logs/`
+2. Verify configuration: `curl http://localhost:8888/health`
+3. Review documentation: `documentation/voice-system.md`
diff --git a/voice-server/voices.json b/voice-server/voices.json
index 129a9601..9b50e6da 100644
--- a/voice-server/voices.json
+++ b/voice-server/voices.json
@@ -17,11 +17,11 @@
"type": "Premium"
},
"engineer": {
- "voice_name": "Tom (Enhanced)",
+ "voice_name": "Zoe (Premium)",
"rate_multiplier": 1.35,
"rate_wpm": 236,
- "description": "US Male - Steady, professional",
- "type": "Enhanced"
+ "description": "US Female - Steady, professional",
+ "type": "Premium"
},
"architect": {
"voice_name": "Serena (Premium)",
@@ -37,6 +37,13 @@
"description": "Indian Female - Creative, distinct",
"type": "Premium"
},
+ "artist": {
+ "voice_name": "Isha (Premium)",
+ "rate_multiplier": 1.35,
+ "rate_wpm": 236,
+ "description": "Indian Female - Creative, artistic",
+ "type": "Premium"
+ },
"pentester": {
"voice_name": "Oliver (Enhanced)",
"rate_multiplier": 1.35,
@@ -45,11 +52,11 @@
"type": "Enhanced"
},
"writer": {
- "voice_name": "Samantha (Enhanced)",
+ "voice_name": "Serena (Premium)",
"rate_multiplier": 1.35,
"rate_wpm": 236,
- "description": "US Female - Articulate, warm",
- "type": "Enhanced"
+ "description": "UK Female - Articulate, warm",
+ "type": "Premium"
}
}
}