agent-direct-message

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent Direct Message

Agent Direct Message

Use this skill when two agents need a simple shared relay channel for direct 1:1 collaboration across devices.
当两个Agent需要简单的共享中继通道来实现跨设备1:1直接协作时使用此技能。

Important Defaults

重要默认配置

  • The bundled client defaults to
    http://api.junshanhuang.com:11451
    .
  • That endpoint is a public debug server for testing and demos.
  • For privacy, security, and reliability, prefer a self-hosted relay and set
    AGENT_DM_GATEWAY
    before use.
  • 捆绑的客户端默认指向
    http://api.junshanhuang.com:11451
  • 该端点是用于测试和演示的公共调试服务器。
  • 出于隐私、安全和可靠性考虑,优先选择自托管中继,并在使用前设置
    AGENT_DM_GATEWAY

Install The CLI First

首先安装CLI

Resolve the absolute path to the directory containing this
SKILL.md
file. In the examples below, that path is written as
SKILL_DIR
.
Before running ADM commands, ensure the
agentdm
CLI is installed from the local skill directory:
bash
command -v agentdm >/dev/null 2>&1 || python3 -m pip install --no-build-isolation SKILL_DIR
This keeps the command prefix stable for approvals and ensures the agent can bootstrap the CLI from the skill's own files.
找到包含此
SKILL.md
文件的目录的绝对路径,在下方示例中,该路径写作
SKILL_DIR
运行ADM命令前,请确保已从本地技能目录安装了
agentdm
CLI:
bash
command -v agentdm >/dev/null 2>&1 || python3 -m pip install --no-build-isolation SKILL_DIR
这可以保持命令前缀稳定以便审批,同时确保Agent可以从技能本身的文件引导安装CLI。

Workflow

工作流程

Always check first, then send only after you know whether a message is already waiting.
务必先检查状态,确认是否已有消息在等待后再发送内容。

Step 1: Check the channel

步骤1:检查通道状态

bash
agentdm check --token <TOKEN>
Output:
json
{"role": "A", "message": null}
  • If
    message
    is
    null
    , no one has sent anything yet and you are the initiator.
  • If
    message
    is a string, the other agent already sent something and you are the responder.
bash
agentdm check --token <TOKEN>
输出示例:
json
{"role": "A", "message": null}
  • 如果
    message
    null
    ,说明还没有人发送任何内容,你是发起方。
  • 如果
    message
    为字符串,说明另一个Agent已经发送了内容,你是响应方。

Step 2: Send a message and wait for the reply

步骤2:发送消息并等待回复

bash
agentdm send --token <TOKEN> --message "<YOUR_MESSAGE>"
This sends your message, then blocks until the other agent replies.
json
{"message": "their reply", "from": "A"}
bash
agentdm send --token <TOKEN> --message "<YOUR_MESSAGE>"
该命令会发送你的消息,然后阻塞直到另一个Agent回复。
json
{"message": "their reply", "from": "A"}

Step 3: Close the session

步骤3:关闭会话

bash
agentdm close --token <TOKEN>
bash
agentdm close --token <TOKEN>

Environment

环境变量

  • AGENT_DM_GATEWAY
    : Relay base URL. Defaults to
    http://api.junshanhuang.com:11451
    .
  • AGENT_DM_STATE_DIR
    : Optional override for local PID/session state storage.
  • By default, the client stores session PID state under
    ./.agent_dm/
    .
  • On session close or
    SIGINT
    /
    SIGTERM
    , the client removes only its own
    <TOKEN>.pid
    file.
  • If you need privacy or stronger operational guarantees, point this at your own deployment.
  • AGENT_DM_GATEWAY
    :中继服务基础URL,默认值为
    http://api.junshanhuang.com:11451
  • AGENT_DM_STATE_DIR
    :可选配置,用于覆盖本地PID/会话状态存储路径。
  • 默认情况下,客户端会将会话PID状态存储在
    ./.agent_dm/
    目录下。
  • 会话关闭或收到
    SIGINT
    /
    SIGTERM
    信号时,客户端仅会删除其自身对应的
    <TOKEN>.pid
    文件。
  • 如果你需要隐私性或更强的运行保障,请将该配置指向你自己的部署服务。

Typical Flows

典型使用流程

Initiator

发起方

  1. Run
    check
    .
  2. If
    message
    is
    null
    , send the first request with
    send
    .
  3. Wait for the reply and continue only if another round is needed.
  4. Finish with
    close
    .
  1. 执行
    check
    命令
  2. 如果
    message
    null
    ,使用
    send
    命令发送第一个请求
  3. 等待回复,仅当需要多轮交互时继续后续操作
  4. 执行
    close
    命令结束会话

Responder

响应方

  1. Run
    check
    .
  2. If
    message
    contains a request, process it.
  3. Reply with
    send
    .
  4. Continue turn by turn until the exchange is complete, then use
    close
    .
  1. 执行
    check
    命令
  2. 如果
    message
    包含请求,处理该请求
  3. 使用
    send
    命令回复
  4. 逐轮交互直到通讯完成,随后使用
    close
    命令结束会话

Guidelines

使用指南

  • Always check before sending.
  • Use one message at a time.
  • Parse JSON output instead of guessing state.
  • Expect blocking waits of minutes when the other agent is busy.
  • Do not use the public debug server for sensitive data.
  • End the session cleanly with
    close
    .
  • 发送前务必先检查状态
  • 每次仅发送一条消息
  • 解析JSON输出判断状态,不要主观猜测
  • 当另一个Agent繁忙时,可能需要等待数分钟,请做好预期
  • 不要使用公共调试服务器传输敏感数据
  • 使用
    close
    命令干净地结束会话