Add a MessageDisplay hook for streamed assistant output

Open
#33,420 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
api, cli

Research direction

Start by tracing the shared codex-core response-stream path and the existing Stop hook, then compare it with the app-server item/agentMessage/delta event. The work is done when a configured hook receives coalesced assistant-message updates and a guaranteed final delivery without affecting model execution, with integration coverage for the hook lifecycle.

Written by the indexing model from the issue text.

Description

CLI enhancement hooks
What variant of Codex are you using?

Codex CLI 0.144.4, primarily the interactive TUI and codex exec. The event should be emitted from the shared codex-core response-stream path so all relevant CLI/app-server/IDE surfaces receive consistent behavior.

What feature would you like to see?

Please add a first-class MessageDisplay hook that fires while assistant text is streaming, before the existing Stop hook.

The primary use case is live local narration/TTS, but the same event also enables incremental logging, telemetry, accessibility tooling, and external display overlays without requiring an app-server client.

A minimal contract could include:

  • stable session, turn, and assistant message/item identifiers;
  • the assistant text observed so far (either a delta plus sequence index, or cumulative displayed_text);
  • an unambiguous final-delivery flag;
  • debounced/coalesced mid-stream delivery, with the final delivery guaranteed;
  • observational, non-blocking execution that cannot alter model state or delay the turn;
  • no streaming-path work when no matching handler is configured.

For example, the reference implementation uses cumulative text:

{
  "hook_event_name": "MessageDisplay",
  "session_id": "...",
  "turn_id": "...",
  "item_id": "...",
  "displayed_text": "The response so far...",
  "is_final": false
}

The precise payload should follow maintainer preference. Claude Code currently uses delta, index, and final; Qwen Code chose cumulative text plus is_final, which makes debounce/coalescing and narration consumers simpler.

Additional information

Codex hooks currently expose lifecycle/tool events and Stop, but no event during assistant-message streaming. The app-server already emits item/agentMessage/delta, so the data exists internally; using it today requires running/connecting an app-server client instead of configuring an ordinary hook.

Concrete motivator: DontSpeak provides local voice narration for coding CLIs. Claude Code can support this through its native MessageDisplay hook. I recently added the equivalent capability to Qwen Code, and it was merged on July 11, 2026.

Prior art and references:

I am filing this issue first in accordance with the repository contribution policy and am not opening an unsolicited upstream PR. The fork is available to make the design concrete; it also contains an implementation audit identifying the process-lifetime, final-delivery, migration, metrics, and integration-test hardening that should be resolved before any upstream merge. I would be happy to adapt the design or contribute code if maintainers invite the work.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.