diff --git a/hive-matrix-mcp/src/handlers.rs b/hive-matrix-mcp/src/handlers.rs index b4c1810d..344d7fef 100644 --- a/hive-matrix-mcp/src/handlers.rs +++ b/hive-matrix-mcp/src/handlers.rs @@ -890,6 +890,7 @@ pub async fn collect_unread_with_ids( ) -> Vec<(matrix_sdk::ruma::OwnedRoomId, crate::protocol::RoomUnread)> { use crate::protocol::RoomUnread; let mut result = Vec::new(); + let own_user_id = client.user_id(); for room in client.joined_rooms() { let count = u32::try_from(room.unread_notification_counts().notification_count).unwrap_or(u32::MAX); @@ -902,6 +903,13 @@ pub async fn collect_unread_with_ids( } else { (None, None) }; + // Skip rooms where the newest unread event was sent by the agent itself. + // Self-authored messages should not trigger an unread notification. + if let (Some(ref sender), Some(own_id)) = (&last_sender, own_user_id) { + if sender == own_id.as_str() { + continue; + } + } result.push(( room.room_id().to_owned(), RoomUnread {