Motivation
PAI_DIR currently conflates two concerns: Claude Code's config root (~/.claude) and PAI's installation root (~/.claude/PAI/). This prevents PAI from being installed independently of CC's config directory and makes PAI_DIR's name a lie — it points to the Claude home, not the PAI directory.
Goal: Use the official CLAUDE_CONFIG_DIR for CC config and make PAI_DIR user-configurable at install time, defaulting to ~/.pai.
Architecture
Env Vars After Separation (Two Variables Only)
| Variable |
Purpose |
Default |
settings.json |
CLAUDE_CONFIG_DIR |
CC config root |
~/.claude |
env.CLAUDE_CONFIG_DIR (literal absolute) |
PAI_DIR |
PAI installation root (redefined) |
~/.pai |
env.PAI_DIR (literal absolute) |
PAI_CONFIG_DIR |
XDG user preferences |
~/.config/PAI |
Unchanged |
Live-tested (2026-04-06): Setting CLAUDE_CONFIG_DIR in settings.json env makes it available to hook commands via shell expansion. It does NOT relocate CC's config directory (CC has already found settings.json by that point). No third variable needed.
What Stays vs What Moves
Stays at CLAUDE_CONFIG_DIR (~/.claude):
hooks/ — CC discovers hooks from its config dir
MEMORY/ — session state, per-project memory
settings.json, CLAUDE.md, projects/
Moves to PAI_DIR (~/.pai):
PAI/ — tools, algorithms, documentation
skills/ — skill definitions
agents/ — agent definitions
PAI-Install/ — installer engine
VoiceServer/ — voice notification server
Critical Constraint: Hook Command Paths
settings.json hook commands use ${PAI_DIR}/hooks/ (27 references). Changing PAI_DIR breaks hook discovery. Solution: Add CLAUDE_CONFIG_DIR to settings.json env; migrate hook commands from ${PAI_DIR}/hooks/ to ${CLAUDE_CONFIG_DIR}/hooks/ before changing PAI_DIR.
paths.ts Redesign
getConfigDir() → CLAUDE_CONFIG_DIR || ~/.claude
getPaiDir() → PAI_DIR || ~/.pai
configPath(...) → getConfigDir() + segments (hooks, MEMORY, settings)
codePath(...) → getPaiDir() + segments (PAI/Tools, Algorithm, docs)
paiPath(...) → DEPRECATED → configPath()
File Audit
| Category |
Files |
References |
| settings.json |
1 |
28 (1 def + 27 hook cmds) |
| Hook TS files |
15 |
~20 relative imports |
| PAI Tool scripts |
27 |
~70 path constructions |
| PAI documentation |
12 |
102 hardcoded paths |
| Installer/build |
18 |
120+ references |
| Config (CLAUDE.md etc) |
3 |
~10 references |
| Skill files |
3 |
~16 references |
| Total |
79 |
~366 |
Static Dependencies (Cannot Use Env Vars)
| Location |
Why |
settings.json env values |
CC doesn't expand shell vars — must be literal absolute paths |
settings.json additionalDirectories |
Literal paths required |
~/.claude.json |
OAuth state, ignores CLAUDE_CONFIG_DIR entirely |
Execution Plan
Pre-Migration Gate — PASSED ✅
Phase 0: Centralise Imports
Phase 1: Add CLAUDE_CONFIG_DIR + Update paths.ts
Phase 2: Copy PAI Code + Redefine PAI_DIR
Phase 3: Validate + Documentation
Phase 4: Cleanup
Rollback
At any phase: Set PAI_DIR back to ~/.claude in settings.json. Old code never left during Phases 0-3. One-line revert, under 60 seconds.
Pre-migration backup:
tar czf ~/tmp/pai-pre-migration.tar.gz ~/.claude/settings.json ~/.claude/hooks/ ~/.claude/PAI/ ~/.claude/skills/ ~/.claude/agents/ ~/.claude/CLAUDE.md
Council Report
See reports/2026-04-06-council-claude-config-dir-pai-dir-separation.md for the full 3-round debate transcript and detailed analysis.
Motivation
PAI_DIR currently conflates two concerns: Claude Code's config root (
~/.claude) and PAI's installation root (~/.claude/PAI/). This prevents PAI from being installed independently of CC's config directory and makes PAI_DIR's name a lie — it points to the Claude home, not the PAI directory.Goal: Use the official
CLAUDE_CONFIG_DIRfor CC config and makePAI_DIRuser-configurable at install time, defaulting to~/.pai.Architecture
Env Vars After Separation (Two Variables Only)
CLAUDE_CONFIG_DIR~/.claudeenv.CLAUDE_CONFIG_DIR(literal absolute)PAI_DIR~/.paienv.PAI_DIR(literal absolute)PAI_CONFIG_DIR~/.config/PAILive-tested (2026-04-06): Setting
CLAUDE_CONFIG_DIRin settings.jsonenvmakes it available to hook commands via shell expansion. It does NOT relocate CC's config directory (CC has already found settings.json by that point). No third variable needed.What Stays vs What Moves
Stays at CLAUDE_CONFIG_DIR (~/.claude):
hooks/— CC discovers hooks from its config dirMEMORY/— session state, per-project memorysettings.json,CLAUDE.md,projects/Moves to PAI_DIR (~/.pai):
PAI/— tools, algorithms, documentationskills/— skill definitionsagents/— agent definitionsPAI-Install/— installer engineVoiceServer/— voice notification serverCritical Constraint: Hook Command Paths
settings.json hook commands use
${PAI_DIR}/hooks/(27 references). Changing PAI_DIR breaks hook discovery. Solution: AddCLAUDE_CONFIG_DIRto settings.json env; migrate hook commands from${PAI_DIR}/hooks/to${CLAUDE_CONFIG_DIR}/hooks/before changing PAI_DIR.paths.ts Redesign
File Audit
Static Dependencies (Cannot Use Env Vars)
settings.jsonenv valuessettings.jsonadditionalDirectories~/.claude.jsonExecution Plan
Pre-Migration Gate — PASSED ✅
CLAUDE_CONFIG_DIRto settings.json env, change one hook command to use it, verify it firesPhase 0: Centralise Imports
../PAI/Tools/imports to usepaths.tsresolversPhase 1: Add CLAUDE_CONFIG_DIR + Update paths.ts
CLAUDE_CONFIG_DIRto settings.json envgetConfigDir(),configPath(),codePath()to paths.ts${PAI_DIR}/hooks/to${CLAUDE_CONFIG_DIR}/hooks/Phase 2: Copy PAI Code + Redefine PAI_DIR
Phase 3: Validate + Documentation
Phase 4: Cleanup
Rollback
At any phase: Set
PAI_DIRback to~/.claudein settings.json. Old code never left during Phases 0-3. One-line revert, under 60 seconds.Pre-migration backup:
Council Report
See
reports/2026-04-06-council-claude-config-dir-pai-dir-separation.mdfor the full 3-round debate transcript and detailed analysis.