Lifecycle Hooks Plugin (SuperPi.Extension behaviour).
Implements lifecycle hook interception for workspace sessions:
- Discovers and merges
hooks.jsonfiles across workspace.agents/hooks.jsonand global config directories, respecting"enabled": false. SessionStart(before_agent_start/2): Runs startup hooks once and injectssystemMessagesteps.PreInvocation(before_request/2): Runs before model invocation and injects transientephemeralMessageoruserMessagesteps intoderived.messagesfor that turn.PreToolUse(before_tool/3): Matches tool names againstmatcher("*","", or regex), sends camelCase JSON payload onstdin, and parsesstdoutJSON (decision: "allow" | "deny" | "ask" | "force_ask"and shallow top-leveloverwritemap).PostToolUse(after_tool/4): Runs matching post-tool commands witherrormetadata when a tool fails.PostInvocation(after_tools/2): SupportsterminationBehavior: "force_continue".Stop(after_run/2): SendsterminationReason: "NO_TOOL_CALL"and honorsdecision: "continue"+reason.