whatsapp-claude-plugin
AGENTS.md114 starsChanged 5 months agoApache-2.0View on GitHub
Guidance for AI coding agents working in this repository. Read this file fully, then use the routing table at the bottom before starting any non-trivial task. WhatsApp MCP Server plugin for Claude Code — connects WhatsApp as a messaging channel via the linked-device protocol (Baileys). Bidirectional messaging, media, voice transcription, access control, per-group AI personalities, cron tasks. Published on claude.com/plugins. - Runtime: Bun — TypeScript runs directly. No build step. - Deps (only 4 — no new dependencies without the…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 107
Same ritual, third step: write the banner notes: Add or extend the entry for that version in scripts/update-notice.ts's CHANGELOG.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for AI coding agents working in this repository. Read this file fully, then use the routing table at the bottom before starting any non-trivial task.
Project Overview
WhatsApp MCP Server plugin for Claude Code — connects WhatsApp as a messaging channel via the linked-device protocol (Baileys). Bidirectional messaging, media, voice transcription, access control, per-group AI personalities, cron tasks. Published on claude.com/plugins.
Tech Stack & Commands
- Runtime: Bun — TypeScript runs directly. No build step.
- Deps (only 4 — no new dependencies without the user's explicit approval):
@modelcontextprotocol/sdk,@whiskeysockets/baileys@7.0.0-rc14,@inquirer/prompts,zod(2 connection payload fields are patched bypatch-baileys.mjsvia postinstall; rc12 brought the upstream message-spoofing and Noise initialization fixes; rc14 is the first release whose spoofing guard still accepts the phone's own sync). - Tests: there IS a test suite — 26
*.test.tsfiles underlib/andscripts/, run withbun test. There is notestscript inpackage.json;bun testfinds them itself. - Linting: Trunk (prettier, markdownlint, shellcheck, shfmt, checkov, trufflehog).
Trunk is not installed on every machine — check before assuming
trunk checkruns.
bun install # install deps (postinstall runs patch-baileys.mjs)
bun server.ts # run the MCP server
bun test # ~130s, spawns real servers — see the warning below
trunk check # lint
trunk fmt # formatType checking — bun build is NOT a type check. bun build is a bundler: it
resolves and emits, it does not check types, so an out-of-scope or misspelled
identifier bundles happily and tells you nothing. Use tsc directly. This repo
has no tsconfig.json and no local typescript dependency, so pass the options
on the command line (verified 2026-09-08: exit 0, no errors):
bunx --bun typescript@5 --noEmit --skipLibCheck \
--target esnext --module preserve --moduleResolution bundler \
--strict server.ts--strict is load-bearing, not decoration: without it you get two phantom
TS2339s in lib/mentions.ts that do not exist under strict mode. Note the
invocation is bunx typescript@5 <options> — bunx typescript@5 tsc ... fails,
because bunx already resolves the package's tsc binary and the extra tsc
is then read as a filename to compile.
Never run bun test concurrently with another bun test or with a forked
review agent. The IPC tests spawn real servers and contend on the singleton
lock. Run it to a log and grep the summary — piping to tail hides failures.
Architecture
WhatsApp (phone) ←─ Baileys ─→ MCP Server (server.ts) ←─ stdio ─→ Claude Code
↓
~/.whatsapp-channel/ (runtime state, never in repo)
├─ access.json
├─ .baileys_auth/
├─ groups/<groupJid>/ (config.md = personality + cron,
│ memory.md = conversation memory)
├─ tasks.md (agent-maintained open-task list, read by catch_up)
├─ messages.jsonl (inbound + owner/Claude context lines, pruned
│ hourly to WHATSAPP_MESSAGE_TTL_DAYS, default 7)
├─ sent.jsonl (id + ts of the plugin's own sends, 24h)
├─ polls.json (send_poll's polls + the secret their votes need, 30 days)
├─ .aged-out-chats.json (hashed chat_id -> when a WAITING line
│ was pruned; 30 days; never written in static mode)
└─ inbox/ (attachments, pruned to the same horizon as messages.jsonl)server.ts— the entire MCP server in one file (~5400 lines; re-check withwc -lrather than trusting this number). MCP tools exposed to Claude:reply,send_poll,react,set_presence,download_attachment,edit_message,status,unreplied,catch_up,list_groups,mark_read. Also contains: access-control engine (DM policiespairing/allowlist/disabled, group policies, pairing codes with 1-hour TTL, LID↔phone mapping), message pipeline (access gate → routing → mention detection → text/media extraction → optional transcription → 4096-char chunking inlengthornewlinemode peraccess.json'schunkMode), per-group personality loading, cron parser (reads the## Cron Jobssection — exactly that heading — in each group'sconfig.md).skills/— user-facing commands:/whatsapp-channel:setup,:configure,:access.hooks/hooks.json→hooks-handlers/session-start.sh— onboarding detection at session start.scripts/watchdog.sh,scripts/whisper-transcribe.sh— reference scripts users copy out of the repo (watchdog to~/.whatsapp-channel/watchdog.sh; the whisper script to~/whisper-transcribe.sh— server.ts hardcodes that home-dir path). Editing them in the repo does NOT affect running deployments until re-copied.
Hard Rules (each one exists because it was violated before — evidence in docs/governance/A-diagnosis.md)
- Version bump on every push. Bump BOTH
.claude-plugin/marketplace.json(the innerplugins[0].version) AND.claude-plugin/plugin.json. Before committing, verify:grep -n '"version"' .claude-plugin/marketplace.json .claude-plugin/plugin.json— this prints THREE version lines; IGNORE marketplace's top-levelversion(that's the marketplace's own). Compare marketplace'splugins[0].versionwith plugin.json'sversion: they must match each other and be newer than before. Skipping one makesplugin updatesilently no-op for users. Semver: patch for fixes, minor for features. Same ritual, third step: write the banner notes. Add or extend the entry for that version inscripts/update-notice.ts'sCHANGELOG. The note text is hand-written per release — nothing derives it — so a bump without it ships a release the banner never mentions, or worse, leaves an older note standing that the new release just made false (that is how the 0.23.0 permissions note ended up telling users a still-broken block was fixed). One short line per change, under ~100 characters. A note that will not fit is two notes, never a wrapped paragraph: they are joined with a blank line between bullets and read at session start, and 0.22.0 once stacked thirteen paragraphs there. - Danger zones in
server.ts: connection lifecycle, the singleton lock, and allowlist/access gating have each regressed before. Before editing them, grep the whole file for every symbol you touch (grep -n <symbol> server.ts— module-level state crosses the whole file). After editing, name in your summary the invariant you preserved (e.g. "lock survives PID reuse"). Can't name one → stop and re-read. - Remote commands to
mini(or any unattended host): anything beyond a quick status check must usetimeout <seconds>or run backgrounded with output redirected to a log you then read. Never a bare blocking long-running command over ssh. Check current state (tmux session? process? lockfile?) before restarting anything there. - State lives in
~/.whatsapp-channel/, created at runtime — never write runtime state into the repo.
Routing — read the matching governance file BEFORE starting the task
All in docs/governance/:
| Situation | Read |
| Delegating work to subagents, or choosing model/effort for one | C-model-dispatch.md |
| Deciding: am I done? escalate? ask the user? is my approach wrong? | D-judgment-rubric.md |
| Writing a subagent prompt (search / implement / refactor / research / review) | E-dispatch-templates.md |
| You learned a lesson, hit a new failure mode, or want to edit governance files | F-maintenance-protocol.md |
| Session start on substantial work, or when disoriented | G-letter-to-future-sessions.md and A-diagnosis.md |
These files are the operating system for this environment, written deliberately on
2026-07-03 to make future sessions reliable. Don't casually override them; change them
only per F-maintenance-protocol.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

