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.
npx skills add echoVic/blade-code --skill hooks-and-behavior-interceptiongit clone --depth 1 https://github.com/echoVic/blade-codeWrote 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.
[](https://agentmods.dev/skills/echovic/blade-code/hooks-and-behavior-interception)<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.
<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>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once 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 |
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.
Copies of this mod
1 near-identical copy found in the catalogue:
- knowledge-interaction-surfaces — 88% identical, 125 lines differ
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 APIpackages/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()inpackages/cli/src/hooks/HookManager.ts— 冻结并关联 source/worktree 的 Session 配置HookManager.executePreToolHooks()inpackages/cli/src/hooks/HookManager.ts— 工具前置决策与输入改写HookExecutor.executeHook()inpackages/cli/src/hooks/HookExecutor.ts— trust gate 与后端分派runPreToolUseHooks()inpackages/cli/src/tools/execution/ToolExecutionHooks.ts— 将 Hook 决策合并回工具准入HookTrustService.getStatus()inpackages/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— 进程退出时触发 SessionEndpackages/cli/src/plugins/PluginIntegrator.ts— 插件 Hooks 的整批合并、来源标记与刷新恢复packages/cli/src/ui/— 用户提示提交、Session 级启停与 TUI 信任审阅packages/cli/web/src/components/settings/HookTrustPanel.tsx— Web 摘要审阅和 Session 开关
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.
- 1mo ago First seen · 98 lines · 147 tokens per session scan A 3cc190f20ab0
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.
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…
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…
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.
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…
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.
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.