Proposal: define CLI/SDK @mention behavior next to CJK text
Summary
The CLI/SDK mention parser only recognizes @Name when the @ is at the start of the message or preceded by ASCII whitespace.
That rule is explicitly documented in crates/buzz-sdk/src/mentions.rs as protection against treating email-like text such as user@host as a mention. This proposal is therefore asking for product/grammar clarification rather than assuming the current behavior is a bug.
In languages that commonly omit spaces, the same rule makes natural agent-authored handoffs look like mentions while emitting no p tag:
| Content | Current result |
|---|---|
@Scout please review |
resolves Scout |
你好 @Scout |
resolves Scout |
交给@Scout处理 |
no mention tag |
[email protected] |
no mention tag, intentionally |
The third case is easy for a human or agent to write in Chinese, but the recipient is not notified and a mention-gated ACP agent does not wake.
Question for maintainers
Should CLI/SDK auto-resolution remain strictly token-delimited, with agent callers expected to use explicit --mention <pubkey> whenever notification delivery matters?
Or should the known-channel-member path support @Name immediately preceded by CJK text, while keeping the unknown-name fallback and email-style ASCII cases conservative?
Possible narrow direction
If CJK-adjacent mentions are desired, one conservative option would be:
- only relax the left boundary when
Nameexactly matches a known member of the target channel; - keep ASCII word/email-local characters before
@excluded, souser@hostbehavior is unchanged; - keep unknown-name fallback parsing whitespace/start-delimited;
- preserve self-mention suppression and existing mention caps;
- add regression cases for CJK prefixes, ASCII emails, partial names, and code regions.
This still has a tradeoff: Unicode email local parts can contain non-ASCII characters, and prose that discusses @Member could create an unintended notification. I would prefer maintainer confirmation of the intended grammar before proposing code.
Related work
- #2526 and PRs #2547 / #2684 cover Markdown emphasis, spoiler, and parenthesis delimiters in the Rust parser.
- PR #2465 covers CJK-adjacent mention detection in Desktop.
- #3015 and PR #3047 cover warnings for unresolved CLI mentions.
- PR #3330 added explicit repeatable
--mention, which is the reliable current path for agent-authored notifications.
This issue is specifically about the CLI/SDK left boundary when CJK prose is immediately adjacent to @Name; it does not propose changing Desktop autocomplete or non-member mention policy.
Additional non-ASCII data point for the grammar question: it's not only CJK text before @Name — non-ASCII characters inside or right after the mention token also break resolution.
Observed live (Buzz relay + buzz-cli, 2026-08-11):
Content:
Bitte @-erwähnt den Agenten nicht so
(that is @ + -erwähnt, a German word with a non-ASCII umlaut ä)
Result:
user_error: mention '@-erw' does not match a current channel member
Consistent with the ASCII-boundary analysis reported in #2526, the literal text @-erwähnt is treated as a phantom mention @-erw and the send is rejected because -erw is not a member. (For completeness: the is_word_boundary character class in mentions.rs is indeed ASCII-only — whitespace plus ,;.!?:)]} — re-verified against main today.) The text was never meant to be a mention — it's just a German hyphenated word starting with @.
This is the same boundary/character-class root cause as #2526 (ASCII is_word_boundary vs. non-ASCII input), just triggered by an umlaut instead of emphasis. So we now have three live reproductions of the same class: emphasis-wrapped names (#2526), CJK-before-@ (#3904's table), and non-ASCII inside the token (this one).
For the maintainers' question at the bottom of this issue: I'd argue the parser should never fabricate a mention out of an unknown fragment and then hard-fail the send — at minimum an unresolved @-prefixed token should degrade to presentation-only (no p tag, no error), which is what the Hermes adapter now does defensively by passing explicit --mention <pubkey> on any @-containing send.