Reinventing.AI
Claude Code agent harness guide covering hooks and plugins
GuideUpdated 2026-09-0610 min

Claude Code Guide: Hooks, Plugins, and Running Claude Code as an Agent Harness

A professional guide to Claude Code as an agent operations harness: what it runs, how hooks and the new function hook plugins give operators deterministic control, and what changes when the work happens in the desktop app.

What Claude Code is as a harness

A harness is the runtime around a model: where it runs, what it can touch, how work is scheduled, and how an operator stays in control. Claude Code runs in a terminal or in the Code tab of Claude Desktop, reads and writes real files, runs real commands, schedules recurring work, and defined the skill format that most other harnesses now read.

That combination is why it is the reference harness for operator kits published today, and why the controls it exposes matter more than any single feature. An operator who understands hooks, plugins, and permission modes can run Claude Code on real work with confidence rather than hope.

  • Runs locally with direct file and shell access
  • Scheduled tasks and routines for recurring work
  • Permission modes from manual approval to auto mode
  • Skills, subagents, and plugins as the extension points
  • Hooks as the deterministic control layer

Hooks are the control layer

A rule in CLAUDE.md is advice the model can forget as a session grows. A hook is code that Claude Code runs at a fixed point in its lifecycle: before a tool call, after an edit, when a prompt is submitted, when a turn ends. Anthropic's documentation calls this deterministic control, and it is the difference between asking an agent to behave and making it.

Classic hooks are a block of JSON in a settings file that runs a shell command, an HTTP request, or a model prompt. A PreToolUse hook that returns a deny decision blocks a tool even in bypass permissions mode, which is what makes hooks a policy layer rather than a suggestion. The complete hooks guide linked below goes from a first hook in the desktop app to seven copy and paste examples.

  • Block destructive commands before they run
  • Format files after every edit
  • Re-inject project rules after compaction
  • Keep the agent working until tests pass
  • Audit every configuration change

Function hooks turn Claude Code into a platform

In September 2026 an Anthropic engineer published a proposal for function hooks: a TypeScript module inside a plugin that wraps the engine's own behaviour in the style of Express middleware. A function hook can rewrite a prompt, answer a tool call from a cache, draw a status row in the interface, ask the user a question, register new tools, call a model, and remember state, none of which a shell hook can do.

A preview runtime ships in Claude Code 2.1.260 and later behind an environment variable, and a built-in skill, plugin-authoring, writes plugins from a description once the flag is on. The showcase example is a secret redactor that keeps pasted API keys out of the session transcript while the session can still use them. The guides below cover enabling the preview in the desktop app, building the redactor with one prompt, and what the skill unlocks.

How to start

Start with one classic hook that solves a problem already felt, usually a guard on destructive commands or a formatter after edits. Add a Stop hook once the first one is trusted. Then turn on the function hooks preview in a local session, run the secret redactor prompt, and read what the skill produces.

Keep hard policy in classic hooks until function hooks ship, treat the preview API as something that will change, and read the debug log when a plugin seems to do nothing. The harness comparison page on this site shows where Claude Code sits next to OpenClaw, Codex, Hermes and the rest when the work needs more than one runtime.

  • One guard hook first, then a Stop hook
  • Enable the preview in a local desktop session
  • Build the redactor from a prompt and read the result
  • Validate, reload, and check the debug log

Best articles to read next

AI Trends2026-05-26

OpenClaw vs Hermes vs Claude Code: The State of AI Agent Harnesses in May 2026

Fresh May 2026 comparison of OpenClaw, Hermes, and Claude Code, based only on the last two weeks of releases, plus runner-up analysis for Codex and Gemini CLI.

AI Trends2026-06-22

AI Agents Are Starting to Ship as Operator Harnesses for Small-Team Workflows

Recent launches from Mastra, GitHub, n8n, LlamaIndex, and Anthropic show a practical June 2026 shift: useful AI agents are increasingly delivered as operator harnesses with approvals, reusable files, local tools, and reviewable workflow steps.

AI Trends2026-06-23

OpenClaw Trends: Session Logs, Hooks, and Workflow Files Are Becoming the Daily Operator Stack

Recent updates from OpenAI, GitHub, Google, and Anthropic point to a practical June 2026 shift: useful agent workflows for operators are being packaged into reusable files, session history, hooks, and reviewable task loops rather than one-off chats.

AI Trends2026-04-14

AI Coding Workflows for Solo Developers: Practical Patterns from 2026

How independent developers and small teams are building structured AI-augmented workflows that boost productivity without sacrificing code quality or engineering judgment.

AI Trends2026-07-08

AI Agents Are Moving Into Approval-Based SMB Automations

Recent releases from OpenAI and GitHub, paired with operator guidance from Anthropic and small-business adoption data from QuickBooks, point to a practical 2026 trend: teams are turning repeatable work into approval-based AI automations with scheduled triggers, narrow tools, and reviewable outputs.

Frequently asked questions

Is Claude Code an agent harness or a coding tool?

Both. It started as a coding agent, but it runs locally, schedules recurring work, exposes hooks and plugins, and defined the portable skill format, which is what makes it a harness that operators use for far more than code.

Do hooks work in the Claude Code desktop app?

Yes. The desktop app's Code tab and the CLI read the same settings files, so hooks defined there run in both. Terminal-dialog commands such as /permissions are not available in the Code tab, so hooks are added by editing the settings file or by asking Claude to write them.

Are function hooks safe to rely on today?

They are a preview behind an environment variable, proposed in September 2026 and not yet shipped. A hook that fails is skipped silently and the API can change between releases. Keep hard policy in classic hooks and treat function hook plugins as something to read and test.

Where should a first-time operator start?

With one classic hook that blocks destructive commands, then a Stop hook, then the function hooks preview once those two are trusted. The complete hooks guide on this site walks that order.

Agent Ops Club by Reinventing.AI

Reading about AI agents is step one.Running them for your business is the Club.

8 open source AI Employees, the 45 lesson Agent Ops Masterclass, and 22 premium systems you can customize, deploy for clients, and charge for under a resale license.

Get Lifetime for $499See what is inside →

Pro is $99 a month or $349 a year. Lifetime is $499 until October 31, then $999.