Logo vun Add Imessage

Add Imessage

OrganisatiounBeléift
nanocoai
add-imessage

Add iMessage to NanoClaw — one channel, two backends. Local (this Mac's chat.db via the Chat SDK bridge; macOS + Full Disk Access) or Hosted iMessage (via photon.codes — native spectrum-ts with a device-login wizard; any OS, no Mac relay). Triggers on "add imessage", "connect imessage", "add photon", "imessage via photon", "native imessage".

Iwwersiicht

Editeurnanocoai
Repositorynanoclaw
Skill-Nummadd-imessage
Stären
30.9K
Forks
12.8K
Matgeliwwert Fichieren
3
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum nanocoai op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Add Imessage an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/nanocoai/nanoclaw/tree/main/.claude/skills/add-imessage
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nanocoai/nanoclaw.git /tmp/nanoclaw
mkdir -p .claude/skills
cp -r /tmp/nanoclaw/.claude/skills/add-imessage .claude/skills/add-imessage
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Add Imessage an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Add Imessage automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Add Imessage net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Add iMessage

NanoClaw talks to iMessage through a single imessage channel with two pluggable backends:

  • Local (this Mac) — the Chat SDK bridge over chat-adapter-imessage, reading this Mac's signed-in iMessage account (chat.db). macOS only; the Node binary needs Full Disk Access.
  • Hosted iMessage (via photon.codes) — a native adapter over Photon's spectrum-ts gRPC stream. The hosted service owns the iMessage line, so there's no Mac relay, webhook, or public URL. Works on any OS, and a device-login flow provisions everything for you.

Both register the same imessage channel type; only one runs per install. NanoClaw doesn't ship channels in trunk — this skill copies the unified imessage adapter in from the channels branch. Full reference: docs/imessage.md.

The mechanical steps under Apply carry nc: directive fences: an agent reads the prose and applies them, and a parser can apply them deterministically from the same document. Every directive is idempotent, so the whole skill is safe to re-run; anything a parser can't apply falls back to the prose beside it.

Apply

1. Choose a backend

Pick the backend first — it decides which package gets installed and which walkthrough runs below (the other backend's steps are skipped):

nc
How should iMessage run — `local` (this Mac's signed-in iMessage account; macOS only, needs Full Disk Access) or `hosted` (a managed line via photon.codes; works on any OS)?

The local backend only works on a Mac — it reads this machine's iMessage chat.db directly, and there is no such database off macOS. On any other OS, stop here and choose hosted instead; otherwise you'd write a local config that can never receive a message:

nc
[ "$(uname)" = Darwin ]

2. Copy the adapter

Fetch the channels branch and copy the unified iMessage adapter and its tests into src/channels/:

nc
src/channels/imessage.ts
src/channels/imessage.test.ts
src/channels/imessage-registration.test.ts

3. Register the adapter

Append the self-registration import to the channel barrel (skipped if the line is already present). This one line is the skill's only reach-in into core:

nc
import './imessage.js';

4. Install the chosen backend's package

Pinned to an exact version — the supply-chain policy rejects ranges and latest. Install only the chosen backend's package.

Local — the Chat SDK iMessage adapter. Its chat.db reader (@photon-ai/imessage-kit) brings its own better-sqlite3 12.x, which ships no prebuilt binary, and NanoClaw doesn't run dependency build scripts, so that copy can't open the database. First point the reader at NanoClaw's own prebuilt better-sqlite3 ($better-sqlite3 is pnpm's reference to the version NanoClaw pins). The reinstall applies it to an install that already has the adapter, since the step below skips a package that is already present:

nc
pnpm pkg set 'pnpm.overrides[@photon-ai/imessage-kit>better-sqlite3]=$better-sqlite3'
pnpm install --no-frozen-lockfile
nc
chat-adapter-imessage@0.1.1

Hosted — Photon's Spectrum SDK:

nc
spectrum-ts@11.0.0

Pin exactly. spectrum-ts ships breaking majors (v11 is what the adapter targets); don't @latest. NanoClaw's pnpm gate (minimumReleaseAge) requires a version ≥3 days old — both pins clear it. A fresher pin needs human sign-off before a minimumReleaseAgeExclude entry (CLAUDE.md → Supply Chain Security).

5. Build and validate

Build guards the typed createChatSdkBridge(...) core call used by the local backend, and the registration test proves the channel is wired:

nc
pnpm run build
nc
pnpm exec vitest run src/channels/imessage-registration.test.ts

Both must be clean. imessage-registration.test.ts imports the real channel barrel and asserts the registry contains imessage — it goes red if the import './imessage.js'; line is missing or the barrel fails to evaluate. The adapter loads neither backend's SDK at import (hosted spectrum-ts only in setup(), local chat-adapter-imessage only in the factory), so the test needs no package.

For the hosted backend, also run the full adapter suite — it includes an integration block that exercises the real installed spectrum-ts (version, exports, builders) and auto-skips when the package is absent:

nc
pnpm exec vitest run src/channels/imessage.test.ts

For the local backend, check that the chat.db reader's better-sqlite3 loads under Node. It fails with Could not locate the bindings file when that copy has no binary, meaning step 4's override didn't land: re-run that override step, then this check:

nc
node --input-type=module -e 'import { createRequire } from "node:module"; const kit = createRequire(import.meta.resolve("chat-adapter-imessage")).resolve("@photon-ai/imessage-kit"); const Database = createRequire(kit)("better-sqlite3"); new Database(":memory:").close();'

Local backend: Full Disk Access (macOS)

The adapter reads this Mac's chat.db, which requires Full Disk Access granted to the Node binary the host runs under. The Node path is buried deep (e.g. ~/.nvm/versions/node/v22.x.x/bin/node), so open its folder in Finder to make the drag-and-drop target obvious. Harmless off a desktop (SSH/headless) — it just no-ops:

nc
open "$(dirname "$(which node)")" 2>/dev/null || true

Then tell the user:

nc
Grant Full Disk Access to Node so iMessage can read your chat history:
1. Open System Settings > Privacy & Security > Full Disk Access.
2. Click +, then drag the "node" file from the Finder window that just opened.
3. Toggle it on, then come back here.

Stop and wait for the user to confirm Full Disk Access is granted before continuing.

Now select the local backend in .env. The configure script owns this upsert-and-remove (a plain set-if-absent env write can neither replace a stale value nor delete a key, and a lingering hosted selector would shadow the choice):

nc
bash setup/channels/imessage-configure.sh local

Hosted backend: device login (via photon.codes)

The provisioning flow needs the phone number you send iMessages from — it registers that number with your project so the hosted line recognises you:

nc
The phone number you iMessage from, in E.164 format — + followed by country code and number, no spaces or dashes (e.g. +14155551234).

Tell the user what's about to happen:

nc
Connect your hosted iMessage line (photon.codes):
1. A login URL and a short code will print below.
2. Open the URL in a browser, approve the device, and enter the code.
3. Setup then registers your number and prints the iMessage line Photon assigned to it. Send one message from your phone to that line — a number only enters routing after it has texted its line once.
4. Once the opt-in lands, setup finishes on its own and confirms your agent's iMessage number.

Run the device-login flow. It provisions the project, reuses its current secret (regenerating only when the API returns none), registers your number, prints the line to text and waits until that message opts the number in, and surfaces the iMessage number you'll use — writing PHOTON_PROJECT_ID + PHOTON_PROJECT_SECRET to .env and the assigned number to data/photon-auth.json:

nc
pnpm exec tsx scripts/photon-setup.ts setup --phone {{owner_handle}} --embedded

If the login times out, the code expired (~30 min) — re-run the step; a stored token is reused. Check state any time with pnpm exec tsx scripts/photon-setup.ts status.

Then select the hosted backend in .env — the Photon credentials already imply hosted, but the explicit selector avoids ambiguity if local keys linger:

nc
bash setup/channels/imessage-configure.sh hosted

Restart

Restart the service so it loads the iMessage adapter and the backend config you just wrote, and wait for its CLI socket before wiring:

nc
bash setup/lib/restart.sh

For the hosted backend, confirm the connection came up: grep "Photon channel connected" logs/nanoclaw.log | tail -1.

Resolve your iMessage handle

The agent greets you in the iMessage conversation tied to the handle you message from — that handle is both your identity and the conversation address. The hosted flow already collected it above; for the local backend, resolve it now (email works too — whatever iMessage recognises):

nc
The phone number or email you iMessage from — a +E.164 number (e.g. +14155551234) or an email / Apple ID (e.g. you@icloud.com).

Hosted first contact: text your agent's iMessage number once (it was printed above; also stored in data/photon-auth.json) before expecting any message from it. This first text is required, not just convenient — the hosted line can only message numbers that have already texted it (cold outbound is rejected with Target not allowed for this project). Tell the user:

nc
Send one text — anything — from your phone to your agent's iMessage number (printed above). The hosted line can only reply to numbers that have texted it first, so its welcome message needs yours to arrive first.

iMessage is a native channel: it sends the raw handle as the conversation address, with no channel prefix — so the messaging-group platform id is that handle as-is:

nc
echo "{{owner_handle}}"

owner_handle and platform_id are what the owner-wiring step needs. The welcome iMessage goes out through the adapter once the service is running — on the local backend that needs Full Disk Access granted (above); on the hosted backend it goes out via your photon.codes line after your first text.

Next Steps

If you're in the middle of /setup, return to the setup flow now. Otherwise /init-first-agent stands up an agent on your iMessage DM, or /manage-channels wires it to an existing agent group.

Channel Info

  • type: imessage (one channel; the backend is local or hosted)
  • terminology: iMessage has 1:1 "chats" (DMs) and group chats. Photon (hosted) calls each conversation a "space".
  • platform-id-format: DM = your bare handle (E.164 phone, or email for local) — direct-addressable; the user id is imessage:<handle>. Group (hosted) = the opaque Spectrum space id.
  • how-to-find-id: DMs use the counterpart's phone/email. Groups (hosted) are discovered on first message — pnpm exec tsx scripts/q.ts data/v2.db "SELECT platform_id, name FROM messaging_groups WHERE channel_type='imessage'"
  • supports-threads: no
  • typical-use: Interactive 1:1 chat — personal messaging
  • default-isolation: One agent per install. Multiple DMs with the same operator can share an agent group; groups with other people should typically use isolated session mode.

Hosted features

Markdown (native; PHOTON_MARKDOWN=false for plain text), file attachments in and out (inbound staged into the session inbox, capped by PHOTON_MAX_INLINE_ATTACHMENT_BYTES, default 20 MB), tapback reactions, read receipts, typing indicators, and ask_user_question via /approve / /reject slash replies. Optional .env: PHOTON_MARKDOWN, PHOTON_TELEMETRY, PHOTON_MAX_INLINE_ATTACHMENT_BYTES, PHOTON_DASHBOARD_HOST, PHOTON_SPECTRUM_HOST. Full table in docs/imessage.md.

Troubleshooting

The backend answer is rejected. It must be exactly local or hosted, lowercase. Local only exists on macOS — it reads this Mac's chat.db directly — so on any other OS the platform check stops you and hosted is the only path.

Local: outgoing works but nothing ever arrives. Full Disk Access wasn't granted to the actual Node binary the service runs under — with nvm the path changes per Node version (~/.nvm/versions/node/v22.x.x/bin/node), so an old grant silently stops covering a new binary. Re-open System Settings → Privacy & Security → Full Disk Access, add the binary at $(which node), then restart the service.

Local: Failed to open database … Could not locate the bindings file. The chat.db reader is on a better-sqlite3 copy with no native binary, from an install made before step 4 set its override. Re-run /add-imessage with the local backend: step 4 sets the override and reinstalls, and the skill restarts the service.

spectrum-ts not installed (hosted) — re-run step 4 (pnpm install spectrum-ts@11.0.0) and restart.

Device login times out (hosted) — the code expires in ~30 min; re-run the login step (a stored token is reused).

Target not allowed for this project (hosted) — intended: the line only messages numbers that have texted it first. Text the agent's number once, then retry (a welcome DM queued before that first text simply fails delivery).

Your handle is rejected at the resolve step. It must be a bare +E.164 number (+14155551234 — no spaces, dashes, or parentheses) or, on the local backend, an email/Apple ID. Use the exact handle you actually send iMessages from — a number-vs-email mismatch means your messages never map to the wired conversation.

Adapter installed but silent. Run pnpm exec vitest run src/channels/imessage-registration.test.ts — red means the barrel import or the package install drifted, so re-run the Apply steps. If green, confirm the backend connected (hosted: grep "Photon channel connected" logs/nanoclaw.log), restart the service (bash setup/lib/restart.sh), then check logs/nanoclaw.error.log.

More in docs/imessage.md.

Upgrading spectrum-ts (hosted)

spectrum-ts is pinned exactly because it ships breaking majors. To upgrade, read the release notes for every version between the pins, bump the pin, reconcile src/channels/imessage.ts against the new typings, then pnpm run build and pnpm exec vitest run src/channels/imessage.test.ts. See docs/imessage.md.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Add Imessage?

Add iMessage to NanoClaw — one channel, two backends. Local (this Mac's chat.db via the Chat SDK bridge; macOS + Full Disk Access) or Hosted iMessage (via photon.codes — native spectrum-ts with a device-login wizard; any OS, no Mac relay). Triggers on "add imessage", "connect imessage", "add photon", "imessage via photon", "native imessage".

Firwat Add Imessage op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Add Imessage besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Add Imessage an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/nanocoai/nanoclaw/tree/main/.claude/skills/add-imessage an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Add Imessage benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Add Imessage benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Add Imessage domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Add Imessage gratis?

Jo. De Skill gëtt vum nanocoai ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