From 4c40c3adb1026cf822c257f49cea3c93bdd21559 Mon Sep 17 00:00:00 2001 From: khduy Date: Sat, 31 Jan 2026 01:30:28 +0700 Subject: [PATCH] fix(claude-code-hooks): deduplicate settings paths to prevent double hook execution When cwd equals home directory, ~/.claude/settings.json was being loaded twice (once as home config and once as cwd config), causing hooks like Stop to execute twice. This adds deduplication using Set to ensure each config file is only loaded once. --- src/hooks/claude-code-hooks/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/claude-code-hooks/config.ts b/src/hooks/claude-code-hooks/config.ts index b155c4810..60f9bc27a 100644 --- a/src/hooks/claude-code-hooks/config.ts +++ b/src/hooks/claude-code-hooks/config.ts @@ -55,7 +55,9 @@ export function getClaudeSettingsPaths(customPath?: string): string[] { paths.unshift(customPath) } - return paths + // Deduplicate paths to prevent loading the same file multiple times + // (e.g., when cwd is the home directory) + return [...new Set(paths)] } function mergeHooksConfig(