{
  "name": "Jimmy Decodes OPC — 4-Station Zero-Code B2B Fulfillment & Anti-Inversion Pipeline (v2026.11)",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": "opc_station1_7col_intake",
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "Station 1 · Tally / Feishu 7-Col Intake Webhook"
        },
        "notes": "Receives structured 7-column client order payload: Client_ID, Company_Name, Source_Channel, Pain_Option_ABC, Raw_Input_Payload, Monthly_Quota_Max, Current_Runs_Used."
      }
    },
    {
      "id": 2,
      "module": "builtin:BasicFilter",
      "version": 1,
      "parameters": {},
      "filter": {
        "name": "Station 2 · Anti-Inversion P95 Quota Guard (< 80% Cap)",
        "conditions": [
          [
            {
              "a": "{{1.Current_Runs_Used}}",
              "b": "{{1.Monthly_Quota_Max}}",
              "o": "number:less"
            },
            {
              "a": "{{1.Raw_Input_Payload}}",
              "o": "exist"
            }
          ]
        ]
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Station 2 · P95 Compute Quota & Margin Guard"
        },
        "notes": "Blocks runaway API calls if client has reached their P95 monthly run cap (>=70% gross margin protection)."
      }
    },
    {
      "id": 3,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true
      },
      "mapper": {
        "url": "https://api.deepseek.com/v1/chat/completions",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer {{env.DEEPSEEK_OR_HAIKU_API_KEY}}"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ],
        "bodyType": "raw",
        "contentType": "application/json",
        "data": "{\"model\": \"deepseek-chat\", \"temperature\": 0.0, \"response_format\": {\"type\": \"json_object\"}, \"messages\": [{\"role\": \"system\", \"content\": \"You are Station 3A (Low-Cost JSON Sanitizer). Extract only verified client facts, target KPIs, forbidden terms, and pain_score (1-10) from the raw intake. Never invent facts. Output strict JSON.\"}, {\"role\": \"user\", \"content\": \"{{1.Raw_Input_Payload}}\"}]}"
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Station 3A · Cheap Classifier (DeepSeek V3 / Haiku)"
        },
        "notes": "Cuts token spend by ~75% by cleaning and structuring raw input before calling Claude Sonnet 4.5."
      }
    },
    {
      "id": 4,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true
      },
      "mapper": {
        "url": "https://api.anthropic.com/v1/messages",
        "method": "post",
        "headers": [
          {
            "name": "x-api-key",
            "value": "{{env.ANTHROPIC_API_KEY}}"
          },
          {
            "name": "anthropic-version",
            "value": "2023-06-01"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          }
        ],
        "bodyType": "raw",
        "contentType": "application/json",
        "data": "{\"model\": \"claude-sonnet-4-5-20250929\", \"max_tokens\": 4096, \"temperature\": 0.2, \"system\": \"You are Station 3B (Executive B2B Deliverable Generator & Independent Fact-Check Auditor). Using ONLY the verified JSON from Station 3A, produce: (1) 3-Sentence Executive Verdict, (2) Before-vs-After Optimization Table, (3) Risk & Compliance Notes, and (4) Self-Audit Verification Log confirming 0 fabricated numbers.\", \"messages\": [{\"role\": \"user\", \"content\": \"Verified JSON Input: {{3.data}}\"}]}"
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0,
          "name": "Station 3B · Frontier Synthesis (Claude Sonnet 4.5)"
        },
        "notes": "Generates the high-margin B2B deliverable draft with strict write-audit separation."
      }
    },
    {
      "id": 5,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true
      },
      "mapper": {
        "url": "{{env.FEISHU_OR_NOTION_WEBHOOK_URL}}",
        "method": "post",
        "bodyType": "raw",
        "contentType": "application/json",
        "data": "{\"client_id\": \"{{1.Client_ID}}\", \"company\": \"{{1.Company_Name}}\", \"ai_draft\": \"{{4.data.content[0].text}}\", \"estimated_api_cost_usd\": 0.14, \"qa_status\": \"PENDING_3MIN_HUMAN_QA\", \"next_action\": \"Toggle [Human_QA_Approved = ✅] in Feishu/Notion to trigger Resend/WeCom delivery.\"}"
      },
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0,
          "name": "Station 4 · Write to 7-Col CRM & Await 3-Min Human QA"
        },
        "notes": "Never send unreviewed AI output straight to a paying B2B client. Holds in Feishu/Notion until operator clicks Approve."
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "sequential": false,
      "confidential": false
    },
    "author": "Jimmy Decodes (https://www.jimmydecodes.com/opc/)"
  }
}
