feat(hooks): add prompt hook type with LLM evaluation support - #3388
Conversation
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
…nLM/qwen-code into feat/hook-prompt-hook-second
Code ReviewOverviewAdds a fourth hook executor type, The change is well-scoped, well-tested (815 lines of new tests), and the dedup-truncation fix in IssuesDocumentation/code mismatch on default model — fix before mergeThe settings schema (
But the implementation uses
Pick one and align all three. Given the LLM is being asked to make a structured decision from JSON, Fail-open on parse failure is a real security footgun
The doc snippet in
Abort listener leak on long-lived signals
Fix: use
|

TLDR
This PR adds a new prompt hook type to Qwen Code hooks system. Prompt hooks use an LLM to evaluate hook input and return a decision (allow/block), enabling intelligent, AI-powered hook logic. This is useful for security evaluation, context injection, and conditional workflow control.
Screenshots / Video Demo
UI:

Take PreToolUse as example:

Dive Deeper
Key changes:
PromptHookRunnerfor LLM-based hook evaluation$ARGUMENTSplaceholderCore changes:
PromptHookRunner(packages/core/src/hooks/promptHookRunner.ts)$ARGUMENTSplaceholder for injecting context{ok: true/false, reason?: string, additionalContext?: string}HookType.PromptenumReviewer Test Plan
1、Run tests:
Testing Matrix
Linked issues / bugs