hey
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/hey - HEY Email Workflow Command
/hey - HEY 邮件工作流命令
CLI for HEY: mailboxes, labels, collections, email threads, contacts, replies, compose, calendars, todos, habits, time tracking, and journal entries.
Use the installed CLI as the command reference. This skill holds the rules that span commands; it does not copy the command catalog, because the binary's own help is the source of truth and always matches the version you are running.
HEY 的 CLI:邮箱、标签、收藏集、邮件会话、联系人、回复、撰写邮件、日历、待办事项、习惯、时间追踪和日志条目。
将已安装的 CLI 作为命令参考。此 skill 包含跨命令适用的规则;它不复制命令目录,因为二进制自身的帮助输出才是事实来源,并且始终与你正在运行的版本一致。
Discovery-first workflow
发现优先的工作流
For each task:
-
Infer the deepest plausible leaf command from the user's words.
-
Unless its arguments and flags are already established by a tool result in this conversation, read that leaf's help before running it:bash
hey <group> <subcommand> --agent --help -
If the leaf does not exist, read its nearest parent group. Use root help only when the top-level group itself is unclear:bash
hey <group> --agent --help # fallback hey --agent --help # last resort hey commands --json # every command with its agent_notes -
Treat the leaf's,
short,longandagent_notesas the source of truth. Do not guess positional arguments, flags, accepted values, or limits.flags -
Run with an explicit output mode, then read structured errors before deciding what to do next.
Leaf help is cheap; root help and print the whole catalog and are not. Global flags (, , , , ) apply wherever a command supports them.
hey commands --json--json--jq--quiet--account--stats对于每项任务:
-
根据用户的措辞,推断出层级最深且最有可能存在的叶子命令。
-
除非该命令的参数和标志已由此对话中的某个工具结果确定,否则在运行前读取该叶子命令的帮助信息:bash
hey <group> <subcommand> --agent --help -
如果叶子命令不存在,则读取它最近的父级分组。仅当顶层分组本身不明确时才读取根级帮助信息:bash
hey <group> --agent --help # fallback hey --agent --help # last resort hey commands --json # every command with its agent_notes -
将叶子命令的、
short、long和agent_notes视为事实来源。不要猜测位置参数、标志、可接受的值或限制。flags -
以明确的输出模式运行,然后读取结构化错误,再决定下一步。
叶子命令帮助信息的开销很低;而根级帮助信息和 会打印整个命令目录,开销较高。全局标志(、、、、)适用于支持它们的任何命令。
hey commands --json--json--jq--quiet--account--statsNon-negotiable rules
不可违背的规则
- Choose the right structured output. Use to filter or extract fields and
--jq '<expression>'for the full response. Never pipe to an external--json;jqis built in and implies--jq.--json - Reuse stored authentication. Run the requested data command; it uses stored credentials and refreshes expiring OAuth tokens automatically. If it returns an auth error, follow the retry in Authentication before you report the task as blocked. Use when an explicit authentication check is needed (it reports stored credentials and does not contact HEY). Never run
hey auth status --jsonunattended; use it only for interactive recovery with the user present.hey auth login - Linked mail accounts share one login. Use , then
hey account list --jsonwhen a task must target one account.--account <id|all> - Local HEY configuration requires human trust. Never run without the user's explicit approval.
hey config trust-local - Never resend a send that failed with . See Sending.
not_delivered - Confirm box item mutations. See IDs: HEY does not report IDs that matched nothing.
- 选择正确的结构化输出。 使用 筛选或提取字段,使用
--jq '<expression>'获取完整响应。绝不要管道到外部--json;jq是内置的,并隐含启用--jq。--json - 复用已存储的认证信息。 直接运行用户要求的数据命令;它会使用存储的凭据,并自动刷新即将过期的 OAuth token。如果返回认证错误,请先遵循认证中的重试步骤,再将任务报告为受阻。需要显式检查认证状态时,使用 (它会报告存储的凭据,且不会联系 HEY)。绝不要在无人值守的情况下运行
hey auth status --json;仅在用户在场时将其用于交互式恢复。hey auth login - 关联的邮件账户共用同一登录状态。 使用 ,然后在任务必须指向某个账户时使用
hey account list --json。--account <id|all> - 本地 HEY 配置需要用户明确信任。 未经用户明确批准,绝不要运行 。
hey config trust-local - 绝不重新发送以 失败的发送操作。 参见发送。
not_delivered - 确认邮箱项目变更操作。 参见 IDs:HEY 不会报告未匹配到任何内容的 ID。
Output
输出
--jq.data--quiet --jqauth tokenshell-completion generatesetupskilltui--versiontimetrack export--output--jqhey watch--jqbash
hey box list --jq '.data[] | {id, name}'
hey search "quarterly planning" --jq '.data[].topic_id'
hey box list --quiet --jq '.[].name'- An empty result is an empty array rather than , so
nullis safe on a listing that found nothing..data[] - A field HEY's answer leaves out is left out, never guessed. A posting's is present only when true, so test
seenfor unseen..seen != true - prints one ID per line and
--ids-onlya bare number. They work on listings: every--countcommand, the thread listings,list,hey workflow view,hey search,hey screener history,hey event day|week,hey timetrack categoriesandhey attachment list(its entries, read from the index without bodies). Both answer for what was read, which is the first page unlesshey thread reador--allreads more, and not every listing warns that more pages exist;--limitis the exception and counts the whole queue. On thread listings they count the postings, not the box, label or contact around them.hey screener list --count - stops at a page cap, which each listing's help names. A capped read says where to continue:
--allfor a cursor listing such asnext_page, or thehey box view, naming thenoticevalue, for a numbered one such as--pageorhey search. Continue from there rather than treating the list as complete.hey contact list - writes the original HTML of
--html,hey thread readand a contact's private note to a pipe or file; a terminal is refused.hey journal read
--jq.data--quiet --jqauth tokenshell-completion generatesetupskilltui--version--outputtimetrack export--jqhey watch--jqbash
hey box list --jq '.data[] | {id, name}'
hey search "quarterly planning" --jq '.data[].topic_id'
hey box list --quiet --jq '.[].name'- 空结果为空数组而不是 ,因此即使列表没有找到任何内容,使用
null也是安全的。.data[] - HEY 响应中省略的字段会被直接省略,绝不能猜测。邮件条目的 仅在为 true 时出现,因此使用
seen检测未读项。.seen != true - 每行打印一个 ID,
--ids-only打印一个裸数字。它们适用于各种列表:每个--count命令、会话列表、list、hey workflow view、hey search、hey screener history、hey event day|week、hey timetrack categories和hey attachment list(其条目从索引中读取,不含正文)。二者都会回答实际读取了什么;除非使用hey thread read或--all读取更多内容,否则结果仅涵盖第一页,而且并非每个列表都会警告仍有更多页面。--limit是例外,它会统计整个队列。在会话列表中,它们统计的是邮件条目,而不是周围的邮箱、标签或联系人。hey screener list --count - 会停在页面上限处,每个列表的帮助信息都会注明该上限。达到上限的读取结果会指明继续方式:游标列表(例如
--all)使用hey box view,编号列表(例如next_page或hey search)则使用hey contact list并指定notice值。应从该位置继续,而不能将列表视为完整结果。--page - 会将
--html、hey thread read以及联系人私密备注的原始 HTML 写入管道或文件;目标为终端时会被拒绝。hey journal read
IDs
IDs
Every email thread has two IDs: , its box item ID (one posting in one box), and , its thread ID. Each posting in a thread listing has , , ( for a bundle row), (subject), and ; a thread row also has , and .
idtopic_ididtopic_idkindbundlenamecreated_atapp_urlcontactssummaryvisible_entry_count- Box item ID ():
id,hey seen,unseen,move,label add|remove|create,trash,spam,ignore,stop-ignoring,bubble up|pop,set-aside groupandbulk-reply.bundle view - Thread ID ():
topic_id,hey thread read|update|comment,share,unshare,attachment list,reply,forward,compose --thread-idandcollection add|remove.workflow add|move|remove - Entry ID: an entry's from
id;hey thread readtakes it, and the passage must appear in that message's text.hey clip create - Contact ID from or contact data, clearance ID from
hey contact list(which also gives thehey screener listof the thread to read before deciding), box ID fromtopic_id, label ID fromhey box list. Never substitute one kind for another, or an email address for a contact ID.hey label list
Thread listings (, , , , , ) carry both IDs, with two exceptions: a bundle row can omit , and a search result omits when you have no box item for its thread.
hey box viewlabel viewcollection viewbundle viewcontact threadssearchtopic_ididPassing the wrong kind is not redirected. Unmatched IDs are not reported: HEY checks only that some box item ID in a call is yours, and changes every one that matches. , , and answer only when none match; , , , , and never check ( with no matching ID leaves an empty group). So a mixed batch is a partial success reported as a whole one, a typo is silently skipped, and a that happens to equal one of your box item IDs acts on an unrelated thread; likewise a box item ID given to can read an unrelated thread. Confirm rather than trust the envelope:
hey trashspamlabel add|remove|createbubble up|popnot_foundhey seenunseenmoveignorestop-ignoringset-aside group create|add|removegroup createtopic_idhey thread readbash
hey box view imbox --json --all --jq '{notice, next_page: .data.next_page, match: [.data.postings[] | select(.id == 12345) | {id, topic_id, seen}]}'for a mark, or read the destination box for a move. An empty with still set means the box is larger than reads: continue with rather than calling it a non-match.
matchnext_page--all--page <next_page>Bundle rows. A posting whose is rolls one sender's mail into one row and names the sender, not a thread. It carries only while it holds exactly one unseen thread. Never pass a bundle row's to . lists its unseen threads with their ; lists every thread with that sender, seen or not, which is the only place a bundle's mail is listed once read through. Change grouping with .
kindbundletopic_ididhey thread readhey bundle view <id>topic_idhey contact threads <contact_id>hey contact bundle|unbundle <contact_id>每个邮件会话都有两个 ID:,即其邮箱项目 ID(位于一个邮箱中的一个邮件条目);以及 ,即其会话 ID。会话列表中的每个邮件条目都有 、、(bundle 行对应 )、(主题)、 和 ;会话行还包含 、 和 。
idtopic_ididtopic_idkindbundlenamecreated_atapp_urlcontactssummaryvisible_entry_count- 邮箱项目 ID():
id、hey seen、unseen、move、label add|remove|create、trash、spam、ignore、stop-ignoring、bubble up|pop、set-aside group和bulk-reply。bundle view - 会话 ID():
topic_id、hey thread read|update|comment、share、unshare、attachment list、reply、forward、compose --thread-id和collection add|remove。workflow add|move|remove - 条目 ID:来自 的条目
hey thread read;id接受该 ID,并且摘录内容必须出现在该邮件正文中。hey clip create - 来自 或联系人数据的 Contact ID,来自
hey contact list的 clearance ID(该命令还会提供需要在作出决定前读取的会话hey screener list),来自topic_id的 box ID,以及来自hey box list的 label ID。绝不能用一种 ID 替代另一种,也不能用电子邮件地址替代 Contact ID。hey label list
会话列表(、、、、、)同时包含两种 ID,但有两个例外:bundle 行可能省略 ;如果没有该会话对应的邮箱项目,搜索结果会省略 。
hey box viewlabel viewcollection viewbundle viewcontact threadssearchtopic_idid传入错误类型的 ID 不会被自动重定向。未匹配的 ID 不会被报告:HEY 只会检查调用中的某个邮箱项目 ID 是否属于你,然后会对每一个匹配的 ID 执行更改。、、 和 仅在没有任何 ID 匹配时返回 ;、、、、 和 则完全不检查( 没有匹配的 ID 时会留下一个空组)。因此,混合批次中的部分成功会被作为整个批次的成功来报告,拼写错误会被静默跳过;某个恰好等于你邮箱项目 ID 的 会作用于无关会话;同样,将邮箱项目 ID 传给 也可能读取无关会话。必须进行确认,而不能信任响应封装:
hey trashspamlabel add|remove|createbubble up|popnot_foundhey seenunseenmoveignorestop-ignoringset-aside group create|add|removegroup createtopic_idhey thread readbash
hey box view imbox --json --all --jq '{notice, next_page: .data.next_page, match: [.data.postings[] | select(.id == 12345) | {id, topic_id, seen}]}'执行标记操作后应进行确认,移动操作后则应读取目标邮箱。如果 为空但仍设置了 ,说明邮箱内容超过了 的读取范围:应继续使用 ,而不能认定其未匹配。
matchnext_page--all--page <next_page>Bundle 行。 为 的邮件条目会将同一发件人的邮件合并为一行,并列出发件人而不是会话。只有当它恰好包含一个未读会话时,才会携带 。绝不要把 bundle 行的 传给 。 会列出其未读会话及其 ; 会列出与该发件人的所有会话,无论已读还是未读,而且这是读取 bundle 内邮件后唯一能列出所有相关会话的地方。使用 更改分组方式。
kindbundletopic_ididhey thread readhey bundle view <id>topic_idhey contact threads <contact_id>hey contact bundle|unbundle <contact_id>Sending
发送
- Writing an email for a person goes draft, review, send. Save it with on
--draftorcompose, show the person its From, To, Cc, Bcc, Subject and Body in the conversation (replyreads it back), change it withhey draft show <id> --jsonas they ask, and runhey draft edit <id>when they say to send it. They don't need to open HEY to review it. When the person asks outright for a message to go out,hey draft send <id>orcomposewithoutreplysends it in one step.--draft - A send (,
compose,reply,forward) answers the new message'sdraft sendand theidof the thread it landed on; read it withtopic_id.hey thread read <topic_id> - means Undo Send is still holding it, and HEY leaves it out of its thread until it goes out:
delayed: trueshows the thread without it, or answershey thread readfor a thread it started. Wait and read again rather than treating the send as lost.not_found - A send HEY refused (usually the account's sending limit) fails with (exit 7). HEY kept it as a draft, named by
not_deliveredin the error;draft_idsends it later. Do not resend the message; that makes a second draft.hey draft send <draft_id> - A answer carries the draft ID for
--draftand, when the CLI can name it,hey draft show|edit|send|delete, the draft's page in HEY. The person can also review and send it from any HEY app.app_url - adds a note to a thread, which is never emailed but is not private: everyone with access to the thread sees it, HEY for Domains teammates included. The answer lists them in
hey thread comment <topic_id> -m "...";visible_toanswers the same without adding anything. To mail the people on a thread, use--dry-run.hey reply - : run
hey bulk-replybeforepreview. A delivery sent by mistake can be recalled withsendwhile the window is open.hey bulk-reply undo <delivery_id>
- 为用户撰写邮件时,应走“草稿、审阅、发送”流程。 使用 或
compose的reply保存草稿,在对话中向用户展示 From、To、Cc、Bcc、Subject 和 Body(使用--draft读回草稿),根据用户要求使用hey draft show <id> --json修改,并在用户表示要发送时运行hey draft edit <id>。用户无需打开 HEY 即可审阅。当用户明确要求直接发送消息时,不带hey draft send <id>的--draft或compose会一步完成发送。reply - 发送操作(、
compose、reply、forward)会返回新消息的draft send以及其所属会话的id;使用topic_id读取。hey thread read <topic_id> - 表示 Undo Send 仍在暂缓该消息,并且 HEY 会在消息实际发出前将其排除在会话之外:
delayed: true会显示不包含该消息的会话,或者对由该消息创建的会话返回hey thread read。应等待并再次读取,而不能将发送视为丢失。not_found - HEY 拒绝的发送操作(通常是账户发送上限所致)会以 失败(退出码 7)。HEY 已将其保留为草稿,错误中会通过
not_delivered标识该草稿;之后可运行draft_id进行发送。不要重新发送该消息,否则会创建第二份草稿。hey draft send <draft_id> - 的响应会包含用于
--draft的草稿 ID;当 CLI 能够提供时,还会包含hey draft show|edit|send|delete,即 HEY 中该草稿的页面。用户也可以在任意 HEY 应用中审阅并发送草稿。app_url - 会为会话添加备注。该备注不会通过电子邮件发送,但也并非私密:有权访问会话的所有人都能看到它,包括 HEY for Domains 团队成员。响应会将这些人员列在
hey thread comment <topic_id> -m "..."中;visible_to会返回相同信息,但不会实际添加备注。若要向会话中的人员发送邮件,请使用--dry-run。hey reply - :发送前先运行
hey bulk-reply。误发的投递可在撤销窗口仍然开放时使用preview召回。hey bulk-reply undo <delivery_id>
Writing content
编写内容
Message bodies, drafts, thread notes, journal entries, snippets and contact notes are Markdown by default (, , , positional content, stdin and alike) and are converted to rich text on the way out; clip passages, event notes and time track notes are plain text. Each Markdown flag has an HTML twin (such as , , ) for raw HTML, and each pair is mutually exclusive. A fenced code block's language survives for the languages HEY highlights (Ruby, Python, JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Swift, HTML and CSS); any other is dropped.
-m--content--note$EDITOR--message-html--note-html--content-htmlEverything a calendar holds is a recording, and each kind has its own command: , , , , . Without a date, those commands read the account's time zone to find today; name the date to skip the account read.
hey eventhey todohey journalhey habithey timetrack消息正文、草稿、会话备注、日志条目、短文本和联系人备注默认使用 Markdown(、、、位置参数内容、标准输入和 均是如此),并在发送时转换为富文本;摘录段落、事件备注和时间追踪备注使用纯文本。每个 Markdown 标志都有一个对应的 HTML 标志(如 、、)用于原始 HTML,并且每对标志互斥。围栏代码块的语言标注会为 HEY 支持高亮的语言保留(Ruby、Python、JavaScript、TypeScript、Go、Rust、Java、C#、C++、PHP、Swift、HTML 和 CSS);其他语言则会被丢弃。
-m--content--note$EDITOR--message-html--note-html--content-html日历中的一切都是记录项,并且每种类型都有各自的命令:、、、、。未指定日期时,这些命令会读取账户所在时区以确定今天;指定日期则可跳过账户读取。
hey eventhey todohey journalhey habithey timetrackAdding to something written whole
向完整写入的内容中添加内容
hey contact note sethey journal write&&Contact note. When is , holds the whole note; the read checks the flag itself and fails when it is , so nothing is written:
note_markdown_losslesstruenote_markdownfalsebash
note=$(hey contact note show 12345 --jq 'if .data.note_markdown_lossless then .data.note_markdown else error("note_markdown would drop part of this note: change note_html with --note-html") end') &&
printf '%s\n\nMoved to the Lisbon office in March.\n' "$note" | hey contact note set 12345When it is , the note holds markup Markdown cannot carry. Add to the HTML instead:
falsebash
note=$(hey contact note show 12345 --jq '.data.note_html') &&
hey contact note set 12345 --note-html "$note<p>Moved to the Lisbon office in March.</p>"Journal entry. The same, with ; the read also fails for a day with no entry:
content_markdown_losslessbash
entry=$(hey journal read 2026-03-15 --jq 'if .data.content_markdown_lossless then .data.content_markdown else error("content_markdown would drop part of this entry, or there is none: change content with --content-html") end') &&
printf '%s\n\nBooked the venue for the second day.\n' "$entry" | hey journal write 2026-03-15bash
entry=$(hey journal read 2026-03-15 --jq '.data.content // error("no journal entry for this day")') &&
hey journal write 2026-03-15 --content-html "$entry<p>Booked the venue for the second day.</p>"hey contact note sethey journal write&&联系人备注。 当 为 时, 保存完整备注;读取操作会自行检查该标志,并在其为 时失败,因此不会写入任何内容:
note_markdown_losslesstruenote_markdownfalsebash
note=$(hey contact note show 12345 --jq 'if .data.note_markdown_lossless then .data.note_markdown else error("note_markdown would drop part of this note: change note_html with --note-html") end') &&
printf '%s\n\nMoved to the Lisbon office in March.\n' "$note" | hey contact note set 12345当该标志为 时,备注中包含 Markdown 无法承载的标记。应改为添加到 HTML 中:
falsebash
note=$(hey contact note show 12345 --jq '.data.note_html') &&
hey contact note set 12345 --note-html "$note<p>Moved to the Lisbon office in March.</p>"日志条目。 日志条目同理,使用 ;读取操作也会在当天没有条目时失败:
content_markdown_losslessbash
entry=$(hey journal read 2026-03-15 --jq 'if .data.content_markdown_lossless then .data.content_markdown else error("content_markdown would drop part of this entry, or there is none: change content with --content-html") end') &&
printf '%s\n\nBooked the venue for the second day.\n' "$entry" | hey journal write 2026-03-15bash
entry=$(hey journal read 2026-03-15 --jq '.data.content // error("no journal entry for this day")') &&
hey journal write 2026-03-15 --content-html "$entry<p>Booked the venue for the second day.</p>"Authentication
认证
Data commands use the credentials HEY already stores and refresh expiring OAuth tokens automatically. Run the requested data command without a login preflight.
If a data command returns exit code 3 with , or fails with , authentication is unavailable to that process. On macOS under Codex, the sandbox can hide credentials that the HEY CLI stores in Keychain. Before reporting the task as blocked, use the harness's normal approval flow to retry once with elevated sandbox permission. Limit the escalation to this one read-only command. If the response's is , rerun only the exact command the user requested through a separate one-command approval. If is , report the task as blocked and tell the user to run in Terminal; do not run it for them unattended. If the status command fails instead, with a keyring error such as , the login is not the problem and will not fix it: report the task as blocked, relay the error's , and stop.
"code": "auth"could not read stored credentialshey auth status --jsondata.authenticatedtrueheydata.authenticatedfalsehey auth loginexit status 36hey auth loginhintNever run the macOS command to read Keychain contents, print or copy credentials, or move credentials into a file; never disable the sandbox globally; never set as an authentication workaround.
securityHEY_NO_KEYRING=1Piped, machine-output and non-TTY commands do not prompt for sign-in. When an agent harness runs commands under a PTY, set so a missing login returns the same actionable auth error instead of opening an interactive prompt.
HEY_NONINTERACTIVE=1数据命令使用 HEY 已存储的凭据,并自动刷新即将过期的 OAuth token。直接运行用户要求的数据命令,不要预先执行登录。
如果数据命令返回退出码 3 且包含 ,或者提示 ,则说明该进程无法使用认证。在 macOS 的 Codex 环境中,沙箱可能会隐藏 HEY CLI 存储在 Keychain 中的凭据。在将任务报告为受阻之前,使用 harness 的标准审批流程,在提升的沙箱权限下重试一次 。权限提升应严格限制为这一次只读命令。如果响应中的 为 ,则通过单独的一次命令审批,仅重新运行用户要求的确切 命令。如果 为 ,则将任务报告为受阻,并告知用户在 Terminal 中运行 ;不要在无人值守的情况下替用户运行。如果状态命令本身失败,并出现 等 keyring 错误,则问题并不在登录, 无法解决:应将任务报告为受阻,传达错误的 ,然后停止。
"code": "auth""could not read stored credentials"hey auth status --jsondata.authenticatedtrueheydata.authenticatedfalsehey auth loginexit status 36hey auth loginhint绝不要运行 macOS 命令来读取 Keychain 内容、打印或复制凭据,或将凭据移入文件;绝不要全局禁用沙箱;也绝不要将 设为认证绕过方案。
securityHEY_NO_KEYRING=1通过管道、机器输出以及非 TTY 执行的命令不会提示登录。当 agent harness 在 PTY 下运行命令时,设置 ,使缺少登录状态时返回同样可操作的认证错误,而不是打开交互式提示。
HEY_NONINTERACTIVE=1