Idempotent sends

Use stable client ids when the transport supports them. Retry failed sends with the same id so duplicates do not create twin bubbles.

Scope memory per conversation

Store agent state keyed by space.to or message.group?.chatId — not globally per user phone, unless you explicitly want cross-chat memory.

Failure audit log

Persist app.on("error", …) events with to, code, and message. They indicate deliverability or entitlement issues before users report them.

Webhook deduplication

When using webhooks, unique-index eventId so at-least-once delivery does not double-charge your agent.