iMessage
このコンテンツはまだ日本語訳がありません。
iMessage (legacy: imsg)
Section titled “iMessage (legacy: imsg)”The imsg integration is legacy and may be removed in a future release.
Status: legacy external CLI integration. Gateway spawns imsg rpc and communicates over JSON-RPC on stdio (no separate daemon/port).
Quick setup
Section titled “Quick setup”brew install steipete/tap/imsgimsg rpc --help </Step>
<Step title="Configure CoderClaw">{ channels: { imessage: { enabled: true, cliPath: "/usr/local/bin/imsg", dbPath: "/Users/<you>/Library/Messages/chat.db", }, },} </Step>
<Step title="Start gateway">coderclaw gateway </Step>
<Step title="Approve first DM pairing (default dmPolicy)">coderclaw pairing list imessagecoderclaw pairing approve imessage <CODE> Pairing requests expire after 1 hour. </Step></Steps>#!/usr/bin/env bashexec ssh -T gateway-host imsg "$@"Recommended config when attachments are enabled:{ channels: { imessage: { enabled: true, cliPath: "~/.coderclaw/scripts/imsg-ssh", remoteHost: "user@gateway-host", // used for SCP attachment fetches includeAttachments: true, }, },}If `remoteHost` is not set, CoderClaw attempts to auto-detect it by parsing the SSH wrapper script.Requirements and permissions (macOS)
Section titled “Requirements and permissions (macOS)”- Messages must be signed in on the Mac running
imsg. - Full Disk Access is required for the process context running CoderClaw/
imsg(Messages DB access). - Automation permission is required to send messages through Messages.app.
imsg chats --limit 1# orimsg send <handle> "test"Access control and routing
Section titled “Access control and routing”- `pairing` (default)- `allowlist`- `open` (requires `allowFrom` to include `"*"`)- `disabled`
Allowlist field: `channels.imessage.allowFrom`.
Allowlist entries can be handles or chat targets (`chat_id:*`, `chat_guid:*`, `chat_identifier:*`).- `allowlist` (default when configured)- `open`- `disabled`
Group sender allowlist: `channels.imessage.groupAllowFrom`.
Runtime fallback: if `groupAllowFrom` is unset, iMessage group sender checks fall back to `allowFrom` when available.
Mention gating for groups:
- iMessage has no native mention metadata- mention detection uses regex patterns (`agents.list[].groupChat.mentionPatterns`, fallback `messages.groupChat.mentionPatterns`)- with no configured patterns, mention gating cannot be enforced
Control commands from authorized senders can bypass mention gating in groups.Group-ish thread behavior:
Some multi-participant iMessage threads can arrive with `is_group=false`.If that `chat_id` is explicitly configured under `channels.imessage.groups`, CoderClaw treats it as group traffic (group gating + group session isolation).Deployment patterns
Section titled “Deployment patterns”Typical flow:
1. Create/sign in a dedicated macOS user.2. Sign into Messages with the bot Apple ID in that user.3. Install `imsg` in that user.4. Create SSH wrapper so CoderClaw can run `imsg` in that user context.5. Point `channels.imessage.accounts.<id>.cliPath` and `.dbPath` to that user profile.
First run may require GUI approvals (Automation + Full Disk Access) in that bot user session.- gateway runs on Linux/VM- iMessage + `imsg` runs on a Mac in your tailnet- `cliPath` wrapper uses SSH to run `imsg`- `remoteHost` enables SCP attachment fetches
Example:{ channels: { imessage: { enabled: true, cliPath: "~/.coderclaw/scripts/imsg-ssh", includeAttachments: true, dbPath: "/Users/bot/Library/Messages/chat.db", }, },}#!/usr/bin/env bashUse SSH keys so both SSH and SCP are non-interactive.Each account can override fields such as `cliPath`, `dbPath`, `allowFrom`, `groupPolicy`, `mediaMaxMb`, and history settings.Media, chunking, and delivery targets
Section titled “Media, chunking, and delivery targets”- `chat_id:123` (recommended for stable routing)- `chat_guid:...`- `chat_identifier:...`
Handle targets are also supported:
- `imessage:+1555...`- `sms:+1555...`imsg chats --limit 20Config writes
Section titled “Config writes”iMessage allows channel-initiated config writes by default (for /config set|unset when commands.config: true).
Disable:
{ channels: { imessage: { configWrites: false, }, },}Troubleshooting
Section titled “Troubleshooting”imsg rpc --helpcoderclaw channels status --probeIf probe reports RPC unsupported, update `imsg`.- `channels.imessage.dmPolicy`- `channels.imessage.allowFrom`- pairing approvals (`coderclaw pairing list imessage`)- `channels.imessage.groupPolicy`- `channels.imessage.groupAllowFrom`- `channels.imessage.groups` allowlist behavior- mention pattern configuration (`agents.list[].groupChat.mentionPatterns`)- `channels.imessage.remoteHost`- SSH/SCP key auth from the gateway host- remote path readability on the Mac running Messagesimsg chats --limit 1imsg send <handle> "test"Confirm Full Disk Access + Automation are granted for the process context that runs CoderClaw/`imsg`.