diff options
| author | Kenneth Lien <kenneth@anthropic.com> | 2026-03-20 14:51:47 -0700 |
|---|---|---|
| committer | Kenneth Lien <kenneth@anthropic.com> | 2026-03-20 14:51:47 -0700 |
| commit | 6d0053f69e717a8d960d8e2e4ba55878473aa2d3 (patch) | |
| tree | 4161dc02f3f924237ece237e4b13eae0d5173bda /external_plugins | |
| parent | 252577f8de4c3f874660b93858972a087716e0b4 (diff) | |
Add IMESSAGE_APPEND_SIGNATURE env var (default true)
Diffstat (limited to 'external_plugins')
| -rw-r--r-- | external_plugins/imessage/README.md | 9 | ||||
| -rw-r--r-- | external_plugins/imessage/server.ts | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/external_plugins/imessage/README.md b/external_plugins/imessage/README.md index 73ef3c13..dab93202 100644 --- a/external_plugins/imessage/README.md +++ b/external_plugins/imessage/README.md @@ -17,7 +17,7 @@ If you click Don't Allow, or the prompt never appears, grant it manually: **Syst These are Claude Code commands — run `claude` to start a session first. -Install the plugin. No env vars needed. +Install the plugin. No env vars required. ``` /plugin install imessage@claude-plugins-official ``` @@ -57,6 +57,13 @@ Handles are phone numbers (`+15551234567`) or Apple ID emails (`them@icloud.com` | **History & search** | Direct SQLite queries against `chat.db`. Full history — not just messages since the server started. | | **Attachments** | `chat.db` stores absolute filesystem paths. The first inbound image per message is surfaced to the assistant as a local path it can `Read`. Outbound attachments send as separate messages after the text. | +## Environment variables + +| Variable | Default | Effect | +| --- | --- | --- | +| `IMESSAGE_APPEND_SIGNATURE` | `true` | Appends `\nSent by Claude` to outbound messages. Set to `false` to disable. | +| `IMESSAGE_ACCESS_MODE` | — | Set to `static` to disable runtime pairing and read `access.json` only. | + ## Access control See **[ACCESS.md](./ACCESS.md)** for DM policies, groups, self-chat, delivery config, skill commands, and the `access.json` schema. diff --git a/external_plugins/imessage/server.ts b/external_plugins/imessage/server.ts index d208a16c..190a5ce9 100644 --- a/external_plugins/imessage/server.ts +++ b/external_plugins/imessage/server.ts @@ -30,6 +30,8 @@ import { homedir } from 'os' import { join, basename, sep } from 'path' const STATIC = process.env.IMESSAGE_ACCESS_MODE === 'static' +const APPEND_SIGNATURE = process.env.IMESSAGE_APPEND_SIGNATURE !== 'false' +const SIGNATURE = '\nSent by Claude' const CHAT_DB = join(homedir(), 'Library', 'Messages', 'chat.db') const STATE_DIR = join(homedir(), '.claude', 'channels', 'imessage') @@ -550,6 +552,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async req => { const limit = Math.max(1, Math.min(access.textChunkLimit ?? MAX_CHUNK_LIMIT, MAX_CHUNK_LIMIT)) const mode = access.chunkMode ?? 'length' const chunks = chunk(text, limit, mode) + if (APPEND_SIGNATURE && chunks.length > 0) chunks[chunks.length - 1] += SIGNATURE let sent = 0 for (let i = 0; i < chunks.length; i++) { |
