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:
Our upcoming compliance check requires that correspondence tied to internal project coordination stays cleanly separated from my general inbox.

Please create a label named “Project Compliance Records” if it isn’t already in my list.

I need a rule that applies this label to all incoming messages from project-team@company.com, and also to messages whose subject line contains strategic indicators like “roadmap”, “milestone”, or “delivery”, since those are part of our governance documentation.

Some older threads may contain a mix of project-team mail and my own replies, so ensure that every thread involving project-team@company.com
 or containing those key subjects is captured under “Project Compliance Records”.

The objective is to ensure every project-related conversation — past and future — appears in a single compliant record group.

Available tools:
list_threads
list_filters
list_labels
create_filter
create_label
modify_thread

Verification checks:
[{"verifier_type": "database_state", "name": "Project Compliance Records exists", "description": "Confirms the label was created exactly once with correct name and correct user association.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM labels\nWHERE name = 'Project Compliance Records'\n  AND user_id = 'user_001';\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "Filter exists for project-team + roadmap/milestone/delivery", "description": "Ensures that exactly ONE filter exists where the filter criteria includes project-team@company.com or any of the required subjects, and the filter action applies the correct label.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM filters f\nJOIN labels l ON l.id = JSON_EXTRACT(f.action_json, '$.addLabelIds[0]')\nWHERE f.user_id = 'user_001'\n  AND l.name = 'Project Compliance Records'\n  AND (\n        f.criteria_json LIKE '%project-team@company.com%'\n     OR f.criteria_json LIKE '%roadmap%'\n     OR f.criteria_json LIKE '%milestone%'\n     OR f.criteria_json LIKE '%delivery%'\n      );\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "Thread containing project milestone was labeled", "description": "Checks that the message in thread_002 containing the subject \"Project Milestone Review\" received the label.", "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\nJOIN labels l ON l.id = ml.label_id\nWHERE m.thread_id = 'thread_002'\n  AND l.name = 'Project Compliance Records'\n  AND l.user_id = 'user_001';\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "No old or conflicting filters remain", "description": "Ensures that no other filters referencing project-team@company.com, roadmap, milestone, or delivery exist besides the correct one.", "gym_name": "gym-email-mcp", "validation_config": {"query": "SELECT COUNT(*) AS cnt\nFROM filters\nWHERE user_id = 'user_001'\n  AND (\n        criteria_json LIKE '%project-team@company.com%'\n     OR criteria_json LIKE '%roadmap%'\n     OR criteria_json LIKE '%milestone%'\n     OR criteria_json LIKE '%delivery%'\n      );\n", "expected_value": 1, "comparison_type": "equals"}}, {"verifier_type": "database_state", "name": "Label applied to all matching historical messages", "description": "Ensures any message whose subject matched roadmap/milestone/delivery was labeled (in DB snapshot only thread_002 qualifies).", "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\nJOIN labels l ON l.id = ml.label_id\nWHERE l.name = 'Project Compliance Records'\n  AND l.user_id = 'user_001'\n  AND (\n        m.snippet LIKE '%roadmap%'\n     OR m.snippet LIKE '%milestone%'\n     OR m.snippet LIKE '%delivery%'\n      );\n", "expected_value": 1, "comparison_type": "equals"}}]