claude-code - 💡(How to fix) Fix [FEATURE] PostAssistantResponse

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

{
  "hooks": {
    "PostAssistantResponse": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cat >> ~/claude_responses.log"
          }
        ]
      }
    ]
  }
}
The hook payload could follow the same pattern as existing hooks — a JSON object on stdin with at minimum:


{
  "text": "<full assistant response text>",
  "session_id": "..."
}


### Alternative Solutions

_No response_

### Priority

High - Significant impact on productivity

### Feature Category

Configuration and settings

### Use Case Example


Routing long responses to a local documentation site or sketchbook (avoiding terminal clutter)
Logging assistant output for review or auditing
Triggering notifications when a task completes
Post-processing responses with custom scripts (summarization, tagging, archiving)

### Additional Context

Why a pseudo-terminal wrapper does not work[](http://localhost:8005/#why-a-pseudo-terminal-wrapper-does-not-work)
A pty.spawn wrapper around the Claude Code binary captures raw terminal bytes including ANSI escape codes and Terminal User Interface chrome (borders, spinner, status bar). Extracting clean assistant text from that stream requires complex post-processing and is fragile. A first-class hook is the only reliable solution.

PreToolUse / PostToolUse hooks already demonstrate this pattern works well
Many users have asked for ways to log or redirect Claude output (see related issues)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Problem

Claude Code currently has no hook that fires after the assistant produces a text response. The existing hooks (PreToolUse, PostToolUse, SessionStart, SessionEnd) cover tool calls and session lifecycle, but there is no way to intercept assistant text output programmatically.

This makes it impossible to reliably pipe Claude's responses to external tools — log files, documentation sites, note-taking systems, etc. — without manual copy-paste.

Proposed Solution

Proposed solution

Add a PostAssistantResponse hook that fires after each assistant turn completes. The hook should receive the response text as input (via stdin or environment variable), for example:

{
  "hooks": {
    "PostAssistantResponse": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cat >> ~/claude_responses.log"
          }
        ]
      }
    ]
  }
}
The hook payload could follow the same pattern as existing hooks — a JSON object on stdin with at minimum:


{
  "text": "<full assistant response text>",
  "session_id": "..."
}


### Alternative Solutions

_No response_

### Priority

High - Significant impact on productivity

### Feature Category

Configuration and settings

### Use Case Example


Routing long responses to a local documentation site or sketchbook (avoiding terminal clutter)
Logging assistant output for review or auditing
Triggering notifications when a task completes
Post-processing responses with custom scripts (summarization, tagging, archiving)

### Additional Context

Why a pseudo-terminal wrapper does not work[](http://localhost:8005/#why-a-pseudo-terminal-wrapper-does-not-work)
A pty.spawn wrapper around the Claude Code binary captures raw terminal bytes including ANSI escape codes and Terminal User Interface chrome (borders, spinner, status bar). Extracting clean assistant text from that stream requires complex post-processing and is fragile. A first-class hook is the only reliable solution.

PreToolUse / PostToolUse hooks already demonstrate this pattern works well
Many users have asked for ways to log or redirect Claude output (see related issues) ```

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] PostAssistantResponse