[DOCS] Hooks reference missing `terminalSequence` JSON output field for notifications

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened May 13, 2026 · closed Jun 1, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/hooks

Section/Topic

JSON output and Notification hooks

Current Documentation

The hooks reference currently says:

The JSON object supports three kinds of fields: Universal fields like continue work across all events. These are listed in the table below. Top-level decision and reason are used by some events to block or provide feedback. * hookSpecificOutput is a nested object for events that need richer control. | continue | true | If false, Claude stops processing entirely after the hook runs. | | stopReason | none | Message shown to the user when continue is false. | | suppressOutput | false | If true, omits stdout from the debug log | | systemMessage | none | Warning message shown to the user |

Later on the same page, the Notification section says:

Notification hooks cannot block or modify notifications. They are intended for side effects such as forwarding the notification to an external service. The common JSON output fields such as systemMessage apply.

What's Wrong or Missing?

The v2.1.141 release added a terminalSequence field to hook JSON output so hooks can emit terminal-side effects such as desktop notifications, window-title updates, and bells without a controlling terminal.

That field is not documented anywhere in the hooks reference: there is no field definition, no supported-event guidance, and no example showing how to use it. As a result, the current docs only point users to built-in notification settings or shell-command Notification hooks, and they do not expose the new structured-output path.

Suggested Improvement

Add terminalSequence to the JSON output field table and document it in the hooks reference with:

  • what value format it accepts
  • which hook events process it
  • whether it can be returned alongside systemMessage and additionalContext
  • short examples for a bell, a window-title update, and a terminal-driven notification

It would also help to add one cross-reference from the Notification or terminal configuration docs explaining when to use terminalSequence instead of a shell command hook.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/hooks | 680-702, 1657 | JSON output field list omits terminalSequence; Notification section mentions systemMessage but not the new field |
| https://code.claude.com/docs/en/terminal-config | 64-84 | Notification guidance covers built-in notifications and command hooks, but not structured hook output for terminal sequences |

Total scope: 2 pages affected

Feature added in v2.1.141.

View original on GitHub ↗

3 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/44902
  2. https://github.com/anthropics/claude-code/issues/52607
  3. https://github.com/anthropics/claude-code/issues/58120

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

coygeek · 4 months ago

Issue #58858 Verification

Title: [DOCS] Hooks reference missing terminalSequence JSON output field for notifications
Issue Date: 2026-05-13
Verification Date: 2026-05-31
Status: RESOLVED

---

Issue Summary

This issue reported that the v2.1.141 release added a terminalSequence field to hook JSON output so hooks can emit terminal-side effects (desktop notifications, window-title updates, and bells) without a controlling terminal. At the time it was filed, the field was not documented in the hooks reference: there was no field definition, no supported-event guidance, and no example showing how to use it.

---

Verification Results

Claim 1: terminalSequence missing from the JSON output field table

Status: RESOLVED

The terminalSequence field is now present in the JSON output field table. At https://code.claude.com/docs/en/hooks, line 706, the table includes:

| terminalSequence | none | A terminal escape sequence for Claude Code to emit on your behalf, such as a desktop notification, window title, or bell. Restricted to OSC 0/1/2/9/99/777 and BEL. If the value contains anything outside the allowlist, the field is ignored. Use this instead of writing to /dev/tty, which is unavailable to hooks |

The hook input and output section (line 562) also cross-references the field:

To trigger a desktop notification, set a window title, or ring the bell, return [terminalSequence](#emit-terminal-notifications) instead.

Verdict: The field definition is complete and present in the documented table.

---

Claim 2: No supported-event guidance or examples for terminalSequence

Status: RESOLVED

The hooks page now includes a dedicated #### Emit terminal notifications subsection (lines 714-746) with:

  • Supported sequences (lines 722-727): the allowlisted escape sequences (OSC 0/1/2, OSC 9, OSC 99, OSC 777, bare BEL) with terminal-specific notes
  • Termination (line 728): BEL or ST, with CSI/OSC palette/hyperlink/1337 sequences rejected
  • A Notification hook example (lines 732-740):

````bash
#!/bin/bash

Notification hook: ping the desktop when Claude Code needs attention.

input=$(cat)
title="Claude Code"
body=$(jq -r '.message // "Needs your attention"' <<<"$input")
seq=$(printf '\033]777;notify;%s;%s\007' "$title" "$body")
jq -nc --arg seq "$seq" '{terminalSequence: $seq}'

````

  • Compatibility note (line 716): "The terminalSequence field requires Claude Code v2.1.141 or later."
  • Cross-platform guidance (line 742): "The { "terminalSequence": "..." } shape is the same from any shell or language."

Verdict: The documentation now provides thorough guidance on supported events, allowed sequences, and working examples.

---

Claim 3: Notification section at terminal-config lacks cross-reference to terminalSequence

Status: PARTIALLY RESOLVED

The terminal-config page at https://code.claude.com/docs/en/terminal-config (lines 64-94) covers desktop notifications and hook-based sounds but does not explicitly reference terminalSequence or the structured hook-output path. However, it links to the hooks documentation (line 86: "configure a Notification hook"), and the hooks page now thoroughly documents the field with a Notification hook example.

Verdict: The cross-reference is implicit through the existing hooks link rather than explicit. Given the thorough coverage in the hooks reference itself, this is a minor gap.

---

Current State

| Claim | Status |
|-------|--------|
| terminalSequence missing from JSON output field table | RESOLVED |
| No field definition, guidance, or examples | RESOLVED |
| terminal-config lacks cross-reference | PARTIALLY RESOLVED |

---

Suggested Fix

N/A - the core issue has been resolved. The terminalSequence field is now fully documented in the hooks reference with a field definition, supported-sequence guidance, a Notification hook example, and cross-references from the input/output section. The terminal-config page could optionally add an explicit mention of the structured hook-output path for terminalSequence, but this is a minor enhancement given the existing hooks link.

---

References

---

Conclusion & Recommendation

Primary Concern: The hooks reference was missing documentation for the terminalSequence JSON output field introduced in v2.1.141.

Resolution Status: RESOLVED

Recommendation: CLOSE

The terminalSequence field is now thoroughly documented in the hooks reference with a complete field definition, a dedicated "Emit terminal notifications" section covering allowed sequences and supported events, a working Notification hook example, and cross-references from the general input/output section. The issue's core complaint (no documentation at all) no longer applies.

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.