[KongchangAI]
ConceptHooks机制 / 事件触发机制

Hooks

Hooks are an event-driven automation mechanism that executes predefined operations or workflows automatically in response to specific trigger events, such as file saves or code commits. Core characteristics include deep integration with the development workflow, support for custom trigger conditions and response actions, and the ability to complete tasks such as testing, formatting, and building without manual intervention. Hooks are widely used in development tools and IDEs to increase automation and development efficiency.

Core Facts

Timeline (last 90 days)

Nov 27

Factory Droid's Hooks allow custom actions to be triggered at specific points in the Droid execution flow, with their own storage locations and purposes.

Unverified50%
Nov 12

In Claude Code, CLAUDE.md manages persistent background, Skills manage reusable workflows, Hooks manage mandatory checkpoints, and MCP manages external data access.

Unverified50%
Nov 10

X-Helix's Hooks mechanism is used to define at which nodes reviews are triggered and which steps require manual review.

Unverified50%
Nov 9

Hooks scripts run with local permissions, so hardcoding sensitive credentials in them should be avoided.

Unverified50%
Nov 8

Skills in Claude Code are reusable instruction packages, Subagents are sub-agents with independent context windows, and Hooks are check scripts that trigger automatically on specific events (such as before or after tool calls).

Unverified50%
Nov 4

The content covered by Claude Code Quest includes basic command-line operations as well as advanced features such as Skills, Hooks, Subagents, and MCP.

Unverified50%
Nov 4

Hooks are a hook mechanism that automatically triggers scripts at key points of tool calls, used for validation, interception, or logging.

Unverified50%
Nov 4

The Hooks mechanism in Claude Code plugins allows a plugin to automatically execute preset programs when specific events are triggered, with file and network access permissions equal to those of the user account.

Unverified50%
Nov 3

Hooks are Shell commands bound to session lifecycle events (such as before and after tool calls, and at session end), enforced by the Claude Code runtime without relying on model decisions, making them suitable for deterministic quality gates.

Unverified50%
Nov 1

Claude Code can automatically leave traces on Trace Canvas through the Hooks mechanism, recording the session process.

Unverified50%

34 more timeline events

All Facts (20)

Verified

Hooks are an event-driven automated trigger mechanism that automatically triggers preset subsequent actions when a specific operation is completed.

65%
Verified

Hooks adopt a lazy-loading design, loading into the context only when triggered and not occupying context space at other times.

65%
Verified

Gemini CLI's secret-scanning hook can automatically intercept file write operations that contain hardcoded API keys.

65%
Unverified

Plugin将Skills、Hooks和MCP配置打包成单个可安装包,新工程师安装后可立即拥有与资深同事相同的上下文和能力

90%
Unverified

The Hooks stop hook can reflect on what happened at the end of a session and suggest CLAUDE.md updates, while the start hook can dynamically load team-specific context.

90%
Unverified

Kiro提供Hooks开发钩子机制,将Git Hooks和CI/CD流水线的自动化能力与AI能力结合,在本地开发阶段触发

90%
Unverified

Claude Code的Hooks机制是确定性的,每次都会执行,而Claude.md中的提示词指令是概率性的,可能被遗漏

85%
Unverified

Hooks和Skills的核心区别在于:Skill是模型主动调用的拉模式(Pull),Hook是外部系统被动触发的推模式(Push)

85%
Unverified

Claude Code的Hooks机制包括停止钩子(会话结束时自动提议更新CLAUDE.md)和启动钩子(自动加载最新上下文信息)

85%
Unverified

Claude Code's Hooks system provides 29 event hooks, drawing on the event-driven architectural design of Git Hooks.

80%
Unverified

Claude Code's Hooks mechanism is a hard constraint that AI cannot bypass at all; it can set mandatory checkpoints in the AI action chain to prevent unauthorized operations caused by model hallucinations or misjudgments.

80%
Unverified

Using code hooks for hard interception is more reliable than placing safety rules in prompts and relying on the model to self-enforce them, because the model can be bypassed or produce hallucinations.

60%
Unverified

Claude Code's Hooks allow events in the agent loop to be intercepted and bash commands or scripts to be executed upon triggering, configured in settings.json under the .claude/hooks directory.

60%
Unverified

The pre-tool hook is triggered immediately before the tool function body executes.

60%
Unverified

Making good use of Hooks can reduce a large amount of unnecessary rework, improving development efficiency by at least double.

60%
Unverified

Hooks are programmatic hard constraints enforced through an event-driven mechanism that does not rely on the model's self-discipline, making them more reliable than the soft constraint approach of CLAUDE.md.

60%
Unverified

In Claude Code Hooks, exit code 0 means pass-through, exit code 2 means hard block (the AI will not retry), and other non-zero exit codes mean soft warnings.

60%
Unverified

Claude Code's tool harness is built around five extension points: CLAUDE.md files, Hooks, Skills, Plugins, and LSP integration with MCP servers.

60%
Unverified

Kiro的两大核心功能是Specs(规范)和Hooks(开发钩子)

60%
Unverified

Gemini CLI's hook mechanism can intercept AI-generated content before it is written to disk, which constitutes a Shift-Left Security practice.

60%

Source Articles