Skip to content

fix: use prompt hook type to avoid agent hooks message bug#5

Merged
antfu merged 1 commit intomainfrom
antfu/fix-agent-hooks-msg-bug
Apr 16, 2026
Merged

fix: use prompt hook type to avoid agent hooks message bug#5
antfu merged 1 commit intomainfrom
antfu/fix-agent-hooks-msg-bug

Conversation

@antfu
Copy link
Copy Markdown
Owner

@antfu antfu commented Apr 16, 2026

Summary

  • Changes hook type from agent to prompt for both SessionStart and UserPromptSubmit hooks
  • Fixes "Messages are required for agent hooks. This is a bug." error that crashes the plugin on every user prompt
  • The prompt hook type has an identical schema and behavior but doesn't require conversation messages to be available at hook execution time

Test plan

  • Install the updated plugin in Claude Code
  • Submit a prompt — verify the hook error no longer appears
  • Run /intent:init then submit a direction-changing message to verify intent tracking still works

🤖 Generated with Claude Code

Claude Code's `agent` hook type crashes with "Messages are required
for agent hooks" because conversation messages aren't available yet
during UserPromptSubmit. The `prompt` type has identical schema and
behavior but handles this gracefully.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antfu antfu merged commit a392695 into main Apr 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant