knowledge-extension-ecosystem-hooks-and-behavior-interception

knowledge-extension-ecosystem-hooks-and-behavior-interception is a skill for Claude Code from echoVic/blade-code. It costs 147 tokens per session (3,013 once invoked), scanned A, original, MIT.

A codebase guide to hooks, which run around agent, tool, permission, session, and notification events to inspect or change behavior.

In plain words
What is it for?
Use it when changing hook events or outputs, debugging hooks that do not run or block unexpectedly, or adjusting trust and execution rules.
Why use it?
It helps developers understand why a hook ran, was blocked, changed an input, or produced a particular result.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: mentions subagents.

Good fit Use it when changing hook events or outputs, debugging hooks that do not run or block unexpectedly, or adjusting trust and execution rules.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/echovic/blade-code/hooks-and-behavior-interception
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add echoVic/blade-code --skill hooks-and-behavior-interception
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for knowledge-extension-ecosystem-hooks-and-behavior-interception

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/hooks-and-behavior-interception/github.svg)](https://agentmods.dev/skills/echovic/blade-code/hooks-and-behavior-interception)
Your own site
<a href="https://agentmods.dev/skills/echovic/blade-code/hooks-and-behavior-interception"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/hooks-and-behavior-interception/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for knowledge-extension-ecosystem-hooks-and-behavior-interception

Your own site · 80×15
<a href="https://agentmods.dev/skills/echovic/blade-code/hooks-and-behavior-interception"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/hooks-and-behavior-interception.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 147 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,013 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00147 $0.03013
Opus 5.5 $0.00059 $0.01205
Sonnet 5.5 $0.00029 $0.00603
Haiku 4.5 $0.00015 $0.00301

Measured 1mo ago against content hash 3cc190f20ab0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

knowledge-extension-ecosystem-hooks-and-behavior-interception scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.trae/knowledges/extension-ecosystem/hooks-and-behavior-interception/SKILL.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Module Structure

Hooks 不是独立业务流程,而是在工具、权限、会话、Agent 控制流、上下文压缩和 MCP 交互处改变后续行为的横切分支;HookManager 绑定 Session 配置,HookExecutor 执行 Command、Prompt、Function 或 HTTP 后端并归并事件特定结果。

Directory Layout

  • packages/cli/src/hooks/ — 配置、管理、匹配、执行、输出校验、信任与安全后端
  • packages/cli/src/tools/execution/ToolExecutionHooks.ts — 工具执行管线的 Pre/Post 适配
  • packages/cli/src/server/routes/hooks.ts — Web Session 开关与 trust/revoke API
  • packages/cli/src/slash-commands/hooks.ts — TUI/ACP Hook 管理命令
  • packages/cli/src/ui/components/HooksManager.tsx — TUI 配置与信任界面
  • packages/cli/web/src/components/settings/HookTrustPanel.tsx — Web 信任审阅界面

Key Entry Points

  • HookManager.bindSessionConfig() in packages/cli/src/hooks/HookManager.ts — 冻结并关联 source/worktree 的 Session 配置
  • HookManager.executePreToolHooks() in packages/cli/src/hooks/HookManager.ts — 工具前置决策与输入改写
  • HookExecutor.executeHook() in packages/cli/src/hooks/HookExecutor.ts — trust gate 与后端分派
  • runPreToolUseHooks() in packages/cli/src/tools/execution/ToolExecutionHooks.ts — 将 Hook 决策合并回工具准入
  • HookTrustService.getStatus() in packages/cli/src/hooks/HookTrustService.ts — 校验当前外部 Hook 摘要

Branching Table

分支维度 分支条件 实际行为
配置与宿主开关 config disabled、进程禁用或 Session 暂停 所有事件返回各自的 pass-through 默认值,不调用 executor
Hook 类型信任 Function Hook 不进入 Hook Trust 摘要,可作为进程内宿主策略直接执行
Hook 类型信任 Command、Prompt、HTTP Hook 仅 trusted 摘要执行;untrusted、modified、error 均跳过并给 warning
工具权限模式 Plan 的 PreToolUse/PostToolUse 直接跳过这两个工具 Hook;其他生命周期事件不因 Plan 自动跳过
工具权限模式 YOLO 的 PreToolUse 保留 deny 和输入修改,把 ask 收敛为 allow
执行顺序 PreToolUse / PermissionRequest / Stop / Compaction 串行执行,可短路或累积前序结果
执行顺序 PostToolUse / PostToolUseFailure / SessionEnd 受 maxConcurrentHooks 限制并行执行,再按配置顺序归并结果
HTTP 目标 默认策略与 allowedHosts 命中 默认要求 HTTPS 且拒绝 loopback/私网/link-local;allowlist 命中会绕过这些限制
失败或超时 behavior=ignore / ask / deny 分别继续并警告、返回确认分支、或立即产生阻塞结果

Affected Scope

  • packages/cli/src/tools/execution/ — 工具规则、输入重建、审批、成功/失败结果与后续诊断
  • packages/cli/src/agent/runtime/SessionRuntime.ts — SessionStart 环境、配置快照、worktree 别名与 dispose 清理
  • packages/cli/src/agent/loop/completionPolicy.ts — 主 Agent Stop Hook 的继续/停止决策
  • packages/cli/src/tools/builtin/task/task.ts — SubagentStop 后续提示与再次执行
  • packages/cli/src/context/CompactionService.ts — 手动/自动压缩前的阻断分支
  • packages/cli/src/mcp/McpClient.ts — Elicitation 展示前和响应回传前的改写或取消
  • packages/cli/src/services/GracefulShutdown.ts — 进程退出时触发 SessionEnd
  • packages/cli/src/plugins/PluginIntegrator.ts — 插件 Hooks 的整批合并、来源标记与刷新恢复
  • packages/cli/src/ui/ — 用户提示提交、Session 级启停与 TUI 信任审阅
  • packages/cli/web/src/components/settings/HookTrustPanel.tsx — Web 摘要审阅和 Session 开关

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 98 lines · 147 tokens per session scan A 3cc190f20ab0

Subscribe to this mod's changes

knowledge-extension-ecosystem-hooks-and-behavior-interception is a skill published in the GitHub repository echoVic/blade-code (181 stars, last pushed 3d ago), licensed MIT. It adds 147 tokens to every session and 3,013 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

clinical-reports

Write comprehensive clinical reports including case reports (CARE guidelines), diagnostic reports (radiology/pathology/lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation (SOAP, H&P, discharge summaries). Full support with templates, regulatory compliance (HIPAA, FDA, ICH-GCP), and validation…

synthetic-sciences/openscience · 71 tokens

clinical-decision-support

Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading…

synthetic-sciences/openscience · 97 tokens

gget

Fast CLI/Python queries to 20+ bioinformatics databases. Use for quick lookups: gene info, BLAST searches, AlphaFold structures, enrichment analysis. Best for interactive exploration, simple queries. For batch processing or advanced BLAST use biopython; for multi-database Python workflows use bioservices.

synthetic-sciences/openscience · 66 tokens

immunology-assays

Computational analysis of immunology experimental data. ATAC-seq differential accessibility, immune cell tracking from microscopy, ELISA data processing with 4-parameter logistic fitting, immunohistochemistry quantification, antibody titer analysis, and cell cycle phase duration estimation. For flow cytometry use…

synthetic-sciences/openscience · 79 tokens

molecular-cloning

Molecular cloning simulation and design. PCR amplicon prediction, restriction enzyme digestion, Golden Gate and Gibson assembly simulation, primer design, CRISPR sgRNA design, and plasmid annotation. For protein-level sequence analysis use biopython or esm; for database lookups use gene-database or ensembl-database.

synthetic-sciences/openscience · 70 tokens

geo-database

Access NCBI GEO for gene expression/genomics data. Search/download microarray and RNA-seq datasets (GSE, GSM, GPL), retrieve SOFT/Matrix files, for transcriptomics and expression analysis.

synthetic-sciences/openscience · 47 tokens