Skip to content

Commit 8ff95c6

Browse files
Fix .env file location confusion
- Changed .env location from ~/.env to ${PAI_DIR}/.env for consistency - Updated all documentation to use ${PAI_DIR}/.env - Fixed .env-example comments to clarify location - Updated README.md, quick-start.md, and all other docs - Fixed voice-server documentation references - All commands now source from ${PAI_DIR}/.env This provides a central location for environment variables that stays with the PAI installation rather than polluting the home directory. Fixes #20 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 152d047 commit 8ff95c6

8 files changed

Lines changed: 25 additions & 24 deletions

File tree

.env-example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Your core .env file for everything PAI related
2-
# Yours should be named .env (.env-example is just the example)
3-
# 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.
2+
# Copy this file to ${PAI_DIR}/.env: cp .env-example ${PAI_DIR}/.env
3+
# Then add your actual API keys to ${PAI_DIR}/.env
4+
# Commands and agents should reference keys from ${PAI_DIR}/.env, not store them directly in their files
45

56
OPENAI_API_KEY="example-key-here"
67
SOME_OTHER_KEY="another-example-key-here"

PAI_DIRECTORY/commands/web-research.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Quick Usage
44
```bash
5-
# Basic research query (API key in ~/.env as PERPLEXITY_API_KEY)
6-
source ~/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
5+
# Basic research query (API key in ${PAI_DIR}/.env as PERPLEXITY_API_KEY)
6+
source ${PAI_DIR}/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
77
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
88
-H "Content-Type: application/json" \
99
-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 \
1212

1313
## With Citations
1414
```bash
15-
source ~/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
15+
source ${PAI_DIR}/.env && curl -s -X POST https://api.perplexity.ai/chat/completions \
1616
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
1717
-H "Content-Type: application/json" \
1818
-d "{\"model\":\"sonar\",\"messages\":[{\"role\":\"user\",\"content\":\"YOUR_QUERY_HERE\"}],\"return_citations\":true}" \

PAI_DIRECTORY/context/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
**This is the PUBLIC version of PAI - a template for others to build their own personal AI infrastructure.**
88

99
All sensitive data, personal information, and API keys have been removed. Users should:
10-
1. Add their own API keys to ~/.env
10+
1. Add their own API keys to ${PAI_DIR}/.env
1111
2. Customize context files for their needs
1212
3. Add their own personal commands and workflows
1313

PAI_DIRECTORY/documentation/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ cd PAI_DIRECTORY/voice-server
115115
./install.sh
116116

117117
# Configure environment
118-
cp .env.example ~/.env
119-
# Edit ~/.env with your settings
118+
cp .env.example ${PAI_DIR}/.env
119+
# Edit ${PAI_DIR}/.env with your settings
120120
```
121121

122122
## Configuration
123123

124124
PAI is configured through:
125-
1. Environment variables in `~/.env`
125+
1. Environment variables in `${PAI_DIR}/.env`
126126
2. Context files in `${PAI_DIR}/context/`
127127
3. Hook scripts in `${PAI_DIR}/hooks/`
128128
4. Project-specific configurations
@@ -156,9 +156,9 @@ Common issues and solutions:
156156
| Issue | Solution |
157157
|-------|----------|
158158
| Context not loading | Check `${PAI_DIR}/context/` |
159-
| Voice not working | Verify ElevenLabs API key in `~/.env` |
159+
| Voice not working | Verify ElevenLabs API key in `${PAI_DIR}/.env` |
160160
| Hooks not triggering | Ensure hook scripts are executable |
161-
| Port conflicts | Change PORT in `~/.env` |
161+
| Port conflicts | Change PORT in `${PAI_DIR}/.env` |
162162

163163
## Contributing
164164

PAI_DIRECTORY/documentation/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mkdir -p "$HOME/Documentation"
4848

4949
### 4. Configure Environment File
5050

51-
Create `~/.env` with your settings:
51+
Create `${PAI_DIR}/.env` with your settings:
5252

5353
```bash
5454
# Essential Configuration

