From nobody Mon Jul 27 02:50:51 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778519151; cv=none; d=zohomail.com; s=zohoarc; b=Jc0U+nJ6vUWcm1bzfZRHtcZTUE32ch1EJeTII3XYNR13Sf7ELw2oxncCbHEzWgj0+AaAmCjRF52BAxWpytFVR4GSkePfMbCBzuGtEFVWFiw4kS3TuiJpCj0BTt3n++M2eqqsrVL2X000S//EzEI3zfQKMARCCaVz7Vg65DpH8V8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778519151; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8DK8w3wWlNjyLdHUAxS2nkmLSUJ4xVH9mq/jC0j206M=; b=N5GCBcTew/yYbVS9lan3PWkhmACzLUc3qZJDdtaF/T1ZWEqqOpI6uupoSU6StrvRCEkMNVZjRHRn5crgZ+d6ljIn2I8f8nmhrXmh59ksXOXIdTuOxdWcjQSOjiY4Nrxukwm02GIe6BvQ84VtCfXmAXed/ZuImk8ohv3nHyYD600= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778519151269372.80689653660147; Mon, 11 May 2026 10:05:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wMU4M-000171-KN; Mon, 11 May 2026 13:05:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wMU47-0000uP-JA for qemu-devel@nongnu.org; Mon, 11 May 2026 13:05:11 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wMU44-0007oS-Gr for qemu-devel@nongnu.org; Mon, 11 May 2026 13:05:11 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-43fe62837baso2379847f8f.3 for ; Mon, 11 May 2026 10:05:08 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491304387sm25974694f8f.21.2026.05.11.10.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 10:05:04 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3582A60EFD; Mon, 11 May 2026 18:05:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778519107; x=1779123907; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8DK8w3wWlNjyLdHUAxS2nkmLSUJ4xVH9mq/jC0j206M=; b=ZafP+sO0gdYvhC5u0iNFY1jBabfbaox14HNap2q1HDusgB45n/ScquR/MhCifOSaDM lDlutGIoXvzAYO9cDpYiokyFG9NZDr6MU5L0GFx+40Dbjzyeb1aciCWFlgCmOdBTbbQZ jybVFtCvRqxufAzwJnRDqY6II9hMkxRO9UsesYPfyto83p2euRwEvob8C1DsveSwpa0a SG5Ye0rWjWVPcDOSg5udRIFU4xpyOwCmHZYKx/jTzdYtHTVo9b357OJk/D+Nn+z3Zuq4 +YNgCn9Cg+uc5BryMfPcG5CqokKqxG8PXXArRnBzA4lI+kUHLfva1C/Rrsz8F2zscbGa VWXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778519107; x=1779123907; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8DK8w3wWlNjyLdHUAxS2nkmLSUJ4xVH9mq/jC0j206M=; b=nNNBG1g4dc0lxM/lYpLQ7J594M81A+5RMkanA0V5wgLUz6BlWtbafW3dWSlptUGm+V 4rIzrsA2Pdhlzlpby/WVJ1CmtmHL5bf3eC5jfxFoGrRvus1XHvka3v0hCd10orvW6lSU 50J16aPscz+q7z08ydSfuUin343LyJDkhjuBkOpoo888JGxvrc73lq6o23XzAO9Jw2nj 3LR2JnHCzEqphRHoDWhWs2gfYhg6L++SDs2SE0yifBmQ/hpaeRN7qdwFdx6MvmAIEqCg r2KmuPJ/EPc2f6+IvcyVi9GqCYJDDJYlybMh5llr6YDaA4PXbZlfp3xvdc6yRE/FfMC0 541Q== X-Gm-Message-State: AOJu0YyMcj25/AS8SNkJEvKZ3X5oJ+UVUOfRaGT4wR+g9R3+rmDqckCH 7NKzWUfiJlClUJ0P6WznMbpxWEy/P1vdHqwrPrj7/KiiAQoLOi0IdKBH0DTgKr/tgs3dMmoTKT5 eXgCgMQU= X-Gm-Gg: Acq92OG+11Rsjbn4pI6gtuSLXo4XdnMzEkEycEBIeoE7jnEFybhMODohJ3RPSJZXeUF MAGrathsc1DiOMZvNvfcHOvGoC/K0DBXn1HJGSvqlb3ropjyS4os+v+tvKlqxpyFVLMLhGFZKvx 87CvkqvI3dSuTRsOBU2IjDn7UOVbo5c+9oo6gwUt5cZkJlKOwXlf+sU6MQjP5NUCSuR3OWuereL brZBIN67jbP4NXdjv1JKf9ZMclH980Nijvd1bOTtqV+hTR0CMbje6P8bFm2p61PFZlvhkwrp+7x ESlvKiG72F6MmwULtfDDp696rLRdSt+8tjvFg52/Wzy1rnHzwbi5PclpapHSasCNCcdnUd8suxC nRK377fmztj1xqThCCOmsTnZWiU++ZjFu6E9VLw7eXAzBGkIZc0c/5jsifLykJLsSJ2rdPxuQed pCp9dIp1d4khTWTUJRfUOhZgs2HVadUdouDw== X-Received: by 2002:a05:6000:18a6:b0:455:cff5:9178 with SMTP id ffacd0b85a97d-455cff591b5mr18548550f8f.9.1778519106759; Mon, 11 May 2026 10:05:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: John Snow , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Cleber Rosa Subject: [RFC PATCH v2 07/10] .agents/skills: add qemu-mail-thread skill Date: Mon, 11 May 2026 18:04:56 +0100 Message-ID: <20260511170500.124211-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260511170500.124211-1-alex.bennee@linaro.org> References: <20260511170500.124211-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1778519153479158500 Teach agents how to fetch and deal with archives of mail threads. Just YOLO'ing the entire mail thread into an LLM context is quite expensive especially if reviewing a thread against your current tree state. This skill allows the agent to extract just the comments and tags saving tokens. Signed-off-by: Alex Benn=C3=A9e --- v2 - rename to qemu-mail-thread - add instructions on fetching threads via b4 - refactor the metadata handling in the script - mention in AGENTS skill list --- .agents/skills/qemu-mail-thread/SKILL.md | 34 +++++++ .../scripts/qemu_mail_parser.py | 98 +++++++++++++++++++ AGENTS.md | 1 + 3 files changed, 133 insertions(+) create mode 100644 .agents/skills/qemu-mail-thread/SKILL.md create mode 100644 .agents/skills/qemu-mail-thread/scripts/qemu_mail_parse= r.py diff --git a/.agents/skills/qemu-mail-thread/SKILL.md b/.agents/skills/qemu= -mail-thread/SKILL.md new file mode 100644 index 00000000000..58e7c833a27 --- /dev/null +++ b/.agents/skills/qemu-mail-thread/SKILL.md @@ -0,0 +1,34 @@ +# QEMU Mail Thread + +This skill helps you fetch and extract reviewer comments from QEMU mailing= list threads. It can handle standard `mbox` files (e.g., from `b4 mbox`) o= r raw text dumps from the user. + +## How to fetch a mail thread + +If you have a Message-ID (e.g., from a patch series), use `b4` to fetch th= e entire thread: + +```bash +b4 mbox +``` + +This will typically save an `.mbx` file in your current directory. + +## How to parse comments + +Use the included Python script to extract feedback, filtering out quoted t= ext and diffs. + +```bash +python .agents/skills/qemu-mail-thread/scripts/qemu_mail_parser.py +``` + +The script automatically detects whether the input is a standard mbox or a= raw text dump. + +## Expected Output +The script generates `parsed_comments.txt` in the current working director= y: +``` +--- REPLY FROM Reviewer Name --- +Subject: Re: [PATCH 01/10] ... +Comment text here... +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +``` + +Use this structured text to efficiently analyze the feedback and identify = outstanding suggestions. diff --git a/.agents/skills/qemu-mail-thread/scripts/qemu_mail_parser.py b/= .agents/skills/qemu-mail-thread/scripts/qemu_mail_parser.py new file mode 100644 index 00000000000..fdaac57ac15 --- /dev/null +++ b/.agents/skills/qemu-mail-thread/scripts/qemu_mail_parser.py @@ -0,0 +1,98 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +import sys +import os +import mailbox + + +def is_metadata_line(line): + """Check if a line is metadata (quotes, diff, etc.)""" + return (line.startswith(">") or + line.startswith("---") or + line.startswith("diff ")) + + +def parse_raw_text(text, output_f): + # Split by the separator used in lore.kernel.org / b4 dumps + messages =3D text.split("----------------------------------------") + for msg in messages: + if not msg.strip(): continue + + lines =3D msg.strip().split('\n') + author =3D "" + subject =3D "" + body_start =3D 0 + for i, line in enumerate(lines): + if line.startswith("From: "): author =3D line[6:] + if line.startswith("Subject: "): subject =3D line[9:] + if not line.strip() and body_start =3D=3D 0: + body_start =3D i + 1 + break + + is_reply =3D subject and ("Re: " in subject or subject.startswith(= "Re:")) + + if is_reply and author !=3D "" and not author.startswith("qemu-dev= el"): + output_f.write(f"--- REPLY FROM {author} ---\nSubject: {subjec= t}\n") + + for line in lines[body_start:]: + if not is_metadata_line(line): + output_f.write(line + "\n") + output_f.write("=3D"*60 + "\n\n") + + +def parse_mbox(mbox_path, output_f): + mbox =3D mailbox.mbox(mbox_path) + for message in mbox: + subject =3D message['subject'] + if subject and 'Re: ' in subject: + author =3D message['from'] + output_f.write(f"--- REPLY FROM {author} ---\nSubject: {subjec= t}\n") + + payload =3D message.get_payload() + body =3D "" + if isinstance(payload, list): + # Handle multipart + for part in payload: + if part.get_content_type() =3D=3D 'text/plain': + body =3D part.get_payload(decode=3DTrue).decode('u= tf-8', errors=3D'ignore') + break + else: + body =3D message.get_payload(decode=3DTrue).decode('utf-8'= , errors=3D'ignore') + + # Simple heuristic to extract comments + for line in body.split('\n'): + if line.strip() and not is_metadata_line(line.strip()): + output_f.write(line + "\n") + output_f.write("=3D"*60 + "\n\n") + + +def main(): + if len(sys.argv) < 2: + print("Usage: python qemu_mail_parser.py ") + sys.exit(1) + + input_file =3D sys.argv[1] + output_file =3D "parsed_comments.txt" + + if not os.path.exists(input_file): + print(f"Error: File not found - {input_file}") + sys.exit(1) + + with open(output_file, "w", encoding=3D"utf-8") as out_f: + # Detect if it's an mbox or raw text + with open(input_file, 'rb') as f: + header =3D f.read(15) + is_mbox =3D header.startswith(b'From mboxrd@z ') + + if is_mbox: + print(f"Parsing {input_file} as mbox...") + parse_mbox(input_file, out_f) + else: + print(f"Parsing {input_file} as raw text dump...") + with open(input_file, "r", encoding=3D"utf-8", errors=3D'ignor= e') as f: + text =3D f.read() + parse_raw_text(text, out_f) + + print(f"Done. Extracted comments saved to {output_file}") + +if __name__ =3D=3D "__main__": + main() diff --git a/AGENTS.md b/AGENTS.md index fbbc3b65ed0..d99d3078378 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,6 +28,7 @@ You should use the following specialized skills for commo= n tasks: - `qemu-build`: For configuring and building QEMU (including debug and san= itizer builds). - `qemu-testing`: For finding, listing, and running individual tests (Unit= , QTest, Functional, TCG). - `qemu-code-reviewer`: For pulling and applying patch series from mailing= lists. +- `qemu-mail-thread`: For analyzing and parsing mailing list threads. =20 ## Source Code Layout (see `docs/devel/codebase.rst`) - **`accel/`**: Hardware accelerators (KVM, TCG, HVF, Xen, etc.) and archi= tecture-agnostic acceleration code. --=20 2.47.3