{"id":"add-whatsapp","name":"add-whatsapp","summary":"ネイティブのBaileysアダプターを使ってWhatsAppチャンネルを追加してください。直接接続 — Chat SDKブリッジなし。","body":"# Add WhatsApp Channel\n\nAdds WhatsApp support via the native Baileys adapter — a direct WhatsApp Web\nconnection, no Chat SDK bridge. NanoClaw doesn't ship channels in trunk — this\nskill copies the WhatsApp adapter in from the `channels` branch.\n\nThe mechanical steps under **Apply** carry `nc:` directive fences: an agent\nreads the prose and applies them, and a parser can apply them deterministically\nfrom the same document. Every directive is idempotent, so the whole skill is\nsafe to re-run; anything a parser can't apply falls back to the prose beside it.\n\n## Number safety check (required)\n\nComplete this check before running any install or authentication command. If\nthe user already said they want to use their **shared**, **personal**,\n**main**, **existing**, or **everyday** WhatsApp number, treat it as a shared\nnumber and show the warning immediately. Do not ask the number-type question\nagain.\n\nOtherwise, ask which WhatsApp number NanoClaw will use:\n\n```nc:prompt number_mode validate:^(dedicated|shared)$\nWhich WhatsApp number will NanoClaw use? `dedicated` (recommended) — a separate number used only for NanoClaw (spare SIM, eSIM, or old phone). `shared` — your existing everyday / personal WhatsApp number.\n```\n\nIf the answer is `shared`, show this warning — tell the user:\n\n```nc:operator when:number_mode=shared\n⚠️ Risk to your WhatsApp account\n\nConnecting your shared or personal number could cause WhatsApp to temporarily suspend or permanently ban that number. You could lose access to the WhatsApp account, chats, and groups you rely on.\n\nWe strongly recommend using a separate, dedicated number for NanoClaw.\n\nOn your personal number, the agent lives only in your \"You\" / self-chat. Messages other people send you are ignored entirely — never read, never answered, never flagged for approval. Nobody else can talk to the agent.\n\nIf you want the agent reachable as its own contact, consider:\n• Telegram — a bot takes ~2 minutes to set up\n• a dedicated WhatsApp number — spare SIM, eSIM, or old phone\n• /add-whatsapp-cloud — the official Meta Business API\n```\n\nThen confirm how to proceed. Do not continue with installation or\nauthentication unless the user explicitly selects the second option:\n\n```nc:prompt shared_confirm validate:^(continue|dedicated)$ when:number_mode=shared\nHow would you like to proceed? `dedicated` (recommended) — go back and use a dedicated number. `continue` — I understand the risk, continue with my shared number.\n```\n\nRemember the effective mode for the rest of this workflow: it is `shared` only\nwhen the user explicitly acknowledged the risk and continued; anyone who chose\na dedicated number — up front or at the warning — continues as a\ndedicated-number install without seeing the warning again:\n\n```nc:run capture:mode effect:fetch when:number_mode=dedicated\necho dedicated\n```\n```nc:run capture:mode effect:fetch when:shared_confirm=continue\necho shared\n```\n```nc:run capture:mode effect:fetch when:shared_confirm=dedicated\necho dedicated\n```\n\n## Apply\n\n### 1. Copy the adapter and its registration test\n\nFetch the `channels` branch and copy the WhatsApp adapter, its registration\ntest, and the `whatsapp-formatting` container skill (overwrite — the branch is\ncanonical). The `whatsapp-auth` setup step is maintained in trunk, so it is not\ncopied here:\n\n```nc:copy from-branch:channels\nsrc/channels/whatsapp.ts\nsrc/channels/whatsapp-registration.test.ts\ncontainer/skills/whatsapp-formatting/SKILL.md\ncontainer/skills/whatsapp-formatting/instructions.md\n```\n\nThe `whatsapp-formatting` container skill is part of the channel payload: its\n`instructions.md` becomes the `skill-whatsapp-formatting.md` fragment in every\ngroup's composed CLAUDE.md (see `src/claude-md-compose.ts`), teaching agents\nWhatsApp's formatting syntax. Trunk does not ship it — without this copy step\nagents format WhatsApp messages with generic markdown that renders literally.\n\n### 2. Register the adapter\n\nAppend the self-registration import to the channel barrel (skipped if the line\nis already present). This one line is the skill's only reach-in into core:\n\n```nc:append to:src/channels/index.ts\nimport './whatsapp.js';\n```\n\n### 3. Install the adapter packages\n\nPinned to exact versions — the supply-chain policy rejects ranges and `latest`.\nBaileys is the WhatsApp Web client; `qrcode` renders the device-link QR in the\nterminal; `pino` is Baileys' logger:\n\n```nc:dep\n@whiskeysockets/baileys@7.0.0-rc.9\nqrcode@1.5.4\n@types/qrcode@1.5.6\npino@9.6.0\n```\n\n### 4. Build and validate\n\nBuild first: it typechecks the adapter against core and proves the dependencies\nare installed. Then run the one integration test.\n\n```nc:run effect:build\npnpm run build\n```\n```nc:run effect:test\npnpm exec vitest run src/channels/whatsapp-registration.test.ts\n```\n\n`whatsapp-registration.test.ts` imports the real channel barrel and asserts the\nregistry contains `whatsapp`. It goes red if the `import './whatsapp.js';` line\nis deleted or drifts, if the barrel fails to evaluate, or if\n`@whiskeysockets/baileys` isn't installed (the import throws) — so it also covers\nthe dependency from step 3. End-to-end delivery against a real WhatsApp number is\nverified manually once the service runs.\n\n## Authenticate\n\nWhatsApp uses linked-device authentication — no API key, just a one-time pairing\nfrom your phone. The adapter is installed and registered, but its factory returns\n`null` (and the channel stays dark) until `store/auth/creds.json` exists.\n\nThe number safety check above is still required even when credentials already\nexist. If `store/auth/creds.json` exists, skip ahead to \"Dedicated vs personal\nnumber\" after completing the safety check — the link step below reports the\nalready-linked number and moves on.\n\nPick how to link the device. `qr` shows a rotating QR you scan with your phone's\ncamera; `pairing-code` shows an 8-character code you type into WhatsApp (no camera\nneeded, but it needs your phone number):\n\n```nc:prompt auth_method validate:^(qr|pairing-code)$\nHow do you want to link WhatsApp? Type `qr` to scan a QR code in this terminal, or `pairing-code` to enter a code on your phone (no camera needed).\n```\n\nThe pairing-code method needs the number you're linking, the way WhatsApp expects\nit — digits only, country code first, no `+`, spaces, or dashes (the QR method\nskips this entirely):\n\n```nc:prompt phone validate:^\\d{8,15}$ when:auth_method=pairing-code\nYour WhatsApp phone number — digits only, country code first (e.g. 14155551234 for +1 415-555-1234).\n```\n\nPoint the user at the right screen before the code appears. For the QR method,\ntell the user:\n\n```nc:operator when:auth_method=qr\nLink WhatsApp by QR:\n1. On your phone, open WhatsApp → Settings → Linked Devices → Link a Device.\n2. A QR code will appear in this terminal below and refresh every ~20 seconds. Point your phone's camera at it to scan.\n```\n\nFor the pairing-code method, tell the user:\n\n```nc:operator when:auth_method=pairing-code\nLink WhatsApp by pairing code:\n1. On your phone, open WhatsApp → Settings → Linked Devices → Link a Device → tap \"Link with phone number instead\".\n2. An 8-character code will appear in this terminal below. Enter it on your phone immediately — it expires in about 60 seconds.\n```\n\nNow run the linked-device handshake. It streams the live QR (or the pairing-code\ncard) to this terminal and, on success, reports the linked WhatsApp number. Run\nthe command for the method chosen above — `qr` or `pairing-code`:\n\n```nc:run effect:step capture:bot_phone=PHONE when:auth_method=qr\npnpm exec tsx setup/index.ts --step whatsapp-auth -- --method qr\n```\n```nc:run effect:step capture:bot_phone=PHONE when:auth_method=pairing-code\npnpm exec tsx setup/index.ts --step whatsapp-auth -- --method pairing-code --phone {{phone}}\n```\n\nIf the handshake fails (`logged_out` or a timeout), the code expired — clear\n`store/auth/` and run the step again for a fresh one. See Troubleshooting.\n\nA successful link reports the number back as `bot_phone`. If it came back empty,\nthe device never confirmed (an expired QR or pairing code), so don't restart or\nwire against a blank number — clear `store/auth/` and re-run the link step first:\n\n```nc:run effect:check\n[ -n \"{{bot_phone}}\" ]\n```\n\n## Your personal chat number (dedicated number only)\n\nOn a dedicated number, the agent owns the linked line and you chat with it from\nyour own, different number. Collect that number — it is required, and it is\n*not* the number you just linked. Tell the user:\n\n```nc:operator when:mode=dedicated\nThe agent is signed in as +{{bot_phone}}.\n\nNow, your personal number — the one you'll chat with the agent from. It'll show up as a normal two-way conversation with the agent's contact.\n```\n\n```nc:prompt chat_phone validate:^\\d{8,15}$ when:mode=dedicated\nYour personal number, where you'll chat from — digits only, country code first (e.g. 14155551234). Required — this must be YOUR number, not the agent's linked one.\n```\n\nChatting from the bot's own number IS the shared-number setup — if the number\ngiven equals the linked number, stop and route through the same interception\nscreen as the up-front pick: show the account-risk warning from the number\nsafety check again and get explicit acknowledgement before treating this\ninstall as shared (or collect a genuinely different personal number and stay\ndedicated). If the install does become shared, correct the mode everywhere it\nwas recorded — in particular make sure `.env` ends up with\n`ASSISTANT_HAS_OWN_NUMBER=false`, rewriting a `true` that may already have been\nwritten; a stale `true` on a personal number makes the bot claim messages\naddressed to the human:\n\n```nc:run effect:check when:mode=dedicated\n[ \"{{chat_phone}}\" != \"{{bot_phone}}\" ]\n```\n\n## Dedicated vs personal number\n\nThe adapter behaves fundamentally differently depending on whether the linked\nnumber is the assistant's own or the operator's personal one. The switch is\n`ASSISTANT_HAS_OWN_NUMBER` in `.env`, read by the adapter itself at startup.\n**Inference rule: absent (or anything other than `true`) means shared/personal**\n— the safe default, since misreading a personal number as dedicated makes the\nbot claim messages addressed to the human.\n\n- **Shared/personal number** (`ASSISTANT_HAS_OWN_NUMBER` unset or not `true`) — DMs to this number and group @-tags of it address the *human*, not the bot. The adapter never emits a mention signal (`mentions: 'never'` in its declared channel defaults), so: no stranger DM ever auto-creates a messaging group or raises an admin approval card; group wirings default to a name pattern (`\\b<AgentName>\\b`) instead of platform mentions; auto-created chats default to `unknown_sender_policy: 'strict'`; outbound messages are prefixed with the assistant's name.\n- **Dedicated number** (`ASSISTANT_HAS_OWN_NUMBER=true`) — everything sent to the number is for the bot. DMs and group mentions carry a real mention signal (`mentions: 'platform'`), unknown senders escalate via `request_approval` approval cards, and card-approved groups wire with `engage_mode: 'mention'`. No name prefix on outbound.\n\nUse the mode selected in the required safety check. If information discovered\nlater contradicts that selection, ask again before changing modes; switching to\nshared requires the same warning and explicit acknowledgement.\n\nWrite the answer to `.env` **explicitly in both cases** (don't rely on the\ninference rule for new installs), replacing any existing\n`ASSISTANT_HAS_OWN_NUMBER` line. Written in both modes so a re-run that\nswitches dedicated → shared doesn't leave a stale `true` behind:\n\n```nc:run effect:external when:mode=dedicated\ngrep -q '^ASSISTANT_HAS_OWN_NUMBER=' .env && sed -i.bak 's/^ASSISTANT_HAS_OWN_NUMBER=.*/ASSISTANT_HAS_OWN_NUMBER=true/' .env && rm -f .env.bak || echo 'ASSISTANT_HAS_OWN_NUMBER=true' >> .env\n```\n```nc:run effect:external when:mode=shared\ngrep -q '^ASSISTANT_HAS_OWN_NUMBER=' .env && sed -i.bak 's/^ASSISTANT_HAS_OWN_NUMBER=.*/ASSISTANT_HAS_OWN_NUMBER=false/' .env && rm -f .env.bak || echo 'ASSISTANT_HAS_OWN_NUMBER=false' >> .env\n```\n\n### Assistant name\n\nBoth modes: keep the adapter's outbound prefix / mention normalization in sync\nwith the chosen agent name (the adapter's config default is `Andy` otherwise).\nUse the assistant's already-chosen name if one was configured; otherwise ask:\n\n```nc:prompt agent_name normalize:trim validate:^.+$\nWhat should your assistant be called? (e.g. `Nano` — used as the outbound name prefix on a shared number, and for @-name engagement)\n```\n\nPersist it to `.env` as `ASSISTANT_NAME`, replacing any existing\n`ASSISTANT_NAME` line (the value is written literally — no pattern expansion):\n\n```nc:run effect:external\ntouch .env && grep -v '^ASSISTANT_NAME=' .env > .env.tmp; printf 'ASSISTANT_NAME=%s\\n' '{{agent_name}}' >> .env.tmp && mv .env.tmp .env\n```\n\n### Update path: existing install, flag unset\n\nIf WhatsApp auth already exists (`store/auth/creds.json` present) but `.env` has no `ASSISTANT_HAS_OWN_NUMBER` line, the install predates the explicit switch. Use the mode established by the required safety check and write it explicitly.\n\nSuggest a default by comparing the authed number against the wired DM chat:\n\n```bash\n# The number this install is authenticated as\nnode -e \"const c=JSON.parse(require('fs').readFileSync('store/auth/creds.json','utf-8'));console.log(c.me?.id?.split(':')[0])\"\n# The wired WhatsApp DM chats\npnpm exec tsx scripts/q.ts data/v2.db \"SELECT mg.platform_id FROM messaging_groups mg JOIN messaging_group_agents mga ON mg.id=mga.messaging_group_id WHERE mg.channel_type='whatsapp' AND mg.is_group=0\"\n```\n\nIf the wired DM's phone **equals** the authed number, the operator is talking to the bot in their own self-chat — that's a personal number: suggest **Shared**. If they differ, the operator messages the bot from a different number: suggest **Dedicated**. Confirm with the operator either way, then write the flag and restart the service.\n\n### Migration audit: spam-era group wirings\n\nBefore the shared-number fix, group chats approved via the channel-registration card were wired `engage_mode='pattern'` with pattern `.` — respond-to-everything — because the card flow couldn't tell groups from DMs on non-threaded platforms. On a personal number this shows up as the bot answering every message in family/work groups after someone once tapped Connect on a spam-triggered card.\n\nList the suspect wirings (host service running — `ncl` is socket-only):\n\n```bash\nncl wirings list --engage-mode pattern --engage-pattern \".\" --json\n```\n\nCross-reference against WhatsApp group chats (`ncl messaging-groups list --channel-type whatsapp --is-group 1`). For each wiring with pattern `.` on a WhatsApp group that is *not* the operator's deliberate always-on chat (e.g. their self-chat), offer:\n\n- **Flip to name-based engagement**: `ncl wirings update <wiring-id> --engage-mode pattern --engage-pattern '\\b<AgentName>\\b'` (or `--engage-mode mention` on a dedicated number)\n- **Delete the wiring**: `ncl wirings delete <wiring-id>`\n\nStale approval cards from that era can also linger. Clear pending channel approvals for chats the operator doesn't want wired:\n\n```bash\npnpm exec tsx scripts/q.ts data/v2.db \"DELETE FROM pending_channel_approvals WHERE messaging_group_id IN (SELECT id FROM messaging_groups WHERE channel_type='whatsapp')\"\n```\n\n## Self-chat engagement (shared number only)\n\nOn a shared number the agent lives in your \"You\" / self-chat. Choose whether it\nresponds to every message you write there, or only to messages addressed to it\nby name:\n\n```nc:prompt selfchat_engage validate:^(all|mention)$ when:mode=shared\nRespond to every self-chat message, or only messages starting with @<agent name>? `all` — every message (the self-chat becomes the agent's inbox). `mention` — only messages starting with @<agent name> (keep the self-chat for your own notes too).\n```\n\nFor `mention`, the engage pattern is `@` plus the regex-escaped agent name,\nanchored to the start of the message, with a trailing `\\b` word-boundary guard.\n`\\b` only terminates a match after a word character — skip it for names ending\nin punctuation, where it would never match:\n\n```nc:run capture:engage_pattern effect:fetch when:selfchat_engage=mention\nnode -e 'const n=process.argv[1];const e=n.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");console.log(/\\w$/.test(n)?\"^@\"+e+\"\\\\b\":\"^@\"+e)' '{{agent_name}}'\n```\n\n`engage_pattern` is what the self-chat wiring uses: when wiring this channel\nwith `scripts/init-first-agent.ts`, pass it as `--engage-pattern`. Choosing\n`all` leaves it unset — the wiring falls back to the respond-to-everything\ndefault for a DM.\n\n## Restart\n\nRestart NanoClaw so it loads the WhatsApp adapter and sees your credentials and\nsettings, and wait for its CLI socket before resolving. Restart only after\n`ASSISTANT_HAS_OWN_NUMBER` / `ASSISTANT_NAME` land in `.env` — the adapter\ncomputes its shared/dedicated mode and name once at module load, so restarting\nearlier would leave it running with defaults:\n\n```nc:run effect:restart\nbash setup/lib/restart.sh\n```\n\n## Resolve your DM channel\n\nResolve the conversation address as the WhatsApp JID for the number you chat\nfrom — the linked number itself for a shared account (your self-chat), or the\npersonal number you gave for a dedicated one. Run the one matching the mode:\n\n```nc:run capture:platform_id effect:fetch when:mode=shared\necho \"{{bot_phone}}@s.whatsapp.net\"\n```\n```nc:run capture:platform_id effect:fetch when:mode=dedicated\necho \"{{chat_phone}}@s.whatsapp.net\"\n```\n\nFor WhatsApp, your owner handle is that same JID:\n\n```nc:run capture:owner_handle effect:fetch\necho \"{{platform_id}}\"\n```\n\n`owner_handle` and `platform_id` are what the owner-wiring step needs. The\ngreeting goes out over your WhatsApp chat as soon as the service reconnects with\nthe linked credentials.\n\n## Next Steps\n\nFor a shared number, set expectations — tell the user:\n\n```nc:operator when:mode=shared\nSelf-chat mode: only your \"You\" / self-chat is connected. Messages other people send to your number are ignored — never seen, never asked about. The welcome message will land in your \"You\" chat on WhatsApp.\n\nWire a specific chat later with /manage-channels.\n```\n\nIf you're in the middle of `/setup`, return to the setup flow now. Otherwise wire\nthis channel with `/init-first-agent` (or `/manage-channels`) — in shared\n`mention` mode, pass the engage pattern above via `--engage-pattern`.\n\n## Channel Info\n\n- **type**: `whatsapp`\n- **terminology**: WhatsApp calls them \"groups\" and \"chats.\" A \"chat\" is a 1:1 DM; a \"group\" has multiple members.\n- **platform-id-format**: DMs use `<phone>@s.whatsapp.net` (e.g. `14155551234@s.whatsapp.net`). Groups use `<id>@g.us`. Native adapter — the JID is the platform ID as-is, no `whatsapp:` prefix.\n- **how-to-find-id**: To find your linked number after auth: `node -e \"const c=JSON.parse(require('fs').readFileSync('store/auth/creds.json','utf-8'));console.log(c.me?.id?.split(':')[0].split('@')[0]+'@s.whatsapp.net')\"`. Groups are auto-discovered — check `pnpm exec tsx scripts/q.ts data/v2.db \"SELECT platform_id, name FROM messaging_groups WHERE channel_type='whatsapp' AND is_group=1\"`.\n- **supports-threads**: no\n- **typical-use**: Interactive chat — direct messages or small groups\n- **default-isolation**: Same agent group if you're the only participant across multiple chats. Separate agent group if different people are in different groups.\n\n### Features\n\n- Markdown formatting — `**bold**`→`*bold*`, `*italic*`→`_italic_`, headings→bold, code blocks preserved\n- Approval questions — `ask_user_question` renders with `/approve`, `/reject` slash commands\n- File attachments — send and receive images, video, audio, documents\n- Reactions — send emoji reactions on messages\n- Typing indicators — composing presence updates\n- Credential requests — text fallback (WhatsApp has no modal support)\n\nNot supported (WhatsApp linked-device limitation): edit messages, delete messages.\n\n## Alternatives\n\n### QR code in a browser\n\nBesides the in-terminal QR and the pairing code the Apply flow uses, this skill\nships a helper that renders the rotating QR as a PNG in your default browser —\nhandy when the terminal QR is too small to scan reliably. It spawns the same\n`whatsapp-auth` step, parses each rotating QR from its `WHATSAPP_AUTH_QR` status\nblocks, and serves the current one on a local HTTP server (default port `8765`,\nfalls back to a free port):\n\n```bash\npnpm exec tsx .claude/skills/add-whatsapp/scripts/wa-qr-browser.ts\n```\n\nFlags: `--clean` wipes `store/auth/` before spawning, `--port N` pins the port.\n\nA browser window opens with a QR code. On your phone, open WhatsApp →\n**Settings** → **Linked Devices** → **Link a Device**, scan the QR, and the page\nshows \"Authenticated!\" when done.\n\n### Headless environments\n\nOn a headless host (no display server — no `$DISPLAY`/`$WAYLAND_DISPLAY`, not\nmacOS), the browser method can't open a window. Detect it and fall back to the\npairing-code method (no camera needed):\n\n```bash\n[[ -z \"$DISPLAY\" && -z \"$WAYLAND_DISPLAY\" && \"$OSTYPE\" != darwin* ]] && echo \"IS_HEADLESS=true\" || echo \"IS_HEADLESS=false\"\n```\n\n## Optional configuration\n\nIf the assistant runs on a dedicated number (its own phone/SIM, not your personal\nWhatsApp), tell the adapter so it doesn't prefix outbound replies with its name:\n\n```bash\nASSISTANT_HAS_OWN_NUMBER=true\n```\n\nThe Apply flow writes this key for you **in both modes** — `true` for a\ndedicated number, `false` for a shared (personal) one — so a re-run that\nswitches modes never leaves a stale value behind. Absent (or anything other\nthan `true`) is read as shared/personal, the safe default.\n\n## Troubleshooting\n\n### QR code or pairing code expired\n\nCodes expire after ~60 seconds. The QR rotates automatically while the auth step\nis running; if the step exited, clear the auth state and re-run it:\n\n```bash\nrm -rf store/auth/ && pnpm exec tsx setup/index.ts --step whatsapp-auth -- --method qr\n```\n\nFor pairing code, ensure digits only (no `+`), the phone has internet, and\nWhatsApp is updated:\n\n```bash\nrm -rf store/auth/ && pnpm exec tsx setup/index.ts --step whatsapp-auth -- --method pairing-code --phone <phone>\n```\n\nWhatsApp's pairing-code flow occasionally rejects valid codes with \"Couldn't link\ndevice.\" This is a server-side rejection unrelated to the code itself. If you hit\nit more than once, switch to the QR method — it has a noticeably higher success\nrate.\n\n### Pairing code not working\n\nCodes expire in ~60 seconds. Delete auth and retry:\n\n```bash\nrm -rf store/auth/ && pnpm exec tsx setup/index.ts --step whatsapp-auth -- --method pairing-code --phone <phone>\n```\n\nEnsure: digits only (no `+`), phone has internet, WhatsApp is updated.\n\nWhatsApp's pairing-code flow occasionally rejects valid codes with \"Couldn't link\ndevice — An error happened. Please try again.\" This is a server-side rejection\nunrelated to the code itself; we've seen it happen twice in a row on fresh\ndedicated numbers. If you hit it more than once, switch to QR-browser auth — it\nhas a noticeably higher success rate:\n\n```bash\npnpm exec tsx .claude/skills/add-whatsapp/scripts/wa-qr-browser.ts --clean\n```\n\n### \"waiting for this message\" on reactions\n\nWhatsApp sessions corrupted from rapid restarts. Clear sessions, then restart the\nservice. Run from your NanoClaw project root:\n\n```bash\nsource setup/lib/install-slug.sh\nsystemctl --user stop $(systemd_unit)\nrm store/auth/session-*.json\nsystemctl --user start $(systemd_unit)\n```\n\n### Bot not responding\n\n1. Auth exists: `test -f store/auth/creds.json`\n2. Connected: `grep \"Connected to WhatsApp\" logs/nanoclaw.log | tail -1`\n3. Channel wired: `pnpm exec tsx scripts/q.ts data/v2.db \"SELECT mg.platform_id, mg.name FROM messaging_groups mg JOIN messaging_group_agents mga ON mg.id=mga.messaging_group_id WHERE mg.channel_type='whatsapp'\"`\n4. Service running: `systemctl --user status \"$(. setup/lib/install-slug.sh && systemd_unit)\"`\n\n### \"conflict\" disconnection\n\nTwo instances connected with the same credentials. Ensure only one NanoClaw\nprocess is running.\n\n### Trunk updated but shared-number behavior unchanged (stale adapter copy)\n\nThe shared-number behavior (no stranger approval cards, name-pattern group defaults) lives in the **adapter copy** at `src/channels/whatsapp.ts`, installed from the `channels` branch — not in trunk. If you updated trunk via `/update-nanoclaw` but skipped the skill-update step, the old adapter copy neither reads `ASSISTANT_HAS_OWN_NUMBER` itself nor declares channel defaults, so trunk falls back to the legacy behavior: approval cards still fire on a personal number, and new wirings get the channel-blind defaults. Symptoms of the skew:\n\n- `.env` says `ASSISTANT_HAS_OWN_NUMBER=false` (or unset) but strangers' DMs still raise approval cards\n- `ncl wirings create` on a WhatsApp group defaults to `mention` instead of a name pattern\n\nFix: re-run `/add-whatsapp` (or `/update-skills`) to pull the current adapter from the `channels` branch, then restart the service. The reverse skew (new adapter, old trunk) can't happen — the adapter's `defaults` field is optional and old trunk ignores it.","author":"@nanocoai","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/nanocoai/nanoclaw/tree/main/.claude/skills/add-whatsapp","license":"MIT","category":"writing","lang":"en","tokens":6174,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"apply-fixtures.json","size":1918,"sha256":"a757508f0a52b621e40a1eb4f150b27bb3fa347f270a950ae02e914c4bbda680"},{"path":"REMOVE.md","size":1848,"sha256":"7cc4e08471528a3309756122bee70372c1201b74c892177b3306836e14a01a51"},{"path":"scripts/wa-qr-browser.ts","size":8014,"sha256":"26c24bbe0074f9e72a8c1b9c2535fe9ff2fedd5d3af676378d49e901cde526bb"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[{"code":"code.eval","kind":"dangerous-code","where":"scripts/wa-qr-browser.ts:173","excerpt":"exec(","message":"evaluates code at runtime","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":true,"networkEndpoints":[]}}