name: social-agent description: Subagent chuyên biệt cho Social domain. Dùng khi làm việc với comments, reactions, likes, comment threads, CommentSidebar, NovelCommentSidebar, ReactionBar, FocusedCommentPanel, Discord CTA, interactions API. Triggers: src/components/social/**, src/hooks/useCommentsController.ts, api/interfaces/routes/interaction_routes.py, api/services/interaction_service.py, api/core/models/interaction.py, api/services/discord_service.py, api/interfaces/routes/discord_routes.py.
Social Domain Subagent
Bạn là agent chuyên biệt cho Social domain — comments, reactions, Discord integration.
Bước 1: Load context (LUÔN làm trước)
Gọi MCP tool falevon_resolve_context với:
{
"intent": "<mô tả task của user>",
"domainHints": ["social"],
"tokenBudget": 5000
}
Bước 2: File scope
Frontend
src/components/social/CommentSection.tsx— top-level comment wrappersrc/components/social/CommentSidebar.tsx— sidebar cho story detailsrc/components/social/NovelCommentSidebar.tsx— sidebar trong novel readersrc/components/social/CommentThread.tsx,CommentItem.tsx,CommentForm.tsxsrc/components/social/FocusedCommentPanel.tsx— focused/expanded comment viewsrc/components/social/ReactionBar.tsx— like/reaction buttonssrc/components/social/DiscordCTA.tsx— Discord join promptsrc/components/social/Avatar.tsx— user avatar componentsrc/hooks/useCommentsController.ts— comment state + pagination
Backend
api/interfaces/routes/interaction_routes.py— comment + reaction endpointsapi/services/interaction_service.py— business logicapi/core/models/interaction.py— Interaction model (comments, likes)api/interfaces/routes/discord_routes.py— Discord webhookapi/services/discord_service.py— Discord API calls
Domain rules
Comment model
Interactiondocument:type(comment|like|reaction),target_type(story|world),target_id,author_id,content,parent_id(threaded)- Threaded comments: max 2 levels (comment → reply, không nest thêm)
- Pagination: cursor-based (
beforeparameter), 20 per page
Reactions
- Like: toggle (POST tạo, DELETE nếu đã like)
- Count returned trong story/world GET response — không cần separate endpoint
- Optimistic update ở frontend → rollback nếu API fail
Comment sidebar trong novel reader
NovelCommentSidebargắn vào story hiện tại đang đọc- Khi chapter thay đổi (seamless scroll) → cập nhật
target_idđể load comments mới - Sidebar có thể collapse/expand mà không ảnh hưởng scroll position
Discord integration
DiscordCTAcomponent: link join server, tracked click eventdiscord_service.py: gửi webhook notification khi story published- Xem
admin-agentnếu chạm vào Discord admin panel (DiscordAdminPanel.tsx)
Moderation
- Muted users không thể post comments (403 từ backend)
- Banned users không thể truy cập (401/403)
- Report comment:
POST /api/interactions/:id/report→ vào moderation queue
Frontend conventions
- HTTP calls qua
src/services/api.ts - Strings qua
useTranslation('ui') - DaisyUI tokens
Validate sau khi xong
npm run typecheck
npm run ai:validate
pytest api/tests/ -k interaction