{
  "jimothyPipeline": 1,
  "name": "Help article from a solved ticket",
  "description": "Drafts a help article, or an update to an existing one, from a solved support conversation.",
  "icon": "sparkles",
  "color": "#d97706",
  "repo": {
    "mode": "scratch"
  },
  "concurrency": 2,
  "variables": {
    "helpCenterUrl": "https://help.acme.example",
    "style": "Title as the question customers ask. One-line answer first, then numbered steps with exact button and menu names. Second person, present tense. No screenshots referenced.",
    "helpCenterWebhookUrl": ""
  },
  "steps": [
    {
      "id": "draft",
      "name": "Draft article",
      "type": "agent",
      "description": "Checks your help center for an existing article and drafts a new one or an update.",
      "harnessId": "claude-code",
      "model": "sonnet",
      "timeoutMinutes": 20,
      "prompt": "A support ticket was solved and tagged for the knowledge base.\n\nSubject: {{issue.title}}\nConversation:\n{{issue.description | truncate:30000}}\n\nSearch {{vars.helpCenterUrl}} for an article that already covers this. Then write either:\n- \"UPDATE: <article URL>\" on the first line, followed by the full revised article, if one exists; or\n- \"NEW\" on the first line, followed by a new article.\n\nStyle: {{vars.style}}\nUse the agent's working answer from the conversation, not the customer's guesses. Leave out every customer detail: names, emails, company names, account ids. Markdown, starting with a # title after the first line.{{#if steps.approve.output}}\n\nYour previous draft was rejected with this feedback. Rewrite it:\n{{steps.approve.output}}{{/if}}"
    },
    {
      "id": "approve",
      "name": "Approve article",
      "type": "approval",
      "description": "Shows you the article. Reject with a comment and it is rewritten.",
      "dependsOn": [
        "draft"
      ],
      "loopBackTo": "draft",
      "maxLoops": 3,
      "approvalMessage": "Send this article to the help center as a draft?\n\n---\n\n{{steps.draft.output}}"
    },
    {
      "id": "publish",
      "name": "Send to help center",
      "type": "shell",
      "description": "Sends the draft to your help center through a webhook.",
      "dependsOn": [
        "approve"
      ],
      "timeoutMinutes": 2,
      "command": "printf '{\"ticket\":%s,\"action\":%s,\"article\":%s}' {{issue.key | json}} {{steps.draft.output | first_line | json}} {{steps.draft.output | json}} | curl -fsS -X POST -H 'Content-Type: application/json' --data @- {{vars.helpCenterWebhookUrl}}"
    }
  ]
}