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:
  1. Infer the deepest plausible leaf command from the user's words.
  2. 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
  3. 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
  4. Treat the leaf's
    short
    ,
    long
    ,
    agent_notes
    and
    flags
    as the source of truth. Do not guess positional arguments, flags, accepted values, or limits.
  5. Run with an explicit output mode, then read structured errors before deciding what to do next.
Leaf help is cheap; root help and
hey commands --json
print the whole catalog and are not. Global flags (
--json
,
--jq
,
--quiet
,
--account
,
--stats
) apply wherever a command supports them.
对于每项任务:
  1. 根据用户的措辞,推断出层级最深且最有可能存在的叶子命令。
  2. 除非该命令的参数和标志已由此对话中的某个工具结果确定,否则在运行前读取该叶子命令的帮助信息:
    bash
    hey <group> <subcommand> --agent --help
  3. 如果叶子命令不存在,则读取它最近的父级分组。仅当顶层分组本身不明确时才读取根级帮助信息:
    bash
    hey <group> --agent --help   # fallback
    hey --agent --help           # last resort
    hey commands --json          # every command with its agent_notes
  4. 将叶子命令的
    short
    、
    long
    、
    agent_notes
    和
    flags
    视为事实来源。不要猜测位置参数、标志、可接受的值或限制。
  5. 以明确的输出模式运行,然后读取结构化错误,再决定下一步。
叶子命令帮助信息的开销很低;而根级帮助信息和
hey commands --json
会打印整个命令目录,开销较高。全局标志(
--json
、
--jq
、
--quiet
、
--account
、
--stats
)适用于支持它们的任何命令。

Non-negotiable rules

不可违背的规则

  1. Choose the right structured output. Use
    --jq '<expression>'
    to filter or extract fields and
    --json
    for the full response. Never pipe to an external
    jq
    ;
    --jq
    is built in and implies
    --json
    .
  2. 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
    hey auth status --json
    when an explicit authentication check is needed (it reports stored credentials and does not contact HEY). Never run
    hey auth login
    unattended; use it only for interactive recovery with the user present.
  3. Linked mail accounts share one login. Use
    hey account list --json
    , then
    --account <id|all>
    when a task must target one account.
  4. Local HEY configuration requires human trust. Never run
    hey config trust-local
    without the user's explicit approval.
  5. Never resend a send that failed with
    not_delivered
    .
    See Sending.
  6. Confirm box item mutations. See IDs: HEY does not report IDs that matched nothing.
  1. 选择正确的结构化输出。 使用
    --jq '<expression>'
    筛选或提取字段,使用
    --json
    获取完整响应。绝不要管道到外部
    jq
    ;
    --jq
    是内置的,并隐含启用
    --json
    。
  2. 复用已存储的认证信息。 直接运行用户要求的数据命令;它会使用存储的凭据,并自动刷新即将过期的 OAuth token。如果返回认证错误,请先遵循认证中的重试步骤,再将任务报告为受阻。需要显式检查认证状态时,使用
    hey auth status --json
    (它会报告存储的凭据,且不会联系 HEY)。绝不要在无人值守的情况下运行
    hey auth login
    ;仅在用户在场时将其用于交互式恢复。
  3. 关联的邮件账户共用同一登录状态。 使用
    hey account list --json
    ,然后在任务必须指向某个账户时使用
    --account <id|all>
    。
  4. 本地 HEY 配置需要用户明确信任。 未经用户明确批准,绝不要运行
    hey config trust-local
    。
  5. 绝不重新发送以
    not_delivered
    失败的发送操作。
    参见发送。
  6. 确认邮箱项目变更操作。 参见 IDs:HEY 不会报告未匹配到任何内容的 ID。

Output

输出

