Skip to content

Commit 5a46849

Browse files
committed
feat(hooks): wire task-reminder hook into session tier and event chain
The task-reminder hook was fully implemented with tests but never registered in the hook composition system. This commit: - Adds 'task-reminder' to HookNameSchema for disabled_hooks support - Exports createTaskReminderHook from hooks barrel - Registers in create-session-hooks.ts with isHookEnabled gate - Wires tool.execute.after handler in tool-execute-after.ts - Wires event handler in event.ts for session.deleted cleanup
1 parent 36e69f8 commit 5a46849

5 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/config/schema/hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const HookNameSchema = z.enum([
5959
"fsync-skip-warning",
6060
"plan-format-validator",
6161
"legacy-plugin-toast",
62+
"task-reminder",
6263
])
6364

6465
export type HookName = z.infer<typeof HookNameSchema>

src/hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ export { createLegacyPluginToastHook } from "./legacy-plugin-toast"
6868
export { createFsyncSkipWarningHook } from "./fsync-skip-warning"
6969
export { createNotepadWriteGuardHook } from "./notepad-write-guard"
7070
export { createPlanFormatValidatorHook } from "./plan-format-validator"
71+
export { createTaskReminderHook } from "./task-reminder"

src/plugin/event.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ export function createEventHandler(args: {
332332
await runEventHookSafely("writeExistingFileGuard", hooks.writeExistingFileGuard?.event, input);
333333
await runEventHookSafely("atlasHook", hooks.atlasHook?.handler, input);
334334
await runEventHookSafely("autoSlashCommand", hooks.autoSlashCommand?.event, input);
335+
await runEventHookSafely("taskReminder", hooks.taskReminder?.event, input);
335336
};
336337

337338
const recentSyntheticIdles = new Map<string, number>();

src/plugin/hooks/create-session-hooks.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
createPreemptiveCompactionHook,
2929
createRuntimeFallbackHook,
3030
createLegacyPluginToastHook,
31+
createTaskReminderHook,
3132
} from "../../hooks"
3233
import { createAnthropicEffortHook } from "../../hooks/anthropic-effort"
3334
import {
@@ -65,6 +66,7 @@ export type SessionHooks = {
6566
anthropicEffort: ReturnType<typeof createAnthropicEffortHook> | null
6667
runtimeFallback: ReturnType<typeof createRuntimeFallbackHook> | null
6768
legacyPluginToast: ReturnType<typeof createLegacyPluginToastHook> | null
69+
taskReminder: ReturnType<typeof createTaskReminderHook> | null
6870
}
6971

7072
export function createSessionHooks(args: {
@@ -276,6 +278,10 @@ export function createSessionHooks(args: {
276278
? safeHook("legacy-plugin-toast", () => createLegacyPluginToastHook(ctx))
277279
: null
278280

281+
const taskReminder = isHookEnabled("task-reminder")
282+
? safeHook("task-reminder", () => createTaskReminderHook(ctx))
283+
: null
284+
279285
return {
280286
contextWindowMonitor,
281287
preemptiveCompaction,
@@ -301,5 +307,6 @@ export function createSessionHooks(args: {
301307
anthropicEffort,
302308
runtimeFallback,
303309
legacyPluginToast,
310+
taskReminder,
304311
}
305312
}

src/plugin/tool-execute-after.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export function createToolExecuteAfterHandler(args: {
181181
await hooks.fsyncSkipWarning?.["tool.execute.after"]?.(hookInput, output)
182182
await hooks.jsonErrorRecovery?.["tool.execute.after"]?.(hookInput, output)
183183
await hooks.planFormatValidator?.["tool.execute.after"]?.(hookInput, output)
184+
await hooks.taskReminder?.["tool.execute.after"]?.(hookInput, output)
184185
}
185186

186187
if (input.tool === "extract" || input.tool === "discard") {

0 commit comments

Comments
 (0)