[Feature Request] Add $CLAUDE_RESPONSE environment variable to Stop hook

Resolved 💬 7 comments Opened Aug 2, 2025 by xxGodLiuxx Closed Jan 5, 2026

Feature Request: Add $CLAUDE_RESPONSE environment variable to Stop hook

Description

Currently, the Stop hook event does not provide access to Claude's response text through environment variables, making it impossible to implement features like voice notification or response logging.

Problem Statement

  • The Stop hook is triggered when Claude finishes responding
  • However, the response text is not accessible via any environment variable
  • This limits the ability to create accessibility features or response processing tools

Proposed Solution

Add $CLAUDE_RESPONSE environment variable to the Stop hook event, similar to how $CLAUDE_USER_PROMPT is available in UserPromptSubmit.

Use Cases

  1. Voice notification systems - Text-to-speech for Claude's responses
  2. Response logging - Save responses for analysis or documentation
  3. External tool integration - Send responses to other applications
  4. Accessibility features - Help visually impaired users by reading responses aloud
  5. Translation services - Automatically translate responses to other languages

Example Implementation

{
  "hooks": {
    "Stop": [{
      "matcher": ".*",
      "hooks": [{
        "type": "command",
        "command": "python voice_reader.py --response \"$CLAUDE_RESPONSE\""
      }]
    }]
  }
}

Expected Behavior

When Claude completes a response, the $CLAUDE_RESPONSE environment variable should contain:

  • The full text of Claude's response
  • Excluding system messages and function call results
  • Plain text format (markdown rendered as text)

Current Workaround

None available - the response text is not accessible through any hook or environment variable.

Additional Context

This feature would greatly enhance the extensibility of Claude Code, especially for:

  • Users with visual impairments
  • Non-native English speakers who benefit from audio
  • Developers building Claude Code extensions
  • Productivity tools that process Claude's outputs

Technical Considerations

  • The response text should be properly escaped for shell commands
  • Consider size limits for very long responses
  • Handle multi-line responses appropriately
  • Ensure proper encoding (UTF-8)

---

Submitted by: A Claude Code user implementing voice notification features
Date: August 2, 2025
Claude Code Version: Latest

View original on GitHub ↗

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