fix(hooks): use getPaiDir() instead of hardcoded ~/.claude paths#1039
Open
MarvinDontPanic wants to merge 1 commit intodanielmiessler:mainfrom
Open
fix(hooks): use getPaiDir() instead of hardcoded ~/.claude paths#1039MarvinDontPanic wants to merge 1 commit intodanielmiessler:mainfrom
MarvinDontPanic wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
Replace hardcoded join(HOME, '.claude') fallbacks with getPaiDir() from hooks/lib/paths.ts in 4 hooks: LastResponseCache, RatingCapture, SessionCleanup, WorkCompletionLearning. This enables PAI_DIR portability — users can set PAI_DIR to install PAI outside ~/.claude/ (e.g. to work around Claude Code v2.1.78+ sensitive directory protection). Complements existing getPaiDir() usage in SecurityValidator, SessionAutoName, RelationshipMemory, KittyEnvPersist, LoadContext. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces hardcoded
join(HOME, '.claude')fallbacks withgetPaiDir()fromhooks/lib/paths.tsin 4 hooks:getPaiDir()BASE_DIRviagetPaiDir()BASE_DIRviagetPaiDir()BASE_DIRviagetPaiDir()Motivation
Claude Code v2.1.78+ hardened
~/.claude/as a protected directory, blocking writes even with--dangerously-skip-permissions. Users who setPAI_DIRto install PAI outside~/.claude/need hooks to respect that variable.getPaiDir()already exists inhooks/lib/paths.tsand is used by SecurityValidator, SessionAutoName, RelationshipMemory, KittyEnvPersist, and LoadContext. This completes the migration for the remaining 4 hooks.Related: #992, #873, #994
Backward Compatible
Yes —
getPaiDir()falls back to~/.claudewhenPAI_DIRis not set.Test plan
PAI_DIR=~/.claudePAI_DIR=~/pai🤖 Generated with Claude Code