chore: handle TaskCreated hook event (v2.1.84) #254

Closed
opened 2026-04-13 09:11:28 -07:00 by hikari · 1 comment
Owner

Context

Claude Code v2.1.84 added a new TaskCreated hook event, emitted when a subagent task is spawned by the Task tool.

This is distinct from the existing agent lifecycle signals we already track (via Task tool_use blocks in the stream-json output). The hook fires specifically at task creation time, before the agent begins executing.

Why This Matters

We already parse the Task tool_use block to detect subagent spawning and drive character state. The TaskCreated hook provides an earlier, more reliable signal for the same lifecycle event. It may carry additional metadata (e.g. task description, agent ID) that we could use for:

  1. Earlier character state transitions (show "searching/thinking" sooner)
  2. Better agent tracking in the UI
  3. A more accurate spawn timestamp

Tasks

  • Add TaskCreated variant to the hook event enum in src-tauri/src/types.rs
  • Review what fields the TaskCreated hook payload contains
  • Determine whether to use this hook instead of / in addition to the Task tool_use block for agent tracking
  • Add handling in src-tauri/src/wsl_bridge.rs
  • Add tests for the new type variant

References

  • Claude Code v2.1.84 changelog
  • src-tauri/src/types.rs
  • src-tauri/src/wsl_bridge.rs
  • Existing agent tracking via Task tool_use block (see memory: claude-code-protocol.md)

This issue was created with help from Hikari~ 🌸

## Context Claude Code v2.1.84 added a new **`TaskCreated`** hook event, emitted when a subagent task is spawned by the Task tool. This is distinct from the existing agent lifecycle signals we already track (via `Task` tool_use blocks in the stream-json output). The hook fires specifically at task creation time, before the agent begins executing. ## Why This Matters We already parse the `Task` tool_use block to detect subagent spawning and drive character state. The `TaskCreated` hook provides an earlier, more reliable signal for the same lifecycle event. It may carry additional metadata (e.g. task description, agent ID) that we could use for: 1. Earlier character state transitions (show "searching/thinking" sooner) 2. Better agent tracking in the UI 3. A more accurate spawn timestamp ## Tasks - [ ] Add `TaskCreated` variant to the hook event enum in `src-tauri/src/types.rs` - [ ] Review what fields the `TaskCreated` hook payload contains - [ ] Determine whether to use this hook instead of / in addition to the `Task` tool_use block for agent tracking - [ ] Add handling in `src-tauri/src/wsl_bridge.rs` - [ ] Add tests for the new type variant ## References - Claude Code v2.1.84 changelog - `src-tauri/src/types.rs` - `src-tauri/src/wsl_bridge.rs` - Existing agent tracking via `Task` tool_use block (see memory: `claude-code-protocol.md`) ✨ This issue was created with help from Hikari~ 🌸
Author
Owner

Resolved in PR #261. Added TaskCreatedEvent type in types.rs, parse function in wsl_bridge.rs, and Tauri event claude:task-created emitted on hook detection. Tests included.

Resolved in PR #261. Added `TaskCreatedEvent` type in `types.rs`, parse function in `wsl_bridge.rs`, and Tauri event `claude:task-created` emitted on hook detection. Tests included. ✨
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#254