⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.
docs: Standardize authentication to single $PAI_DIR/.env location
Daniel Miesslere1fe591b5de4
diff --git a/.env.example b/.env.examplenew file mode 100644index 00000000..909590d2--- /dev/null+++ b/.env.example@@ -0,0 +1,33 @@+# PAI Environment Variables+# ==========================+#+# SINGLE SOURCE OF TRUTH for all API keys and authentication.+# Copy this file to $PAI_DIR/.env and fill in your values.+#+# Location: $PAI_DIR/.env (e.g., ~/.config/pai/.env)+#+# SECURITY RULES:+# 1. NEVER commit .env files to git+# 2. NEVER store API keys anywhere else in PAI+# 3. ALL packs and tools read from this ONE file++# ============================================================+# REQUIRED: System Configuration+# ============================================================++# Your AI assistant's name+DA=YourAIName++# Your timezone+TIME_ZONE=America/Los_Angeles++# ============================================================+# PACK-SPECIFIC KEYS+# ============================================================+#+# Each pack documents its required API keys in its installation+# section. Add them here as you install packs.+#+# Example format:+# SERVICE_API_KEY=your_key_here+#diff --git a/Bundles/Kai/README.md b/Bundles/Kai/README.mdindex c915ca32..c2c0430f 100644--- a/Bundles/Kai/README.md+++ b/Bundles/Kai/README.md@@ -22,18 +22,22 @@ The wizard has three phases:1. **Where should PAI be installed?** (default: `~/.config/pai`)2. **What would you like to name your AI assistant?** (e.g., Kai, Atlas, Nova, Jarvis)3. **What's your timezone?** (e.g., America/Los_Angeles, Europe/London)-4. **Do you have an ElevenLabs API key for voice notifications?** (optional - skip if no)-5. **If yes, what's your preferred ElevenLabs voice ID?** (optional)-**After gathering answers, set these variables:**+**After gathering answers, create the .env file:**```bash-export PAI_DIR="[their answer or ~/.config/pai]"-export DA="[their AI name]"-export TIME_ZONE="[their timezone]"-export ELEVENLABS_API_KEY="[if provided]"-export ELEVENLABS_VOICE_ID="[if provided]"+# Create PAI directory+mkdir -p $PAI_DIR++# Copy the example .env file+cp ../../.env.example $PAI_DIR/.env++# The .env file should contain:+DA="[their AI name]"+TIME_ZONE="[their timezone]"```+**Note:** API keys (ElevenLabs, Replicate, etc.) are added to `.env` later when installing packs that need them. See the [Authentication](#authentication) section for details.+---### Phase 2: Identity & Personalization@@ -203,6 +207,38 @@ When fully installed, the Kai bundle gives you a number of features that elevate---+## Authentication++**All API keys live in ONE place: `$PAI_DIR/.env`**++This is a core principle of PAI: no keys stored anywhere else in the system. Every pack reads from this single file.++### Setup++```bash+# 1. Copy the example file to your PAI directory+cp ../../.env.example $PAI_DIR/.env++# 2. Edit and add your API keys+nano $PAI_DIR/.env++# 3. Uncomment and fill in the keys you need+```++### Which Packs Need Keys?++Most packs require **no API keys** - only packs that integrate with external services need them. Each pack documents its specific requirements in its installation section.++### Security Rules++1. **NEVER commit `.env` files to git**+2. **NEVER store API keys in pack files, configs, or code**+3. **ALL authentication flows through `$PAI_DIR/.env`**++See [.env.example](../../.env.example) for the complete template.++---+## VerificationAfter installing all packs, verify the bundle:diff --git a/Packs/README.md b/Packs/README.mdindex 7057e39c..b08353cf 100644--- a/Packs/README.md+++ b/Packs/README.md@@ -59,9 +59,19 @@ Each pack is a single markdown file containing everything needed to go from zero- **Installation Instructions** - Step-by-step for both AI and manual installation- **Verification Steps** - How to confirm it's working- **Examples** - Real usage scenarios+- **Customization** - How to personalize the pack for your specific needs**Key principle:** Give your AI the pack file, and it can install the entire capability into your system autonomously.+### Customization Section++Many packs include a **Customization** section with:++- **Recommended Customization** - Personalization that significantly improves the pack's value (most users should do this)+- **Optional Customization** - Additional tweaks for advanced users++For example, the Art Skill pack recommends having an extended conversation with your AI about your aesthetic preferences, then capturing that in the Aesthetic.md file so all generated images reflect your personal style.+---## Available Packs@@ -116,6 +126,22 @@ Open any pack file and follow the "Installation" section step by step.---+## Authentication++**All API keys live in ONE place: `$PAI_DIR/.env`**++Packs that require API keys (Voice, Art, etc.) all read from a single environment file. No keys should ever be stored in pack files, configs, or code.++```bash+# Copy the example and add your keys+cp ../.env.example $PAI_DIR/.env+nano $PAI_DIR/.env+```++See [.env.example](../.env.example) for the complete list of supported variables.++---+## Pack Categories| Category | Purpose | Examples |diff --git a/Packs/kai-art-skill.md b/Packs/kai-art-skill.mdindex a049ee41..b5edc046 100644--- a/Packs/kai-art-skill.md+++ b/Packs/kai-art-skill.md@@ -147,8 +147,8 @@ The Art Skill treats image generation as a repeatable process, not a creative ga- **Bun runtime**: `curl -fsSL https://bun.sh/install | bash`- **Claude Code** (or compatible agent system with skill support)-- **Write access** to `$PAI_DIR/` (default: `~/.config/pai` or `~/.claude`)-- **API Keys** (at least one required):+- **Write access** to `$PAI_DIR/` (default: `~/.config/pai`)+- **API Keys in `$PAI_DIR/.env`** (at least one required):- `REPLICATE_API_TOKEN` - For Flux and Nano Banana models- `GOOGLE_API_KEY` - For Nano Banana Pro (Gemini 3) model- `OPENAI_API_KEY` - For GPT-image-1 model@@ -292,7 +292,7 @@ bun run $PAI_DIR/Skills/Art/Tools/Generate.ts \--output ~/Downloads/output.png```-**API keys in:** `$PAI_DIR/.env` or `~/.claude/.env`+**API keys in:** `$PAI_DIR/.env` (single source of truth for all authentication)---@@ -1153,11 +1153,12 @@ const execAsync = promisify(exec);// ============================================================================async function loadEnv(): Promise<void> {- // Try multiple locations for .env file+ // Load from canonical location: $PAI_DIR/.env (single source of truth)+ // Falls back to legacy locations for backwards compatibility+ const paiDir = process.env.PAI_DIR || resolve(process.env.HOME!, '.config/pai');const envPaths = [- resolve(process.env.PAI_DIR || '', '.env'),- resolve(process.env.HOME!, '.claude/.env'),- resolve(process.env.HOME!, '.config/pai/.env'),+ resolve(paiDir, '.env'),+ resolve(process.env.HOME!, '.claude/.env'), // Legacy location];for (const envPath of envPaths) {@@ -1834,13 +1835,102 @@ export REMOVEBG_API_KEY="..." # For background removalexport PAI_DIR="$HOME/.config/pai" # Custom PAI directory```-### Customization+---++## Customization++### Recommended Customization++**Personalize Your Aesthetic Through AI Conversation**++The single most valuable customization for this pack is to have an extended conversation with your AI about your personal aesthetic preferences, then capture that in `Aesthetic.md`. This transforms the Art Skill from a generic tool into one that produces images reflecting YOUR unique visual taste.++**What to Customize:** `$PAI_DIR/Skills/Art/Aesthetic.md`++**Why:** The default Aesthetic.md contains a generic Excalidraw-style dark-mode palette. By investing 15-30 minutes in an aesthetic exploration conversation, every image generated will feel like YOUR work, not generic AI output. This is the difference between "usable" and "perfectly on-brand."++**Process:**++1. **Start the Aesthetic Exploration Conversation**++ Tell your AI something like:+ ```+ I want to define my personal aesthetic for the Art Skill. Let's have a conversation+ where you ask me questions about my visual preferences, and we'll capture the+ result in Aesthetic.md.+ ```++2. **Answer Questions About Your Preferences**++ Your AI will ask about:+ - Color preferences (warm vs cool, muted vs vibrant, specific colors you love/hate)+ - Line quality (precise vs gestural, thick vs thin, confident vs sketchy)+ - Composition style (minimal vs detailed, symmetric vs organic, structured vs chaotic)+ - Influences and inspiration (artists, design movements, specific images you love)+ - Emotional tone (technical, whimsical, serious, playful, elegant, raw)+ - Typography preferences (serif vs sans, heavy vs light, classic vs modern)+ - Specific use cases (blog headers, diagrams, social media, presentations)++3. **Iterate with Visual Examples**++ As you discuss, your AI can generate test images:+ ```+ Generate a sample header image using what we've discussed so far+ ```+ Use these to refine the aesthetic definition. "More like this, less like that."++4. **Capture the Final Aesthetic**++ Once you're satisfied, ask:+ ```+ Now update my Aesthetic.md with everything we've defined+ ```+ Your AI will rewrite Aesthetic.md with your personalized color palette, style guidelines, and validation criteria.++**Expected Outcome:** After this process, running `create a header image for my post about X` will produce images that feel unmistakably YOURS—matching your brand, preferences, and visual language.++---++### Optional Customization++| Customization | File | Impact |+|---------------|------|--------|+| **Custom Color Palette** | `Aesthetic.md` | Change hex codes to match your brand colors |+| **Custom Prompt Templates** | `Workflows/*.md` | Create prompt patterns for your specific use cases |+| **Additional Workflows** | `Workflows/` | Add workflows for content types you create frequently (infographics, presentations, etc.) |+| **Model Preference** | `SKILL.md` | Change default model if you prefer different generation characteristics |+| **Validation Criteria** | `Aesthetic.md` | Add specific must-have/must-not-have rules for your brand |++**Example: Brand Color Customization**++Edit `Aesthetic.md` to replace the default palette:++```markdown+## Color Palette++### Primary Colors+| Color | Hex | Usage |+|-------|-----|-------|+| **Background** | `#1a1a2e` | Your brand's dark background |+| **Primary** | `#ff6b35` | Your brand's accent color |+| **Secondary** | `#4ecdc4` | Your brand's secondary color |+```++**Example: Adding a Custom Workflow**++Create `$PAI_DIR/Skills/Art/Workflows/Infographics.md` for a specific content type you create often:-To customize the aesthetic, edit `$PAI_DIR/Skills/Art/Aesthetic.md`:-- Change color hex codes for your brand-- Adjust color ratios-- Add emotional registers-- Update validation criteria+```markdown+# Infographic Workflow++[Your custom workflow for infographic-style visuals with your specific+prompt templates, validation criteria, and generation settings]+```++Then add a routing entry in `SKILL.md`:+```markdown+ - Infographic or data visualization → `Workflows/Infographics.md`+```---diff --git a/Packs/kai-core-install.md b/Packs/kai-core-install.mdindex 8a07cc0d..07e36797 100644--- a/Packs/kai-core-install.md+++ b/Packs/kai-core-install.md@@ -1363,6 +1363,99 @@ cat $PAI_DIR/Skills/CORE/SKILL.md | head -20---+## Customization++### Recommended Customization++**Define Your Personality and Identity**++The CORE skill includes a placeholder identity. The most valuable customization is filling this in to create a consistent, personalized AI assistant.++**What to Customize:** `$PAI_DIR/Skills/CORE/SKILL.md`++**Why:** A well-defined personality creates consistent, predictable interactions. When your AI knows who it is, how formal to be, and what your preferences are, every response feels coherent and familiar.++**Process:**++1. **Fill in Your Identity**+ Edit the Identity section:+ ```markdown+ ## Identity++ **Assistant:**+ - Name: [Choose a name for your AI - e.g., "Kai", "Atlas", "Sage"]+ - Role: [Your name]'s AI assistant++ **User:**+ - Name: [Your name]+ - Profession: [Your profession - e.g., "Software Engineer", "Researcher"]+ ```++2. **Calibrate Personality Traits**+ Adjust the numeric values based on your preferences:+ ```markdown+ | Trait | Value | Description |+ |-------|-------|-------------|+ | Humor | 60/100 | Higher = more witty, lower = more serious |+ | Curiosity | 90/100 | Higher = asks more questions, explores tangents |+ | Precision | 95/100 | Higher = more exact details |+ | Formality | 50/100 | Higher = more professional, lower = more casual |+ | Directness | 80/100 | Higher = blunt, lower = diplomatic |+ ```++3. **Define Your Voice Preferences**+ Have a conversation with your AI about communication style:+ ```+ Let's define how you should communicate. I prefer:+ - Direct answers without excessive hedging+ - Technical accuracy over simplification+ - Brief responses unless I ask for detail++ Capture this in the CORE skill.+ ```++**Expected Outcome:** A consistent AI personality that feels like working with a familiar colleague.++---++### Optional Customization++| Customization | File | Impact |+|---------------|------|--------|+| **Contacts Directory** | `Contacts.md` | Add your frequent contacts |+| **Stack Preferences** | `CoreStack.md` | Define your technology preferences |+| **Response Format** | `SKILL.md` | Modify the structured response format |+| **Security Protocols** | `SecurityProtocols.md` | Add project-specific security rules |+| **Definitions** | `Definitions.md` | Add canonical term definitions |++**Example: Add Contacts**++Create or edit `$PAI_DIR/Skills/CORE/Contacts.md`:++```markdown+# Contacts++## Frequently Used++- **Alice** [Team Lead]: [email protected]+- **Bob** [DevOps]: [email protected]+```++**Example: Define Stack Preferences**++Create or edit `$PAI_DIR/Skills/CORE/CoreStack.md`:++```markdown+# Technology Stack Preferences++- **TypeScript > Python** - Unless explicitly approved+- **bun > npm** - For all JS/TS projects+- **Markdown > HTML** - For documentation+- **SQLite > PostgreSQL** - For local development+```++---+## Credits- **Author:** Daniel Miesslerdiff --git a/Packs/kai-history-system.md b/Packs/kai-history-system.mdindex 84cf5020..50316229 100644--- a/Packs/kai-history-system.md+++ b/Packs/kai-history-system.md@@ -1462,6 +1462,95 @@ export PAI_SOURCE_APP="MyAI"**Directory structure is fixed** - categorization depends on consistent paths. Only customize the root PAI_DIR location if needed.+---++## Customization++### Recommended Customization++**Tune the Learning Detection Keywords**++The history system automatically categorizes responses as "learnings" or "sessions" based on keyword detection. Customize these keywords to match your vocabulary and ensure valuable insights get properly captured.++**What to Customize:** `$PAI_DIR/hooks/stop-hook.ts`++**Why:** Different developers express learning differently. If you say "figured out" but not "root cause", or "aha moment" instead of "discovered", your learnings might not be captured in the learnings/ directory. Tuning these keywords ensures your insights get properly categorized.++**Process:**++1. **Review Your Recent Sessions**+ ```bash+ # Look at recent sessions+ ls -lt $PAI_DIR/history/sessions/ | head -10++ # Check if any should have been learnings+ grep -l "aha\|insight\|realized" $PAI_DIR/history/sessions/+ ```++2. **Add Your Keywords**+ Edit the `hasLearningIndicators` function in `stop-hook.ts`:+ ```typescript+ function hasLearningIndicators(text: string): boolean {+ const indicators = [+ 'problem', 'solved', 'discovered', 'fixed', 'learned', 'realized',+ 'figured out', 'root cause', 'debugging', 'issue was', 'turned out',+ 'mistake', 'error', 'bug', 'solution',+ // Add your personal indicators:+ 'aha', 'insight', 'trick was', 'key was', 'finally', 'breakthrough'+ ];+ // ...+ }+ ```++3. **Adjust Threshold**+ Default requires 2+ matches. Adjust if needed:+ ```typescript+ return matches.length >= 2; // Change to 1 for more sensitive capture+ ```++**Expected Outcome:** Your valuable learnings are properly categorized and easily searchable.++---++### Optional Customization++| Customization | File | Impact |+|---------------|------|--------|+| **Agent Routing** | `subagent-stop-hook.ts` | Add new agent types and their output directories |+| **Summary Extraction** | `stop-hook.ts` | Modify how completion summaries are extracted |+| **Session Focus Detection** | `capture-session-summary.ts` | Add patterns for your project types |+| **File Naming** | All hooks | Change timestamp format or description extraction |++**Example: Add New Agent Type Routing**++Edit `subagent-stop-hook.ts` to add routing for custom agents:++```typescript+// Add to agent routing logic+if (agentType === 'security-researcher' || agentType === 'pentester') {+ captureType = 'SECURITY';+ category = 'security'; // Creates history/security/+} else if (agentType === 'code-reviewer') {+ captureType = 'REVIEW';+ category = 'reviews'; // Creates history/reviews/+}+```++**Example: Custom Session Focus Detection**++Edit `capture-session-summary.ts` to detect your project types:++```typescript+function determineSessionFocus(filesChanged: string[], commandsExecuted: string[]): string {+ // Add your project-specific patterns+ if (filePatterns.some(f => f.includes('/api/'))) return 'api-development';+ if (filePatterns.some(f => f.includes('/tests/'))) return 'test-writing';+ // ...+}+```++---+## Credits- **Original concept**: Daniel Miessler - developed as part of Kai personal AI infrastructure- **Contributors**: The PAI communitydiff --git a/Packs/kai-hook-system.md b/Packs/kai-hook-system.mdindex 74868df0..74075d7b 100644--- a/Packs/kai-hook-system.md+++ b/Packs/kai-hook-system.md@@ -1327,6 +1327,82 @@ function setTabTitle(title: string): void {---+## Customization++### Recommended Customization++**Define Your Security Policies**++The security validator comes with sensible defaults, but you'll want to customize the attack patterns for your specific environment and risk tolerance.++**What to Customize:** `$PAI_DIR/hooks/security-validator.ts`++**Why:** The default security patterns may be too strict or too lenient for your use case. For example, if you regularly work with Docker, you might want to allow certain commands that are blocked by default. Conversely, if you work with sensitive data, you may want to add stricter patterns.++**Process:**++1. **Review Current Patterns**+ - Read through the `ATTACK_PATTERNS` object in security-validator.ts+ - Identify patterns that trigger too often (false positives)+ - Identify dangerous commands specific to your environment++2. **Add Custom Patterns**+ ```typescript+ // Add to ATTACK_PATTERNS in security-validator.ts+ customProjectRules: {+ patterns: [+ /dangerous-command-for-your-project/i,+ ],+ action: 'block',+ message: '🚨 BLOCKED: Custom project security rule'+ }+ ```++3. **Adjust Action Levels**+ - `block` - Completely prevent execution+ - `warn` - Allow but show warning+ - `log` - Allow and log for review+ - `confirm` - Require explicit confirmation++**Expected Outcome:** Security validation tailored to your specific workflow and risk profile.++---++### Optional Customization++| Customization | File | Impact |+|---------------|------|--------|+| **Tab Title Format** | `update-tab-titles.ts` | Change the emoji prefix or title format |+| **Session Initialization** | `initialize-session.ts` | Add custom session startup actions |+| **Context Loading** | `load-core-context.ts` | Modify what context loads at session start |+| **Observability URL** | Environment variable | Point to different observability endpoint |++**Example: Custom Tab Title Prefix**++Edit `update-tab-titles.ts` to change the tab icon:++```typescript+function setTabTitle(title: string): void {+ const prefix = process.env.PAI_TAB_PREFIX || '🤖'; // Change this+ // ...+}+```++**Example: Add Project-Specific Context**++Edit `load-core-context.ts` to load project-specific context:++```typescript+// Check for project-specific context file+const projectContextPath = join(payload.cwd, '.pai', 'context.md');+if (existsSync(projectContextPath)) {+ const projectContext = readFileSync(projectContextPath, 'utf-8');+ console.log(`<system-reminder>${projectContext}</system-reminder>`);+}+```++---+## Credits- **Original concept**: Daniel Miessler - developed as part of Kai personal AI infrastructurediff --git a/Packs/kai-observability-server.md b/Packs/kai-observability-server.mdindex 5e4dbf44..8b604a01 100644--- a/Packs/kai-observability-server.md+++ b/Packs/kai-observability-server.md@@ -1572,6 +1572,90 @@ User: "Something's wrong with my workflow"---+## Customization++### Recommended Customization++**Customize the Dashboard for Your Workflow**++The default dashboard shows all events in a simple timeline. Customize it to highlight what matters most to your work.++**What to Customize:** `$PAI_DIR/observability/apps/client/src/App.vue`++**Why:** Different developers care about different things. Security-focused work might want to highlight Bash commands. Research workflows might want to emphasize agent spawns. A customized dashboard surfaces the information you need.++**Process:**++1. **Identify Your Key Events**+ - What events do you care about most?+ - Which agents do you want prominently displayed?+ - What information should be visible at a glance?++2. **Customize Event Colors**+ Edit the `getBorderColor` function:+ ```typescript+ function getBorderColor(eventType: string): string {+ const colors: Record<string, string> = {+ 'PreToolUse': 'border-[var(--accent-blue)]',+ 'PostToolUse': 'border-[var(--accent-green)]',+ 'Stop': 'border-[var(--accent-yellow)]',+ 'Completed': 'border-[var(--accent-green)]',+ // Add your custom highlights:+ 'SecurityWarning': 'border-red-500',+ 'AgentSpawn': 'border-purple-500',+ }+ return colors[eventType] || 'border-[var(--text-secondary)]'+ }+ ```++3. **Add Custom Filtering**+ Modify the template to add agent or tool filters:+ ```vue+ <select v-model="selectedAgent" class="...">+ <option value="">All Agents</option>+ <option v-for="agent in agents" :value="agent">{{ agent }}</option>+ </select>+ ```++**Expected Outcome:** A dashboard that immediately shows you what you care about.++---++### Optional Customization++| Customization | File | Impact |+|---------------|------|--------|+| **Theme Colors** | `style.css` | Change the color scheme |+| **Event Limit** | `file-ingest.ts` | Adjust MAX_EVENTS for memory usage |+| **Ports** | `manage.sh`, `vite.config.ts`, `index.ts` | Change server/client ports |+| **Agent Name Mapping** | `file-ingest.ts` | Add recognition for custom agent types |++**Example: Change Theme Colors**++Edit `$PAI_DIR/observability/apps/client/src/style.css`:++```css+:root {+ --bg-primary: #0d1117; /* Darker background */+ --accent-blue: #58a6ff; /* GitHub-style blue */+ --accent-green: #3fb950; /* GitHub-style green */+}+```++**Example: Add Custom Agent Recognition**++Edit `file-ingest.ts` to recognize your custom agents:++```typescript+const subAgentTypes = [+ 'artist', 'intern', 'engineer', 'pentester', 'architect',+ // Add your custom agent types:+ 'security-researcher', 'documentation-writer', 'code-reviewer'+];+```++---+## Credits- **Original concept**: Daniel Miessler - developed as part of Kai personal AI infrastructurediff --git a/Packs/kai-voice-system.md b/Packs/kai-voice-system.mdindex d76954eb..43c1a1e8 100644--- a/Packs/kai-voice-system.md+++ b/Packs/kai-voice-system.md@@ -353,11 +353,12 @@ elseecho "❌ kai-core-install NOT installed - REQUIRED! Install it first."fi-# Check for ElevenLabs API key-if [ -f "$HOME/.env" ] && grep -q "ELEVENLABS_API_KEY" "$HOME/.env"; then- echo "✓ ELEVENLABS_API_KEY found in ~/.env"+# Check for ElevenLabs API key in $PAI_DIR/.env+PAI_ENV="${PAI_DIR:-$HOME/.config/pai}/.env"+if [ -f "$PAI_ENV" ] && grep -q "ELEVENLABS_API_KEY" "$PAI_ENV"; then+ echo "✓ ELEVENLABS_API_KEY found in $PAI_ENV"else- echo "⚠️ ELEVENLABS_API_KEY not found - you'll need to add it"+ echo "⚠️ ELEVENLABS_API_KEY not found - add it to $PAI_ENV"fi```@@ -1568,8 +1569,9 @@ import { homedir } from "os";import { join } from "path";import { existsSync, readFileSync } from "fs";-// Load .env from user home directory-const envPath = join(homedir(), '.env');+// Load .env from PAI directory (single source of truth for all API keys)+const paiDir = process.env.PAI_DIR || join(homedir(), '.config', 'pai');+const envPath = join(paiDir, '.env');if (existsSync(envPath)) {const envContent = await Bun.file(envPath).text();envContent.split('\n').forEach(line => {@@ -1584,8 +1586,8 @@ const PORT = parseInt(process.env.PAI_VOICE_PORT || "8888");const ELEVENLABS_API_KEY = process.env.ELEVENLABS_API_KEY;if (!ELEVENLABS_API_KEY) {- console.error('⚠️ ELEVENLABS_API_KEY not found in ~/.env');- console.error('Add: ELEVENLABS_API_KEY=your_key_here');+ console.error(`⚠️ ELEVENLABS_API_KEY not found in ${envPath}`);+ console.error('Add: ELEVENLABS_API_KEY=your_key_here to $PAI_DIR/.env');}// Default voice ID (customize to your preference)@@ -2011,8 +2013,8 @@ fiif [ "$ELEVENLABS_CONFIGURED" = false ]; thenecho- echo "To enable AI voices, add your ElevenLabs API key to ~/.env:"- echo " echo 'ELEVENLABS_API_KEY=your_api_key_here' >> ~/.env"+ echo "To enable AI voices, add your ElevenLabs API key to \$PAI_DIR/.env:"+ echo " echo 'ELEVENLABS_API_KEY=your_api_key_here' >> \$PAI_DIR/.env"echo " Get a key at: https://elevenlabs.io"echofi@@ -2290,21 +2292,19 @@ chmod +x $PAI_DIR/voice-server/*.sh### Step 11: Configure Environment Variables-Add your ElevenLabs credentials to `~/.env`:+Add your ElevenLabs credentials to `$PAI_DIR/.env` (the single source of truth for all API keys):```bash-# Add to ~/.env-echo 'ELEVENLABS_API_KEY=your_actual_api_key_here' >> ~/.env-echo 'ELEVENLABS_VOICE_ID=s3TPKV1kjDlVtZbl4Ksh' >> ~/.env--# Reload shell-source ~/.zshrc+# Add to $PAI_DIR/.env+PAI_ENV="${PAI_DIR:-$HOME/.config/pai}/.env"+echo 'ELEVENLABS_API_KEY=your_actual_api_key_here' >> "$PAI_ENV"+echo 'ELEVENLABS_VOICE_ID=s3TPKV1kjDlVtZbl4Ksh' >> "$PAI_ENV"```-**Also add to your shell profile** (`~/.zshrc` or `~/.bashrc`):+**Optionally add convenience variables to your shell profile** (`~/.zshrc` or `~/.bashrc`):```bash-# PAI Voice System+# PAI Voice System (optional - for CLI access)export PAI_VOICE_SERVER="http://localhost:8888/notify"export PAI_VOICE_PORT="8888"```@@ -2348,13 +2348,14 @@ ls -la $PAI_DIR/voice-server/status.sh```bash# Check ElevenLabs API key is setecho "=== Checking Environment ==="-grep "ELEVENLABS_API_KEY" ~/.env+PAI_ENV="${PAI_DIR:-$HOME/.config/pai}/.env"+grep "ELEVENLABS_API_KEY" "$PAI_ENV"# Should show your key (not "your_api_key_here")# Test the API key worksecho "=== Testing ElevenLabs API Key ==="curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/s3TPKV1kjDlVtZbl4Ksh" \- -H "xi-api-key: $(grep ELEVENLABS_API_KEY ~/.env | cut -d'=' -f2)" \+ -H "xi-api-key: $(grep ELEVENLABS_API_KEY "$PAI_ENV" | cut -d'=' -f2)" \-H "Content-Type: application/json" \-d '{"text": "API key verified.", "model_id": "eleven_turbo_v2_5"}' \--output /tmp/test-voice.mp3 && \@@ -2509,7 +2510,7 @@ curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/s3TPKV1kjDlVtZbl4Ks**Symptom:** "ElevenLabs API error: 401"1. Verify your API key at [elevenlabs.io](https://elevenlabs.io) → Profile → API Key-2. Check the key in ~/.env matches exactly (no extra spaces or quotes)+2. Check the key in `$PAI_DIR/.env` matches exactly (no extra spaces or quotes)3. Ensure your ElevenLabs subscription is active### Hooks Not Running@@ -2551,7 +2552,7 @@ The server has built-in rate limiting (10 requests/minute per IP). If you're tes| Error | Cause | Fix ||-------|-------|-----|-| "ELEVENLABS_API_KEY not found" | Missing .env | Add key to ~/.env |+| "ELEVENLABS_API_KEY not found" | Missing .env | Add key to `$PAI_DIR/.env` || "Voice server is not responding" | Server crashed | `./restart.sh` || "Invalid voice_id" | Wrong voice ID format | Check voice ID exists in ElevenLabs || "afplay exited with code" | Audio playback failed | Check macOS audio settings |@@ -2661,6 +2662,57 @@ If the voice server is offline:---+## Customization++### Recommended Customization++**What to Customize:** Voice selection and persona mapping++**Why:** The default voice works, but PAI becomes truly personal when it speaks with a voice that resonates with you. Spending time selecting and mapping voices transforms PAI from "a system that talks" to "your AI's voice."++**Process:**++1. **Explore ElevenLabs Voice Library**+ - Browse [ElevenLabs Voice Library](https://elevenlabs.io/voice-library)+ - Listen to at least 10-15 different voices+ - Note voice IDs for ones that feel right++2. **Define Your Voice Mapping**+ Have a conversation with your AI to explore preferences:+ ```+ "I want to customize my PAI voices. For the main PAI voice, I want+ something [professional/warm/energetic/calm]. For notifications,+ maybe something [shorter/punchier/softer]. Let's explore what+ feels right..."+ ```++3. **Test with Real Content**+ - Try different voices with actual PAI outputs+ - Test emotional markers with different voice models+ - Listen for naturalness with your typical message length++4. **Update Environment Variables**+ ```bash+ # In $PAI_DIR/.env+ ELEVENLABS_VOICE_PAI="your-chosen-voice-id"+ ELEVENLABS_VOICE_DEFAULT="your-fallback-voice-id"+ ```++**Expected Outcome:** PAI speaks in a voice that feels natural and personal to you. The voice becomes part of your PAI's identity rather than a generic TTS output.++### Optional Customization++| Customization | File | Impact |+|--------------|------|--------|+| Custom emotional markers | `voice-server/server.ts` | Add your own prosody tags beyond the defaults |+| Message preprocessing | `voice-server/server.ts` | Custom text cleanup before TTS |+| Volume/speed defaults | ElevenLabs dashboard | Adjust voice characteristics |+| Multi-voice personas | `.env` + server config | Different voices for different agent types |+| Notification sounds | `voice-server/server.ts` | Add audio cues before/after speech |+| Queue behavior | `voice-server/server.ts` | Adjust how overlapping messages are handled |++---+## Credits- **Original concept**: Daniel Miessler - developed as part of the PAI (Personal AI) projectdiff --git a/README.md b/README.mdindex 0bb62f31..30dc1492 100644--- a/README.md+++ b/README.md@@ -287,6 +287,42 @@ Packs are self-contained markdown files. You can:---+## 🔐 Authentication Setup++**All API keys live in ONE place: `$PAI_DIR/.env`**++This is a core principle of PAI: **no keys stored anywhere else in the system**. Every pack, every tool, every workflow reads from this single file.++### Setup++```bash+# 1. Copy the example file to your PAI directory+cp .env.example $PAI_DIR/.env++# 2. Edit and add your API keys+nano $PAI_DIR/.env++# 3. Restart Claude Code to load the new environment+```++### What Goes in .env++**Core variables:**+- `DA` - Your AI assistant's name+- `TIME_ZONE` - Your timezone++**Pack-specific keys:** Each pack documents its required API keys in its installation section. Add them to `.env` as you install packs.++### Security Rules++1. **NEVER commit `.env` files to git** - The `.gitignore` already excludes them+2. **NEVER store API keys in pack files, configs, or code** - Always use environment variables+3. **ALL authentication flows through `$PAI_DIR/.env`** - One file, one location, no exceptions++See [.env.example](.env.example) for the complete template with documentation.++---+## 📖 How PAI Packs WorkPAI offers **two types of packs**, each with its own structure and purpose:diff --git a/Tools/PAIPackTemplate.md b/Tools/PAIPackTemplate.mdindex b1f83558..a795f1f1 100644--- a/Tools/PAIPackTemplate.md+++ b/Tools/PAIPackTemplate.md@@ -903,6 +903,60 @@ export TIME_ZONE="America/Los_Angeles"export DA="MyAI"```+## Customization+<!--+(2048 words max)++INSTRUCTIONS FOR AI: This section documents how users can personalize and customize+the pack beyond basic configuration. This is OPTIONAL but highly encouraged for packs+that benefit from personalization.++Structure this section with two subsections:+1. **Recommended Customization** - Personalization steps that significantly improve+ the pack's value for individual users. These are things most users SHOULD do.+2. **Optional Customization** - Additional tweaks users CAN make if desired.++For each customization:+- Explain WHAT to customize+- Explain WHY it improves the experience+- Provide specific STEPS or a process+- Note the EXPECTED OUTCOME++Example from Art Skill:+- RECOMMENDED: Have an extended conversation with your AI about your aesthetic preferences,+ capture this in Aesthetic.md, so all generated images reflect your personal style.+- OPTIONAL: Add your own color palette, create custom prompt templates for your use cases.++If no customization is applicable, write "No customization options. This pack works+as-is without personalization."+-->++### Recommended Customization++[Describe customization steps that significantly improve the pack for individual users]++**What to Customize:** [The component/file/setting to personalize]++**Why:** [How this improves the experience]++**Process:**+1. [Step 1]+2. [Step 2]+3. [Step 3]++**Expected Outcome:** [What users should expect after customization]++---++### Optional Customization++[Describe additional tweaks users can make]++| Customization | File | Impact |+|--------------|------|--------|+| [Custom option 1] | [file.md] | [What it affects] |+| [Custom option 2] | [file.md] | [What it affects] |+## Credits<!--(256 words max)@@ -984,7 +1038,8 @@ Format: ### {version} - {YYYY-MM-DD}| `## Installation` | 16384 | Step-by-step with ALL code || `## Invocation Scenarios` | 8192 | When/how it triggers || `## Example Usage` | 8192 | Concrete examples |-| `## Configuration` | 512 | Options and customization |+| `## Configuration` | 512 | Options and environment variables |+| `## Customization` | 2048 | Personalization beyond basic config || `## Credits` | 256 | Attribution || `## Related Work` | 256 | Similar projects || `## Works Well With` | 256 | Complementary packs |@@ -1016,6 +1071,7 @@ Format: ### {version} - {YYYY-MM-DD}- [ ] **Environment variables**: Required vars and where to set them- [ ] **Verification steps**: How to confirm success- [ ] **256x256 icon**: Transparent PNG in blue/purple palette (generated with `--remove-bg` flag)+- [ ] **Customization section**: If pack benefits from personalization, document recommended and optional customizations**The test:** Can someone go from fresh Claude Code to fully working system using ONLY this pack?