This repository was archived by the owner on May 24, 2026. It is now read-only.
Description Summary
The SDK provides 6 hook types that allow customizing session behavior at key lifecycle points. PolyPilot does not use any of them.
SDK Hooks
Hook
Input
Output
Purpose
OnPreToolUse
ToolName, ToolArgs, Cwd
PermissionDecision, ModifiedArgs, AdditionalContext
Block/modify tool calls before execution
OnPostToolUse
ToolName, ToolArgs, ToolResult
ModifiedResult, AdditionalContext
Filter/transform tool output after execution
OnUserPromptSubmitted
Prompt, Cwd
ModifiedPrompt, AdditionalContext
Rewrite prompts, inject context
OnSessionStart
Cwd, Source, InitialPrompt
AdditionalContext, ModifiedConfig
Custom initialization
OnSessionEnd
Reason, FinalMessage, Error
CleanupActions, SessionSummary
Custom cleanup
OnErrorOccurred
Error, ErrorContext, Recoverable
ErrorHandling, RetryCount
Custom error recovery
Hook Events
HookStartEvent — hook invocation began (includes HookType, Input)
HookEndEvent — hook invocation completed (includes Output, Success, Error)
Proposed Implementation
Hook configuration UI per session or per group (multi-agent preset)
PreToolUse : Configurable tool approval policies (e.g., "always block rm -rf", "require approval for write operations")
PostToolUse : Output filtering (e.g., redact secrets, collapse verbose output)
UserPromptSubmitted : Auto-inject context like repo conventions, current task, or team decisions
Hook activity log : Show when hooks fire and what they modified (via HookStart/HookEnd events)
Value
Power-user feature for customizing agent behavior. Enterprise users especially want tool approval policies and output filtering.
Priority: 🔴 HIGH Reactions are currently unavailable
Summary
The SDK provides 6 hook types that allow customizing session behavior at key lifecycle points. PolyPilot does not use any of them.
SDK Hooks
ToolName,ToolArgs,CwdPermissionDecision,ModifiedArgs,AdditionalContextToolName,ToolArgs,ToolResultModifiedResult,AdditionalContextPrompt,CwdModifiedPrompt,AdditionalContextCwd,Source,InitialPromptAdditionalContext,ModifiedConfigReason,FinalMessage,ErrorCleanupActions,SessionSummaryError,ErrorContext,RecoverableErrorHandling,RetryCountHook Events
HookStartEvent— hook invocation began (includesHookType,Input)HookEndEvent— hook invocation completed (includesOutput,Success,Error)Proposed Implementation
rm -rf", "require approval for write operations")Value
Power-user feature for customizing agent behavior. Enterprise users especially want tool approval policies and output filtering.
Priority: 🔴 HIGH