diff --git a/src/hooks/claude-code-hooks/handlers/tool-execute-after-handler.ts b/src/hooks/claude-code-hooks/handlers/tool-execute-after-handler.ts index c9adf45e8..fa37ea8b7 100644 --- a/src/hooks/claude-code-hooks/handlers/tool-execute-after-handler.ts +++ b/src/hooks/claude-code-hooks/handlers/tool-execute-after-handler.ts @@ -79,8 +79,6 @@ export function createToolExecuteAfterHandler(ctx: PluginInput, config: PluginCo return } - const claudeConfig = await loadClaudeHooksConfig() - const extendedConfig = await loadPluginExtendedConfig() const cachedInput = getToolInput(input.sessionID, input.tool, input.callID) || {} @@ -96,6 +94,9 @@ export function createToolExecuteAfterHandler(ctx: PluginInput, config: PluginCo return } + const claudeConfig = await loadClaudeHooksConfig() + const extendedConfig = await loadPluginExtendedConfig() + const postClient: PostToolUseClient = { session: { messages: (opts) => ctx.client.session.messages(opts), diff --git a/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts b/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts index 164c52682..412cc2c23 100644 --- a/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts +++ b/src/hooks/claude-code-hooks/handlers/tool-execute-before-handler.ts @@ -43,8 +43,6 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC log("todowrite: parsed todos string to array", { sessionID: input.sessionID }) } - const claudeConfig = await loadClaudeHooksConfig() - const extendedConfig = await loadPluginExtendedConfig() appendTranscriptEntry(input.sessionID, { type: "tool_use", @@ -59,6 +57,9 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC return } + const claudeConfig = await loadClaudeHooksConfig() + const extendedConfig = await loadPluginExtendedConfig() + const preCtx: PreToolUseContext = { sessionId: input.sessionID, toolName: input.tool,