From fa45ea43ce108b14f4ddea94466e2fcd96a810a9 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 11 Mar 2026 21:39:27 -0700 Subject: [PATCH] Clear activity after session and on tool failure --- src/commands/new.ts | 2 ++ src/commands/open.ts | 2 ++ src/vm.ts | 1 + 3 files changed, 5 insertions(+) diff --git a/src/commands/new.ts b/src/commands/new.ts index 59f1d2c..ff60a2f 100644 --- a/src/commands/new.ts +++ b/src/commands/new.ts @@ -137,5 +137,7 @@ export async function action( await vm.claude(worktreeAbs, { prompt, print: opts.print }) } + await vm.clearActivity(worktreeAbs, branch) + if (opts.save !== false) await saveChanges(worktreeAbs, branch) } diff --git a/src/commands/open.ts b/src/commands/open.ts index fa8cb5f..81bf8e3 100644 --- a/src/commands/open.ts +++ b/src/commands/open.ts @@ -33,5 +33,7 @@ export async function action( await vm.claude(session.worktree, { prompt, print: opts.print, continue: true }) } + await vm.clearActivity(session.worktree, branch) + if (opts.save !== false) await saveChanges(session.worktree, branch) } diff --git a/src/vm.ts b/src/vm.ts index 36eaf69..8d3201c 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -155,6 +155,7 @@ async function configureEnvironment(home: string, apiKey: string): Promise const hooks = { UserPromptSubmit: [{ hooks: [{ type: "command", command: `${activityBin} active` }] }], Stop: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], + PostToolUseFailure: [{ hooks: [{ type: "command", command: `${activityBin} idle` }] }], } const settingsJson = JSON.stringify({ apiKeyHelper: "~/.claude/api-key-helper.sh", skipDangerousModePermissionPrompt: true, hooks }) const claudeJson = JSON.stringify({ hasCompletedOnboarding: true, effortCalloutDismissed: true, projects: { "/": { hasTrustDialogAccepted: true } } })