Hooks let you inject custom scripts at key workflow moments to validate operations, monitor usage, and shape AI decisions. Currently supported on macOS and Linux.
06 Nov 2025 — 2 min read

Cline v3.36 ships with Hooks, a system for injecting custom logic into the AI workflow at critical decision points.
How Hooks work
Hooks are executable scripts that trigger at specific workflow events. Place them in `~/Documents/Cline/Rules/Hook…
Hooks let you inject custom scripts at key workflow moments to validate operations, monitor usage, and shape AI decisions. Currently supported on macOS and Linux.
06 Nov 2025 — 2 min read

Cline v3.36 ships with Hooks, a system for injecting custom logic into the AI workflow at critical decision points.
How Hooks work
Hooks are executable scripts that trigger at specific workflow events. Place them in ~/Documents/Cline/Rules/Hooks/ for global use or .clinerules/hooks/ for project-specific logic. Name your script file exactly matching the hook type (no extension) and make it executable.
Each hook receives JSON via stdin containing operation context. Your script processes this data and returns JSON controlling whether to proceed:
#!/usr/bin/env bash
input=$(cat)
# Validate operation
if [[ conditions ]]; then
echo '{"cancel": true, "errorMessage": "Invalid operation"}'
else
echo '{"cancel": false, "contextModification": "WORKSPACE_RULES: Use TypeScript"}'
fi
The cancel field blocks or allows execution. The contextModification field injects text into the conversation, affecting future AI decisions. When PreToolUse runs, the AI has already decided its action; your hook validates it. Context modifications shape the next API request, not the current one.
Visual blocks appear in the UI for each hook execution, showing real-time output with expand/collapse functionality. Users can cancel mid-execution, turning the hook indicator red. Resume functionality maintains hook state across interruptions.
Six hook types
- PreToolUse validates operations before execution. Block problematic operations like creating
.jsfiles in TypeScript projects. Receives tool name and parameters. - PostToolUse learns from completed actions. Track performance metrics from execution results. Receives tool name, parameters, execution results, and timing data.
- UserPromptSubmit processes user messages. Inject context based on prompts or validate inputs. Receives prompt text and attachments.
- TaskStart initializes tracking and detects project types. Inject initial context that shapes how Cline approaches work. Receives task metadata including task ID and initial task description.
- TaskResume restores state after interruptions. Refresh context and log resumption. Receives task metadata and previous state information.
- TaskCancel handles cleanup when work stops. Log cancellation details and notify external systems. Receives task metadata and completion status.
Each hook receives base fields (clineVersion, hookName, timestamp, taskId, workspaceRoots, userId) plus specific data for its type.
Get started
Enable hooks in Cline settings under Features. Create your first hook:
mkdir -p .clinerules/hooks
echo '#!/usr/bin/env bash
input=$(cat)
echo "$input" | jq .
echo "{\"cancel\": false}"' > .clinerules/hooks/TaskStart
chmod +x .clinerules/hooks/TaskStart
Hooks are currently supported on macOS and Linux only. Windows support is not available.
In this release, we also have
-
Refinements to the GLM-4.6 system prompt
-
Bug fixes:
-
Added support for
<think>(instead of<thinking>) tags, preferred by some open-source models -
CLI improvements to auth & providers
-
Fixed an issue with the OpenAI Compatible provider