worker

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Worker Skill

工作者技能

This skill is for a Codex session that was started as an OMX Team worker (a tmux pane spawned by
$team
).
本技能适用于作为OMX团队工作者启动的Codex会话(由
$team
生成的tmux窗格)。

Identity

身份

You MUST be running with
OMX_TEAM_WORKER
set. It looks like:
<team-name>/worker-<n>
Example:
alpha/worker-2
你必须在已设置
OMX_TEAM_WORKER
的环境下运行,格式如下:
<team-name>/worker-<n>
示例:
alpha/worker-2

Load Worker Skill Path (Claude/Codex)

加载工作者技能路径(Claude/Codex)

When a worker inbox tells you to load this skill, resolve the first existing path:
  1. ${CODEX_HOME:-~/.codex}/skills/worker/SKILL.md
  2. ~/.codex/skills/worker/SKILL.md
  3. <leader_cwd>/.codex/skills/worker/SKILL.md
  4. <leader_cwd>/skills/worker/SKILL.md
    (repo fallback)
当工作者收件箱要求你加载本技能时,按顺序查找第一个存在的路径:
  1. ${CODEX_HOME:-~/.codex}/skills/worker/SKILL.md
  2. ~/.codex/skills/worker/SKILL.md
  3. <leader_cwd>/.codex/skills/worker/SKILL.md
  4. <leader_cwd>/skills/worker/SKILL.md
    (仓库兜底路径)

Startup Protocol (ACK)

启动协议(ACK)

  1. Parse
    OMX_TEAM_WORKER
    into:
    • teamName
      (before the
      /
      )
    • workerName
      (after the
      /
      , usually
      worker-<n>
      )
  2. Send a startup ACK to the lead mailbox before task work:
    • Recipient worker id:
      leader-fixed
    • Body: one short deterministic line (recommended:
      ACK: <workerName> initialized
      ).
  3. After ACK, proceed to your inbox instructions.
The lead will see your message in:
<team_state_root>/team/<teamName>/mailbox/leader-fixed.json
Use CLI interop:
  • omx team api send-message --input <json> --json
    with
    {team_name, from_worker, to_worker:"leader-fixed", body}
