Terminal Protocols

OSC 26 terminal agent protocol

OSC 26, also called the Terminal Agent Protocol, is Otty's proposed OSC sequence for letting code agents report identity, status, task progress, and session actions to a terminal.

Short answer

OSC 26 is the proposed Terminal Agent Protocol for code agents. It lets tools such as Codex, Claude Code, OpenCode, or Aider declare their agent identity, session id, status, task progress, title, project folder, resume method, and fork method to a supporting terminal.

OSC 26 is Otty's proposed Terminal Agent Protocol, or TAP. It is an OSC escape sequence that gives terminal-based coding agents a small structured channel for live metadata.

The goal is simple: instead of a terminal guessing what a code agent is doing by scraping process names, private files, or screen text, the agent can announce its own state.

Short form

OSC 26 ; CodeAgent=claude ; Status=running ; TaskProgress=1/4 ST

In raw bytes, OSC is ESC ] and ST is either ESC \ or BEL.

What OSC 26 can carry

FieldMeaning
CodeAgentThe agent kind, such as claude, codex, opencode, or aider.
SessionIdThe agent session identifier.
SessionTitleA title hint for the terminal tab or pane.
ProjectFolderThe project root for this agent session.
StatusA closed state such as idle, running, awaiting-approval, awaiting-input, error, or finished.
DetailAn open display detail such as thinking, before-tool-call, or edit-file.
TaskListNewline-separated task labels.
TaskProgressA literal fraction like 1/4.
MethodResumeA declarative hint for how to resume the session.
MethodForkA declarative hint for how to fork or branch the session.

Values that may contain spaces, semicolons, equals signs, or non-ASCII text are base64-encoded UTF-8. Stable tokens such as status enums can be sent literally.

Why code agents need it

Agent CLIs run inside ordinary terminal panes, but their useful state is not ordinary terminal text. A terminal wants to know whether an agent is thinking, waiting for approval, done, blocked, resumable, or forkable. Without a protocol, the terminal has to infer that state from fragile heuristics.

OSC 26 turns that into declarative terminal metadata. The agent emits a state update, and the terminal can render badges, notifications, task progress, session grouping, resume, and fork actions.

Relationship to OSC 88

OSC 26 is about live agent state. OSC 88, the Terminal Resume Protocol, is about cold-restart recovery.

An agent can use both. OSC 26 says who the agent is and what it is doing now. OSC 88 says how the terminal can relaunch the program after a restart.

Status

OSC 26 is a proposal, not a ratified terminal standard. Otty ships the reference implementation and documents the wire format so other terminals and agent CLIs can implement the same behavior.

Sources