基础设施 4.0 · 优秀 2026-10-06 · 文章

A Terminal Protocol for Program Status (OSC 7501)

Mitchell Hashimoto 发布 OSC 7501 程序状态协议规范:应用通过一条终端 escape sequence 主动声明自己在 idleworking等用户输入完成还是失败,附原因与结构化元数据,例如 Terraform 报 state=blockedkind=permissionapp=terraform 加 base64 消息现有做法要么猜窗口标题要么抓屏正则要么依赖各家 agentic inbox 的私有 API,并行 agent 越多越脆;这条通用规范让任何终端或 inbox 工具用同一套语法解释程序状态规范挂在 Superlogical 的 rex docs 下,与 GhosttySuperlogical 无产品绑定,面向整个终端生态

打开原文回到归档

A Terminal Protocol for Program Status (OSC 7501)

  • ID: 6719dd9b
  • 原文链接: https://mitchellh.com/writing/program-status-osc7501
  • 作者: Mitchell Hashimoto
  • 日期: 2026-10-06
  • 分类: infra
  • 来源类型: article
  • 标签: terminal, osc, protocol, agent-observability, spec
  • 质量评分: 4/5
  • 抓取时间: 2026-10-07T15:52:52Z

中文导读

Mitchell Hashimoto 写了一个新终端 escape sequence 的规范:OSC 7501,程序状态协议。它让任何程序告诉终端自己正处于 idle、working、blocked(等用户)、finished 还是 failed,以及原因——比如 Terraform 可以报 state=blocked、kind=permission、app=terraform,消息 base64 编码:Apply 3 to add, 1 to change, 0 to destroy?。终端或任何运行该程序的工具(通知、inbox、状态图标)都能用同一语法解释。写作动机是 coding agent 时代的具体痛点:想知道后台 agent 的状态,现在只能猜窗口标题、抓屏幕做正则、或让工具去调 Agent Deck/Herdr/cmux 这类 agentic inbox 的私有 API,全是 heuristic,agent 一多就脆。规范是完全通用的终端原生协议,从 Superlogical 与 Ghostty 的工作中长出来,但不与任何产品绑定。

为什么值得关注

agentic inbox 工具潮的共享脊柱候选:状态声明从 heuristic 变成标准 escape sequence,终端生态一旦采纳,并行 agent 的可观测性成本会显著下降。

关键信息

  • 规范原文:superlogical.com/rex/docs/build/program-status(OSC 7501)
  • 状态示例:ESC ] 7501 ; state=blocked:kind=permission:app=terraform:msg=<base64> ESC \
  • 作者背景:Mitchell Hashimoto,Ghostty/Superlogical;规范与产品无绑定
  • 发布:2026-10-06

English Abstract

I wrote a specification for a new terminal escape sequence: OSC 7501, the Program Status Protocol. It lets any program tell the terminal what it's doing: idle, working, waiting on the user, finished, or failed, and why. The post covers why this protocol needs to exist, why existing approaches aren't good enough (especially for coding agents), and how the protocol works. It is a completely generic, terminal-native specification and protocol.

English Summary

OSC 7501 is a proposed terminal escape sequence for programs to self-declare structured status (state, kind, app, message), replacing title guessing, screen scraping, and private inbox APIs for observing background agents.

Obsidian Notes

  • 内容获取路径:opencli web read --url https://mitchellh.com/writing/program-status-osc7501 成功抓取全文(约 10 KB),状态语义与协议示例均出自正文。
  • 现代站点生成器按 content/{entry.id}.md 查找内容页;本文件写入 canonical content 目录,而不是 openclaw/content/。