PAI_DIRECTORY/documentation/voice-system.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The PAI Voice System provides text-to-speech capabilities for Kai and all agents
6868

6969
## Server Configuration
7070

71-
### Environment Variables (in ~/.env)
71+
### Environment Variables (in ${PAI_DIR}/.env)
7272
```bash
7373
ELEVENLABS_API_KEY="your_api_key_here"
7474
ELEVENLABS_VOICE_ID="jqcCZkN6Knx8BJ5TBdYR" # Default voice ID (Kai)
@@ -212,7 +212,7 @@ Every response from Kai and agents MUST include:
212212
```
213213

214214
2. **API Key Issues**
215-
- Verify ELEVENLABS_API_KEY in ~/.env
215+
- Verify ELEVENLABS_API_KEY in ${PAI_DIR}/.env
216216
- Check API key is valid and has credits
217217
- Server falls back to 'say' command if API fails
218218

PAI_DIRECTORY/voice-server/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ curl -fsSL https://bun.sh/install | bash
2727
```
2828

2929
### 2. Configure API Key (Optional but Recommended)
30-
Add your ElevenLabs API key to `~/.env`:
30+
Add your ElevenLabs API key to `${PAI_DIR}/.env`:
3131
```bash
32-
echo "ELEVENLABS_API_KEY=your_api_key_here" >> ~/.env
33-
echo "ELEVENLABS_VOICE_ID=jqcCZkN6Knx8BJ5TBdYR" >> ~/.env
32+
echo "ELEVENLABS_API_KEY=your_api_key_here" >> ${PAI_DIR}/.env
33+
echo "ELEVENLABS_VOICE_ID=jqcCZkN6Knx8BJ5TBdYR" >> ${PAI_DIR}/.env
3434
```
3535

3636
> 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:
146146
## 🔧 Configuration
147147

148148
### Environment Variables
149-
Create or edit `~/.env` in your home directory:
149+
Create or edit `${PAI_DIR}/.env`:
150150

151151
```bash
152152
# Required for ElevenLabs voices (optional)
@@ -163,7 +163,7 @@ PORT=8888
163163
1. Go to [ElevenLabs Voice Library](https://elevenlabs.io/voice-library)
164164
2. Select a voice you like
165165
3. Click "Use" and copy the Voice ID
166-
4. Update `ELEVENLABS_VOICE_ID` in your `~/.env`
166+
4. Update `ELEVENLABS_VOICE_ID` in your `${PAI_DIR}/.env`
167167

168168
## 🐛 Troubleshooting
169169

@@ -182,7 +182,7 @@ lsof -ti :8888 | xargs kill -9
182182
### No voice output
183183
```bash
184184
# Check if ElevenLabs key is configured
185-
grep ELEVENLABS_API_KEY ~/.env
185+
grep ELEVENLABS_API_KEY ${PAI_DIR}/.env
186186

187187
# Test with fallback (macOS say)
188188
curl -X POST http://localhost:8888/notify \
@@ -230,7 +230,7 @@ ${PAI_DIR}/voice-server/
230230

231231
## 🔐 Security Notes
232232

233-
- **No hardcoded API keys**: All sensitive data is read from `~/.env`
233+
- **No hardcoded API keys**: All sensitive data is read from `${PAI_DIR}/.env`
234234
- **Local only**: Server only listens on localhost (127.0.0.1)
235235
- **User-specific**: Each user maintains their own API keys
236236
- **Safe for public repos**: No sensitive data in the codebase

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,11 @@ source ~/.zshrc # or source ~/.bashrc
511511
#### **Step 4: Configure Environment**
512512

513513
```bash
514-
# Copy environment template
515-
cp .env.example ~/.env
514+
# Copy environment template to PAI_DIRECTORY
515+
cp .env.example ${PAI_DIR}/.env
516516

517517
# Add your API keys (optional but recommended)
518-
vim ~/.env
518+
vim ${PAI_DIR}/.env
519519
# Add: ELEVENLABS_API_KEY="your_key_here"
520520
# Add: OPENAI_API_KEY="your_key_here"
521521
```

0 commit comments

Comments
 (0)