Skip to content

S16 - Terminal Stream

Purpose: How wb guards boundary 6 of T00-indexT00-indexboundary 6 is the host terminal stream., the guest output that wb writes to the user’s terminal.

Requirements: FR01-drop-inFR01-drop-in: Drop-in for claudewb is the single entry point for everything, structured as wb [wb flags] <command> [command args]., SEC03-no-host-execSEC03-no-host-exec: No host code execution via returned workNothing the agent produces executes on the host without an explicit user action; returned changes to files the host may later execute are flagged., SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter., SEC14-no-fake-approvalsSEC14-no-fake-approvals: Approvals cannot be spoofed by the guestApproval prompts are never rendered in the agent's terminal stream., NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it..

Tests: C10-terminalC10-terminal: TerminalThe test cases for the terminal filter in wb, which stands between the guest's output and the host terminal.

Brief: B37-terminal-boundaryB37-terminal-boundary: Should the host terminal be a trust boundary with its own filter?Yes, decided.

host: trusted guest: untrusted Claude Code writes any bytes wb allowlist filter notifications: one BEL its own title, reset on exit terminal emulator the user's terminal relayed unchanged wb-guestd, wb-hostd passes text, cursor, colors, screen and keyboard modes, queries dropped whole, counted: titles, links, OSC 52 clipboard, iTerm2 files, DCS, APC counts and dropped links: audit log and session summary
The terminal stream. Claude Code in the guest can write any bytes. wb-guestd and wb-hostd relay them unchanged to wb, which filters them with an allowlist before the user's terminal emulator. Text, cursor movement, colors, screen and keyboard modes, and queries pass. Titles, links, OSC 52 clipboard writes, iTerm2 file transfers, and DCS and APC sequences such as kitty graphics are dropped whole and counted. Notifications become one BEL. wb writes its own title and resets the terminal on exit. The counts and the dropped links go to the audit log and the session summary.

The terminal emulator parses the guest’s output, and acts on some of it on the host:

  • OSC 52 writes the clipboard;
  • iTerm2’s OSC 1337 saves files;
  • kitty graphics can read a file by its path.

Every parser bug is a path to the host. So guest output is boundary 6 of T00-indexT00-indexboundary 6 is the host terminal stream.. wb filters it with an allowlist that fails closed, as wb-netd filters packets (SEC03-no-host-execSEC03-no-host-exec: No host code execution via returned workNothing the agent produces executes on the host without an explicit user action; returned changes to files the host may later execute are flagged.).

Page What it covers
S16-01-filterS16-01-filter: FilterWhere wb filters guest output, how the filter splits it into tokens, and the allowlist of what passes. Where the filter runs, how it splits the stream, and the allowlist
S16-02-drops-and-linksS16-02-drops-and-links: Drops and LinksThe fixed rules that drops are counted by, and how wb records the links the filter drops. The drop rules the counts use, and the links the filter drops
S16-03-around-the-streamS16-03-around-the-stream: Around the StreamWhat wb writes to the terminal around the filtered stream, the terminal environment the guest gets, and how guest text in wb's other output is escaped. What wb writes around the stream, the environment, terminfo, and guest text in other output

Status: Draft