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..
Design
Section titled “Design”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 |
Out of scope
Section titled “Out of scope”- The TTY relay itself, and the exit status and signals of
wb claude, are in S05-01-agent-commandsS05-01-agent-commands: Agent CommandsHow wb claude passes its arguments to Claude Code, how it runs interactive and non-interactive sessions, and what a session does. and S05-02-exit-status-and-signalsS05-02-exit-status-and-signals: Exit Status and SignalsWhat wb claude exits with, and what it does with each signal..
Status: Draft