Domain: email

System prompt:
You are a helpful Email assistant with access to all available tools. Operate in a safe and fully authorized environment—you do not need to ask for confirmation or permission before taking action. When identifiers such as names or IDs are missing, perform exactly one lookup per entity type, verify that you are reusing correct values from previous responses, and proceed using the retrieved data. Never assume or fabricate IDs, responses, or outcomes—rely solely on verified API results. Complete each task in a single, logical, and efficient execution flow.

Task:
I want to streamline the way I track important work conversations. 
Find all messages that mention timelines, performance metrics, approvals, project milestones, or anything that clearly describes progress or results. 
Label these messages as “Work Insight”.

For any of these that belong to a multi-message thread, tag the entire thread with “Ongoing Discussion”.  
If the message includes any attachments, add another label called “Documented Insight”.

Next, check whether the message is already marked under “Projects” or “Important”.  
If so, treat it as more critical and label it “Priority Insight”.

If the message appears later in its thread rather than being the first one, also add “Follow-Up Insight”.

Please ignore drafts and only create new labels when necessary.

Available tools:
list_messages
modify_message
list_labels
get_thread
create_label

Verification checks:
[{"verifier_type": "database_state", "name": "priority_insight_on_existing_priority_messages", "description": "Messages originally labeled Important or Projects (msg_001, msg_002) must have Priority Insight.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Priority Insight')\n  AND ml.message_id IN ('msg_001', 'msg_002');", "expected_value": 2, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "work_insight_applied_correctly", "description": "Ensures all 3 target messages received Work Insight.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Work Insight')\n  AND ml.message_id IN ('msg_001', 'msg_002', 'msg_003');\n", "expected_value": 3, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "ongoing_discussion_multithread", "description": "Ensures both messages in thread_001 have Ongoing Discussion.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nJOIN messages m ON m.id = ml.message_id\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Ongoing Discussion')\n  AND m.thread_id = 'thread_001';", "expected_value": 2, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "documented_insight_for_pdf", "description": "Only msg_002 (with PDF) should have Documented Insight.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Documented Insight')\n  AND ml.message_id = 'msg_002';\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "follow_up_insight_applied_correctly", "description": "Ensures msg_003 (follow-up) has Follow-Up Insight.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Follow-Up Insight')\n  AND ml.message_id = 'msg_003';\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "follow_up_not_on_first_message", "description": "Ensures msg_001 (first message) does NOT have Follow-Up Insight.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Follow-Up Insight')\n  AND ml.message_id = 'msg_001';\n", "expected_value": 0, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "ongoing_discussion_not_on_single_message_thread", "description": "Ensures no messages in thread_002 have Ongoing Discussion.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nJOIN messages m ON m.id = ml.message_id\nWHERE ml.label_id = (SELECT id FROM labels WHERE name = 'Ongoing Discussion')\n  AND m.thread_id = 'thread_002';\n", "expected_value": 0, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "draft_message_untouched", "description": "Draft must not have ANY of the new labels.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM message_labels ml\nWHERE ml.message_id = 'draft_msg_001'\n  AND ml.label_id IN (\n      SELECT id FROM labels \n      WHERE name IN (\n        'Work Insight',\n        'Ongoing Discussion',\n        'Documented Insight',\n        'Priority Insight',\n        'Follow-Up Insight'\n      )\n  );\n", "expected_value": 0, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "all_new_labels_created", "description": "Check all 5 new labels exist.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM labels\nWHERE name IN (\n  'Work Insight',\n  'Ongoing Discussion',\n  'Documented Insight',\n  'Priority Insight',\n  'Follow-Up Insight'\n);\n", "expected_value": 5, "comparison_type": "equals"}}]