{
  "name": "WF03-\uba85\uc138\uc11c\uc0dd\uc131",
  "id": "7kZOpw4nYXj5aWIG",
  "description": "Claude Code \uae30\ubc18 \ud2b9\ud5c8 \uba85\uc138\uc11c \uc790\ub3d9 \uc0dd\uc131 \uc6cc\ud06c\ud50c\ub85c\uc6b0 - \uccad\uad6c\ud56d \u2192 \uc0c1\uc138\uc124\uba85 \u2192 \ub3c4\uba74\uc124\uba85 \uc21c\ucc28 \uc0dd\uc131",
  "active": false,
  "nodes": [
    {
      "id": "webhook-trigger",
      "name": "\uba85\uc138\uc11c \uc0dd\uc131 Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "wf03-generate-patent-spec",
        "responseMode": "lastNode"
      }
    },
    {
      "id": "load-context",
      "name": "\ucee8\ud14d\uc2a4\ud2b8 \ub85c\ub4dc",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "id": "prepare-claim-prompt",
      "name": "\uccad\uad6c\ud56d \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ]
    },
    {
      "id": "generate-claims",
      "name": "\uccad\uad6c\ud56d \uc0dd\uc131 (AI)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        660,
        0
      ]
    },
    {
      "id": "prepare-description-prompt",
      "name": "\uc0c1\uc138\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        0
      ]
    },
    {
      "id": "generate-description",
      "name": "\uc0c1\uc138\uc124\uba85 \uc0dd\uc131 (AI)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        1100,
        0
      ]
    },
    {
      "id": "prepare-drawing-prompt",
      "name": "\ub3c4\uba74\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1320,
        0
      ]
    },
    {
      "id": "generate-drawing-desc",
      "name": "\ub3c4\uba74\uc124\uba85 \uc0dd\uc131 (AI)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        1540,
        0
      ]
    },
    {
      "id": "format-kipo",
      "name": "KIPO \ud3ec\ub9f7 \uc870\ub9bd",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1760,
        0
      ]
    },
    {
      "id": "set-output",
      "name": "\ucd9c\ub825 \ub370\uc774\ud130 \uc124\uc815",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1980,
        0
      ]
    },
    {
      "id": "convert-to-markdown",
      "name": "\uba85\uc138\uc11c Markdown \ubcc0\ud658",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2200,
        0
      ],
      "parameters": {
        "jsCode": "// \uba85\uc138\uc11c\ub97c Markdown \ud30c\uc77c\ub85c \ubcc0\ud658\nconst data = $input.first().json;\n\n// KIPO \ud3ec\ub9f7 \uba85\uc138\uc11c \uc870\ub9bd\nconst specContent = `# ${data.invention_title || '\ud2b9\ud5c8 \uba85\uc138\uc11c'}\\n\\n` +\n  `**Patent ID**: ${data.patent_id}\\n\\n` +\n  `---\\n\\n` +\n  `## \u3010\ud2b9\ud5c8\uccad\uad6c\ubc94\uc704\u3011\\n\\n${data.claims || ''}\\n\\n` +\n  `## \u3010\ubc1c\uba85\uc758 \uc0c1\uc138\ud55c \uc124\uba85\u3011\\n\\n${data.detailed_description || ''}\\n\\n` +\n  `## \u3010\ub3c4\uba74\uc758 \uac04\ub2e8\ud55c \uc124\uba85\u3011\\n\\n${data.drawing_description || ''}\\n\\n` +\n  `---\\n\\n` +\n  `*\uc0dd\uc131\uc77c: ${new Date().toISOString()}*`;\n\nreturn [{\n  json: {\n    ...data,\n    spec_content: specContent,\n    status: 'reviewing'\n  },\n  binary: {\n    data: Buffer.from(specContent, 'utf-8').toString('base64')\n  }\n}];"
      }
    },
    {
      "id": "google-drive-upload-spec",
      "name": "Google Drive \uc5c5\ub85c\ub4dc (\uba85\uc138\uc11c\ucd08\uc548)",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        2420,
        0
      ],
      "parameters": {
        "operation": "upload",
        "folderId": {
          "__rl": true,
          "value": "={{ $vars.GOOGLE_DRIVE_DRAFT_FOLDER_ID }}",
          "mode": "id"
        },
        "name": "=\uba85\uc138\uc11c\ucd08\uc548_{{ $json.patent_id }}_{{ $now.format('yyyyMMdd') }}.md",
        "options": {
          "mimeType": "text/markdown"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "google-sheets-update-status",
      "name": "Google Sheets \uc0c1\ud0dc \uc5c5\ub370\uc774\ud2b8",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        2640,
        0
      ],
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "={{ $vars.GOOGLE_SHEETS_TRACKING_ID }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "\uc81c\ucd9c\uc774\ub825",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Patent ID": "={{ $json.patent_id }}",
            "\uc0c1\ud0dc": "reviewing",
            "\uba85\uc138\uc11c\ucd08\uc548 URL": "={{ $('Google Drive \uc5c5\ub85c\ub4dc (\uba85\uc138\uc11c\ucd08\uc548)').item.json.webViewLink }}"
          }
        },
        "options": {
          "updateLookupColumn": "Patent ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "set-output-with-spec-url",
      "name": "\uba85\uc138\uc11c URL \ud3ec\ud568 \ucd9c\ub825",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2860,
        0
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "spec_drive_url",
              "name": "spec_drive_url",
              "value": "={{ $('Google Drive \uc5c5\ub85c\ub4dc (\uba85\uc138\uc11c\ucd08\uc548)').item.json.webViewLink }}",
              "type": "string"
            },
            {
              "id": "status",
              "name": "status",
              "value": "reviewing",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true
      }
    },
    {
      "id": "call-wf04",
      "name": "WF04 \uac80\uc218\uc694\uccad \ud638\ucd9c",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        3080,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $vars.N8N_WEBHOOK_URL }}/wf04-review-request",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "\uba85\uc138\uc11c \uc0dd\uc131 Webhook": {
      "main": [
        [
          {
            "node": "\ucee8\ud14d\uc2a4\ud2b8 \ub85c\ub4dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ucee8\ud14d\uc2a4\ud2b8 \ub85c\ub4dc": {
      "main": [
        [
          {
            "node": "\uccad\uad6c\ud56d \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uccad\uad6c\ud56d \ud504\ub86c\ud504\ud2b8 \uc900\ube44": {
      "main": [
        [
          {
            "node": "\uccad\uad6c\ud56d \uc0dd\uc131 (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uccad\uad6c\ud56d \uc0dd\uc131 (AI)": {
      "main": [
        [
          {
            "node": "\uc0c1\uc138\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uc0c1\uc138\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44": {
      "main": [
        [
          {
            "node": "\uc0c1\uc138\uc124\uba85 \uc0dd\uc131 (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uc0c1\uc138\uc124\uba85 \uc0dd\uc131 (AI)": {
      "main": [
        [
          {
            "node": "\ub3c4\uba74\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ub3c4\uba74\uc124\uba85 \ud504\ub86c\ud504\ud2b8 \uc900\ube44": {
      "main": [
        [
          {
            "node": "\ub3c4\uba74\uc124\uba85 \uc0dd\uc131 (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ub3c4\uba74\uc124\uba85 \uc0dd\uc131 (AI)": {
      "main": [
        [
          {
            "node": "KIPO \ud3ec\ub9f7 \uc870\ub9bd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KIPO \ud3ec\ub9f7 \uc870\ub9bd": {
      "main": [
        [
          {
            "node": "\ucd9c\ub825 \ub370\uc774\ud130 \uc124\uc815",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ucd9c\ub825 \ub370\uc774\ud130 \uc124\uc815": {
      "main": [
        [
          {
            "node": "\uba85\uc138\uc11c Markdown \ubcc0\ud658",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uba85\uc138\uc11c Markdown \ubcc0\ud658": {
      "main": [
        [
          {
            "node": "Google Drive \uc5c5\ub85c\ub4dc (\uba85\uc138\uc11c\ucd08\uc548)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive \uc5c5\ub85c\ub4dc (\uba85\uc138\uc11c\ucd08\uc548)": {
      "main": [
        [
          {
            "node": "Google Sheets \uc0c1\ud0dc \uc5c5\ub370\uc774\ud2b8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets \uc0c1\ud0dc \uc5c5\ub370\uc774\ud2b8": {
      "main": [
        [
          {
            "node": "\uba85\uc138\uc11c URL \ud3ec\ud568 \ucd9c\ub825",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uba85\uc138\uc11c URL \ud3ec\ud568 \ucd9c\ub825": {
      "main": [
        [
          {
            "node": "WF04 \uac80\uc218\uc694\uccad \ud638\ucd9c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "version": "1.2.0",
    "created": "2026-01-10",
    "updated": "2026-01-13",
    "project": "MAIPatent",
    "workflow_sequence": 3,
    "next_workflow": "WF04-human-review",
    "trigger_connection": "HTTP Request to WF04 Webhook",
    "ai_model": "gpt-4o",
    "generation_order": [
      "claims",
      "description",
      "drawing_description"
    ]
  }
}