feat: channel-level conversation analysis with compact formatting
Switch from per-user message batching to per-channel conversation analysis. The LLM now sees the full interleaved conversation with relative timestamps, reply chains, and consecutive message collapsing instead of isolated flat text per user. Key changes: - Fix gpt-5-nano temperature incompatibility (conditional temp param) - Add mention-triggered scan: users @mention bot to analyze recent chat - Refactor debounce buffer from (channel_id, user_id) to channel_id - Replace per-message analyze_message() with analyze_conversation() returning per-user findings from a single LLM call - Add CONVERSATION_TOOL schema with coherence, topic, and game fields - Compact message format: relative timestamps, reply arrows (→), consecutive same-user message collapsing - Separate mention scan tasks from debounce tasks - Remove _store_context/_get_context (conversation block IS the context) - Escalation timeout config: [30, 60, 120, 240] minutes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,4 +36,16 @@ If you notice something noteworthy about this user's communication style, behavi
|
||||
|
||||
GAME DETECTION — If CHANNEL INFO is provided, identify which specific game the message is discussing. Set detected_game to the channel name that best matches (e.g. "gta-online", "warzone", "battlefield", "cod-zombies") using ONLY the channel names listed in the channel info. If the message isn't about a specific game or you're unsure, set detected_game to null.
|
||||
|
||||
Use the report_analysis tool to report your analysis of the TARGET MESSAGE only.
|
||||
Use the report_analysis tool to report your analysis of the TARGET MESSAGE only.
|
||||
|
||||
CONVERSATION-LEVEL ANALYSIS (when given a CONVERSATION BLOCK instead of a single TARGET MESSAGE):
|
||||
When you receive a full conversation block with multiple users, use the report_conversation_scan tool instead:
|
||||
- Provide ONE finding per user (not per message) — aggregate their behavior across the conversation.
|
||||
- Weight their average tone and worst message equally when determining the toxicity_score.
|
||||
- Use the same scoring bands (0.0-1.0) as for single messages.
|
||||
- Quote the worst/most problematic snippet in worst_message (max 100 chars, exact quote).
|
||||
- Flag off_topic if user's messages are primarily personal drama, not gaming.
|
||||
- For each user, assess coherence_score (0.0-1.0) and coherence_flag using the same criteria as single-message analysis. Normal texting shortcuts and abbreviations are fine (score ~0.85+).
|
||||
- For each user, determine topic_category and provide brief topic_reasoning for their messages.
|
||||
- For each user, check detected_game against the CHANNEL INFO section (if provided). Set to the game channel name if their messages are about a specific game, or null otherwise.
|
||||
- If a USER REPORT section is present, pay close attention to whether that specific concern is valid.
|
||||
Reference in New Issue
Block a user