--jq
filters the full JSON success envelope, so result data is under
.data
. String results print as plain text; objects and arrays print as formatted JSON. Use
--quiet --jq
when the expression should run against result data directly. Errors keep their complete structured envelope. Commands with raw output of their own (
auth token
,
shell-completion generate
,
setup
,
skill
,
tui
,
--version
, and
timetrack export
without
--output
) reject
--jq
.
hey watch
writes one raw JSON event per line with no envelope and does not apply
--jq
.
bash
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
    null
    , so
    .data[]
    is safe on a listing that found nothing.
  • A field HEY's answer leaves out is left out, never guessed. A posting's
    seen
    is present only when true, so test
    .seen != true
    for unseen.
  • --ids-only
    prints one ID per line and
    --count
    a bare number. They work on listings: every
    list
    command, the thread listings,
    hey workflow view
    ,
    hey search
    ,
    hey screener history
    ,
    hey event day|week
    ,
    hey timetrack categories
    ,
    hey attachment list
    and
    hey thread read
    (its entries, read from the index without bodies). Both answer for what was read, which is the first page unless
    --all
    or
    --limit
    reads more, and not every listing warns that more pages exist;
    hey screener list --count
    is the exception and counts the whole queue. On thread listings they count the postings, not the box, label or contact around them.
  • --all
    stops at a page cap, which each listing's help names. A capped read says where to continue:
    next_page
    for a cursor listing such as
    hey box view
    , or the
    notice
    , naming the
    --page
    value, for a numbered one such as
    hey search
    or
    hey contact list
    . Continue from there rather than treating the list as complete.
  • --html
    writes the original HTML of
    hey thread read
    ,
    hey journal read
    and a contact's private note to a pipe or file; a terminal is refused.
--jq
过滤器会筛选完整的 JSON 成功封装,因此结果数据位于
.data
下。字符串结果以纯文本打印;对象和数组以格式化 JSON 打印。当表达式应直接针对结果数据运行时,使用
--quiet --jq
。错误会保留完整的结构化封装。带有自身原始输出的命令(
auth token
、
shell-completion generate
、
setup
、
skill
、
tui
、
--version
,以及未指定
--output
的
timetrack export
)会拒绝
--jq
。
hey watch
每行写入一个原始 JSON 事件,没有封装,也不应用
--jq
。
bash
hey box list --jq '.data[] | {id, name}'
hey search "quarterly planning" --jq '.data[].topic_id'
hey box list --quiet --jq '.[].name'
  • 空结果为空数组而不是
    null
    ,因此即使列表没有找到任何内容,使用
    .data[]
    也是安全的。
  • HEY 响应中省略的字段会被直接省略,绝不能猜测。邮件条目的
    seen
    仅在为 true 时出现,因此使用
    .seen != true
    检测未读项。
  • --ids-only
    每行打印一个 ID,
    --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
    、
    hey journal read
    以及联系人私密备注的原始 HTML 写入管道或文件;目标为终端时会被拒绝。

IDs

IDs

Every email thread has two IDs:
id
, its box item ID (one posting in one box), and
topic_id
, its thread ID. Each posting in a thread listing has
id
,
topic_id
,
kind
(
bundle
for a bundle row),
name
(subject),
created_at
and
app_url
; a thread row also has
contacts
,
summary
and
visible_entry_count
.
  • Box item ID (
    id
    ):
    hey seen
    ,
    unseen
    ,
    move
    ,
    label add|remove|create
    ,
    trash
    ,
    spam
    ,
    ignore
    ,
    stop-ignoring
    ,
    bubble up|pop
    ,
    set-aside group
    ,
    bulk-reply
    and
    bundle view
    .
  • Thread ID (
    topic_id
    ):
    hey thread read|update|comment
    ,
    share
    ,
    unshare
    ,
    attachment list
    ,
    reply
    ,
    forward
    ,
    compose --thread-id
    ,
    collection add|remove
    and
    workflow add|move|remove
    .
  • Entry ID: an entry's
    id
    from
    hey thread read
    ;
    hey clip create
    takes it, and the passage must appear in that message's text.
  • Contact ID from
    hey contact list
    or contact data, clearance ID from
    hey screener list
    (which also gives the
    topic_id
    of the thread to read before deciding), box ID from
    hey box list
    , label ID from
    hey label list
    . Never substitute one kind for another, or an email address for a contact ID.
