{
  "id": "ct9CXaSztxJhhkhm",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "GPT 4.1-Mini Contract Extraction, Risk Analysis & Compliance Audit Automation",
  "tags": [],
  "nodes": [
    {
      "id": "1f0ade6a-6133-45ac-9803-62a5fc98c23a",
      "name": "Schedule Contract Review",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        432,
        144
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 2
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f3d62b6-8f75-4218-b5c2-836b5985dc18",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "repositoryApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Contract Repository API URL__>"
            },
            {
              "id": "id-2",
              "name": "dashboardApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Dashboard API Endpoint__>"
            },
            {
              "id": "id-3",
              "name": "clmSystemUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__CLM System API URL__>"
            },
            {
              "id": "id-4",
              "name": "erpSystemUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__ERP System API URL__>"
            },
            {
              "id": "id-5",
              "name": "complianceRulesUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Compliance Rules API or File URL__>"
            },
            {
              "id": "id-6",
              "name": "riskThresholdHigh",
              "type": "number",
              "value": 80
            },
            {
              "id": "id-7",
              "name": "riskThresholdMedium",
              "type": "number",
              "value": 50
            },
            {
              "id": "id-8",
              "name": "slackChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for Alerts__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "793d7e3e-8cd1-4dff-b316-fb6960cdb5e3",
      "name": "Webhook - Contract Upload",
      "type": "n8n-nodes-base.webhook",
      "position": [
        864,
        336
      ],
      "parameters": {
        "path": "contract-upload",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "bc46037f-ceca-43ce-8790-09e79522d05f",
      "name": "Gmail - Contract Emails",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        864,
        528
      ],
      "parameters": {
        "filters": {
          "q": "subject:contract"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 5
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "326f85fc-9785-4da0-ad00-05c8d13e45b2",
      "name": "Fetch Contracts from Repository",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        144
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.repositoryApiUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "d9559a33-bb2a-4c74-bee0-53f78946b1ed",
      "name": "Merge All Contract Sources",
      "type": "n8n-nodes-base.merge",
      "position": [
        1104,
        176
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "389d8496-b07a-4854-9190-a28016a780c6",
      "name": "Extract Contract Content",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1280,
        192
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "bca5340d-de9a-4ccc-b412-79cdd77371ae",
      "name": "Text Splitter - Clause Chunking",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1472,
        496
      ],
      "parameters": {
        "options": {},
        "chunkSize": 2000,
        "chunkOverlap": 200
      },
      "typeVersion": 1
    },
    {
      "id": "a9de0d18-f5ce-4625-91e4-c311d098d01a",
      "name": "Document Loader - Contract Processing",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1472,
        368
      ],
      "parameters": {
        "options": {},
        "dataType": "binary",
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "2550a4ef-5f91-40d9-a5e6-bd579644bf85",
      "name": "OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1296,
        432
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a158b707-625e-4915-a281-81a78188170b",
      "name": "Vector Store - Contract Clauses",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1456,
        192
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "181085ab-6527-48b9-a2cc-fe694429a745",
      "name": "OpenAI Chat Model - Compliance Analysis",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1792,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "334410e0-6443-4ff2-8e3c-36f6ed139e07",
      "name": "Structured Parser - Compliance Results",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1920,
        400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"contractId\": \"string\",\n  \"complianceStatus\": \"compliant|non-compliant|partial\",\n  \"findings\": [\n    {\n      \"clause\": \"string\",\n      \"issue\": \"string\",\n      \"severity\": \"high|medium|low\",\n      \"recommendation\": \"string\"\n    }\n  ],\n  \"missingClauses\": [\"string\"],\n  \"deviations\": [\"string\"],\n  \"summary\": \"string\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6979c919-2a3c-47d5-a377-4005adc34acf",
      "name": "AI Agent - Compliance Checker",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1792,
        192
      ],
      "parameters": {
        "text": "=You are a contract compliance expert. Analyze the provided contract document against standard compliance rules and regulatory frameworks. Your task is to:\n\n1. Identify all key clauses in the contract\n2. Check for compliance with standard legal requirements (liability, indemnification, termination, confidentiality, payment terms, dispute resolution)\n3. Detect missing mandatory clauses\n4. Identify deviations from best practices\n5. Flag potential legal risks or breaches\n6. Assess severity of each finding (high, medium, low)\n7. Provide actionable recommendations\n\nContract to analyze: {{ $json.extractedText }}\n\nProvide a comprehensive compliance assessment.",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "f5cb2b29-926e-4a10-a4f4-8ec200f749ed",
      "name": "Calculate Risk Score",
      "type": "n8n-nodes-base.code",
      "position": [
        2096,
        192
      ],
      "parameters": {
        "jsCode": "// Risk Scoring Algorithm for Contract Compliance\nconst items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n  const data = item.json;\n  \n  // Initialize risk score\n  let riskScore = 0;\n  let riskFactors = [];\n  \n  // Severity weights\n  const severityWeights = {\n    high: 30,\n    medium: 15,\n    low: 5\n  };\n  \n  // 1. Compliance Status Impact (0-40 points)\n  if (data.complianceStatus === 'non-compliant') {\n    riskScore += 40;\n    riskFactors.push('Non-compliant status');\n  } else if (data.complianceStatus === 'partial') {\n    riskScore += 20;\n    riskFactors.push('Partial compliance');\n  }\n  \n  // 2. Findings Severity Score (0-40 points)\n  if (data.findings && Array.isArray(data.findings)) {\n    const findingsScore = data.findings.reduce((score, finding) => {\n      return score + (severityWeights[finding.severity] || 0);\n    }, 0);\n    riskScore += Math.min(findingsScore, 40);\n    riskFactors.push(`${data.findings.length} findings detected`);\n  }\n  \n  // 3. Missing Clauses Impact (0-15 points)\n  if (data.missingClauses && data.missingClauses.length > 0) {\n    const missingScore = Math.min(data.missingClauses.length * 5, 15);\n    riskScore += missingScore;\n    riskFactors.push(`${data.missingClauses.length} missing clauses`);\n  }\n  \n  // 4. Deviations Impact (0-5 points)\n  if (data.deviations && data.deviations.length > 0) {\n    riskScore += Math.min(data.deviations.length * 2, 5);\n    riskFactors.push(`${data.deviations.length} deviations`);\n  }\n  \n  // Cap risk score at 100\n  riskScore = Math.min(riskScore, 100);\n  \n  // Determine risk level\n  let riskLevel;\n  if (riskScore >= 80) {\n    riskLevel = 'CRITICAL';\n  } else if (riskScore >= 50) {\n    riskLevel = 'HIGH';\n  } else if (riskScore >= 25) {\n    riskLevel = 'MEDIUM';\n  } else {\n    riskLevel = 'LOW';\n  }\n  \n  // Calculate business impact\n  const highSeverityCount = data.findings?.filter(f => f.severity === 'high').length || 0;\n  const businessImpact = highSeverityCount > 2 ? 'SEVERE' : highSeverityCount > 0 ? 'MODERATE' : 'MINIMAL';\n  \n  results.push({\n    json: {\n      ...data,\n      riskScore,\n      riskLevel,\n      riskFactors,\n      businessImpact,\n      reviewPriority: riskLevel === 'CRITICAL' || riskLevel === 'HIGH' ? 'URGENT' : 'STANDARD',\n      assessmentTimestamp: new Date().toISOString(),\n      requiresLegalReview: riskScore >= 50\n    }\n  });\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "3d8bb1af-a363-4305-89da-7dfc8c32422c",
      "name": "Store Compliance Results",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2288,
        304
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "<__PLACEHOLDER_VALUE__Compliance Results Table Name__>"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {}
      },
      "typeVersion": 2.6
    },
    {
      "id": "707ef78c-94ac-46f1-a267-27fe485e6a01",
      "name": "Route by Risk Level",
      "type": "n8n-nodes-base.switch",
      "position": [
        2448,
        416
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Critical Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "CRITICAL"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "High Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "HIGH"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Medium Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "MEDIUM"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Low Risk"
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "2a2c733f-76c0-45b3-a3b5-f1052fe1e0c7",
      "name": "Alert - High Risk Contracts",
      "type": "n8n-nodes-base.slack",
      "position": [
        2576,
        208
      ],
      "parameters": {
        "text": "=\ud83d\udea8 *HIGH RISK CONTRACT DETECTED*\n\n*Contract ID:* {{ $json.contractId }}\n*Risk Level:* {{ $json.riskLevel }}\n*Risk Score:* {{ $json.riskScore }}/100\n*Business Impact:* {{ $json.businessImpact }}\n*Compliance Status:* {{ $json.complianceStatus }}\n\n*Key Issues:*\n\u2022 {{ $json.riskFactors.join(\"\\n\u2022 \") }}\n\n*Action Required:* {{ $json.reviewPriority }} legal review needed\n\n*Timestamp:* {{ $json.assessmentTimestamp }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a183b50f-1756-46a1-b7bd-383ad4357a4f",
      "name": "Send to Dashboard API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2752,
        304
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.dashboardApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "030ed3d2-2523-473b-a07d-2b1d3dd61879",
      "name": "Update CLM System",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2912,
        304
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.clmSystemUrl }}",
        "method": "PUT",
        "options": {},
        "jsonBody": "={\n  \"contractId\": \"{{ $json.contractId }}\",\n  \"complianceStatus\": \"{{ $json.complianceStatus }}\",\n  \"riskScore\": {{ $json.riskScore }},\n  \"lastAssessment\": \"{{ $json.assessmentTimestamp }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "d2c732a8-a300-4e36-9467-b16e0a4e3e82",
      "name": "Update ERP System",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3072,
        304
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.erpSystemUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contractId\": \"{{ $json.contractId }}\",\n  \"riskLevel\": \"{{ $json.riskLevel }}\",\n  \"requiresAction\": {{ $json.requiresLegalReview }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "97ac219c-4109-49cf-9331-88579ea8b2b8",
      "name": "Prepare Audit Trail",
      "type": "n8n-nodes-base.set",
      "position": [
        3232,
        304
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "auditId",
              "type": "string",
              "value": "={{ $now.toISO() }}-{{ $json.contractId }}"
            },
            {
              "id": "id-2",
              "name": "workflowExecutionId",
              "type": "string",
              "value": "={{ $execution.id }}"
            },
            {
              "id": "id-3",
              "name": "processedBy",
              "type": "string",
              "value": "AI Compliance Checker"
            },
            {
              "id": "id-4",
              "name": "auditTimestamp",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "id-5",
              "name": "dataRetentionDays",
              "type": "number",
              "value": 2555
            },
            {
              "id": "id-6",
              "name": "explainabilityReport",
              "type": "string",
              "value": "={{ JSON.stringify($json.findings) }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "89e84b2b-4f58-4d90-9f0c-bb6aea030212",
      "name": "Store Audit Trail",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3376,
        304
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "<__PLACEHOLDER_VALUE__Audit Trail Table Name__>"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {}
      },
      "typeVersion": 2.6
    },
    {
      "id": "402a9660-3b29-4856-af81-0d44364d0db9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -416
      ],
      "parameters": {
        "width": 576,
        "height": 192,
        "content": "## How It Works\nScheduled triggers initiate automated contract reviews. The system fetches documents from cloud storage and email, then uses AI to extract key terms, obligations, and compliance requirements. Multi-model parsing identifies gaps, inconsistencies, and potential risks. A scoring engine evaluates severity and routes alerts to the appropriate channels. The workflow then updates the CLM system and produces audit-ready documentation for tracking and governance.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "04ac6443-b496-4a79-8f9d-2bf2f22e6df8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -416
      ],
      "parameters": {
        "width": 368,
        "height": 320,
        "content": "## Setup Instructions\n1. **Storage:** Configure access to your Google Drive or webhook-based document repository.\n2. **Email:** Connect Gmail to automatically ingest contract-related emails.\n3. **AI Extraction:** Add the OpenAI API key and define extraction prompts for obligations and terms.\n4. **CLM System:** Enter credentials for your contract lifecycle management platform.\n5. **Alerts:** Set up Google Sheets logging and connect dashboard endpoints for risk and compliance alerts."
      },
      "typeVersion": 1
    },
    {
      "id": "f333e27d-c821-4719-bd94-12fdd7e0cfe1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1568,
        -416
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 256,
        "content": "## Prerequisites\nCloud storage access; Gmail credentials; OpenAI API key; CLM system credentials; document processing license\n\n## Use Cases\nContract renewal tracking; compliance audits; risk management; vendor agreement reviews; regulatory adherence monitoring"
      },
      "typeVersion": 1
    },
    {
      "id": "6a146666-f535-4f93-9da0-81cb27471bd5",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2016,
        -416
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 240,
        "content": "## Customization\nAdjust risk thresholds; modify extraction rules; add Slack notifications; extend compliance frameworks \n\n## Benefits\nReduces review time 80%; catches compliance gaps; automates audit trails; "
      },
      "typeVersion": 1
    },
    {
      "id": "216ed68e-1ec1-4a58-a4c7-87e614d96272",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 384,
        "content": "## Schedule Contract Review Cycle\nTriggers workflow at defined intervals to batch-process contracts from repositories and inboxes\nWhy: Consistent review cadence prevents contracts from sitting unreviewed; "
      },
      "typeVersion": 1
    },
    {
      "id": "8d62765a-1404-4128-804a-17f02a76b3fa",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 768,
        "content": "## Fetch & Ingest Contracts\n\nRetrieves contracts from cloud storage (Google Drive, SharePoint, repositories) and captures email attachments from Gmail, all with version tracking.\n**Why:** Centralized intake prevents missing documents and ensures you always analyze the latest contract\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cefb4c45-9065-4125-8ad9-c64439e86255",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 720,
        "content": "## OCR + AI Content Extraction\n\nConverts PDFs/images into machine-readable text; AI extracts structured data: parties, dates, renewal/payment terms, liability caps.\n**Why:** Transforms unstructured contracts into queryable data; "
      },
      "typeVersion": 1
    },
    {
      "id": "c83f4f6c-e2dd-447a-b8b0-8d1229fe3c0a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 720,
        "content": "## Parse Obligations & Covenants\n\nIdentifies legal obligations: payment schedules, performance metrics, notices, termination conditions.\n**Why:** Extracting obligations prevents costly missed deadlines or SLA breaches buried in legal language."
      },
      "typeVersion": 1
    },
    {
      "id": "cdf8524b-da71-4e92-81a5-c20b3552e724",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 150,
        "height": 592,
        "content": "## Multi-Model Compliance Check\n\nRuns multiple AI models against GDPR, SOX, and industry-specific rules.\n**Why:** Parallel analysis catches gaps that a single model might miss.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "32db43e4-395b-4bb5-afa1-ce3aa15f131d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2064,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 176,
        "height": 464,
        "content": "## Calculate Risk Score\n\nAssigns numerical rating based on gap severity, financial exposure, regulatory penalties\n**Why:** Helps prioritize critical issues and enables smart triage."
      },
      "typeVersion": 1
    },
    {
      "id": "34b6ffb8-1447-4f12-a4f9-873c1a75f115",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2416,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 720,
        "content": "## Contract Risk Routing & Archiving\n\nRoutes contracts based on risk: high-risk to legal, medium-risk to compliance officers, and low-risk archived for audit.\n**Why:** Ensures critical issues get expert review, moderate gaps are evaluated appropriately"
      },
      "typeVersion": 1
    },
    {
      "id": "197a1873-0882-465c-9498-227b478b1c13",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2704,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 448,
        "content": "## CLM Integration & Compliance Tracking\n\nUpdates CLM with terms, risk scores, compliance status, and review dates; creates audit trails and logs extraction accuracy\n**Why:** Centralizes data, proves compliance, and improves AI over time.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0590d2ad-9ad7-4ae8-9f7d-3338b2f52591",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3200,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 448,
        "content": "## Alerts \n\nSummarizes contracts, risk levels, gaps, and deadlines\n**Why:** Gives leadership a clear view and ensures urgent issues reach decision-makers fast.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "80f22d9a-cb26-4a38-b532-9e59f676026a",
  "connections": {
    "OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Vector Store - Contract Clauses",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Update CLM System": {
      "main": [
        [
          {
            "node": "Update ERP System",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update ERP System": {
      "main": [
        [
          {
            "node": "Prepare Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Audit Trail": {
      "main": [
        [
          {
            "node": "Store Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Risk Level": {
      "main": [
        [
          {
            "node": "Alert - High Risk Contracts",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send to Dashboard API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Risk Score": {
      "main": [
        [
          {
            "node": "Store Compliance Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Dashboard API": {
      "main": [
        [
          {
            "node": "Update CLM System",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Contracts from Repository",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Contract Emails": {
      "main": [
        [
          {
            "node": "Merge All Contract Sources",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Contract Content": {
      "main": [
        [
          {
            "node": "Vector Store - Contract Clauses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Contract Review": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Compliance Results": {
      "main": [
        [
          {
            "node": "Route by Risk Level",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Contract Upload": {
      "main": [
        [
          {
            "node": "Merge All Contract Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Contract Sources": {
      "main": [
        [
          {
            "node": "Extract Contract Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Compliance Checker": {
      "main": [
        [
          {
            "node": "Calculate Risk Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Contracts from Repository": {
      "main": [
        [
          {
            "node": "Merge All Contract Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Splitter - Clause Chunking": {
      "ai_textSplitter": [
        [
          {
            "node": "Document Loader - Contract Processing",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store - Contract Clauses": {
      "main": [
        [
          {
            "node": "AI Agent - Compliance Checker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Loader - Contract Processing": {
      "ai_document": [
        [
          {
            "node": "Vector Store - Contract Clauses",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Structured Parser - Compliance Results": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - Compliance Checker",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model - Compliance Analysis": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Compliance Checker",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}