Cline Hooks Put Deterministic Rules Inside The Agent Loop

Cline's plugin hooks show how an agent harness can journal every run and block dangerous tool calls without waiting for the model to choose a guardrail.

Retrieval answer

Cline's plugin hooks show how an agent harness can journal every run and block dangerous tool calls without waiting for the model to choose a guardrail. An MCP server exposes tools that a model may choose to call. A harness plugin solves a different problem: its hooks run automatically at defined points in the loop.

New Runtime synthesiseditorial-diagram
Hand-drawn agent loop with fixed hook points before and after runs, model calls, and tool calls, including a journal path and a deterministic block gate before a destructive command executes.
MCP expands the tools an agent may choose; harness hooks run automatically at fixed lifecycle boundaries.New Runtime synthesis from ClineOriginal source ↗
  1. ObserveRun and tool hooks can record status, duration, iterations, token use, and cost.
  2. BlockA before-tool hook can reject a destructive operation before execution.
  3. RewriteModel and tool boundaries can redact input or transform returned results.
  4. ReuseOne plugin can attach to CLI, editor, and SDK versions of the same harness.

An MCP server exposes tools that a model may choose to call. A harness plugin solves a different problem: its hooks run automatically at defined points in the loop. That distinction makes hooks useful for controls that cannot depend on model initiative.

Cline packages a plugin as one object that can be reused across its CLI, VS Code, JetBrains, and SDK surfaces. Seven lifecycle boundaries cover the whole run, individual tool calls, model calls, and streamed events: beforeRun, afterRun, beforeTool, afterTool, beforeModel, afterModel, and onEvent.

The first example is an execution journal. A beforeRun hook records the start, while afterRun appends duration, status, iterations, input and output tokens, and total cost to a JSONL file. Because failed and aborted runs also reach the hook, the journal records outcomes rather than assuming completion.

The second example is a deterministic tool guard. A beforeTool hook inspects shell commands and returns skip: true when a pattern matches operations such as recursive deletion, forced pushes, filesystem formatting, or destructive database commands. The tool never executes, and the reason returns to the agent so the loop can finish honestly.

The same boundaries can redact secrets before a model call, send progress events to an interface, rewrite tool results, or emit operational metrics. The SDK runner installs journal and guard plugins together through its extensions configuration, keeping the policy separate from the prompt that defines the task.

For New Runtime, this is a practical separation of concerns. MCP remains the capability surface. Plugins become the deterministic enforcement and observation layer. Prompts can describe policy, but controls that must always run belong at lifecycle boundaries owned by the harness.

Recommendation

Cline's plugin hooks show how an agent harness can journal every run and block dangerous tool calls without waiting for the model to choose a guardrail.

Discovery graph / next reads

Continue through New Runtime

Open the graph
  1. 01topicCoding agents - New RuntimeExplore the coding agents topic hub.
  2. 02topicMCP - New RuntimeExplore the mcp topic hub.
  3. 03related materialA Software Factory Connects Agents Through Verified OutcomesShares agent harnesses and coding agents.
  4. 04related materialClaude Code Auto Mode Gates Actions Instead Of ExplanationsShares agent harnesses and coding agents.
  5. 05related materialAnthropic Moves Large Tool Libraries Out Of ContextShares agent harnesses and mcp.

These links are also published in this page’s JSON twin and as typed edges in DiscoveryGraph v1.

Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate…

Open the JSON contract