{
  "version": 1,
  "actionName": "weeklyEmailDigest",
  "description": "Fetch recent emails and send a digest summary to yourself",
  "parameters": [
    {
      "name": "timePeriod",
      "type": "string",
      "required": false,
      "default": "this week",
      "description": "Time period to summarize (e.g. 'this week', 'today', 'last 3 days')"
    },
    {
      "name": "focus",
      "type": "string",
      "required": false,
      "default": "personal and work emails; skip promotional, marketing, and automated messages",
      "description": "What to focus on or exclude in the digest"
    }
  ],
  "steps": [
    {
      "id": "emails",
      "schemaName": "email",
      "actionName": "findEmail",
      "parameters": {
        "messageRef": {
          "receivedDateTime": {
            "dayRange": "${timePeriod}"
          }
        }
      }
    },
    {
      "id": "digest",
      "schemaName": "utility",
      "actionName": "llmTransform",
      "parameters": {
        "input": "${emails.text}",
        "prompt": "Write a concise email digest from the emails below. Group by topic or sender. Focus on: ${focus}. Use plain text with short bullet points per group.",
        "model": "claude-haiku-4-5-20251001"
      }
    },
    {
      "id": "sent",
      "schemaName": "email",
      "actionName": "sendEmail",
      "parameters": {
        "subject": "Email digest — ${timePeriod}",
        "body": "${digest.text}",
        "to": ["me"],
        "genContent": { "generateBody": false }
      }
    }
  ],
  "grammarPatterns": [
    "send (me)? (a)? (weekly)? email digest (for)? $(timePeriod:wildcard)",
    "give me (my)? (weekly)? email digest (for)? $(timePeriod:wildcard)",
    "email digest (for)? $(timePeriod:wildcard)",
    "(weekly)? email digest",
    "summarize (my)? (recent)? email(s)? (for)? $(timePeriod:wildcard)"
  ]
}
