diff --git a/README.md b/README.md
index 3853127..43a515b 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@ message meets a specified criterion.
- **Advanced parameters** – tune generation settings like temperature, top‑p and more from the options page.
- **Markdown conversion** – optionally convert HTML bodies to Markdown before sending them to the AI service.
- **Debug logging** – optional colorized logs help troubleshoot interactions with the AI service.
+- **Debug tab** – view the last request payload sent to the AI service.
- **Light/Dark themes** – automatically match Thunderbird's appearance with optional manual override.
- **Automatic rules** – create rules that tag, move, copy, forward, reply, delete, archive, mark read/unread or flag/unflag messages based on AI classification. Rules can optionally apply only to unread messages and can ignore messages outside a chosen age range.
- **Rule ordering** – drag rules to prioritize them and optionally stop processing after a match.
diff --git a/modules/AiClassifier.js b/modules/AiClassifier.js
index b35cb2c..8313654 100644
--- a/modules/AiClassifier.js
+++ b/modules/AiClassifier.js
@@ -308,6 +308,11 @@ async function classifyText(text, criterion, cacheKey = null) {
}
const payload = buildPayload(text, criterion);
+ try {
+ await storage.local.set({ lastPayload: JSON.parse(payload) });
+ } catch (e) {
+ aiLog('failed to save last payload', { level: 'warn' }, e);
+ }
aiLog(`[AiClassifier] Sending classification request to ${gEndpoint}`, {debug: true});
aiLog(`[AiClassifier] Classification request payload:`, { debug: true }, payload);
diff --git a/options/options.html b/options/options.html
index 69158b1..d14ce99 100644
--- a/options/options.html
+++ b/options/options.html
@@ -47,6 +47,7 @@