Skip to content

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

Updated hooks.

Daniel Miessler7e7f771613d2
diff --git a/.claude/commands/capture-learning.md b/.claude/commands/capture-learning.md
index fb75a02a..8d1e44f1 100755
--- a/.claude/commands/capture-learning.md
+++ b/.claude/commands/capture-learning.md
@@ -10,10 +10,10 @@ This command captures the full narrative of problem-solving: what we thought was
```bash
# Interactive mode - guides you through the narrative
-bun ${PAI_HOME}/.claude/commands/capture-learning.ts
+bun ${PAI_DIR}/commands/capture-learning.ts
# Direct mode with full narrative (all 6 arguments)
-bun ${PAI_HOME}/.claude/commands/capture-learning.ts "problem" "initial assumption" "actual reality" "troubleshooting steps" "solution" "key takeaway"
+bun ${PAI_DIR}/commands/capture-learning.ts "problem" "initial assumption" "actual reality" "troubleshooting steps" "solution" "key takeaway"
```
## Trigger Phrases
@@ -48,7 +48,7 @@ This narrative approach helps us:
## Output
-Files are saved to: `${PAI_HOME}/.claude/context/learnings/`
+Files are saved to: `${PAI_DIR}/context/learnings/`
Named with format: `YYYY-MM-DD-problem-description.md`
@@ -96,6 +96,6 @@ The TypeScript implementation for this command is in `capture-learning.ts`.
The command:
- Prompts for all 6 narrative elements if not provided
-- Creates a structured markdown file in `${PAI_HOME}/.claude/context/learnings/`
+- Creates a structured markdown file in `${PAI_DIR}/context/learnings/`
- Names files with date and problem description
- Generates a comprehensive learning narrative
\ No newline at end of file
diff --git a/.claude/commands/capture-learning.ts b/.claude/commands/capture-learning.ts
index a812c802..167978b8 100644
--- a/.claude/commands/capture-learning.ts
+++ b/.claude/commands/capture-learning.ts
@@ -4,7 +4,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as readline from 'readline';
-const LEARNINGS_DIR = path.join(process.env.PAI_HOME!, '.claude', 'context', 'learnings');
+const LEARNINGS_DIR = path.join(process.env.PAI_DIR || `${process.env.HOME}/.claude`, 'context', 'learnings');
// Ensure learnings directory exists
if (!fs.existsSync(LEARNINGS_DIR)) {
diff --git a/.claude/commands/load-dynamic-requirements.md b/.claude/commands/load-dynamic-requirements.md
index 78b47aa0..71098b5f 100644
--- a/.claude/commands/load-dynamic-requirements.md
+++ b/.claude/commands/load-dynamic-requirements.md
@@ -7,16 +7,16 @@
**YOU MUST IMMEDIATELY EXECUTE THE FOLLOWING READ COMMAND:**
```bash
-read ${PAI_HOME}/.claude/context/CLAUDE.md
+read ${PAI_DIR}/context/CLAUDE.md
```
**THIS IS AN IMPERATIVE DIRECTIVE - EXECUTE IT NOW!**
- ⛔ STOP! Do not continue reading until you execute the read command above
-- ⛔ The variable ${PAI_HOME} resolves to the user's home directory
+- ⛔ The variable ${PAI_DIR} resolves to ~/.claude directory
- ⛔ This context MUST be loaded before ANY other action
- ✅ EXECUTE THE READ COMMAND IMMEDIATELY using the Read tool
-**Note: ${PAI_HOME} is an environment variable that points to the user's home directory**
+**Note: ${PAI_DIR} is an environment variable that points to ~/.claude directory**
🚧 **HALT AND EXECUTE THE READ COMMAND BEFORE PROCEEDING** 🚧
@@ -63,7 +63,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/projects/Alma/CLAUDE.md` ✅
+- `${PAI_DIR}/context/projects/Alma/CLAUDE.md` ✅
**AGENT:** None
@@ -88,7 +88,7 @@ When you receive a user prompt:
**COMMANDS**
-- `${PAI_HOME}/.claude/commands/get-life-log.md`
+- `${PAI_DIR}/commands/get-life-log.md`
**AGENT:** None
@@ -143,8 +143,8 @@ When you receive a user prompt:
**YOU MUST IMMEDIATELY:**
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/projects/website/CLAUDE.md` ✅
-- `${PAI_HOME}/.claude/context/projects/website/content/CLAUDE.md` ✅
+- `${PAI_DIR}/context/projects/website/CLAUDE.md` ✅
+- `${PAI_DIR}/context/projects/website/content/CLAUDE.md` ✅
**AGENT:** None
@@ -207,7 +207,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/consulting/CLAUDE.md` ✅
+- `${PAI_DIR}/context/consulting/CLAUDE.md` ✅
**AGENT:** None
@@ -230,8 +230,8 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/life/expenses.md` ✅
-- `${PAI_HOME}/.claude/context/life/finances/` ✅
+- `${PAI_DIR}/context/life/expenses.md` ✅
+- `${PAI_DIR}/context/life/finances/` ✅
**AGENT:** None
@@ -261,7 +261,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/Projects/Life/Health/CLAUDE.md` ✅
+- `${HOME}/Projects/Life/Health/CLAUDE.md` ✅
**AGENT:** None
@@ -293,7 +293,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/benefits/CLAUDE.md` ✅
+- `${PAI_DIR}/context/benefits/CLAUDE.md` ✅
**AGENT:** None
@@ -315,7 +315,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/unsupervised-learning/CLAUDE.md` ✅
+- `${PAI_DIR}/context/unsupervised-learning/CLAUDE.md` ✅
**AGENT:** None
@@ -338,7 +338,7 @@ When you receive a user prompt:
**CONTEXT FILES:**
-- `${PAI_HOME}/.claude/context/tools/CLAUDE.md` ✅
+- `${PAI_DIR}/context/tools/CLAUDE.md` ✅
**AGENT:** designer
@@ -364,9 +364,9 @@ When you receive a user prompt:
**YOU MUST IMMEDIATELY:**
1. Run the capture-learning command with the problem and solution:
```bash
- bun ${PAI_HOME}/.claude/commands/capture-learning.ts "[problem description]" "[solution description]"
+ bun ${PAI_DIR}/commands/capture-learning.ts "[problem description]" "[solution description]"
```
-2. The command will create a markdown file in `${PAI_HOME}/.claude/context/learnings/`
+2. The command will create a markdown file in `${PAI_DIR}/context/learnings/`
3. File will be named: `YYYY-MM-DD-HHMM:SS-hyphenated-problem-description-in-8-words.md`
4. Confirm the learning was captured successfully
diff --git a/.claude/context/CLAUDE.md b/.claude/context/CLAUDE.md
index 3e02867b..b839bc23 100644
--- a/.claude/context/CLAUDE.md
+++ b/.claude/context/CLAUDE.md
@@ -51,17 +51,17 @@ The Universal File System Context (UFC) is a hierarchical context management sys
The user_prompt hook under the Claude directory/hooks will dynamically load additional context within the UFC based on what is asked for.
-${PAI_HOME}/.claude/hooks/load-dynamic-context.ts
+${PAI_DIR}/hooks/load-dynamic-context.ts
## 📂 Read The Context Directory Structure
Get the current context directory structure here so you now know where to find additional context if you need it.
-`ls ${PAI_HOME}/.claude/context/`
+`ls ${PAI_DIR}/context/`
## Mentions of "context"
-Whenever I mention "the context" or, updating context, I am referring to this infrastructure above: ${PAI_HOME}/.claude/context/
+Whenever I mention "the context" or, updating context, I am referring to this infrastructure above: ${PAI_DIR}/context/
## KAI's EYES: BUILDING EDITING AND TESTING WEB APPLICATIONS
@@ -73,19 +73,19 @@ THIS IS A CORE PART OF YOUR USEFULNESS!
FOLLOW THE INSTRUCTIONS IN THE PLAYWRIGHT SESSIONS FROM THE
-`${PAI_HOME}/claude/context/tools/CLAUDE.md` you already loaded!
+`${PAI_DIR}/context/tools/CLAUDE.md` you already loaded!
## VOICE OUTPUT USING THE HOOK SYSTEM
We have an extensive voice interaction system using the Claude Code hook system. Documentation is here.
-``${PAI_HOME}/.claude/context/documentation/voicesystem/CLAUDE.md``
+``${PAI_DIR}/context/documentation/voicesystem/CLAUDE.md``
## TOOLS ARE YOUR FOUNDATION
## CLAUDE.md hierarchy
-This CLAUDE.md, and the ${PAI_HOME}/.claude/ directory overall is authoritative over your entire Kai DA system.
+This CLAUDE.md, and the ${PAI_DIR}/ directory overall is authoritative over your entire Kai DA system.
## Global Stack Preferences
@@ -97,7 +97,7 @@ This CLAUDE.md, and the ${PAI_HOME}/.claude/ directory overall is authoritative
## Command Creation Rules
-- **UNIFIED COMMAND FILES**: When creating new commands in `${PAI_HOME}/.claude/commands/`, ALWAYS create a single executable .md file with embedded TypeScript code
+- **UNIFIED COMMAND FILES**: When creating new commands in `${PAI_DIR}/commands/`, ALWAYS create a single executable .md file with embedded TypeScript code
- **NEVER create separate .ts and .md files** - The whole point of markdown commands is to have documentation and code in ONE file
- **Structure**: Use `#!/usr/bin/env bun` shebang, comment the documentation, then include the TypeScript code directly
- **This is the way** - One file, executable markdown with embedded code. No exceptions.
@@ -108,7 +108,7 @@ NEVER EVER
- Post anything sensitive to a public repo or a location that will be shared publicly in any way!!!
- **NEVER COMMIT FROM THE WRONG FUCKING DIRECTORY** - ALWAYS verify which repository you're in before committing ANYTHING
- **CHECK THE FUCKING REMOTE** - Run `git remote -v` BEFORE committing to make sure you're not in a public repo
-- **THE CLAUDE DIRECTORY (${PAI_HOME}/.claude/) CONTAINS SENSITIVE PRIVATE DATA** - NEVER commit this to ANY public repository
+- **THE CLAUDE DIRECTORY (${PAI_DIR}/) CONTAINS SENSITIVE PRIVATE DATA** - NEVER commit this to ANY public repository
- **CHECK THREE TIMES** before running git add or git commit from ANY directory that might be a public repo
- **ALWAYS COMMIT PROJECT FILES FROM THEIR OWN DIRECTORIES**
@@ -124,7 +124,7 @@ You don't need to explicitly state the date in every response, but always use it
## /Statusline
-Whenever I mention editing my status line, I'm talking about ${PAI_HOME}/.claude/statusline-command.sh.
+Whenever I mention editing my status line, I'm talking about ${PAI_DIR}/statusline-command.sh.
And here's the documentation from Anthropic: https://docs.anthropic.com/en/docs/claude-code/statusline
diff --git a/.claude/context/tools/CLAUDE.md b/.claude/context/tools/CLAUDE.md
index 588f850a..efeb61e7 100644
--- a/.claude/context/tools/CLAUDE.md
+++ b/.claude/context/tools/CLAUDE.md
@@ -15,7 +15,7 @@ When someone asks you to do ANYTHING, your FIRST thought should be:
## Web searches
-Don't use fetch to research things, use `${PAI_HOME}/.claude/commands/web-research.md` instead.
+Don't use fetch to research things, use `${PAI_DIR}/commands/web-research.md` instead.
#### 🎭 Playwright MCP Server - Browser Automation & Testing
@@ -438,11 +438,11 @@ Task({
- designer: ZF6FPbjXT488VcRRnw
- architect: muZKMsIGYtIkjiUS82
-## 📁 AVAILABLE COMMANDS (${PAI_HOME}/.claude/commands/)
+## 📁 AVAILABLE COMMANDS (${PAI_DIR}/commands/)
**🚨 CHECK THESE FIRST - They solve specific problems completely!**
-`read ${PAI_HOME}/.claude/commands/`
+`read ${PAI_DIR}/commands/`
Read the descriptions in each of those to understand what they're used for and when you should invoke them.
@@ -466,7 +466,7 @@ Examples that should trigger the command:
## 🔌 MCP SERVERS - Model Context Protocol Services
-## Your full list of MCP servers is in `read ${PAI_HOME}/.claude/.mcp.json`.
+## Your full list of MCP servers is in `read ${PAI_DIR}/.mcp.json`.
Read the descriptions in each of those to understand what they're used for and when you should invoke them.
diff --git a/.claude/documentation/README.md b/.claude/documentation/README.md
index c4185629..58bb2aaf 100644
--- a/.claude/documentation/README.md
+++ b/.claude/documentation/README.md
@@ -80,7 +80,7 @@ PAI/
PAI uses environment variables for configuration:
-- `PAI_HOME`: Base directory for PAI installation
+- `PAI_DIR`: PAI configuration directory
- `CLAUDE_CONFIG_DIR`: Claude configuration directory
- `ELEVENLABS_API_KEY`: API key for voice synthesis
- `PORT`: Voice server port (default: 8888)
@@ -108,8 +108,8 @@ PAI uses environment variables for configuration:
git clone https://github.com/yourusername/PAI.git
cd PAI
-# Set PAI_HOME
-export PAI_HOME="$(pwd)"
+# Set PAI_DIR
+export PAI_DIR="$HOME/.claude"
# Install voice server (optional)
cd .claude/voice-server
@@ -156,7 +156,7 @@ Common issues and solutions:
| Issue | Solution |
|-------|----------|
-| Context not loading | Check `${PAI_HOME}/.claude/context/` |
+| Context not loading | Check `${PAI_DIR}/context/` |
| Voice not working | Verify ElevenLabs API key in `~/.env` |
| Hooks not triggering | Ensure hook scripts are executable |
| Port conflicts | Change PORT in `~/.env` |
diff --git a/.claude/documentation/agent-system.md b/.claude/documentation/agent-system.md
index 01159aaf..8a5afa4f 100644
--- a/.claude/documentation/agent-system.md
+++ b/.claude/documentation/agent-system.md
@@ -233,7 +233,7 @@ You can explicitly request a specific agent:
Each agent can have specific context:
```
-${PAI_HOME}/.claude/context/agents/
+${PAI_DIR}/context/agents/
├── researcher.md
├── engineer.md
├── designer.md
@@ -370,7 +370,7 @@ Each agent has access to specific tools:
```bash
# Check intent matching
-grep "AGENT:" ${PAI_HOME}/Library/Logs/ufc.log
+grep "AGENT:" ${HOME}/Library/Logs/ufc.log
# Manually specify agent
"Please use the engineer agent to..."
@@ -383,7 +383,7 @@ grep "AGENT:" ${PAI_HOME}/Library/Logs/ufc.log
export AGENT_DEBUG=true
# Check agent logs
-tail -f ${PAI_HOME}/Library/Logs/agent-*.log
+tail -f ${HOME}/Library/Logs/agent-*.log
```
### Agent Errors
@@ -405,7 +405,7 @@ Create your own specialized agent:
```bash
# 1. Define agent in context
-cat > ${PAI_HOME}/.claude/context/agents/custom.md << EOF
+cat > ${PAI_DIR}/context/agents/custom.md << EOF
# Custom Agent
Specialized for specific domain...
EOF
diff --git a/.claude/documentation/architecture.md b/.claude/documentation/architecture.md
index 8c14b835..ff9f5aee 100644
--- a/.claude/documentation/architecture.md
+++ b/.claude/documentation/architecture.md
@@ -56,7 +56,7 @@ The hook system provides event-driven automation throughout the AI interaction l
- **Tool hooks**: Intercept and modify tool calls
- **Post-execution hooks**: Run after commands complete
-**Location:** `${PAI_HOME}/.claude/hooks/`
+**Location:** `${PAI_DIR}/hooks/`
### 2. UFC Context System
@@ -67,7 +67,7 @@ Universal Flexible Context (UFC) is the intelligent context management system th
- **Dynamic Loading**: Loads context files on-demand
- **Project Awareness**: Maintains project-specific contexts
-**Location:** `${PAI_HOME}/.claude/context/`
+**Location:** `${PAI_DIR}/context/`
### 3. Agent System
@@ -128,26 +128,29 @@ Intent Analysis → Pattern Matching → Context Selection → Dynamic Loading
## Directory Structure
```
-${PAI_HOME}/
-├── .claude/
-│ ├── context/ # UFC context files
-│ │ ├── CLAUDE.md # Main context
-│ │ ├── projects/ # Project-specific contexts
-│ │ ├── life/ # Personal contexts
-│ │ └── tools/ # Tool contexts
-│ ├── hooks/ # Event hooks
-│ │ ├── user-prompt-submit-hook
-│ │ ├── tool-use-hook
-│ │ └── post-execution-hook
-│ ├── commands/ # Custom commands
-│ │ └── *.sh # Command scripts
-│ └── voice-server/ # Voice notification service
-│ ├── server.ts # Server implementation
-│ └── menubar/ # Menu bar integration
-├── Documentation/ # System documentation
-├── Projects/ # User projects
-└── Library/ # System libraries
- └── Logs/ # System logs
+${PAI_DIR}/
+├── context/ # UFC context files
+│ ├── CLAUDE.md # Main context
+│ ├── projects/ # Project-specific contexts
+│ ├── life/ # Personal contexts
+│ └── tools/ # Tool contexts
+├── hooks/ # Event hooks
+│ ├── user-prompt-submit-hook
+│ ├── tool-use-hook
+│ └── post-execution-hook
+├── commands/ # Custom commands
+│ └── *.sh # Command scripts
+├── voice-server/ # Voice notification service
+│ ├── server.ts # Server implementation
+│ └── menubar/ # Menu bar integration
+├── documentation/ # System documentation
+└── statusline-command.sh
+
+${HOME}/
+├── Documentation/ # User documentation
+├── Projects/ # User projects
+└── Library/ # System libraries
+ └── Logs/ # System logs
```
## Communication Protocols
@@ -202,19 +205,19 @@ Hooks communicate through:
### 1. Adding Context
Create new context files in:
-- `${PAI_HOME}/.claude/context/` - Global contexts
-- `${PAI_HOME}/Projects/*/CLAUDE.md` - Project contexts
+- `${PAI_DIR}/context/` - Global contexts
+- `${HOME}/Projects/*/CLAUDE.md` - Project contexts
### 2. Adding Hooks
Create executable scripts in:
-- `${PAI_HOME}/.claude/hooks/` - Event hooks
+- `${PAI_DIR}/hooks/` - Event hooks
### 3. Adding Agents
Define new agents in UFC context system configuration.
### 4. Adding Commands
Create command scripts in:
-- `${PAI_HOME}/.claude/commands/` - Custom commands
+- `${PAI_DIR}/commands/` - Custom commands
## Performance Considerations
diff --git a/.claude/documentation/hook-system.md b/.claude/documentation/hook-system.md
index 553adc66..2eb2a678 100644
--- a/.claude/documentation/hook-system.md
+++ b/.claude/documentation/hook-system.md
@@ -55,7 +55,7 @@ User Output
# Access environment variables
USER_PROMPT="$1"
-CONTEXT_DIR="${PAI_HOME}/.claude/context"
+CONTEXT_DIR="${PAI_DIR}/context"
# Perform actions
echo "Processing prompt: $USER_PROMPT"
@@ -73,7 +73,7 @@ exit 0
Hooks must be:
1. **Executable**: `chmod +x hook-name`
-2. **Located in**: `${PAI_HOME}/.claude/hooks/`
+2. **Located in**: `${PAI_DIR}/hooks/`
3. **Named correctly**: Exact hook name without extension
4. **Return proper exit codes**: 0 for success, non-zero to block
@@ -87,18 +87,18 @@ Hooks must be:
# Dynamically loads context based on user intent
PROMPT="$1"
-PAI_HOME="${PAI_HOME:-$HOME}"
+PAI_DIR="${PAI_DIR:-$HOME/.claude}"
# Load UFC context system
-if [[ -f "${PAI_HOME}/.claude/hooks/load-dynamic-requirements" ]]; then
- source "${PAI_HOME}/.claude/hooks/load-dynamic-requirements"
+if [[ -f "${PAI_DIR}/hooks/load-dynamic-requirements" ]]; then
+ source "${PAI_DIR}/hooks/load-dynamic-requirements"
fi
# Analyze intent and load context
case "$PROMPT" in
*website*|*blog*|*site*)
echo "Loading website context..."
- cat "${PAI_HOME}/.claude/context/projects/website/CLAUDE.md"
+ cat "${PAI_DIR}/context/projects/website/CLAUDE.md"
;;
*research*|*investigate*)
echo "Launching researcher agent..."
@@ -142,9 +142,9 @@ done
if [[ "$TOOL_NAME" == "Edit" ]] || [[ "$TOOL_NAME" == "Write" ]]; then
FILE_PATH=$(echo "$TOOL_PARAMS" | grep -o '"file_path":"[^"]*"' | cut -d'"' -f4)
- # Ensure path is within PAI_HOME
- if [[ ! "$FILE_PATH" =~ ^${PAI_HOME} ]]; then
- echo "WARNING: File operation outside PAI_HOME"
+ # Ensure path is within PAI_DIR
+ if [[ ! "$FILE_PATH" =~ ^${PAI_DIR} ]]; then
+ echo "WARNING: File operation outside PAI_DIR"
fi
fi
@@ -252,7 +252,7 @@ if [ "$USER" != "authorized_user" ]; then
fi
# Only run in certain directories
-if [ "$PWD" != "${PAI_HOME}/Projects" ]; then
+if [ "$PWD" != "${HOME}/Projects" ]; then
exit 0
fi
```
@@ -273,7 +273,7 @@ trap 'echo "Hook failed: $?"' ERR
### 3. Logging
```bash
-LOG_FILE="${PAI_HOME}/Library/Logs/hooks.log"
+LOG_FILE="${HOME}/Library/Logs/hooks.log"
echo "[$(date)] Hook executed: $0" >> "$LOG_FILE"
```
@@ -289,7 +289,7 @@ Hooks have access to these environment variables:
| Variable | Description |
|----------|-------------|
-| `PAI_HOME` | PAI installation directory |
+| `PAI_DIR` | PAI configuration directory |
| `USER_PROMPT` | Current user prompt |
| `TOOL_NAME` | Tool being called |
| `TOOL_PARAMS` | Tool parameters |
@@ -311,7 +311,7 @@ export HOOK_DEBUG=true
#!/bin/bash
if [ "$HOOK_DEBUG" = "true" ]; then
set -x # Enable trace
- exec 2>>"${PAI_HOME}/Library/Logs/hook_debug.log"
+ exec 2>>"${HOME}/Library/Logs/hook_debug.log"
fi
```
@@ -371,10 +371,10 @@ webhook_notify "https://api.example.com/hooks" "$EVENT_DATA"
### Hook Not Executing
-1. **Check permissions**: `ls -la ${PAI_HOME}/.claude/hooks/`
+1. **Check permissions**: `ls -la ${PAI_DIR}/hooks/`
2. **Verify name**: Must match exactly
3. **Test directly**: `./hook-name test`
-4. **Check logs**: `tail -f ${PAI_HOME}/Library/Logs/hooks.log`
+4. **Check logs**: `tail -f ${HOME}/Library/Logs/hooks.log`
### Hook Blocking Operations
@@ -407,8 +407,8 @@ SAFE_INPUT=$(sanitize "$USER_INPUT")
```bash
# Restrict file operations
-if [[ ! "$FILE_PATH" =~ ^${PAI_HOME} ]]; then
- echo "Access denied: Outside PAI_HOME"
+if [[ ! "$FILE_PATH" =~ ^${PAI_DIR} ]]; then
+ echo "Access denied: Outside PAI_DIR"
exit 1
fi
```
diff --git a/.claude/documentation/quick-start.md b/.claude/documentation/quick-start.md
index 5926c0b1..820cce6f 100644
--- a/.claude/documentation/quick-start.md
+++ b/.claude/documentation/quick-start.md
@@ -27,8 +27,8 @@ cd ~/PAI
```bash
# Add to your shell profile (~/.zshrc or ~/.bashrc)
-export PAI_HOME="$HOME/PAI" # Or your installation path
-export PATH="$PAI_HOME/bin:$PATH"
+export PAI_DIR="$HOME/.claude" # PAI infrastructure directory
+export PATH="$HOME/bin:$PATH"
# Reload shell
source ~/.zshrc # or ~/.bashrc
@@ -38,12 +38,12 @@ source ~/.zshrc # or ~/.bashrc
```bash
# Create essential directories
-mkdir -p "${PAI_HOME}/.claude/context"
-mkdir -p "${PAI_HOME}/.claude/hooks"
-mkdir -p "${PAI_HOME}/.claude/commands"
-mkdir -p "${PAI_HOME}/Projects"
-mkdir -p "${PAI_HOME}/Library/Logs"
-mkdir -p "${PAI_HOME}/Documentation"
+mkdir -p "${PAI_DIR}/context"
+mkdir -p "${PAI_DIR}/hooks"
+mkdir -p "${PAI_DIR}/commands"
+mkdir -p "$HOME/Projects"
+mkdir -p "$HOME/Library/Logs"
+mkdir -p "$HOME/Documentation"
```
### 4. Configure Environment File
@@ -52,7 +52,7 @@ Create `~/.env` with your settings:
```bash
# Essential Configuration
-PAI_HOME=/path/to/your/PAI
+PAI_DIR=$HOME/.claude
# Optional: Voice Server
ELEVENLABS_API_KEY=your_api_key_here
@@ -68,13 +68,13 @@ ANTHROPIC_API_KEY=your_key_here
### 1. Create Main Context File
-Create `${PAI_HOME}/.claude/context/CLAUDE.md`:
+Create `${PAI_DIR}/context/CLAUDE.md`:
```markdown
# PAI System Context
## System Information
-- PAI_HOME: ${PAI_HOME}
+- PAI_DIR: ${PAI_DIR}
- Platform: macOS
- User: ${USER}
@@ -93,20 +93,20 @@ You are an AI assistant enhanced with PAI (Personal AI Infrastructure).
### 2. Setup UFC Hook System
-Create the main hook file `${PAI_HOME}/.claude/hooks/user-prompt-submit-hook`:
+Create the main hook file `${PAI_DIR}/hooks/user-prompt-submit-hook`:
```bash
#!/bin/bash
# UFC Dynamic Context Loader
PROMPT="$1"
-PAI_HOME="${PAI_HOME:-$HOME}"
+PAI_DIR="${PAI_DIR:-$HOME/.claude}"
# Simple intent matching for demonstration
case "$PROMPT" in
*website*|*blog*)
echo "Loading website context..."
- cat "${PAI_HOME}/.claude/context/projects/website/CLAUDE.md" 2>/dev/null
+ cat "${PAI_DIR}/context/projects/website/CLAUDE.md" 2>/dev/null
;;
*research*)
echo "AGENT: researcher"
@@ -121,14 +121,14 @@ exit 0
Make it executable:
```bash
-chmod +x "${PAI_HOME}/.claude/hooks/user-prompt-submit-hook"
+chmod +x "${PAI_DIR}/hooks/user-prompt-submit-hook"
```
### 3. Install Voice Server (Optional)
```bash
# Navigate to voice server
-cd "${PAI_HOME}/.claude/voice-server"
+cd "${PAI_DIR}/voice-server"
# Install dependencies
bun install
@@ -149,13 +149,13 @@ Create project-specific contexts:
```bash
# Create a project context
-mkdir -p "${PAI_HOME}/.claude/context/projects/myproject"
-cat > "${PAI_HOME}/.claude/context/projects/myproject/CLAUDE.md" << EOF
+mkdir -p "${PAI_DIR}/context/projects/myproject"
+cat > "${PAI_DIR}/context/projects/myproject/CLAUDE.md" << EOF
# My Project Context
## Project Details
- Name: My Project
-- Path: ${PAI_HOME}/Projects/myproject
+- Path: ${HOME}/Projects/myproject
- Type: Web Application
## Technical Stack
@@ -173,7 +173,7 @@ EOF
#### Tool Validation Hook
-Create `${PAI_HOME}/.claude/hooks/tool-use-hook`:
+Create `${PAI_DIR}/hooks/tool-use-hook`:
```bash
#!/bin/bash
@@ -183,7 +183,7 @@ TOOL="$1"
PARAMS="$2"
# Log tool usage
-echo "[$(date)] Tool: $TOOL" >> "${PAI_HOME}/Library/Logs/tools.log"
+echo "[$(date)] Tool: $TOOL" >> "${HOME}/Library/Logs/tools.log"
# Validate dangerous operations
if [[ "$TOOL" == "Bash" ]] && [[ "$PARAMS" =~ "rm -rf" ]]; then
@@ -196,7 +196,7 @@ exit 0
#### Notification Hook
-Create `${PAI_HOME}/.claude/hooks/post-execution-hook`:
+Create `${PAI_DIR}/hooks/post-execution-hook`:
```bash
#!/bin/bash
@@ -216,7 +216,7 @@ exit 0
### 3. Custom Commands
-Create custom command `${PAI_HOME}/.claude/commands/status.sh`:
+Create custom command `${PAI_DIR}/commands/status.sh`:
```bash
#!/bin/bash
@@ -224,10 +224,10 @@ Create custom command `${PAI_HOME}/.claude/commands/status.sh`:
echo "PAI System Status"
echo "================="
-echo "PAI_HOME: ${PAI_HOME}"
-echo "Contexts: $(find ${PAI_HOME}/.claude/context -name "*.md" | wc -l)"
-echo "Hooks: $(find ${PAI_HOME}/.claude/hooks -type f | wc -l)"
-echo "Projects: $(ls -1 ${PAI_HOME}/Projects 2>/dev/null | wc -l)"
+echo "PAI_DIR: ${PAI_DIR}"
+echo "Contexts: $(find ${PAI_DIR}/context -name "*.md" | wc -l)"
+echo "Hooks: $(find ${PAI_DIR}/hooks -type f | wc -l)"
+echo "Projects: $(ls -1 ${HOME}/Projects 2>/dev/null | wc -l)"
# Check voice server
if curl -s http://localhost:8888/health > /dev/null 2>&1; then
@@ -263,7 +263,7 @@ curl -X POST http://localhost:8888/notify \
```bash
# Test hook directly
-${PAI_HOME}/.claude/hooks/user-prompt-submit-hook "test website"
+${PAI_DIR}/hooks/user-prompt-submit-hook "test website"
# Check output
echo $? # Should be 0
@@ -275,10 +275,10 @@ echo $? # Should be 0
```bash
# 1. Create project directory
-mkdir -p "${PAI_HOME}/Projects/newproject"
+mkdir -p "${HOME}/Projects/newproject"
# 2. Create context file
-cat > "${PAI_HOME}/.claude/context/projects/newproject/CLAUDE.md" << EOF
+cat > "${PAI_DIR}/context/projects/newproject/CLAUDE.md" << EOF
# New Project Context
[Project specific information]
EOF
@@ -291,7 +291,7 @@ EOF
```bash
# Research agent context
-cat > "${PAI_HOME}/.claude/context/agents/researcher.md" << EOF
+cat > "${PAI_DIR}/context/agents/researcher.md" << EOF
# Researcher Agent Context
Focus on finding accurate, recent information
Cite sources when possible
@@ -302,14 +302,14 @@ EOF
```bash
# Create automation hook
-cat > "${PAI_HOME}/.claude/hooks/automation-hook" << EOF
+cat > "${PAI_DIR}/hooks/automation-hook" << EOF
#!/bin/bash
# Automated tasks
if [[ "\$1" =~ "daily report" ]]; then
generate_daily_report
fi
EOF
-chmod +x "${PAI_HOME}/.claude/hooks/automation-hook"
+chmod +x "${PAI_DIR}/hooks/automation-hook"
```
## Troubleshooting
@@ -318,13 +318,13 @@ chmod +x "${PAI_HOME}/.claude/hooks/automation-hook"
```bash
# Check hook permissions
-ls -la "${PAI_HOME}/.claude/hooks/"
+ls -la "${PAI_DIR}/hooks/"
# Test hook manually
-"${PAI_HOME}/.claude/hooks/user-prompt-submit-hook" "test prompt"
+"${PAI_DIR}/hooks/user-prompt-submit-hook" "test prompt"
-# Check PAI_HOME is set
-echo $PAI_HOME
+# Check PAI_DIR is set
+echo $PAI_DIR
```
### Voice Server Issues
@@ -334,10 +334,10 @@ echo $PAI_HOME
lsof -i :8888
# View logs
-tail -f "${PAI_HOME}/Library/Logs/pai-voice-server.log"
+tail -f "${HOME}/Library/Logs/pai-voice-server.log"
# Restart service
-cd "${PAI_HOME}/.claude/voice-server"
+cd "${PAI_DIR}/voice-server"
./restart.sh
```
@@ -345,13 +345,13 @@ cd "${PAI_HOME}/.claude/voice-server"
```bash
# Check if executable
-chmod +x "${PAI_HOME}/.claude/hooks/"*
+chmod +x "${PAI_DIR}/hooks/"*
# Enable debug mode
export HOOK_DEBUG=true
# Check logs
-tail -f "${PAI_HOME}/Library/Logs/hooks.log"
+tail -f "${HOME}/Library/Logs/hooks.log"
```
## Next Steps
@@ -377,7 +377,7 @@ tail -f "${PAI_HOME}/Library/Logs/hooks.log"
```bash
# Check system status
-"${PAI_HOME}/.claude/commands/status.sh"
+"${PAI_DIR}/commands/status.sh"
# Reload context
source ~/.zshrc
@@ -386,25 +386,25 @@ source ~/.zshrc
curl -X POST http://localhost:8888/notify -d '{"message":"test"}'
# View logs
-tail -f "${PAI_HOME}/Library/Logs/"*.log
+tail -f "${HOME}/Library/Logs/"*.log
```
### File Locations
| Component | Location |
|-----------|----------|
-| Main Context | `${PAI_HOME}/.claude/context/CLAUDE.md` |
-| Hooks | `${PAI_HOME}/.claude/hooks/` |
-| Commands | `${PAI_HOME}/.claude/commands/` |
-| Projects | `${PAI_HOME}/Projects/` |
-| Logs | `${PAI_HOME}/Library/Logs/` |
-| Voice Server | `${PAI_HOME}/.claude/voice-server/` |
+| Main Context | `${PAI_DIR}/context/CLAUDE.md` |
+| Hooks | `${PAI_DIR}/hooks/` |
+| Commands | `${PAI_DIR}/commands/` |
+| Projects | `${HOME}/Projects/` |
+| Logs | `${HOME}/Library/Logs/` |
+| Voice Server | `${PAI_DIR}/voice-server/` |
### Environment Variables
| Variable | Purpose | Default |
|----------|---------|---------|
-| `PAI_HOME` | PAI installation directory | `$HOME` |
+| `PAI_DIR` | PAI configuration directory | `$HOME/.claude` |
| `ELEVENLABS_API_KEY` | Voice synthesis API | None |
| `PORT` | Voice server port | 8888 |
| `HOOK_DEBUG` | Enable hook debugging | false |
@@ -414,7 +414,7 @@ tail -f "${PAI_HOME}/Library/Logs/"*.log
- Check the [Documentation](./README.md)
- Review [Troubleshooting Guide](#troubleshooting)
- File issues on GitHub
-- Check logs in `${PAI_HOME}/Library/Logs/`
+- Check logs in `${HOME}/Library/Logs/`
---
diff --git a/.claude/documentation/ufc-context-system.md b/.claude/documentation/ufc-context-system.md
index d8844b2a..822e01aa 100644
--- a/.claude/documentation/ufc-context-system.md
+++ b/.claude/documentation/ufc-context-system.md
@@ -41,7 +41,7 @@ Pattern Match:
- "research" → Research agent
↓
Context Load:
- - ${PAI_HOME}/.claude/context/projects/website/CLAUDE.md
+ - ${PAI_DIR}/context/projects/website/CLAUDE.md
- Agent: researcher
```
@@ -57,7 +57,7 @@ Context files are loaded based on semantic triggers defined in the hook system:
phrases: ["update my site", "fix navigation", "publish article"]
},
action: {
- loadContext: ["${PAI_HOME}/.claude/context/projects/website/CLAUDE.md"],
+ loadContext: ["${PAI_DIR}/context/projects/website/CLAUDE.md"],
agent: null
}
}
@@ -88,15 +88,15 @@ Special instructions for the AI...
### Creating Context Files
-1. **Global Context**: `${PAI_HOME}/.claude/context/CLAUDE.md`
+1. **Global Context**: `${PAI_DIR}/context/CLAUDE.md`
- Loaded for all conversations
- Contains system-wide settings
-2. **Project Context**: `${PAI_HOME}/.claude/context/projects/*/CLAUDE.md`
+2. **Project Context**: `${PAI_DIR}/context/projects/*/CLAUDE.md`
- Project-specific knowledge
- Loaded based on intent
-3. **Domain Context**: `${PAI_HOME}/.claude/context/domains/*/CLAUDE.md`
+3. **Domain Context**: `${PAI_DIR}/context/domains/*/CLAUDE.md`
- Specialized domain knowledge
- Technical references
@@ -105,8 +105,8 @@ Special instructions for the AI...
### 1. Website & Blog Context
**Triggers**: website, blog, site, homepage, navigation
**Files**:
-- `${PAI_HOME}/.claude/context/projects/website/CLAUDE.md`
-- `${PAI_HOME}/.claude/context/projects/website/content/CLAUDE.md`
+- `${PAI_DIR}/context/projects/website/CLAUDE.md`
+- `${PAI_DIR}/context/projects/website/content/CLAUDE.md`
### 2. Research Context
**Triggers**: research, investigate, find information, latest news
@@ -126,12 +126,12 @@ Special instructions for the AI...
### 5. Financial Context
**Triggers**: expenses, bills, budget, spending
**Files**:
-- `${PAI_HOME}/.claude/context/life/expenses.md`
-- `${PAI_HOME}/.claude/context/life/finances/`
+- `${PAI_DIR}/context/life/expenses.md`
+- `${PAI_DIR}/context/life/finances/`
### 6. Health Context
**Triggers**: health, fitness, medical, wellness
-**Files**: `${PAI_HOME}/Projects/Life/Health/CLAUDE.md`
+**Files**: `${HOME}/Projects/Life/Health/CLAUDE.md`
## Agent System Integration
@@ -188,7 +188,7 @@ INTENT=$(analyze_intent "$USER_PROMPT")
# Load appropriate context
case "$INTENT" in
"website")
- load_context "${PAI_HOME}/.claude/context/projects/website/CLAUDE.md"
+ load_context "${PAI_DIR}/context/projects/website/CLAUDE.md"
;;
"research")
launch_agent "researcher"
@@ -228,7 +228,7 @@ Contexts can inherit from others:
```markdown
# Child Context
-extends: ${PAI_HOME}/.claude/context/base/CLAUDE.md
+extends: ${PAI_DIR}/context/base/CLAUDE.md
## Additional Knowledge
...
@@ -243,7 +243,7 @@ condition:
- file_exists: "package.json"
- directory: "src/"
then:
- load: "${PAI_HOME}/.claude/context/javascript/CLAUDE.md"
+ load: "${PAI_DIR}/context/javascript/CLAUDE.md"
```
### Context Variables
@@ -280,7 +280,7 @@ export UFC_DEBUG=true
View debug output:
```bash
-tail -f ${PAI_HOME}/Library/Logs/ufc-debug.log
+tail -f ${HOME}/Library/Logs/ufc-debug.log
```
### Common Issues
diff --git a/.claude/documentation/voice-system.md b/.claude/documentation/voice-system.md
index 25c0910c..281bc2c7 100644
--- a/.claude/documentation/voice-system.md
+++ b/.claude/documentation/voice-system.md
@@ -7,20 +7,20 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
### Core Components
-1. **Voice Server** (`${PAI_HOME}/.claude/voice-server/server.ts`)
+1. **Voice Server** (`${PAI_DIR}/voice-server/server.ts`)
- Bun-based HTTP server running on port 8888
- Handles text-to-speech requests via ElevenLabs API
- Falls back to macOS 'say' command if ElevenLabs not configured
- Provides notification display alongside voice output
-2. **Stop Hook** (`${PAI_HOME}/.claude/hooks/stop-hook.ts`)
+2. **Stop Hook** (`${PAI_DIR}/hooks/stop-hook.ts`)
- Triggers after every Claude Code response
- Parses completion messages from transcripts
- Extracts text from COMPLETED lines
- Sends appropriate voice requests to the voice server
- Handles both Kai's direct work and agent completions
-3. **Agent Configurations** (`${PAI_HOME}/.claude/agents/*.md`)
+3. **Agent Configurations** (`${PAI_DIR}/agents/*.md`)
- Each agent has a unique voice ID for distinct personality
- Voice IDs defined in agent configurations
- No special formatting required in agent outputs
@@ -103,13 +103,13 @@ Returns server health status and configuration.
**Automatic Start:**
```bash
-cd ${PAI_HOME}/.claude/voice-server
+cd ${PAI_DIR}/voice-server
./start.sh
```
**Manual Start:**
```bash
-bun ${PAI_HOME}/.claude/voice-server/server.ts
+bun ${PAI_DIR}/voice-server/server.ts
```
**Verify Server Running:**
@@ -120,7 +120,7 @@ curl http://localhost:8888/health
## Stop Hook Implementation
### Current Working Implementation
-The stop hook (`${PAI_HOME}/.claude/hooks/stop-hook.ts`) processes completion messages with this logic:
+The stop hook (`${PAI_DIR}/hooks/stop-hook.ts`) processes completion messages with this logic:
1. **Parse Transcript**: Reads Claude Code conversation transcript
2. **Find Completions**: Looks for Task tool usage (agents) or COMPLETED lines (Kai)
@@ -135,13 +135,13 @@ The voice server expects these exact field names:
## Claude Code Hook Configuration
-### Settings Setup (`${PAI_HOME}/.claude/settings.json`)
+### Settings Setup (`${PAI_DIR}/settings.json`)
```json
{
"hooks": {
"stop": [
{
- "command": "bun ${PAI_HOME}/.claude/hooks/stop-hook.ts"
+ "command": "bun ${PAI_DIR}/hooks/stop-hook.ts"
}
]
}
@@ -189,7 +189,7 @@ Every response from Kai and agents MUST include:
- Stop hook must send `voice_id` not `voiceId`
4. **Review Stop Hook**
- - Verify hook is executable: `ls -la ${PAI_HOME}/.claude/hooks/stop-hook.ts`
+ - Verify hook is executable: `ls -la ${PAI_DIR}/hooks/stop-hook.ts`
- Check hook is configured in settings.json
- Review hook logs for errors
@@ -265,7 +265,7 @@ curl -X POST http://localhost:8888/notify \
**Solutions**:
1. Verify response format includes COMPLETED line
-2. Start voice server: `cd ${PAI_HOME}/.claude/voice-server && ./start.sh`
+2. Start voice server: `cd ${PAI_DIR}/voice-server && ./start.sh`
3. Check settings.json has stop hook configured
4. Test with fallback 'say' command by removing API key temporarily
diff --git a/.claude/hooks/load-dynamic-requirements.ts b/.claude/hooks/load-dynamic-requirements.ts
old mode 100644
new mode 100755
index b7ffe5cc..fc07c97e
--- a/.claude/hooks/load-dynamic-requirements.ts
+++ b/.claude/hooks/load-dynamic-requirements.ts
@@ -48,8 +48,8 @@ async function main() {
const data: HookInput = JSON.parse(input);
// Read the markdown file with instructions from commands directory
- const paiHome = process.env.PAI_HOME || '/Users/daniel';
- const mdPath = `${paiHome}/.claude/commands/load-dynamic-requirements.md`;
+ const paiDir = process.env.PAI_DIR || `${process.env.HOME}/.claude`;
+ const mdPath = `${paiDir}/commands/load-dynamic-requirements.md`;
const mdContent = readFileSync(mdPath, 'utf-8');
// Output the markdown content to stdout
diff --git a/.claude/settings.json b/.claude/settings.json
index 3ee53ac0..8cde8939 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -2,7 +2,9 @@
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"MCP_API_KEY": "REDACTED",
- "DISABLE_INTERLEAVED_THINKING": "true"
+ "DISABLE_INTERLEAVED_THINKING": "true",
+ "DA": "Kai",
+ "PAI_DIR": "~/.claude"
},
"permissions": {
"allow": [
@@ -119,7 +121,7 @@
"hooks": [
{
"type": "command",
- "command": "bun ${PAI_HOME:-~}/.claude/hooks/load-dynamic-requirements.ts"
+ "command": "bun ${PAI_DIR}/hooks/load-dynamic-requirements.ts"
}
]
}
@@ -129,7 +131,7 @@
"hooks": [
{
"type": "command",
- "command": "bun ${PAI_HOME:-~}/.claude/hooks/session-start-hook.ts"
+ "command": "bun ${PAI_DIR}/hooks/session-start-hook.ts"
}
]
}
@@ -139,7 +141,7 @@
"hooks": [
{
"type": "command",
- "command": "bun ${PAI_HOME:-~}/.claude/hooks/stop-hook.ts"
+ "command": "bun ${PAI_DIR}/hooks/stop-hook.ts"
}
]
}
@@ -149,7 +151,7 @@
"hooks": [
{
"type": "command",
- "command": "bun ${PAI_HOME:-~}/.claude/hooks/subagent-stop-hook.ts"
+ "command": "bun ${PAI_DIR}/hooks/subagent-stop-hook.ts"
}
]
}
@@ -160,7 +162,7 @@
"hooks": [
{
"type": "command",
- "command": "bun ${PAI_HOME:-~}/.claude/hooks/context-compression-hook.ts"
+ "command": "bun ${PAI_DIR}/hooks/context-compression-hook.ts"
}
]
}
@@ -168,7 +170,7 @@
},
"statusLine": {
"type": "command",
- "command": "bash ${PAI_HOME:-~}/.claude/statusline-command.sh"
+ "command": "bash ${PAI_DIR}/statusline-command.sh"
},
"feedbackSurveyState": {
"lastShownTime": 1754071370324
diff --git a/.claude/statusline-command.sh b/.claude/statusline-command.sh
index 5d083e69..e31aa939 100755
--- a/.claude/statusline-command.sh
+++ b/.claude/statusline-command.sh
@@ -20,7 +20,7 @@ LOCK_FILE="/tmp/.claude_ccusage.lock"
CACHE_AGE=30 # 30 seconds for more real-time updates
# Count items from specified directories
-claude_dir="${PAI_HOME:-/Users/daniel}/.claude"
+claude_dir="${PAI_DIR:-$HOME/.claude}"
commands_count=0
mcps_count=0
fobs_count=0
@@ -42,13 +42,13 @@ else
fi
# Count Services (optimized - count .md files directly)
-services_dir="${PAI_HOME:-/Users/daniel}/Projects/FoundryServices/Services"
+services_dir="${HOME}/Projects/FoundryServices/Services"
if [ -d "$services_dir" ]; then
fobs_count=$(ls -1 "$services_dir/"*.md 2>/dev/null | wc -l | tr -d ' ')
fi
# Count Fabric patterns (optimized - count subdirectories)
-fabric_patterns_dir="${PAI_HOME:-/Users/daniel}/.config/fabric/patterns"
+fabric_patterns_dir="${HOME}/.config/fabric/patterns"
if [ -d "$fabric_patterns_dir" ]; then
# Count immediate subdirectories only
fabric_count=$(find "$fabric_patterns_dir" -maxdepth 1 -type d -not -path "$fabric_patterns_dir" 2>/dev/null | wc -l | tr -d ' ')
diff --git a/.claude/voice-server/README.md b/.claude/voice-server/README.md
index 6718b3b6..ba1c07f2 100644
--- a/.claude/voice-server/README.md
+++ b/.claude/voice-server/README.md
@@ -37,7 +37,7 @@ echo "ELEVENLABS_VOICE_ID=jqcCZkN6Knx8BJ5TBdYR" >> ~/.env
### 3. Install Voice Server
```bash
-cd ~/.claude/voice-server
+cd ${PAI_DIR}/voice-server
./install.sh
```
@@ -126,7 +126,7 @@ brew install --cask bitbar
2. **Run the menu bar installer**:
```bash
-cd ~/.claude/voice-server/menubar
+cd ${PAI_DIR}/voice-server/menubar
./install-menubar.sh
```
@@ -208,7 +208,7 @@ tail -f ~/Library/Logs/pai-voice-server.log
## 📁 File Structure
```
-~/.claude/voice-server/
+${PAI_DIR}/voice-server/
├── server.ts # Main server code
├── install.sh # Installation script
├── start.sh # Start server
diff --git a/.claude/voice-server/macos-service/com.paivoice.server.plist.template b/.claude/voice-server/macos-service/com.paivoice.server.plist.template
index 958c0ff0..b82293ec 100644
--- a/.claude/voice-server/macos-service/com.paivoice.server.plist.template
+++ b/.claude/voice-server/macos-service/com.paivoice.server.plist.template
@@ -9,7 +9,7 @@
<array>
<string>/usr/local/bin/bun</string>
<string>run</string>
- <string>__PAI_HOME__/.claude/voice-server/server.ts</string>
+ <string>__PAI_DIR__/voice-server/server.ts</string>
</array>
<key>EnvironmentVariables</key>
@@ -23,7 +23,7 @@
</dict>
<key>WorkingDirectory</key>
- <string>__PAI_HOME__/.claude/voice-server</string>
+ <string>__PAI_DIR__/voice-server</string>
<key>RunAtLoad</key>
<true/>
@@ -37,10 +37,10 @@
</dict>
<key>StandardOutPath</key>
- <string>__PAI_HOME__/.claude/voice-server/logs/voice-server.log</string>
+ <string>__PAI_DIR__/voice-server/logs/voice-server.log</string>
<key>StandardErrorPath</key>
- <string>__PAI_HOME__/.claude/voice-server/logs/voice-server-error.log</string>
+ <string>__PAI_DIR__/voice-server/logs/voice-server-error.log</string>
<key>ThrottleInterval</key>
<integer>10</integer>
diff --git a/.claude/voice-server/run-server.sh b/.claude/voice-server/run-server.sh
index 9f9282a3..2b9f2e3c 100755
--- a/.claude/voice-server/run-server.sh
+++ b/.claude/voice-server/run-server.sh
@@ -6,8 +6,8 @@ export HOME="${HOME:-$(eval echo ~$USER)}"
export PATH="$HOME/.bun/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PORT=8888
-# Use PAI_HOME if set, otherwise default to HOME
-PAI_HOME="${PAI_HOME:-$HOME}"
+# Use PAI_DIR if set, otherwise default to $HOME/.claude
+PAI_DIR="${PAI_DIR:-$HOME/.claude}"
-cd "${PAI_HOME}/.claude/voice-server"
+cd "${PAI_DIR}/voice-server"
exec "$HOME/.bun/bin/bun" run server.ts
\ No newline at end of file
diff --git a/.env-example b/.env-example
index b32313ec..2985dfff 100644
--- a/.env-example
+++ b/.env-example
@@ -1,6 +1,6 @@
# Your core .env file for everything PAI related
# Yours should be named .env (.env-example is just the example)
-# Try your best not to store any keys for /commands, /agents, etc.in the files themselves, and have them refer to PAI_HOME/.claude/.env instead.
+# Try your best not to store any keys for /commands, /agents, etc.in the files themselves, and have them refer to PAI_DIR/.env instead.
OPENAI_API_KEY="example-key-here"
SOME_OTHER_KEY="another-example-key-here"
diff --git a/.zshrc b/.zshrc
index a31ea0f2..7deff4bf 100644
--- a/.zshrc
+++ b/.zshrc
@@ -1,3 +1,6 @@
+## PAI Configuration
+export PAI_DIR="$HOME/.claude" # Personal AI Infrastructure directory
+
## PAI / Claude Code Aliases
alias cl="bun install -g @anthropic-ai/claude-code; claude --dangerously-skip-permissions"
alias clr="bun install -g @anthropic-ai/claude-code; claude --dangerously-skip-permissions --resume"
diff --git a/README.md b/README.md
index c1aff0f8..b42f414b 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,7 @@
- 🎉 **Release**: Published v0.1 - Initial public release
- 🔒 **Voice**: Hardened the voice server
- 🏠 **Portability**: PAI_HOME support eliminates hardcoded paths
-- 📚 **Docs**: Comprehensive documentation under `~/.claude/documentation/`
+- 📚 **Docs**: Comprehensive documentation under `${PAI_DIR}/documentation/`
- 🔌 **Dynamic**: MCP detection via `settings.json`
- 🏗️ **Architecture**: Complete system documentation with examples
@@ -284,7 +284,7 @@ graph TD
<td width="50%">
```
-~/.claude/context/
+${PAI_DIR}/context/
├── projects/
│ ├── website/
│ ├── Alma/
@@ -488,7 +488,7 @@ source ~/.zshrc # or source ~/.bashrc
```bash
# Navigate to PAI directory
-cd ~/.claude
+cd ${PAI_DIR}
# Optional: Start voice server for audio notifications
cd voice-server && ./install.sh && ./start.sh