{
  "jimothyPipeline": 1,
  "name": "Weekly support trends",
  "description": "Finds the themes in the week’s tickets, what’s rising, and which docs or bugs would cut volume most.",
  "icon": "sparkles",
  "color": "#b45309",
  "repo": {
    "mode": "inplace",
    "localPath": ""
  },
  "concurrency": 1,
  "variables": {
    "slackWebhookUrl": ""
  },
  "steps": [
    {
      "id": "find",
      "name": "Find export",
      "type": "shell",
      "description": "Picks the newest CSV and last week’s report.",
      "timeoutMinutes": 1,
      "command": "f=$(ls -t -- *.csv 2>/dev/null | head -1); [ -n \"$f\" ] || { echo \"Put the ticket export (.csv) in $(pwd)\"; exit 1; }; echo \"Export: $f\"; last=$(ls -t reports/support-*.md 2>/dev/null | head -1); echo \"Last report: $last\""
    },
    {
      "id": "analyze",
      "name": "Find themes",
      "type": "agent",
      "description": "Counts tickets with a script, clusters subjects into themes, compares with last week and saves the report.",
      "harnessId": "claude-code",
      "model": "sonnet",
      "dependsOn": [
        "find"
      ],
      "timeoutMinutes": 30,
      "prompt": "{{steps.find.output}}\n\n1. With a script, count tickets in the export by category or tag and by status.\n2. Read the subjects (and descriptions, if present) and group them into themes that explain the volume, with a count and two example ticket ids each.\n3. If there's a last report, compare and flag themes that grew by more than 50% or are new.\n4. Recommend up to three help articles and up to three bug fixes that would remove the most tickets, with the tickets they'd cover.\n\nSave the report to reports/support-<today as YYYY-MM-DD>.md (create the folder if needed) and don't modify any other file. Your final answer is the same report as a Slack message (*bold*, - bullets), under 350 words."
    },
    {
      "id": "post",
      "name": "Post to Slack",
      "type": "shell",
      "description": "Posts the report to the support channel.",
      "dependsOn": [
        "analyze"
      ],
      "timeoutMinutes": 2,
      "command": "printf '{\"text\":%s}' {{steps.analyze.output | json}} | curl -fsS -X POST -H 'Content-Type: application/json' --data @- {{vars.slackWebhookUrl}}"
    }
  ]
}