From de48aeb02ae85e3017097fc70c36618e367cffd2 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 18 Mar 2026 22:18:38 -0700 Subject: [PATCH] Replace PostToolUseFailure hook with PreToolUse for activity tracking PostToolUseFailure incorrectly marked the session idle on transient tool errors. PreToolUse keeps the active signal fresh throughout tool execution, while Stop alone handles the transition to idle. --- src/vm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vm.ts b/src/vm.ts index d237faa..f8ff501 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -204,8 +204,8 @@ async function configureEnvironment(home: string, apiKey: string): Promise const activityBin = `/home/${USER}/.local/bin/sandlot-activity` const hooks = { UserPromptSubmit: [{ hooks: [{ type: "command", command: `${activityBin} active` }] }], + PreToolUse: [{ hooks: [{ type: "command", command: `${activityBin} active` }] }], Stop: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], - PostToolUseFailure: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], } const statusLine = { type: "command", command: `/home/${USER}/.local/bin/sandlot-statusline` } const settingsJson = JSON.stringify({ apiKeyHelper: "~/.claude/api-key-helper.sh", skipDangerousModePermissionPrompt: true, hooks, statusLine })