[FEATURE] Add afterResponse hook for intercepting LLM output

Resolved 💬 3 comments Opened Feb 11, 2026 by sandipchitale Closed Feb 14, 2026

Preflight Checklist

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

Problem Statement

Claude Code is terminal-based and cannot render rich markdown content like Mermaid diagrams, LaTeX math, interactive charts, or SVG graphics. Users who need to visualize this content must manually copy it to external tools.

Proposed Solution

Add an afterResponse or onOutput hook that provides access to Claude's LLM response content, similar to Gemini CLI's afterModel hook: https://geminicli.com/docs/hooks/reference/#aftermodel

Proposed API

{
  "hooks": {
    "afterResponse": [{
      "hooks": [{
        "type": "command",
        "command": "python .claude/hooks/render_rich_content.py"
      }]
    }]
  }
}

Hook should provide via stdin (JSON):

Full response text/content
Response metadata (turn number, tokens, model)
Message role (assistant/user)
Timestamp

Hook capabilities:

Read-only access to response (non-blocking)
Can launch external processes
Can write to files/sockets for IPC

Benefits

Native support for visualizing complex outputs
Better debugging workflows (log all responses)
Custom formatting pipelines
Integration with external visualization tools
Improved accessibility options

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

Companion Browser for Rich Content Rendering:

User starts Claude Code session
Hook script launches companion browser window
Hook intercepts each response in real-time
Script detects rich markdown blocks ( ``mermaid, ``math, etc.)
Rich content is automatically rendered in browser
Terminal continues showing text conversation

Additional Context

_No response_

View original on GitHub ↗

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