Skip to content

Body @mentions invite once; comment and reply @mentions notify (#116) - #117

Merged
artifact-agent merged 1 commit into
mainfrom
feat/116-body-mention-invite
Sep 14, 2026
Merged

artifact-agent merged 1 commit into
mainfrom
feat/116-body-mention-invite

Conversation

@artifact-agent

Copy link
Copy Markdown

Closes #116. Follows the analysis in #115.

What changes

  • Body mentions do not notify. inviteMentioned (replacing notifyMentions) fires one mention event per document, tagged invite: true, only while the agent is not present (joined and not idle) and only if roster.invited_at is null, then stamps it. The WeakMap keyed by live Yjs blocks is gone, so a DO restart, a paragraph split, a paste, or an agent patch cannot re-fire a mention that is already in the text. Policy in app/shared/mention-policy.ts.
  • Comment and reply mentions notify every time. A new thread's commentText is scanned in the threads observer (it used to be skipped as "add"), and the inline {>>…<<} run is stripped from the body scan so the same comment is not counted twice. Replies were already handled there.
  • read_document returns mentions, the blocks that name the caller, so a present agent can find what it should look at without scanning the markdown.
  • Event catalog, server instructions, /mcp help and llms.txt, the plugin skill, the design doc, and CLAUDE.md describe the policy: body mentions point, comments summon.

Tests

  • tests/unit/shared/mention-policy.test.ts for shouldInvite and stripCommentRuns.
  • Integration: delete-and-retype no longer re-fires; a second mention in a new block, a split block, and after a simulated restart stays silent; a present agent gets no body mention but sees it in mentions; a human comment notifies every time and its inline run is not double counted; an agent's comment naming another agent notifies it with the actor. The webhook suspension test now re-mentions through a comment.
  • setup in the events tests enrolls via agentRead rather than agentJoin, since a joined agent is present and is not invited.

Full suite: everything passes except the three localStorage test files that CLAUDE.md documents as failing under Node 26 (this machine runs Node 26).

🤖 Generated with Claude Code

A mention in the body is a pointer, not a notification. It fires one
`mention` event per document (`invite: true`), only while the agent is
not present and only if it has never been invited, stamped on
`roster.invited_at` so a restart, a split block, or an agent patch
cannot re-fire it. The per-block WeakMap dedupe is gone. Mentions in a
new comment (from its thread entry, with the inline `{>>…<<}` run
stripped from the body scan) and in replies notify every time.
`read_document` returns `mentions`, the blocks that name the caller.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@artifact-agent
artifact-agent merged commit 989bd69 into main Sep 14, 2026
3 checks passed
@artifact-agent
artifact-agent deleted the feat/116-body-mention-invite branch September 14, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Body @mentions invite once; only comment and reply @mentions notify

1 participant