{
  "name": "Draft Tweet from Selection",
  "description": "Highlight an idea, right-click, and get a punchy, tweet-length draft on your clipboard — written privately on your own device.",
  "tags": [
    "twitter",
    "social media",
    "writing",
    "ai",
    "local ai",
    "drafting"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "🐦 Turn anything into a tweet.\n\nHighlight some text on any page, right-click, and choose this workflow — it drafts a punchy tweet under 280 characters and copies it to your clipboard, ready to paste. The AI runs locally in your browser; nothing leaves your device. Pick a model the first time.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 340,
      "height": 210,
      "measured": {
        "width": 340,
        "height": 210
      }
    },
    {
      "id": "trigger-context-menu",
      "position": {
        "x": 100,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:contextMenu"
        },
        "label": "Right-click a selection",
        "inputs": {
          "contexts": [
            "selection"
          ]
        },
        "parameters": {
          "notes": "Adds this workflow to the right-click menu whenever you have text selected."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "trigger",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "get-selection",
      "position": {
        "x": 320,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:getSelectedTextNode"
        },
        "label": "Get selected text",
        "inputs": {
          "outputFieldName": "selection",
          "options": {
            "includeInputFields": true
          }
        },
        "parameters": {
          "notes": "Reads the full text you highlighted on the page. The context-menu event only carries a short, truncated copy, so this node gets the complete selection reliably."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "draft",
      "position": {
        "x": 510,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:agent:basicLLMChain"
        },
        "label": "Draft a tweet",
        "inputs": {
          "prompt": "Turn this into a punchy tweet under 280 characters:\n\n{{ $input.selection }}"
        },
        "parameters": {
          "notes": "Turns your selection into a punchy, tweet-length draft."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "agent",
      "measured": {
        "width": 144,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "local-model",
      "position": {
        "x": 440,
        "y": 500
      },
      "data": {
        "instance": {
          "id": "af-base-node:dependency:webLLM"
        },
        "label": "Local AI model",
        "inputs": {
          "model": "",
          "options": {
            "temperature": 0.5
          }
        },
        "parameters": {
          "notes": "Runs the AI model locally in your browser. Pick a model the first time — nothing is sent to a server."
        },
        "runned": false,
        "isRunning": false,
        "failed": false,
        "wasRunned": false,
        "skipped": false
      },
      "type": "dependency",
      "measured": {
        "width": 30,
        "height": 30
      },
      "selected": false
    },
    {
      "id": "copy-result",
      "position": {
        "x": 820,
        "y": 120
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:clipboardWriteNode"
        },
        "label": "Copy the tweet",
        "inputs": {
          "text": "{{ $input.response }}"
        },
        "parameters": {
          "notes": "Copies the tweet draft to your clipboard, ready to paste."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "sticky-model",
      "position": {
        "x": 440,
        "y": 660
      },
      "data": {
        "color": "#ffd9b3",
        "content": "Setup needed: pick a local model the first time you run this. It downloads once, then runs fully offline.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 300,
      "height": 110,
      "measured": {
        "width": 300,
        "height": 110
      }
    },
    {
      "id": "46ab6639-ef17-47a1-8215-8946542560ab",
      "type": "basic",
      "position": {
        "x": 850,
        "y": 430
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "displayMarkdownNode-8-788",
        "inputs": {
          "title": "Twitter Draft",
          "content": "{{ $input.response }}"
        },
        "runned": false,
        "isRunning": false,
        "failed": false,
        "wasRunned": false,
        "skipped": false
      },
      "origin": [
        0.5,
        0
      ],
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": true,
      "dragging": false
    }
  ],
  "edges": [
    {
      "id": "e-ctx-get-selection",
      "type": "flowEdge",
      "source": "trigger-context-menu",
      "target": "get-selection",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-trigger-draft",
      "type": "flowEdge",
      "source": "get-selection",
      "target": "draft",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-draft-model",
      "type": "flowEdge",
      "source": "draft",
      "target": "local-model",
      "sourceHandle": "dependency-0",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-draft-copy",
      "type": "flowEdge",
      "source": "draft",
      "target": "copy-result",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "source": "draft",
      "sourceHandle": "output-0",
      "target": "46ab6639-ef17-47a1-8215-8946542560ab",
      "targetHandle": "input-0",
      "id": "xy-edge__draftoutput-0-46ab6639-ef17-47a1-8215-8946542560abinput-0",
      "markerEnd": {
        "type": "arrowclosed"
      }
    }
  ],
  "requiredInputs": [
    {
      "nodeId": "local-model",
      "field": "model"
    }
  ]
}