Cline v3.36: Hooks Let You Inject Custom Logic

Cline v3.36 ships with Hooks, executable scripts that intercept AI workflow at critical points. Validate operations, inject context, track metrics, and control task lifecycle.

Cline v3.36: Hooks Let You Inject Custom Logic

TL;DR

  • Cline v3.36 adds Hooks — executable scripts that intercept and modify AI workflow at critical points
  • Six hook types let you validate operations, track metrics, inject context, and handle task lifecycle events
  • Place scripts in ~/Documents/Cline/Rules/Hooks/ or .clinerules/hooks/; macOS and Linux only for now

What Dropped

Cline v3.36 introduces Hooks, a system for injecting custom logic into the AI workflow. Scripts trigger at specific events, receive JSON context via stdin, and return JSON to block operations or modify the conversation context. Think of them as middleware for your AI coding assistant.

The Dev Angle

Hooks give you fine-grained control over what Cline does and how it reasons. Six hook types cover the full task lifecycle:

  • PreToolUse — Validate operations before execution. Block Cline from creating .js files in a TypeScript project, for example.
  • PostToolUse — Learn from completed actions. Track performance metrics, log execution results, measure timing.
  • UserPromptSubmit — Process incoming prompts. Inject context based on what the user asks or validate inputs before Cline sees them.
  • TaskStart — Initialize tracking and detect project types. Inject initial context that shapes Cline's entire approach to the work.
  • TaskResume — Restore state after interruptions. Refresh context and log when work resumes.
  • TaskCancel — Handle cleanup when work stops. Notify external systems or log cancellation details.

Each hook receives base metadata (Cline version, timestamp, task ID, workspace roots, user ID) plus type-specific data. Your script processes the JSON and returns either {"cancel": true} to block execution or {"contextModification": "..."} to inject text into the conversation, shaping the next API request.

The UI shows visual blocks for each hook execution with real-time output, expand/collapse controls, and the ability to cancel mid-run. Hook state persists across interruptions, so resuming a task restores the hook context.

Should You Care?

If you're building internal tooling around Cline or need guardrails on what the AI can do, Hooks are essential. Teams can enforce project-specific rules (no certain file types, required patterns, mandatory context) without modifying Cline's core behavior. If you're a solo developer using Cline out of the box, you probably don't need this yet — but it's there when your workflow gets complex.

One caveat: Hooks are macOS and Linux only. Windows support isn't available yet.

The v3.36 release also adds Moonshot's kimi-k2-thinking model, support for <think> tags for better compatibility with open-source models, and refinements to the GLM-4.6 system prompt.

Source: Cline