Skip to content

Hooks & Event Automation

Automate your AI coding workflow with 10 event hooks. Run shell scripts or HTTP calls on SessionStart, PreToolUse, PostToolUse and more. GDPR-compliant.

11 Event Types

SessionStart/End, Pre/PostToolUse, and more, hook precisely into the lifecycle.

🖥️

Command Hooks

Attach shell commands to events, lint, test, notify.

🌐

HTTP Hooks

Webhooks to internal or external services, CI, ChatOps, monitoring.

🔌

Plugin Hooks

Plugins react to the same events, extend without patching core.

Hook Validation

Validate configuration before it goes live, fewer surprises in production.

📋

Hook Templates (/create-hook)

Quick start with `/create-hook`, boilerplate for common automation.

The 10 Hook Events

Every significant moment in the agent lifecycle has a corresponding hook event. Subscribe to one or many.

Event When Use Case
SessionStartSession opensCheck environment, load secrets, notify team
SessionEndSession closesSummarize work, post summary to Slack
PreToolUseBefore any tool callLogging, rate limiting, input validation
PostToolUseAfter successful tool callAudit trail, metrics, test runner
PostToolUseFailureAfter failed tool callAlert, fallback, error reporting
UserPromptSubmitUser sends a messageInput filtering, profanity guard
SubagentStartSubagent spawnedResource tracking, cost monitoring
StopAgent stopsCleanup, git commit, deploy trigger
PreCompactBefore context compactionSave important context to file
NotificationAgent sends notificationRoute to preferred channel

Create a Hook

Use /create-hook to scaffold a hook file. The AI generates the boilerplate for Shell or TypeScript hooks.

/create-hook PreToolUse my-loggerShell hook — runs before every tool call
/create-hook PostToolUse audit --tsTypeScript hook — after every tool call
/create-hook SessionEnd notifyHook runs when the session ends

Example: Audit-Log Hook

Log every tool call to a file — useful for compliance, debugging, and tracking AI actions.

.lurus/hooks/pre-tool-use.sh
#!/bin/bash
# .lurus/hooks/pre-tool-use.sh
# Logs every tool call with timestamp

echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ') [TOOL] $TOOL_NAME $TOOL_INPUT" >> .lurus/audit.log

Ready to code smarter?

Join the waitlist and automate Lurus Code with hooks and events.

Get started