Can wb filter Claude Code's terminal output without breaking it?
Answered 2026-10-04. Decided 2026-10-04: A, allowlist as measured, and H1 plus a URL list for hyperlinks. Source: X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS… (I30I30 (closed): X19-terminal-filter: Terminal stream filteringX19-terminal-filter (added to S11-verification-and-spikes in #14)). Feeds I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli). (B37-terminal-boundaryB37-terminal-boundary: Should the host terminal be a trust boundary with its own filter?Yes, decided.) and I38I38 (closed): S06-vm-lifecycle: design port forwarding and clipboard (FR11-port-forward, FR12-clipboard) and their threatsFR11-port-forward (dev servers on host loopback) and FR12-clipboard (clipboard) cross the VM boundary, but no spec designs them and S03-requirements's threat model does not list them.. The check by eye in real terminals is I62I62 (closed): X19-terminal-filter: visual check in real terminalsSplit from #30 (X19-terminal-filter) during triage on 2026-10-04..
Figure 1. The relay of a wb claude session with the filter from X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…. What draws the screen passes. What acts on the host is dropped whole and counted, and a desktop notification arrives as a bell without its text.
Options
Section titled “Options”The spike leaves three choices open: what happens to /copy, to Claude Code’s desktop notifications, and to hyperlinks. The cards below cover the first two. Hyperlinks have their own cards after them, and combine with any of A, B or C.
Hyperlinks.
Claude Code links file paths, web addresses and its own help pages with OSC 8. A link’s visible text can differ from where it goes, and a link to localhost or a private address names a service on the host, not in the guest.
Impact
Section titled “Impact”Evidence
Section titled “Evidence”- verified The inventory: 56 kinds of sequence in 818 KB of output from seven sessions, four terminal profiles (X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…, “Inventory”).
- verified Replayed into two headless emulators, raw and filtered, every screen after every read differs at most in
file://links. A control run that strips colors shows the comparison sees style (X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…, “What the filter changes”). - verified
/copyemitsESC ] 52 ; c ; <base64>as well as runningpbcopy(recordingcopy-ghostty). - inferred Claude Code sends “Claude needs your permission” as OSC 777 for Ghostty and OSC 9 for iTerm2. Observed under the imitated Ghostty and iTerm2 profiles (recordings
session-ghostty,session-iterm), not in the real terminals. - verified A link printed by a Bash tool reaches the terminal as a live link (recording
session-ghostty). - verified About 12 ms of CPU per MB of Claude Code output, and 34 ms per MB for random bytes (X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…, “Cost”).
- verified A fuzz target found one bug, which is fixed, and then ran 17.5 million inputs without a failure (X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…, “Fuzzing”).
- assumed That the headless emulator shows what Ghostty and Terminal.app show. I62I62 (closed): X19-terminal-filter: visual check in real terminalsSplit from #30 (X19-terminal-filter) during triage on 2026-10-04. checks it by eye.
- assumed That the terminal profiles in the recorder answered Claude Code’s queries as the real terminals would. I62I62 (closed): X19-terminal-filter: visual check in real terminalsSplit from #30 (X19-terminal-filter) during triage on 2026-10-04. covers Ghostty and Terminal.app. The iTerm2 and VS Code profiles stay unchecked.
- verified The spike filter passes a guest-set window title (OSC 0) followed by BEL unchanged (security review of PR66PR66 (merged): docs(spikes): X19-terminal-filter result, yes with conditionsAnswer: yes, with conditions, for Ghostty and Terminal.app, as far as a headless emulator can show.).
- inferred From the terminals’ documentation: with a bell, iTerm2’s Notification Center alerts show the session title, and Ghostty’s
bell-features = titleshows it in the tab. So guest text can still reach the desktop, and I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli). haswbown the title. I62I62 (closed): X19-terminal-filter: visual check in real terminalsSplit from #30 (X19-terminal-filter) during triage on 2026-10-04. can check the Ghostty part. The iTerm2 part stays unchecked.
What this unblocks
Section titled “What this unblocks”- I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli).: the spec change for T00-indexT00-indexboundary 6 is the host terminal stream., S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command. and S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…, with this allowlist and the tightening and reset items in X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS… (“What it means for the specs”).
- I62I62 (closed): X19-terminal-filter: visual check in real terminalsSplit from #30 (X19-terminal-filter) during triage on 2026-10-04.: the check by eye, with the relay from the spike branch.
- I38I38 (closed): S06-vm-lifecycle: design port forwarding and clipboard (FR11-port-forward, FR12-clipboard) and their threatsFR11-port-forward (dev servers on host loopback) and FR12-clipboard (clipboard) cross the VM boundary, but no spec designs them and S03-requirements's threat model does not list them.: OSC 52 from
/copyis the input for the guest-to-host clipboard.
Details and glossary
How the filter works. It splits the stream into text, controls, and escape sequences. It passes a sequence only when a rule allows it and drops any other whole, from its ESC to its end. The terminal never sees the start of a dropped sequence. Each drop is counted by rule, so the session summary can say why something looked wrong (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.).
Why file links go. Claude Code links the paths it shows with file:// URLs. In a guest those are guest paths. On the host they name another file or none, and a click opens whatever is there.
Glossary
- Escape sequence: bytes starting with
ESCthat a terminal treats as a command, not text. - OSC 52: the sequence that sets the terminal’s clipboard.
- OSC 8: a hyperlink around some text.
- OSC 9, OSC 777: desktop notifications in iTerm2 and Ghostty.
- Kitty graphics: a protocol for images in the terminal, one mode of which reads a file by its path.
- Headless emulator: a terminal emulator in a library, with no window, used to compare screens.