Copy/paste template:
bash
omx team api send-message --input "{\"team_name\":\"<teamName>\",\"from_worker\":\"<workerName>\",\"to_worker\":\"leader-fixed\",\"body\":\"ACK: <workerName> initialized\"}" --json
  1. 解析
    OMX_TEAM_WORKER
    得到两个字段:
    • teamName
      /
      前面的部分)
    • workerName
      /
      后面的部分,通常为
      worker-<n>
  2. 在开始处理任务前,向负责人邮箱发送启动ACK:
    • 接收方工作者ID:
      leader-fixed
    • 内容:一行简短固定格式的内容(推荐:
      ACK: <workerName> initialized
  3. 发送ACK后,再按照收件箱的指令执行后续操作。
负责人会在以下路径看到你的消息:
<team_state_root>/team/<teamName>/mailbox/leader-fixed.json
使用CLI互操作命令:
  • 执行
    omx team api send-message --input <json> --json
    ,参数为
    {team_name, from_worker, to_worker:"leader-fixed", body}
复制粘贴模板:
bash
omx team api send-message --input "{\"team_name\":\"<teamName>\",\"from_worker\":\"<workerName>\",\"to_worker\":\"leader-fixed\",\"body\":\"ACK: <workerName> initialized\"}" --json

Inbox + Tasks

收件箱与任务

  1. Resolve canonical team state root in this order:
    1. OMX_TEAM_STATE_ROOT
      env
    2. worker identity
      team_state_root
    3. team config/manifest
      team_state_root
    4. local cwd fallback (
      .omx/state
      )
  2. Read your inbox:
    <team_state_root>/team/<teamName>/workers/<workerName>/inbox.md
  3. Pick the first unblocked task assigned to you.
  4. Read the task file:
    <team_state_root>/team/<teamName>/tasks/task-<id>.json
    (example:
    task-1.json
    )
  5. Task id format:
    • The MCP/state API uses the numeric id (
      "1"
      ), not
      "task-1"
      .
    • Never use legacy
      tasks/{id}.json
      wording.
  6. Claim the task (do NOT start work without a claim) using claim-safe lifecycle CLI interop (
    omx team api claim-task --json
    ).
  7. Do the work.
  8. Complete/fail the task via lifecycle transition CLI interop (
    omx team api transition-task-status --json
    ) from
    in_progress
    to
    completed
    or
    failed
    .
    • Do NOT directly write lifecycle fields (
      status
      ,
      owner
      ,
      result
      ,
      error
      ) in task files.
  9. Use
    omx team api release-task-claim --json
    only for rollback/requeue to
    pending
    (not for completion).
  10. Update your worker status:
    <team_state_root>/team/<teamName>/workers/<workerName>/status.json
    with
    {"state":"idle", ...}
  1. 按以下优先级解析规范的团队状态根目录:
    1. OMX_TEAM_STATE_ROOT
      环境变量
    2. 工作者身份配置中的
      team_state_root
    3. 团队配置/清单中的
      team_state_root
    4. 本地当前工作目录兜底路径(
      .omx/state
  2. 读取你的收件箱:
    <team_state_root>/team/<teamName>/workers/<workerName>/inbox.md
  3. 选取分配给你的第一个未阻塞的任务。
  4. 读取任务文件:
    <team_state_root>/team/<teamName>/tasks/task-<id>.json
    (示例:
    task-1.json
  5. 任务ID格式说明:
    • MCP/状态API使用数字ID(
      "1"
      ),而非
      "task-1"
    • 禁止使用旧版的
      tasks/{id}.json
      写法。
  6. 认领任务(未认领前禁止开始工作),使用支持安全认领生命周期的CLI互操作命令(
    omx team api claim-task --json
    )。
  7. 执行任务工作。
  8. 通过生命周期切换CLI互操作命令(
    omx team api transition-task-status --json
    )将任务状态从
    in_progress
    更新为
    completed
    failed
    ,标记任务完成/失败。
    • 禁止直接修改任务文件中的生命周期字段(
      status
      owner
      result
      error
      )。
  9. 仅当需要回滚/将任务重新排入
    pending
    队列时使用
    omx team api release-task-claim --json
    (不可用于标记任务完成)。
  10. 更新你的工作者状态: 向
    <team_state_root>/team/<teamName>/workers/<workerName>/status.json
    写入
    {"state":"idle", ...}

Mailbox

邮箱

Check your mailbox for messages:
<team_state_root>/team/<teamName>/mailbox/<workerName>.json
When notified, read messages and follow any instructions. Use short ACK replies when appropriate.
Note: leader dispatch is state-first. The durable queue lives at:
<team_state_root>/team/<teamName>/dispatch/requests.json
Hooks/watchers may nudge you after mailbox/inbox state is already written.
Use CLI interop:
  • omx team api mailbox-list --json
    to read
  • omx team api mailbox-mark-delivered --json
    to acknowledge delivery
Copy/paste templates:
bash
omx team api mailbox-list --input "{\"team_name\":\"<teamName>\",\"worker\":\"<workerName>\"}" --json
omx team api mailbox-mark-delivered --input "{\"team_name\":\"<teamName>\",\"worker\":\"<workerName>\",\"message_id\":\"<MESSAGE_ID>\"}" --json
在以下路径查看你的邮箱消息:
<team_state_root>/team/<teamName>/mailbox/<workerName>.json
收到通知时,读取消息并遵循所有指令,合适情况下发送简短的ACK回复。
注意:负责人调度以状态为优先级,持久化队列存储在:
<team_state_root>/team/<teamName>/dispatch/requests.json
钩子/监听器会在邮箱/收件箱状态写入完成后提醒你。
使用CLI互操作命令:
  • 执行
    omx team api mailbox-list --json
    读取消息
  • 执行
    omx team api mailbox-mark-delivered --json
    确认消息已送达
复制粘贴模板:
bash
omx team api mailbox-list --input "{\"team_name\":\"<teamName>\",\"worker\":\"<workerName>\"}" --json
omx team api mailbox-mark-delivered --input "{\"team_name\":\"<teamName>\",\"worker\":\"<workerName>\",\"message_id\":\"<MESSAGE_ID>\"}" --json

Dispatch Discipline (state-first)

调度规则(状态优先)

Worker sessions should treat team state + CLI interop as the source of truth.
  • Prefer inbox/mailbox/task state and
    omx team api ... --json
    operations.
  • Do not rely on ad-hoc tmux keystrokes as a primary delivery channel.
  • If a manual trigger arrives (for example
    tmux send-keys
    nudge), treat it only as a prompt to re-check state and continue through the normal claim-safe lifecycle.
工作者会话应当将团队状态+CLI互操作作为唯一可信源。
  • 优先使用收件箱/邮箱/任务状态和
    omx team api ... --json
    操作。
  • 禁止将临时的tmux按键作为主要的指令传递渠道。
  • 如果收到手动触发指令(例如
    tmux send-keys
    提醒),仅将其作为重新检查状态的提示,仍需按照常规的安全认领生命周期流程执行。

Shutdown

关闭

If the lead sends a shutdown request, follow the shutdown inbox instructions exactly, write your shutdown ack file, then exit the Codex session.
如果负责人发送了关闭请求,严格遵循收件箱中的关闭指令,写入关闭ACK文件后退出Codex会话。