name: qq-group-speaker-distinction description: Use when integrating QQ group chat where users want one shared group session, but the assistant must still distinguish who said each message. description_zh: 用于 QQ 群聊集成:保持一个共享群会话,同时让 AI 能区分每条消息来自哪位群成员。
QQ Group Speaker Distinction
Use this skill when the user says "do not isolate by user in group chat" but still needs speaker separation.
Core Rule
- Keep one session key per group:
qq:group:{group_id}. - Attach speaker identity on each inbound message before it enters model context.
- Speaker identity must include stable
user_id; nickname is only a display field.
Minimal Implementation
const sessionKey = `qq:group:${groupId}`;
const speakerTag = `[speaker:user_id=${userId};name=${displayName ?? "unknown"}]`;
const modelInput = `${speakerTag} ${rawText}`;
Add one system instruction for QQ group sessions:
- "Use
[speaker:...]to distinguish participants. Do not merge different speakers."
Anti-Patterns
- Using
qq:group:{group_id}:user:{user_id}when shared group context is required. - Passing only nickname without stable
user_id. - Stripping speaker tags before session append or model input.
Validation Checklist
- Log
group_id,user_id, finalsession_key, and final model input. - Send two messages from different users in the same group.
- Confirm both messages hit the same
session_key. - Confirm each model input line has the correct
speaker:user_id=...tag.
Best-Practice Memory Split
- Conversation context: keyed by
group_idonly. - Optional profile memory: keyed by
group_id + user_idfor preference lookup only.