wire / terminal-osc / 133

OSC 133 — Semantic Prompts (FinalTerm / FTCS shell integration)

OSC 133 marks shell prompt, command-input, and command-output boundaries so terminals can navigate by command, fold output, and color the prompt by exit status. Four subcommands: A (prompt start), B (command-line start), C (output start), D[;exitcode] (command finished). Originated in the defunct FinalTerm emulator; harmonized by Per Bothner's Semantic Prompts proposal; near-universally adopted.

terminal-osc kind control-sequence status de-facto verification verified tier C terminal-escape@1

aka: FTCS · FinalTerm prompt markers · FinalTerm sequences · semantic prompts · shell integration marks · FTCS_PROMPT/FTCS_COMMAND_START/FTCS_COMMAND_EXECUTED/FTCS_COMMAND_FINISHED

frame

OSC introducer: \x1b] ESC ] (0x1B 0x5D)

terminator (ST|BEL): ST \x1b\ · BEL \x07

parameters / subcommands

idnamebytes (ST)meaning
A FTCS_PROMPT \x1b]133;A\x1b\ Start of the prompt. Emitted by the shell precmd hook just before printing PS1.
B FTCS_COMMAND_START \x1b]133;B\x1b\ Start of the command line / end of the prompt. Everything after this until C is what the user typed.
C FTCS_COMMAND_EXECUTED \x1b]133;C\x1b\ Start of command output / end of the command line. Emitted from the shell preexec hook, just before the command runs.
D FTCS_COMMAND_FINISHED \x1b]133;D\x1b\ End of the command. Optional exit code as a second parameter: 0 = success, nonzero = error. Omitting the exit code leaves the mark default-colored (no success/error tint).

support matrix

terminallevelsincenotes
FinalTermfulloriginal (defunct)Origin of the FTCS sequences; project is defunct but documented by iTerm2.
iTerm2fullShell Integration (3.x)Documents the sequences; also defines its own OSC 1337 family for additional shell-integration features.
VTE / GNOME TerminalfullVTE 0.66+Recognizes OSC 133 A/B/C/D for prompt/command tracking.
WezTermfulldocumentedImplements semantic zones from OSC 133; documents shell integration.
kittyfulldocumentedUses OSC 133 for shell integration / command tracking.
Ghosttyfull1.0Supports OSC 133 shell integration out of the box.
Windows Terminalfullstable shell-integration tutorialDocuments A/B/C/D identically to Contour; supports D exit-code coloring.
ContourfulldocumentedDedicated OSC-133 shell-integration page; authoritative cross-source for A/B/C/D.
VS Code integrated terminalvariantshell integrationPrefers OSC 633 (superset) but also accepts/emits OSC 133 for portability.
WarppartialdocumentedBlock model derives from prompt/command boundaries; uses shell-integration marks though its native model predates a pure 133 dependency.
DomTermfullPer Bothner ref implReference implementation behind the Semantic Prompts proposal.

variants

gotchas


provenance

per-fact attribution:

see also

agent: curl -H 'accept: application/json' wire.phall.io/terminal-osc/133 or /terminal-osc/133.json