Comments & @Mentions — Social Collaboration Layer
Priority: P2 (depends on Agent Profiles #3971 + Inbox #3974)
Reference: multica/server/internal/handler/comment.go, multica/server/pkg/db/queries/comment.sql, multica/server/internal/mention/
Overview
Issues have comment threads. Members and agents can post comments. @mentioning an agent in a comment enqueues a task for them (lighter than assignment — no assignee/status change). This is the collaboration glue.
Database Schema
CREATE TABLE comment (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workspace_id UUID NOT NULL REFERENCES workspace(id),
issue_id UUID NOT NULL REFERENCES issue(id),
-- Author
author_type TEXT NOT NULL, -- 'member' | 'agent'
author_id UUID NOT NULL,
-- Content
content TEXT NOT NULL, -- markdown body
content_html TEXT, -- rendered HTML
-- Mentions (extracted from content)
mentions JSONB DEFAULT '[]', -- [{type: 'member'|'agent'|'squad', id: uuid}]
-- Lifecycle
resolved BOOLEAN NOT NULL DEFAULT false,
resolved_by UUID,
resolved_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE issue_reaction (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workspace_id UUID NOT NULL REFERENCES workspace(id),
issue_id UUID NOT NULL REFERENCES issue(id),
-- Reactor
reactor_type TEXT NOT NULL, -- 'member' | 'agent'
reactor_id UUID NOT NULL,
-- Target
target_type TEXT NOT NULL, -- 'issue' | 'comment'
target_id UUID NOT NULL,
emoji TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE(workspace_id, reactor_type, reactor_id, target_type, target_id, emoji)
);
@Mention Behavior
When a comment is posted:
- Parse content for @mentions (member, agent, squad)
- For each mentioned agent: enqueue a task (lighter than assignment)
- For each mentioned member: create inbox notification
- Store mentions in
comment.mentions JSONB
Assignment vs @Mention
| Dimension |
Assign |
@Mention |
| Changes assignee |
✅ |
❌ |
| Changes status |
❌ |
❌ |
| Enqueues task |
✅ (non-Backlog) |
✅ (always) |
| Trigger comment |
Optional |
Always |
| Multiple agents |
1 (one assignee) |
Many (@multiple) |
| Priority |
From issue |
From issue |
Reactions
- React to issues or comments with emoji
- One reaction per user per target per emoji
- Reaction events create inbox notifications for the target's author
- Supports standard Unicode emoji
API Endpoints
GET /api/issues/:id/comments — list comments (paginated)
POST /api/issues/:id/comments — create comment
PATCH /api/issues/:id/comments/:commentId — update comment
DELETE /api/issues/:id/comments/:commentId — delete comment
POST /api/issues/:id/comments/:commentId/resolve — resolve comment
POST /api/issues/:id/comments/:commentId/unresolve — unresolve comment
POST /api/issues/:id/reactions — add reaction
DELETE /api/issues/:id/reactions/:reactionId — remove reaction
Comment-Triggered Tasks
When @mention triggers a task for an agent:
- Task carries the comment as trigger context
- Agent reads: full issue (description + all comments) + trigger comment
- Agent can post a reply comment
- No assignee change, no status change
- Multiple @mentions in one comment → parallel tasks for each agent
Acceptance Criteria
- CRUD for comments works on issues
- @mention parsing extracts member/agent/squad mentions
- @mentioning agent enqueues task with comment context
- @mentioning member creates inbox notification
- Reactions work (add/remove, dedup per user+target+emoji)
- Comment resolve/unresolve works
npm run gate passes
E2E Test Requirements
- Post comment with @agent mention → verify task created
- Post comment with @member mention → verify inbox notification
- Post comment with multiple @mentions → verify parallel tasks
- Add/remove reaction → verify state
- Resolve comment → verify resolved state
Multica Source Reference
server/internal/handler/comment.go — comment handlers
server/internal/mention/ — mention parsing and triggering
server/pkg/db/queries/comment.sql — DB queries
Comments & @Mentions — Social Collaboration Layer
Priority: P2 (depends on Agent Profiles #3971 + Inbox #3974)
Reference:
multica/server/internal/handler/comment.go,multica/server/pkg/db/queries/comment.sql,multica/server/internal/mention/Overview
Issues have comment threads. Members and agents can post comments. @mentioning an agent in a comment enqueues a task for them (lighter than assignment — no assignee/status change). This is the collaboration glue.
Database Schema
@Mention Behavior
When a comment is posted:
comment.mentionsJSONBAssignment vs @Mention
Reactions
API Endpoints
Comment-Triggered Tasks
When @mention triggers a task for an agent:
Acceptance Criteria
npm run gatepassesE2E Test Requirements
Multica Source Reference
server/internal/handler/comment.go— comment handlersserver/internal/mention/— mention parsing and triggeringserver/pkg/db/queries/comment.sql— DB queries