Thread listings (
hey box view
,
label view
,
collection view
,
bundle view
,
contact threads
,
search
) carry both IDs, with two exceptions: a bundle row can omit
topic_id
, and a search result omits
id
when you have no box item for its thread.
Passing 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.
hey trash
,
spam
,
label add|remove|create
and
bubble up|pop
answer
not_found
only when none match;
hey seen
,
unseen
,
move
,
ignore
,
stop-ignoring
and
set-aside group create|add|remove
never check (
group create
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
topic_id
that happens to equal one of your box item IDs acts on an unrelated thread; likewise a box item ID given to
hey thread read
can read an unrelated thread. Confirm rather than trust the envelope:
bash
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
match
with
next_page
still set means the box is larger than
--all
reads: continue with
--page <next_page>
rather than calling it a non-match.
Bundle rows. A posting whose
kind
is
bundle
rolls one sender's mail into one row and names the sender, not a thread. It carries
topic_id
only while it holds exactly one unseen thread. Never pass a bundle row's
id
to
hey thread read
.
hey bundle view <id>
lists its unseen threads with their
topic_id
;
hey contact threads <contact_id>
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
hey contact bundle|unbundle <contact_id>
.
每个邮件会话都有两个 ID:
id
,即其邮箱项目 ID(位于一个邮箱中的一个邮件条目);以及
topic_id
,即其会话 ID。会话列表中的每个邮件条目都有
id
、
topic_id
、
kind
(bundle 行对应
bundle
)、
name
(主题)、
created_at
和
app_url
;会话行还包含
contacts
、
summary
和
visible_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
    ;
    hey clip create
    接受该 ID,并且摘录内容必须出现在该邮件正文中。
  • 来自
    hey contact list
    或联系人数据的 Contact ID,来自
    hey screener list
    的 clearance ID(该命令还会提供需要在作出决定前读取的会话
    topic_id
    ),来自
    hey box list
    的 box ID,以及来自
    hey label list
    的 label ID。绝不能用一种 ID 替代另一种,也不能用电子邮件地址替代 Contact ID。
会话列表(
hey box view
、
label view
、
collection view
、
bundle view
、
contact threads
、
search
)同时包含两种 ID,但有两个例外:bundle 行可能省略
topic_id
;如果没有该会话对应的邮箱项目,搜索结果会省略
id
。
传入错误类型的 ID 不会被自动重定向。未匹配的 ID 不会被报告:HEY 只会检查调用中的某个邮箱项目 ID 是否属于你,然后会对每一个匹配的 ID 执行更改。
hey trash
、
spam
、
label add|remove|create
和
bubble up|pop
仅在没有任何 ID 匹配时返回
not_found
;
hey seen
、
unseen
、
move
、
ignore
、
stop-ignoring
和
set-aside group create|add|remove
则完全不检查(
group create
没有匹配的 ID 时会留下一个空组)。因此,混合批次中的部分成功会被作为整个批次的成功来报告,拼写错误会被静默跳过;某个恰好等于你邮箱项目 ID 的
topic_id
会作用于无关会话;同样,将邮箱项目 ID 传给
hey thread read
也可能读取无关会话。必须进行确认,而不能信任响应封装:
bash
hey box view imbox --json --all --jq '{notice, next_page: .data.next_page, match: [.data.postings[] | select(.id == 12345) | {id, topic_id, seen}]}'
执行标记操作后应进行确认,移动操作后则应读取目标邮箱。如果
match
为空但仍设置了
next_page
,说明邮箱内容超过了
--all
的读取范围:应继续使用
--page <next_page>
,而不能认定其未匹配。
Bundle 行。
kind
为
bundle
的邮件条目会将同一发件人的邮件合并为一行,并列出发件人而不是会话。只有当它恰好包含一个未读会话时,才会携带
topic_id
。绝不要把 bundle 行的
id
传给
hey thread read
。
hey bundle view <id>
会列出其未读会话及其
topic_id
;
hey contact threads <contact_id>
会列出与该发件人的所有会话,无论已读还是未读,而且这是读取 bundle 内邮件后唯一能列出所有相关会话的地方。使用
hey contact bundle|unbundle <contact_id>
更改分组方式。

Sending

发送

  • Writing an email for a person goes draft, review, send. Save it with
    --draft
    on
    compose
    or
    reply
    , show the person its From, To, Cc, Bcc, Subject and Body in the conversation (
    hey draft show <id> --json
    reads it back), change it with
    hey draft edit <id>
    as they ask, and run
    hey draft send <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,
    compose
    or
    reply
    without
    --draft
    sends it in one step.
  • A send (
    compose
    ,
    reply
    ,
    forward
    ,
    draft send
    ) answers the new message's
    id
    and the
    topic_id
    of the thread it landed on; read it with
    hey thread read <topic_id>
    .
  • delayed: true
    means Undo Send is still holding it, and HEY leaves it out of its thread until it goes out:
    hey thread read
    shows the thread without it, or answers
    not_found
    for a thread it started. Wait and read again rather than treating the send as lost.
  • A send HEY refused (usually the account's sending limit) fails with
    not_delivered
    (exit 7). HEY kept it as a draft, named by
    draft_id
    in the error;
    hey draft send <draft_id>
    sends it later. Do not resend the message; that makes a second draft.
  • A
    --draft
    answer carries the draft ID for
    hey draft show|edit|send|delete
    and, when the CLI can name it,
    app_url
    , the draft's page in HEY. The person can also review and send it from any HEY app.
  • hey thread comment <topic_id> -m "..."
    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
    visible_to
    ;
    --dry-run
    answers the same without adding anything. To mail the people on a thread, use
    hey reply
    .
  • hey bulk-reply
    : run
    preview
    before
    send
    . A delivery sent by mistake can be recalled with
    hey bulk-reply undo <delivery_id>
    while the window is open.
  • 为用户撰写邮件时,应走“草稿、审阅、发送”流程。 使用
    compose
    或
    reply
    的
    --draft
    保存草稿,在对话中向用户展示 From、To、Cc、Bcc、Subject 和 Body(使用
    hey draft show <id> --json
    读回草稿),根据用户要求使用
    hey draft edit <id>
    修改,并在用户表示要发送时运行
    hey draft send <id>
    。用户无需打开 HEY 即可审阅。当用户明确要求直接发送消息时,不带
    --draft
    的
    compose
    或
    reply
    会一步完成发送。
  • 发送操作(
    compose
    、
    reply
    、
    forward
    、
    draft send
    )会返回新消息的
    id
    以及其所属会话的
    topic_id
    ;使用
    hey thread read <topic_id>
    读取。
  • delayed: true
    表示 Undo Send 仍在暂缓该消息,并且 HEY 会在消息实际发出前将其排除在会话之外:
    hey thread read
    会显示不包含该消息的会话,或者对由该消息创建的会话返回
    not_found
    。应等待并再次读取,而不能将发送视为丢失。
  • HEY 拒绝的发送操作(通常是账户发送上限所致)会以
    not_delivered
    失败(退出码 7)。HEY 已将其保留为草稿,错误中会通过
    draft_id
    标识该草稿;之后可运行
    hey draft send <draft_id>
    进行发送。不要重新发送该消息,否则会创建第二份草稿。
  • --draft
    的响应会包含用于
    hey draft show|edit|send|delete
    的草稿 ID;当 CLI 能够提供时,还会包含
    app_url
    ,即 HEY 中该草稿的页面。用户也可以在任意 HEY 应用中审阅并发送草稿。
  • hey thread comment <topic_id> -m "..."
    会为会话添加备注。该备注不会通过电子邮件发送,但也并非私密:有权访问会话的所有人都能看到它,包括 HEY for Domains 团队成员。响应会将这些人员列在
    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 (
-m
,
--content
,
--note
, positional content, stdin and
$EDITOR
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
--message-html
,
--note-html
,
--content-html
) 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.
Everything a calendar holds is a recording, and each kind has its own command:
hey event
,
hey todo
,
hey journal
,
hey habit
,
hey timetrack
. Without a date, those commands read the account's time zone to find today; name the date to skip the account read.
消息正文、草稿、会话备注、日志条目、短文本和联系人备注默认使用 Markdown(
-m
、
--content
、
--note
、位置参数内容、标准输入和
$EDITOR
均是如此),并在发送时转换为富文本;摘录段落、事件备注和时间追踪备注使用纯文本。每个 Markdown 标志都有一个对应的 HTML 标志(如
--message-html
、
--note-html
、
--content-html
)用于原始 HTML,并且每对标志互斥。围栏代码块的语言标注会为 HEY 支持高亮的语言保留(Ruby、Python、JavaScript、TypeScript、Go、Rust、Java、C#、C++、PHP、Swift、HTML 和 CSS);其他语言则会被丢弃。
日历中的一切都是记录项,并且每种类型都有各自的命令:
hey event
、
hey todo
、
hey journal
、
hey habit
、
hey timetrack
。未指定日期时,这些命令会读取账户所在时区以确定今天;指定日期则可跳过账户读取。

Adding to something written whole

向完整写入的内容中添加内容

hey contact note set
and
hey journal write
replace the whole note or entry; there is no append. To add, read it, change it, and write all of it back. Keep the
&&
: a failed read must not go on to write. The read and the write are not atomic, so write straight after reading.
Contact note. When
note_markdown_lossless
is
true
,
note_markdown
holds the whole note; the read checks the flag itself and fails when it is
false
, so nothing is written:
bash
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
When it is
false
, the note holds markup Markdown cannot carry. Add to the HTML instead:
bash
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
content_markdown_lossless
; the read also fails for a day with no entry:
bash
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-15
bash
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 set
和
hey journal write
会替换整条备注或条目;不支持追加。若要添加内容,请先读取、修改,再将全部内容写回。保留
&&
:读取失败时不得继续写入。读取和写入不是原子操作,因此读取后应立即写入。
联系人备注。 当
note_markdown_lossless
为
true
时,
note_markdown
保存完整备注;读取操作会自行检查该标志,并在其为
false
时失败,因此不会写入任何内容:
bash
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
当该标志为
false
时,备注中包含 Markdown 无法承载的标记。应改为添加到 HTML 中:
bash
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_lossless
;读取操作也会在当天没有条目时失败:
bash
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-15
bash
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
"code": "auth"
, or fails with
could not read stored credentials
, 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
hey auth status --json
once with elevated sandbox permission. Limit the escalation to this one read-only command. If the response's
data.authenticated
is
true
, rerun only the exact
hey
command the user requested through a separate one-command approval. If
data.authenticated
is
false
, report the task as blocked and tell the user to run
hey auth login
in Terminal; do not run it for them unattended. If the status command fails instead, with a keyring error such as
exit status 36
, the login is not the problem and
hey auth login
will not fix it: report the task as blocked, relay the error's
hint
, and stop.
Never run the macOS
security
command to read Keychain contents, print or copy credentials, or move credentials into a file; never disable the sandbox globally; never set
HEY_NO_KEYRING=1
as an authentication workaround.
Piped, machine-output and non-TTY commands do not prompt for sign-in. When an agent harness runs commands under a PTY, set
HEY_NONINTERACTIVE=1
so a missing login returns the same actionable auth error instead of opening an interactive prompt.
数据命令使用 HEY 已存储的凭据,并自动刷新即将过期的 OAuth token。直接运行用户要求的数据命令,不要预先执行登录。
如果数据命令返回退出码 3 且包含
"code": "auth"
,或者提示
"could not read stored credentials"
,则说明该进程无法使用认证。在 macOS 的 Codex 环境中,沙箱可能会隐藏 HEY CLI 存储在 Keychain 中的凭据。在将任务报告为受阻之前,使用 harness 的标准审批流程,在提升的沙箱权限下重试一次
hey auth status --json
。权限提升应严格限制为这一次只读命令。如果响应中的
data.authenticated
为
true
,则通过单独的一次命令审批,仅重新运行用户要求的确切
hey
命令。如果
data.authenticated
为
false
,则将任务报告为受阻,并告知用户在 Terminal 中运行
hey auth login
;不要在无人值守的情况下替用户运行。如果状态命令本身失败,并出现
exit status 36
等 keyring 错误,则问题并不在登录,
hey auth login
无法解决:应将任务报告为受阻,传达错误的
hint
,然后停止。
绝不要运行 macOS
security
命令来读取 Keychain 内容、打印或复制凭据,或将凭据移入文件;绝不要全局禁用沙箱;也绝不要将
HEY_NO_KEYRING=1
设为认证绕过方案。
通过管道、机器输出以及非 TTY 执行的命令不会提示登录。当 agent harness 在 PTY 下运行命令时,设置
HEY_NONINTERACTIVE=1
,使缺少登录状态时返回同样可操作的认证错误,而不是打开交互式提示。