[BUG] Verbose Mode Display Ordering Bug

Resolved 💬 2 comments Opened Aug 27, 2025 by ntldrake Closed Aug 27, 2025

Bug: Verbose Mode Output Accumulation and Ordering Issue

Issue Summary

Claude Code's --verbose mode has a display issue where hook completion messages accumulate and don't clear properly. This causes:

  1. SessionStart:startup message gets pushed to the bottom of the output
  2. Stop hook completions pile up, making it appear as if multiple Stop hooks fired simultaneously
  3. Previous hook messages remain visible, creating confusion about what's currently executing vs what already completed

Observed Behavior

In Verbose Mode

After several interactions, the output shows:

Stop [uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify] completed successfully
Stop [uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify] completed successfully
Stop [uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify] completed successfully
SessionStart:startup [uv run python /path/to/project/.claude/hooks/session_start.py] completed successfully
Stop [uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify] completed successfully

This makes it appear as if:

  • Multiple Stop hooks are firing simultaneously (they're not - these are accumulated messages from previous executions)
  • SessionStart is firing mid-conversation (it's not - this is the original startup message pushed down)

In Debug Mode

[DEBUG] Executing hooks for Stop
[DEBUG] Getting matching hook commands for Stop with query: undefined
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 1 unique hooks for query "no match query" (1 before deduplication)
[DEBUG] Found 1 hook commands to execute
[DEBUG] Executing hook command: uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify with timeout 60000ms
[DEBUG] Hook command completed with status 0: uv run python /path/to/project/.claude/hooks/stop.py --notify --slash-notify

Debug mode shows the correct behavior - only the Stop hook fires after responses, with no SessionStart event.

Investigation Details

Hook Logs Analysis

  • Checked /path/to/project/logs/session_start.json: Shows only ONE SessionStart event per session with source "startup"
  • Checked /path/to/project/logs/stop.json: Shows Stop events firing at expected times
  • Current session ([session-id]) has exactly 1 SessionStart event logged at session start

Root Cause

This is a display/buffering issue in verbose mode where:

  1. Hook completion messages accumulate rather than clearing after display
  2. Each new hook execution adds its completion message to the growing pile
  3. The SessionStart:startup message from session start gets pushed to the bottom
  4. The accumulated output creates the illusion that multiple hooks are running when they're actually historical completions

Impact

  • Confuses users about when hooks are actually firing
  • Makes debugging hook timing issues difficult in verbose mode
  • Creates false impression that sessions are being recreated mid-conversation

Workaround

Use --debug mode instead of --verbose to see accurate hook execution timing.

Reproduction Steps

  1. Configure hooks in .claude/settings.json
  2. Start Claude Code with --verbose flag
  3. Have a conversation with multiple tool uses
  4. Observe SessionStart events appearing after Stop events

Expected Behavior

In verbose mode:

  1. Hook completion messages should clear or be properly separated from new executions
  2. Output should clearly indicate temporal order of events
  3. Historical completions shouldn't accumulate on screen creating confusion about current state

Environment

  • Claude Code version: Current
  • Platform: Linux (WSL2)
  • Hooks configured: PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, etc.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