Skip to content

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

Fix .env file location confusion

Daniel Miessler8ff95c693b94
diff --git a/.env-example b/.env-example
index 2985dfff..6f518f33 100644
--- a/.env-example
+++ b/.env-example
@@ -1,6 +1,7 @@
# 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_DIR/.env instead.
+# Copy this file to ${PAI_DIR}/.env: cp .env-example ${PAI_DIR}/.env
+# Then add your actual API keys to ${PAI_DIR}/.env
+# Commands and agents should reference keys from ${PAI_DIR}/.env, not store them directly in their files
OPENAI_API_KEY="example-key-here"
SOME_OTHER_KEY="another-example-key-here"
diff --git a/PAI_DIRECTORY/commands/web-research.md b/PAI_DIRECTORY/commands/web-research.md
index 1d7d8420..ed2efc01 100644
--- a/PAI_DIRECTORY/commands/web-research.md
+++ b/PAI_DIRECTORY/commands/web-research.md
@@ -2,8 +2,8 @@
## Quick Usage
```bash
-# Basic research query (API key in ~/.env as PERPLEXITY_API_KEY)
-source ~/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
+# Basic research query (API key in ${PAI_DIR}/.env as PERPLEXITY_API_KEY)
+source ${PAI_DIR}/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"sonar\",\"messages\":[{\"role\":\"user\",\"content\":\"YOUR_QUERY_HERE\"}]}" \
@@ -12,7 +12,7 @@ source ~/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
## With Citations
```bash
-source ~/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
+source ${PAI_DIR}/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"sonar\",\"messages\":[{\"role\":\"user\",\"content\":\"YOUR_QUERY_HERE\"}],\"return_citations\":true}" \
diff --git a/PAI_DIRECTORY/context/CLAUDE.md b/PAI_DIRECTORY/context/CLAUDE.md
index 23f3bdb0..c97ff134 100644
--- a/PAI_DIRECTORY/context/CLAUDE.md
+++ b/PAI_DIRECTORY/context/CLAUDE.md
@@ -7,7 +7,7 @@
**This is the PUBLIC version of PAI - a template for others to build their own personal AI infrastructure.**
All sensitive data, personal information, and API keys have been removed. Users should:
-1. Add their own API keys to ~/.env
+1. Add their own API keys to ${PAI_DIR}/.env
2. Customize context files for their needs
3. Add their own personal commands and workflows
diff --git a/PAI_DIRECTORY/documentation/README.md b/PAI_DIRECTORY/documentation/README.md
index f1c84023..353eb9d8 100644
--- a/PAI_DIRECTORY/documentation/README.md
+++ b/PAI_DIRECTORY/documentation/README.md
@@ -115,14 +115,14 @@ cd PAI_DIRECTORY/voice-server
./install.sh
# Configure environment
-cp .env.example ~/.env
-# Edit ~/.env with your settings
+cp .env.example ${PAI_DIR}/.env
+# Edit ${PAI_DIR}/.env with your settings
```
## Configuration
PAI is configured through:
-1. Environment variables in `~/.env`
+1. Environment variables in `${PAI_DIR}/.env`
2. Context files in `${PAI_DIR}/context/`
3. Hook scripts in `${PAI_DIR}/hooks/`
4. Project-specific configurations
@@ -156,9 +156,9 @@ Common issues and solutions:
| Issue | Solution |
|-------|----------|
| Context not loading | Check `${PAI_DIR}/context/` |
-| Voice not working | Verify ElevenLabs API key in `~/.env` |
+| Voice not working | Verify ElevenLabs API key in `${PAI_DIR}/.env` |
| Hooks not triggering | Ensure hook scripts are executable |
-| Port conflicts | Change PORT in `~/.env` |
+| Port conflicts | Change PORT in `${PAI_DIR}/.env` |
## Contributing
diff --git a/PAI_DIRECTORY/documentation/quick-start.md b/PAI_DIRECTORY/documentation/quick-start.md
index 0ad3c662..bb47cf6a 100644
--- a/PAI_DIRECTORY/documentation/quick-start.md
+++ b/PAI_DIRECTORY/documentation/quick-start.md
@@ -48,7 +48,7 @@ mkdir -p "$HOME/Documentation"
### 4. Configure Environment File
-Create `~/.env` with your settings:
+Create `${PAI_DIR}/.env` with your settings:
```bash
# Essential Configuration
diff --git a/PAI_DIRECTORY/documentation/voice-system.md b/PAI_DIRECTORY/documentation/voice-system.md
index 281bc2c7..6c0fcbfe 100644
--- a/PAI_DIRECTORY/documentation/voice-system.md
+++ b/PAI_DIRECTORY/documentation/voice-system.md
@@ -68,7 +68,7 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
## Server Configuration
-### Environment Variables (in ~/.env)
+### Environment Variables (in ${PAI_DIR}/.env)
```bash
ELEVENLABS_API_KEY="your_api_key_here"
ELEVENLABS_VOICE_ID="jqcCZkN6Knx8BJ5TBdYR" # Default voice ID (Kai)
@@ -212,7 +212,7 @@ Every response from Kai and agents MUST include:
```
2. **API Key Issues**
- - Verify ELEVENLABS_API_KEY in ~/.env
+ - Verify ELEVENLABS_API_KEY in ${PAI_DIR}/.env
- Check API key is valid and has credits
- Server falls back to 'say' command if API fails
diff --git a/PAI_DIRECTORY/voice-server/README.md b/PAI_DIRECTORY/voice-server/README.md
index ba1c07f2..6b4036aa 100644
--- a/PAI_DIRECTORY/voice-server/README.md
+++ b/PAI_DIRECTORY/voice-server/README.md
@@ -27,10 +27,10 @@ curl -fsSL https://bun.sh/install | bash
```
### 2. Configure API Key (Optional but Recommended)
-Add your ElevenLabs API key to `~/.env`:
+Add your ElevenLabs API key to `${PAI_DIR}/.env`:
```bash
-echo "ELEVENLABS_API_KEY=your_api_key_here" >> ~/.env
-echo "ELEVENLABS_VOICE_ID=jqcCZkN6Knx8BJ5TBdYR" >> ~/.env
+echo "ELEVENLABS_API_KEY=your_api_key_here" >> ${PAI_DIR}/.env
+echo "ELEVENLABS_VOICE_ID=jqcCZkN6Knx8BJ5TBdYR" >> ${PAI_DIR}/.env
```
> Get your free API key at [elevenlabs.io](https://elevenlabs.io) (10,000 characters/month free)
@@ -146,7 +146,7 @@ If you prefer manual installation:
## 🔧 Configuration
### Environment Variables
-Create or edit `~/.env` in your home directory:
+Create or edit `${PAI_DIR}/.env`:
```bash
# Required for ElevenLabs voices (optional)
@@ -163,7 +163,7 @@ PORT=8888
1. Go to [ElevenLabs Voice Library](https://elevenlabs.io/voice-library)
2. Select a voice you like
3. Click "Use" and copy the Voice ID
-4. Update `ELEVENLABS_VOICE_ID` in your `~/.env`
+4. Update `ELEVENLABS_VOICE_ID` in your `${PAI_DIR}/.env`
## 🐛 Troubleshooting
@@ -182,7 +182,7 @@ lsof -ti :8888 | xargs kill -9
### No voice output
```bash
# Check if ElevenLabs key is configured
-grep ELEVENLABS_API_KEY ~/.env
+grep ELEVENLABS_API_KEY ${PAI_DIR}/.env
# Test with fallback (macOS say)
curl -X POST http://localhost:8888/notify \
@@ -230,7 +230,7 @@ ${PAI_DIR}/voice-server/
## 🔐 Security Notes
-- **No hardcoded API keys**: All sensitive data is read from `~/.env`
+- **No hardcoded API keys**: All sensitive data is read from `${PAI_DIR}/.env`
- **Local only**: Server only listens on localhost (127.0.0.1)
- **User-specific**: Each user maintains their own API keys
- **Safe for public repos**: No sensitive data in the codebase
diff --git a/README.md b/README.md
index 586f631e..d1b8e929 100644
--- a/README.md
+++ b/README.md
@@ -511,11 +511,11 @@ source ~/.zshrc # or source ~/.bashrc
#### **Step 4: Configure Environment**
```bash
-# Copy environment template
-cp .env.example ~/.env
+# Copy environment template to PAI_DIRECTORY
+cp .env.example ${PAI_DIR}/.env
# Add your API keys (optional but recommended)
-vim ~/.env
+vim ${PAI_DIR}/.env
# Add: ELEVENLABS_API_KEY="your_key_here"
# Add: OPENAI_API_KEY="your_key_here"
```