Skip to content

fix: Write .env to both ~/.claude/ and ~/.config/pai/#337

Closed
nmitch17 wants to merge 1 commit into
danielmiessler:mainfrom
nmitch17:fix/env-file-location
Closed

fix: Write .env to both ~/.claude/ and ~/.config/pai/#337
nmitch17 wants to merge 1 commit into
danielmiessler:mainfrom
nmitch17:fix/env-file-location

Conversation

@nmitch17

@nmitch17 nmitch17 commented Jan 7, 2026

Copy link
Copy Markdown

Summary

Fixes installer to write .env to the canonical PAI location where components actually look for it.

Problem

The installer wrote .env to ~/.claude/, but PAI components (voice server, hooks, etc.) look in ~/.config/pai/. This caused voice and other features to fail silently.

Solution

Single source of truth - write .env only to ~/.config/pai/:

Component Reads from
Voice server ~/.config/pai/.env
Hooks ~/.config/pai/.env
Installer (update mode) ~/.config/pai/.env

Changes

  • readExistingConfig() now reads from ~/.config/pai/
  • .env written only to ~/.config/pai/.env
  • Removed duplicate write to ~/.claude/.env

Test Plan

  • Fresh install: verify .env created at ~/.config/pai/.env
  • Update install: verify existing config read from ~/.config/pai/.env
  • Voice server finds API keys correctly

Fixes #336

🤖 Generated with Claude Code

The installer was writing .env to ~/.claude/, but PAI components
(voice server, hooks, etc.) look in ~/.config/pai/.

This fix:
- Writes .env only to ~/.config/pai/.env (single source of truth)
- Updates readExistingConfig() to read from ~/.config/pai/ for updates
- No duplication, no sync issues

Fixes danielmiessler#336

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nmitch17
nmitch17 force-pushed the fix/env-file-location branch from a367507 to 8c164e6 Compare January 7, 2026 19:44
@danielmiessler

Copy link
Copy Markdown
Owner

Thank you @nmitch17 for identifying this .env location issue! 🙏

PAI v2.1 just dropped with a major restructure including a new settings.json.template approach and improved environment handling. Your issue report (#336) and this PR helped highlight the configuration pain points we needed to address.

The installer paths have changed significantly (Bundles/Kai/Bundles/Official/), so this PR can't merge as-is. But your contribution helped drive the improvements!

See the release: https://github.com/danielmiessler/PAI/releases/tag/v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installer writes .env to ~/.claude/ but PAI looks in ~/.config/pai/

2 participants