Developer abdallah has released mattermost-dm, an agent skill and Python script designed to let Claude Code send direct messages on Mattermost without breaking social norms. The tool, hosted on GitHub and licensed under MIT, introduces a mandatory human-in-the-loop workflow where the AI drafts a message, the user approves it, and the script ensures the exact approved text is sent. This approach addresses a critical friction point in agentic workflows: the fear of an AI spamming colleagues or sending contextually inappropriate messages without oversight.

The Safety-First Architecture

The core innovation here isn't the API connection, but the strict guarantee system built on top of it. The script uses a --dry-run flag to generate a preview and --send-pending to transmit exactly that preview, but only once and within an hour. This prevents race conditions or accidental double-sends. Furthermore, it enforces all-or-nothing batch processing; if one recipient in a list fails to resolve, the entire send operation is blocked. This is a significant departure from typical 'fire-and-forget' agent scripts that often fail silently or partially.

Personalization and Voice Cloning

The tool goes beyond simple templating by allowing users to define their personal writing style in a local voice.md file. This file is ignored by Git, ensuring privacy, and can be generated by analyzing past message history via the --history flag. The script supports dynamic placeholders like {hi} for time-sensitive greetings and {first_name} for personalized addresses. This allows the AI to mimic the user's toneβ€”whether it's 'good morning :)' or a terse 'hey'β€”reducing the uncanny valley effect of AI-generated corporate communication.

Privacy and Data Handling

Token security is handled with hacker-culture paranoia. The script loads the Mattermost personal access token from ~/.mattermost but never prints it to stdout, and the accompanying skill explicitly instructs Claude not to read the file contents. All sensitive data, including the token and the user's voice profile, remains on the local machine. However, users must be aware that using the --history feature to train the voice model sends message context to their AI provider, so checking company confidentiality policies is a prerequisite for that specific feature.

Key Takeaways

  • The tool enforces a strict preview-approve-send loop, preventing unauthorized AI communication.
  • It uses a local voice.md file to personalize AI output, which can be auto-generated from message history.
  • Security is prioritized via token non-printing and local-only storage of sensitive configuration files.
  • It is explicitly not a full client; for reading mentions or search, the author recommends other tools like rhnvrm/mattermost-cli.

The Bottom Line

This is the kind of pragmatic, safety-bounded tooling we need to see more of. Instead of trying to make AI fully autonomous in social spaces, it correctly identifies that human approval is the only viable path for professional communication. The --wait-reply flag also suggests a future where agents can hold conversations asynchronously, but for now, this tool nails the basics: don't send the wrong thing, and make it sound like you wrote it.