跳到主要内容

iMessage

通过 macOS 上的 imsg CLI 发送和接收 iMessage/SMS。

技能元数据

来源捆绑(默认安装)
路径skills/apple/imessage
版本1.0.0
作者Hermes Agent
许可证MIT
平台macos
标签iMessage, SMS, messaging, macOS, Apple

参考:完整 SKILL.md

信息

以下是 Hermes 在触发此技能时加载的完整技能定义。这是技能激活时代理所看到的指令。

iMessage

使用 imsg 通过 macOS 的 Messages.app 读取和发送 iMessage/SMS。

前提条件

  • macOS 且已登录 Messages.app
  • 安装:brew install steipete/tap/imsg
  • 授予终端完全磁盘访问权限(系统设置 → 隐私与安全性 → 完全磁盘访问权限)
  • 在提示时授予 Messages.app 自动化权限

何时使用

  • 用户要求发送 iMessage 或短信
  • 读取 iMessage 对话历史
  • 检查最近的 Messages.app 聊天
  • 发送给电话号码或 Apple ID

何时不使用

  • Telegram/Discord/Slack/WhatsApp 消息 → 使用相应的网关通道
  • 群聊管理(添加/移除成员)→ 不支持
  • 批量/群发消息 → 务必先与用户确认

快速参考

列出聊天

imsg chats --limit 10 --json

查看历史记录

# By chat ID
imsg history --chat-id 1 --limit 20 --json

# With attachments info
imsg history --chat-id 1 --limit 20 --attachments --json

发送消息

# Text only
imsg send --to "+14155551212" --text "Hello!"

# With attachment
imsg send --to "+14155551212" --text "Check this out" --file /path/to/image.jpg

# Force iMessage or SMS
imsg send --to "+14155551212" --text "Hi" --service imessage
imsg send --to "+14155551212" --text "Hi" --service sms

监听新消息

imsg watch --chat-id 1 --attachments

服务选项

  • --service imessage — 强制使用 iMessage(要求收件人拥有 iMessage)
  • --service sms — 强制使用 SMS(绿色气泡)
  • --service auto — 让 Messages.app 决定(默认)

规则

  1. 发送前务必确认收件人和消息内容
  2. 未经用户明确批准,切勿向陌生号码发送消息
  3. 附加文件前验证文件路径是否存在
  4. 不要发送垃圾消息 — 自我限制频率

示例工作流

用户:“给我妈发短信说我晚点到”

# 1. Find mom's chat
imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("Mom"))'

# 2. Confirm with user: "Found Mom at +1555123456. Send 'I'll be late' via iMessage?"

# 3. Send after confirmation
imsg send --to "+1555123456" --text "I'll be late"